diff --git a/404.html b/404.html index 842c31cd..9b5b2543 100644 --- a/404.html +++ b/404.html @@ -9,14 +9,14 @@ - - - + + +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- - + + \ No newline at end of file diff --git a/CHANGELOG.html b/CHANGELOG.html index 2a73f709..b1841c26 100644 --- a/CHANGELOG.html +++ b/CHANGELOG.html @@ -1,20 +1,20 @@ -Version Changelogs & Updates | Dasar Pemrograman Rust +Version Changelogs & Updates | Dasar Pemrograman Rust - - - - + + + +
-
Skip to main content

Version Changelogs & Updates

📝 Release v1.0.20240731 (2024-07-31)

◉ Chapter baru

◉ Chapter update

  • Variabel
    • Penambahan penjelasan tentang variabel _
  • Tipe Data ➜ Result
    • Perbaikan konten
    • Penambahan penjelasan tentang tipe Result<T> dan Result<(), E>
    • Penambahan penjelasan tentang intro error handling di Rust
  • File, Path, Directory
    • Penambahan penjelasan terkait OS path ketika method .join() digunakan
    • Penambahan contoh operasi baca file ke string & vector
    • Penambahan sample source code yang sebelumnya tidak ada
    • Perbaikan syntax error
  • Traits
    • Chapter di-split menjadi 2, yaitu Traits dan Traits ➜ Advanced
    • Penambahan penjelasan tentang external traits vs internal traits
    • Perbaikan narasi konten
  • Attributes
    • Penambahan attribute configuration
    • Penambahan section macro cfg!() dan conditional compilation
    • Penambahan section configuration debug_assertions
    • Penambahan attribute linting: #[forbid]

◉ General update

  • Peningkatan keyword untuk keperluan SEO
  • Perubahan isi konten halaman utama
  • Perbaikan typo
- - +
Skip to main content

Version Changelogs & Updates

📝 Release v1.0.20240830 (2024-08-30)

◉ General update

  • Optimasi pagespeed

📝 Release v1.0.20240731 (2024-07-31)

◉ Chapter baru

◉ Chapter update

  • Variabel
    • Penambahan penjelasan tentang variabel _
  • Tipe Data ➜ Result
    • Perbaikan konten
    • Penambahan penjelasan tentang tipe Result<T> dan Result<(), E>
    • Penambahan penjelasan tentang intro error handling di Rust
  • File, Path, Directory
    • Penambahan penjelasan terkait OS path ketika method .join() digunakan
    • Penambahan contoh operasi baca file ke string & vector
    • Penambahan sample source code yang sebelumnya tidak ada
    • Perbaikan syntax error
  • Traits
    • Chapter di-split menjadi 2, yaitu Traits dan Traits ➜ Advanced
    • Penambahan penjelasan tentang external traits vs internal traits
    • Perbaikan narasi konten
  • Attributes
    • Penambahan attribute configuration
    • Penambahan section macro cfg!() dan conditional compilation
    • Penambahan section configuration debug_assertions
    • Penambahan attribute linting: #[forbid]

◉ General update

  • Peningkatan keyword untuk keperluan SEO
  • Perubahan isi konten halaman utama
  • Perbaikan typo
+ + \ No newline at end of file diff --git a/CONTRIBUTING.html b/CONTRIBUTING.html index 5296bf49..696883d0 100644 --- a/CONTRIBUTING.html +++ b/CONTRIBUTING.html @@ -7,14 +7,14 @@ - - - - + + + +
-
Skip to main content

Contribution & Tech Stack

Ebook Dasar Pemrograman Rust adalah project open source. Siapapun bebas untuk berkontribusi di sini, bisa dalam bentuk perbaikan typo, update kalimat, maupun submit tulisan baru.

Bagi kawan-kawan yang berminat untuk berkontribusi, silakan fork github.com/novalagung/dasarpemrogramanrust, kemudian langsung saja cek/buat issue kemudian submit relevan pull request untuk issue tersebut 😊

Checkout project

git clone https://github.com/novalagung/dasarpemrogramanrust.git
git submodule update --init --recursive --remote

Maintainer

E-book ini di-inisialisasi dan di-maintain oleh Noval Agung Prayogo.

Contributors

Berikut merupakan hall of fame kontributor yang sudah berbaik hati menyisihkan waktunya untuk membantu pengembangan e-book ini.

  1. Acep Saepudin
  2. Afifurrohman
  3. ardiantovn
  4. Fal
  5. Fredianto
  6. I Putu Saputrayana
  7. Indra Sah Noeldy
  8. Khisby Al Ghofari
  9. Lori
  10. M. Zakiyuddin Munziri
  11. Opa Kholis Majid
  12. Rian
  13. Shandy Siswandi
  14. Theis Andatu
  15. ... anda :-)

Ebook/webhook techstack & architecture

Jika pembaca tertarik untuk membuat konten ebook berbasis web sekaligus versi PDF file-nya, bisa menggunakan link berikut sebagai referensi:

https://medium.com/geekculture/serverless-e-book-web-book-using-docusaurus-v2-github-pages-actions-and-pdf-tools-4fef54847b85

Tools yang digunakan:

Desain arsitektur:

Dasar pemrograman python

- - +
Skip to main content

Contribution & Tech Stack

Ebook Dasar Pemrograman Rust adalah project open source. Siapapun bebas untuk berkontribusi di sini, bisa dalam bentuk perbaikan typo, update kalimat, maupun submit tulisan baru.

Bagi kawan-kawan yang berminat untuk berkontribusi, silakan fork github.com/novalagung/dasarpemrogramanrust, kemudian langsung saja cek/buat issue kemudian submit relevan pull request untuk issue tersebut 😊

Checkout project

git clone https://github.com/novalagung/dasarpemrogramanrust.git
git submodule update --init --recursive --remote

Maintainer

E-book ini di-inisialisasi dan di-maintain oleh Noval Agung Prayogo.

Contributors

Berikut merupakan hall of fame kontributor yang sudah berbaik hati menyisihkan waktunya untuk membantu pengembangan e-book ini.

  1. Acep Saepudin
  2. Afifurrohman
  3. ardiantovn
  4. Fal
  5. Fredianto
  6. I Putu Saputrayana
  7. Indra Sah Noeldy
  8. Khisby Al Ghofari
  9. Lori
  10. M. Zakiyuddin Munziri
  11. Opa Kholis Majid
  12. Rian
  13. Shandy Siswandi
  14. Theis Andatu
  15. ... anda :-)

Ebook/webhook techstack & architecture

Jika pembaca tertarik untuk membuat konten ebook berbasis web sekaligus versi PDF file-nya, bisa menggunakan link berikut sebagai referensi:

https://medium.com/geekculture/serverless-e-book-web-book-using-docusaurus-v2-github-pages-actions-and-pdf-tools-4fef54847b85

Tools yang digunakan:

Desain arsitektur:

Dasar pemrograman python

+ + \ No newline at end of file diff --git a/LICENSE.html b/LICENSE.html index 0e83eafc..b6e9cd48 100644 --- a/LICENSE.html +++ b/LICENSE.html @@ -7,14 +7,14 @@ - - - - + + + +
-
Skip to main content

Lisensi & Distribusi Konten

Ebook Dasar Pemrograman Rust gratis untuk disebarluaskan secara bebas, dengan catatan sesuai dengan aturan lisensi CC BY-SA 4.0 yang kurang lebih sebagai berikut:

  • Diperbolehkan menyebar, mencetak, dan menduplikasi material dalam konten ini ke siapapun.
  • Diperbolehkan memodifikasi, mengubah, atau membuat konten baru menggunakan material yang ada dalam ebook ini untuk keperluan komersil maupun tidak.

Dengan catatan:

  • Harus ada credit sumber aslinya, yaitu Dasar Pemrograman Rust atau novalagung
  • Tidak mengubah lisensi aslinya, yaitu CC BY-SA 4.0
  • Tidak ditambahi restrictions baru
  • Lebih jelasnya silakan cek https://creativecommons.org/licenses/by-sa/4.0/.

FOSSA Status

- - +
Skip to main content

Lisensi & Distribusi Konten

Ebook Dasar Pemrograman Rust gratis untuk disebarluaskan secara bebas, dengan catatan sesuai dengan aturan lisensi CC BY-SA 4.0 yang kurang lebih sebagai berikut:

  • Diperbolehkan menyebar, mencetak, dan menduplikasi material dalam konten ini ke siapapun.
  • Diperbolehkan memodifikasi, mengubah, atau membuat konten baru menggunakan material yang ada dalam ebook ini untuk keperluan komersil maupun tidak.

Dengan catatan:

  • Harus ada credit sumber aslinya, yaitu Dasar Pemrograman Rust atau novalagung
  • Tidak mengubah lisensi aslinya, yaitu CC BY-SA 4.0
  • Tidak ditambahi restrictions baru
  • Lebih jelasnya silakan cek https://creativecommons.org/licenses/by-sa/4.0/.

FOSSA Status

+ + \ No newline at end of file diff --git a/assets/css/styles.b9571daa.css b/assets/css/styles.c01241b2.css similarity index 99% rename from assets/css/styles.b9571daa.css rename to assets/css/styles.c01241b2.css index 2ce1b7b2..33657f3f 100644 --- a/assets/css/styles.b9571daa.css +++ b/assets/css/styles.c01241b2.css @@ -1 +1 @@ -.col,.container{padding:0 var(--ifm-spacing-horizontal);width:100%}.markdown li,body{word-wrap:break-word}body,ol ol,ol ul,ul ol,ul ul{margin:0}pre,table{overflow:auto}blockquote,pre{margin:0 0 var(--ifm-spacing-vertical)}.breadcrumbs__link,.button{transition-timing-function:var(--ifm-transition-timing-default)}.button,.hash-link{-webkit-user-select:none}.button,code{vertical-align:middle}.button--outline.button--active,.button--outline:active,.button--outline:hover,:root{--ifm-button-color:var(--ifm-font-color-base-inverse)}.avatar__photo,.card,.text--truncate{overflow:hidden}.menu__link:hover,a{transition:color var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.navbar--dark,:root{--ifm-navbar-link-hover-color:var(--ifm-color-primary)}.menu,.navbar-sidebar{overflow-x:hidden}:root,html[data-theme=dark]{--ifm-color-emphasis-500:var(--ifm-color-gray-500)}.markdown>h2,.markdown>h3,.markdown>h4,.markdown>h5,.markdown>h6,.theme-doc-markdown.markdown .section-footnote h2{margin-bottom:calc(var(--ifm-heading-vertical-rhythm-bottom)*var(--ifm-leading))}.markdown>h2,.theme-doc-markdown.markdown .section-footnote h2{margin-top:calc(var(--ifm-h2-vertical-rhythm-top)*var(--ifm-leading))}.toggleButton_gllP,html{-webkit-tap-highlight-color:transparent}*,.DocSearch-Container,.DocSearch-Container *{box-sizing:border-box}.DocSearch-Hit-content-wrapper,.text--truncate{text-overflow:ellipsis;white-space:nowrap}.button,.dropdown__link,.text--truncate,.theme-doc-markdown.markdown table td code{white-space:nowrap}:root{--ifm-color-scheme:light;--ifm-dark-value:10%;--ifm-darker-value:15%;--ifm-darkest-value:30%;--ifm-light-value:15%;--ifm-lighter-value:30%;--ifm-lightest-value:50%;--ifm-contrast-background-value:90%;--ifm-contrast-foreground-value:70%;--ifm-contrast-background-dark-value:70%;--ifm-contrast-foreground-dark-value:90%;--ifm-color-primary:#3578e5;--ifm-color-secondary:#ebedf0;--ifm-color-success:#00a400;--ifm-color-info:#54c7ec;--ifm-color-warning:#ffba00;--ifm-color-danger:#fa383e;--ifm-color-primary-dark:#306cce;--ifm-color-primary-darker:#2d66c3;--ifm-color-primary-darkest:#2554a0;--ifm-color-primary-light:#538ce9;--ifm-color-primary-lighter:#72a1ed;--ifm-color-primary-lightest:#9abcf2;--ifm-color-primary-contrast-background:#ebf2fc;--ifm-color-primary-contrast-foreground:#102445;--ifm-color-secondary-dark:#d4d5d8;--ifm-color-secondary-darker:#c8c9cc;--ifm-color-secondary-darkest:#a4a6a8;--ifm-color-secondary-light:#eef0f2;--ifm-color-secondary-lighter:#f1f2f5;--ifm-color-secondary-lightest:#f5f6f8;--ifm-color-secondary-contrast-background:#fdfdfe;--ifm-color-secondary-contrast-foreground:#474748;--ifm-color-success-dark:#009400;--ifm-color-success-darker:#008b00;--ifm-color-success-darkest:#007300;--ifm-color-success-light:#26b226;--ifm-color-success-lighter:#4dbf4d;--ifm-color-success-lightest:#80d280;--ifm-color-success-contrast-background:#e6f6e6;--ifm-color-success-contrast-foreground:#003100;--ifm-color-info-dark:#4cb3d4;--ifm-color-info-darker:#47a9c9;--ifm-color-info-darkest:#3b8ba5;--ifm-color-info-light:#6ecfef;--ifm-color-info-lighter:#87d8f2;--ifm-color-info-lightest:#aae3f6;--ifm-color-info-contrast-background:#eef9fd;--ifm-color-info-contrast-foreground:#193c47;--ifm-color-warning-dark:#e6a700;--ifm-color-warning-darker:#d99e00;--ifm-color-warning-darkest:#b38200;--ifm-color-warning-light:#ffc426;--ifm-color-warning-lighter:#ffcf4d;--ifm-color-warning-lightest:#ffdd80;--ifm-color-warning-contrast-background:#fff8e6;--ifm-color-warning-contrast-foreground:#4d3800;--ifm-color-danger-dark:#e13238;--ifm-color-danger-darker:#d53035;--ifm-color-danger-darkest:#af272b;--ifm-color-danger-light:#fb565b;--ifm-color-danger-lighter:#fb7478;--ifm-color-danger-lightest:#fd9c9f;--ifm-color-danger-contrast-background:#ffebec;--ifm-color-danger-contrast-foreground:#4b1113;--ifm-color-white:#fff;--ifm-color-black:#000;--ifm-color-gray-0:var(--ifm-color-white);--ifm-color-gray-100:#f5f6f7;--ifm-color-gray-200:#ebedf0;--ifm-color-gray-300:#dadde1;--ifm-color-gray-400:#ccd0d5;--ifm-color-gray-500:#bec3c9;--ifm-color-gray-600:#8d949e;--ifm-color-gray-700:#606770;--ifm-color-gray-800:#444950;--ifm-color-gray-900:#1c1e21;--ifm-color-gray-1000:var(--ifm-color-black);--ifm-color-emphasis-0:var(--ifm-color-gray-0);--ifm-color-emphasis-100:var(--ifm-color-gray-100);--ifm-color-emphasis-200:var(--ifm-color-gray-200);--ifm-color-emphasis-300:var(--ifm-color-gray-300);--ifm-color-emphasis-400:var(--ifm-color-gray-400);--ifm-color-emphasis-600:var(--ifm-color-gray-600);--ifm-color-emphasis-700:var(--ifm-color-gray-700);--ifm-color-emphasis-800:var(--ifm-color-gray-800);--ifm-color-emphasis-900:var(--ifm-color-gray-900);--ifm-color-emphasis-1000:var(--ifm-color-gray-1000);--ifm-color-content:var(--ifm-color-emphasis-900);--ifm-color-content-inverse:var(--ifm-color-emphasis-0);--ifm-color-content-secondary:#525860;--ifm-background-color:#0000;--ifm-background-surface-color:var(--ifm-color-content-inverse);--ifm-global-border-width:1px;--ifm-global-radius:0.4rem;--ifm-hover-overlay:#0000000d;--ifm-font-color-base:var(--ifm-color-content);--ifm-font-color-base-inverse:var(--ifm-color-content-inverse);--ifm-font-color-secondary:var(--ifm-color-content-secondary);--ifm-font-family-base:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--ifm-font-family-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--ifm-font-size-base:100%;--ifm-font-weight-light:300;--ifm-font-weight-normal:400;--ifm-font-weight-semibold:500;--ifm-font-weight-bold:700;--ifm-font-weight-base:var(--ifm-font-weight-normal);--ifm-line-height-base:1.65;--ifm-global-spacing:1rem;--ifm-spacing-vertical:var(--ifm-global-spacing);--ifm-spacing-horizontal:var(--ifm-global-spacing);--ifm-transition-fast:200ms;--ifm-transition-slow:400ms;--ifm-transition-timing-default:cubic-bezier(0.08,0.52,0.52,1);--ifm-global-shadow-lw:0 1px 2px 0 #0000001a;--ifm-global-shadow-md:0 5px 40px #0003;--ifm-global-shadow-tl:0 12px 28px 0 #0003,0 2px 4px 0 #0000001a;--ifm-z-index-dropdown:100;--ifm-z-index-fixed:200;--ifm-z-index-overlay:400;--ifm-container-width:1140px;--ifm-container-width-xl:1320px;--ifm-code-background:#f6f7f8;--ifm-code-border-radius:var(--ifm-global-radius);--ifm-code-font-size:90%;--ifm-code-padding-horizontal:0.1rem;--ifm-code-padding-vertical:0.1rem;--ifm-pre-background:var(--ifm-code-background);--ifm-pre-border-radius:var(--ifm-code-border-radius);--ifm-pre-color:inherit;--ifm-pre-line-height:1.45;--ifm-pre-padding:1rem;--ifm-heading-color:inherit;--ifm-heading-margin-top:0;--ifm-heading-margin-bottom:var(--ifm-spacing-vertical);--ifm-heading-font-family:var(--ifm-font-family-base);--ifm-heading-font-weight:var(--ifm-font-weight-bold);--ifm-heading-line-height:1.25;--ifm-h1-font-size:2rem;--ifm-h2-font-size:1.5rem;--ifm-h3-font-size:1.25rem;--ifm-h4-font-size:1rem;--ifm-h5-font-size:0.875rem;--ifm-h6-font-size:0.85rem;--ifm-image-alignment-padding:1.25rem;--ifm-leading-desktop:1.25;--ifm-leading:calc(var(--ifm-leading-desktop)*1rem);--ifm-list-left-padding:2rem;--ifm-list-margin:1rem;--ifm-list-item-margin:0.25rem;--ifm-list-paragraph-margin:1rem;--ifm-table-cell-padding:0.75rem;--ifm-table-background:#0000;--ifm-table-stripe-background:#00000008;--ifm-table-border-width:1px;--ifm-table-border-color:var(--ifm-color-emphasis-300);--ifm-table-head-background:inherit;--ifm-table-head-color:inherit;--ifm-table-head-font-weight:var(--ifm-font-weight-bold);--ifm-table-cell-color:inherit;--ifm-link-color:var(--ifm-color-primary);--ifm-link-decoration:none;--ifm-link-hover-color:var(--ifm-link-color);--ifm-link-hover-decoration:underline;--ifm-paragraph-margin-bottom:var(--ifm-leading);--ifm-blockquote-font-size:var(--ifm-font-size-base);--ifm-blockquote-border-left-width:2px;--ifm-blockquote-padding-horizontal:var(--ifm-spacing-horizontal);--ifm-blockquote-padding-vertical:0;--ifm-blockquote-shadow:none;--ifm-blockquote-color:var(--ifm-color-emphasis-800);--ifm-blockquote-border-color:var(--ifm-color-emphasis-300);--ifm-hr-background-color:var(--ifm-color-emphasis-500);--ifm-hr-height:1px;--ifm-hr-margin-vertical:1.5rem;--ifm-scrollbar-size:7px;--ifm-scrollbar-track-background-color:#f1f1f1;--ifm-scrollbar-thumb-background-color:silver;--ifm-scrollbar-thumb-hover-background-color:#a7a7a7;--ifm-alert-background-color:inherit;--ifm-alert-border-color:inherit;--ifm-alert-border-radius:var(--ifm-global-radius);--ifm-alert-border-width:0px;--ifm-alert-border-left-width:5px;--ifm-alert-color:var(--ifm-font-color-base);--ifm-alert-padding-horizontal:var(--ifm-spacing-horizontal);--ifm-alert-padding-vertical:var(--ifm-spacing-vertical);--ifm-alert-shadow:var(--ifm-global-shadow-lw);--ifm-avatar-intro-margin:1rem;--ifm-avatar-intro-alignment:inherit;--ifm-avatar-photo-size:3rem;--ifm-badge-background-color:inherit;--ifm-badge-border-color:inherit;--ifm-badge-border-radius:var(--ifm-global-radius);--ifm-badge-border-width:var(--ifm-global-border-width);--ifm-badge-color:var(--ifm-color-white);--ifm-badge-padding-horizontal:calc(var(--ifm-spacing-horizontal)*0.5);--ifm-badge-padding-vertical:calc(var(--ifm-spacing-vertical)*0.25);--ifm-breadcrumb-border-radius:1.5rem;--ifm-breadcrumb-spacing:0.5rem;--ifm-breadcrumb-color-active:var(--ifm-color-primary);--ifm-breadcrumb-item-background-active:var(--ifm-hover-overlay);--ifm-breadcrumb-padding-horizontal:0.8rem;--ifm-breadcrumb-padding-vertical:0.4rem;--ifm-breadcrumb-size-multiplier:1;--ifm-breadcrumb-separator:url('data:image/svg+xml;utf8,');--ifm-breadcrumb-separator-filter:none;--ifm-breadcrumb-separator-size:0.5rem;--ifm-breadcrumb-separator-size-multiplier:1.25;--ifm-button-background-color:inherit;--ifm-button-border-color:var(--ifm-button-background-color);--ifm-button-border-width:var(--ifm-global-border-width);--ifm-button-font-weight:var(--ifm-font-weight-bold);--ifm-button-padding-horizontal:1.5rem;--ifm-button-padding-vertical:0.375rem;--ifm-button-size-multiplier:1;--ifm-button-transition-duration:var(--ifm-transition-fast);--ifm-button-border-radius:calc(var(--ifm-global-radius)*var(--ifm-button-size-multiplier));--ifm-button-group-spacing:2px;--ifm-card-background-color:var(--ifm-background-surface-color);--ifm-card-border-radius:calc(var(--ifm-global-radius)*2);--ifm-card-horizontal-spacing:var(--ifm-global-spacing);--ifm-card-vertical-spacing:var(--ifm-global-spacing);--ifm-toc-border-color:var(--ifm-color-emphasis-300);--ifm-toc-link-color:var(--ifm-color-content-secondary);--ifm-toc-padding-vertical:0.5rem;--ifm-toc-padding-horizontal:0.5rem;--ifm-dropdown-background-color:var(--ifm-background-surface-color);--ifm-dropdown-font-weight:var(--ifm-font-weight-semibold);--ifm-dropdown-link-color:var(--ifm-font-color-base);--ifm-dropdown-hover-background-color:var(--ifm-hover-overlay);--ifm-footer-background-color:var(--ifm-color-emphasis-100);--ifm-footer-color:inherit;--ifm-footer-link-color:var(--ifm-color-emphasis-700);--ifm-footer-link-hover-color:var(--ifm-color-primary);--ifm-footer-link-horizontal-spacing:0.5rem;--ifm-footer-padding-horizontal:calc(var(--ifm-spacing-horizontal)*2);--ifm-footer-padding-vertical:calc(var(--ifm-spacing-vertical)*2);--ifm-footer-title-color:inherit;--ifm-footer-logo-max-width:min(30rem,90vw);--ifm-hero-background-color:var(--ifm-background-surface-color);--ifm-hero-text-color:var(--ifm-color-emphasis-800);--ifm-menu-color:var(--ifm-color-emphasis-700);--ifm-menu-color-active:var(--ifm-color-primary);--ifm-menu-color-background-active:var(--ifm-hover-overlay);--ifm-menu-color-background-hover:var(--ifm-hover-overlay);--ifm-menu-link-padding-horizontal:0.75rem;--ifm-menu-link-padding-vertical:0.375rem;--ifm-menu-link-sublist-icon:url('data:image/svg+xml;utf8,');--ifm-menu-link-sublist-icon-filter:none;--ifm-navbar-background-color:var(--ifm-background-surface-color);--ifm-navbar-height:3.75rem;--ifm-navbar-item-padding-horizontal:0.75rem;--ifm-navbar-item-padding-vertical:0.25rem;--ifm-navbar-link-color:var(--ifm-font-color-base);--ifm-navbar-link-active-color:var(--ifm-link-color);--ifm-navbar-padding-horizontal:var(--ifm-spacing-horizontal);--ifm-navbar-padding-vertical:calc(var(--ifm-spacing-vertical)*0.5);--ifm-navbar-shadow:var(--ifm-global-shadow-lw);--ifm-navbar-search-input-background-color:var(--ifm-color-emphasis-200);--ifm-navbar-search-input-color:var(--ifm-color-emphasis-800);--ifm-navbar-search-input-placeholder-color:var(--ifm-color-emphasis-500);--ifm-navbar-search-input-icon:url('data:image/svg+xml;utf8,');--ifm-navbar-sidebar-width:83vw;--ifm-pagination-border-radius:var(--ifm-global-radius);--ifm-pagination-color-active:var(--ifm-color-primary);--ifm-pagination-font-size:1rem;--ifm-pagination-item-active-background:var(--ifm-hover-overlay);--ifm-pagination-page-spacing:0.2em;--ifm-pagination-padding-horizontal:calc(var(--ifm-spacing-horizontal)*1);--ifm-pagination-padding-vertical:calc(var(--ifm-spacing-vertical)*0.25);--ifm-pagination-nav-border-radius:var(--ifm-global-radius);--ifm-pagination-nav-color-hover:var(--ifm-color-primary);--ifm-pills-color-active:var(--ifm-color-primary);--ifm-pills-color-background-active:var(--ifm-hover-overlay);--ifm-pills-spacing:0.125rem;--ifm-tabs-color:var(--ifm-font-color-secondary);--ifm-tabs-color-active:var(--ifm-color-primary);--ifm-tabs-color-active-border:var(--ifm-tabs-color-active);--ifm-tabs-padding-horizontal:1rem;--ifm-tabs-padding-vertical:1rem;--docusaurus-progress-bar-color:var(--ifm-color-primary);--ifm-color-primary:#2e8555;--ifm-color-primary-dark:#29784c;--ifm-color-primary-darker:#277148;--ifm-color-primary-darkest:#205d3b;--ifm-color-primary-light:#33925d;--ifm-color-primary-lighter:#359962;--ifm-color-primary-lightest:#3cad6e;--ifm-code-font-size:95%;--docusaurus-highlighted-code-line-bg:#0000001a;--doc-sidebar-width:400px!important;--ifm-blockquote-border-left-width:4px;--ifm-blockquote-border-color:#2e8555;--docusaurus-announcement-bar-height:auto;--docusaurus-tag-list-border:var(--ifm-color-emphasis-300);--docusaurus-collapse-button-bg:#0000;--docusaurus-collapse-button-bg-hover:#0000001a;--doc-sidebar-width:300px;--doc-sidebar-hidden-width:30px;--docsearch-primary-color:#5468ff;--docsearch-text-color:#1c1e21;--docsearch-spacing:12px;--docsearch-icon-stroke-width:1.4;--docsearch-highlight-color:var(--docsearch-primary-color);--docsearch-muted-color:#969faf;--docsearch-container-background:#656c85cc;--docsearch-logo-color:#5468ff;--docsearch-modal-width:560px;--docsearch-modal-height:600px;--docsearch-modal-background:#f5f6f7;--docsearch-modal-shadow:inset 1px 1px 0 0 #ffffff80,0 3px 8px 0 #555a64;--docsearch-searchbox-height:56px;--docsearch-searchbox-background:#ebedf0;--docsearch-searchbox-focus-background:#fff;--docsearch-searchbox-shadow:inset 0 0 0 2px var(--docsearch-primary-color);--docsearch-hit-height:56px;--docsearch-hit-color:#444950;--docsearch-hit-active-color:#fff;--docsearch-hit-background:#fff;--docsearch-hit-shadow:0 1px 3px 0 #d4d9e1;--docsearch-key-gradient:linear-gradient(-225deg,#d5dbe4,#f8f8f8);--docsearch-key-shadow:inset 0 -2px 0 0 #cdcde6,inset 0 0 1px 1px #fff,0 1px 2px 1px #1e235a66;--docsearch-footer-height:44px;--docsearch-footer-background:#fff;--docsearch-footer-shadow:0 -1px 0 0 #e0e3e8,0 -3px 6px 0 #45629b1f;--docsearch-primary-color:var(--ifm-color-primary);--docsearch-text-color:var(--ifm-font-color-base)}.badge--danger,.badge--info,.badge--primary,.badge--secondary,.badge--success,.badge--warning{--ifm-badge-border-color:var(--ifm-badge-background-color)}.button--link,.button--outline{--ifm-button-background-color:#0000}html{-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%;text-size-adjust:100%;background-color:var(--ifm-background-color);color:var(--ifm-font-color-base);color-scheme:var(--ifm-color-scheme);font:var(--ifm-font-size-base)/var(--ifm-line-height-base) var(--ifm-font-family-base);text-rendering:optimizelegibility}iframe{border:0;color-scheme:auto}.container{margin:0 auto;max-width:var(--ifm-container-width)}.container--fluid{max-width:inherit}.row{display:flex;flex-wrap:wrap;margin:0 calc(var(--ifm-spacing-horizontal)*-1)}.margin-bottom--none,.margin-vert--none,.markdown>:last-child{margin-bottom:0!important}.margin-top--none,.margin-vert--none{margin-top:0!important}.row--no-gutters{margin-left:0;margin-right:0}.margin-horiz--none,.margin-right--none{margin-right:0!important}.row--no-gutters>.col{padding-left:0;padding-right:0}.row--align-top{align-items:flex-start}.row--align-bottom{align-items:flex-end}.menuExternalLink_NmtK,.row--align-center{align-items:center}.row--align-stretch{align-items:stretch}.row--align-baseline{align-items:baseline}.col{--ifm-col-width:100%;flex:1 0;margin-left:0;max-width:var(--ifm-col-width)}.padding-bottom--none,.padding-vert--none{padding-bottom:0!important}.padding-top--none,.padding-vert--none{padding-top:0!important}.padding-horiz--none,.padding-left--none{padding-left:0!important}.padding-horiz--none,.padding-right--none{padding-right:0!important}.col[class*=col--]{flex:0 0 var(--ifm-col-width)}.col--1{--ifm-col-width:8.33333%}.col--offset-1{margin-left:8.33333%}.col--2{--ifm-col-width:16.66667%}.col--offset-2{margin-left:16.66667%}.col--3{--ifm-col-width:25%}.col--offset-3{margin-left:25%}.col--4{--ifm-col-width:33.33333%}.col--offset-4{margin-left:33.33333%}.col--5{--ifm-col-width:41.66667%}.col--offset-5{margin-left:41.66667%}.col--6{--ifm-col-width:50%}.col--offset-6{margin-left:50%}.col--7{--ifm-col-width:58.33333%}.col--offset-7{margin-left:58.33333%}.col--8{--ifm-col-width:66.66667%}.col--offset-8{margin-left:66.66667%}.col--9{--ifm-col-width:75%}.col--offset-9{margin-left:75%}.col--10{--ifm-col-width:83.33333%}.col--offset-10{margin-left:83.33333%}.col--11{--ifm-col-width:91.66667%}.col--offset-11{margin-left:91.66667%}.col--12{--ifm-col-width:100%}.col--offset-12{margin-left:100%}.margin-horiz--none,.margin-left--none{margin-left:0!important}.margin--none{margin:0!important}.margin-bottom--xs,.margin-vert--xs{margin-bottom:.25rem!important}.margin-top--xs,.margin-vert--xs{margin-top:.25rem!important}.margin-horiz--xs,.margin-left--xs{margin-left:.25rem!important}.margin-horiz--xs,.margin-right--xs{margin-right:.25rem!important}.margin--xs{margin:.25rem!important}.margin-bottom--sm,.margin-vert--sm{margin-bottom:.5rem!important}.margin-top--sm,.margin-vert--sm{margin-top:.5rem!important}.margin-horiz--sm,.margin-left--sm{margin-left:.5rem!important}.margin-horiz--sm,.margin-right--sm{margin-right:.5rem!important}.margin--sm{margin:.5rem!important}.margin-bottom--md,.margin-vert--md{margin-bottom:1rem!important}.margin-top--md,.margin-vert--md{margin-top:1rem!important}.margin-horiz--md,.margin-left--md{margin-left:1rem!important}.margin-horiz--md,.margin-right--md{margin-right:1rem!important}.margin--md{margin:1rem!important}.margin-bottom--lg,.margin-vert--lg{margin-bottom:2rem!important}.margin-top--lg,.margin-vert--lg{margin-top:2rem!important}.margin-horiz--lg,.margin-left--lg{margin-left:2rem!important}.margin-horiz--lg,.margin-right--lg{margin-right:2rem!important}.margin--lg{margin:2rem!important}.margin-bottom--xl,.margin-vert--xl{margin-bottom:5rem!important}.margin-top--xl,.margin-vert--xl{margin-top:5rem!important}.margin-horiz--xl,.margin-left--xl{margin-left:5rem!important}.margin-horiz--xl,.margin-right--xl{margin-right:5rem!important}.margin--xl{margin:5rem!important}.padding--none{padding:0!important}.padding-bottom--xs,.padding-vert--xs{padding-bottom:.25rem!important}.padding-top--xs,.padding-vert--xs{padding-top:.25rem!important}.padding-horiz--xs,.padding-left--xs{padding-left:.25rem!important}.padding-horiz--xs,.padding-right--xs{padding-right:.25rem!important}.padding--xs{padding:.25rem!important}.padding-bottom--sm,.padding-vert--sm{padding-bottom:.5rem!important}.padding-top--sm,.padding-vert--sm{padding-top:.5rem!important}.padding-horiz--sm,.padding-left--sm{padding-left:.5rem!important}.padding-horiz--sm,.padding-right--sm{padding-right:.5rem!important}.padding--sm{padding:.5rem!important}.padding-bottom--md,.padding-vert--md{padding-bottom:1rem!important}.padding-top--md,.padding-vert--md{padding-top:1rem!important}.padding-horiz--md,.padding-left--md{padding-left:1rem!important}.padding-horiz--md,.padding-right--md{padding-right:1rem!important}.padding--md{padding:1rem!important}.padding-bottom--lg,.padding-vert--lg{padding-bottom:2rem!important}.padding-top--lg,.padding-vert--lg{padding-top:2rem!important}.padding-horiz--lg,.padding-left--lg{padding-left:2rem!important}.padding-horiz--lg,.padding-right--lg{padding-right:2rem!important}.padding--lg{padding:2rem!important}.padding-bottom--xl,.padding-vert--xl{padding-bottom:5rem!important}.padding-top--xl,.padding-vert--xl{padding-top:5rem!important}.padding-horiz--xl,.padding-left--xl{padding-left:5rem!important}.padding-horiz--xl,.padding-right--xl{padding-right:5rem!important}.padding--xl{padding:5rem!important}code{background-color:var(--ifm-code-background);border:.1rem solid #0000001a;border-radius:var(--ifm-code-border-radius);font-family:var(--ifm-font-family-monospace);font-size:var(--ifm-code-font-size);padding:var(--ifm-code-padding-vertical) var(--ifm-code-padding-horizontal)}a code{color:inherit}pre{background-color:var(--ifm-pre-background);border-radius:var(--ifm-pre-border-radius);color:var(--ifm-pre-color);font:var(--ifm-code-font-size)/var(--ifm-pre-line-height) var(--ifm-font-family-monospace);padding:var(--ifm-pre-padding)}pre code{background-color:initial;border:none;font-size:100%;line-height:inherit;padding:0}kbd{background-color:var(--ifm-color-emphasis-0);border:1px solid var(--ifm-color-emphasis-400);border-radius:.2rem;box-shadow:inset 0 -1px 0 var(--ifm-color-emphasis-400);color:var(--ifm-color-emphasis-800);font:80% var(--ifm-font-family-monospace);padding:.15rem .3rem}.text--italic,blockquote{font-style:italic}h1,h2,h3,h4,h5,h6{color:var(--ifm-heading-color);font-family:var(--ifm-heading-font-family);font-weight:var(--ifm-heading-font-weight);line-height:var(--ifm-heading-line-height);margin:var(--ifm-heading-margin-top) 0 var(--ifm-heading-margin-bottom) 0}h1{font-size:var(--ifm-h1-font-size)}h2{font-size:var(--ifm-h2-font-size)}h3{font-size:var(--ifm-h3-font-size)}h4{font-size:var(--ifm-h4-font-size)}h5{font-size:var(--ifm-h5-font-size)}h6{font-size:var(--ifm-h6-font-size)}img{max-width:100%}img[align=right]{padding-left:var(--image-alignment-padding)}img[align=left]{padding-right:var(--image-alignment-padding)}.markdown{--ifm-h1-vertical-rhythm-top:3;--ifm-h2-vertical-rhythm-top:2;--ifm-h3-vertical-rhythm-top:1.5;--ifm-heading-vertical-rhythm-top:1.25;--ifm-h1-vertical-rhythm-bottom:1.25;--ifm-heading-vertical-rhythm-bottom:1}.markdown:after,.markdown:before{content:"";display:table}.markdown:after{clear:both}.markdown h1:first-child{--ifm-h1-font-size:3rem;margin-bottom:calc(var(--ifm-h1-vertical-rhythm-bottom)*var(--ifm-leading));font-weight:400}.markdown>h2{--ifm-h2-font-size:2rem;--ifm-h2-font-size:1.7rem}.markdown>h3{--ifm-h3-font-size:1.5rem;margin-top:calc(var(--ifm-h3-vertical-rhythm-top)*var(--ifm-leading));--ifm-h3-font-size:1.3rem}.markdown>h4,.markdown>h5,.markdown>h6{margin-top:calc(var(--ifm-heading-vertical-rhythm-top)*var(--ifm-leading))}.markdown>p,.markdown>pre,.markdown>ul{margin-bottom:var(--ifm-leading)}.markdown li>p{margin-top:var(--ifm-list-paragraph-margin)}.markdown li+li{margin-top:var(--ifm-list-item-margin)}ol,ul{margin:0 0 var(--ifm-list-margin);padding-left:var(--ifm-list-left-padding)}ol ol,ul ol{list-style-type:lower-roman}ol ol ol,ol ul ol,ul ol ol,ul ul ol{list-style-type:lower-alpha}table{border-collapse:collapse;display:block;margin-bottom:var(--ifm-spacing-vertical)}table thead tr{border-bottom:2px solid var(--ifm-table-border-color)}table thead,table tr:nth-child(2n){background-color:var(--ifm-table-stripe-background)}table tr{background-color:var(--ifm-table-background);border-top:var(--ifm-table-border-width) solid var(--ifm-table-border-color)}table td,table th{border:var(--ifm-table-border-width) solid var(--ifm-table-border-color);padding:var(--ifm-table-cell-padding)}table th{background-color:var(--ifm-table-head-background);color:var(--ifm-table-head-color);font-weight:var(--ifm-table-head-font-weight)}table td{color:var(--ifm-table-cell-color)}strong{font-weight:var(--ifm-font-weight-bold)}a{color:var(--ifm-link-color);text-decoration:var(--ifm-link-decoration)}a:hover{color:var(--ifm-link-hover-color);text-decoration:var(--ifm-link-hover-decoration)}.button:hover,.text--no-decoration,.text--no-decoration:hover,a:not([href]){text-decoration:none}p{margin:0 0 var(--ifm-paragraph-margin-bottom)}blockquote{border-left:var(--ifm-blockquote-border-left-width) solid var(--ifm-blockquote-border-color);box-shadow:var(--ifm-blockquote-shadow);color:var(--ifm-blockquote-color);font-size:var(--ifm-blockquote-font-size);padding:var(--ifm-blockquote-padding-vertical) var(--ifm-blockquote-padding-horizontal);background-color:#fbfbfb;margin-left:15px;padding:15px}blockquote>:first-child{margin-top:0}blockquote>:last-child{margin-bottom:0}hr{background-color:var(--ifm-hr-background-color);border:0;height:var(--ifm-hr-height);margin:var(--ifm-hr-margin-vertical) 0}.shadow--lw{box-shadow:var(--ifm-global-shadow-lw)!important}.shadow--md{box-shadow:var(--ifm-global-shadow-md)!important}.shadow--tl{box-shadow:var(--ifm-global-shadow-tl)!important}.text--primary,.wordWrapButtonEnabled_EoeP .wordWrapButtonIcon_Bwma{color:var(--ifm-color-primary)}.text--secondary{color:var(--ifm-color-secondary)}.text--success{color:var(--ifm-color-success)}.text--info{color:var(--ifm-color-info)}.text--warning{color:var(--ifm-color-warning)}.text--danger{color:var(--ifm-color-danger)}.text--center,.theme-doc-markdown.markdown table tr td.align-center,.theme-doc-markdown.markdown table tr th.align-center{text-align:center}.text--left{text-align:left}.text--justify{text-align:justify}.text--right{text-align:right}.text--capitalize{text-transform:capitalize}.text--lowercase{text-transform:lowercase}.admonitionHeading_tbUL,.alert__heading,.text--uppercase{text-transform:uppercase}.text--light{font-weight:var(--ifm-font-weight-light)}.text--normal{font-weight:var(--ifm-font-weight-normal)}.text--semibold{font-weight:var(--ifm-font-weight-semibold)}.text--bold{font-weight:var(--ifm-font-weight-bold)}.text--break{word-wrap:break-word!important;word-break:break-word!important}.clean-btn{background:none;border:none;color:inherit;cursor:pointer;font-family:inherit;padding:0}.alert,.alert .close{color:var(--ifm-alert-foreground-color)}.clean-list{list-style:none;padding-left:0}.alert--primary{--ifm-alert-background-color:var(--ifm-color-primary-contrast-background);--ifm-alert-background-color-highlight:#3578e526;--ifm-alert-foreground-color:var(--ifm-color-primary-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-primary-dark)}.alert--secondary{--ifm-alert-background-color:var(--ifm-color-secondary-contrast-background);--ifm-alert-background-color-highlight:#ebedf026;--ifm-alert-foreground-color:var(--ifm-color-secondary-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-secondary-dark)}.alert--success{--ifm-alert-background-color:var(--ifm-color-success-contrast-background);--ifm-alert-background-color-highlight:#00a40026;--ifm-alert-foreground-color:var(--ifm-color-success-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-success-dark)}.alert--info{--ifm-alert-background-color:var(--ifm-color-info-contrast-background);--ifm-alert-background-color-highlight:#54c7ec26;--ifm-alert-foreground-color:var(--ifm-color-info-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-info-dark)}.alert--warning{--ifm-alert-background-color:var(--ifm-color-warning-contrast-background);--ifm-alert-background-color-highlight:#ffba0026;--ifm-alert-foreground-color:var(--ifm-color-warning-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-warning-dark)}.alert--danger{--ifm-alert-background-color:var(--ifm-color-danger-contrast-background);--ifm-alert-background-color-highlight:#fa383e26;--ifm-alert-foreground-color:var(--ifm-color-danger-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-danger-dark)}.alert{--ifm-code-background:var(--ifm-alert-background-color-highlight);--ifm-link-color:var(--ifm-alert-foreground-color);--ifm-link-hover-color:var(--ifm-alert-foreground-color);--ifm-link-decoration:underline;--ifm-tabs-color:var(--ifm-alert-foreground-color);--ifm-tabs-color-active:var(--ifm-alert-foreground-color);--ifm-tabs-color-active-border:var(--ifm-alert-border-color);background-color:var(--ifm-alert-background-color);border:var(--ifm-alert-border-width) solid var(--ifm-alert-border-color);border-left-width:var(--ifm-alert-border-left-width);border-radius:var(--ifm-alert-border-radius);box-shadow:var(--ifm-alert-shadow);padding:var(--ifm-alert-padding-vertical) var(--ifm-alert-padding-horizontal)}.alert__heading{align-items:center;display:flex;font:700 var(--ifm-h5-font-size)/var(--ifm-heading-line-height) var(--ifm-heading-font-family);margin-bottom:.5rem}.alert__icon{display:inline-flex;margin-right:.4em}.alert__icon svg{fill:var(--ifm-alert-foreground-color);stroke:var(--ifm-alert-foreground-color);stroke-width:0}.alert .close{margin:calc(var(--ifm-alert-padding-vertical)*-1) calc(var(--ifm-alert-padding-horizontal)*-1) 0 0;opacity:.75}.alert .close:focus,.alert .close:hover{opacity:1}.alert a{text-decoration-color:var(--ifm-alert-border-color)}.alert a:hover{text-decoration-thickness:2px}.avatar{column-gap:var(--ifm-avatar-intro-margin);display:flex}.avatar__photo{border-radius:50%;display:block;height:var(--ifm-avatar-photo-size);width:var(--ifm-avatar-photo-size)}.card--full-height,.navbar__logo img,body,html{height:100%}.avatar__photo--sm{--ifm-avatar-photo-size:2rem}.avatar__photo--lg{--ifm-avatar-photo-size:4rem}.avatar__photo--xl{--ifm-avatar-photo-size:6rem}.avatar__intro{display:flex;flex:1 1;flex-direction:column;justify-content:center;text-align:var(--ifm-avatar-intro-alignment)}.badge,.breadcrumbs__item,.breadcrumbs__link,.button,.dropdown>.navbar__link:after{display:inline-block}.avatar__name{font:700 var(--ifm-h4-font-size)/var(--ifm-heading-line-height) var(--ifm-font-family-base)}.avatar__subtitle{margin-top:.25rem}.avatar--vertical{--ifm-avatar-intro-alignment:center;--ifm-avatar-intro-margin:0.5rem;align-items:center;flex-direction:column}.badge{background-color:var(--ifm-badge-background-color);border:var(--ifm-badge-border-width) solid var(--ifm-badge-border-color);border-radius:var(--ifm-badge-border-radius);color:var(--ifm-badge-color);font-size:75%;font-weight:var(--ifm-font-weight-bold);line-height:1;padding:var(--ifm-badge-padding-vertical) var(--ifm-badge-padding-horizontal)}.badge--primary{--ifm-badge-background-color:var(--ifm-color-primary)}.badge--secondary{--ifm-badge-background-color:var(--ifm-color-secondary);color:var(--ifm-color-black)}.breadcrumbs__link,.button.button--secondary.button--outline:not(.button--active):not(:hover){color:var(--ifm-font-color-base)}.badge--success{--ifm-badge-background-color:var(--ifm-color-success)}.badge--info{--ifm-badge-background-color:var(--ifm-color-info)}.badge--warning{--ifm-badge-background-color:var(--ifm-color-warning)}.badge--danger{--ifm-badge-background-color:var(--ifm-color-danger)}.breadcrumbs{margin-bottom:0;padding-left:0}.breadcrumbs__item:not(:last-child):after{background:var(--ifm-breadcrumb-separator) center;content:" ";display:inline-block;filter:var(--ifm-breadcrumb-separator-filter);height:calc(var(--ifm-breadcrumb-separator-size)*var(--ifm-breadcrumb-size-multiplier)*var(--ifm-breadcrumb-separator-size-multiplier));margin:0 var(--ifm-breadcrumb-spacing);opacity:.5;width:calc(var(--ifm-breadcrumb-separator-size)*var(--ifm-breadcrumb-size-multiplier)*var(--ifm-breadcrumb-separator-size-multiplier))}.breadcrumbs__item--active .breadcrumbs__link{background:var(--ifm-breadcrumb-item-background-active);color:var(--ifm-breadcrumb-color-active)}.breadcrumbs__link{border-radius:var(--ifm-breadcrumb-border-radius);font-size:calc(1rem*var(--ifm-breadcrumb-size-multiplier));padding:calc(var(--ifm-breadcrumb-padding-vertical)*var(--ifm-breadcrumb-size-multiplier)) calc(var(--ifm-breadcrumb-padding-horizontal)*var(--ifm-breadcrumb-size-multiplier));transition-duration:var(--ifm-transition-fast);transition-property:background,color}.breadcrumbs__link:any-link:hover,.breadcrumbs__link:link:hover,.breadcrumbs__link:visited:hover,area.breadcrumbs__link[href]:hover{background:var(--ifm-breadcrumb-item-background-active);text-decoration:none}.breadcrumbs--sm{--ifm-breadcrumb-size-multiplier:0.8}.breadcrumbs--lg{--ifm-breadcrumb-size-multiplier:1.2}.button{background-color:var(--ifm-button-background-color);border:var(--ifm-button-border-width) solid var(--ifm-button-border-color);border-radius:var(--ifm-button-border-radius);cursor:pointer;font-size:calc(.875rem*var(--ifm-button-size-multiplier));font-weight:var(--ifm-button-font-weight);line-height:1.5;padding:calc(var(--ifm-button-padding-vertical)*var(--ifm-button-size-multiplier)) calc(var(--ifm-button-padding-horizontal)*var(--ifm-button-size-multiplier));text-align:center;transition-duration:var(--ifm-button-transition-duration);transition-property:color,background,border-color;user-select:none}.dropdown,.theme-doc-markdown.markdown table tr td.vertical-align-top,.theme-doc-markdown.markdown table.custom-table.top tr td{vertical-align:top}.button,.button:hover{color:var(--ifm-button-color)}.button--outline{--ifm-button-color:var(--ifm-button-border-color)}.button--outline:hover{--ifm-button-background-color:var(--ifm-button-border-color)}.button--link{--ifm-button-border-color:#0000;color:var(--ifm-link-color);text-decoration:var(--ifm-link-decoration)}.button--link.button--active,.button--link:active,.button--link:hover{color:var(--ifm-link-hover-color);text-decoration:var(--ifm-link-hover-decoration)}.button.disabled,.button:disabled,.button[disabled]{opacity:.65;pointer-events:none}.button--sm{--ifm-button-size-multiplier:0.8}.button--lg{--ifm-button-size-multiplier:1.35}.button--block{display:block;width:100%}.button.button--secondary{color:var(--ifm-color-gray-900)}:where(.button--primary){--ifm-button-background-color:var(--ifm-color-primary);--ifm-button-border-color:var(--ifm-color-primary)}:where(.button--primary):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-primary-dark);--ifm-button-border-color:var(--ifm-color-primary-dark)}.button--primary.button--active,.button--primary:active{--ifm-button-background-color:var(--ifm-color-primary-darker);--ifm-button-border-color:var(--ifm-color-primary-darker)}:where(.button--secondary){--ifm-button-background-color:var(--ifm-color-secondary);--ifm-button-border-color:var(--ifm-color-secondary)}:where(.button--secondary):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-secondary-dark);--ifm-button-border-color:var(--ifm-color-secondary-dark)}.button--secondary.button--active,.button--secondary:active{--ifm-button-background-color:var(--ifm-color-secondary-darker);--ifm-button-border-color:var(--ifm-color-secondary-darker)}:where(.button--success){--ifm-button-background-color:var(--ifm-color-success);--ifm-button-border-color:var(--ifm-color-success)}:where(.button--success):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-success-dark);--ifm-button-border-color:var(--ifm-color-success-dark)}.button--success.button--active,.button--success:active{--ifm-button-background-color:var(--ifm-color-success-darker);--ifm-button-border-color:var(--ifm-color-success-darker)}:where(.button--info){--ifm-button-background-color:var(--ifm-color-info);--ifm-button-border-color:var(--ifm-color-info)}:where(.button--info):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-info-dark);--ifm-button-border-color:var(--ifm-color-info-dark)}.button--info.button--active,.button--info:active{--ifm-button-background-color:var(--ifm-color-info-darker);--ifm-button-border-color:var(--ifm-color-info-darker)}:where(.button--warning){--ifm-button-background-color:var(--ifm-color-warning);--ifm-button-border-color:var(--ifm-color-warning)}:where(.button--warning):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-warning-dark);--ifm-button-border-color:var(--ifm-color-warning-dark)}.button--warning.button--active,.button--warning:active{--ifm-button-background-color:var(--ifm-color-warning-darker);--ifm-button-border-color:var(--ifm-color-warning-darker)}:where(.button--danger){--ifm-button-background-color:var(--ifm-color-danger);--ifm-button-border-color:var(--ifm-color-danger)}:where(.button--danger):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-danger-dark);--ifm-button-border-color:var(--ifm-color-danger-dark)}.button--danger.button--active,.button--danger:active{--ifm-button-background-color:var(--ifm-color-danger-darker);--ifm-button-border-color:var(--ifm-color-danger-darker)}.button-group{display:inline-flex;gap:var(--ifm-button-group-spacing)}.button-group>.button:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.button-group>.button:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.button-group--block{display:flex;justify-content:stretch}.button-group--block>.button{flex-grow:1}.card{background-color:var(--ifm-card-background-color);border-radius:var(--ifm-card-border-radius);box-shadow:var(--ifm-global-shadow-lw);display:flex;flex-direction:column}.card__image{padding-top:var(--ifm-card-vertical-spacing)}.card__image:first-child{padding-top:0}.card__body,.card__footer,.card__header{padding:var(--ifm-card-vertical-spacing) var(--ifm-card-horizontal-spacing)}.card__body:not(:last-child),.card__footer:not(:last-child),.card__header:not(:last-child){padding-bottom:0}.card__body>:last-child,.card__footer>:last-child,.card__header>:last-child{margin-bottom:0}.card__footer{margin-top:auto}.table-of-contents{font-size:.8rem;margin-bottom:0;padding:var(--ifm-toc-padding-vertical) 0}.table-of-contents,.table-of-contents ul{list-style:none;padding-left:var(--ifm-toc-padding-horizontal)}.table-of-contents li{margin:var(--ifm-toc-padding-vertical) var(--ifm-toc-padding-horizontal)}.table-of-contents__left-border{border-left:1px solid var(--ifm-toc-border-color)}.table-of-contents__link{color:var(--ifm-toc-link-color);display:block}.table-of-contents__link--active,.table-of-contents__link--active code,.table-of-contents__link:hover,.table-of-contents__link:hover code{color:var(--ifm-color-primary);text-decoration:none}.close{color:var(--ifm-color-black);float:right;font-size:1.5rem;font-weight:var(--ifm-font-weight-bold);line-height:1;opacity:.5;padding:1rem;transition:opacity var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.close:hover{opacity:.7}.close:focus,.theme-code-block-highlighted-line .codeLineNumber_Tfdd:before{opacity:.8}.dropdown{display:inline-flex;font-weight:var(--ifm-dropdown-font-weight);position:relative}.dropdown--hoverable:hover .dropdown__menu,.dropdown--show .dropdown__menu{opacity:1;pointer-events:all;transform:translateY(-1px);visibility:visible}#nprogress,.dropdown__menu,.ebook-wrapper .ebook.ebook-current a,.navbar__item.dropdown .navbar__link:not([href]){pointer-events:none}.dropdown--right .dropdown__menu{left:inherit;right:0}.dropdown--nocaret .navbar__link:after{content:none!important}.dropdown__menu{background-color:var(--ifm-dropdown-background-color);border-radius:var(--ifm-global-radius);box-shadow:var(--ifm-global-shadow-md);left:0;list-style:none;max-height:80vh;min-width:10rem;opacity:0;overflow-y:auto;padding:.5rem;position:absolute;top:calc(100% - var(--ifm-navbar-item-padding-vertical) + .3rem);transform:translateY(-.625rem);transition-duration:var(--ifm-transition-fast);transition-property:opacity,transform,visibility;transition-timing-function:var(--ifm-transition-timing-default);visibility:hidden;z-index:var(--ifm-z-index-dropdown)}.menu__caret,.menu__link,.menu__list-item-collapsible{border-radius:.25rem;transition:background var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.dropdown__link{border-radius:.25rem;color:var(--ifm-dropdown-link-color);display:block;font-size:.875rem;margin-top:.2rem;padding:.25rem .5rem}.dropdown__link--active,.dropdown__link:hover{background-color:var(--ifm-dropdown-hover-background-color);color:var(--ifm-dropdown-link-color);text-decoration:none}.dropdown__link--active,.dropdown__link--active:hover{--ifm-dropdown-link-color:var(--ifm-link-color)}.dropdown>.navbar__link:after{border-color:currentcolor #0000;border-style:solid;border-width:.4em .4em 0;content:"";margin-left:.3em;position:relative;top:2px;transform:translateY(-50%)}.footer{background-color:var(--ifm-footer-background-color);color:var(--ifm-footer-color);padding:var(--ifm-footer-padding-vertical) var(--ifm-footer-padding-horizontal)}.footer--dark{--ifm-footer-background-color:#303846;--ifm-footer-color:var(--ifm-footer-link-color);--ifm-footer-link-color:var(--ifm-color-secondary);--ifm-footer-title-color:var(--ifm-color-white)}.footer__links{margin-bottom:1rem}.footer__link-item{color:var(--ifm-footer-link-color);line-height:2}.footer__link-item:hover{color:var(--ifm-footer-link-hover-color)}.footer__link-separator{margin:0 var(--ifm-footer-link-horizontal-spacing)}.footer__logo{margin-top:1rem;max-width:var(--ifm-footer-logo-max-width)}.footer__title{color:var(--ifm-footer-title-color);font:700 var(--ifm-h4-font-size)/var(--ifm-heading-line-height) var(--ifm-font-family-base);margin-bottom:var(--ifm-heading-margin-bottom)}.menu,.navbar__link{font-weight:var(--ifm-font-weight-semibold)}.docItemContainer_Djhp article>:first-child,.docItemContainer_Djhp header+*,.footer__item{margin-top:0}.admonitionContent_S0QG>:last-child,.collapsibleContent_i85q>:last-child,.footer__items,.theme-doc-markdown.markdown table td>div{margin-bottom:0}.codeBlockStandalone_MEMb,[type=checkbox]{padding:0}.hero{align-items:center;background-color:var(--ifm-hero-background-color);color:var(--ifm-hero-text-color);display:flex;padding:4rem 2rem}.hero--primary{--ifm-hero-background-color:var(--ifm-color-primary);--ifm-hero-text-color:var(--ifm-font-color-base-inverse)}.hero--dark{--ifm-hero-background-color:#303846;--ifm-hero-text-color:var(--ifm-color-white)}.hero__title{font-size:3rem}.hero__subtitle{font-size:1.5rem}.menu__list{list-style:none;margin:0;padding-left:0}.menu__caret,.menu__link{padding:var(--ifm-menu-link-padding-vertical) var(--ifm-menu-link-padding-horizontal)}.menu__list .menu__list{flex:0 0 100%;margin-top:.25rem;padding-left:var(--ifm-menu-link-padding-horizontal)}.menu__list-item:not(:first-child){margin-top:.25rem}.menu__list-item--collapsed .menu__list{height:0;overflow:hidden}.details_lb9f[data-collapsed=false].isBrowser_bmU9>summary:before,.details_lb9f[open]:not(.isBrowser_bmU9)>summary:before,.menu__list-item--collapsed .menu__caret:before,.menu__list-item--collapsed .menu__link--sublist:after{transform:rotate(90deg)}.menu__list-item-collapsible{display:flex;flex-wrap:wrap;position:relative}.menu__caret:hover,.menu__link:hover,.menu__list-item-collapsible--active,.menu__list-item-collapsible:hover{background:var(--ifm-menu-color-background-hover)}.menu__list-item-collapsible .menu__link--active,.menu__list-item-collapsible .menu__link:hover{background:none!important}.menu__caret,.menu__link{align-items:center;display:flex}.menu__link{color:var(--ifm-menu-color);flex:1;line-height:1.25}.menu__link:hover{color:var(--ifm-menu-color);text-decoration:none}.menu__caret:before,.menu__link--sublist-caret:after{height:1.25rem;transform:rotate(180deg);transition:transform var(--ifm-transition-fast) linear;width:1.25rem;filter:var(--ifm-menu-link-sublist-icon-filter);content:""}.menu__link--sublist-caret:after{background:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem;margin-left:auto;min-width:1.25rem}.menu__link--active,.menu__link--active:hover{color:var(--ifm-menu-color-active)}.navbar__brand,.navbar__link{color:var(--ifm-navbar-link-color)}.menu__link--active:not(.menu__link--sublist){background-color:var(--ifm-menu-color-background-active)}.menu__caret:before{background:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem}.navbar--dark,html[data-theme=dark]{--ifm-menu-link-sublist-icon-filter:invert(100%) sepia(94%) saturate(17%) hue-rotate(223deg) brightness(104%) contrast(98%)}.navbar{background-color:var(--ifm-navbar-background-color);box-shadow:var(--ifm-navbar-shadow);height:var(--ifm-navbar-height);padding:var(--ifm-navbar-padding-vertical) var(--ifm-navbar-padding-horizontal)}.docsWrapper_BCFX,.navbar,.navbar>.container,.navbar>.container-fluid{display:flex}.navbar--fixed-top{position:sticky;top:0;z-index:var(--ifm-z-index-fixed)}.navbar-sidebar,.navbar-sidebar__backdrop{bottom:0;opacity:0;position:fixed;transition-timing-function:ease-in-out;left:0;top:0;visibility:hidden}.navbar__inner{display:flex;flex-wrap:wrap;justify-content:space-between;width:100%}.navbar__brand{align-items:center;display:flex;min-width:0}.navbar__brand:hover{color:var(--ifm-navbar-link-hover-color);text-decoration:none}.announcementBarContent_xLdY,.navbar__title{flex:1 1 auto}.navbar__toggle{display:none;margin-right:.5rem}.navbar__logo{flex:0 0 auto;height:2rem;margin-right:.5rem}.navbar__items{align-items:center;display:flex;flex:1;min-width:0}.navbar__items--center{flex:0 0 auto}.navbar__items--center .navbar__brand,.theme-doc-markdown.markdown table.custom-table tr td>*{margin:0}.navbar__items--center+.navbar__items--right{flex:1}.navbar__items--right{flex:0 0 auto;justify-content:flex-end}.navbar__items--right>:last-child{padding-right:0}.navbar__item{display:inline-block;padding:var(--ifm-navbar-item-padding-vertical) var(--ifm-navbar-item-padding-horizontal)}.navbar__link--active,.navbar__link:hover{color:var(--ifm-navbar-link-hover-color);text-decoration:none}.navbar--dark,.navbar--primary{--ifm-menu-color:var(--ifm-color-gray-300);--ifm-navbar-link-color:var(--ifm-color-gray-100);--ifm-navbar-search-input-background-color:#ffffff1a;--ifm-navbar-search-input-placeholder-color:#ffffff80;color:var(--ifm-color-white)}.navbar--dark{--ifm-navbar-background-color:#242526;--ifm-menu-color-background-active:#ffffff0d;--ifm-navbar-search-input-color:var(--ifm-color-white)}.navbar--primary{--ifm-navbar-background-color:var(--ifm-color-primary);--ifm-navbar-link-hover-color:var(--ifm-color-white);--ifm-menu-color-active:var(--ifm-color-white);--ifm-navbar-search-input-color:var(--ifm-color-emphasis-500)}.navbar__search-input{-webkit-appearance:none;appearance:none;background:var(--ifm-navbar-search-input-background-color) var(--ifm-navbar-search-input-icon) no-repeat .75rem center/1rem 1rem;border:none;border-radius:2rem;color:var(--ifm-navbar-search-input-color);cursor:text;display:inline-block;font-size:.9rem;height:2rem;padding:0 .5rem 0 2.25rem;width:12.5rem}.navbar__search-input::placeholder{color:var(--ifm-navbar-search-input-placeholder-color)}.navbar-sidebar{background-color:var(--ifm-navbar-background-color);box-shadow:var(--ifm-global-shadow-md);transform:translate3d(-100%,0,0);transition-duration:.25s;transition-property:opacity,visibility,transform;width:var(--ifm-navbar-sidebar-width)}.navbar-sidebar--show .navbar-sidebar,.navbar-sidebar__items{transform:translateZ(0)}.navbar-sidebar--show .navbar-sidebar,.navbar-sidebar--show .navbar-sidebar__backdrop{opacity:1;visibility:visible}.navbar-sidebar__backdrop{background-color:#0009;right:0;transition-duration:.1s;transition-property:opacity,visibility}.navbar-sidebar__brand{align-items:center;box-shadow:var(--ifm-navbar-shadow);display:flex;flex:1;height:var(--ifm-navbar-height);padding:var(--ifm-navbar-padding-vertical) var(--ifm-navbar-padding-horizontal)}.navbar-sidebar__items{display:flex;height:calc(100% - var(--ifm-navbar-height));transition:transform var(--ifm-transition-fast) ease-in-out}.navbar-sidebar__items--show-secondary{transform:translate3d(calc((var(--ifm-navbar-sidebar-width))*-1),0,0)}.navbar-sidebar__item{flex-shrink:0;padding:.5rem;width:calc(var(--ifm-navbar-sidebar-width))}.navbar-sidebar__back{background:var(--ifm-menu-color-background-active);font-size:15px;font-weight:var(--ifm-button-font-weight);margin:0 0 .2rem -.5rem;padding:.6rem 1.5rem;position:relative;text-align:left;top:-.5rem;width:calc(100% + 1rem)}.navbar-sidebar__close{display:flex;margin-left:auto}.pagination{column-gap:var(--ifm-pagination-page-spacing);display:flex;font-size:var(--ifm-pagination-font-size);padding-left:0}.pagination--sm{--ifm-pagination-font-size:0.8rem;--ifm-pagination-padding-horizontal:0.8rem;--ifm-pagination-padding-vertical:0.2rem}.pagination--lg{--ifm-pagination-font-size:1.2rem;--ifm-pagination-padding-horizontal:1.2rem;--ifm-pagination-padding-vertical:0.3rem}.pagination__item{display:inline-flex}.pagination__item>span{padding:var(--ifm-pagination-padding-vertical)}.pagination__item--active .pagination__link{color:var(--ifm-pagination-color-active)}.pagination__item--active .pagination__link,.pagination__item:not(.pagination__item--active):hover .pagination__link{background:var(--ifm-pagination-item-active-background)}.pagination__item--disabled,.pagination__item[disabled]{opacity:.25;pointer-events:none}.pagination__link{border-radius:var(--ifm-pagination-border-radius);color:var(--ifm-font-color-base);display:inline-block;padding:var(--ifm-pagination-padding-vertical) var(--ifm-pagination-padding-horizontal);transition:background var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.pagination__link:hover{text-decoration:none}.pagination-nav{grid-gap:var(--ifm-spacing-horizontal);display:grid;gap:var(--ifm-spacing-horizontal);grid-template-columns:repeat(2,1fr)}.pagination-nav__link{border:1px solid var(--ifm-color-emphasis-300);border-radius:var(--ifm-pagination-nav-border-radius);display:block;height:100%;line-height:var(--ifm-heading-line-height);padding:var(--ifm-global-spacing);transition:border-color var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.pagination-nav__link:hover{border-color:var(--ifm-pagination-nav-color-hover);text-decoration:none}.pagination-nav__link--next{grid-column:2/3;text-align:right}.pagination-nav__label{font-size:var(--ifm-h4-font-size);font-weight:var(--ifm-heading-font-weight);word-break:break-word}.pagination-nav__link--prev .pagination-nav__label:before{content:"« "}.pagination-nav__link--next .pagination-nav__label:after{content:" »"}.pagination-nav__sublabel{color:var(--ifm-color-content-secondary);font-size:var(--ifm-h5-font-size);font-weight:var(--ifm-font-weight-semibold);margin-bottom:.25rem}.pills__item,.tabs{font-weight:var(--ifm-font-weight-bold)}.pills{display:flex;gap:var(--ifm-pills-spacing);padding-left:0}.pills__item{border-radius:.5rem;cursor:pointer;display:inline-block;padding:.25rem 1rem;transition:background var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.tabs,:not(.containsTaskList_mC6p>li)>.containsTaskList_mC6p{padding-left:0}.pills__item--active{color:var(--ifm-pills-color-active)}.pills__item--active,.pills__item:not(.pills__item--active):hover{background:var(--ifm-pills-color-background-active)}.pills--block{justify-content:stretch}.pills--block .pills__item{flex-grow:1;text-align:center}.tabs{color:var(--ifm-tabs-color);display:flex;margin-bottom:0;overflow-x:auto}.tabs__item{border-bottom:3px solid #0000;border-radius:var(--ifm-global-radius);cursor:pointer;display:inline-flex;padding:var(--ifm-tabs-padding-vertical) var(--ifm-tabs-padding-horizontal);transition:background-color var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.tabs__item--active{border-bottom-color:var(--ifm-tabs-color-active-border);border-bottom-left-radius:0;border-bottom-right-radius:0;color:var(--ifm-tabs-color-active)}.tabs__item:hover{background-color:var(--ifm-hover-overlay)}.tabs--block{justify-content:stretch}.tabs--block .tabs__item{flex-grow:1;justify-content:center}html[data-theme=dark]{--ifm-color-scheme:dark;--ifm-color-emphasis-0:var(--ifm-color-gray-1000);--ifm-color-emphasis-100:var(--ifm-color-gray-900);--ifm-color-emphasis-200:var(--ifm-color-gray-800);--ifm-color-emphasis-300:var(--ifm-color-gray-700);--ifm-color-emphasis-400:var(--ifm-color-gray-600);--ifm-color-emphasis-600:var(--ifm-color-gray-400);--ifm-color-emphasis-700:var(--ifm-color-gray-300);--ifm-color-emphasis-800:var(--ifm-color-gray-200);--ifm-color-emphasis-900:var(--ifm-color-gray-100);--ifm-color-emphasis-1000:var(--ifm-color-gray-0);--ifm-background-color:#1b1b1d;--ifm-background-surface-color:#242526;--ifm-hover-overlay:#ffffff0d;--ifm-color-content:#e3e3e3;--ifm-color-content-secondary:#fff;--ifm-breadcrumb-separator-filter:invert(64%) sepia(11%) saturate(0%) hue-rotate(149deg) brightness(99%) contrast(95%);--ifm-code-background:#ffffff1a;--ifm-scrollbar-track-background-color:#444;--ifm-scrollbar-thumb-background-color:#686868;--ifm-scrollbar-thumb-hover-background-color:#7a7a7a;--ifm-table-stripe-background:#ffffff12;--ifm-toc-border-color:var(--ifm-color-emphasis-200);--ifm-color-primary-contrast-background:#102445;--ifm-color-primary-contrast-foreground:#ebf2fc;--ifm-color-secondary-contrast-background:#474748;--ifm-color-secondary-contrast-foreground:#fdfdfe;--ifm-color-success-contrast-background:#003100;--ifm-color-success-contrast-foreground:#e6f6e6;--ifm-color-info-contrast-background:#193c47;--ifm-color-info-contrast-foreground:#eef9fd;--ifm-color-warning-contrast-background:#4d3800;--ifm-color-warning-contrast-foreground:#fff8e6;--ifm-color-danger-contrast-background:#4b1113;--ifm-color-danger-contrast-foreground:#ffebec;--docsearch-text-color:#f5f6f7;--docsearch-container-background:#090a11cc;--docsearch-modal-background:#15172a;--docsearch-modal-shadow:inset 1px 1px 0 0 #2c2e40,0 3px 8px 0 #000309;--docsearch-searchbox-background:#090a11;--docsearch-searchbox-focus-background:#000;--docsearch-hit-color:#bec3c9;--docsearch-hit-shadow:none;--docsearch-hit-background:#090a11;--docsearch-key-gradient:linear-gradient(-26.5deg,#565872,#31355b);--docsearch-key-shadow:inset 0 -2px 0 0 #282d55,inset 0 0 1px 1px #51577d,0 2px 2px 0 #0304094d;--docsearch-footer-background:#1e2136;--docsearch-footer-shadow:inset 0 1px 0 0 #494c6a80,0 -4px 8px 0 #0003;--docsearch-logo-color:#fff;--docsearch-muted-color:#7f8497}#nprogress .bar{background:var(--docusaurus-progress-bar-color);height:2px;left:0;position:fixed;top:0;width:100%;z-index:1031}#nprogress .peg{box-shadow:0 0 10px var(--docusaurus-progress-bar-color),0 0 5px var(--docusaurus-progress-bar-color);height:100%;opacity:1;position:absolute;right:0;transform:rotate(3deg) translateY(-4px);width:100px}.menu__link{padding-right:0!important}.theme-doc-markdown.markdown hr,.theme-doc-markdown.markdown+hr{background-color:#eee;margin-bottom:40px;margin-top:40px}[data-theme=dark] blockquote{background-color:#282a36}.theme-code-block[class*=language-]{border-radius:0!important;color:#fff!important;font-size:.9em!important;background:#2e8555!important}.theme-code-block[class*=language-]>div>pre{border-radius:0}.theme-code-block[class*=language-]>div>pre>code>span{display:block;margin-bottom:1px}.navbar__brand{margin-right:1.5rem}.aa-DetachedSearchButton{background-color:#fff;border-color:#d5d8da!important;height:33px;width:100px!important}.aa-DetachedSearchButton .aa-DetachedSearchButtonIcon{color:#d5d8da}.aa-DetachedSearchButton .aa-DetachedSearchButtonIcon .aa-DetachedSearchButtonPlaceholder,.ebook-wrapper .ebook.ebook-current .ebook-checkmark,.tocCollapsibleContent_vkbj a{display:block}.aa-DetachedSearchButton .aa-DetachedSearchButtonIcon .aa-DetachedSearchButtonPlaceholder:after{content:"Search ..."}.token-line .token.comment{font-style:normal!important}.menu.thin-scrollbar{padding-bottom:25px}.theme-doc-markdown.markdown a{font-weight:500}.theme-doc-markdown.markdown .section-footnote h3{margin-top:calc(var(--ifm-h3-vertical-rhythm-top)*var(--ifm-leading))}.table-of-contents li a>code,.theme-doc-markdown.markdown h1>code,.theme-doc-markdown.markdown h2>code,.theme-doc-markdown.markdown h3>code,.theme-doc-markdown.markdown li>code,.theme-doc-markdown.markdown p>code,.theme-doc-markdown.markdown td>code{padding:2px 5px}.theme-doc-markdown.markdown table.custom-table.full{display:table;width:100%}.theme-doc-markdown.markdown table.custom-table tr:nth-child(2n){background-color:initial!important}.theme-doc-markdown.markdown table tr td>.theme-code-block:nth-of-type(n+1){margin-top:10px}.theme-doc-markdown.markdown table.no-content-background tr:nth-child(2n){background-color:initial}.substack-iframe{background:#fff;border:1px solid #eee}.disqus-wrapper{margin-top:30px}.ebook-wrapper{display:block;margin-top:40px;text-align:center}.ebook-wrapper h3{margin-bottom:10px}.ebook-wrapper h3 .underline{border-bottom:1px solid #c2c2c2;padding-bottom:2px}.ebook-wrapper .ebook{display:inline-block;margin:5px;padding:10px;position:relative;vertical-align:top;width:200px}.ebook-wrapper .ebook a{color:#000;cursor:pointer;display:block}.ebook-wrapper .ebook .ebook-checkmark{display:none;font-size:30px;left:-10px;position:absolute;top:-15px}.ebook-wrapper .ebook.ebook-current{cursor:no-drop}.ebook-wrapper .ebook .ebook-img{box-shadow:0 2px 8px 0 #63636333;display:block;margin-bottom:10px}.ebook-wrapper .ebook:not(.ebook-current):hover .ebook-img{box-shadow:0 3px 9px 0 #63636380}.ebook-wrapper .ebook .ebook-title{display:inline-block;font-style:italic;font-weight:var(--ifm-h3-font-size);opacity:.8;text-align:center}.ebook-wrapper .ebook:not(.ebook-current):hover .ebook-title,.footerLogoLink_BH7S:hover,.hash-link:focus,:hover>.hash-link{opacity:1}[data-theme=dark]{--ifm-color-primary:#25c2a0;--ifm-color-primary-dark:#21af90;--ifm-color-primary-darker:#1fa588;--ifm-color-primary-darkest:#1a8870;--ifm-color-primary-light:#29d5b0;--ifm-color-primary-lighter:#32d8b4;--ifm-color-primary-lightest:#4fddbf;--docusaurus-highlighted-code-line-bg:#0000004d}body:not(.navigation-with-keyboard) :not(input):focus{outline:0}#docusaurus-base-url-issue-banner-container,.themedImage_ToTc,[data-theme=dark] .lightToggleIcon_pyhR,[data-theme=light] .darkToggleIcon_wfgR,html[data-announcement-bar-initially-dismissed=true] .announcementBar_mb4j{display:none}.skipToContent_fXgn{background-color:var(--ifm-background-surface-color);color:var(--ifm-color-emphasis-900);left:100%;padding:calc(var(--ifm-global-spacing)/2) var(--ifm-global-spacing);position:fixed;top:1rem;z-index:calc(var(--ifm-z-index-fixed) + 1)}.skipToContent_fXgn:focus{box-shadow:var(--ifm-global-shadow-md);left:1rem}.closeButton_CVFx{line-height:0;padding:0}.content_knG7{font-size:85%;padding:5px 0;text-align:center}.content_knG7 a{color:inherit;text-decoration:underline}.DocSearch-Container a,.tag_zVej:hover{text-decoration:none}.announcementBar_mb4j{align-items:center;background-color:var(--ifm-color-white);border-bottom:1px solid var(--ifm-color-emphasis-100);color:var(--ifm-color-black);display:flex;height:var(--docusaurus-announcement-bar-height)}.announcementBarPlaceholder_vyr4{flex:0 0 10px}.announcementBarClose_gvF7{align-self:stretch;flex:0 0 30px}.toggle_vylO{height:2rem;width:2rem}.toggleButton_gllP{align-items:center;border-radius:50%;display:flex;height:100%;justify-content:center;transition:background var(--ifm-transition-fast);width:100%}.toggleButton_gllP:hover{background:var(--ifm-color-emphasis-200)}.toggleButtonDisabled_aARS{cursor:not-allowed}[data-theme=dark] .themedImage--dark_i4oU,[data-theme=light] .themedImage--light_HNdA{display:initial}.iconExternalLink_nPIU{margin-left:.3rem}.iconLanguage_nlXk{margin-right:5px;vertical-align:text-bottom}.navbarHideable_m1mJ{transition:transform var(--ifm-transition-fast) ease}.navbarHidden_jGov{transform:translate3d(0,calc(-100% - 2px),0)}.footerLogoLink_BH7S{opacity:.5;transition:opacity var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.mainWrapper_z2l0{flex:1 0 auto}.docusaurus-mt-lg{margin-top:3rem}#__docusaurus{display:flex;flex-direction:column;min-height:100%}.iconEdit_Z9Sw{margin-right:.3em;vertical-align:sub}.tag_zVej{border:1px solid var(--docusaurus-tag-list-border);transition:border var(--ifm-transition-fast)}.tag_zVej:hover{--docusaurus-tag-list-border:var(--ifm-link-color)}.tagRegular_sFm0{border-radius:var(--ifm-global-radius);font-size:90%;padding:.2rem .5rem .3rem}.tagWithCount_h2kH{align-items:center;border-left:0;display:flex;padding:0 .5rem 0 1rem;position:relative}.tagWithCount_h2kH:after,.tagWithCount_h2kH:before{border:1px solid var(--docusaurus-tag-list-border);content:"";position:absolute;top:50%;transition:inherit}.tagWithCount_h2kH:before{border-bottom:0;border-right:0;height:1.18rem;right:100%;transform:translate(50%,-50%) rotate(-45deg);width:1.18rem}.tagWithCount_h2kH:after{border-radius:50%;height:.5rem;left:0;transform:translateY(-50%);width:.5rem}.tagWithCount_h2kH span{background:var(--ifm-color-secondary);border-radius:var(--ifm-global-radius);color:var(--ifm-color-black);font-size:.7rem;line-height:1.2;margin-left:.3rem;padding:.1rem .4rem}.tags_jXut{display:inline}.tag_QGVx{display:inline-block;margin:0 .4rem .5rem 0}.lastUpdated_vwxv{font-size:smaller;font-style:italic;margin-top:.2rem}.tocCollapsibleButton_TO0P{align-items:center;display:flex;font-size:inherit;justify-content:space-between;padding:.4rem .8rem;width:100%}.tocCollapsibleButton_TO0P:after{background:var(--ifm-menu-link-sublist-icon) 50% 50%/2rem 2rem no-repeat;content:"";filter:var(--ifm-menu-link-sublist-icon-filter);height:1.25rem;transform:rotate(180deg);transition:transform var(--ifm-transition-fast);width:1.25rem}.tocCollapsibleButtonExpanded_MG3E:after,.tocCollapsibleExpanded_sAul{transform:none}.tocCollapsible_ETCw{background-color:var(--ifm-menu-color-background-active);border-radius:var(--ifm-global-radius);margin:1rem 0}.buttonGroup__atx button,.codeBlockContainer_Ckt0{background:var(--prism-background-color);color:var(--prism-color)}.tocCollapsibleContent_vkbj>ul{border-left:none;border-top:1px solid var(--ifm-color-emphasis-300);font-size:15px;padding:.2rem 0}.tocCollapsibleContent_vkbj ul li{margin:.4rem .8rem}.tableOfContents_bqdL{max-height:calc(100vh - var(--ifm-navbar-height) - 2rem);overflow-y:auto;position:sticky;top:calc(var(--ifm-navbar-height) + 1rem)}.anchorWithStickyNavbar_LWe7{scroll-margin-top:calc(var(--ifm-navbar-height) + .5rem)}.anchorWithHideOnScrollNavbar_WYt5{scroll-margin-top:.5rem}.hash-link{opacity:0;padding-left:.5rem;transition:opacity var(--ifm-transition-fast);user-select:none}.hash-link:before{content:"#"}.codeBlockContainer_Ckt0{border-radius:var(--ifm-code-border-radius);box-shadow:var(--ifm-global-shadow-lw);margin-bottom:var(--ifm-leading)}.codeBlockContent_biex{border-radius:inherit;direction:ltr;position:relative}.codeBlockTitle_Ktv7{border-bottom:1px solid var(--ifm-color-emphasis-300);border-top-left-radius:inherit;border-top-right-radius:inherit;font-size:var(--ifm-code-font-size);font-weight:500;padding:.75rem var(--ifm-pre-padding)}.codeBlock_bY9V{--ifm-pre-background:var(--prism-background-color);margin:0;padding:0}.codeBlockTitle_Ktv7+.codeBlockContent_biex .codeBlock_bY9V{border-top-left-radius:0;border-top-right-radius:0}.codeBlockLines_e6Vv{float:left;font:inherit;min-width:100%;padding:var(--ifm-pre-padding)}.codeBlockLinesWithNumbering_o6Pm{display:table;padding:var(--ifm-pre-padding) 0}.buttonGroup__atx{column-gap:.2rem;display:flex;position:absolute;right:calc(var(--ifm-pre-padding)/2);top:calc(var(--ifm-pre-padding)/2)}.buttonGroup__atx button{align-items:center;border:1px solid var(--ifm-color-emphasis-300);border-radius:var(--ifm-global-radius);display:flex;line-height:0;opacity:0;padding:.4rem;transition:opacity .2s ease-in-out}.buttonGroup__atx button:focus-visible,.buttonGroup__atx button:hover{opacity:1!important}.theme-code-block:hover .buttonGroup__atx button{opacity:.4}:where(:root){--docusaurus-highlighted-code-line-bg:#484d5b}:where([data-theme=dark]){--docusaurus-highlighted-code-line-bg:#646464}.theme-code-block-highlighted-line{background-color:var(--docusaurus-highlighted-code-line-bg);display:block;margin:0 calc(var(--ifm-pre-padding)*-1);padding:0 var(--ifm-pre-padding)}.codeLine_lJS_{counter-increment:a;display:table-row}.codeLineNumber_Tfdd{background:var(--ifm-pre-background);display:table-cell;left:0;overflow-wrap:normal;padding:0 var(--ifm-pre-padding);position:sticky;text-align:right;width:1%}.codeLineNumber_Tfdd:before{content:counter(a);opacity:.4}.codeLineContent_feaV{padding-right:var(--ifm-pre-padding)}.theme-code-block:hover .copyButtonCopied_obH4{opacity:1!important}.copyButtonIcons_eSgA{height:1.125rem;position:relative;width:1.125rem}.copyButtonIcon_y97N,.copyButtonSuccessIcon_LjdS{fill:currentColor;height:inherit;left:0;opacity:inherit;position:absolute;top:0;transition:.15s;width:inherit}.copyButtonSuccessIcon_LjdS{color:#00d600;left:50%;opacity:0;top:50%;transform:translate(-50%,-50%) scale(.33)}.copyButtonCopied_obH4 .copyButtonIcon_y97N{opacity:0;transform:scale(.33)}.copyButtonCopied_obH4 .copyButtonSuccessIcon_LjdS{opacity:1;transform:translate(-50%,-50%) scale(1);transition-delay:75ms}.wordWrapButtonIcon_Bwma{height:1.2rem;width:1.2rem}.details_lb9f{--docusaurus-details-summary-arrow-size:0.38rem;--docusaurus-details-transition:transform 200ms ease;--docusaurus-details-decoration-color:grey}.details_lb9f>summary{cursor:pointer;list-style:none;padding-left:1rem;position:relative}.details_lb9f>summary::-webkit-details-marker{display:none}.details_lb9f>summary:before{border-color:#0000 #0000 #0000 var(--docusaurus-details-decoration-color);border-style:solid;border-width:var(--docusaurus-details-summary-arrow-size);content:"";left:0;position:absolute;top:.45rem;transform:rotate(0);transform-origin:calc(var(--docusaurus-details-summary-arrow-size)/2) 50%;transition:var(--docusaurus-details-transition)}.collapsibleContent_i85q{border-top:1px solid var(--docusaurus-details-decoration-color);margin-top:1rem;padding-top:1rem}.details_b_Ee{--docusaurus-details-decoration-color:var(--ifm-alert-border-color);--docusaurus-details-transition:transform var(--ifm-transition-fast) ease;border:1px solid var(--ifm-alert-border-color);margin:0 0 var(--ifm-spacing-vertical)}.containsTaskList_mC6p{list-style:none}.img_ev3q{height:auto}.admonition_LlT9{margin-bottom:1em}.admonitionHeading_tbUL{font:var(--ifm-heading-font-weight) var(--ifm-h5-font-size)/var(--ifm-heading-line-height) var(--ifm-heading-font-family);margin-bottom:.3rem}.admonitionHeading_tbUL code{text-transform:none}.admonitionIcon_kALy{display:inline-block;margin-right:.4em;vertical-align:middle}.admonitionIcon_kALy svg{fill:var(--ifm-alert-foreground-color);display:inline-block;height:1.6em;width:1.6em}.breadcrumbsContainer_Z_bl{--ifm-breadcrumb-size-multiplier:0.8;margin-bottom:.8rem}.breadcrumbHomeIcon_OVgt{height:1.1rem;position:relative;top:1px;vertical-align:top;width:1.1rem}.searchQueryInput_u2C7,.searchVersionInput_m0Ui{background:var(--docsearch-searchbox-focus-background);border:2px solid var(--ifm-toc-border-color);border-radius:var(--ifm-global-radius);color:var(--docsearch-text-color);font:var(--ifm-font-size-base) var(--ifm-font-family-base);margin-bottom:.5rem;padding:.8rem;transition:border var(--ifm-transition-fast) ease;width:100%}.searchQueryInput_u2C7:focus,.searchVersionInput_m0Ui:focus{border-color:var(--docsearch-primary-color);outline:0}.searchQueryInput_u2C7::placeholder{color:var(--docsearch-muted-color)}.searchResultsColumn_JPFH{font-size:.9rem;font-weight:700}.algoliaLogo_rT1R{max-width:150px}.algoliaLogoPathFill_WdUC{fill:var(--ifm-font-color-base)}.searchResultItem_Tv2o{border-bottom:1px solid var(--ifm-toc-border-color);padding:1rem 0}.searchResultItemHeading_KbCB{font-weight:400;margin-bottom:0}.searchResultItemPath_lhe1{--ifm-breadcrumb-separator-size-multiplier:1;color:var(--ifm-color-content-secondary);font-size:.8rem}.searchResultItemSummary_AEaO{font-style:italic;margin:.5rem 0 0}.loadingSpinner_XVxU{animation:1s linear infinite a;border:.4em solid #eee;border-radius:50%;border-top:.4em solid var(--ifm-color-primary);height:3rem;margin:0 auto;width:3rem}@keyframes a{to{transform:rotate(1turn)}}.loader_vvXV{margin-top:2rem}.search-result-match{background:#ffd78e40;color:var(--docsearch-hit-color);padding:.09em 0}.backToTopButton_sjWU{background-color:var(--ifm-color-emphasis-200);border-radius:50%;bottom:1.3rem;box-shadow:var(--ifm-global-shadow-lw);height:3rem;opacity:0;position:fixed;right:1.3rem;transform:scale(0);transition:all var(--ifm-transition-fast) var(--ifm-transition-timing-default);visibility:hidden;width:3rem;z-index:calc(var(--ifm-z-index-fixed) - 1)}.backToTopButton_sjWU:after{background-color:var(--ifm-color-emphasis-1000);content:" ";display:inline-block;height:100%;-webkit-mask:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem no-repeat;mask:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem no-repeat;width:100%}.backToTopButtonShow_xfvO{opacity:1;transform:scale(1);visibility:visible}[data-theme=dark]:root{--docusaurus-collapse-button-bg:#ffffff0d;--docusaurus-collapse-button-bg-hover:#ffffff1a}.collapseSidebarButton_PEFL,.docSidebarContainer_b6E3,.sidebarLogo_isFc{display:none}.docMainContainer_gTbr,.docPage__5DB{display:flex;width:100%}.DocSearch-Button{align-items:center;background:var(--docsearch-searchbox-background);border:0;border-radius:40px;color:var(--docsearch-muted-color);cursor:pointer;display:flex;font-weight:500;height:36px;justify-content:space-between;padding:0 8px;-webkit-user-select:none;user-select:none}.DocSearch-Button:active,.DocSearch-Button:focus,.DocSearch-Button:hover{background:var(--docsearch-searchbox-focus-background);box-shadow:var(--docsearch-searchbox-shadow);color:var(--docsearch-text-color);outline:0}.DocSearch-Button-Container{align-items:center;display:flex}.DocSearch-Search-Icon{stroke-width:1.6}.DocSearch-Hit-Tree,.DocSearch-Hit-action,.DocSearch-Hit-icon,.DocSearch-Reset{stroke-width:var(--docsearch-icon-stroke-width)}.DocSearch-Button .DocSearch-Search-Icon{color:var(--docsearch-text-color)}.DocSearch-Button-Placeholder{font-size:1rem;padding:0 12px 0 6px}.DocSearch-Input,.DocSearch-Link{-webkit-appearance:none;font:inherit}.DocSearch-Button-Keys{display:flex;min-width:calc(40px + .8em)}.DocSearch-Button-Key{align-items:center;background:var(--docsearch-key-gradient);border:0;border-radius:3px;box-shadow:var(--docsearch-key-shadow);color:var(--docsearch-muted-color);display:flex;height:18px;justify-content:center;margin-right:.4em;padding:0 0 2px;position:relative;top:-1px;width:20px}.DocSearch--active{overflow:hidden!important}.DocSearch-Container{background-color:var(--docsearch-container-background);height:100vh;left:0;position:fixed;top:0;width:100vw;z-index:200}.DocSearch-Link{appearance:none;background:none;border:0;color:var(--docsearch-highlight-color);cursor:pointer;margin:0;padding:0}.DocSearch-Modal{background:var(--docsearch-modal-background);border-radius:6px;box-shadow:var(--docsearch-modal-shadow);flex-direction:column;margin:60px auto auto;max-width:var(--docsearch-modal-width);position:relative}.DocSearch-SearchBar{display:flex;padding:var(--docsearch-spacing) var(--docsearch-spacing) 0}.DocSearch-Form{align-items:center;background:var(--docsearch-searchbox-focus-background);border-radius:4px;box-shadow:var(--docsearch-searchbox-shadow);display:flex;height:var(--docsearch-searchbox-height);margin:0;padding:0 var(--docsearch-spacing);position:relative;width:100%}.DocSearch-Input{appearance:none;background:#0000;border:0;color:var(--docsearch-text-color);flex:1;font-size:1.2em;height:100%;outline:0;padding:0 0 0 8px;width:80%}.DocSearch-Hit-action-button,.DocSearch-Reset{-webkit-appearance:none;border:0;cursor:pointer}.DocSearch-Input::placeholder{color:var(--docsearch-muted-color);opacity:1}.DocSearch-Input::-webkit-search-cancel-button,.DocSearch-Input::-webkit-search-decoration,.DocSearch-Input::-webkit-search-results-button,.DocSearch-Input::-webkit-search-results-decoration{display:none}.DocSearch-LoadingIndicator,.DocSearch-MagnifierLabel,.DocSearch-Reset{margin:0;padding:0}.DocSearch-Container--Stalled .DocSearch-LoadingIndicator,.DocSearch-MagnifierLabel,.DocSearch-Reset{align-items:center;color:var(--docsearch-highlight-color);display:flex;justify-content:center}.DocSearch-Cancel,.DocSearch-Container--Stalled .DocSearch-MagnifierLabel,.DocSearch-LoadingIndicator,.DocSearch-Reset[hidden]{display:none}.DocSearch-Reset{animation:.1s ease-in forwards b;appearance:none;background:none;border-radius:50%;color:var(--docsearch-icon-color);padding:2px;right:0}.DocSearch-Help,.DocSearch-HitsFooter,.DocSearch-Label{color:var(--docsearch-muted-color)}.DocSearch-Reset:focus{outline:0}.DocSearch-Reset:hover{color:var(--docsearch-highlight-color)}.DocSearch-LoadingIndicator svg,.DocSearch-MagnifierLabel svg{height:24px;width:24px}.DocSearch-Dropdown{max-height:calc(var(--docsearch-modal-height) - var(--docsearch-searchbox-height) - var(--docsearch-spacing) - var(--docsearch-footer-height));min-height:var(--docsearch-spacing);overflow-y:auto;overflow-y:overlay;padding:0 var(--docsearch-spacing);scrollbar-color:var(--docsearch-muted-color) var(--docsearch-modal-background);scrollbar-width:thin}.DocSearch-Dropdown::-webkit-scrollbar{width:12px}.DocSearch-Dropdown::-webkit-scrollbar-track{background:#0000}.DocSearch-Dropdown::-webkit-scrollbar-thumb{background-color:var(--docsearch-muted-color);border:3px solid var(--docsearch-modal-background);border-radius:20px}.DocSearch-Dropdown ul{list-style:none;margin:0;padding:0}.DocSearch-Label{font-size:.75em;line-height:1.6em}.DocSearch-Help{font-size:.9em;margin:0;-webkit-user-select:none;user-select:none}.DocSearch-Title{font-size:1.2em}.DocSearch-Logo a{display:flex}.DocSearch-Logo svg{color:var(--docsearch-logo-color);margin-left:8px}.DocSearch-Hits:last-of-type{margin-bottom:24px}.DocSearch-Hits mark{background:none;color:var(--docsearch-highlight-color)}.DocSearch-HitsFooter{display:flex;font-size:.85em;justify-content:center;margin-bottom:var(--docsearch-spacing);padding:var(--docsearch-spacing)}.DocSearch-HitsFooter a{border-bottom:1px solid;color:inherit}.DocSearch-Hit{border-radius:4px;display:flex;padding-bottom:4px;position:relative}.DocSearch-Hit--deleting{opacity:0;transition:.25s linear}.DocSearch-Hit--favoriting{transform:scale(0);transform-origin:top center;transition:.25s linear .25s}.DocSearch-Hit a{background:var(--docsearch-hit-background);border-radius:4px;box-shadow:var(--docsearch-hit-shadow);display:block;padding-left:var(--docsearch-spacing);width:100%}.DocSearch-Hit-source{background:var(--docsearch-modal-background);color:var(--docsearch-highlight-color);font-size:.85em;font-weight:600;line-height:32px;margin:0 -4px;padding:8px 4px 0;position:sticky;top:0;z-index:10}.DocSearch-Hit-Tree{color:var(--docsearch-muted-color);height:var(--docsearch-hit-height);opacity:.5;width:24px}.DocSearch-Hit[aria-selected=true] a{background-color:var(--docsearch-highlight-color)}.DocSearch-Hit[aria-selected=true] mark{text-decoration:underline}.DocSearch-Hit-Container{align-items:center;color:var(--docsearch-hit-color);display:flex;flex-direction:row;height:var(--docsearch-hit-height);padding:0 var(--docsearch-spacing) 0 0}.DocSearch-Hit-icon{height:20px;width:20px}.DocSearch-Hit-action,.DocSearch-Hit-icon{color:var(--docsearch-muted-color)}.DocSearch-Hit-action{align-items:center;display:flex;height:22px;width:22px}.DocSearch-Hit-action svg{display:block;height:18px;width:18px}.DocSearch-Hit-action+.DocSearch-Hit-action{margin-left:6px}.DocSearch-Hit-action-button{appearance:none;background:none;border-radius:50%;color:inherit;padding:2px}svg.DocSearch-Hit-Select-Icon{display:none}.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-Select-Icon{display:block}.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{background:#0003;transition:background-color .1s ease-in}.DocSearch-Hit-action-button:focus path,.DocSearch-Hit-action-button:hover path{fill:#fff}.DocSearch-Hit-content-wrapper{display:flex;flex:1 1 auto;flex-direction:column;font-weight:500;justify-content:center;line-height:1.2em;margin:0 8px;overflow-x:hidden;position:relative;width:80%}.DocSearch-Hit-title{font-size:.9em}.DocSearch-Hit-path{color:var(--docsearch-muted-color);font-size:.75em}.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-Tree,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-action,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-icon,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-path,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-text,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-title,.DocSearch-Hit[aria-selected=true] mark{color:var(--docsearch-hit-active-color)!important}.DocSearch-ErrorScreen,.DocSearch-NoResults,.DocSearch-StartScreen{font-size:.9em;margin:0 auto;padding:36px 0;text-align:center;width:80%}.DocSearch-Screen-Icon{color:var(--docsearch-muted-color);padding-bottom:12px}.DocSearch-NoResults-Prefill-List{display:inline-block;padding-bottom:24px;text-align:left}.DocSearch-NoResults-Prefill-List ul{display:inline-block;padding:8px 0 0}.DocSearch-NoResults-Prefill-List li{list-style-position:inside;list-style-type:"» "}.DocSearch-Prefill{-webkit-appearance:none;appearance:none;background:none;border:0;border-radius:1em;color:var(--docsearch-highlight-color);cursor:pointer;display:inline-block;font-size:1em;font-weight:700;padding:0}.DocSearch-Prefill:focus,.DocSearch-Prefill:hover{outline:0;text-decoration:underline}.DocSearch-Footer{align-items:center;background:var(--docsearch-footer-background);border-radius:0 0 8px 8px;box-shadow:var(--docsearch-footer-shadow);display:flex;flex-direction:row-reverse;flex-shrink:0;height:var(--docsearch-footer-height);justify-content:space-between;padding:0 var(--docsearch-spacing);position:relative;-webkit-user-select:none;user-select:none;width:100%;z-index:300}.DocSearch-Commands{color:var(--docsearch-muted-color);display:flex;list-style:none;margin:0;padding:0}.DocSearch-Commands li{align-items:center;display:flex}.DocSearch-Commands li:not(:last-of-type){margin-right:.8em}.DocSearch-Commands-Key{align-items:center;background:var(--docsearch-key-gradient);border:0;border-radius:2px;box-shadow:var(--docsearch-key-shadow);color:var(--docsearch-muted-color);display:flex;height:18px;justify-content:center;margin-right:.4em;padding:0 0 1px;width:20px}@keyframes b{0%{opacity:0}to{opacity:1}}.DocSearch-Button{margin:0;transition:all var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.DocSearch-Container{z-index:calc(var(--ifm-z-index-fixed) + 1)}@media (min-width:997px){.collapseSidebarButton_PEFL,.expandButton_m80_{background-color:var(--docusaurus-collapse-button-bg);position:sticky}:root{--docusaurus-announcement-bar-height:30px}.announcementBarClose_gvF7,.announcementBarPlaceholder_vyr4{flex-basis:50px}.searchBox_ZlJk{padding:var(--ifm-navbar-item-padding-vertical) var(--ifm-navbar-item-padding-horizontal)}.lastUpdated_vwxv{text-align:right}.tocMobile_ITEo{display:none}.docItemCol_VOVn{max-width:75%!important}.collapseSidebarButton_PEFL{border:1px solid var(--ifm-toc-border-color);border-radius:0;bottom:0;display:block!important;height:40px}.collapseSidebarButtonIcon_kv0_{margin-top:4px;transform:rotate(180deg)}.expandButtonIcon_BlDH,[dir=rtl] .collapseSidebarButtonIcon_kv0_{transform:rotate(0)}.collapseSidebarButton_PEFL:focus,.collapseSidebarButton_PEFL:hover,.expandButton_m80_:focus,.expandButton_m80_:hover{background-color:var(--docusaurus-collapse-button-bg-hover)}.menuHtmlItem_M9Kj{padding:var(--ifm-menu-link-padding-vertical) var(--ifm-menu-link-padding-horizontal)}.menu_SIkG{flex-grow:1;padding:.5rem}@supports (scrollbar-gutter:stable){.menu_SIkG{padding:.5rem 0 .5rem .5rem;scrollbar-gutter:stable}}.menuWithAnnouncementBar_GW3s{margin-bottom:var(--docusaurus-announcement-bar-height)}.sidebar_njMd{display:flex;flex-direction:column;height:100%;max-height:100vh;padding-top:var(--ifm-navbar-height);position:sticky;top:0;transition:opacity 50ms;width:var(--doc-sidebar-width)}.sidebarWithHideableNavbar_wUlq{padding-top:0}.sidebarHidden_VK0M{height:0;opacity:0;overflow:hidden;visibility:hidden}.sidebarLogo_isFc{align-items:center;color:inherit!important;display:flex!important;margin:0 var(--ifm-navbar-padding-horizontal);max-height:var(--ifm-navbar-height);min-height:var(--ifm-navbar-height);text-decoration:none!important}.sidebarLogo_isFc img{height:2rem;margin-right:.5rem}.expandButton_m80_{align-items:center;display:flex;height:100%;justify-content:center;max-height:100vh;top:0;transition:background-color var(--ifm-transition-fast) ease}[dir=rtl] .expandButtonIcon_BlDH{transform:rotate(180deg)}.docSidebarContainer_b6E3{border-right:1px solid var(--ifm-toc-border-color);-webkit-clip-path:inset(0);clip-path:inset(0);display:block;margin-top:calc(var(--ifm-navbar-height)*-1);transition:width var(--ifm-transition-fast) ease;width:var(--doc-sidebar-width);will-change:width}.docSidebarContainerHidden_b3ry{cursor:pointer;width:var(--doc-sidebar-hidden-width)}.docMainContainer_gTbr{flex-grow:1;max-width:calc(100% - var(--doc-sidebar-width))}.docMainContainerEnhanced_Uz_u{max-width:calc(100% - var(--doc-sidebar-hidden-width))}.docItemWrapperEnhanced_czyv{max-width:calc(var(--ifm-container-width) + var(--doc-sidebar-width))!important}}@media (min-width:1440px){.container{max-width:var(--ifm-container-width-xl)}}@media (max-width:996px){.col{--ifm-col-width:100%;flex-basis:var(--ifm-col-width);margin-left:0}.footer{--ifm-footer-padding-horizontal:0}.colorModeToggle_x44X,.footer__link-separator,.navbar__item,.tableOfContents_bqdL{display:none}.footer__col{margin-bottom:calc(var(--ifm-spacing-vertical)*3)}.footer__link-item{display:block}.hero{padding-left:0;padding-right:0}.navbar>.container,.navbar>.container-fluid{padding:0}.navbar__toggle{display:inherit}.navbar__search-input{width:9rem}.pills--block,.tabs--block{flex-direction:column}.searchBox_ZlJk{position:absolute;right:var(--ifm-navbar-padding-horizontal)}.docItemContainer_F8PC{padding:0 .3rem}}@media only screen and (max-width:996px){.searchQueryColumn_RTkw,.searchResultsColumn_JPFH{max-width:60%!important}.searchLogoColumn_rJIA,.searchVersionColumn_ypXd{max-width:40%!important}.searchLogoColumn_rJIA{padding-left:0!important}}@media (max-width:768px){.DocSearch-Button-Keys,.DocSearch-Button-Placeholder,.DocSearch-Commands,.DocSearch-Hit-Tree{display:none}:root{--docsearch-spacing:10px;--docsearch-footer-height:40px}.DocSearch-Dropdown{height:100%;max-height:calc(var(--docsearch-vh,1vh)*100 - var(--docsearch-searchbox-height) - var(--docsearch-spacing) - var(--docsearch-footer-height))}.DocSearch-Container{height:100vh;height:-webkit-fill-available;height:calc(var(--docsearch-vh,1vh)*100);position:absolute}.DocSearch-Footer{border-radius:0;bottom:0;position:absolute}.DocSearch-Hit-content-wrapper{display:flex;position:relative;width:80%}.DocSearch-Modal{border-radius:0;box-shadow:none;height:100vh;height:-webkit-fill-available;height:calc(var(--docsearch-vh,1vh)*100);margin:0;max-width:100%;width:100%}.DocSearch-Cancel{-webkit-appearance:none;appearance:none;background:none;border:0;color:var(--docsearch-highlight-color);cursor:pointer;display:inline-block;flex:none;font:inherit;font-size:1em;font-weight:500;margin-left:var(--docsearch-spacing);outline:0;overflow:hidden;padding:0;-webkit-user-select:none;user-select:none;white-space:nowrap}}@media (max-width:576px){.markdown h1:first-child{--ifm-h1-font-size:2rem}.markdown>h2{--ifm-h2-font-size:1.5rem}.markdown>h3{--ifm-h3-font-size:1.25rem}}@media screen and (max-width:576px){.searchQueryColumn_RTkw{max-width:100%!important}.searchVersionColumn_ypXd{max-width:100%!important;padding-left:var(--ifm-spacing-horizontal)!important}}@media (hover:hover){.backToTopButton_sjWU:hover{background-color:var(--ifm-color-emphasis-300)}}@media (pointer:fine){.thin-scrollbar{scrollbar-width:thin}.thin-scrollbar::-webkit-scrollbar{height:var(--ifm-scrollbar-size);width:var(--ifm-scrollbar-size)}.thin-scrollbar::-webkit-scrollbar-track{background:var(--ifm-scrollbar-track-background-color);border-radius:10px}.thin-scrollbar::-webkit-scrollbar-thumb{background:var(--ifm-scrollbar-thumb-background-color);border-radius:10px}.thin-scrollbar::-webkit-scrollbar-thumb:hover{background:var(--ifm-scrollbar-thumb-hover-background-color)}}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Reset{stroke-width:var(--docsearch-icon-stroke-width);animation:none;-webkit-appearance:none;appearance:none;background:none;border:0;border-radius:50%;color:var(--docsearch-icon-color);cursor:pointer;right:0}.DocSearch-Hit--deleting,.DocSearch-Hit--favoriting{transition:none}.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{background:#0003;transition:none}}@media print{.announcementBar_mb4j,.footer,.menu,.navbar,.pagination-nav,.table-of-contents,.tocMobile_ITEo{display:none}.tabs{page-break-inside:avoid}.codeBlockLines_e6Vv{white-space:pre-wrap}} \ No newline at end of file +.col,.container{padding:0 var(--ifm-spacing-horizontal);width:100%}.markdown li,body{word-wrap:break-word}body,ol ol,ol ul,ul ol,ul ul{margin:0}pre,table{overflow:auto}blockquote,pre{margin:0 0 var(--ifm-spacing-vertical)}.breadcrumbs__link,.button{transition-timing-function:var(--ifm-transition-timing-default)}.button,.hash-link{-webkit-user-select:none}.button,code{vertical-align:middle}.button--outline.button--active,.button--outline:active,.button--outline:hover,:root{--ifm-button-color:var(--ifm-font-color-base-inverse)}.avatar__photo,.card,.text--truncate{overflow:hidden}.menu__link:hover,a{transition:color var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.navbar--dark,:root{--ifm-navbar-link-hover-color:var(--ifm-color-primary)}.menu,.navbar-sidebar{overflow-x:hidden}:root,html[data-theme=dark]{--ifm-color-emphasis-500:var(--ifm-color-gray-500)}.markdown>h2,.markdown>h3,.markdown>h4,.markdown>h5,.markdown>h6,.theme-doc-markdown.markdown .section-footnote h2{margin-bottom:calc(var(--ifm-heading-vertical-rhythm-bottom)*var(--ifm-leading))}.markdown>h2,.theme-doc-markdown.markdown .section-footnote h2{margin-top:calc(var(--ifm-h2-vertical-rhythm-top)*var(--ifm-leading))}.toggleButton_gllP,html{-webkit-tap-highlight-color:transparent}*,.DocSearch-Container,.DocSearch-Container *{box-sizing:border-box}.DocSearch-Hit-content-wrapper,.text--truncate{text-overflow:ellipsis;white-space:nowrap}.button,.dropdown__link,.text--truncate,.theme-doc-markdown.markdown table td code{white-space:nowrap}:root{--ifm-color-scheme:light;--ifm-dark-value:10%;--ifm-darker-value:15%;--ifm-darkest-value:30%;--ifm-light-value:15%;--ifm-lighter-value:30%;--ifm-lightest-value:50%;--ifm-contrast-background-value:90%;--ifm-contrast-foreground-value:70%;--ifm-contrast-background-dark-value:70%;--ifm-contrast-foreground-dark-value:90%;--ifm-color-primary:#3578e5;--ifm-color-secondary:#ebedf0;--ifm-color-success:#00a400;--ifm-color-info:#54c7ec;--ifm-color-warning:#ffba00;--ifm-color-danger:#fa383e;--ifm-color-primary-dark:#306cce;--ifm-color-primary-darker:#2d66c3;--ifm-color-primary-darkest:#2554a0;--ifm-color-primary-light:#538ce9;--ifm-color-primary-lighter:#72a1ed;--ifm-color-primary-lightest:#9abcf2;--ifm-color-primary-contrast-background:#ebf2fc;--ifm-color-primary-contrast-foreground:#102445;--ifm-color-secondary-dark:#d4d5d8;--ifm-color-secondary-darker:#c8c9cc;--ifm-color-secondary-darkest:#a4a6a8;--ifm-color-secondary-light:#eef0f2;--ifm-color-secondary-lighter:#f1f2f5;--ifm-color-secondary-lightest:#f5f6f8;--ifm-color-secondary-contrast-background:#fdfdfe;--ifm-color-secondary-contrast-foreground:#474748;--ifm-color-success-dark:#009400;--ifm-color-success-darker:#008b00;--ifm-color-success-darkest:#007300;--ifm-color-success-light:#26b226;--ifm-color-success-lighter:#4dbf4d;--ifm-color-success-lightest:#80d280;--ifm-color-success-contrast-background:#e6f6e6;--ifm-color-success-contrast-foreground:#003100;--ifm-color-info-dark:#4cb3d4;--ifm-color-info-darker:#47a9c9;--ifm-color-info-darkest:#3b8ba5;--ifm-color-info-light:#6ecfef;--ifm-color-info-lighter:#87d8f2;--ifm-color-info-lightest:#aae3f6;--ifm-color-info-contrast-background:#eef9fd;--ifm-color-info-contrast-foreground:#193c47;--ifm-color-warning-dark:#e6a700;--ifm-color-warning-darker:#d99e00;--ifm-color-warning-darkest:#b38200;--ifm-color-warning-light:#ffc426;--ifm-color-warning-lighter:#ffcf4d;--ifm-color-warning-lightest:#ffdd80;--ifm-color-warning-contrast-background:#fff8e6;--ifm-color-warning-contrast-foreground:#4d3800;--ifm-color-danger-dark:#e13238;--ifm-color-danger-darker:#d53035;--ifm-color-danger-darkest:#af272b;--ifm-color-danger-light:#fb565b;--ifm-color-danger-lighter:#fb7478;--ifm-color-danger-lightest:#fd9c9f;--ifm-color-danger-contrast-background:#ffebec;--ifm-color-danger-contrast-foreground:#4b1113;--ifm-color-white:#fff;--ifm-color-black:#000;--ifm-color-gray-0:var(--ifm-color-white);--ifm-color-gray-100:#f5f6f7;--ifm-color-gray-200:#ebedf0;--ifm-color-gray-300:#dadde1;--ifm-color-gray-400:#ccd0d5;--ifm-color-gray-500:#bec3c9;--ifm-color-gray-600:#8d949e;--ifm-color-gray-700:#606770;--ifm-color-gray-800:#444950;--ifm-color-gray-900:#1c1e21;--ifm-color-gray-1000:var(--ifm-color-black);--ifm-color-emphasis-0:var(--ifm-color-gray-0);--ifm-color-emphasis-100:var(--ifm-color-gray-100);--ifm-color-emphasis-200:var(--ifm-color-gray-200);--ifm-color-emphasis-300:var(--ifm-color-gray-300);--ifm-color-emphasis-400:var(--ifm-color-gray-400);--ifm-color-emphasis-600:var(--ifm-color-gray-600);--ifm-color-emphasis-700:var(--ifm-color-gray-700);--ifm-color-emphasis-800:var(--ifm-color-gray-800);--ifm-color-emphasis-900:var(--ifm-color-gray-900);--ifm-color-emphasis-1000:var(--ifm-color-gray-1000);--ifm-color-content:var(--ifm-color-emphasis-900);--ifm-color-content-inverse:var(--ifm-color-emphasis-0);--ifm-color-content-secondary:#525860;--ifm-background-color:#0000;--ifm-background-surface-color:var(--ifm-color-content-inverse);--ifm-global-border-width:1px;--ifm-global-radius:0.4rem;--ifm-hover-overlay:#0000000d;--ifm-font-color-base:var(--ifm-color-content);--ifm-font-color-base-inverse:var(--ifm-color-content-inverse);--ifm-font-color-secondary:var(--ifm-color-content-secondary);--ifm-font-family-base:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--ifm-font-family-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--ifm-font-size-base:100%;--ifm-font-weight-light:300;--ifm-font-weight-normal:400;--ifm-font-weight-semibold:500;--ifm-font-weight-bold:700;--ifm-font-weight-base:var(--ifm-font-weight-normal);--ifm-line-height-base:1.65;--ifm-global-spacing:1rem;--ifm-spacing-vertical:var(--ifm-global-spacing);--ifm-spacing-horizontal:var(--ifm-global-spacing);--ifm-transition-fast:200ms;--ifm-transition-slow:400ms;--ifm-transition-timing-default:cubic-bezier(0.08,0.52,0.52,1);--ifm-global-shadow-lw:0 1px 2px 0 #0000001a;--ifm-global-shadow-md:0 5px 40px #0003;--ifm-global-shadow-tl:0 12px 28px 0 #0003,0 2px 4px 0 #0000001a;--ifm-z-index-dropdown:100;--ifm-z-index-fixed:200;--ifm-z-index-overlay:400;--ifm-container-width:1140px;--ifm-container-width-xl:1320px;--ifm-code-background:#f6f7f8;--ifm-code-border-radius:var(--ifm-global-radius);--ifm-code-font-size:90%;--ifm-code-padding-horizontal:0.1rem;--ifm-code-padding-vertical:0.1rem;--ifm-pre-background:var(--ifm-code-background);--ifm-pre-border-radius:var(--ifm-code-border-radius);--ifm-pre-color:inherit;--ifm-pre-line-height:1.45;--ifm-pre-padding:1rem;--ifm-heading-color:inherit;--ifm-heading-margin-top:0;--ifm-heading-margin-bottom:var(--ifm-spacing-vertical);--ifm-heading-font-family:var(--ifm-font-family-base);--ifm-heading-font-weight:var(--ifm-font-weight-bold);--ifm-heading-line-height:1.25;--ifm-h1-font-size:2rem;--ifm-h2-font-size:1.5rem;--ifm-h3-font-size:1.25rem;--ifm-h4-font-size:1rem;--ifm-h5-font-size:0.875rem;--ifm-h6-font-size:0.85rem;--ifm-image-alignment-padding:1.25rem;--ifm-leading-desktop:1.25;--ifm-leading:calc(var(--ifm-leading-desktop)*1rem);--ifm-list-left-padding:2rem;--ifm-list-margin:1rem;--ifm-list-item-margin:0.25rem;--ifm-list-paragraph-margin:1rem;--ifm-table-cell-padding:0.75rem;--ifm-table-background:#0000;--ifm-table-stripe-background:#00000008;--ifm-table-border-width:1px;--ifm-table-border-color:var(--ifm-color-emphasis-300);--ifm-table-head-background:inherit;--ifm-table-head-color:inherit;--ifm-table-head-font-weight:var(--ifm-font-weight-bold);--ifm-table-cell-color:inherit;--ifm-link-color:var(--ifm-color-primary);--ifm-link-decoration:none;--ifm-link-hover-color:var(--ifm-link-color);--ifm-link-hover-decoration:underline;--ifm-paragraph-margin-bottom:var(--ifm-leading);--ifm-blockquote-font-size:var(--ifm-font-size-base);--ifm-blockquote-border-left-width:2px;--ifm-blockquote-padding-horizontal:var(--ifm-spacing-horizontal);--ifm-blockquote-padding-vertical:0;--ifm-blockquote-shadow:none;--ifm-blockquote-color:var(--ifm-color-emphasis-800);--ifm-blockquote-border-color:var(--ifm-color-emphasis-300);--ifm-hr-background-color:var(--ifm-color-emphasis-500);--ifm-hr-height:1px;--ifm-hr-margin-vertical:1.5rem;--ifm-scrollbar-size:7px;--ifm-scrollbar-track-background-color:#f1f1f1;--ifm-scrollbar-thumb-background-color:silver;--ifm-scrollbar-thumb-hover-background-color:#a7a7a7;--ifm-alert-background-color:inherit;--ifm-alert-border-color:inherit;--ifm-alert-border-radius:var(--ifm-global-radius);--ifm-alert-border-width:0px;--ifm-alert-border-left-width:5px;--ifm-alert-color:var(--ifm-font-color-base);--ifm-alert-padding-horizontal:var(--ifm-spacing-horizontal);--ifm-alert-padding-vertical:var(--ifm-spacing-vertical);--ifm-alert-shadow:var(--ifm-global-shadow-lw);--ifm-avatar-intro-margin:1rem;--ifm-avatar-intro-alignment:inherit;--ifm-avatar-photo-size:3rem;--ifm-badge-background-color:inherit;--ifm-badge-border-color:inherit;--ifm-badge-border-radius:var(--ifm-global-radius);--ifm-badge-border-width:var(--ifm-global-border-width);--ifm-badge-color:var(--ifm-color-white);--ifm-badge-padding-horizontal:calc(var(--ifm-spacing-horizontal)*0.5);--ifm-badge-padding-vertical:calc(var(--ifm-spacing-vertical)*0.25);--ifm-breadcrumb-border-radius:1.5rem;--ifm-breadcrumb-spacing:0.5rem;--ifm-breadcrumb-color-active:var(--ifm-color-primary);--ifm-breadcrumb-item-background-active:var(--ifm-hover-overlay);--ifm-breadcrumb-padding-horizontal:0.8rem;--ifm-breadcrumb-padding-vertical:0.4rem;--ifm-breadcrumb-size-multiplier:1;--ifm-breadcrumb-separator:url('data:image/svg+xml;utf8,');--ifm-breadcrumb-separator-filter:none;--ifm-breadcrumb-separator-size:0.5rem;--ifm-breadcrumb-separator-size-multiplier:1.25;--ifm-button-background-color:inherit;--ifm-button-border-color:var(--ifm-button-background-color);--ifm-button-border-width:var(--ifm-global-border-width);--ifm-button-font-weight:var(--ifm-font-weight-bold);--ifm-button-padding-horizontal:1.5rem;--ifm-button-padding-vertical:0.375rem;--ifm-button-size-multiplier:1;--ifm-button-transition-duration:var(--ifm-transition-fast);--ifm-button-border-radius:calc(var(--ifm-global-radius)*var(--ifm-button-size-multiplier));--ifm-button-group-spacing:2px;--ifm-card-background-color:var(--ifm-background-surface-color);--ifm-card-border-radius:calc(var(--ifm-global-radius)*2);--ifm-card-horizontal-spacing:var(--ifm-global-spacing);--ifm-card-vertical-spacing:var(--ifm-global-spacing);--ifm-toc-border-color:var(--ifm-color-emphasis-300);--ifm-toc-link-color:var(--ifm-color-content-secondary);--ifm-toc-padding-vertical:0.5rem;--ifm-toc-padding-horizontal:0.5rem;--ifm-dropdown-background-color:var(--ifm-background-surface-color);--ifm-dropdown-font-weight:var(--ifm-font-weight-semibold);--ifm-dropdown-link-color:var(--ifm-font-color-base);--ifm-dropdown-hover-background-color:var(--ifm-hover-overlay);--ifm-footer-background-color:var(--ifm-color-emphasis-100);--ifm-footer-color:inherit;--ifm-footer-link-color:var(--ifm-color-emphasis-700);--ifm-footer-link-hover-color:var(--ifm-color-primary);--ifm-footer-link-horizontal-spacing:0.5rem;--ifm-footer-padding-horizontal:calc(var(--ifm-spacing-horizontal)*2);--ifm-footer-padding-vertical:calc(var(--ifm-spacing-vertical)*2);--ifm-footer-title-color:inherit;--ifm-footer-logo-max-width:min(30rem,90vw);--ifm-hero-background-color:var(--ifm-background-surface-color);--ifm-hero-text-color:var(--ifm-color-emphasis-800);--ifm-menu-color:var(--ifm-color-emphasis-700);--ifm-menu-color-active:var(--ifm-color-primary);--ifm-menu-color-background-active:var(--ifm-hover-overlay);--ifm-menu-color-background-hover:var(--ifm-hover-overlay);--ifm-menu-link-padding-horizontal:0.75rem;--ifm-menu-link-padding-vertical:0.375rem;--ifm-menu-link-sublist-icon:url('data:image/svg+xml;utf8,');--ifm-menu-link-sublist-icon-filter:none;--ifm-navbar-background-color:var(--ifm-background-surface-color);--ifm-navbar-height:3.75rem;--ifm-navbar-item-padding-horizontal:0.75rem;--ifm-navbar-item-padding-vertical:0.25rem;--ifm-navbar-link-color:var(--ifm-font-color-base);--ifm-navbar-link-active-color:var(--ifm-link-color);--ifm-navbar-padding-horizontal:var(--ifm-spacing-horizontal);--ifm-navbar-padding-vertical:calc(var(--ifm-spacing-vertical)*0.5);--ifm-navbar-shadow:var(--ifm-global-shadow-lw);--ifm-navbar-search-input-background-color:var(--ifm-color-emphasis-200);--ifm-navbar-search-input-color:var(--ifm-color-emphasis-800);--ifm-navbar-search-input-placeholder-color:var(--ifm-color-emphasis-500);--ifm-navbar-search-input-icon:url('data:image/svg+xml;utf8,');--ifm-navbar-sidebar-width:83vw;--ifm-pagination-border-radius:var(--ifm-global-radius);--ifm-pagination-color-active:var(--ifm-color-primary);--ifm-pagination-font-size:1rem;--ifm-pagination-item-active-background:var(--ifm-hover-overlay);--ifm-pagination-page-spacing:0.2em;--ifm-pagination-padding-horizontal:calc(var(--ifm-spacing-horizontal)*1);--ifm-pagination-padding-vertical:calc(var(--ifm-spacing-vertical)*0.25);--ifm-pagination-nav-border-radius:var(--ifm-global-radius);--ifm-pagination-nav-color-hover:var(--ifm-color-primary);--ifm-pills-color-active:var(--ifm-color-primary);--ifm-pills-color-background-active:var(--ifm-hover-overlay);--ifm-pills-spacing:0.125rem;--ifm-tabs-color:var(--ifm-font-color-secondary);--ifm-tabs-color-active:var(--ifm-color-primary);--ifm-tabs-color-active-border:var(--ifm-tabs-color-active);--ifm-tabs-padding-horizontal:1rem;--ifm-tabs-padding-vertical:1rem;--docusaurus-progress-bar-color:var(--ifm-color-primary);--ifm-color-primary:#2e8555;--ifm-color-primary-dark:#29784c;--ifm-color-primary-darker:#277148;--ifm-color-primary-darkest:#205d3b;--ifm-color-primary-light:#33925d;--ifm-color-primary-lighter:#359962;--ifm-color-primary-lightest:#3cad6e;--ifm-code-font-size:95%;--docusaurus-highlighted-code-line-bg:#0000001a;--doc-sidebar-width:400px!important;--ifm-blockquote-border-left-width:4px;--ifm-blockquote-border-color:#2e8555;--docusaurus-announcement-bar-height:auto;--docusaurus-tag-list-border:var(--ifm-color-emphasis-300);--docusaurus-collapse-button-bg:#0000;--docusaurus-collapse-button-bg-hover:#0000001a;--doc-sidebar-width:300px;--doc-sidebar-hidden-width:30px;--docsearch-primary-color:#5468ff;--docsearch-text-color:#1c1e21;--docsearch-spacing:12px;--docsearch-icon-stroke-width:1.4;--docsearch-highlight-color:var(--docsearch-primary-color);--docsearch-muted-color:#969faf;--docsearch-container-background:#656c85cc;--docsearch-logo-color:#5468ff;--docsearch-modal-width:560px;--docsearch-modal-height:600px;--docsearch-modal-background:#f5f6f7;--docsearch-modal-shadow:inset 1px 1px 0 0 #ffffff80,0 3px 8px 0 #555a64;--docsearch-searchbox-height:56px;--docsearch-searchbox-background:#ebedf0;--docsearch-searchbox-focus-background:#fff;--docsearch-searchbox-shadow:inset 0 0 0 2px var(--docsearch-primary-color);--docsearch-hit-height:56px;--docsearch-hit-color:#444950;--docsearch-hit-active-color:#fff;--docsearch-hit-background:#fff;--docsearch-hit-shadow:0 1px 3px 0 #d4d9e1;--docsearch-key-gradient:linear-gradient(-225deg,#d5dbe4,#f8f8f8);--docsearch-key-shadow:inset 0 -2px 0 0 #cdcde6,inset 0 0 1px 1px #fff,0 1px 2px 1px #1e235a66;--docsearch-footer-height:44px;--docsearch-footer-background:#fff;--docsearch-footer-shadow:0 -1px 0 0 #e0e3e8,0 -3px 6px 0 #45629b1f;--docsearch-primary-color:var(--ifm-color-primary);--docsearch-text-color:var(--ifm-font-color-base)}.badge--danger,.badge--info,.badge--primary,.badge--secondary,.badge--success,.badge--warning{--ifm-badge-border-color:var(--ifm-badge-background-color)}.button--link,.button--outline{--ifm-button-background-color:#0000}html{-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%;text-size-adjust:100%;background-color:var(--ifm-background-color);color:var(--ifm-font-color-base);color-scheme:var(--ifm-color-scheme);font:var(--ifm-font-size-base)/var(--ifm-line-height-base) var(--ifm-font-family-base);text-rendering:optimizelegibility}iframe{border:0;color-scheme:auto}.container{margin:0 auto;max-width:var(--ifm-container-width)}.container--fluid{max-width:inherit}.row{display:flex;flex-wrap:wrap;margin:0 calc(var(--ifm-spacing-horizontal)*-1)}.margin-bottom--none,.margin-vert--none,.markdown>:last-child{margin-bottom:0!important}.margin-top--none,.margin-vert--none{margin-top:0!important}.row--no-gutters{margin-left:0;margin-right:0}.margin-horiz--none,.margin-right--none{margin-right:0!important}.row--no-gutters>.col{padding-left:0;padding-right:0}.row--align-top{align-items:flex-start}.row--align-bottom{align-items:flex-end}.menuExternalLink_NmtK,.row--align-center{align-items:center}.row--align-stretch{align-items:stretch}.row--align-baseline{align-items:baseline}.col{--ifm-col-width:100%;flex:1 0;margin-left:0;max-width:var(--ifm-col-width)}.padding-bottom--none,.padding-vert--none{padding-bottom:0!important}.padding-top--none,.padding-vert--none{padding-top:0!important}.padding-horiz--none,.padding-left--none{padding-left:0!important}.padding-horiz--none,.padding-right--none{padding-right:0!important}.col[class*=col--]{flex:0 0 var(--ifm-col-width)}.col--1{--ifm-col-width:8.33333%}.col--offset-1{margin-left:8.33333%}.col--2{--ifm-col-width:16.66667%}.col--offset-2{margin-left:16.66667%}.col--3{--ifm-col-width:25%}.col--offset-3{margin-left:25%}.col--4{--ifm-col-width:33.33333%}.col--offset-4{margin-left:33.33333%}.col--5{--ifm-col-width:41.66667%}.col--offset-5{margin-left:41.66667%}.col--6{--ifm-col-width:50%}.col--offset-6{margin-left:50%}.col--7{--ifm-col-width:58.33333%}.col--offset-7{margin-left:58.33333%}.col--8{--ifm-col-width:66.66667%}.col--offset-8{margin-left:66.66667%}.col--9{--ifm-col-width:75%}.col--offset-9{margin-left:75%}.col--10{--ifm-col-width:83.33333%}.col--offset-10{margin-left:83.33333%}.col--11{--ifm-col-width:91.66667%}.col--offset-11{margin-left:91.66667%}.col--12{--ifm-col-width:100%}.col--offset-12{margin-left:100%}.margin-horiz--none,.margin-left--none{margin-left:0!important}.margin--none{margin:0!important}.margin-bottom--xs,.margin-vert--xs{margin-bottom:.25rem!important}.margin-top--xs,.margin-vert--xs{margin-top:.25rem!important}.margin-horiz--xs,.margin-left--xs{margin-left:.25rem!important}.margin-horiz--xs,.margin-right--xs{margin-right:.25rem!important}.margin--xs{margin:.25rem!important}.margin-bottom--sm,.margin-vert--sm{margin-bottom:.5rem!important}.margin-top--sm,.margin-vert--sm{margin-top:.5rem!important}.margin-horiz--sm,.margin-left--sm{margin-left:.5rem!important}.margin-horiz--sm,.margin-right--sm{margin-right:.5rem!important}.margin--sm{margin:.5rem!important}.margin-bottom--md,.margin-vert--md{margin-bottom:1rem!important}.margin-top--md,.margin-vert--md{margin-top:1rem!important}.margin-horiz--md,.margin-left--md{margin-left:1rem!important}.margin-horiz--md,.margin-right--md{margin-right:1rem!important}.margin--md{margin:1rem!important}.margin-bottom--lg,.margin-vert--lg{margin-bottom:2rem!important}.margin-top--lg,.margin-vert--lg{margin-top:2rem!important}.margin-horiz--lg,.margin-left--lg{margin-left:2rem!important}.margin-horiz--lg,.margin-right--lg{margin-right:2rem!important}.margin--lg{margin:2rem!important}.margin-bottom--xl,.margin-vert--xl{margin-bottom:5rem!important}.margin-top--xl,.margin-vert--xl{margin-top:5rem!important}.margin-horiz--xl,.margin-left--xl{margin-left:5rem!important}.margin-horiz--xl,.margin-right--xl{margin-right:5rem!important}.margin--xl{margin:5rem!important}.padding--none{padding:0!important}.padding-bottom--xs,.padding-vert--xs{padding-bottom:.25rem!important}.padding-top--xs,.padding-vert--xs{padding-top:.25rem!important}.padding-horiz--xs,.padding-left--xs{padding-left:.25rem!important}.padding-horiz--xs,.padding-right--xs{padding-right:.25rem!important}.padding--xs{padding:.25rem!important}.padding-bottom--sm,.padding-vert--sm{padding-bottom:.5rem!important}.padding-top--sm,.padding-vert--sm{padding-top:.5rem!important}.padding-horiz--sm,.padding-left--sm{padding-left:.5rem!important}.padding-horiz--sm,.padding-right--sm{padding-right:.5rem!important}.padding--sm{padding:.5rem!important}.padding-bottom--md,.padding-vert--md{padding-bottom:1rem!important}.padding-top--md,.padding-vert--md{padding-top:1rem!important}.padding-horiz--md,.padding-left--md{padding-left:1rem!important}.padding-horiz--md,.padding-right--md{padding-right:1rem!important}.padding--md{padding:1rem!important}.padding-bottom--lg,.padding-vert--lg{padding-bottom:2rem!important}.padding-top--lg,.padding-vert--lg{padding-top:2rem!important}.padding-horiz--lg,.padding-left--lg{padding-left:2rem!important}.padding-horiz--lg,.padding-right--lg{padding-right:2rem!important}.padding--lg{padding:2rem!important}.padding-bottom--xl,.padding-vert--xl{padding-bottom:5rem!important}.padding-top--xl,.padding-vert--xl{padding-top:5rem!important}.padding-horiz--xl,.padding-left--xl{padding-left:5rem!important}.padding-horiz--xl,.padding-right--xl{padding-right:5rem!important}.padding--xl{padding:5rem!important}code{background-color:var(--ifm-code-background);border:.1rem solid #0000001a;border-radius:var(--ifm-code-border-radius);font-family:var(--ifm-font-family-monospace);font-size:var(--ifm-code-font-size);padding:var(--ifm-code-padding-vertical) var(--ifm-code-padding-horizontal)}a code{color:inherit}pre{background-color:var(--ifm-pre-background);border-radius:var(--ifm-pre-border-radius);color:var(--ifm-pre-color);font:var(--ifm-code-font-size)/var(--ifm-pre-line-height) var(--ifm-font-family-monospace);padding:var(--ifm-pre-padding)}pre code{background-color:initial;border:none;font-size:100%;line-height:inherit;padding:0}kbd{background-color:var(--ifm-color-emphasis-0);border:1px solid var(--ifm-color-emphasis-400);border-radius:.2rem;box-shadow:inset 0 -1px 0 var(--ifm-color-emphasis-400);color:var(--ifm-color-emphasis-800);font:80% var(--ifm-font-family-monospace);padding:.15rem .3rem}.text--italic,blockquote{font-style:italic}h1,h2,h3,h4,h5,h6{color:var(--ifm-heading-color);font-family:var(--ifm-heading-font-family);font-weight:var(--ifm-heading-font-weight);line-height:var(--ifm-heading-line-height);margin:var(--ifm-heading-margin-top) 0 var(--ifm-heading-margin-bottom) 0}h1{font-size:var(--ifm-h1-font-size)}h2{font-size:var(--ifm-h2-font-size)}h3{font-size:var(--ifm-h3-font-size)}h4{font-size:var(--ifm-h4-font-size)}h5{font-size:var(--ifm-h5-font-size)}h6{font-size:var(--ifm-h6-font-size)}img{max-width:100%}img[align=right]{padding-left:var(--image-alignment-padding)}img[align=left]{padding-right:var(--image-alignment-padding)}.markdown{--ifm-h1-vertical-rhythm-top:3;--ifm-h2-vertical-rhythm-top:2;--ifm-h3-vertical-rhythm-top:1.5;--ifm-heading-vertical-rhythm-top:1.25;--ifm-h1-vertical-rhythm-bottom:1.25;--ifm-heading-vertical-rhythm-bottom:1}.markdown:after,.markdown:before{content:"";display:table}.markdown:after{clear:both}.markdown h1:first-child{--ifm-h1-font-size:3rem;margin-bottom:calc(var(--ifm-h1-vertical-rhythm-bottom)*var(--ifm-leading));font-weight:400}.markdown>h2{--ifm-h2-font-size:2rem;--ifm-h2-font-size:1.7rem}.markdown>h3{--ifm-h3-font-size:1.5rem;margin-top:calc(var(--ifm-h3-vertical-rhythm-top)*var(--ifm-leading));--ifm-h3-font-size:1.3rem}.markdown>h4,.markdown>h5,.markdown>h6{margin-top:calc(var(--ifm-heading-vertical-rhythm-top)*var(--ifm-leading))}.markdown>p,.markdown>pre,.markdown>ul{margin-bottom:var(--ifm-leading)}.markdown li>p{margin-top:var(--ifm-list-paragraph-margin)}.markdown li+li{margin-top:var(--ifm-list-item-margin)}ol,ul{margin:0 0 var(--ifm-list-margin);padding-left:var(--ifm-list-left-padding)}ol ol,ul ol{list-style-type:lower-roman}ol ol ol,ol ul ol,ul ol ol,ul ul ol{list-style-type:lower-alpha}table{border-collapse:collapse;display:block;margin-bottom:var(--ifm-spacing-vertical)}table thead tr{border-bottom:2px solid var(--ifm-table-border-color)}table thead,table tr:nth-child(2n){background-color:var(--ifm-table-stripe-background)}table tr{background-color:var(--ifm-table-background);border-top:var(--ifm-table-border-width) solid var(--ifm-table-border-color)}table td,table th{border:var(--ifm-table-border-width) solid var(--ifm-table-border-color);padding:var(--ifm-table-cell-padding)}table th{background-color:var(--ifm-table-head-background);color:var(--ifm-table-head-color);font-weight:var(--ifm-table-head-font-weight)}table td{color:var(--ifm-table-cell-color)}strong{font-weight:var(--ifm-font-weight-bold)}a{color:var(--ifm-link-color);text-decoration:var(--ifm-link-decoration)}a:hover{color:var(--ifm-link-hover-color);text-decoration:var(--ifm-link-hover-decoration)}.button:hover,.text--no-decoration,.text--no-decoration:hover,a:not([href]){text-decoration:none}p{margin:0 0 var(--ifm-paragraph-margin-bottom)}blockquote{border-left:var(--ifm-blockquote-border-left-width) solid var(--ifm-blockquote-border-color);box-shadow:var(--ifm-blockquote-shadow);color:var(--ifm-blockquote-color);font-size:var(--ifm-blockquote-font-size);padding:var(--ifm-blockquote-padding-vertical) var(--ifm-blockquote-padding-horizontal);background-color:#fbfbfb;margin-left:15px;padding:15px}blockquote>:first-child{margin-top:0}blockquote>:last-child{margin-bottom:0}hr{background-color:var(--ifm-hr-background-color);border:0;height:var(--ifm-hr-height);margin:var(--ifm-hr-margin-vertical) 0}.shadow--lw{box-shadow:var(--ifm-global-shadow-lw)!important}.shadow--md{box-shadow:var(--ifm-global-shadow-md)!important}.shadow--tl{box-shadow:var(--ifm-global-shadow-tl)!important}.text--primary,.wordWrapButtonEnabled_EoeP .wordWrapButtonIcon_Bwma{color:var(--ifm-color-primary)}.text--secondary{color:var(--ifm-color-secondary)}.text--success{color:var(--ifm-color-success)}.text--info{color:var(--ifm-color-info)}.text--warning{color:var(--ifm-color-warning)}.text--danger{color:var(--ifm-color-danger)}.text--center,.theme-doc-markdown.markdown table tr td.align-center,.theme-doc-markdown.markdown table tr th.align-center{text-align:center}.text--left{text-align:left}.text--justify{text-align:justify}.text--right{text-align:right}.text--capitalize{text-transform:capitalize}.text--lowercase{text-transform:lowercase}.admonitionHeading_tbUL,.alert__heading,.text--uppercase{text-transform:uppercase}.text--light{font-weight:var(--ifm-font-weight-light)}.text--normal{font-weight:var(--ifm-font-weight-normal)}.text--semibold{font-weight:var(--ifm-font-weight-semibold)}.text--bold{font-weight:var(--ifm-font-weight-bold)}.text--break{word-wrap:break-word!important;word-break:break-word!important}.clean-btn{background:none;border:none;color:inherit;cursor:pointer;font-family:inherit;padding:0}.alert,.alert .close{color:var(--ifm-alert-foreground-color)}.clean-list{list-style:none;padding-left:0}.alert--primary{--ifm-alert-background-color:var(--ifm-color-primary-contrast-background);--ifm-alert-background-color-highlight:#3578e526;--ifm-alert-foreground-color:var(--ifm-color-primary-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-primary-dark)}.alert--secondary{--ifm-alert-background-color:var(--ifm-color-secondary-contrast-background);--ifm-alert-background-color-highlight:#ebedf026;--ifm-alert-foreground-color:var(--ifm-color-secondary-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-secondary-dark)}.alert--success{--ifm-alert-background-color:var(--ifm-color-success-contrast-background);--ifm-alert-background-color-highlight:#00a40026;--ifm-alert-foreground-color:var(--ifm-color-success-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-success-dark)}.alert--info{--ifm-alert-background-color:var(--ifm-color-info-contrast-background);--ifm-alert-background-color-highlight:#54c7ec26;--ifm-alert-foreground-color:var(--ifm-color-info-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-info-dark)}.alert--warning{--ifm-alert-background-color:var(--ifm-color-warning-contrast-background);--ifm-alert-background-color-highlight:#ffba0026;--ifm-alert-foreground-color:var(--ifm-color-warning-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-warning-dark)}.alert--danger{--ifm-alert-background-color:var(--ifm-color-danger-contrast-background);--ifm-alert-background-color-highlight:#fa383e26;--ifm-alert-foreground-color:var(--ifm-color-danger-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-danger-dark)}.alert{--ifm-code-background:var(--ifm-alert-background-color-highlight);--ifm-link-color:var(--ifm-alert-foreground-color);--ifm-link-hover-color:var(--ifm-alert-foreground-color);--ifm-link-decoration:underline;--ifm-tabs-color:var(--ifm-alert-foreground-color);--ifm-tabs-color-active:var(--ifm-alert-foreground-color);--ifm-tabs-color-active-border:var(--ifm-alert-border-color);background-color:var(--ifm-alert-background-color);border:var(--ifm-alert-border-width) solid var(--ifm-alert-border-color);border-left-width:var(--ifm-alert-border-left-width);border-radius:var(--ifm-alert-border-radius);box-shadow:var(--ifm-alert-shadow);padding:var(--ifm-alert-padding-vertical) var(--ifm-alert-padding-horizontal)}.alert__heading{align-items:center;display:flex;font:700 var(--ifm-h5-font-size)/var(--ifm-heading-line-height) var(--ifm-heading-font-family);margin-bottom:.5rem}.alert__icon{display:inline-flex;margin-right:.4em}.alert__icon svg{fill:var(--ifm-alert-foreground-color);stroke:var(--ifm-alert-foreground-color);stroke-width:0}.alert .close{margin:calc(var(--ifm-alert-padding-vertical)*-1) calc(var(--ifm-alert-padding-horizontal)*-1) 0 0;opacity:.75}.alert .close:focus,.alert .close:hover{opacity:1}.alert a{text-decoration-color:var(--ifm-alert-border-color)}.alert a:hover{text-decoration-thickness:2px}.avatar{column-gap:var(--ifm-avatar-intro-margin);display:flex}.avatar__photo{border-radius:50%;display:block;height:var(--ifm-avatar-photo-size);width:var(--ifm-avatar-photo-size)}.card--full-height,.navbar__logo img,body,html{height:100%}.avatar__photo--sm{--ifm-avatar-photo-size:2rem}.avatar__photo--lg{--ifm-avatar-photo-size:4rem}.avatar__photo--xl{--ifm-avatar-photo-size:6rem}.avatar__intro{display:flex;flex:1 1;flex-direction:column;justify-content:center;text-align:var(--ifm-avatar-intro-alignment)}.badge,.breadcrumbs__item,.breadcrumbs__link,.button,.dropdown>.navbar__link:after{display:inline-block}.avatar__name{font:700 var(--ifm-h4-font-size)/var(--ifm-heading-line-height) var(--ifm-font-family-base)}.avatar__subtitle{margin-top:.25rem}.avatar--vertical{--ifm-avatar-intro-alignment:center;--ifm-avatar-intro-margin:0.5rem;align-items:center;flex-direction:column}.badge{background-color:var(--ifm-badge-background-color);border:var(--ifm-badge-border-width) solid var(--ifm-badge-border-color);border-radius:var(--ifm-badge-border-radius);color:var(--ifm-badge-color);font-size:75%;font-weight:var(--ifm-font-weight-bold);line-height:1;padding:var(--ifm-badge-padding-vertical) var(--ifm-badge-padding-horizontal)}.badge--primary{--ifm-badge-background-color:var(--ifm-color-primary)}.badge--secondary{--ifm-badge-background-color:var(--ifm-color-secondary);color:var(--ifm-color-black)}.breadcrumbs__link,.button.button--secondary.button--outline:not(.button--active):not(:hover){color:var(--ifm-font-color-base)}.badge--success{--ifm-badge-background-color:var(--ifm-color-success)}.badge--info{--ifm-badge-background-color:var(--ifm-color-info)}.badge--warning{--ifm-badge-background-color:var(--ifm-color-warning)}.badge--danger{--ifm-badge-background-color:var(--ifm-color-danger)}.breadcrumbs{margin-bottom:0;padding-left:0}.breadcrumbs__item:not(:last-child):after{background:var(--ifm-breadcrumb-separator) center;content:" ";display:inline-block;filter:var(--ifm-breadcrumb-separator-filter);height:calc(var(--ifm-breadcrumb-separator-size)*var(--ifm-breadcrumb-size-multiplier)*var(--ifm-breadcrumb-separator-size-multiplier));margin:0 var(--ifm-breadcrumb-spacing);opacity:.5;width:calc(var(--ifm-breadcrumb-separator-size)*var(--ifm-breadcrumb-size-multiplier)*var(--ifm-breadcrumb-separator-size-multiplier))}.breadcrumbs__item--active .breadcrumbs__link{background:var(--ifm-breadcrumb-item-background-active);color:var(--ifm-breadcrumb-color-active)}.breadcrumbs__link{border-radius:var(--ifm-breadcrumb-border-radius);font-size:calc(1rem*var(--ifm-breadcrumb-size-multiplier));padding:calc(var(--ifm-breadcrumb-padding-vertical)*var(--ifm-breadcrumb-size-multiplier)) calc(var(--ifm-breadcrumb-padding-horizontal)*var(--ifm-breadcrumb-size-multiplier));transition-duration:var(--ifm-transition-fast);transition-property:background,color}.breadcrumbs__link:any-link:hover,.breadcrumbs__link:link:hover,.breadcrumbs__link:visited:hover,area.breadcrumbs__link[href]:hover{background:var(--ifm-breadcrumb-item-background-active);text-decoration:none}.breadcrumbs--sm{--ifm-breadcrumb-size-multiplier:0.8}.breadcrumbs--lg{--ifm-breadcrumb-size-multiplier:1.2}.button{background-color:var(--ifm-button-background-color);border:var(--ifm-button-border-width) solid var(--ifm-button-border-color);border-radius:var(--ifm-button-border-radius);cursor:pointer;font-size:calc(.875rem*var(--ifm-button-size-multiplier));font-weight:var(--ifm-button-font-weight);line-height:1.5;padding:calc(var(--ifm-button-padding-vertical)*var(--ifm-button-size-multiplier)) calc(var(--ifm-button-padding-horizontal)*var(--ifm-button-size-multiplier));text-align:center;transition-duration:var(--ifm-button-transition-duration);transition-property:color,background,border-color;user-select:none}.dropdown,.theme-doc-markdown.markdown table tr td.vertical-align-top,.theme-doc-markdown.markdown table.custom-table.top tr td{vertical-align:top}.button,.button:hover{color:var(--ifm-button-color)}.button--outline{--ifm-button-color:var(--ifm-button-border-color)}.button--outline:hover{--ifm-button-background-color:var(--ifm-button-border-color)}.button--link{--ifm-button-border-color:#0000;color:var(--ifm-link-color);text-decoration:var(--ifm-link-decoration)}.button--link.button--active,.button--link:active,.button--link:hover{color:var(--ifm-link-hover-color);text-decoration:var(--ifm-link-hover-decoration)}.button.disabled,.button:disabled,.button[disabled]{opacity:.65;pointer-events:none}.button--sm{--ifm-button-size-multiplier:0.8}.button--lg{--ifm-button-size-multiplier:1.35}.button--block{display:block;width:100%}.button.button--secondary{color:var(--ifm-color-gray-900)}:where(.button--primary){--ifm-button-background-color:var(--ifm-color-primary);--ifm-button-border-color:var(--ifm-color-primary)}:where(.button--primary):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-primary-dark);--ifm-button-border-color:var(--ifm-color-primary-dark)}.button--primary.button--active,.button--primary:active{--ifm-button-background-color:var(--ifm-color-primary-darker);--ifm-button-border-color:var(--ifm-color-primary-darker)}:where(.button--secondary){--ifm-button-background-color:var(--ifm-color-secondary);--ifm-button-border-color:var(--ifm-color-secondary)}:where(.button--secondary):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-secondary-dark);--ifm-button-border-color:var(--ifm-color-secondary-dark)}.button--secondary.button--active,.button--secondary:active{--ifm-button-background-color:var(--ifm-color-secondary-darker);--ifm-button-border-color:var(--ifm-color-secondary-darker)}:where(.button--success){--ifm-button-background-color:var(--ifm-color-success);--ifm-button-border-color:var(--ifm-color-success)}:where(.button--success):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-success-dark);--ifm-button-border-color:var(--ifm-color-success-dark)}.button--success.button--active,.button--success:active{--ifm-button-background-color:var(--ifm-color-success-darker);--ifm-button-border-color:var(--ifm-color-success-darker)}:where(.button--info){--ifm-button-background-color:var(--ifm-color-info);--ifm-button-border-color:var(--ifm-color-info)}:where(.button--info):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-info-dark);--ifm-button-border-color:var(--ifm-color-info-dark)}.button--info.button--active,.button--info:active{--ifm-button-background-color:var(--ifm-color-info-darker);--ifm-button-border-color:var(--ifm-color-info-darker)}:where(.button--warning){--ifm-button-background-color:var(--ifm-color-warning);--ifm-button-border-color:var(--ifm-color-warning)}:where(.button--warning):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-warning-dark);--ifm-button-border-color:var(--ifm-color-warning-dark)}.button--warning.button--active,.button--warning:active{--ifm-button-background-color:var(--ifm-color-warning-darker);--ifm-button-border-color:var(--ifm-color-warning-darker)}:where(.button--danger){--ifm-button-background-color:var(--ifm-color-danger);--ifm-button-border-color:var(--ifm-color-danger)}:where(.button--danger):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-danger-dark);--ifm-button-border-color:var(--ifm-color-danger-dark)}.button--danger.button--active,.button--danger:active{--ifm-button-background-color:var(--ifm-color-danger-darker);--ifm-button-border-color:var(--ifm-color-danger-darker)}.button-group{display:inline-flex;gap:var(--ifm-button-group-spacing)}.button-group>.button:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.button-group>.button:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.button-group--block{display:flex;justify-content:stretch}.button-group--block>.button{flex-grow:1}.card{background-color:var(--ifm-card-background-color);border-radius:var(--ifm-card-border-radius);box-shadow:var(--ifm-global-shadow-lw);display:flex;flex-direction:column}.card__image{padding-top:var(--ifm-card-vertical-spacing)}.card__image:first-child{padding-top:0}.card__body,.card__footer,.card__header{padding:var(--ifm-card-vertical-spacing) var(--ifm-card-horizontal-spacing)}.card__body:not(:last-child),.card__footer:not(:last-child),.card__header:not(:last-child){padding-bottom:0}.card__body>:last-child,.card__footer>:last-child,.card__header>:last-child{margin-bottom:0}.card__footer{margin-top:auto}.table-of-contents{font-size:.8rem;margin-bottom:0;padding:var(--ifm-toc-padding-vertical) 0}.table-of-contents,.table-of-contents ul{list-style:none;padding-left:var(--ifm-toc-padding-horizontal)}.table-of-contents li{margin:var(--ifm-toc-padding-vertical) var(--ifm-toc-padding-horizontal)}.table-of-contents__left-border{border-left:1px solid var(--ifm-toc-border-color)}.table-of-contents__link{color:var(--ifm-toc-link-color);display:block}.table-of-contents__link--active,.table-of-contents__link--active code,.table-of-contents__link:hover,.table-of-contents__link:hover code{color:var(--ifm-color-primary);text-decoration:none}.close{color:var(--ifm-color-black);float:right;font-size:1.5rem;font-weight:var(--ifm-font-weight-bold);line-height:1;opacity:.5;padding:1rem;transition:opacity var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.close:hover{opacity:.7}.close:focus,.theme-code-block-highlighted-line .codeLineNumber_Tfdd:before{opacity:.8}.dropdown{display:inline-flex;font-weight:var(--ifm-dropdown-font-weight);position:relative}.dropdown--hoverable:hover .dropdown__menu,.dropdown--show .dropdown__menu{opacity:1;pointer-events:all;transform:translateY(-1px);visibility:visible}#nprogress,.dropdown__menu,.ebook-wrapper .ebook.ebook-current a,.navbar__item.dropdown .navbar__link:not([href]){pointer-events:none}.dropdown--right .dropdown__menu{left:inherit;right:0}.dropdown--nocaret .navbar__link:after{content:none!important}.dropdown__menu{background-color:var(--ifm-dropdown-background-color);border-radius:var(--ifm-global-radius);box-shadow:var(--ifm-global-shadow-md);left:0;list-style:none;max-height:80vh;min-width:10rem;opacity:0;overflow-y:auto;padding:.5rem;position:absolute;top:calc(100% - var(--ifm-navbar-item-padding-vertical) + .3rem);transform:translateY(-.625rem);transition-duration:var(--ifm-transition-fast);transition-property:opacity,transform,visibility;transition-timing-function:var(--ifm-transition-timing-default);visibility:hidden;z-index:var(--ifm-z-index-dropdown)}.menu__caret,.menu__link,.menu__list-item-collapsible{border-radius:.25rem;transition:background var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.dropdown__link{border-radius:.25rem;color:var(--ifm-dropdown-link-color);display:block;font-size:.875rem;margin-top:.2rem;padding:.25rem .5rem}.dropdown__link--active,.dropdown__link:hover{background-color:var(--ifm-dropdown-hover-background-color);color:var(--ifm-dropdown-link-color);text-decoration:none}.dropdown__link--active,.dropdown__link--active:hover{--ifm-dropdown-link-color:var(--ifm-link-color)}.dropdown>.navbar__link:after{border-color:currentcolor #0000;border-style:solid;border-width:.4em .4em 0;content:"";margin-left:.3em;position:relative;top:2px;transform:translateY(-50%)}.footer{background-color:var(--ifm-footer-background-color);color:var(--ifm-footer-color);padding:var(--ifm-footer-padding-vertical) var(--ifm-footer-padding-horizontal)}.footer--dark{--ifm-footer-background-color:#303846;--ifm-footer-color:var(--ifm-footer-link-color);--ifm-footer-link-color:var(--ifm-color-secondary);--ifm-footer-title-color:var(--ifm-color-white)}.footer__links{margin-bottom:1rem}.footer__link-item{color:var(--ifm-footer-link-color);line-height:2}.footer__link-item:hover{color:var(--ifm-footer-link-hover-color)}.footer__link-separator{margin:0 var(--ifm-footer-link-horizontal-spacing)}.footer__logo{margin-top:1rem;max-width:var(--ifm-footer-logo-max-width)}.footer__title{color:var(--ifm-footer-title-color);font:700 var(--ifm-h4-font-size)/var(--ifm-heading-line-height) var(--ifm-font-family-base);margin-bottom:var(--ifm-heading-margin-bottom)}.menu,.navbar__link{font-weight:var(--ifm-font-weight-semibold)}.docItemContainer_Djhp article>:first-child,.docItemContainer_Djhp header+*,.footer__item{margin-top:0}.admonitionContent_S0QG>:last-child,.collapsibleContent_i85q>:last-child,.footer__items,.theme-doc-markdown.markdown table td>div{margin-bottom:0}.codeBlockStandalone_MEMb,[type=checkbox]{padding:0}.hero{align-items:center;background-color:var(--ifm-hero-background-color);color:var(--ifm-hero-text-color);display:flex;padding:4rem 2rem}.hero--primary{--ifm-hero-background-color:var(--ifm-color-primary);--ifm-hero-text-color:var(--ifm-font-color-base-inverse)}.hero--dark{--ifm-hero-background-color:#303846;--ifm-hero-text-color:var(--ifm-color-white)}.hero__title{font-size:3rem}.hero__subtitle{font-size:1.5rem}.menu__list{list-style:none;margin:0;padding-left:0}.menu__caret,.menu__link{padding:var(--ifm-menu-link-padding-vertical) var(--ifm-menu-link-padding-horizontal)}.menu__list .menu__list{flex:0 0 100%;margin-top:.25rem;padding-left:var(--ifm-menu-link-padding-horizontal)}.menu__list-item:not(:first-child){margin-top:.25rem}.menu__list-item--collapsed .menu__list{height:0;overflow:hidden}.details_lb9f[data-collapsed=false].isBrowser_bmU9>summary:before,.details_lb9f[open]:not(.isBrowser_bmU9)>summary:before,.menu__list-item--collapsed .menu__caret:before,.menu__list-item--collapsed .menu__link--sublist:after{transform:rotate(90deg)}.menu__list-item-collapsible{display:flex;flex-wrap:wrap;position:relative}.menu__caret:hover,.menu__link:hover,.menu__list-item-collapsible--active,.menu__list-item-collapsible:hover{background:var(--ifm-menu-color-background-hover)}.menu__list-item-collapsible .menu__link--active,.menu__list-item-collapsible .menu__link:hover{background:none!important}.menu__caret,.menu__link{align-items:center;display:flex}.menu__link{color:var(--ifm-menu-color);flex:1;line-height:1.25}.menu__link:hover{color:var(--ifm-menu-color);text-decoration:none}.menu__caret:before,.menu__link--sublist-caret:after{height:1.25rem;transform:rotate(180deg);transition:transform var(--ifm-transition-fast) linear;width:1.25rem;filter:var(--ifm-menu-link-sublist-icon-filter);content:""}.menu__link--sublist-caret:after{background:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem;margin-left:auto;min-width:1.25rem}.menu__link--active,.menu__link--active:hover{color:var(--ifm-menu-color-active)}.navbar__brand,.navbar__link{color:var(--ifm-navbar-link-color)}.menu__link--active:not(.menu__link--sublist){background-color:var(--ifm-menu-color-background-active)}.menu__caret:before{background:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem}.navbar--dark,html[data-theme=dark]{--ifm-menu-link-sublist-icon-filter:invert(100%) sepia(94%) saturate(17%) hue-rotate(223deg) brightness(104%) contrast(98%)}.navbar{background-color:var(--ifm-navbar-background-color);box-shadow:var(--ifm-navbar-shadow);height:var(--ifm-navbar-height);padding:var(--ifm-navbar-padding-vertical) var(--ifm-navbar-padding-horizontal)}.docsWrapper_BCFX,.navbar,.navbar>.container,.navbar>.container-fluid{display:flex}.navbar--fixed-top{position:sticky;top:0;z-index:var(--ifm-z-index-fixed)}.navbar-sidebar,.navbar-sidebar__backdrop{bottom:0;opacity:0;position:fixed;transition-timing-function:ease-in-out;left:0;top:0;visibility:hidden}.navbar__inner{display:flex;flex-wrap:wrap;justify-content:space-between;width:100%}.navbar__brand{align-items:center;display:flex;min-width:0}.navbar__brand:hover{color:var(--ifm-navbar-link-hover-color);text-decoration:none}.announcementBarContent_xLdY,.navbar__title{flex:1 1 auto}.navbar__toggle{display:none;margin-right:.5rem}.navbar__logo{flex:0 0 auto;height:2rem;margin-right:.5rem}.navbar__items{align-items:center;display:flex;flex:1;min-width:0}.navbar__items--center{flex:0 0 auto}.navbar__items--center .navbar__brand,.theme-doc-markdown.markdown table.custom-table tr td>*{margin:0}.navbar__items--center+.navbar__items--right{flex:1}.navbar__items--right{flex:0 0 auto;justify-content:flex-end}.navbar__items--right>:last-child{padding-right:0}.navbar__item{display:inline-block;padding:var(--ifm-navbar-item-padding-vertical) var(--ifm-navbar-item-padding-horizontal)}.navbar__link--active,.navbar__link:hover{color:var(--ifm-navbar-link-hover-color);text-decoration:none}.navbar--dark,.navbar--primary{--ifm-menu-color:var(--ifm-color-gray-300);--ifm-navbar-link-color:var(--ifm-color-gray-100);--ifm-navbar-search-input-background-color:#ffffff1a;--ifm-navbar-search-input-placeholder-color:#ffffff80;color:var(--ifm-color-white)}.navbar--dark{--ifm-navbar-background-color:#242526;--ifm-menu-color-background-active:#ffffff0d;--ifm-navbar-search-input-color:var(--ifm-color-white)}.navbar--primary{--ifm-navbar-background-color:var(--ifm-color-primary);--ifm-navbar-link-hover-color:var(--ifm-color-white);--ifm-menu-color-active:var(--ifm-color-white);--ifm-navbar-search-input-color:var(--ifm-color-emphasis-500)}.navbar__search-input{-webkit-appearance:none;appearance:none;background:var(--ifm-navbar-search-input-background-color) var(--ifm-navbar-search-input-icon) no-repeat .75rem center/1rem 1rem;border:none;border-radius:2rem;color:var(--ifm-navbar-search-input-color);cursor:text;display:inline-block;font-size:.9rem;height:2rem;padding:0 .5rem 0 2.25rem;width:12.5rem}.navbar__search-input::placeholder{color:var(--ifm-navbar-search-input-placeholder-color)}.navbar-sidebar{background-color:var(--ifm-navbar-background-color);box-shadow:var(--ifm-global-shadow-md);transform:translate3d(-100%,0,0);transition-duration:.25s;transition-property:opacity,visibility,transform;width:var(--ifm-navbar-sidebar-width)}.navbar-sidebar--show .navbar-sidebar,.navbar-sidebar__items{transform:translateZ(0)}.navbar-sidebar--show .navbar-sidebar,.navbar-sidebar--show .navbar-sidebar__backdrop{opacity:1;visibility:visible}.navbar-sidebar__backdrop{background-color:#0009;right:0;transition-duration:.1s;transition-property:opacity,visibility}.navbar-sidebar__brand{align-items:center;box-shadow:var(--ifm-navbar-shadow);display:flex;flex:1;height:var(--ifm-navbar-height);padding:var(--ifm-navbar-padding-vertical) var(--ifm-navbar-padding-horizontal)}.navbar-sidebar__items{display:flex;height:calc(100% - var(--ifm-navbar-height));transition:transform var(--ifm-transition-fast) ease-in-out}.navbar-sidebar__items--show-secondary{transform:translate3d(calc((var(--ifm-navbar-sidebar-width))*-1),0,0)}.navbar-sidebar__item{flex-shrink:0;padding:.5rem;width:calc(var(--ifm-navbar-sidebar-width))}.navbar-sidebar__back{background:var(--ifm-menu-color-background-active);font-size:15px;font-weight:var(--ifm-button-font-weight);margin:0 0 .2rem -.5rem;padding:.6rem 1.5rem;position:relative;text-align:left;top:-.5rem;width:calc(100% + 1rem)}.navbar-sidebar__close{display:flex;margin-left:auto}.pagination{column-gap:var(--ifm-pagination-page-spacing);display:flex;font-size:var(--ifm-pagination-font-size);padding-left:0}.pagination--sm{--ifm-pagination-font-size:0.8rem;--ifm-pagination-padding-horizontal:0.8rem;--ifm-pagination-padding-vertical:0.2rem}.pagination--lg{--ifm-pagination-font-size:1.2rem;--ifm-pagination-padding-horizontal:1.2rem;--ifm-pagination-padding-vertical:0.3rem}.pagination__item{display:inline-flex}.pagination__item>span{padding:var(--ifm-pagination-padding-vertical)}.pagination__item--active .pagination__link{color:var(--ifm-pagination-color-active)}.pagination__item--active .pagination__link,.pagination__item:not(.pagination__item--active):hover .pagination__link{background:var(--ifm-pagination-item-active-background)}.pagination__item--disabled,.pagination__item[disabled]{opacity:.25;pointer-events:none}.pagination__link{border-radius:var(--ifm-pagination-border-radius);color:var(--ifm-font-color-base);display:inline-block;padding:var(--ifm-pagination-padding-vertical) var(--ifm-pagination-padding-horizontal);transition:background var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.pagination__link:hover{text-decoration:none}.pagination-nav{grid-gap:var(--ifm-spacing-horizontal);display:grid;gap:var(--ifm-spacing-horizontal);grid-template-columns:repeat(2,1fr)}.pagination-nav__link{border:1px solid var(--ifm-color-emphasis-300);border-radius:var(--ifm-pagination-nav-border-radius);display:block;height:100%;line-height:var(--ifm-heading-line-height);padding:var(--ifm-global-spacing);transition:border-color var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.pagination-nav__link:hover{border-color:var(--ifm-pagination-nav-color-hover);text-decoration:none}.pagination-nav__link--next{grid-column:2/3;text-align:right}.pagination-nav__label{font-size:var(--ifm-h4-font-size);font-weight:var(--ifm-heading-font-weight);word-break:break-word}.pagination-nav__link--prev .pagination-nav__label:before{content:"« "}.pagination-nav__link--next .pagination-nav__label:after{content:" »"}.pagination-nav__sublabel{color:var(--ifm-color-content-secondary);font-size:var(--ifm-h5-font-size);font-weight:var(--ifm-font-weight-semibold);margin-bottom:.25rem}.pills__item,.tabs{font-weight:var(--ifm-font-weight-bold)}.pills{display:flex;gap:var(--ifm-pills-spacing);padding-left:0}.pills__item{border-radius:.5rem;cursor:pointer;display:inline-block;padding:.25rem 1rem;transition:background var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.tabs,:not(.containsTaskList_mC6p>li)>.containsTaskList_mC6p{padding-left:0}.pills__item--active{color:var(--ifm-pills-color-active)}.pills__item--active,.pills__item:not(.pills__item--active):hover{background:var(--ifm-pills-color-background-active)}.pills--block{justify-content:stretch}.pills--block .pills__item{flex-grow:1;text-align:center}.tabs{color:var(--ifm-tabs-color);display:flex;margin-bottom:0;overflow-x:auto}.tabs__item{border-bottom:3px solid #0000;border-radius:var(--ifm-global-radius);cursor:pointer;display:inline-flex;padding:var(--ifm-tabs-padding-vertical) var(--ifm-tabs-padding-horizontal);transition:background-color var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.tabs__item--active{border-bottom-color:var(--ifm-tabs-color-active-border);border-bottom-left-radius:0;border-bottom-right-radius:0;color:var(--ifm-tabs-color-active)}.tabs__item:hover{background-color:var(--ifm-hover-overlay)}.tabs--block{justify-content:stretch}.tabs--block .tabs__item{flex-grow:1;justify-content:center}html[data-theme=dark]{--ifm-color-scheme:dark;--ifm-color-emphasis-0:var(--ifm-color-gray-1000);--ifm-color-emphasis-100:var(--ifm-color-gray-900);--ifm-color-emphasis-200:var(--ifm-color-gray-800);--ifm-color-emphasis-300:var(--ifm-color-gray-700);--ifm-color-emphasis-400:var(--ifm-color-gray-600);--ifm-color-emphasis-600:var(--ifm-color-gray-400);--ifm-color-emphasis-700:var(--ifm-color-gray-300);--ifm-color-emphasis-800:var(--ifm-color-gray-200);--ifm-color-emphasis-900:var(--ifm-color-gray-100);--ifm-color-emphasis-1000:var(--ifm-color-gray-0);--ifm-background-color:#1b1b1d;--ifm-background-surface-color:#242526;--ifm-hover-overlay:#ffffff0d;--ifm-color-content:#e3e3e3;--ifm-color-content-secondary:#fff;--ifm-breadcrumb-separator-filter:invert(64%) sepia(11%) saturate(0%) hue-rotate(149deg) brightness(99%) contrast(95%);--ifm-code-background:#ffffff1a;--ifm-scrollbar-track-background-color:#444;--ifm-scrollbar-thumb-background-color:#686868;--ifm-scrollbar-thumb-hover-background-color:#7a7a7a;--ifm-table-stripe-background:#ffffff12;--ifm-toc-border-color:var(--ifm-color-emphasis-200);--ifm-color-primary-contrast-background:#102445;--ifm-color-primary-contrast-foreground:#ebf2fc;--ifm-color-secondary-contrast-background:#474748;--ifm-color-secondary-contrast-foreground:#fdfdfe;--ifm-color-success-contrast-background:#003100;--ifm-color-success-contrast-foreground:#e6f6e6;--ifm-color-info-contrast-background:#193c47;--ifm-color-info-contrast-foreground:#eef9fd;--ifm-color-warning-contrast-background:#4d3800;--ifm-color-warning-contrast-foreground:#fff8e6;--ifm-color-danger-contrast-background:#4b1113;--ifm-color-danger-contrast-foreground:#ffebec;--docsearch-text-color:#f5f6f7;--docsearch-container-background:#090a11cc;--docsearch-modal-background:#15172a;--docsearch-modal-shadow:inset 1px 1px 0 0 #2c2e40,0 3px 8px 0 #000309;--docsearch-searchbox-background:#090a11;--docsearch-searchbox-focus-background:#000;--docsearch-hit-color:#bec3c9;--docsearch-hit-shadow:none;--docsearch-hit-background:#090a11;--docsearch-key-gradient:linear-gradient(-26.5deg,#565872,#31355b);--docsearch-key-shadow:inset 0 -2px 0 0 #282d55,inset 0 0 1px 1px #51577d,0 2px 2px 0 #0304094d;--docsearch-footer-background:#1e2136;--docsearch-footer-shadow:inset 0 1px 0 0 #494c6a80,0 -4px 8px 0 #0003;--docsearch-logo-color:#fff;--docsearch-muted-color:#7f8497}#nprogress .bar{background:var(--docusaurus-progress-bar-color);height:2px;left:0;position:fixed;top:0;width:100%;z-index:1031}#nprogress .peg{box-shadow:0 0 10px var(--docusaurus-progress-bar-color),0 0 5px var(--docusaurus-progress-bar-color);height:100%;opacity:1;position:absolute;right:0;transform:rotate(3deg) translateY(-4px);width:100px}.menu__link{padding-right:0!important}.theme-doc-markdown.markdown hr,.theme-doc-markdown.markdown+hr{background-color:#eee;margin-bottom:40px;margin-top:40px}[data-theme=dark] blockquote{background-color:#282a36}.theme-code-block[class*=language-]{border-radius:0!important;color:#fff!important;font-size:.9em!important;background:#2e8555!important}.theme-code-block[class*=language-]>div>pre{border-radius:0}.theme-code-block[class*=language-]>div>pre>code>span{display:block;margin-bottom:1px}.navbar__brand{margin-right:1.5rem}.aa-DetachedSearchButton{background-color:#fff;border-color:#d5d8da!important;height:33px;width:100px!important}.aa-DetachedSearchButton .aa-DetachedSearchButtonIcon{color:#d5d8da}.aa-DetachedSearchButton .aa-DetachedSearchButtonIcon .aa-DetachedSearchButtonPlaceholder,.ebook-wrapper .ebook.ebook-current .ebook-checkmark,.tocCollapsibleContent_vkbj a{display:block}.aa-DetachedSearchButton .aa-DetachedSearchButtonIcon .aa-DetachedSearchButtonPlaceholder:after{content:"Search ..."}.token-line .token.comment{font-style:normal!important}.menu.thin-scrollbar{padding-bottom:25px}.theme-doc-markdown.markdown a{font-weight:500}.theme-doc-markdown.markdown .section-footnote h3{margin-top:calc(var(--ifm-h3-vertical-rhythm-top)*var(--ifm-leading))}.table-of-contents li a>code,.theme-doc-markdown.markdown h1>code,.theme-doc-markdown.markdown h2>code,.theme-doc-markdown.markdown h3>code,.theme-doc-markdown.markdown li>code,.theme-doc-markdown.markdown p>code,.theme-doc-markdown.markdown td>code{padding:2px 5px}.theme-doc-markdown.markdown table.custom-table.full{display:table;width:100%}.theme-doc-markdown.markdown table.custom-table tr:nth-child(2n){background-color:initial!important}.theme-doc-markdown.markdown table tr td>.theme-code-block:nth-of-type(n+1){margin-top:10px}.theme-doc-markdown.markdown table.no-content-background tr:nth-child(2n){background-color:initial}.substack-iframe{background:#fff;border:1px solid #eee}.disqus-wrapper{margin-top:30px}.ebook-wrapper{display:block;margin-top:40px;text-align:center}.ebook-wrapper h3{margin-bottom:10px}.ebook-wrapper h3 .underline{border-bottom:1px solid #c2c2c2;padding-bottom:2px}.ebook-wrapper .ebook{display:inline-block;margin:5px;padding:10px;position:relative;vertical-align:top;width:200px}.ebook-wrapper .ebook a{color:#000;cursor:pointer;display:block}.ebook-wrapper .ebook .ebook-checkmark{display:none;font-size:30px;left:-10px;position:absolute;top:-15px}.ebook-wrapper .ebook.ebook-current{cursor:no-drop}.ebook-wrapper .ebook .ebook-img{box-shadow:0 2px 8px 0 #63636333;display:block;margin-bottom:10px}.ebook-wrapper .ebook:not(.ebook-current):hover .ebook-img{box-shadow:0 3px 9px 0 #63636380}.ebook-wrapper .ebook .ebook-title{display:inline-block;font-style:italic;font-weight:var(--ifm-h3-font-size);opacity:.8;text-align:center}.ebook-wrapper .ebook:not(.ebook-current):hover .ebook-title,.footerLogoLink_BH7S:hover,.hash-link:focus,:hover>.hash-link{opacity:1}[data-theme=dark]{--ifm-color-primary:#25c2a0;--ifm-color-primary-dark:#21af90;--ifm-color-primary-darker:#1fa588;--ifm-color-primary-darkest:#1a8870;--ifm-color-primary-light:#29d5b0;--ifm-color-primary-lighter:#32d8b4;--ifm-color-primary-lightest:#4fddbf;--docusaurus-highlighted-code-line-bg:#0000004d}body:not(.navigation-with-keyboard) :not(input):focus{outline:0}#docusaurus-base-url-issue-banner-container,.themedImage_ToTc,[data-theme=dark] .lightToggleIcon_pyhR,[data-theme=light] .darkToggleIcon_wfgR,html[data-announcement-bar-initially-dismissed=true] .announcementBar_mb4j{display:none}.skipToContent_fXgn{background-color:var(--ifm-background-surface-color);color:var(--ifm-color-emphasis-900);left:100%;padding:calc(var(--ifm-global-spacing)/2) var(--ifm-global-spacing);position:fixed;top:1rem;z-index:calc(var(--ifm-z-index-fixed) + 1)}.skipToContent_fXgn:focus{box-shadow:var(--ifm-global-shadow-md);left:1rem}.closeButton_CVFx{line-height:0;padding:0}.content_knG7{font-size:85%;padding:5px 0;text-align:center}.content_knG7 a{color:inherit;text-decoration:underline}.DocSearch-Container a,.tag_zVej:hover{text-decoration:none}.announcementBar_mb4j{align-items:center;background-color:var(--ifm-color-white);border-bottom:1px solid var(--ifm-color-emphasis-100);color:var(--ifm-color-black);display:flex;height:var(--docusaurus-announcement-bar-height)}.announcementBarPlaceholder_vyr4{flex:0 0 10px}.announcementBarClose_gvF7{align-self:stretch;flex:0 0 30px}.toggle_vylO{height:2rem;width:2rem}.toggleButton_gllP{align-items:center;border-radius:50%;display:flex;height:100%;justify-content:center;transition:background var(--ifm-transition-fast);width:100%}.toggleButton_gllP:hover{background:var(--ifm-color-emphasis-200)}.toggleButtonDisabled_aARS{cursor:not-allowed}[data-theme=dark] .themedImage--dark_i4oU,[data-theme=light] .themedImage--light_HNdA{display:initial}.iconExternalLink_nPIU{margin-left:.3rem}.iconLanguage_nlXk{margin-right:5px;vertical-align:text-bottom}.navbarHideable_m1mJ{transition:transform var(--ifm-transition-fast) ease}.navbarHidden_jGov{transform:translate3d(0,calc(-100% - 2px),0)}.footerLogoLink_BH7S{opacity:.5;transition:opacity var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.mainWrapper_z2l0{flex:1 0 auto}.docusaurus-mt-lg{margin-top:3rem}#__docusaurus{display:flex;flex-direction:column;min-height:100%}.iconEdit_Z9Sw{margin-right:.3em;vertical-align:sub}.tag_zVej{border:1px solid var(--docusaurus-tag-list-border);transition:border var(--ifm-transition-fast)}.tag_zVej:hover{--docusaurus-tag-list-border:var(--ifm-link-color)}.tagRegular_sFm0{border-radius:var(--ifm-global-radius);font-size:90%;padding:.2rem .5rem .3rem}.tagWithCount_h2kH{align-items:center;border-left:0;display:flex;padding:0 .5rem 0 1rem;position:relative}.tagWithCount_h2kH:after,.tagWithCount_h2kH:before{border:1px solid var(--docusaurus-tag-list-border);content:"";position:absolute;top:50%;transition:inherit}.tagWithCount_h2kH:before{border-bottom:0;border-right:0;height:1.18rem;right:100%;transform:translate(50%,-50%) rotate(-45deg);width:1.18rem}.tagWithCount_h2kH:after{border-radius:50%;height:.5rem;left:0;transform:translateY(-50%);width:.5rem}.tagWithCount_h2kH span{background:var(--ifm-color-secondary);border-radius:var(--ifm-global-radius);color:var(--ifm-color-black);font-size:.7rem;line-height:1.2;margin-left:.3rem;padding:.1rem .4rem}.tags_jXut{display:inline}.tag_QGVx{display:inline-block;margin:0 .4rem .5rem 0}.lastUpdated_vwxv{font-size:smaller;font-style:italic;margin-top:.2rem}.tocCollapsibleButton_TO0P{align-items:center;display:flex;font-size:inherit;justify-content:space-between;padding:.4rem .8rem;width:100%}.tocCollapsibleButton_TO0P:after{background:var(--ifm-menu-link-sublist-icon) 50% 50%/2rem 2rem no-repeat;content:"";filter:var(--ifm-menu-link-sublist-icon-filter);height:1.25rem;transform:rotate(180deg);transition:transform var(--ifm-transition-fast);width:1.25rem}.tocCollapsibleButtonExpanded_MG3E:after,.tocCollapsibleExpanded_sAul{transform:none}.tocCollapsible_ETCw{background-color:var(--ifm-menu-color-background-active);border-radius:var(--ifm-global-radius);margin:1rem 0}.buttonGroup__atx button,.codeBlockContainer_Ckt0{background:var(--prism-background-color);color:var(--prism-color)}.tocCollapsibleContent_vkbj>ul{border-left:none;border-top:1px solid var(--ifm-color-emphasis-300);font-size:15px;padding:.2rem 0}.tocCollapsibleContent_vkbj ul li{margin:.4rem .8rem}.tableOfContents_bqdL{max-height:calc(100vh - var(--ifm-navbar-height) - 2rem);overflow-y:auto;position:sticky;top:calc(var(--ifm-navbar-height) + 1rem)}.anchorWithStickyNavbar_LWe7{scroll-margin-top:calc(var(--ifm-navbar-height) + .5rem)}.anchorWithHideOnScrollNavbar_WYt5{scroll-margin-top:.5rem}.hash-link{opacity:0;padding-left:.5rem;transition:opacity var(--ifm-transition-fast);user-select:none}.hash-link:before{content:"#"}.codeBlockContainer_Ckt0{border-radius:var(--ifm-code-border-radius);box-shadow:var(--ifm-global-shadow-lw);margin-bottom:var(--ifm-leading)}.codeBlockContent_biex{border-radius:inherit;direction:ltr;position:relative}.codeBlockTitle_Ktv7{border-bottom:1px solid var(--ifm-color-emphasis-300);border-top-left-radius:inherit;border-top-right-radius:inherit;font-size:var(--ifm-code-font-size);font-weight:500;padding:.75rem var(--ifm-pre-padding)}.codeBlock_bY9V{--ifm-pre-background:var(--prism-background-color);margin:0;padding:0}.codeBlockTitle_Ktv7+.codeBlockContent_biex .codeBlock_bY9V{border-top-left-radius:0;border-top-right-radius:0}.codeBlockLines_e6Vv{float:left;font:inherit;min-width:100%;padding:var(--ifm-pre-padding)}.codeBlockLinesWithNumbering_o6Pm{display:table;padding:var(--ifm-pre-padding) 0}.buttonGroup__atx{column-gap:.2rem;display:flex;position:absolute;right:calc(var(--ifm-pre-padding)/2);top:calc(var(--ifm-pre-padding)/2)}.buttonGroup__atx button{align-items:center;border:1px solid var(--ifm-color-emphasis-300);border-radius:var(--ifm-global-radius);display:flex;line-height:0;opacity:0;padding:.4rem;transition:opacity .2s ease-in-out}.buttonGroup__atx button:focus-visible,.buttonGroup__atx button:hover{opacity:1!important}.theme-code-block:hover .buttonGroup__atx button{opacity:.4}:where(:root){--docusaurus-highlighted-code-line-bg:#484d5b}:where([data-theme=dark]){--docusaurus-highlighted-code-line-bg:#646464}.theme-code-block-highlighted-line{background-color:var(--docusaurus-highlighted-code-line-bg);display:block;margin:0 calc(var(--ifm-pre-padding)*-1);padding:0 var(--ifm-pre-padding)}.codeLine_lJS_{counter-increment:a;display:table-row}.codeLineNumber_Tfdd{background:var(--ifm-pre-background);display:table-cell;left:0;overflow-wrap:normal;padding:0 var(--ifm-pre-padding);position:sticky;text-align:right;width:1%}.codeLineNumber_Tfdd:before{content:counter(a);opacity:.4}.codeLineContent_feaV{padding-right:var(--ifm-pre-padding)}.theme-code-block:hover .copyButtonCopied_obH4{opacity:1!important}.copyButtonIcons_eSgA{height:1.125rem;position:relative;width:1.125rem}.copyButtonIcon_y97N,.copyButtonSuccessIcon_LjdS{fill:currentColor;height:inherit;left:0;opacity:inherit;position:absolute;top:0;transition:.15s;width:inherit}.copyButtonSuccessIcon_LjdS{color:#00d600;left:50%;opacity:0;top:50%;transform:translate(-50%,-50%) scale(.33)}.copyButtonCopied_obH4 .copyButtonIcon_y97N{opacity:0;transform:scale(.33)}.copyButtonCopied_obH4 .copyButtonSuccessIcon_LjdS{opacity:1;transform:translate(-50%,-50%) scale(1);transition-delay:75ms}.wordWrapButtonIcon_Bwma{height:1.2rem;width:1.2rem}.details_lb9f{--docusaurus-details-summary-arrow-size:0.38rem;--docusaurus-details-transition:transform 200ms ease;--docusaurus-details-decoration-color:grey}.details_lb9f>summary{cursor:pointer;list-style:none;padding-left:1rem;position:relative}.details_lb9f>summary::-webkit-details-marker{display:none}.details_lb9f>summary:before{border-color:#0000 #0000 #0000 var(--docusaurus-details-decoration-color);border-style:solid;border-width:var(--docusaurus-details-summary-arrow-size);content:"";left:0;position:absolute;top:.45rem;transform:rotate(0);transform-origin:calc(var(--docusaurus-details-summary-arrow-size)/2) 50%;transition:var(--docusaurus-details-transition)}.collapsibleContent_i85q{border-top:1px solid var(--docusaurus-details-decoration-color);margin-top:1rem;padding-top:1rem}.details_b_Ee{--docusaurus-details-decoration-color:var(--ifm-alert-border-color);--docusaurus-details-transition:transform var(--ifm-transition-fast) ease;border:1px solid var(--ifm-alert-border-color);margin:0 0 var(--ifm-spacing-vertical)}.containsTaskList_mC6p{list-style:none}.img_CujE{height:auto}.admonition_LlT9{margin-bottom:1em}.admonitionHeading_tbUL{font:var(--ifm-heading-font-weight) var(--ifm-h5-font-size)/var(--ifm-heading-line-height) var(--ifm-heading-font-family);margin-bottom:.3rem}.admonitionHeading_tbUL code{text-transform:none}.admonitionIcon_kALy{display:inline-block;margin-right:.4em;vertical-align:middle}.admonitionIcon_kALy svg{fill:var(--ifm-alert-foreground-color);display:inline-block;height:1.6em;width:1.6em}.breadcrumbsContainer_Z_bl{--ifm-breadcrumb-size-multiplier:0.8;margin-bottom:.8rem}.breadcrumbHomeIcon_OVgt{height:1.1rem;position:relative;top:1px;vertical-align:top;width:1.1rem}.searchQueryInput_u2C7,.searchVersionInput_m0Ui{background:var(--docsearch-searchbox-focus-background);border:2px solid var(--ifm-toc-border-color);border-radius:var(--ifm-global-radius);color:var(--docsearch-text-color);font:var(--ifm-font-size-base) var(--ifm-font-family-base);margin-bottom:.5rem;padding:.8rem;transition:border var(--ifm-transition-fast) ease;width:100%}.searchQueryInput_u2C7:focus,.searchVersionInput_m0Ui:focus{border-color:var(--docsearch-primary-color);outline:0}.searchQueryInput_u2C7::placeholder{color:var(--docsearch-muted-color)}.searchResultsColumn_JPFH{font-size:.9rem;font-weight:700}.algoliaLogo_rT1R{max-width:150px}.algoliaLogoPathFill_WdUC{fill:var(--ifm-font-color-base)}.searchResultItem_Tv2o{border-bottom:1px solid var(--ifm-toc-border-color);padding:1rem 0}.searchResultItemHeading_KbCB{font-weight:400;margin-bottom:0}.searchResultItemPath_lhe1{--ifm-breadcrumb-separator-size-multiplier:1;color:var(--ifm-color-content-secondary);font-size:.8rem}.searchResultItemSummary_AEaO{font-style:italic;margin:.5rem 0 0}.loadingSpinner_XVxU{animation:1s linear infinite a;border:.4em solid #eee;border-radius:50%;border-top:.4em solid var(--ifm-color-primary);height:3rem;margin:0 auto;width:3rem}@keyframes a{to{transform:rotate(1turn)}}.loader_vvXV{margin-top:2rem}.search-result-match{background:#ffd78e40;color:var(--docsearch-hit-color);padding:.09em 0}.backToTopButton_sjWU{background-color:var(--ifm-color-emphasis-200);border-radius:50%;bottom:1.3rem;box-shadow:var(--ifm-global-shadow-lw);height:3rem;opacity:0;position:fixed;right:1.3rem;transform:scale(0);transition:all var(--ifm-transition-fast) var(--ifm-transition-timing-default);visibility:hidden;width:3rem;z-index:calc(var(--ifm-z-index-fixed) - 1)}.backToTopButton_sjWU:after{background-color:var(--ifm-color-emphasis-1000);content:" ";display:inline-block;height:100%;-webkit-mask:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem no-repeat;mask:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem no-repeat;width:100%}.backToTopButtonShow_xfvO{opacity:1;transform:scale(1);visibility:visible}[data-theme=dark]:root{--docusaurus-collapse-button-bg:#ffffff0d;--docusaurus-collapse-button-bg-hover:#ffffff1a}.collapseSidebarButton_PEFL,.docSidebarContainer_b6E3,.sidebarLogo_isFc{display:none}.docMainContainer_gTbr,.docPage__5DB{display:flex;width:100%}.DocSearch-Button{align-items:center;background:var(--docsearch-searchbox-background);border:0;border-radius:40px;color:var(--docsearch-muted-color);cursor:pointer;display:flex;font-weight:500;height:36px;justify-content:space-between;padding:0 8px;-webkit-user-select:none;user-select:none}.DocSearch-Button:active,.DocSearch-Button:focus,.DocSearch-Button:hover{background:var(--docsearch-searchbox-focus-background);box-shadow:var(--docsearch-searchbox-shadow);color:var(--docsearch-text-color);outline:0}.DocSearch-Button-Container{align-items:center;display:flex}.DocSearch-Search-Icon{stroke-width:1.6}.DocSearch-Hit-Tree,.DocSearch-Hit-action,.DocSearch-Hit-icon,.DocSearch-Reset{stroke-width:var(--docsearch-icon-stroke-width)}.DocSearch-Button .DocSearch-Search-Icon{color:var(--docsearch-text-color)}.DocSearch-Button-Placeholder{font-size:1rem;padding:0 12px 0 6px}.DocSearch-Input,.DocSearch-Link{-webkit-appearance:none;font:inherit}.DocSearch-Button-Keys{display:flex;min-width:calc(40px + .8em)}.DocSearch-Button-Key{align-items:center;background:var(--docsearch-key-gradient);border:0;border-radius:3px;box-shadow:var(--docsearch-key-shadow);color:var(--docsearch-muted-color);display:flex;height:18px;justify-content:center;margin-right:.4em;padding:0 0 2px;position:relative;top:-1px;width:20px}.DocSearch--active{overflow:hidden!important}.DocSearch-Container{background-color:var(--docsearch-container-background);height:100vh;left:0;position:fixed;top:0;width:100vw;z-index:200}.DocSearch-Link{appearance:none;background:none;border:0;color:var(--docsearch-highlight-color);cursor:pointer;margin:0;padding:0}.DocSearch-Modal{background:var(--docsearch-modal-background);border-radius:6px;box-shadow:var(--docsearch-modal-shadow);flex-direction:column;margin:60px auto auto;max-width:var(--docsearch-modal-width);position:relative}.DocSearch-SearchBar{display:flex;padding:var(--docsearch-spacing) var(--docsearch-spacing) 0}.DocSearch-Form{align-items:center;background:var(--docsearch-searchbox-focus-background);border-radius:4px;box-shadow:var(--docsearch-searchbox-shadow);display:flex;height:var(--docsearch-searchbox-height);margin:0;padding:0 var(--docsearch-spacing);position:relative;width:100%}.DocSearch-Input{appearance:none;background:#0000;border:0;color:var(--docsearch-text-color);flex:1;font-size:1.2em;height:100%;outline:0;padding:0 0 0 8px;width:80%}.DocSearch-Hit-action-button,.DocSearch-Reset{-webkit-appearance:none;border:0;cursor:pointer}.DocSearch-Input::placeholder{color:var(--docsearch-muted-color);opacity:1}.DocSearch-Input::-webkit-search-cancel-button,.DocSearch-Input::-webkit-search-decoration,.DocSearch-Input::-webkit-search-results-button,.DocSearch-Input::-webkit-search-results-decoration{display:none}.DocSearch-LoadingIndicator,.DocSearch-MagnifierLabel,.DocSearch-Reset{margin:0;padding:0}.DocSearch-Container--Stalled .DocSearch-LoadingIndicator,.DocSearch-MagnifierLabel,.DocSearch-Reset{align-items:center;color:var(--docsearch-highlight-color);display:flex;justify-content:center}.DocSearch-Cancel,.DocSearch-Container--Stalled .DocSearch-MagnifierLabel,.DocSearch-LoadingIndicator,.DocSearch-Reset[hidden]{display:none}.DocSearch-Reset{animation:.1s ease-in forwards b;appearance:none;background:none;border-radius:50%;color:var(--docsearch-icon-color);padding:2px;right:0}.DocSearch-Help,.DocSearch-HitsFooter,.DocSearch-Label{color:var(--docsearch-muted-color)}.DocSearch-Reset:focus{outline:0}.DocSearch-Reset:hover{color:var(--docsearch-highlight-color)}.DocSearch-LoadingIndicator svg,.DocSearch-MagnifierLabel svg{height:24px;width:24px}.DocSearch-Dropdown{max-height:calc(var(--docsearch-modal-height) - var(--docsearch-searchbox-height) - var(--docsearch-spacing) - var(--docsearch-footer-height));min-height:var(--docsearch-spacing);overflow-y:auto;overflow-y:overlay;padding:0 var(--docsearch-spacing);scrollbar-color:var(--docsearch-muted-color) var(--docsearch-modal-background);scrollbar-width:thin}.DocSearch-Dropdown::-webkit-scrollbar{width:12px}.DocSearch-Dropdown::-webkit-scrollbar-track{background:#0000}.DocSearch-Dropdown::-webkit-scrollbar-thumb{background-color:var(--docsearch-muted-color);border:3px solid var(--docsearch-modal-background);border-radius:20px}.DocSearch-Dropdown ul{list-style:none;margin:0;padding:0}.DocSearch-Label{font-size:.75em;line-height:1.6em}.DocSearch-Help{font-size:.9em;margin:0;-webkit-user-select:none;user-select:none}.DocSearch-Title{font-size:1.2em}.DocSearch-Logo a{display:flex}.DocSearch-Logo svg{color:var(--docsearch-logo-color);margin-left:8px}.DocSearch-Hits:last-of-type{margin-bottom:24px}.DocSearch-Hits mark{background:none;color:var(--docsearch-highlight-color)}.DocSearch-HitsFooter{display:flex;font-size:.85em;justify-content:center;margin-bottom:var(--docsearch-spacing);padding:var(--docsearch-spacing)}.DocSearch-HitsFooter a{border-bottom:1px solid;color:inherit}.DocSearch-Hit{border-radius:4px;display:flex;padding-bottom:4px;position:relative}.DocSearch-Hit--deleting{opacity:0;transition:.25s linear}.DocSearch-Hit--favoriting{transform:scale(0);transform-origin:top center;transition:.25s linear .25s}.DocSearch-Hit a{background:var(--docsearch-hit-background);border-radius:4px;box-shadow:var(--docsearch-hit-shadow);display:block;padding-left:var(--docsearch-spacing);width:100%}.DocSearch-Hit-source{background:var(--docsearch-modal-background);color:var(--docsearch-highlight-color);font-size:.85em;font-weight:600;line-height:32px;margin:0 -4px;padding:8px 4px 0;position:sticky;top:0;z-index:10}.DocSearch-Hit-Tree{color:var(--docsearch-muted-color);height:var(--docsearch-hit-height);opacity:.5;width:24px}.DocSearch-Hit[aria-selected=true] a{background-color:var(--docsearch-highlight-color)}.DocSearch-Hit[aria-selected=true] mark{text-decoration:underline}.DocSearch-Hit-Container{align-items:center;color:var(--docsearch-hit-color);display:flex;flex-direction:row;height:var(--docsearch-hit-height);padding:0 var(--docsearch-spacing) 0 0}.DocSearch-Hit-icon{height:20px;width:20px}.DocSearch-Hit-action,.DocSearch-Hit-icon{color:var(--docsearch-muted-color)}.DocSearch-Hit-action{align-items:center;display:flex;height:22px;width:22px}.DocSearch-Hit-action svg{display:block;height:18px;width:18px}.DocSearch-Hit-action+.DocSearch-Hit-action{margin-left:6px}.DocSearch-Hit-action-button{appearance:none;background:none;border-radius:50%;color:inherit;padding:2px}svg.DocSearch-Hit-Select-Icon{display:none}.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-Select-Icon{display:block}.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{background:#0003;transition:background-color .1s ease-in}.DocSearch-Hit-action-button:focus path,.DocSearch-Hit-action-button:hover path{fill:#fff}.DocSearch-Hit-content-wrapper{display:flex;flex:1 1 auto;flex-direction:column;font-weight:500;justify-content:center;line-height:1.2em;margin:0 8px;overflow-x:hidden;position:relative;width:80%}.DocSearch-Hit-title{font-size:.9em}.DocSearch-Hit-path{color:var(--docsearch-muted-color);font-size:.75em}.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-Tree,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-action,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-icon,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-path,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-text,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-title,.DocSearch-Hit[aria-selected=true] mark{color:var(--docsearch-hit-active-color)!important}.DocSearch-ErrorScreen,.DocSearch-NoResults,.DocSearch-StartScreen{font-size:.9em;margin:0 auto;padding:36px 0;text-align:center;width:80%}.DocSearch-Screen-Icon{color:var(--docsearch-muted-color);padding-bottom:12px}.DocSearch-NoResults-Prefill-List{display:inline-block;padding-bottom:24px;text-align:left}.DocSearch-NoResults-Prefill-List ul{display:inline-block;padding:8px 0 0}.DocSearch-NoResults-Prefill-List li{list-style-position:inside;list-style-type:"» "}.DocSearch-Prefill{-webkit-appearance:none;appearance:none;background:none;border:0;border-radius:1em;color:var(--docsearch-highlight-color);cursor:pointer;display:inline-block;font-size:1em;font-weight:700;padding:0}.DocSearch-Prefill:focus,.DocSearch-Prefill:hover{outline:0;text-decoration:underline}.DocSearch-Footer{align-items:center;background:var(--docsearch-footer-background);border-radius:0 0 8px 8px;box-shadow:var(--docsearch-footer-shadow);display:flex;flex-direction:row-reverse;flex-shrink:0;height:var(--docsearch-footer-height);justify-content:space-between;padding:0 var(--docsearch-spacing);position:relative;-webkit-user-select:none;user-select:none;width:100%;z-index:300}.DocSearch-Commands{color:var(--docsearch-muted-color);display:flex;list-style:none;margin:0;padding:0}.DocSearch-Commands li{align-items:center;display:flex}.DocSearch-Commands li:not(:last-of-type){margin-right:.8em}.DocSearch-Commands-Key{align-items:center;background:var(--docsearch-key-gradient);border:0;border-radius:2px;box-shadow:var(--docsearch-key-shadow);color:var(--docsearch-muted-color);display:flex;height:18px;justify-content:center;margin-right:.4em;padding:0 0 1px;width:20px}@keyframes b{0%{opacity:0}to{opacity:1}}.DocSearch-Button{margin:0;transition:all var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.DocSearch-Container{z-index:calc(var(--ifm-z-index-fixed) + 1)}@media (min-width:997px){.collapseSidebarButton_PEFL,.expandButton_m80_{background-color:var(--docusaurus-collapse-button-bg);position:sticky}:root{--docusaurus-announcement-bar-height:30px}.announcementBarClose_gvF7,.announcementBarPlaceholder_vyr4{flex-basis:50px}.searchBox_ZlJk{padding:var(--ifm-navbar-item-padding-vertical) var(--ifm-navbar-item-padding-horizontal)}.lastUpdated_vwxv{text-align:right}.tocMobile_ITEo{display:none}.docItemCol_VOVn{max-width:75%!important}.collapseSidebarButton_PEFL{border:1px solid var(--ifm-toc-border-color);border-radius:0;bottom:0;display:block!important;height:40px}.collapseSidebarButtonIcon_kv0_{margin-top:4px;transform:rotate(180deg)}.expandButtonIcon_BlDH,[dir=rtl] .collapseSidebarButtonIcon_kv0_{transform:rotate(0)}.collapseSidebarButton_PEFL:focus,.collapseSidebarButton_PEFL:hover,.expandButton_m80_:focus,.expandButton_m80_:hover{background-color:var(--docusaurus-collapse-button-bg-hover)}.menuHtmlItem_M9Kj{padding:var(--ifm-menu-link-padding-vertical) var(--ifm-menu-link-padding-horizontal)}.menu_SIkG{flex-grow:1;padding:.5rem}@supports (scrollbar-gutter:stable){.menu_SIkG{padding:.5rem 0 .5rem .5rem;scrollbar-gutter:stable}}.menuWithAnnouncementBar_GW3s{margin-bottom:var(--docusaurus-announcement-bar-height)}.sidebar_njMd{display:flex;flex-direction:column;height:100%;max-height:100vh;padding-top:var(--ifm-navbar-height);position:sticky;top:0;transition:opacity 50ms;width:var(--doc-sidebar-width)}.sidebarWithHideableNavbar_wUlq{padding-top:0}.sidebarHidden_VK0M{height:0;opacity:0;overflow:hidden;visibility:hidden}.sidebarLogo_isFc{align-items:center;color:inherit!important;display:flex!important;margin:0 var(--ifm-navbar-padding-horizontal);max-height:var(--ifm-navbar-height);min-height:var(--ifm-navbar-height);text-decoration:none!important}.sidebarLogo_isFc img{height:2rem;margin-right:.5rem}.expandButton_m80_{align-items:center;display:flex;height:100%;justify-content:center;max-height:100vh;top:0;transition:background-color var(--ifm-transition-fast) ease}[dir=rtl] .expandButtonIcon_BlDH{transform:rotate(180deg)}.docSidebarContainer_b6E3{border-right:1px solid var(--ifm-toc-border-color);-webkit-clip-path:inset(0);clip-path:inset(0);display:block;margin-top:calc(var(--ifm-navbar-height)*-1);transition:width var(--ifm-transition-fast) ease;width:var(--doc-sidebar-width);will-change:width}.docSidebarContainerHidden_b3ry{cursor:pointer;width:var(--doc-sidebar-hidden-width)}.docMainContainer_gTbr{flex-grow:1;max-width:calc(100% - var(--doc-sidebar-width))}.docMainContainerEnhanced_Uz_u{max-width:calc(100% - var(--doc-sidebar-hidden-width))}.docItemWrapperEnhanced_czyv{max-width:calc(var(--ifm-container-width) + var(--doc-sidebar-width))!important}}@media (min-width:1440px){.container{max-width:var(--ifm-container-width-xl)}}@media (max-width:996px){.col{--ifm-col-width:100%;flex-basis:var(--ifm-col-width);margin-left:0}.footer{--ifm-footer-padding-horizontal:0}.colorModeToggle_x44X,.footer__link-separator,.navbar__item,.tableOfContents_bqdL{display:none}.footer__col{margin-bottom:calc(var(--ifm-spacing-vertical)*3)}.footer__link-item{display:block}.hero{padding-left:0;padding-right:0}.navbar>.container,.navbar>.container-fluid{padding:0}.navbar__toggle{display:inherit}.navbar__search-input{width:9rem}.pills--block,.tabs--block{flex-direction:column}.searchBox_ZlJk{position:absolute;right:var(--ifm-navbar-padding-horizontal)}.docItemContainer_F8PC{padding:0 .3rem}}@media only screen and (max-width:996px){.searchQueryColumn_RTkw,.searchResultsColumn_JPFH{max-width:60%!important}.searchLogoColumn_rJIA,.searchVersionColumn_ypXd{max-width:40%!important}.searchLogoColumn_rJIA{padding-left:0!important}}@media (max-width:768px){.DocSearch-Button-Keys,.DocSearch-Button-Placeholder,.DocSearch-Commands,.DocSearch-Hit-Tree{display:none}:root{--docsearch-spacing:10px;--docsearch-footer-height:40px}.DocSearch-Dropdown{height:100%;max-height:calc(var(--docsearch-vh,1vh)*100 - var(--docsearch-searchbox-height) - var(--docsearch-spacing) - var(--docsearch-footer-height))}.DocSearch-Container{height:100vh;height:-webkit-fill-available;height:calc(var(--docsearch-vh,1vh)*100);position:absolute}.DocSearch-Footer{border-radius:0;bottom:0;position:absolute}.DocSearch-Hit-content-wrapper{display:flex;position:relative;width:80%}.DocSearch-Modal{border-radius:0;box-shadow:none;height:100vh;height:-webkit-fill-available;height:calc(var(--docsearch-vh,1vh)*100);margin:0;max-width:100%;width:100%}.DocSearch-Cancel{-webkit-appearance:none;appearance:none;background:none;border:0;color:var(--docsearch-highlight-color);cursor:pointer;display:inline-block;flex:none;font:inherit;font-size:1em;font-weight:500;margin-left:var(--docsearch-spacing);outline:0;overflow:hidden;padding:0;-webkit-user-select:none;user-select:none;white-space:nowrap}}@media (max-width:576px){.markdown h1:first-child{--ifm-h1-font-size:2rem}.markdown>h2{--ifm-h2-font-size:1.5rem}.markdown>h3{--ifm-h3-font-size:1.25rem}}@media screen and (max-width:576px){.searchQueryColumn_RTkw{max-width:100%!important}.searchVersionColumn_ypXd{max-width:100%!important;padding-left:var(--ifm-spacing-horizontal)!important}}@media (hover:hover){.backToTopButton_sjWU:hover{background-color:var(--ifm-color-emphasis-300)}}@media (pointer:fine){.thin-scrollbar{scrollbar-width:thin}.thin-scrollbar::-webkit-scrollbar{height:var(--ifm-scrollbar-size);width:var(--ifm-scrollbar-size)}.thin-scrollbar::-webkit-scrollbar-track{background:var(--ifm-scrollbar-track-background-color);border-radius:10px}.thin-scrollbar::-webkit-scrollbar-thumb{background:var(--ifm-scrollbar-thumb-background-color);border-radius:10px}.thin-scrollbar::-webkit-scrollbar-thumb:hover{background:var(--ifm-scrollbar-thumb-hover-background-color)}}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Reset{stroke-width:var(--docsearch-icon-stroke-width);animation:none;-webkit-appearance:none;appearance:none;background:none;border:0;border-radius:50%;color:var(--docsearch-icon-color);cursor:pointer;right:0}.DocSearch-Hit--deleting,.DocSearch-Hit--favoriting{transition:none}.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{background:#0003;transition:none}}@media print{.announcementBar_mb4j,.footer,.menu,.navbar,.pagination-nav,.table-of-contents,.tocMobile_ITEo{display:none}.tabs{page-break-inside:avoid}.codeBlockLines_e6Vv{white-space:pre-wrap}} \ No newline at end of file diff --git a/assets/js/016a0787.589d8079.js b/assets/js/016a0787.589d8079.js new file mode 100644 index 00000000..b53e7cf7 --- /dev/null +++ b/assets/js/016a0787.589d8079.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[274],{3905:(a,e,t)=>{t.d(e,{Zo:()=>o,kt:()=>u});var n=t(7294);function r(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function i(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),t.push.apply(t,n)}return t}function m(a){for(var e=1;e=0||(r[t]=a[t]);return r}(a,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(a,t)&&(r[t]=a[t])}return r}var p=n.createContext({}),k=function(a){var e=n.useContext(p),t=e;return a&&(t="function"==typeof a?a(e):m(m({},e),a)),t},o=function(a){var e=k(a.components);return n.createElement(p.Provider,{value:e},a.children)},d={inlineCode:"code",wrapper:function(a){var e=a.children;return n.createElement(n.Fragment,{},e)}},s=n.forwardRef((function(a,e){var t=a.components,r=a.mdxType,i=a.originalType,p=a.parentName,o=l(a,["components","mdxType","originalType","parentName"]),s=k(t),u=r,g=s["".concat(p,".").concat(u)]||s[u]||d[u]||i;return t?n.createElement(g,m(m({ref:e},o),{},{components:t})):n.createElement(g,m({ref:e},o))}));function u(a,e){var t=arguments,r=e&&e.mdxType;if("string"==typeof a||r){var i=t.length,m=new Array(i);m[0]=s;var l={};for(var p in e)hasOwnProperty.call(e,p)&&(l[p]=e[p]);l.originalType=a,l.mdxType="string"==typeof a?a:r,m[1]=l;for(var k=2;k{t.r(e),t.d(e,{assets:()=>p,contentTitle:()=>m,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>k});var n=t(7462),r=(t(7294),t(3905));const i={sidebar_position:32,title:"A.32. Basic Memory Management",sidebar_label:"A.32. Basic Memory Management"},m=void 0,l={unversionedId:"basic/basic-memory-management",id:"basic/basic-memory-management",title:"A.32. Basic Memory Management",description:"Pada chapter ini kita akan belajar tentang salah satu hal penting dalam topik pemrograman secara general, yaitu memory management yang mencakup pembahasan tentang alamat memori, pointer, heap, stack, dan juga error-error yang terjadi karena kesalahan dalam manajemen memori.",source:"@site/docs/basic/basic-memory-management.md",sourceDirName:"basic",slug:"/basic/basic-memory-management",permalink:"/basic/basic-memory-management",draft:!1,tags:[],version:"current",sidebarPosition:32,frontMatter:{sidebar_position:32,title:"A.32. Basic Memory Management",sidebar_label:"A.32. Basic Memory Management"},sidebar:"tutorialSidebar",previous:{title:"A.31. Shadowing",permalink:"/basic/shadowing"},next:{title:"A.33. Pointer & References",permalink:"/basic/pointer-references"}},p={},k=[{value:"A.32.1. Memory management",id:"a321-memory-management",level:2},{value:"\u25c9 Garbage collection (GC)",id:"-garbage-collection-gc",level:3},{value:"\u25c9 Automatic reference counting (ARC)",id:"-automatic-reference-counting-arc",level:3},{value:"\u25c9 Manual memory management",id:"-manual-memory-management",level:3},{value:"\u25c9 Ownership rules",id:"-ownership-rules",level:3},{value:"A.32.2. Memory Address",id:"a322-memory-address",level:2},{value:"A.32.3. Stack memory",id:"a323-stack-memory",level:2},{value:"\u25c9 Contoh ke-1",id:"-contoh-ke-1",level:3},{value:"\u25c9 Contoh ke-2",id:"-contoh-ke-2",level:3},{value:"A.32.4. Heap memory",id:"a324-heap-memory",level:2},{value:"A.32.5. Error memory management",id:"a325-error-memory-management",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],o={toc:k};function d(a){let{components:e,...i}=a;return(0,r.kt)("wrapper",(0,n.Z)({},o,i,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Pada chapter ini kita akan belajar tentang salah satu hal penting dalam topik pemrograman secara general, yaitu ",(0,r.kt)("em",{parentName:"p"},"memory management")," yang mencakup pembahasan tentang alamat memori, pointer, heap, stack, dan juga error-error yang terjadi karena kesalahan dalam manajemen memori."),(0,r.kt)("p",null,"Di bahasa pemrograman high-level biasanya topik tersebut jarang disentuh, tetapi di Rust yang notabene adalah system programming, hal di atas wajib untuk dipelajari."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Penulis tekankan bahwa mungkin pembelajaran pada bagian ini akan terasa seperti ",(0,r.kt)("em",{parentName:"p"},"oversimplified")," karena tujuannya adalah untuk para pembaca yang masih dalam proses belajar atau malah belum mengenal sama sekali tentang manajemen memori.")),(0,r.kt)("h2",{id:"a321-memory-management"},"A.32.1. Memory management"),(0,r.kt)("p",null,"Semua bahasa pemrograman memiliki caranya sendiri dalam melakukan pengelolaan memory atau memory management. Ada beberapa macam metode manajemen memori yang diterapkan pada bahasa pemrograman, di antaranya adalah berikut:"),(0,r.kt)("h3",{id:"-garbage-collection-gc"},"\u25c9 Garbage collection (GC)"),(0,r.kt)("p",null,"GC adalah metode manajemen memori otomatis pada bahasa pemrograman. GC memiliki suatu unit yang disebut dengan ",(0,r.kt)("em",{parentName:"p"},"garbage collector"),". Collector tersebut aktif memonitor program, dan pada periode atau event tertentu ia akan berusaha untuk mengambil kembali (reclaim) memory yang sebelumnya telah dialokasikan dengan catatan memori tersebut sudah tidak lagi digunakan. Proses ini disebut dengan dealokasi memory."),(0,r.kt)("p",null,"Proses dealokasi pada GC terjadi di belakang layar secara asynchronous."),(0,r.kt)("p",null,"Beberapa bahasa pemrograman yang menerapkan GC di antara adalah Java, C#, Go, Lisp, dan banyak bahasa lainnya."),(0,r.kt)("h3",{id:"-automatic-reference-counting-arc"},"\u25c9 Automatic reference counting (ARC)"),(0,r.kt)("p",null,"ARC adalah metode manajemen memori yang diterapkan pada bahasa Objective-C dan Swift. Cara ARC me-manage memory adalah dengan mencatat ",(0,r.kt)("em",{parentName:"p"},"reference")," object dan segala aktifitas yang terjadi pada object tersebut."),(0,r.kt)("p",null,"Di ARC, ada satuan yang disebut dengan ",(0,r.kt)("em",{parentName:"p"},"retain count")," yang merupakan representasi jumlah banyaknya variabel atau object yang memegang suatu ",(0,r.kt)("em",{parentName:"p"},"reference"),". Ketika ",(0,r.kt)("em",{parentName:"p"},"reference")," sudah pindah ke luar scope atau dihapus isinya dan dilihat pada catatan rupanya tidak ada variabel yang memegang ",(0,r.kt)("em",{parentName:"p"},"reference")," tersebut, maka dilakukan proses dealokasi memory."),(0,r.kt)("p",null,"Dalam bahasa yang menerapkan ARC, programmer dianjurkan untuk perhatian dan bijak dalam pengalokasian variabel beserta nilainya. Mana data yang diperlukan untuk di-retain secara ",(0,r.kt)("em",{parentName:"p"},"strong")," dan mana yang tidak, harus pas sesuai dengan kebutuhan. Jika tidak hati-hati maka program mempunyai resiko lebih tinggi untuk menemui error ",(0,r.kt)("em",{parentName:"p"},"deadlocks")," ataupun ",(0,r.kt)("em",{parentName:"p"},"memory leaks")," (yang juga akan dibahas pada chapter ini)."),(0,r.kt)("h3",{id:"-manual-memory-management"},"\u25c9 Manual memory management"),(0,r.kt)("p",null,"Manual memory management berarti programmer dibebani secara penuh dalam hal manajemen memori, mengharuskan programmer untuk super hati-hati dalam pengalokasian memory, kapan waktunya, di mana alokasinya (apakah ",(0,r.kt)("em",{parentName:"p"},"heap")," atau ",(0,r.kt)("em",{parentName:"p"},"stack"),"), dan kapan harus melakukan operasi dealokasi memory."),(0,r.kt)("p",null,"Metode manajemen memori ini dipakai dalam system programming contohnya bahasa C dan C++."),(0,r.kt)("h3",{id:"-ownership-rules"},"\u25c9 Ownership rules"),(0,r.kt)("p",null,"Manajemen memori yang dilakukan dengan menerapkan konsep ",(0,r.kt)("em",{parentName:"p"},"ownership")," beserta aturan-aturannya. Metode manajemen memori ini adalah yang digunakan di Rust."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai ownership rules pada Rust dibahas pada chapter selanjutnya, yaitu ",(0,r.kt)("a",{parentName:"p",href:"/basic/ownership"},"Ownership"),". Untuk sekarang silakan selesaikan terlebih dahulu pembahasan chapter ini.")),(0,r.kt)("h2",{id:"a322-memory-address"},"A.32.2. Memory Address"),(0,r.kt)("p",null,"Memory address atau alamat memori adalah sebuah lokasi spesifik di memori yang digunakan oleh software maupun hardware untuk menyimpan suatu data."),(0,r.kt)("p",null,"Pembahasan mengenai memory address ini sangatlah luas. Pada chapter ini kita tidak akan membahasnya secara menyeluruh, melainkan hanya poin penting yang perlu diketahui dan dibutuhkan dalam proses pembelajaran."),(0,r.kt)("p",null,"Ok lanjut ke contoh agar lebih jelas. Dimisalkan ada sebuah variabel bertipe data numerik ",(0,r.kt)("inlineCode",{parentName:"p"},"i32"),", variabel tersebut akan membutuhkan sejumlah bit alokasi alamat memori untuk bisa menyimpan value-nya yang pada contoh ini adalah ",(0,r.kt)("inlineCode",{parentName:"p"},"32 bits")," (karena tipenya ",(0,r.kt)("inlineCode",{parentName:"p"},"i32"),") atau jika dikonversi ke bentuk ",(0,r.kt)("em",{parentName:"p"},"bytes")," adalah ",(0,r.kt)("inlineCode",{parentName:"p"},"4 bytes"),"."),(0,r.kt)("p",null,"Alokasi memory address mengacu ke tipe data (bukan value), sebagai contoh pada data bertipe ",(0,r.kt)("inlineCode",{parentName:"p"},"i32")," maka berapapun value data tersebut (entah ",(0,r.kt)("inlineCode",{parentName:"p"},"1"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"2"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"1999999"),", atau lainnya) tetap membutuhkan ",(0,r.kt)("inlineCode",{parentName:"p"},"32 bits")," alokasi alamat memori untuk menyimpan data tersebut."),(0,r.kt)("p",null,"Silakan perhatikan ilustrasi berikut agar lebih jelas. Gambar diambil dari post ",(0,r.kt)("a",{parentName:"p",href:"https://medium.com/@luischaparroc/integer-numbers-storage-in-computer-memory-47af4b59009"},"medium.com/@luischaparroc"),"."),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Memory address",src:t(4275).Z,width:"875",height:"477"})),(0,r.kt)("p",null,"Pada contoh di atas, variabel adalah bertipe data ",(0,r.kt)("inlineCode",{parentName:"p"},"i32"),", maka di memory dialokasikanlah alamat memory dengan lebar 32 bit."),(0,r.kt)("p",null,"Nilai variabel tersebut adalah ",(0,r.kt)("inlineCode",{parentName:"p"},"25"),", yang jika dikonversi ke bentuk binary adalah ",(0,r.kt)("inlineCode",{parentName:"p"},"11001"),". Dengan ini maka pada 32 bit yang sudah dialokasikan, akan terisi dengan nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"11001"),". Penulisannya dari kanan dan jika ada slot kosong sebelah kiri maka terisi dengan ",(0,r.kt)("inlineCode",{parentName:"p"},"0"),"."),(0,r.kt)("p",null,"Hasilnya adalah angka biner berikut:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"00000000000000000000000000011001\n")),(0,r.kt)("h2",{id:"a323-stack-memory"},"A.32.3. Stack memory"),(0,r.kt)("p",null,"Masih dalam topik manajemen memori, ada dua hal lagi yang sangat penting untuk diketahui, yaitu ",(0,r.kt)("em",{parentName:"p"},"stack")," dan ",(0,r.kt)("em",{parentName:"p"},"heap"),". Keduanya adalah bagian dari memory, tempat di mana alokasi dilakukan."),(0,r.kt)("p",null,"Data disimpan dalam stack memory dalam bentuk stack. Karakteristik dari stack:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Di Rust programming, stack digunakan sebagai default tempat alokasi memori"),(0,r.kt)("li",{parentName:"ul"},"Data yang terakhir masuk adalah yang pertama akan keluar (LIFO)"),(0,r.kt)("li",{parentName:"ul"},"Data yang disimpan diketahui size/ukurannya, dan memiliki batas"),(0,r.kt)("li",{parentName:"ul"},"Alokasi bersifat lokal terhadap pemanggilan fungsi"),(0,r.kt)("li",{parentName:"ul"},"Kecepatan pengaksesan data sangat tinggi")),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"lazy",alt:"Stack memory",src:t(9929).Z,width:"500",height:"345"})),(0,r.kt)("p",null,"Data untuk tipe primitif (seperti ",(0,r.kt)("inlineCode",{parentName:"p"},"i32"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"bool"),", dll) disimpan di stack."),(0,r.kt)("h3",{id:"-contoh-ke-1"},"\u25c9 Contoh ke-1"),(0,r.kt)("p",null,"Selanjutnya kita akan pelajari secara garis besar tentang bagaimana sebuah data dialokasikan di stack. Silakan mulai dengan mempelajari kode sederhana berikut (tanpa perlu dipraktikkan), kemudian ikuti pembahasan setelahnya."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"fn main() {\n let x = 24;\n}\n")),(0,r.kt)("p",null,"Fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main")," hanya berisi 1 buah data, yaitu variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"x")," dengan nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"24"),". Ketika fungsi tersebut dipanggil, maka data variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"x")," disimpan di stack (karena di Rust by default semua data disimpan di stack). Nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"x")," adalah numerik bertipe ",(0,r.kt)("inlineCode",{parentName:"p"},"i32"),", maka compiler akan mengalokasikan 32 bits di stack memory untuk menyimpan nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"24"),"."),(0,r.kt)("p",null,"Pada catatan karakteristik stack di atas, telah disinggung bahwa alokasi data di stack bersifat lokal terhadap pemanggilan fungsi, artinya apa? \u279c Semua data dalam suatu blok fungsi akan disimpan dalam sebuah group yang disebut dengan ",(0,r.kt)("em",{parentName:"p"},"stack frame"),"."),(0,r.kt)("p",null,"Pada contoh di atas, ketika fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main")," dipanggil, sebuah stack frame terbuat, dan data variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"x")," disimpan dalam stack frame tersebut."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"No."),(0,r.kt)("th",{parentName:"tr",align:"center"},"Variabel"),(0,r.kt)("th",{parentName:"tr",align:"center"},"Nilai"),(0,r.kt)("th",{parentName:"tr",align:"left"},(0,r.kt)("em",{parentName:"th"},"Stack frame")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},"0"),(0,r.kt)("td",{parentName:"tr",align:"center"},"x"),(0,r.kt)("td",{parentName:"tr",align:"center"},"24"),(0,r.kt)("td",{parentName:"tr",align:"left"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"td"},"main()"))))),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Kolom ",(0,r.kt)("inlineCode",{parentName:"p"},"No.")," di atas merepresentasikan urutan data dalam stack agar lebih mudah dipahami")),(0,r.kt)("h3",{id:"-contoh-ke-2"},"\u25c9 Contoh ke-2"),(0,r.kt)("p",null,"Ok, sekarang mari lanjut contoh ke-2 berikut ini agar makin jelas."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something() {\n let y = 13;\n let z = 11;\n}\n\nfn main() {\n let x = 24;\n do_something();\n let a = 4;\n let b = 18;\n}\n")),(0,r.kt)("p",null,"Program sederhana di atas memiliki dua buah fungsi, ",(0,r.kt)("inlineCode",{parentName:"p"},"main")," dan ",(0,r.kt)("inlineCode",{parentName:"p"},"do_something"),". Saat program dijalankan, lebih tepatnya saat fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main")," dipanggil maka sebuah stack frame dibuat dan data dalam fungsi tersebut dialokasikan pada stack frame."),(0,r.kt)("p",null,"Perlu diketahui bahwa eksekusi statement dalam fungsi adalah per baris, dimulai dari atas. Dengan ini maka data yang pertama dialokasikan ke memory adalah variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"x"),"."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"No."),(0,r.kt)("th",{parentName:"tr",align:"center"},"Variabel"),(0,r.kt)("th",{parentName:"tr",align:"center"},"Nilai"),(0,r.kt)("th",{parentName:"tr",align:"left"},(0,r.kt)("em",{parentName:"th"},"Stack frame")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},"0"),(0,r.kt)("td",{parentName:"tr",align:"center"},"x"),(0,r.kt)("td",{parentName:"tr",align:"center"},"24"),(0,r.kt)("td",{parentName:"tr",align:"left"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"td"},"main()"))))),(0,r.kt)("p",null,"Setelah itu, lanjut ke statement ke-2 yaitu pemanggilan fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"do_something"),"."),(0,r.kt)("p",null,"Kembali ke teori, bahwa alokasi data stack adalah bersifat lokal terhadap pemanggilan fungsi. Maka dibuatlah stack frame baru untuk pemanggilan fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"do_something")," dengan isi adalah alokasi data ",(0,r.kt)("inlineCode",{parentName:"p"},"y")," dan ",(0,r.kt)("inlineCode",{parentName:"p"},"z"),"."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"No."),(0,r.kt)("th",{parentName:"tr",align:"center"},"Variabel"),(0,r.kt)("th",{parentName:"tr",align:"center"},"Nilai"),(0,r.kt)("th",{parentName:"tr",align:"left"},(0,r.kt)("em",{parentName:"th"},"Stack frame")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"2"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"z"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"11"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"strong"},"do_something()"))))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"1"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"y"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"13"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"strong"},"do_something()"))))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},"0"),(0,r.kt)("td",{parentName:"tr",align:"center"},"x"),(0,r.kt)("td",{parentName:"tr",align:"center"},"24"),(0,r.kt)("td",{parentName:"tr",align:"left"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"td"},"main()"))))),(0,r.kt)("p",null,"Setelah eksekusi blok kode do_something selesai maka stack frame pemanggilan fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"do_something")," akan di-dealokasi, dikosongkan, dihapus."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Sebenarnya tidak se-sederhana itu proses dealokasi memori, ada pengecekan ownership yang harus dilakukan terlebih dahulu. Namun agar makin tidak bingung, untuk sementara kita gunakan penjelasan di atas."),(0,r.kt)("p",{parentName:"blockquote"},"Silakan selesaikan dulu pembahasan chapter ini, kemudian pada chapter selanjutnya kita akan bahas tentang apa itu ",(0,r.kt)("a",{parentName:"p",href:"/basic/ownership"},"Ownership"),".")),(0,r.kt)("p",null,"Ok, maka dari 2 stack yang sebelumnya ada, sekarang tinggal 1 stack frame saja yaitu milik pemanggilan fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,r.kt)("p",null,"Dari yang sebelumnya ..."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"No."),(0,r.kt)("th",{parentName:"tr",align:"center"},"Variabel"),(0,r.kt)("th",{parentName:"tr",align:"center"},"Nilai"),(0,r.kt)("th",{parentName:"tr",align:"left"},(0,r.kt)("em",{parentName:"th"},"Stack frame")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"red"}},(0,r.kt)("del",{parentName:"td"},"2"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"red"}},(0,r.kt)("del",{parentName:"td"},"z"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"red"}},(0,r.kt)("del",{parentName:"td"},"11"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("span",{style:{color:"red"}},(0,r.kt)("del",{parentName:"td"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"del"},"do_something()"))))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"red"}},(0,r.kt)("del",{parentName:"td"},"1"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"red"}},(0,r.kt)("del",{parentName:"td"},"y"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"red"}},(0,r.kt)("del",{parentName:"td"},"13"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("span",{style:{color:"red"}},(0,r.kt)("del",{parentName:"td"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"del"},"do_something()"))))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},"0"),(0,r.kt)("td",{parentName:"tr",align:"center"},"x"),(0,r.kt)("td",{parentName:"tr",align:"center"},"24"),(0,r.kt)("td",{parentName:"tr",align:"left"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"td"},"main()"))))),(0,r.kt)("p",null,"... sekarang menjadi ..."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"No."),(0,r.kt)("th",{parentName:"tr",align:"center"},"Variabel"),(0,r.kt)("th",{parentName:"tr",align:"center"},"Nilai"),(0,r.kt)("th",{parentName:"tr",align:"left"},(0,r.kt)("em",{parentName:"th"},"Stack frame")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},"0"),(0,r.kt)("td",{parentName:"tr",align:"center"},"x"),(0,r.kt)("td",{parentName:"tr",align:"center"},"24"),(0,r.kt)("td",{parentName:"tr",align:"left"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"td"},"main()"))))),(0,r.kt)("p",null,"Ok, lanjut ke block fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main")," berikutnya, yaitu ",(0,r.kt)("inlineCode",{parentName:"p"},"let a = 4"),". Saat dipanggil maka ada penambahan data baru pada stack frame pertama."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"No."),(0,r.kt)("th",{parentName:"tr",align:"center"},"Variabel"),(0,r.kt)("th",{parentName:"tr",align:"center"},"Nilai"),(0,r.kt)("th",{parentName:"tr",align:"left"},(0,r.kt)("em",{parentName:"th"},"Stack frame")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"3"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"a"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"4"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"strong"},"main()"))))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},"0"),(0,r.kt)("td",{parentName:"tr",align:"center"},"x"),(0,r.kt)("td",{parentName:"tr",align:"center"},"24"),(0,r.kt)("td",{parentName:"tr",align:"left"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"td"},"main()"))))),(0,r.kt)("p",null,"Kemudian sampai di statement terakhir fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main"),". Ketika ",(0,r.kt)("inlineCode",{parentName:"p"},"let b = 14")," dipanggil maka ada penambahan data baru pada stack frame pertama."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"No."),(0,r.kt)("th",{parentName:"tr",align:"center"},"Variabel"),(0,r.kt)("th",{parentName:"tr",align:"center"},"Nilai"),(0,r.kt)("th",{parentName:"tr",align:"left"},(0,r.kt)("em",{parentName:"th"},"Stack frame")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"4"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"b"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"18"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"strong"},"main()"))))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},"3"),(0,r.kt)("td",{parentName:"tr",align:"center"},"a"),(0,r.kt)("td",{parentName:"tr",align:"center"},"4"),(0,r.kt)("td",{parentName:"tr",align:"left"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"td"},"main()"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},"0"),(0,r.kt)("td",{parentName:"tr",align:"center"},"x"),(0,r.kt)("td",{parentName:"tr",align:"center"},"24"),(0,r.kt)("td",{parentName:"tr",align:"left"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"td"},"main()"))))),(0,r.kt)("p",null,"Setelah fungsi selesai dieksekusi, stack frame di-dealokasi."),(0,r.kt)("p",null,"Kurang lebih seperti itu sekilas peran dari stack dalam Rust programming. Selanjutnya kita bahas tentang heap memory."),(0,r.kt)("h2",{id:"a324-heap-memory"},"A.32.4. Heap memory"),(0,r.kt)("p",null,"Heap adalah salah satu tempat alokasi memory selain stack. Karakteristik dari heap:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Heap digunakan untuk alokasi data yang sifatnya dinamis, tidak diketahui size-nya, atau bisa berubah size-nya"),(0,r.kt)("li",{parentName:"ul"},"Data di heap tidak memiliki pattern tertentu"),(0,r.kt)("li",{parentName:"ul"},"Alokasi dan dealokasi data di heap bisa dilakukan kapanpun"),(0,r.kt)("li",{parentName:"ul"},"Kecepatan pengaksesan data di heap lebih lambat dibanding stack")),(0,r.kt)("p",null,"Ilustrasi perbandingan stack dan heap:"),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"lazy",alt:"Heap memory",src:t(6907).Z,width:"414",height:"236"})),(0,r.kt)("p",null,"Tipe data non-primitive di Rust data-nya disimpan di heap, contohnya seperti Vector, ",(0,r.kt)("inlineCode",{parentName:"p"},"String"),", dan beberapa lainnya. Penulis tekankan, bahwa ",(0,r.kt)("strong",{parentName:"p"},"yang disimpan di heap adalah data-nya saja, sedangkan atribut lainnya (seperti ",(0,r.kt)("inlineCode",{parentName:"strong"},"length")," dan ",(0,r.kt)("inlineCode",{parentName:"strong"},"capacity"),") tetap disimpan disimpan di stack"),". Lebih jelasnya silakan lihat ilustrasi berikut:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"let numbers = vec![12, 24, 7];\n")),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"lazy",alt:"Heap memory",src:t(6033).Z,width:"420",height:"184"})),(0,r.kt)("p",null,"Heap, selain digunakan sebagai penyimpanan data dinamis, kita juga bisa manfaatkan sebagai penyimpanan data jenis lainnya (secara eksplisit) menggunakan tipe data ",(0,r.kt)("inlineCode",{parentName:"p"},"Box"),"."),(0,r.kt)("p",null,"Pembahasan Lebih jelasnya mengenai heap allocation ada pada chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/string-slice-vs-string-literal"},"String Custom Type vs ",(0,r.kt)("inlineCode",{parentName:"a"},"&str"))," dan juga ",(0,r.kt)("a",{parentName:"p",href:"#/wip/box"},"Box"),". Namun untuk sekarang, penulis anjurkan untuk lanjut ke pembahasan berikutnya terlebih dahulu."),(0,r.kt)("h2",{id:"a325-error-memory-management"},"A.32.5. Error memory management"),(0,r.kt)("p",null,"Rust sangat disiplin dalam hal penulisan source code, terutama untuk kode-kode yang berhubungan dengan memory management. Hal ini dilakukan oleh Rust untuk meminimalisir munculnya error seperti memory leak dan sejenisnya."),(0,r.kt)("p",null,"Namun meski demikian, potensi error memory tetap ada, dan kita akan bahas itu nantinya setelah masuk chapter ",(0,r.kt)("a",{parentName:"p",href:"#/wip/safe-unsafe"},"Safe & Unsafe"),"."),(0,r.kt)("p",null,"Nantinya akan dibahas juga tentang beberapa error saat compile time yang error tersebut berhubungan dengan memory management, yaitu pada chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/ownership"},"Ownership")," dan ",(0,r.kt)("a",{parentName:"p",href:"/basic/borrowing"},"Borrowing"),". Untuk sekarang, mari lanjut ke chapter berikutnya terlebih dahulu."),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,r.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,r.kt)("pre",null,(0,r.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/memory_management"},"github.com/novalagung/dasarpemrogramanrust-example/../memory_management")),(0,r.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/nomicon/ownership.html"},"https://doc.rust-lang.org/nomicon/ownership.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html"},"https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/1.22.0/book/first-edition/the-stack-and-the-heap.html"},"https://doc.rust-lang.org/1.22.0/book/first-edition/the-stack-and-the-heap.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/std/box.html"},"https://doc.rust-lang.org/rust-by-example/std/box.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html"},"https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://docs.elementscompiler.com/Concepts/ARC/"},"https://docs.elementscompiler.com/Concepts/ARC/")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://en.wikipedia.org/wiki/Memory_address"},"https://en.wikipedia.org/wiki/Memory_address")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://en.wikipedia.org/wiki/Code_segment"},"https://en.wikipedia.org/wiki/Code_segment")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://en.wikipedia.org/wiki/Automatic_Reference_Counting"},"https://en.wikipedia.org/wiki/Automatic_Reference_Counting")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)"},"https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://log2base2.com/C/pointer/computer-memory-address-basics.html"},"https://log2base2.com/C/pointer/computer-memory-address-basics.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://quora.com/How-does-memory-management-work-in-Rust"},"https://quora.com/How-does-memory-management-work-in-Rust")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://medium.com/the-legend/management-memori-pada-bahasa-pemrograman-a33772635aa5"},"https://medium.com/the-legend/management-memori-pada-bahasa-pemrograman-a33772635aa5")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://imam.digmi.id/post/belajar-rust-memahami-stack-dan-heap/"},"https://imam.digmi.id/post/belajar-rust-memahami-stack-dan-heap/")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://javatpoint.com/rust-ownership"},"https://javatpoint.com/rust-ownership")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/24158114"},"https://stackoverflow.com/questions/24158114"))))}d.isMDXComponent=!0},4275:(a,e,t)=>{t.d(e,{Z:()=>n});const n=t.p+"assets/images/basic-memory-management-1-ac98989ab48847e58470100c02455dab.png"},9929:(a,e,t)=>{t.d(e,{Z:()=>n});const n=t.p+"assets/images/basic-memory-management-2-114833fdf1f1ac3114d03494e6603ff1.jpg"},6907:(a,e,t)=>{t.d(e,{Z:()=>n});const n="data:image/png;base64,iV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OzH/jvq7gmedQ2w/mi2GFIAABwr5BpdKwzkKe4xnJN4XqDazbXW3WK55rqUbui9vNcQ7i6cYWhCCVmSBAEQRDkaKEQIAiCIBgSBEEQBMGQIAiCIBgSBEEQBMGQIAiCIBgSBEEQBMGQIAiCIBgSBEEQBDWm/wcTwEbwntl2lQAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/016a0787.ddd4552f.js b/assets/js/016a0787.ddd4552f.js deleted file mode 100644 index ed6c3df1..00000000 --- a/assets/js/016a0787.ddd4552f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[274],{3905:(a,e,t)=>{t.d(e,{Zo:()=>o,kt:()=>u});var n=t(7294);function r(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function i(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),t.push.apply(t,n)}return t}function m(a){for(var e=1;e=0||(r[t]=a[t]);return r}(a,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(a,t)&&(r[t]=a[t])}return r}var p=n.createContext({}),k=function(a){var e=n.useContext(p),t=e;return a&&(t="function"==typeof a?a(e):m(m({},e),a)),t},o=function(a){var e=k(a.components);return n.createElement(p.Provider,{value:e},a.children)},d={inlineCode:"code",wrapper:function(a){var e=a.children;return n.createElement(n.Fragment,{},e)}},s=n.forwardRef((function(a,e){var t=a.components,r=a.mdxType,i=a.originalType,p=a.parentName,o=l(a,["components","mdxType","originalType","parentName"]),s=k(t),u=r,g=s["".concat(p,".").concat(u)]||s[u]||d[u]||i;return t?n.createElement(g,m(m({ref:e},o),{},{components:t})):n.createElement(g,m({ref:e},o))}));function u(a,e){var t=arguments,r=e&&e.mdxType;if("string"==typeof a||r){var i=t.length,m=new Array(i);m[0]=s;var l={};for(var p in e)hasOwnProperty.call(e,p)&&(l[p]=e[p]);l.originalType=a,l.mdxType="string"==typeof a?a:r,m[1]=l;for(var k=2;k{t.r(e),t.d(e,{assets:()=>p,contentTitle:()=>m,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>k});var n=t(7462),r=(t(7294),t(3905));const i={sidebar_position:32,title:"A.32. Basic Memory Management",sidebar_label:"A.32. Basic Memory Management"},m=void 0,l={unversionedId:"basic/basic-memory-management",id:"basic/basic-memory-management",title:"A.32. Basic Memory Management",description:"Pada chapter ini kita akan belajar tentang salah satu hal penting dalam topik pemrograman secara general, yaitu memory management yang mencakup pembahasan tentang alamat memori, pointer, heap, stack, dan juga error-error yang terjadi karena kesalahan dalam manajemen memori.",source:"@site/docs/basic/basic-memory-management.md",sourceDirName:"basic",slug:"/basic/basic-memory-management",permalink:"/basic/basic-memory-management",draft:!1,tags:[],version:"current",sidebarPosition:32,frontMatter:{sidebar_position:32,title:"A.32. Basic Memory Management",sidebar_label:"A.32. Basic Memory Management"},sidebar:"tutorialSidebar",previous:{title:"A.31. Shadowing",permalink:"/basic/shadowing"},next:{title:"A.33. Pointer & References",permalink:"/basic/pointer-references"}},p={},k=[{value:"A.32.1. Memory management",id:"a321-memory-management",level:2},{value:"\u25c9 Garbage collection (GC)",id:"-garbage-collection-gc",level:3},{value:"\u25c9 Automatic reference counting (ARC)",id:"-automatic-reference-counting-arc",level:3},{value:"\u25c9 Manual memory management",id:"-manual-memory-management",level:3},{value:"\u25c9 Ownership rules",id:"-ownership-rules",level:3},{value:"A.32.2. Memory Address",id:"a322-memory-address",level:2},{value:"A.32.3. Stack memory",id:"a323-stack-memory",level:2},{value:"\u25c9 Contoh ke-1",id:"-contoh-ke-1",level:3},{value:"\u25c9 Contoh ke-2",id:"-contoh-ke-2",level:3},{value:"A.32.4. Heap memory",id:"a324-heap-memory",level:2},{value:"A.32.5. Error memory management",id:"a325-error-memory-management",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],o={toc:k};function d(a){let{components:e,...i}=a;return(0,r.kt)("wrapper",(0,n.Z)({},o,i,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Pada chapter ini kita akan belajar tentang salah satu hal penting dalam topik pemrograman secara general, yaitu ",(0,r.kt)("em",{parentName:"p"},"memory management")," yang mencakup pembahasan tentang alamat memori, pointer, heap, stack, dan juga error-error yang terjadi karena kesalahan dalam manajemen memori."),(0,r.kt)("p",null,"Di bahasa pemrograman high-level biasanya topik tersebut jarang disentuh, tetapi di Rust yang notabene adalah system programming, hal di atas wajib untuk dipelajari."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Penulis tekankan bahwa mungkin pembelajaran pada bagian ini akan terasa seperti ",(0,r.kt)("em",{parentName:"p"},"oversimplified")," karena tujuannya adalah untuk para pembaca yang masih dalam proses belajar atau malah belum mengenal sama sekali tentang manajemen memori.")),(0,r.kt)("h2",{id:"a321-memory-management"},"A.32.1. Memory management"),(0,r.kt)("p",null,"Semua bahasa pemrograman memiliki caranya sendiri dalam melakukan pengelolaan memory atau memory management. Ada beberapa macam metode manajemen memori yang diterapkan pada bahasa pemrograman, di antaranya adalah berikut:"),(0,r.kt)("h3",{id:"-garbage-collection-gc"},"\u25c9 Garbage collection (GC)"),(0,r.kt)("p",null,"GC adalah metode manajemen memori otomatis pada bahasa pemrograman. GC memiliki suatu unit yang disebut dengan ",(0,r.kt)("em",{parentName:"p"},"garbage collector"),". Collector tersebut aktif memonitor program, dan pada periode atau event tertentu ia akan berusaha untuk mengambil kembali (reclaim) memory yang sebelumnya telah dialokasikan dengan catatan memori tersebut sudah tidak lagi digunakan. Proses ini disebut dengan dealokasi memory."),(0,r.kt)("p",null,"Proses dealokasi pada GC terjadi di belakang layar secara asynchronous."),(0,r.kt)("p",null,"Beberapa bahasa pemrograman yang menerapkan GC di antara adalah Java, C#, Go, Lisp, dan banyak bahasa lainnya."),(0,r.kt)("h3",{id:"-automatic-reference-counting-arc"},"\u25c9 Automatic reference counting (ARC)"),(0,r.kt)("p",null,"ARC adalah metode manajemen memori yang diterapkan pada bahasa Objective-C dan Swift. Cara ARC me-manage memory adalah dengan mencatat ",(0,r.kt)("em",{parentName:"p"},"reference")," object dan segala aktifitas yang terjadi pada object tersebut."),(0,r.kt)("p",null,"Di ARC, ada satuan yang disebut dengan ",(0,r.kt)("em",{parentName:"p"},"retain count")," yang merupakan representasi jumlah banyaknya variabel atau object yang memegang suatu ",(0,r.kt)("em",{parentName:"p"},"reference"),". Ketika ",(0,r.kt)("em",{parentName:"p"},"reference")," sudah pindah ke luar scope atau dihapus isinya dan dilihat pada catatan rupanya tidak ada variabel yang memegang ",(0,r.kt)("em",{parentName:"p"},"reference")," tersebut, maka dilakukan proses dealokasi memory."),(0,r.kt)("p",null,"Dalam bahasa yang menerapkan ARC, programmer dianjurkan untuk perhatian dan bijak dalam pengalokasian variabel beserta nilainya. Mana data yang diperlukan untuk di-retain secara ",(0,r.kt)("em",{parentName:"p"},"strong")," dan mana yang tidak, harus pas sesuai dengan kebutuhan. Jika tidak hati-hati maka program mempunyai resiko lebih tinggi untuk menemui error ",(0,r.kt)("em",{parentName:"p"},"deadlocks")," ataupun ",(0,r.kt)("em",{parentName:"p"},"memory leaks")," (yang juga akan dibahas pada chapter ini)."),(0,r.kt)("h3",{id:"-manual-memory-management"},"\u25c9 Manual memory management"),(0,r.kt)("p",null,"Manual memory management berarti programmer dibebani secara penuh dalam hal manajemen memori, mengharuskan programmer untuk super hati-hati dalam pengalokasian memory, kapan waktunya, di mana alokasinya (apakah ",(0,r.kt)("em",{parentName:"p"},"heap")," atau ",(0,r.kt)("em",{parentName:"p"},"stack"),"), dan kapan harus melakukan operasi dealokasi memory."),(0,r.kt)("p",null,"Metode manajemen memori ini dipakai dalam system programming contohnya bahasa C dan C++."),(0,r.kt)("h3",{id:"-ownership-rules"},"\u25c9 Ownership rules"),(0,r.kt)("p",null,"Manajemen memori yang dilakukan dengan menerapkan konsep ",(0,r.kt)("em",{parentName:"p"},"ownership")," beserta aturan-aturannya. Metode manajemen memori ini adalah yang digunakan di Rust."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai ownership rules pada Rust dibahas pada chapter selanjutnya, yaitu ",(0,r.kt)("a",{parentName:"p",href:"/basic/ownership"},"Ownership"),". Untuk sekarang silakan selesaikan terlebih dahulu pembahasan chapter ini.")),(0,r.kt)("h2",{id:"a322-memory-address"},"A.32.2. Memory Address"),(0,r.kt)("p",null,"Memory address atau alamat memori adalah sebuah lokasi spesifik di memori yang digunakan oleh software maupun hardware untuk menyimpan suatu data."),(0,r.kt)("p",null,"Pembahasan mengenai memory address ini sangatlah luas. Pada chapter ini kita tidak akan membahasnya secara menyeluruh, melainkan hanya poin penting yang perlu diketahui dan dibutuhkan dalam proses pembelajaran."),(0,r.kt)("p",null,"Ok lanjut ke contoh agar lebih jelas. Dimisalkan ada sebuah variabel bertipe data numerik ",(0,r.kt)("inlineCode",{parentName:"p"},"i32"),", variabel tersebut akan membutuhkan sejumlah bit alokasi alamat memori untuk bisa menyimpan value-nya yang pada contoh ini adalah ",(0,r.kt)("inlineCode",{parentName:"p"},"32 bits")," (karena tipenya ",(0,r.kt)("inlineCode",{parentName:"p"},"i32"),") atau jika dikonversi ke bentuk ",(0,r.kt)("em",{parentName:"p"},"bytes")," adalah ",(0,r.kt)("inlineCode",{parentName:"p"},"4 bytes"),"."),(0,r.kt)("p",null,"Alokasi memory address mengacu ke tipe data (bukan value), sebagai contoh pada data bertipe ",(0,r.kt)("inlineCode",{parentName:"p"},"i32")," maka berapapun value data tersebut (entah ",(0,r.kt)("inlineCode",{parentName:"p"},"1"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"2"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"1999999"),", atau lainnya) tetap membutuhkan ",(0,r.kt)("inlineCode",{parentName:"p"},"32 bits")," alokasi alamat memori untuk menyimpan data tersebut."),(0,r.kt)("p",null,"Silakan perhatikan ilustrasi berikut agar lebih jelas. Gambar diambil dari post ",(0,r.kt)("a",{parentName:"p",href:"https://medium.com/@luischaparroc/integer-numbers-storage-in-computer-memory-47af4b59009"},"medium.com/@luischaparroc"),"."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Memory address",src:t(4275).Z,width:"875",height:"477"})),(0,r.kt)("p",null,"Pada contoh di atas, variabel adalah bertipe data ",(0,r.kt)("inlineCode",{parentName:"p"},"i32"),", maka di memory dialokasikanlah alamat memory dengan lebar 32 bit."),(0,r.kt)("p",null,"Nilai variabel tersebut adalah ",(0,r.kt)("inlineCode",{parentName:"p"},"25"),", yang jika dikonversi ke bentuk binary adalah ",(0,r.kt)("inlineCode",{parentName:"p"},"11001"),". Dengan ini maka pada 32 bit yang sudah dialokasikan, akan terisi dengan nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"11001"),". Penulisannya dari kanan dan jika ada slot kosong sebelah kiri maka terisi dengan ",(0,r.kt)("inlineCode",{parentName:"p"},"0"),"."),(0,r.kt)("p",null,"Hasilnya adalah angka biner berikut:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"00000000000000000000000000011001\n")),(0,r.kt)("h2",{id:"a323-stack-memory"},"A.32.3. Stack memory"),(0,r.kt)("p",null,"Masih dalam topik manajemen memori, ada dua hal lagi yang sangat penting untuk diketahui, yaitu ",(0,r.kt)("em",{parentName:"p"},"stack")," dan ",(0,r.kt)("em",{parentName:"p"},"heap"),". Keduanya adalah bagian dari memory, tempat di mana alokasi dilakukan."),(0,r.kt)("p",null,"Data disimpan dalam stack memory dalam bentuk stack. Karakteristik dari stack:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Di Rust programming, stack digunakan sebagai default tempat alokasi memori"),(0,r.kt)("li",{parentName:"ul"},"Data yang terakhir masuk adalah yang pertama akan keluar (LIFO)"),(0,r.kt)("li",{parentName:"ul"},"Data yang disimpan diketahui size/ukurannya, dan memiliki batas"),(0,r.kt)("li",{parentName:"ul"},"Alokasi bersifat lokal terhadap pemanggilan fungsi"),(0,r.kt)("li",{parentName:"ul"},"Kecepatan pengaksesan data sangat tinggi")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Stack memory",src:t(9929).Z,width:"500",height:"345"})),(0,r.kt)("p",null,"Data untuk tipe primitif (seperti ",(0,r.kt)("inlineCode",{parentName:"p"},"i32"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"bool"),", dll) disimpan di stack."),(0,r.kt)("h3",{id:"-contoh-ke-1"},"\u25c9 Contoh ke-1"),(0,r.kt)("p",null,"Selanjutnya kita akan pelajari secara garis besar tentang bagaimana sebuah data dialokasikan di stack. Silakan mulai dengan mempelajari kode sederhana berikut (tanpa perlu dipraktikkan), kemudian ikuti pembahasan setelahnya."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"fn main() {\n let x = 24;\n}\n")),(0,r.kt)("p",null,"Fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main")," hanya berisi 1 buah data, yaitu variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"x")," dengan nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"24"),". Ketika fungsi tersebut dipanggil, maka data variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"x")," disimpan di stack (karena di Rust by default semua data disimpan di stack). Nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"x")," adalah numerik bertipe ",(0,r.kt)("inlineCode",{parentName:"p"},"i32"),", maka compiler akan mengalokasikan 32 bits di stack memory untuk menyimpan nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"24"),"."),(0,r.kt)("p",null,"Pada catatan karakteristik stack di atas, telah disinggung bahwa alokasi data di stack bersifat lokal terhadap pemanggilan fungsi, artinya apa? \u279c Semua data dalam suatu blok fungsi akan disimpan dalam sebuah group yang disebut dengan ",(0,r.kt)("em",{parentName:"p"},"stack frame"),"."),(0,r.kt)("p",null,"Pada contoh di atas, ketika fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main")," dipanggil, sebuah stack frame terbuat, dan data variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"x")," disimpan dalam stack frame tersebut."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"No."),(0,r.kt)("th",{parentName:"tr",align:"center"},"Variabel"),(0,r.kt)("th",{parentName:"tr",align:"center"},"Nilai"),(0,r.kt)("th",{parentName:"tr",align:"left"},(0,r.kt)("em",{parentName:"th"},"Stack frame")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},"0"),(0,r.kt)("td",{parentName:"tr",align:"center"},"x"),(0,r.kt)("td",{parentName:"tr",align:"center"},"24"),(0,r.kt)("td",{parentName:"tr",align:"left"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"td"},"main()"))))),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Kolom ",(0,r.kt)("inlineCode",{parentName:"p"},"No.")," di atas merepresentasikan urutan data dalam stack agar lebih mudah dipahami")),(0,r.kt)("h3",{id:"-contoh-ke-2"},"\u25c9 Contoh ke-2"),(0,r.kt)("p",null,"Ok, sekarang mari lanjut contoh ke-2 berikut ini agar makin jelas."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something() {\n let y = 13;\n let z = 11;\n}\n\nfn main() {\n let x = 24;\n do_something();\n let a = 4;\n let b = 18;\n}\n")),(0,r.kt)("p",null,"Program sederhana di atas memiliki dua buah fungsi, ",(0,r.kt)("inlineCode",{parentName:"p"},"main")," dan ",(0,r.kt)("inlineCode",{parentName:"p"},"do_something"),". Saat program dijalankan, lebih tepatnya saat fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main")," dipanggil maka sebuah stack frame dibuat dan data dalam fungsi tersebut dialokasikan pada stack frame."),(0,r.kt)("p",null,"Perlu diketahui bahwa eksekusi statement dalam fungsi adalah per baris, dimulai dari atas. Dengan ini maka data yang pertama dialokasikan ke memory adalah variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"x"),"."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"No."),(0,r.kt)("th",{parentName:"tr",align:"center"},"Variabel"),(0,r.kt)("th",{parentName:"tr",align:"center"},"Nilai"),(0,r.kt)("th",{parentName:"tr",align:"left"},(0,r.kt)("em",{parentName:"th"},"Stack frame")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},"0"),(0,r.kt)("td",{parentName:"tr",align:"center"},"x"),(0,r.kt)("td",{parentName:"tr",align:"center"},"24"),(0,r.kt)("td",{parentName:"tr",align:"left"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"td"},"main()"))))),(0,r.kt)("p",null,"Setelah itu, lanjut ke statement ke-2 yaitu pemanggilan fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"do_something"),"."),(0,r.kt)("p",null,"Kembali ke teori, bahwa alokasi data stack adalah bersifat lokal terhadap pemanggilan fungsi. Maka dibuatlah stack frame baru untuk pemanggilan fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"do_something")," dengan isi adalah alokasi data ",(0,r.kt)("inlineCode",{parentName:"p"},"y")," dan ",(0,r.kt)("inlineCode",{parentName:"p"},"z"),"."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"No."),(0,r.kt)("th",{parentName:"tr",align:"center"},"Variabel"),(0,r.kt)("th",{parentName:"tr",align:"center"},"Nilai"),(0,r.kt)("th",{parentName:"tr",align:"left"},(0,r.kt)("em",{parentName:"th"},"Stack frame")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"2"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"z"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"11"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"strong"},"do_something()"))))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"1"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"y"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"13"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"strong"},"do_something()"))))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},"0"),(0,r.kt)("td",{parentName:"tr",align:"center"},"x"),(0,r.kt)("td",{parentName:"tr",align:"center"},"24"),(0,r.kt)("td",{parentName:"tr",align:"left"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"td"},"main()"))))),(0,r.kt)("p",null,"Setelah eksekusi blok kode do_something selesai maka stack frame pemanggilan fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"do_something")," akan di-dealokasi, dikosongkan, dihapus."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Sebenarnya tidak se-sederhana itu proses dealokasi memori, ada pengecekan ownership yang harus dilakukan terlebih dahulu. Namun agar makin tidak bingung, untuk sementara kita gunakan penjelasan di atas."),(0,r.kt)("p",{parentName:"blockquote"},"Silakan selesaikan dulu pembahasan chapter ini, kemudian pada chapter selanjutnya kita akan bahas tentang apa itu ",(0,r.kt)("a",{parentName:"p",href:"/basic/ownership"},"Ownership"),".")),(0,r.kt)("p",null,"Ok, maka dari 2 stack yang sebelumnya ada, sekarang tinggal 1 stack frame saja yaitu milik pemanggilan fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,r.kt)("p",null,"Dari yang sebelumnya ..."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"No."),(0,r.kt)("th",{parentName:"tr",align:"center"},"Variabel"),(0,r.kt)("th",{parentName:"tr",align:"center"},"Nilai"),(0,r.kt)("th",{parentName:"tr",align:"left"},(0,r.kt)("em",{parentName:"th"},"Stack frame")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"red"}},(0,r.kt)("del",{parentName:"td"},"2"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"red"}},(0,r.kt)("del",{parentName:"td"},"z"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"red"}},(0,r.kt)("del",{parentName:"td"},"11"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("span",{style:{color:"red"}},(0,r.kt)("del",{parentName:"td"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"del"},"do_something()"))))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"red"}},(0,r.kt)("del",{parentName:"td"},"1"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"red"}},(0,r.kt)("del",{parentName:"td"},"y"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"red"}},(0,r.kt)("del",{parentName:"td"},"13"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("span",{style:{color:"red"}},(0,r.kt)("del",{parentName:"td"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"del"},"do_something()"))))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},"0"),(0,r.kt)("td",{parentName:"tr",align:"center"},"x"),(0,r.kt)("td",{parentName:"tr",align:"center"},"24"),(0,r.kt)("td",{parentName:"tr",align:"left"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"td"},"main()"))))),(0,r.kt)("p",null,"... sekarang menjadi ..."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"No."),(0,r.kt)("th",{parentName:"tr",align:"center"},"Variabel"),(0,r.kt)("th",{parentName:"tr",align:"center"},"Nilai"),(0,r.kt)("th",{parentName:"tr",align:"left"},(0,r.kt)("em",{parentName:"th"},"Stack frame")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},"0"),(0,r.kt)("td",{parentName:"tr",align:"center"},"x"),(0,r.kt)("td",{parentName:"tr",align:"center"},"24"),(0,r.kt)("td",{parentName:"tr",align:"left"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"td"},"main()"))))),(0,r.kt)("p",null,"Ok, lanjut ke block fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main")," berikutnya, yaitu ",(0,r.kt)("inlineCode",{parentName:"p"},"let a = 4"),". Saat dipanggil maka ada penambahan data baru pada stack frame pertama."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"No."),(0,r.kt)("th",{parentName:"tr",align:"center"},"Variabel"),(0,r.kt)("th",{parentName:"tr",align:"center"},"Nilai"),(0,r.kt)("th",{parentName:"tr",align:"left"},(0,r.kt)("em",{parentName:"th"},"Stack frame")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"3"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"a"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"4"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"strong"},"main()"))))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},"0"),(0,r.kt)("td",{parentName:"tr",align:"center"},"x"),(0,r.kt)("td",{parentName:"tr",align:"center"},"24"),(0,r.kt)("td",{parentName:"tr",align:"left"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"td"},"main()"))))),(0,r.kt)("p",null,"Kemudian sampai di statement terakhir fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main"),". Ketika ",(0,r.kt)("inlineCode",{parentName:"p"},"let b = 14")," dipanggil maka ada penambahan data baru pada stack frame pertama."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"No."),(0,r.kt)("th",{parentName:"tr",align:"center"},"Variabel"),(0,r.kt)("th",{parentName:"tr",align:"center"},"Nilai"),(0,r.kt)("th",{parentName:"tr",align:"left"},(0,r.kt)("em",{parentName:"th"},"Stack frame")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"4"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"b"))),(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"18"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("span",{style:{color:"#2e8555"}},(0,r.kt)("strong",{parentName:"td"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"strong"},"main()"))))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},"3"),(0,r.kt)("td",{parentName:"tr",align:"center"},"a"),(0,r.kt)("td",{parentName:"tr",align:"center"},"4"),(0,r.kt)("td",{parentName:"tr",align:"left"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"td"},"main()"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},"0"),(0,r.kt)("td",{parentName:"tr",align:"center"},"x"),(0,r.kt)("td",{parentName:"tr",align:"center"},"24"),(0,r.kt)("td",{parentName:"tr",align:"left"},"milik fungsi ",(0,r.kt)("inlineCode",{parentName:"td"},"main()"))))),(0,r.kt)("p",null,"Setelah fungsi selesai dieksekusi, stack frame di-dealokasi."),(0,r.kt)("p",null,"Kurang lebih seperti itu sekilas peran dari stack dalam Rust programming. Selanjutnya kita bahas tentang heap memory."),(0,r.kt)("h2",{id:"a324-heap-memory"},"A.32.4. Heap memory"),(0,r.kt)("p",null,"Heap adalah salah satu tempat alokasi memory selain stack. Karakteristik dari heap:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Heap digunakan untuk alokasi data yang sifatnya dinamis, tidak diketahui size-nya, atau bisa berubah size-nya"),(0,r.kt)("li",{parentName:"ul"},"Data di heap tidak memiliki pattern tertentu"),(0,r.kt)("li",{parentName:"ul"},"Alokasi dan dealokasi data di heap bisa dilakukan kapanpun"),(0,r.kt)("li",{parentName:"ul"},"Kecepatan pengaksesan data di heap lebih lambat dibanding stack")),(0,r.kt)("p",null,"Ilustrasi perbandingan stack dan heap:"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Heap memory",src:t(6907).Z,width:"414",height:"236"})),(0,r.kt)("p",null,"Tipe data non-primitive di Rust data-nya disimpan di heap, contohnya seperti Vector, ",(0,r.kt)("inlineCode",{parentName:"p"},"String"),", dan beberapa lainnya. Penulis tekankan, bahwa ",(0,r.kt)("strong",{parentName:"p"},"yang disimpan di heap adalah data-nya saja, sedangkan atribut lainnya (seperti ",(0,r.kt)("inlineCode",{parentName:"strong"},"length")," dan ",(0,r.kt)("inlineCode",{parentName:"strong"},"capacity"),") tetap disimpan disimpan di stack"),". Lebih jelasnya silakan lihat ilustrasi berikut:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"let numbers = vec![12, 24, 7];\n")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Heap memory",src:t(6033).Z,width:"420",height:"184"})),(0,r.kt)("p",null,"Heap, selain digunakan sebagai penyimpanan data dinamis, kita juga bisa manfaatkan sebagai penyimpanan data jenis lainnya (secara eksplisit) menggunakan tipe data ",(0,r.kt)("inlineCode",{parentName:"p"},"Box"),"."),(0,r.kt)("p",null,"Pembahasan Lebih jelasnya mengenai heap allocation ada pada chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/string-slice-vs-string-literal"},"String Custom Type vs ",(0,r.kt)("inlineCode",{parentName:"a"},"&str"))," dan juga ",(0,r.kt)("a",{parentName:"p",href:"#/wip/box"},"Box"),". Namun untuk sekarang, penulis anjurkan untuk lanjut ke pembahasan berikutnya terlebih dahulu."),(0,r.kt)("h2",{id:"a325-error-memory-management"},"A.32.5. Error memory management"),(0,r.kt)("p",null,"Rust sangat disiplin dalam hal penulisan source code, terutama untuk kode-kode yang berhubungan dengan memory management. Hal ini dilakukan oleh Rust untuk meminimalisir munculnya error seperti memory leak dan sejenisnya."),(0,r.kt)("p",null,"Namun meski demikian, potensi error memory tetap ada, dan kita akan bahas itu nantinya setelah masuk chapter ",(0,r.kt)("a",{parentName:"p",href:"#/wip/safe-unsafe"},"Safe & Unsafe"),"."),(0,r.kt)("p",null,"Nantinya akan dibahas juga tentang beberapa error saat compile time yang error tersebut berhubungan dengan memory management, yaitu pada chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/ownership"},"Ownership")," dan ",(0,r.kt)("a",{parentName:"p",href:"/basic/borrowing"},"Borrowing"),". Untuk sekarang, mari lanjut ke chapter berikutnya terlebih dahulu."),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,r.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,r.kt)("pre",null,(0,r.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/memory_management"},"github.com/novalagung/dasarpemrogramanrust-example/../memory_management")),(0,r.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/nomicon/ownership.html"},"https://doc.rust-lang.org/nomicon/ownership.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html"},"https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/1.22.0/book/first-edition/the-stack-and-the-heap.html"},"https://doc.rust-lang.org/1.22.0/book/first-edition/the-stack-and-the-heap.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/std/box.html"},"https://doc.rust-lang.org/rust-by-example/std/box.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html"},"https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://docs.elementscompiler.com/Concepts/ARC/"},"https://docs.elementscompiler.com/Concepts/ARC/")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://en.wikipedia.org/wiki/Memory_address"},"https://en.wikipedia.org/wiki/Memory_address")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://en.wikipedia.org/wiki/Code_segment"},"https://en.wikipedia.org/wiki/Code_segment")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://en.wikipedia.org/wiki/Automatic_Reference_Counting"},"https://en.wikipedia.org/wiki/Automatic_Reference_Counting")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)"},"https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://log2base2.com/C/pointer/computer-memory-address-basics.html"},"https://log2base2.com/C/pointer/computer-memory-address-basics.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://quora.com/How-does-memory-management-work-in-Rust"},"https://quora.com/How-does-memory-management-work-in-Rust")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://medium.com/the-legend/management-memori-pada-bahasa-pemrograman-a33772635aa5"},"https://medium.com/the-legend/management-memori-pada-bahasa-pemrograman-a33772635aa5")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://imam.digmi.id/post/belajar-rust-memahami-stack-dan-heap/"},"https://imam.digmi.id/post/belajar-rust-memahami-stack-dan-heap/")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://javatpoint.com/rust-ownership"},"https://javatpoint.com/rust-ownership")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/24158114"},"https://stackoverflow.com/questions/24158114"))))}d.isMDXComponent=!0},4275:(a,e,t)=>{t.d(e,{Z:()=>n});const n=t.p+"assets/images/basic-memory-management-1-ac98989ab48847e58470100c02455dab.png"},9929:(a,e,t)=>{t.d(e,{Z:()=>n});const n=t.p+"assets/images/basic-memory-management-2-114833fdf1f1ac3114d03494e6603ff1.jpg"},6907:(a,e,t)=>{t.d(e,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZ4AAADsCAIAAADLg1cmAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDx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jlMPtK3H008/faZuH6pRSgsCGBIAQErMU6vVlXPnzsWqrGYsXLgwW6/X015GtAWIrxLffBgSAEBqRPFs6cuWLVte3bRpk9sb0ebNm1nr1q3zuBnR1iCPKPmNhyEBAKTKkObNm5/o0qVLKVXK7sb69etZx44dS6kMeFk84Q5vOAwJACB1hvFs6VREREQxbTJ369YtxZoQbTG+aNEiFhoaWhoeHn6M/+9D3emNhiEBAOTCn0NCQvYYjcbrU6ZMKTl16pRijGj//v3s+eefL1CpVDf5/7id/6+PuuMbDEMCAMiNSF9f3yXe3t6FJpOp4P3332d5eXmyM6HU1FT2zjvvsLZt2xYGBARc5P/Xmx6128q7LTAkAICciQkNDf2aFm3t0aNH7ooVK26mpaVJ1oQOHjzIZsyYUdK+ffs8MtTg4OCPPBQyqRWGBAAAtei4/qLX6zcbDIaCsLCwwvHjx5cmJSUxV64CcfjwYZaYmMiGDh1awA2ojGd2tC0ErTfXF28ZDAkA4B6YuF4LCgr6jjIRf3//0kceeeTK5MmT8zZu3FhNmUpurn12Vr958yajrOzbb79lS5curRg5cmRux44dc728vKoCAwMzAgICNvF7Gc0VjrcFhgQAAG24hnPN4vrYaDSe0Gq1JRqNpjIkJKSgc+fOV3r27Hlp+PDhWWPGjMnhxlXw5ptvls+ZM+fWrFmzKqdNm1YyceLE/NjY2CuDBg3K6tat2+W2bdvmcqMr4eer5ue7wjOzH/jvq7gmedQ2w/mi2GFIAABwr5BpdKwzkKe4xnJN4XqDazbXW3WK55rqUbui9vNcQ7i6cYWhCCVmSBAEQRDkaKEQIAiCIBgSBEEQBMGQIAiCIBgSBEEQBMGQIAiCIBgSBEEQBMGQIAiCIBgSBEEQBDWm/wcTwEbwntl2lQAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/04da11da.4b3bbe99.js b/assets/js/04da11da.4b3bbe99.js new file mode 100644 index 00000000..a3fbd5ac --- /dev/null +++ b/assets/js/04da11da.4b3bbe99.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[3007],{3905:(e,a,n)=>{n.d(a,{Zo:()=>k,kt:()=>o});var A=n(7294);function l(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function t(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(e);a&&(A=A.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,A)}return n}function i(e){for(var a=1;a=0||(l[n]=e[n]);return l}(e,a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);for(A=0;A=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var p=A.createContext({}),d=function(e){var a=A.useContext(p),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},k=function(e){var a=d(e.components);return A.createElement(p.Provider,{value:a},e.children)},m={inlineCode:"code",wrapper:function(e){var a=e.children;return A.createElement(A.Fragment,{},a)}},u=A.forwardRef((function(e,a){var n=e.components,l=e.mdxType,t=e.originalType,p=e.parentName,k=r(e,["components","mdxType","originalType","parentName"]),u=d(n),o=l,c=u["".concat(p,".").concat(o)]||u[o]||m[o]||t;return n?A.createElement(c,i(i({ref:a},k),{},{components:n})):A.createElement(c,i({ref:a},k))}));function o(e,a){var n=arguments,l=a&&a.mdxType;if("string"==typeof e||l){var t=n.length,i=new Array(t);i[0]=u;var r={};for(var p in a)hasOwnProperty.call(a,p)&&(r[p]=a[p]);r.originalType=e,r.mdxType="string"==typeof e?e:l,i[1]=r;for(var d=2;d{n.r(a),n.d(a,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>t,metadata:()=>r,toc:()=>d});var A=n(7462),l=(n(7294),n(3905));const t={sidebar_position:11,title:"A.11. Perulangan \u279c loop, break, continue, label",sidebar_label:"A.11. Perulangan \u279c loop, break, continue, label"},i=void 0,r={unversionedId:"basic/perulangan-loop-break-continue-label",id:"basic/perulangan-loop-break-continue-label",title:"A.11. Perulangan \u279c loop, break, continue, label",description:"Selain keyword while, ada juga keyword loop yang fungsi dasarnya adalah sama, yaitu untuk perulangan.",source:"@site/docs/basic/perulangan-loop-break-continue-label.md",sourceDirName:"basic",slug:"/basic/perulangan-loop-break-continue-label",permalink:"/basic/perulangan-loop-break-continue-label",draft:!1,tags:[],version:"current",sidebarPosition:11,frontMatter:{sidebar_position:11,title:"A.11. Perulangan \u279c loop, break, continue, label",sidebar_label:"A.11. Perulangan \u279c loop, break, continue, label"},sidebar:"tutorialSidebar",previous:{title:"A.10. Perulangan \u279c while",permalink:"/basic/perulangan-while"},next:{title:"A.12. Perulangan \u279c for in",permalink:"/basic/perulangan-for-in"}},p={},d=[{value:"A.11.1. Keyword loop",id:"a111-keyword-loop",level:2},{value:"A.11.2. Keyword break",id:"a112-keyword-break",level:2},{value:"A.11.3. Nested loop",id:"a113-nested-loop",level:2},{value:"A.11.4. Keyword continue",id:"a114-keyword-continue",level:2},{value:"A.11.5. Label perulangan",id:"a115-label-perulangan",level:2},{value:"A.11.6. Returning from loop",id:"a116-returning-from-loop",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],k={toc:d};function m(e){let{components:a,...t}=e;return(0,l.kt)("wrapper",(0,A.Z)({},k,t,{components:a,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"Selain keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"while"),", ada juga keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"loop")," yang fungsi dasarnya adalah sama, yaitu untuk perulangan."),(0,l.kt)("h2",{id:"a111-keyword-loop"},"A.11.1. Keyword ",(0,l.kt)("inlineCode",{parentName:"h2"},"loop")),(0,l.kt)("p",null,"Notasi penulisan dan cara penggunaan ",(0,l.kt)("inlineCode",{parentName:"p"},"loop")," ada sedikit beda dibanding ",(0,l.kt)("inlineCode",{parentName:"p"},"while"),". Keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"loop")," tidak membutuhkan argument. Blok kode loop akan terus dieksekusi selama program tidak di-stop."),(0,l.kt)("p",null,"Silakan coba praktikkan kode berikut. Angka ",(0,l.kt)("inlineCode",{parentName:"p"},"i")," akan ditampilkan setiap perulangan kemudian di-increment nilainya. Angka akan muncul terus sampai aplikasi di-stop."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let mut i = 0;\n\n loop {\n println!("nilai: {i}");\n i += 1;\n }\n}\n')),(0,l.kt)("p",null,(0,l.kt)("img",{loading:"eager",fetchpriority:"high",alt:"loop tanpa break",src:n(3723).Z,width:"608",height:"213"})),(0,l.kt)("h2",{id:"a112-keyword-break"},"A.11.2. Keyword ",(0,l.kt)("inlineCode",{parentName:"h2"},"break")),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"loop")," menghasilkan perulangan tanpa henti, lalu bagaimana cara stop-nya? Di sinilah keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"break")," berperan. ",(0,l.kt)("inlineCode",{parentName:"p"},"break")," digunakan untuk menghentikan paksa eksekusi blok kode perulangan. Biasanya keyword ini digunakan dalam kondisi tertentu (sesuai kebutuhan), misalnya ",(0,l.kt)("inlineCode",{parentName:"p"},"perulangan harus berhenti ketika nilai i di atas max"),"."),(0,l.kt)("p",null,"Mari kita ubah kode di atas dengan menambahkan kondisi untuk menghentikan perulangan jika ",(0,l.kt)("inlineCode",{parentName:"p"},"i")," nilainya lebih dari ",(0,l.kt)("inlineCode",{parentName:"p"},"5"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'let mut i = 0;\nlet max = 5;\n\nloop {\n println!("nilai: {i}");\n i += 1;\n if i > max {\n break;\n }\n}\n\nprintln!("perulangan selesai");\n')),(0,l.kt)("p",null,(0,l.kt)("img",{loading:"lazy",alt:"keyword break",src:n(4722).Z,width:"451",height:"195"})),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"Penulisan ",(0,l.kt)("inlineCode",{parentName:"p"},"break")," boleh tanpa diakhiri semicolon ",(0,l.kt)("inlineCode",{parentName:"p"},";"))),(0,l.kt)("h2",{id:"a113-nested-loop"},"A.11.3. Nested ",(0,l.kt)("inlineCode",{parentName:"h2"},"loop")),(0,l.kt)("p",null,"Cara menerapkan nested loop (atau ",(0,l.kt)("inlineCode",{parentName:"p"},"loop")," di dalam ",(0,l.kt)("inlineCode",{parentName:"p"},"loop"),"), tulis saja statement ",(0,l.kt)("inlineCode",{parentName:"p"},"loop")," di dalam ",(0,l.kt)("inlineCode",{parentName:"p"},"loop")," sesuai kebutuhan."),(0,l.kt)("p",null,"Pada kode berikut, teknik nested loop diterapkan untuk membuat bentuk segitiga menggunakan karakter ",(0,l.kt)("inlineCode",{parentName:"p"},"*"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'let mut i = 0;\nlet max = 5;\n\nloop {\n let mut j = max;\n let max_inner = i;\n\n loop {\n print!("* ");\n j -= 1;\n if j < max_inner {\n break;\n }\n }\n \n println!();\n\n i += 1;\n if i > max {\n break;\n }\n}\n')),(0,l.kt)("p",null,(0,l.kt)("img",{loading:"lazy",alt:"keyword break",src:n(4237).Z,width:"454",height:"175"})),(0,l.kt)("h2",{id:"a114-keyword-continue"},"A.11.4. Keyword ",(0,l.kt)("inlineCode",{parentName:"h2"},"continue")),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"continue")," digunakan untuk melanjutkan paksa sebuah perulangan, kebalikan dari ",(0,l.kt)("inlineCode",{parentName:"p"},"break")," yang fungsinya menghentikan paksa sebuah perulangan."),(0,l.kt)("p",null,"Source code berikut merupakan contoh penerapan ",(0,l.kt)("inlineCode",{parentName:"p"},"continue"),". Variabel ",(0,l.kt)("inlineCode",{parentName:"p"},"i")," berperan sebagai counter perulangan. Jika nilai ",(0,l.kt)("inlineCode",{parentName:"p"},"i")," adalah ganjil, maka perulangan dipaksa lanjut ke iterasi berikutnya. Dengan ini maka macro ",(0,l.kt)("inlineCode",{parentName:"p"},"println")," hanya akan menampilkan nilai genap. Dan program akan berhenti jika ",(0,l.kt)("inlineCode",{parentName:"p"},"i")," nilainya lebih dari ",(0,l.kt)("inlineCode",{parentName:"p"},"max"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'let mut i = 0;\nlet max = 15;\n\nloop {\n i += 1;\n\n if i % 2 == 1 {\n continue;\n }\n\n println!("nilai i: {i}");\n\n if i > max {\n break;\n }\n}\n')),(0,l.kt)("p",null,(0,l.kt)("img",{loading:"lazy",alt:"keyword continue",src:n(5541).Z,width:"456",height:"230"})),(0,l.kt)("h2",{id:"a115-label-perulangan"},"A.11.5. Label perulangan"),(0,l.kt)("p",null,"Statement perulangan menggunakan ",(0,l.kt)("inlineCode",{parentName:"p"},"loop")," bisa ditandai dengan label. Manfaat dari penggunaan label adalah bisa mengeksekusi ",(0,l.kt)("inlineCode",{parentName:"p"},"break")," atau ",(0,l.kt)("inlineCode",{parentName:"p"},"continue")," ke perulangan di luar blok kode perulangan di mana statement itu berada. Umumnya label perulangan dipergunakan pada nested loop untuk keperluan menghentikan/melanjutkan paksa perulangan terluar."),(0,l.kt)("p",null,"Berikut adalah notasi penulisan loop dengan dan tanpa label. Nama label diawali dengan tanda petik ",(0,l.kt)("inlineCode",{parentName:"p"},"'"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},"// loop biasa\nloop {\n // statements\n break;\n}\n\n// loop dengan label\n'namaLabel: loop {\n // statements\n break 'namaLabel;\n}\n")),(0,l.kt)("p",null,"Mari kita pelajari dan praktikkan kode berikut ini. Di bawah ini adalah sebuah program sederhana menampilkan angka yang hasilnya bisa dilihat pada gambar di bawahnya. Perulangan di level 2 akan dihentikan secara paksa ketika ",(0,l.kt)("inlineCode",{parentName:"p"},"j > i"),". Sedangkan perulangan level pertama atau terluar (dengan label ",(0,l.kt)("inlineCode",{parentName:"p"},"'mainLoop"),") akan dihentikan paksa dari perulangan level 2 jika kondisi ",(0,l.kt)("inlineCode",{parentName:"p"},"i > max"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},"let mut i = 0;\nlet max = 9;\n\n'mainLoop: loop {\n i += 1;\n let mut j = 0;\n\n loop {\n if i > max {\n break 'mainLoop;\n }\n\n j += 1;\n if j > i {\n break;\n }\n\n print!(\"{i} \");\n }\n\n println!();\n}\n")),(0,l.kt)("p",null,(0,l.kt)("img",{loading:"lazy",alt:"looping label",src:n(5302).Z,width:"514",height:"227"})),(0,l.kt)("h2",{id:"a116-returning-from-loop"},"A.11.6. Returning from ",(0,l.kt)("inlineCode",{parentName:"h2"},"loop")),(0,l.kt)("p",null,(0,l.kt)("em",{parentName:"p"},"Returning from ",(0,l.kt)("inlineCode",{parentName:"em"},"loop"))," merupakan teknik pemanfaatan ",(0,l.kt)("inlineCode",{parentName:"p"},"loop")," dan ",(0,l.kt)("inlineCode",{parentName:"p"},"break")," untuk menampung sebuah return value dari blok kode perulangan ",(0,l.kt)("inlineCode",{parentName:"p"},"loop"),". Agar lebih jelas, silakan coba kode berikut:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'let mut counter = 0;\n\nlet result = loop {\n counter += 1;\n\n if counter == 10 {\n break counter * 2;\n }\n};\n\nprintln!("result: {result}");\n')),(0,l.kt)("p",null,"Pada kode di atas, variabel ",(0,l.kt)("inlineCode",{parentName:"p"},"result")," dideklarasikan dengan predefined value adalah blok kode ",(0,l.kt)("inlineCode",{parentName:"p"},"loop"),". Di sini artinya variabel ",(0,l.kt)("inlineCode",{parentName:"p"},"result")," isinya bukan blok kode perulangan ",(0,l.kt)("inlineCode",{parentName:"p"},"loop"),", melainkan isinya adalah apapun yang dituliskan setelah keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"break"),". Unik ya?"),(0,l.kt)("p",null,"Variabel ",(0,l.kt)("inlineCode",{parentName:"p"},"counter")," yang nilai awalnya ",(0,l.kt)("inlineCode",{parentName:"p"},"0"),", di-increment dalam perulangan. Ketika nilai ",(0,l.kt)("inlineCode",{parentName:"p"},"counter")," adalah ",(0,l.kt)("inlineCode",{parentName:"p"},"10"),", nilai ",(0,l.kt)("inlineCode",{parentName:"p"},"counter * 2")," dijadikan sebagai return value. Dengan ini maka variabel ",(0,l.kt)("inlineCode",{parentName:"p"},"result")," nilainya adalah ",(0,l.kt)("inlineCode",{parentName:"p"},"20"),"."),(0,l.kt)("p",null,(0,l.kt)("img",{loading:"lazy",alt:"looping label",src:n(5249).Z,width:"553",height:"117"})),(0,l.kt)("hr",null),(0,l.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,l.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,l.kt)("pre",null,(0,l.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/perulangan_loop_break_continue_label"},"github.com/novalagung/dasarpemrogramanrust-example/../perulangan_loop_break_continue_label")),(0,l.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch03-05-control-flow.html"},"https://doc.rust-lang.org/book/ch03-05-control-flow.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.loop.html"},"https://doc.rust-lang.org/std/keyword.loop.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.break.html"},"https://doc.rust-lang.org/std/keyword.break.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.continue.html"},"https://doc.rust-lang.org/std/keyword.continue.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/flow_control/loop.html"},"https://doc.rust-lang.org/rust-by-example/flow_control/loop.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/flow_control/loop/nested.html"},"https://doc.rust-lang.org/rust-by-example/flow_control/loop/nested.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/flow_control/loop/return.html"},"https://doc.rust-lang.org/rust-by-example/flow_control/loop/return.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/expressions/loop-expr.html"},"https://doc.rust-lang.org/reference/expressions/loop-expr.html"))))}m.isMDXComponent=!0},3723:(e,a,n)=>{n.d(a,{Z:()=>A});const A=n.p+"assets/images/perulangan-loop-break-continue-label-1-f02ae31c07ab672a301cbf6db2f23179.png"},4722:(e,a,n)=>{n.d(a,{Z:()=>A});const A="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcMAAADDCAIAAABxk+09AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib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i0odhDEARBpA3FHoIgCCJtKPYQBEEQaUOxhyAIgkgbij0EQRBE2lDsIQiCINKGYg9BEASRNhR7CIIgiLSh2EMQBEGkDcUegiAIIm0o9hAEQRBpQ7GHIAiCSBuKPQRBEETa/D+WdfpclQ0ncgAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/04da11da.d61e5604.js b/assets/js/04da11da.d61e5604.js deleted file mode 100644 index e5bc661a..00000000 --- a/assets/js/04da11da.d61e5604.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[3007],{3905:(e,a,n)=>{n.d(a,{Zo:()=>k,kt:()=>o});var A=n(7294);function l(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function t(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(e);a&&(A=A.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,A)}return n}function i(e){for(var a=1;a=0||(l[n]=e[n]);return l}(e,a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);for(A=0;A=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var p=A.createContext({}),d=function(e){var a=A.useContext(p),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},k=function(e){var a=d(e.components);return A.createElement(p.Provider,{value:a},e.children)},m={inlineCode:"code",wrapper:function(e){var a=e.children;return A.createElement(A.Fragment,{},a)}},u=A.forwardRef((function(e,a){var n=e.components,l=e.mdxType,t=e.originalType,p=e.parentName,k=r(e,["components","mdxType","originalType","parentName"]),u=d(n),o=l,c=u["".concat(p,".").concat(o)]||u[o]||m[o]||t;return n?A.createElement(c,i(i({ref:a},k),{},{components:n})):A.createElement(c,i({ref:a},k))}));function o(e,a){var n=arguments,l=a&&a.mdxType;if("string"==typeof e||l){var t=n.length,i=new Array(t);i[0]=u;var r={};for(var p in a)hasOwnProperty.call(a,p)&&(r[p]=a[p]);r.originalType=e,r.mdxType="string"==typeof e?e:l,i[1]=r;for(var d=2;d{n.r(a),n.d(a,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>t,metadata:()=>r,toc:()=>d});var A=n(7462),l=(n(7294),n(3905));const t={sidebar_position:11,title:"A.11. Perulangan \u279c loop, break, continue, label",sidebar_label:"A.11. Perulangan \u279c loop, break, continue, label"},i=void 0,r={unversionedId:"basic/perulangan-loop-break-continue-label",id:"basic/perulangan-loop-break-continue-label",title:"A.11. Perulangan \u279c loop, break, continue, label",description:"Selain keyword while, ada juga keyword loop yang fungsi dasarnya adalah sama, yaitu untuk perulangan.",source:"@site/docs/basic/perulangan-loop-break-continue-label.md",sourceDirName:"basic",slug:"/basic/perulangan-loop-break-continue-label",permalink:"/basic/perulangan-loop-break-continue-label",draft:!1,tags:[],version:"current",sidebarPosition:11,frontMatter:{sidebar_position:11,title:"A.11. Perulangan \u279c loop, break, continue, label",sidebar_label:"A.11. Perulangan \u279c loop, break, continue, label"},sidebar:"tutorialSidebar",previous:{title:"A.10. Perulangan \u279c while",permalink:"/basic/perulangan-while"},next:{title:"A.12. Perulangan \u279c for in",permalink:"/basic/perulangan-for-in"}},p={},d=[{value:"A.11.1. Keyword loop",id:"a111-keyword-loop",level:2},{value:"A.11.2. Keyword break",id:"a112-keyword-break",level:2},{value:"A.11.3. Nested loop",id:"a113-nested-loop",level:2},{value:"A.11.4. Keyword continue",id:"a114-keyword-continue",level:2},{value:"A.11.5. Label perulangan",id:"a115-label-perulangan",level:2},{value:"A.11.6. Returning from loop",id:"a116-returning-from-loop",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],k={toc:d};function m(e){let{components:a,...t}=e;return(0,l.kt)("wrapper",(0,A.Z)({},k,t,{components:a,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"Selain keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"while"),", ada juga keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"loop")," yang fungsi dasarnya adalah sama, yaitu untuk perulangan."),(0,l.kt)("h2",{id:"a111-keyword-loop"},"A.11.1. Keyword ",(0,l.kt)("inlineCode",{parentName:"h2"},"loop")),(0,l.kt)("p",null,"Notasi penulisan dan cara penggunaan ",(0,l.kt)("inlineCode",{parentName:"p"},"loop")," ada sedikit beda dibanding ",(0,l.kt)("inlineCode",{parentName:"p"},"while"),". Keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"loop")," tidak membutuhkan argument. Blok kode loop akan terus dieksekusi selama program tidak di-stop."),(0,l.kt)("p",null,"Silakan coba praktikkan kode berikut. Angka ",(0,l.kt)("inlineCode",{parentName:"p"},"i")," akan ditampilkan setiap perulangan kemudian di-increment nilainya. Angka akan muncul terus sampai aplikasi di-stop."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let mut i = 0;\n\n loop {\n println!("nilai: {i}");\n i += 1;\n }\n}\n')),(0,l.kt)("p",null,(0,l.kt)("img",{alt:"loop tanpa break",src:n(3723).Z,width:"608",height:"213"})),(0,l.kt)("h2",{id:"a112-keyword-break"},"A.11.2. Keyword ",(0,l.kt)("inlineCode",{parentName:"h2"},"break")),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"loop")," menghasilkan perulangan tanpa henti, lalu bagaimana cara stop-nya? Di sinilah keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"break")," berperan. ",(0,l.kt)("inlineCode",{parentName:"p"},"break")," digunakan untuk menghentikan paksa eksekusi blok kode perulangan. Biasanya keyword ini digunakan dalam kondisi tertentu (sesuai kebutuhan), misalnya ",(0,l.kt)("inlineCode",{parentName:"p"},"perulangan harus berhenti ketika nilai i di atas max"),"."),(0,l.kt)("p",null,"Mari kita ubah kode di atas dengan menambahkan kondisi untuk menghentikan perulangan jika ",(0,l.kt)("inlineCode",{parentName:"p"},"i")," nilainya lebih dari ",(0,l.kt)("inlineCode",{parentName:"p"},"5"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'let mut i = 0;\nlet max = 5;\n\nloop {\n println!("nilai: {i}");\n i += 1;\n if i > max {\n break;\n }\n}\n\nprintln!("perulangan selesai");\n')),(0,l.kt)("p",null,(0,l.kt)("img",{alt:"keyword break",src:n(4722).Z,width:"451",height:"195"})),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"Penulisan ",(0,l.kt)("inlineCode",{parentName:"p"},"break")," boleh tanpa diakhiri semicolon ",(0,l.kt)("inlineCode",{parentName:"p"},";"))),(0,l.kt)("h2",{id:"a113-nested-loop"},"A.11.3. Nested ",(0,l.kt)("inlineCode",{parentName:"h2"},"loop")),(0,l.kt)("p",null,"Cara menerapkan nested loop (atau ",(0,l.kt)("inlineCode",{parentName:"p"},"loop")," di dalam ",(0,l.kt)("inlineCode",{parentName:"p"},"loop"),"), tulis saja statement ",(0,l.kt)("inlineCode",{parentName:"p"},"loop")," di dalam ",(0,l.kt)("inlineCode",{parentName:"p"},"loop")," sesuai kebutuhan."),(0,l.kt)("p",null,"Pada kode berikut, teknik nested loop diterapkan untuk membuat bentuk segitiga menggunakan karakter ",(0,l.kt)("inlineCode",{parentName:"p"},"*"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'let mut i = 0;\nlet max = 5;\n\nloop {\n let mut j = max;\n let max_inner = i;\n\n loop {\n print!("* ");\n j -= 1;\n if j < max_inner {\n break;\n }\n }\n \n println!();\n\n i += 1;\n if i > max {\n break;\n }\n}\n')),(0,l.kt)("p",null,(0,l.kt)("img",{alt:"keyword break",src:n(4237).Z,width:"454",height:"175"})),(0,l.kt)("h2",{id:"a114-keyword-continue"},"A.11.4. Keyword ",(0,l.kt)("inlineCode",{parentName:"h2"},"continue")),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"continue")," digunakan untuk melanjutkan paksa sebuah perulangan, kebalikan dari ",(0,l.kt)("inlineCode",{parentName:"p"},"break")," yang fungsinya menghentikan paksa sebuah perulangan."),(0,l.kt)("p",null,"Source code berikut merupakan contoh penerapan ",(0,l.kt)("inlineCode",{parentName:"p"},"continue"),". Variabel ",(0,l.kt)("inlineCode",{parentName:"p"},"i")," berperan sebagai counter perulangan. Jika nilai ",(0,l.kt)("inlineCode",{parentName:"p"},"i")," adalah ganjil, maka perulangan dipaksa lanjut ke iterasi berikutnya. Dengan ini maka macro ",(0,l.kt)("inlineCode",{parentName:"p"},"println")," hanya akan menampilkan nilai genap. Dan program akan berhenti jika ",(0,l.kt)("inlineCode",{parentName:"p"},"i")," nilainya lebih dari ",(0,l.kt)("inlineCode",{parentName:"p"},"max"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'let mut i = 0;\nlet max = 15;\n\nloop {\n i += 1;\n\n if i % 2 == 1 {\n continue;\n }\n\n println!("nilai i: {i}");\n\n if i > max {\n break;\n }\n}\n')),(0,l.kt)("p",null,(0,l.kt)("img",{alt:"keyword continue",src:n(5541).Z,width:"456",height:"230"})),(0,l.kt)("h2",{id:"a115-label-perulangan"},"A.11.5. Label perulangan"),(0,l.kt)("p",null,"Statement perulangan menggunakan ",(0,l.kt)("inlineCode",{parentName:"p"},"loop")," bisa ditandai dengan label. Manfaat dari penggunaan label adalah bisa mengeksekusi ",(0,l.kt)("inlineCode",{parentName:"p"},"break")," atau ",(0,l.kt)("inlineCode",{parentName:"p"},"continue")," ke perulangan di luar blok kode perulangan di mana statement itu berada. Umumnya label perulangan dipergunakan pada nested loop untuk keperluan menghentikan/melanjutkan paksa perulangan terluar."),(0,l.kt)("p",null,"Berikut adalah notasi penulisan loop dengan dan tanpa label. Nama label diawali dengan tanda petik ",(0,l.kt)("inlineCode",{parentName:"p"},"'"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},"// loop biasa\nloop {\n // statements\n break;\n}\n\n// loop dengan label\n'namaLabel: loop {\n // statements\n break 'namaLabel;\n}\n")),(0,l.kt)("p",null,"Mari kita pelajari dan praktikkan kode berikut ini. Di bawah ini adalah sebuah program sederhana menampilkan angka yang hasilnya bisa dilihat pada gambar di bawahnya. Perulangan di level 2 akan dihentikan secara paksa ketika ",(0,l.kt)("inlineCode",{parentName:"p"},"j > i"),". Sedangkan perulangan level pertama atau terluar (dengan label ",(0,l.kt)("inlineCode",{parentName:"p"},"'mainLoop"),") akan dihentikan paksa dari perulangan level 2 jika kondisi ",(0,l.kt)("inlineCode",{parentName:"p"},"i > max"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},"let mut i = 0;\nlet max = 9;\n\n'mainLoop: loop {\n i += 1;\n let mut j = 0;\n\n loop {\n if i > max {\n break 'mainLoop;\n }\n\n j += 1;\n if j > i {\n break;\n }\n\n print!(\"{i} \");\n }\n\n println!();\n}\n")),(0,l.kt)("p",null,(0,l.kt)("img",{alt:"looping label",src:n(5302).Z,width:"514",height:"227"})),(0,l.kt)("h2",{id:"a116-returning-from-loop"},"A.11.6. Returning from ",(0,l.kt)("inlineCode",{parentName:"h2"},"loop")),(0,l.kt)("p",null,(0,l.kt)("em",{parentName:"p"},"Returning from ",(0,l.kt)("inlineCode",{parentName:"em"},"loop"))," merupakan teknik pemanfaatan ",(0,l.kt)("inlineCode",{parentName:"p"},"loop")," dan ",(0,l.kt)("inlineCode",{parentName:"p"},"break")," untuk menampung sebuah return value dari blok kode perulangan ",(0,l.kt)("inlineCode",{parentName:"p"},"loop"),". Agar lebih jelas, silakan coba kode berikut:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'let mut counter = 0;\n\nlet result = loop {\n counter += 1;\n\n if counter == 10 {\n break counter * 2;\n }\n};\n\nprintln!("result: {result}");\n')),(0,l.kt)("p",null,"Pada kode di atas, variabel ",(0,l.kt)("inlineCode",{parentName:"p"},"result")," dideklarasikan dengan predefined value adalah blok kode ",(0,l.kt)("inlineCode",{parentName:"p"},"loop"),". Di sini artinya variabel ",(0,l.kt)("inlineCode",{parentName:"p"},"result")," isinya bukan blok kode perulangan ",(0,l.kt)("inlineCode",{parentName:"p"},"loop"),", melainkan isinya adalah apapun yang dituliskan setelah keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"break"),". Unik ya?"),(0,l.kt)("p",null,"Variabel ",(0,l.kt)("inlineCode",{parentName:"p"},"counter")," yang nilai awalnya ",(0,l.kt)("inlineCode",{parentName:"p"},"0"),", di-increment dalam perulangan. Ketika nilai ",(0,l.kt)("inlineCode",{parentName:"p"},"counter")," adalah ",(0,l.kt)("inlineCode",{parentName:"p"},"10"),", nilai ",(0,l.kt)("inlineCode",{parentName:"p"},"counter * 2")," dijadikan sebagai return value. Dengan ini maka variabel ",(0,l.kt)("inlineCode",{parentName:"p"},"result")," nilainya adalah ",(0,l.kt)("inlineCode",{parentName:"p"},"20"),"."),(0,l.kt)("p",null,(0,l.kt)("img",{alt:"looping label",src:n(5249).Z,width:"553",height:"117"})),(0,l.kt)("hr",null),(0,l.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,l.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,l.kt)("pre",null,(0,l.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/perulangan_loop_break_continue_label"},"github.com/novalagung/dasarpemrogramanrust-example/../perulangan_loop_break_continue_label")),(0,l.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch03-05-control-flow.html"},"https://doc.rust-lang.org/book/ch03-05-control-flow.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.loop.html"},"https://doc.rust-lang.org/std/keyword.loop.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.break.html"},"https://doc.rust-lang.org/std/keyword.break.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.continue.html"},"https://doc.rust-lang.org/std/keyword.continue.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/flow_control/loop.html"},"https://doc.rust-lang.org/rust-by-example/flow_control/loop.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/flow_control/loop/nested.html"},"https://doc.rust-lang.org/rust-by-example/flow_control/loop/nested.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/flow_control/loop/return.html"},"https://doc.rust-lang.org/rust-by-example/flow_control/loop/return.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/expressions/loop-expr.html"},"https://doc.rust-lang.org/reference/expressions/loop-expr.html"))))}m.isMDXComponent=!0},3723:(e,a,n)=>{n.d(a,{Z:()=>A});const A=n.p+"assets/images/perulangan-loop-break-continue-label-1-f02ae31c07ab672a301cbf6db2f23179.png"},4722:(e,a,n)=>{n.d(a,{Z:()=>A});const A="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcMAAADDCAIAAABxk+09AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZ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PdmQwxmgA0BkMYdiZ/CkV88NBJ9UcEQRBEAhTrXM7eNEZig/3fGbXOoOh9Ycxz2W8cfGjMxha03cWj/aazaafOQAr8NiGWwcvOsO8/JW+uG1r975oDeAIgiCI2ZERBMH/DMb7f/uSNn2GDexHrHHR5MSh+qwjPSy+qO90HGcCY6VcuHVuj/aaD0X7AWPWz0pwVtOABEEQhIvg2EMQBEEQ8XJpvi0lCIIgLgwUewiCIIi0odhDEARBpA3FHoIgCCJtKPYQBEEQaUOxhyAIgkgbij0EQRBE2lDsIQiCINKGYg9BEASRNhR7CIIgiLSh2EMQBEGkDcUegiAIIm0o9hAEQRBpQ7GHIAiCSBuKPQRBEETa/D+WdfpclQ0ncgAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/05cc1716.3b4c86e1.js b/assets/js/05cc1716.3b4c86e1.js new file mode 100644 index 00000000..6195a97d --- /dev/null +++ b/assets/js/05cc1716.3b4c86e1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[6477],{3905:(e,a,n)=>{n.d(a,{Zo:()=>p,kt:()=>u});var i=n(7294);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);a&&(i=i.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var a=1;a=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var k=i.createContext({}),A=function(e){var a=i.useContext(k),n=a;return e&&(n="function"==typeof e?e(a):r(r({},a),e)),n},p=function(e){var a=A(e.components);return i.createElement(k.Provider,{value:a},e.children)},s={inlineCode:"code",wrapper:function(e){var a=e.children;return i.createElement(i.Fragment,{},a)}},o=i.forwardRef((function(e,a){var n=e.components,t=e.mdxType,l=e.originalType,k=e.parentName,p=d(e,["components","mdxType","originalType","parentName"]),o=A(n),u=t,m=o["".concat(k,".").concat(u)]||o[u]||s[u]||l;return n?i.createElement(m,r(r({ref:a},p),{},{components:n})):i.createElement(m,r({ref:a},p))}));function u(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var l=n.length,r=new Array(l);r[0]=o;var d={};for(var k in a)hasOwnProperty.call(a,k)&&(d[k]=a[k]);d.originalType=e,d.mdxType="string"==typeof e?e:t,r[1]=d;for(var A=2;A{n.r(a),n.d(a,{assets:()=>k,contentTitle:()=>r,default:()=>s,frontMatter:()=>l,metadata:()=>d,toc:()=>A});var i=n(7462),t=(n(7294),n(3905));const l={sidebar_position:9,title:"A.9. Seleksi Kondisi \u279c if, else if, else",sidebar_label:"A.9. Seleksi Kondisi \u279c if, else if, else"},r=void 0,d={unversionedId:"basic/seleksi-kondisi-if",id:"basic/seleksi-kondisi-if",title:"A.9. Seleksi Kondisi \u279c if, else if, else",description:"Pada chapter ini kita akan bahas tentang penerapan if untuk kontrol alur program.",source:"@site/docs/basic/seleksi-kondisi-if.md",sourceDirName:"basic",slug:"/basic/seleksi-kondisi-if",permalink:"/basic/seleksi-kondisi-if",draft:!1,tags:[],version:"current",sidebarPosition:9,frontMatter:{sidebar_position:9,title:"A.9. Seleksi Kondisi \u279c if, else if, else",sidebar_label:"A.9. Seleksi Kondisi \u279c if, else if, else"},sidebar:"tutorialSidebar",previous:{title:"A.8. Operator",permalink:"/basic/operator"},next:{title:"A.10. Perulangan \u279c while",permalink:"/basic/perulangan-while"}},k={},A=[{value:"A.9.1. Keyword if",id:"a91-keyword-if",level:2},{value:"A.9.2. Keyword if, else if, dan else",id:"a92-keyword-if-else-if-dan-else",level:2},{value:"A.9.3. Nested if",id:"a93-nested-if",level:2},{value:"A.9.4. Returning From if",id:"a94-returning-from-if",level:2},{value:"A.9.5. Kombinasi Keyword let dan if, Dengan Tipe Data Eksplisit",id:"a95-kombinasi-keyword-let-dan-if-dengan-tipe-data-eksplisit",level:2},{value:"A.9.6. Keyword if let",id:"a96-keyword-if-let",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],p={toc:A};function s(e){let{components:a,...l}=e;return(0,t.kt)("wrapper",(0,i.Z)({},p,l,{components:a,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Pada chapter ini kita akan bahas tentang penerapan ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," untuk kontrol alur program."),(0,t.kt)("p",null,"Seleksi kondisi sendiri merupakan teknik untuk grouping blok kode yang eksekusinya tergantung hasil ekspresi seleksi kondisi. Analoginya mirip seperti fungsi rambu lalu lintas di jalan raya. Kapan kendaraan diperbolehkan melaju dan kapan harus berhenti diatur oleh rambu tersebut. Seleksi kondisi pada program juga kurang lebih sama, kapan sebuah blok kode akan dieksekusi dikontrol."),(0,t.kt)("h2",{id:"a91-keyword-if"},"A.9.1. Keyword ",(0,t.kt)("inlineCode",{parentName:"h2"},"if")),(0,t.kt)("p",null,(0,t.kt)("inlineCode",{parentName:"p"},"if")," adalah salah satu keyword untuk seleksi kondisi di Rust, penggunaannya sangat mudah, yaitu dengan cukup tulis keyword tersebut diikuti dengan data boolean (atau ekspresi logika yang hasilnya boolean), lalu diikuti blok kode. Notasi penulisan ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," seperti berikut."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"if operasiLogika {\n // blok kode\n}\n")),(0,t.kt)("p",null,"Pada notasi di atas, ",(0,t.kt)("inlineCode",{parentName:"p"},"operasiLogika")," bisa diisi dengan variabel yang bertipe ",(0,t.kt)("inlineCode",{parentName:"p"},"bool"),", atau statement ekspresi perbandingan seperti ",(0,t.kt)("inlineCode",{parentName:"p"},"a == b"),". Lebih jelasnya sekarang silakan perhatikan dan coba kode berikut."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let number_a = 3;\nif number_a < 5 {\n println!("number_a adalah di bawah 5");\n}\n\nlet result_a = number_a >= 5;\nif result_a {\n println!("result_a adalah di atas atau sama dengan 5");\n}\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"eager",fetchpriority:"high",alt:"seleksi kondisi",src:n(5632).Z,width:"446",height:"110"})),(0,t.kt)("p",null,"Pada kode di atas ada dua buah blok kode ",(0,t.kt)("inlineCode",{parentName:"p"},"if"),". Yang pertama mengecek hasil ekspresi logika ",(0,t.kt)("inlineCode",{parentName:"p"},"apakah variabel number_a di bawah 5?"),". Jika hasilnya benar atau ",(0,t.kt)("inlineCode",{parentName:"p"},"true")," maka blok kode setelahnya yang diapit tanda kurung kurawal akan dieksekusi, hasilnya menampilkan tulisan ",(0,t.kt)("inlineCode",{parentName:"p"},"angka adalah di bawah 5"),"."),(0,t.kt)("p",null,"Blok kode ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," kedua adalah mengecek nilai ",(0,t.kt)("inlineCode",{parentName:"p"},"bool")," variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"result_a"),". Variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"result_a")," sendiri isinya berasal dari ekspresi logika ",(0,t.kt)("inlineCode",{parentName:"p"},"apakah variabel number_a lebih besar atau sama dengan 5?"),". Jika hasilnya ",(0,t.kt)("inlineCode",{parentName:"p"},"true")," maka blok kode setelahnya (yang diapit tanda kurung kurawal) dieksekusi. Namun, pada contoh di atas, hasilnya adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"false"),", karena variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"number_a")," nilainya adalah tidak lebih besar atau sama dengan 5, dengan demikian blok kode tidak dieksekusi."),(0,t.kt)("h2",{id:"a92-keyword-if-else-if-dan-else"},"A.9.2. Keyword ",(0,t.kt)("inlineCode",{parentName:"h2"},"if"),", ",(0,t.kt)("inlineCode",{parentName:"h2"},"else if"),", dan ",(0,t.kt)("inlineCode",{parentName:"h2"},"else")),(0,t.kt)("p",null,"Jika seleksi kondisi lebih dari satu, gunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"else if")," dan/atau ",(0,t.kt)("inlineCode",{parentName:"p"},"else"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let number_b = 3;\nif number_b == 2 {\n println!("number_b adalah 2");\n} else if number_b < 2 {\n println!("number_b adalah di bawah 2");\n} else {\n println!("number_b adalah di atas 2");\n}\n')),(0,t.kt)("p",null,"Pada contoh di atas, ",(0,t.kt)("inlineCode",{parentName:"p"},"number_b")," yang nilainya ",(0,t.kt)("inlineCode",{parentName:"p"},"3"),", match dengan statement seleksi kondisi ",(0,t.kt)("inlineCode",{parentName:"p"},"else"),", dengan ini maka statement dalam blok kode tersebut dieksekusi, text ",(0,t.kt)("inlineCode",{parentName:"p"},"number_b adalah di atas 2")," muncul."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"seleksi kondisi",src:n(3732).Z,width:"447",height:"96"})),(0,t.kt)("p",null,"Silakan bermain dengan nilai variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"number_b")," untuk coba-coba."),(0,t.kt)("h2",{id:"a93-nested-if"},"A.9.3. Nested ",(0,t.kt)("inlineCode",{parentName:"h2"},"if")),(0,t.kt)("p",null,"Sebuah blok kode ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," bisa saja berada di dalam sebuah ",(0,t.kt)("inlineCode",{parentName:"p"},"if"),", dan seperti ini umum terjadi di bahasa pemrograman. Di Rust penerapan nested ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," sama seperti pada bahasa lainnya, yaitu dengan langsung tuliskan saja blok kode ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," ke dalam blok kode ",(0,t.kt)("inlineCode",{parentName:"p"},"if"),". Contoh:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let number_c = 10;\nif number_c > 6 {\n println!("selamat, anda lulus");\n\n if number_c == 10 {\n println!("dengan nilai sempurna");\n } else if number_c > 7 {\n println!("dengan nilai baik");\n } else {\n println!("dengan nilai cukup");\n }\n} else {\n println!("anda tidak lulus");\n\n if number_c < 4 {\n println!("belajar lagi ya");\n } else {\n println!("jangan malas belajar!");\n }\n}\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"nested if",src:n(1669).Z,width:"448",height:"128"})),(0,t.kt)("h2",{id:"a94-returning-from-if"},"A.9.4. Returning From ",(0,t.kt)("inlineCode",{parentName:"h2"},"if")),(0,t.kt)("p",null,(0,t.kt)("em",{parentName:"p"},"Returning from ",(0,t.kt)("inlineCode",{parentName:"em"},"if"))," adalah salah satu cara unik penerapan ",(0,t.kt)("inlineCode",{parentName:"p"},"if"),". Yang biasanya ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," digunakan untuk eksekusi statements dengan kondisi tertentu, pada case ini statement yang ada pada blok kode if ditampung sebagai ",(0,t.kt)("em",{parentName:"p"},"return value")," atau nilai balik. Teknik ini mirip seperti operasi ",(0,t.kt)("em",{parentName:"p"},"ternary")," hanya saja jumlah kondisinya bisa sebanyak yang kita inginkan."),(0,t.kt)("p",null,"Agar lebih jelas, silakan pelajari dulu kode berikut."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let number_d = 3;\nlet result_d: bool;\n\nif number_d == 2 {\n result_d = true\n} else {\n result_d = false\n}\n\nprintln!("result_d adalah {result_d}");\n')),(0,t.kt)("p",null,"Blok seleksi kondisi pada contoh di atas menjadi penentu nilai variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"result_d"),". Dengan kebutuhan tersebut, kita bisa juga memanfaatkan ",(0,t.kt)("inlineCode",{parentName:"p"},"let if")," untuk mendapatkan hasil yang ekuivalen."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Pada kode di atas, deklarasi variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"result_d")," dan pengisian nilainya adalah ditulis dalam statement terpisah. Cara ini diperbolehkan pada variable immutable (tanpa perlu membuatnya mutable) selama operasi assignment hanya dilakukan sekali saja setelah deklarasi."),(0,t.kt)("p",{parentName:"blockquote"},"Lebih detailnya dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/variabel#a45-deklarasi-variabel-tanpa-predefined-value"},"Variabel section A.4.5"),".")),(0,t.kt)("p",null,"Kode di atas jika diubah ke bentuk ",(0,t.kt)("inlineCode",{parentName:"p"},"let if")," hasilnya menjadi seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let number_d = 3;\nlet result_d = if number_d == 2 {\n true\n} else {\n false\n};\nprintln!("result_d adalah {result_d}");\n')),(0,t.kt)("p",null,"Penulisannya cukup unik. Blok kode seleksi kondisi dituliskan sebagai value dari statement ",(0,t.kt)("inlineCode",{parentName:"p"},"let result_d"),". Dan isi blok kode nantinya akan menjadi value untuk variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"result_d"),", tergantung kondisi mana yang match."),(0,t.kt)("p",null,"Pada contoh di atas, karena ",(0,t.kt)("inlineCode",{parentName:"p"},"number_d")," nilainya 3, maka ",(0,t.kt)("inlineCode",{parentName:"p"},"result_d")," bernilai false. Blok kode ",(0,t.kt)("inlineCode",{parentName:"p"},"else")," adalah yang dieksekusi."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"seleksi kondisi",src:n(5146).Z,width:"447",height:"112"})),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Dalam penggunakan kombinasi keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"let")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"if"),", pastikan di akhir blok kode seleksi kondisi dituliskan tanda ",(0,t.kt)("inlineCode",{parentName:"p"},";"),".")),(0,t.kt)("p",null,"O iya, beberapa orang lebih memilih memanfaatkan indentasi untuk mempermudah memahami statement ",(0,t.kt)("inlineCode",{parentName:"p"},"let if"),". Contohnya seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let number_d = 3;\nlet result_d = \n if number_d == 2 {\n true\n } else {\n false\n };\nprintln!("result_d adalah {result_d}");\n')),(0,t.kt)("h2",{id:"a95-kombinasi-keyword-let-dan-if-dengan-tipe-data-eksplisit"},"A.9.5. Kombinasi Keyword ",(0,t.kt)("inlineCode",{parentName:"h2"},"let")," dan ",(0,t.kt)("inlineCode",{parentName:"h2"},"if"),", Dengan Tipe Data Eksplisit"),(0,t.kt)("p",null,"Ada situasi di mana dalam pemanfaatan ",(0,t.kt)("inlineCode",{parentName:"p"},"let if")," kita perlu men-specify secara eksplisit tipe data variabel penampung. Caranya sama seperti statement deklarasi variabel beserta tipe data, langsung tulis saja tipe data yang diinginkan setelah nama variabel dan sebelum operator ",(0,t.kt)("inlineCode",{parentName:"p"},"="),"."),(0,t.kt)("p",null,"Pada contoh berikut, variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"result_e")," saya definisikan tipenya adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"string literal &str"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let number_e = 3;\nlet result_e: &str = if number_e == 2 {\n "angka adalah 2"\n} else if number_e < 2 {\n "angka adalah di bawah 2"\n} else {\n "angka adalah di atas 2"\n};\nprintln!("angka adalah {result_e}");\n')),(0,t.kt)("p",null,"Contoh lain:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let max = 100.0;\nlet string_f = "nilai minimum kelulusan";\nlet result_f: f64 = if string_f == "nilai maksimum kelulusan" {\n max\n} else {\n max * 3.0 / 4.0\n};\nprintln!("angka adalah {result_f}");\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"seleksi kondisi",src:n(3853).Z,width:"450",height:"94"})),(0,t.kt)("h2",{id:"a96-keyword-if-let"},"A.9.6. Keyword ",(0,t.kt)("inlineCode",{parentName:"h2"},"if let")),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"if let")," berbeda dengan kombinasi ",(0,t.kt)("inlineCode",{parentName:"p"},"let")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"if"),". Kita akan bahas topik ini secara terpisah pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/pattern-matching"},"Pattern Matching"),"."),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/seleksi_kondisi_if"},"github.com/novalagung/dasarpemrogramanrust-example/../seleksi_kondisi_if")),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch03-05-control-flow.html"},"https://doc.rust-lang.org/book/ch03-05-control-flow.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.if.html"},"https://doc.rust-lang.org/std/keyword.if.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.else.html"},"https://doc.rust-lang.org/std/keyword.else.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/flow_control/if_else.html"},"https://doc.rust-lang.org/rust-by-example/flow_control/if_else.html"))))}s.isMDXComponent=!0},5632:(e,a,n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GWls28WzwrJ1//UJZmHM84clUJ7Hk2tebIJxaMI6tOLe0uq8zJLNLZ4S6c0Hv+uwNKWHe3EAQZL/Dsqh/q6CeWZwrFOYAoKyqdSlJKbh2/qJcMAsCgPU8pV3R4vLDK4uLhZUzy6+z1km2/tbihVOmpfKFZfXMG9SSztX7XKEwZ+zAM1unYCTKC+cpNynq6rKM+04IckDo6U/azS6tLCYvtu8Izi6tLIolfJISQZB9TU9fBhWTzuXx7BkxYS2dEQRB9is9/oFl98P3+D4kgiD7H/ydegRBkEigUB6CIEgkMI0iCIJEAtMogiBIJEKm0VhsZCTGAQBw7X/1FC4W60OtEeA4LoKfHBeLcUPlD4IgvSak3mir1TT/pbeazcCi3aG3WsP1y8S6rje7b5GuD5k7CIL0HFzUIwiCRALTKIIgSCQwjSIIgkTi/wH4l5+XTFlmAAAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/05cc1716.bb8cde02.js b/assets/js/05cc1716.bb8cde02.js deleted file mode 100644 index 4357bd00..00000000 --- a/assets/js/05cc1716.bb8cde02.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[6477],{3905:(e,a,n)=>{n.d(a,{Zo:()=>p,kt:()=>u});var i=n(7294);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);a&&(i=i.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var a=1;a=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var k=i.createContext({}),A=function(e){var a=i.useContext(k),n=a;return e&&(n="function"==typeof e?e(a):r(r({},a),e)),n},p=function(e){var a=A(e.components);return i.createElement(k.Provider,{value:a},e.children)},s={inlineCode:"code",wrapper:function(e){var a=e.children;return i.createElement(i.Fragment,{},a)}},o=i.forwardRef((function(e,a){var n=e.components,t=e.mdxType,l=e.originalType,k=e.parentName,p=d(e,["components","mdxType","originalType","parentName"]),o=A(n),u=t,m=o["".concat(k,".").concat(u)]||o[u]||s[u]||l;return n?i.createElement(m,r(r({ref:a},p),{},{components:n})):i.createElement(m,r({ref:a},p))}));function u(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var l=n.length,r=new Array(l);r[0]=o;var d={};for(var k in a)hasOwnProperty.call(a,k)&&(d[k]=a[k]);d.originalType=e,d.mdxType="string"==typeof e?e:t,r[1]=d;for(var A=2;A{n.r(a),n.d(a,{assets:()=>k,contentTitle:()=>r,default:()=>s,frontMatter:()=>l,metadata:()=>d,toc:()=>A});var i=n(7462),t=(n(7294),n(3905));const l={sidebar_position:9,title:"A.9. Seleksi Kondisi \u279c if, else if, else",sidebar_label:"A.9. Seleksi Kondisi \u279c if, else if, else"},r=void 0,d={unversionedId:"basic/seleksi-kondisi-if",id:"basic/seleksi-kondisi-if",title:"A.9. Seleksi Kondisi \u279c if, else if, else",description:"Pada chapter ini kita akan bahas tentang penerapan if untuk kontrol alur program.",source:"@site/docs/basic/seleksi-kondisi-if.md",sourceDirName:"basic",slug:"/basic/seleksi-kondisi-if",permalink:"/basic/seleksi-kondisi-if",draft:!1,tags:[],version:"current",sidebarPosition:9,frontMatter:{sidebar_position:9,title:"A.9. Seleksi Kondisi \u279c if, else if, else",sidebar_label:"A.9. Seleksi Kondisi \u279c if, else if, else"},sidebar:"tutorialSidebar",previous:{title:"A.8. Operator",permalink:"/basic/operator"},next:{title:"A.10. Perulangan \u279c while",permalink:"/basic/perulangan-while"}},k={},A=[{value:"A.9.1. Keyword if",id:"a91-keyword-if",level:2},{value:"A.9.2. Keyword if, else if, dan else",id:"a92-keyword-if-else-if-dan-else",level:2},{value:"A.9.3. Nested if",id:"a93-nested-if",level:2},{value:"A.9.4. Returning From if",id:"a94-returning-from-if",level:2},{value:"A.9.5. Kombinasi Keyword let dan if, Dengan Tipe Data Eksplisit",id:"a95-kombinasi-keyword-let-dan-if-dengan-tipe-data-eksplisit",level:2},{value:"A.9.6. Keyword if let",id:"a96-keyword-if-let",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],p={toc:A};function s(e){let{components:a,...l}=e;return(0,t.kt)("wrapper",(0,i.Z)({},p,l,{components:a,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Pada chapter ini kita akan bahas tentang penerapan ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," untuk kontrol alur program."),(0,t.kt)("p",null,"Seleksi kondisi sendiri merupakan teknik untuk grouping blok kode yang eksekusinya tergantung hasil ekspresi seleksi kondisi. Analoginya mirip seperti fungsi rambu lalu lintas di jalan raya. Kapan kendaraan diperbolehkan melaju dan kapan harus berhenti diatur oleh rambu tersebut. Seleksi kondisi pada program juga kurang lebih sama, kapan sebuah blok kode akan dieksekusi dikontrol."),(0,t.kt)("h2",{id:"a91-keyword-if"},"A.9.1. Keyword ",(0,t.kt)("inlineCode",{parentName:"h2"},"if")),(0,t.kt)("p",null,(0,t.kt)("inlineCode",{parentName:"p"},"if")," adalah salah satu keyword untuk seleksi kondisi di Rust, penggunaannya sangat mudah, yaitu dengan cukup tulis keyword tersebut diikuti dengan data boolean (atau ekspresi logika yang hasilnya boolean), lalu diikuti blok kode. Notasi penulisan ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," seperti berikut."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"if operasiLogika {\n // blok kode\n}\n")),(0,t.kt)("p",null,"Pada notasi di atas, ",(0,t.kt)("inlineCode",{parentName:"p"},"operasiLogika")," bisa diisi dengan variabel yang bertipe ",(0,t.kt)("inlineCode",{parentName:"p"},"bool"),", atau statement ekspresi perbandingan seperti ",(0,t.kt)("inlineCode",{parentName:"p"},"a == b"),". Lebih jelasnya sekarang silakan perhatikan dan coba kode berikut."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let number_a = 3;\nif number_a < 5 {\n println!("number_a adalah di bawah 5");\n}\n\nlet result_a = number_a >= 5;\nif result_a {\n println!("result_a adalah di atas atau sama dengan 5");\n}\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"seleksi kondisi",src:n(5632).Z,width:"446",height:"110"})),(0,t.kt)("p",null,"Pada kode di atas ada dua buah blok kode ",(0,t.kt)("inlineCode",{parentName:"p"},"if"),". Yang pertama mengecek hasil ekspresi logika ",(0,t.kt)("inlineCode",{parentName:"p"},"apakah variabel number_a di bawah 5?"),". Jika hasilnya benar atau ",(0,t.kt)("inlineCode",{parentName:"p"},"true")," maka blok kode setelahnya yang diapit tanda kurung kurawal akan dieksekusi, hasilnya menampilkan tulisan ",(0,t.kt)("inlineCode",{parentName:"p"},"angka adalah di bawah 5"),"."),(0,t.kt)("p",null,"Blok kode ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," kedua adalah mengecek nilai ",(0,t.kt)("inlineCode",{parentName:"p"},"bool")," variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"result_a"),". Variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"result_a")," sendiri isinya berasal dari ekspresi logika ",(0,t.kt)("inlineCode",{parentName:"p"},"apakah variabel number_a lebih besar atau sama dengan 5?"),". Jika hasilnya ",(0,t.kt)("inlineCode",{parentName:"p"},"true")," maka blok kode setelahnya (yang diapit tanda kurung kurawal) dieksekusi. Namun, pada contoh di atas, hasilnya adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"false"),", karena variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"number_a")," nilainya adalah tidak lebih besar atau sama dengan 5, dengan demikian blok kode tidak dieksekusi."),(0,t.kt)("h2",{id:"a92-keyword-if-else-if-dan-else"},"A.9.2. Keyword ",(0,t.kt)("inlineCode",{parentName:"h2"},"if"),", ",(0,t.kt)("inlineCode",{parentName:"h2"},"else if"),", dan ",(0,t.kt)("inlineCode",{parentName:"h2"},"else")),(0,t.kt)("p",null,"Jika seleksi kondisi lebih dari satu, gunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"else if")," dan/atau ",(0,t.kt)("inlineCode",{parentName:"p"},"else"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let number_b = 3;\nif number_b == 2 {\n println!("number_b adalah 2");\n} else if number_b < 2 {\n println!("number_b adalah di bawah 2");\n} else {\n println!("number_b adalah di atas 2");\n}\n')),(0,t.kt)("p",null,"Pada contoh di atas, ",(0,t.kt)("inlineCode",{parentName:"p"},"number_b")," yang nilainya ",(0,t.kt)("inlineCode",{parentName:"p"},"3"),", match dengan statement seleksi kondisi ",(0,t.kt)("inlineCode",{parentName:"p"},"else"),", dengan ini maka statement dalam blok kode tersebut dieksekusi, text ",(0,t.kt)("inlineCode",{parentName:"p"},"number_b adalah di atas 2")," muncul."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"seleksi kondisi",src:n(3732).Z,width:"447",height:"96"})),(0,t.kt)("p",null,"Silakan bermain dengan nilai variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"number_b")," untuk coba-coba."),(0,t.kt)("h2",{id:"a93-nested-if"},"A.9.3. Nested ",(0,t.kt)("inlineCode",{parentName:"h2"},"if")),(0,t.kt)("p",null,"Sebuah blok kode ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," bisa saja berada di dalam sebuah ",(0,t.kt)("inlineCode",{parentName:"p"},"if"),", dan seperti ini umum terjadi di bahasa pemrograman. Di Rust penerapan nested ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," sama seperti pada bahasa lainnya, yaitu dengan langsung tuliskan saja blok kode ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," ke dalam blok kode ",(0,t.kt)("inlineCode",{parentName:"p"},"if"),". Contoh:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let number_c = 10;\nif number_c > 6 {\n println!("selamat, anda lulus");\n\n if number_c == 10 {\n println!("dengan nilai sempurna");\n } else if number_c > 7 {\n println!("dengan nilai baik");\n } else {\n println!("dengan nilai cukup");\n }\n} else {\n println!("anda tidak lulus");\n\n if number_c < 4 {\n println!("belajar lagi ya");\n } else {\n println!("jangan malas belajar!");\n }\n}\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"nested if",src:n(1669).Z,width:"448",height:"128"})),(0,t.kt)("h2",{id:"a94-returning-from-if"},"A.9.4. Returning From ",(0,t.kt)("inlineCode",{parentName:"h2"},"if")),(0,t.kt)("p",null,(0,t.kt)("em",{parentName:"p"},"Returning from ",(0,t.kt)("inlineCode",{parentName:"em"},"if"))," adalah salah satu cara unik penerapan ",(0,t.kt)("inlineCode",{parentName:"p"},"if"),". Yang biasanya ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," digunakan untuk eksekusi statements dengan kondisi tertentu, pada case ini statement yang ada pada blok kode if ditampung sebagai ",(0,t.kt)("em",{parentName:"p"},"return value")," atau nilai balik. Teknik ini mirip seperti operasi ",(0,t.kt)("em",{parentName:"p"},"ternary")," hanya saja jumlah kondisinya bisa sebanyak yang kita inginkan."),(0,t.kt)("p",null,"Agar lebih jelas, silakan pelajari dulu kode berikut."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let number_d = 3;\nlet result_d: bool;\n\nif number_d == 2 {\n result_d = true\n} else {\n result_d = false\n}\n\nprintln!("result_d adalah {result_d}");\n')),(0,t.kt)("p",null,"Blok seleksi kondisi pada contoh di atas menjadi penentu nilai variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"result_d"),". Dengan kebutuhan tersebut, kita bisa juga memanfaatkan ",(0,t.kt)("inlineCode",{parentName:"p"},"let if")," untuk mendapatkan hasil yang ekuivalen."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Pada kode di atas, deklarasi variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"result_d")," dan pengisian nilainya adalah ditulis dalam statement terpisah. Cara ini diperbolehkan pada variable immutable (tanpa perlu membuatnya mutable) selama operasi assignment hanya dilakukan sekali saja setelah deklarasi."),(0,t.kt)("p",{parentName:"blockquote"},"Lebih detailnya dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/variabel#a45-deklarasi-variabel-tanpa-predefined-value"},"Variabel section A.4.5"),".")),(0,t.kt)("p",null,"Kode di atas jika diubah ke bentuk ",(0,t.kt)("inlineCode",{parentName:"p"},"let if")," hasilnya menjadi seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let number_d = 3;\nlet result_d = if number_d == 2 {\n true\n} else {\n false\n};\nprintln!("result_d adalah {result_d}");\n')),(0,t.kt)("p",null,"Penulisannya cukup unik. Blok kode seleksi kondisi dituliskan sebagai value dari statement ",(0,t.kt)("inlineCode",{parentName:"p"},"let result_d"),". Dan isi blok kode nantinya akan menjadi value untuk variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"result_d"),", tergantung kondisi mana yang match."),(0,t.kt)("p",null,"Pada contoh di atas, karena ",(0,t.kt)("inlineCode",{parentName:"p"},"number_d")," nilainya 3, maka ",(0,t.kt)("inlineCode",{parentName:"p"},"result_d")," bernilai false. Blok kode ",(0,t.kt)("inlineCode",{parentName:"p"},"else")," adalah yang dieksekusi."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"seleksi kondisi",src:n(5146).Z,width:"447",height:"112"})),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Dalam penggunakan kombinasi keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"let")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"if"),", pastikan di akhir blok kode seleksi kondisi dituliskan tanda ",(0,t.kt)("inlineCode",{parentName:"p"},";"),".")),(0,t.kt)("p",null,"O iya, beberapa orang lebih memilih memanfaatkan indentasi untuk mempermudah memahami statement ",(0,t.kt)("inlineCode",{parentName:"p"},"let if"),". Contohnya seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let number_d = 3;\nlet result_d = \n if number_d == 2 {\n true\n } else {\n false\n };\nprintln!("result_d adalah {result_d}");\n')),(0,t.kt)("h2",{id:"a95-kombinasi-keyword-let-dan-if-dengan-tipe-data-eksplisit"},"A.9.5. Kombinasi Keyword ",(0,t.kt)("inlineCode",{parentName:"h2"},"let")," dan ",(0,t.kt)("inlineCode",{parentName:"h2"},"if"),", Dengan Tipe Data Eksplisit"),(0,t.kt)("p",null,"Ada situasi di mana dalam pemanfaatan ",(0,t.kt)("inlineCode",{parentName:"p"},"let if")," kita perlu men-specify secara eksplisit tipe data variabel penampung. Caranya sama seperti statement deklarasi variabel beserta tipe data, langsung tulis saja tipe data yang diinginkan setelah nama variabel dan sebelum operator ",(0,t.kt)("inlineCode",{parentName:"p"},"="),"."),(0,t.kt)("p",null,"Pada contoh berikut, variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"result_e")," saya definisikan tipenya adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"string literal &str"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let number_e = 3;\nlet result_e: &str = if number_e == 2 {\n "angka adalah 2"\n} else if number_e < 2 {\n "angka adalah di bawah 2"\n} else {\n "angka adalah di atas 2"\n};\nprintln!("angka adalah {result_e}");\n')),(0,t.kt)("p",null,"Contoh lain:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let max = 100.0;\nlet string_f = "nilai minimum kelulusan";\nlet result_f: f64 = if string_f == "nilai maksimum kelulusan" {\n max\n} else {\n max * 3.0 / 4.0\n};\nprintln!("angka adalah {result_f}");\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"seleksi kondisi",src:n(3853).Z,width:"450",height:"94"})),(0,t.kt)("h2",{id:"a96-keyword-if-let"},"A.9.6. Keyword ",(0,t.kt)("inlineCode",{parentName:"h2"},"if let")),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"if let")," berbeda dengan kombinasi ",(0,t.kt)("inlineCode",{parentName:"p"},"let")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"if"),". Kita akan bahas topik ini secara terpisah pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/pattern-matching"},"Pattern Matching"),"."),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/seleksi_kondisi_if"},"github.com/novalagung/dasarpemrogramanrust-example/../seleksi_kondisi_if")),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch03-05-control-flow.html"},"https://doc.rust-lang.org/book/ch03-05-control-flow.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.if.html"},"https://doc.rust-lang.org/std/keyword.if.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.else.html"},"https://doc.rust-lang.org/std/keyword.else.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/flow_control/if_else.html"},"https://doc.rust-lang.org/rust-by-example/flow_control/if_else.html"))))}s.isMD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D43uvm1ua/zhvtRHxfGWls28WzwrJ1//UJZmHM84clUJ7Hk2tebIJxaMI6tOLe0uq8zJLNLZ4S6c0Hv+uwNKWHe3EAQZL/Dsqh/q6CeWZwrFOYAoKyqdSlJKbh2/qJcMAsCgPU8pV3R4vLDK4uLhZUzy6+z1km2/tbihVOmpfKFZfXMG9SSztX7XKEwZ+zAM1unYCTKC+cpNynq6rKM+04IckDo6U/azS6tLCYvtu8Izi6tLIolfJISQZB9TU9fBhWTzuXx7BkxYS2dEQRB9is9/oFl98P3+D4kgiD7H/ydegRBkEigUB6CIEgkMI0iCIJEAtMogiBIJEKm0VhsZCTGAQBw7X/1FC4W60OtEeA4LoKfHBeLcUPlD4IgvSak3mir1TT/pbeazcCi3aG3WsP1y8S6rje7b5GuD5k7CIL0HFzUIwiCRALTKIIgSCQwjSIIgkTi/wH4l5+XTFlmAAAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/0ae704f7.12a11a9d.js b/assets/js/0ae704f7.12a11a9d.js deleted file mode 100644 index 998d058c..00000000 --- a/assets/js/0ae704f7.12a11a9d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[2089],{3905:(e,a,n)=>{n.d(a,{Zo:()=>o,kt:()=>k});var t=n(7294);function r(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function i(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function l(e){for(var a=1;a=0||(r[n]=e[n]);return r}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var m=t.createContext({}),u=function(e){var a=t.useContext(m),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},o=function(e){var a=u(e.components);return t.createElement(m.Provider,{value:a},e.children)},d={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},b=t.forwardRef((function(e,a){var n=e.components,r=e.mdxType,i=e.originalType,m=e.parentName,o=p(e,["components","mdxType","originalType","parentName"]),b=u(n),k=r,s=b["".concat(m,".").concat(k)]||b[k]||d[k]||i;return n?t.createElement(s,l(l({ref:a},o),{},{components:n})):t.createElement(s,l({ref:a},o))}));function k(e,a){var n=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=b;var p={};for(var m in a)hasOwnProperty.call(a,m)&&(p[m]=a[m]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var u=2;u{n.r(a),n.d(a,{assets:()=>m,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var t=n(7462),r=(n(7294),n(3905));const i={sidebar_position:33,title:"A.33. Pointer & References",sidebar_label:"A.33. Pointer & References"},l=void 0,p={unversionedId:"basic/pointer-references",id:"basic/pointer-references",title:"A.33. Pointer & References",description:"Chapter ini membahas tentang apa itu pointer, references, dan dereferences. Pembelajaran dimulai tentang konsep dan praktik dasar tentang ketiga topik tersebut, kemudian diikuti dengan pembahasan tentang karakteristik pointer & reference.",source:"@site/docs/basic/pointer-references.md",sourceDirName:"basic",slug:"/basic/pointer-references",permalink:"/basic/pointer-references",draft:!1,tags:[],version:"current",sidebarPosition:33,frontMatter:{sidebar_position:33,title:"A.33. Pointer & References",sidebar_label:"A.33. Pointer & References"},sidebar:"tutorialSidebar",previous:{title:"A.32. Basic Memory Management",permalink:"/basic/basic-memory-management"},next:{title:"A.34. Ownership",permalink:"/basic/ownership"}},m={},u=[{value:"A.33.1. Pointer",id:"a331-pointer",level:2},{value:"A.33.2. Reference (operator &)",id:"a332-reference-operator-",level:2},{value:"A.33.3. Dereference (operator *)",id:"a333-dereference-operator-",level:2},{value:"A.33.4. Mutable References (operator &mut)",id:"a334-mutable-references-operator-mut",level:2},{value:"A.33.5. Aturan Reference",id:"a335-aturan-reference",level:2},{value:"A.33.6. Karakteristik pointer & reference",id:"a336-karakteristik-pointer--reference",level:2},{value:"\u25c9 Contoh ke-1",id:"-contoh-ke-1",level:3},{value:"\u25c9 Contoh ke-2",id:"-contoh-ke-2",level:3},{value:"A.33.7. Reference & borrowing",id:"a337-reference--borrowing",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],o={toc:u};function d(e){let{components:a,...i}=e;return(0,r.kt)("wrapper",(0,t.Z)({},o,i,{components:a,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Chapter ini membahas tentang apa itu pointer, references, dan dereferences. Pembelajaran dimulai tentang konsep dan praktik dasar tentang ketiga topik tersebut, kemudian diikuti dengan pembahasan tentang karakteristik pointer & reference."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Penulis tekankan bahwa ",(0,r.kt)("strong",{parentName:"p"},"pada chapter ini, konsep reference yang dibahas adalah dalam konteks programming secara general.")," Tidak dari sudut pandang ownership.")),(0,r.kt)("p",null,"Reference pada Rust memiliki keunikan, tapi kita akan bahas itu secara terpisah pada chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/borrowing"},"Borrowing"),". Untuk sekarang silakan ikuti terlebih dahulu pembahasan chapter-per-chapter secara berurutan."),(0,r.kt)("h2",{id:"a331-pointer"},"A.33.1. Pointer"),(0,r.kt)("p",null,"Pointer artinya adalah alamat memori. Variabel pointer artinya adalah variabel yang berisi alamat memory (hanya alamat memory-nya saja, bukan value yang sebenarnya)."),(0,r.kt)("p",null,"Di Rust, variabel pointer ditandai dengan adanya karakter ",(0,r.kt)("inlineCode",{parentName:"p"},"&")," pada tipe data. Sebagai contoh ",(0,r.kt)("inlineCode",{parentName:"p"},"&i32")," artinya adalah tipe data pointer ",(0,r.kt)("inlineCode",{parentName:"p"},"i32"),". Contoh lain adalah ",(0,r.kt)("inlineCode",{parentName:"p"},"&bool")," yang merupakan tipe data pointer ",(0,r.kt)("inlineCode",{parentName:"p"},"bool"),"."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Ada dua jenis tipe pointer di Rust programming, yaitu smart pointer dan raw pointer. Pada chapter ini kita tidak membahasnya karena termasuk topik yang cukup advance. Pembahasan akan ada pada chapter terpisah ",(0,r.kt)("a",{parentName:"p",href:"#/wip/smart-pointer-raw-pointer"},"Smart Pointer vs Raw Pointer"),".")),(0,r.kt)("h2",{id:"a332-reference-operator-"},"A.33.2. Reference (operator ",(0,r.kt)("inlineCode",{parentName:"h2"},"&"),")"),(0,r.kt)("p",null,"Ok, selanjutnya apa itu ",(0,r.kt)("em",{parentName:"p"},"reference"),"? Istilah ini sudah beberapa kali disinggung pada chapter sebelum-sebelumnya."),(0,r.kt)("p",null,"Reference artinya adalah pointer dari sebuah variabel atau data. Operasi pengambilan pointer dari variabel disebut dengan ",(0,r.kt)("em",{parentName:"p"},"referencing"),", caranya dilakukan dengan menggunakan karakter ",(0,r.kt)("inlineCode",{parentName:"p"},"&"),"."),(0,r.kt)("p",null,"O iya, semua jenis variabel bisa diambil nilai pointernya. Contohnya bisa dilihat berikut ini:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'let number: i32 = 24;\nprintln!("value: {:?}", number);\n\nlet pointer_number: &i32 = &number;\nprintln!("pointer: {:p}", pointer_number);\n')),(0,r.kt)("p",null,"Pada contoh di atas, sebuah variabel dideklarasikan bernama ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," dengan tipe data adalah numerik dan value ",(0,r.kt)("inlineCode",{parentName:"p"},"24"),". Variabel tersebut jika di-print akan muncul nilainya, yaitu ",(0,r.kt)("inlineCode",{parentName:"p"},"24"),"."),(0,r.kt)("p",null,"Ada satu lagi variabel yang dideklarasikan yaitu ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number"),", yang nilainya adalah ",(0,r.kt)("em",{parentName:"p"},"reference")," dari variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),". Cara pengambilan reference yang dilihat pada contoh, yaitu dengan menambahkan operator ",(0,r.kt)("inlineCode",{parentName:"p"},"&")," pada variabel yang ingin diambil pointernya."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"// variabel pointer_number nilainya adalah reference variabel number.\n// contoh statement:\nlet pointer_number_1 = &number;\nlet pointer_number_2: &i32 = &number;\n")),(0,r.kt)("p",null,"By default, ketika variabel pointer di print, yang muncul adalah ",(0,r.kt)("em",{parentName:"p"},"underlying value")," atau nilai sebenarnya, yang pada contoh di atas adalah ",(0,r.kt)("inlineCode",{parentName:"p"},"24"),". Untuk menampilkan alamat memory gunakan formatted print ",(0,r.kt)("inlineCode",{parentName:"p"},"{:p}"),"."),(0,r.kt)("p",null,"Coba jalankan program kemudian lihat hasilnya. Value muncul sesuai dengan yang ditulis, sedangkan pointer memunculkan data alamat memory yaitu ",(0,r.kt)("inlineCode",{parentName:"p"},"0xa3bbeff6dc"),"."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"pointer & reference",src:n(1007).Z,width:"494",height:"320"})),(0,r.kt)("p",null,"Seperti yang sudah dijelaskan di awal bahwa variabel pointer isinya adalah alamat memory. Penulisannya dalam notasi heksadesimal diawali dengan karakter ",(0,r.kt)("inlineCode",{parentName:"p"},"0x"),". Contohnya adalah nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"0xa3bbeff6dc")," yang merupakan alamat memory, yang alamat tersebut adalah reference ke pemilik data sebenarnya (yaitu variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),")."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Di environment lokal masing-masing, alamat memory yang muncul sangat mungkin berbeda karena alokasi adalah random")),(0,r.kt)("h2",{id:"a333-dereference-operator-"},"A.33.3. Dereference (operator ",(0,r.kt)("inlineCode",{parentName:"h2"},"*"),")"),(0,r.kt)("p",null,"Kita sudah belajar cara mengambil data pointer dari sebuah variabel. Pada bagian ini kita belajar cara mengambil nilai sebenarnya atau underlying value dari sebuah pointer (istilahnya adalah ",(0,r.kt)("em",{parentName:"p"},"dereference"),")."),(0,r.kt)("p",null,"Cara melakukan operasi ",(0,r.kt)("em",{parentName:"p"},"dereferencing")," adalah dengan menambahkan karakter ",(0,r.kt)("inlineCode",{parentName:"p"},"*")," pada variabel pointer. Contohnya seperti berikut, silakan tambahkan kode ini ke program yang sudah ditulis."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'// variabel underlying_value nilainya adalah nilai sebenarnya dari pointer pointer_number\nlet underlying_value = *pointer_number;\nprintln!("value: {:}", underlying_value);\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Dereference",src:n(6356).Z,width:"467",height:"412"})),(0,r.kt)("p",null,"Bisa dilihat, nilai dari variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"underlying_value")," adalah nilai sebenarnya dari pointer ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number"),", yang pastinya adalah sama dengan nilai variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),"."),(0,r.kt)("h2",{id:"a334-mutable-references-operator-mut"},"A.33.4. Mutable References (operator ",(0,r.kt)("inlineCode",{parentName:"h2"},"&mut"),")"),(0,r.kt)("p",null,"By default, reference sifatnya ",(0,r.kt)("em",{parentName:"p"},"read-only")," atau ",(0,r.kt)("em",{parentName:"p"},"immutable"),", artinya tidak bisa diubah ",(0,r.kt)("em",{parentName:"p"},"underlying-value"),"-nya."),(0,r.kt)("p",null,"Jika ada variabel (sebut saja X) yang merupakan underlying value dari reference variabel lain, maka perubahan value pada variabel X tersebut ",(0,r.kt)("em",{parentName:"p"},"default"),"-nya menghasilkan error."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'let mut number = 24;\nprintln!("number: {}", number);\n\nlet pointer_number = &number;\nprintln!("pointer_number: {:p}", pointer_number);\n\n*pointer_number = 12;\n\nprintln!("*pointer_number: {}", *pointer_number);\nprintln!("number: {}", number);\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Pointer & reference",src:n(8992).Z,width:"715",height:"343"})),(0,r.kt)("p",null,"Pada gambar di atas bisa dilihat, variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number")," merupakan reference dari variabel mutable ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),". Setelahnya ada statement ",(0,r.kt)("inlineCode",{parentName:"p"},"*pointer_number = 12"),", yang artinya adalah underlying value dari variabel pointer ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number")," diakses kemudian di-isi nilainya dengan angka ",(0,r.kt)("inlineCode",{parentName:"p"},"12"),"."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Statement ",(0,r.kt)("inlineCode",{parentName:"p"},"*pointer_number = 12")," tidak menghasilkan error, dan statement ini berbeda dengan ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number = 12"),"."),(0,r.kt)("p",{parentName:"blockquote"},"Statement ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number = 12")," menghasilkan error karena ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number")," adalah variabel bertipe ",(0,r.kt)("strong",{parentName:"p"},"pointer ",(0,r.kt)("inlineCode",{parentName:"strong"},"i32")," atau ",(0,r.kt)("inlineCode",{parentName:"strong"},"&i32")," (bukan ",(0,r.kt)("inlineCode",{parentName:"strong"},"i32"),")"),". Jika ingin mengubah nilainya perlu mengakses dulu underlying value-nya menggunakan ",(0,r.kt)("inlineCode",{parentName:"p"},"*pointer_number"),".")),(0,r.kt)("p",null,"Ok, lalu kenapa muncul error? Di gambar terlihat ada garis merah dan popup pesan error muncul, padahal tidak ada yang salah dengan statement-nya."),(0,r.kt)("p",null,"Penyebab erronya bukan dari statement tersebut, tetapi pada baris statement pengambilan reference variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),". Statement ",(0,r.kt)("inlineCode",{parentName:"p"},"&number")," artinya adalah mengambil reference dari variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),". Di atas sempat kita bahas bahwa ",(0,r.kt)("em",{parentName:"p"},"by default")," sebuah reference tidak bisa diubah nilainya (",(0,r.kt)("em",{parentName:"p"},"immutable"),"), dan ini adalah penyebab error yang dialami."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Silakan perhatikan pesan di popup error message agar mudah untuk tau di mana sumber masalahnya.")),(0,r.kt)("p",null,"Perubahan isi nilai variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," tidak menghasilkan error, hal ini karena number adalah variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," adalah mutable. Sedangkan operasi perubahan nilai variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"*pointer_number")," pada contoh di atas, dianggap sebagai error karena variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number")," reference-nya adalah bukan mutable (meskipun reference diperoleh dari variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," yang notabene mutable)."),(0,r.kt)("p",null,"Solusi dari error di atas adalah menerapkan ",(0,r.kt)("strong",{parentName:"p"},"mutable reference"),". Mutable reference sama seperti reference biasa tetapi nilainya diperbolehkan untuk diubah (mutable). Caranya pengaksesan mutable reference dilakukan menggunakan operator ",(0,r.kt)("inlineCode",{parentName:"p"},"&mut"),"."),(0,r.kt)("p",null,"Ok, sekarang ubah statement berikut ini, lalu jalankan program:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"// before\nlet pointer_number = &number;\n\n// after\nlet pointer_number = &mut number;\n")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Pointer & reference",src:n(5127).Z,width:"488",height:"417"})),(0,r.kt)("p",null,"Deklarasi variable pointer yang menampung mutable reference bisa via metode penulisan ",(0,r.kt)("em",{parentName:"p"},"manifest typing")," atau ",(0,r.kt)("em",{parentName:"p"},"type inference"),". Pada contoh berikut, variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number")," tipe data-nya adalah mutable reference ",(0,r.kt)("inlineCode",{parentName:"p"},"i32"),", maka penulisan tipe data adalah ",(0,r.kt)("inlineCode",{parentName:"p"},"&mut i32"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"// type inference\nlet pointer_number = &mut number;\n\n// manifest typing\nlet pointer_number: &mut i32 = &mut number;\n")),(0,r.kt)("p",null,"Pada contoh ini kita menggunakan tipe data primitif, lalu bagaimana dengan tipe data non-primitive seperti custom type struct atau ",(0,r.kt)("inlineCode",{parentName:"p"},"String"),", apakah penerapan mutable reference juga sama? Jawabannya tidak. Ada beberapa perbedaan dan nantinya kita akan bahas secara detail pada chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/borrowing"},"Borrowing"),". Untuk sekarang, dianjurkan mengikuti pembahasan chapter per chapter secara urut."),(0,r.kt)("h2",{id:"a335-aturan-reference"},"A.33.5. Aturan Reference"),(0,r.kt)("p",null,"Ada dua aturan penting yang harus dipatuhi dalam penerapan reference baik mutable atau immutable reference."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Dalam waktu yang sama, hanya boleh ada satu mutable reference atau banyak immutable reference (keduanya tidak bisa bersamaan, harus salah satu)."),(0,r.kt)("li",{parentName:"ul"},"Reference harus selalu valid.")),(0,r.kt)("p",null,"Mengenai penjelasan tentang dua aturan penting di atas akan bahas pada chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/borrowing"},"Borrowing"),"."),(0,r.kt)("h2",{id:"a336-karakteristik-pointer--reference"},"A.33.6. Karakteristik pointer & reference"),(0,r.kt)("p",null,"Kita sudah belajar tentang definisi beserta cara penerapan pointer, reference, dereference, dan mutable reference. Sekarang lanjut ke pembahasan tentang karakteristik dari pointer & reference."),(0,r.kt)("p",null,"Pointer merupakan variabel yang isinya adalah alamat memory (bukan nilai sebenarnya). Dan reference adalah alamat memory suatu data/variabel. Dengan menerapkan keduanya kita bisa menerapkan efisiensi penggunaan memory yang dampaknya sangat positif terhadap performa program."),(0,r.kt)("p",null,"Sekarang perhatikan statement berikut:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"let number_one = 24;\nlet number_two = number_one;\n")),(0,r.kt)("p",null,"Variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number_one")," adalah data numerik bertipe ",(0,r.kt)("inlineCode",{parentName:"p"},"i32"),", eksekusi statement tersebut menghasilkan alokasi memori selebar 32-bit."),(0,r.kt)("p",null,"Kemudian ada lagi statement ",(0,r.kt)("inlineCode",{parentName:"p"},"number_two"),". Meskipun nilainya didapat dari variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number_one"),", yang terjadi di balik layar adalah Rust akan mengalokasikan lagi alamat memory selebar 32-bit untuk menampung data ",(0,r.kt)("inlineCode",{parentName:"p"},"number_two")," yang didapat dari hasil operasi ",(0,r.kt)("strong",{parentName:"p"},"copy")," dari variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number_one"),"."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Semua variabel primitif di Rust mengadopsi ",(0,r.kt)("em",{parentName:"p"},"copy semantics"),", yang artinya jika variabel tersebut digunakan dalam statement assignment, maka nilai akan di-duplikasi untuk kemudian ditampung pada variabel baru."),(0,r.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai ",(0,r.kt)("em",{parentName:"p"},"copy semantics")," dibahas pada chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/ownership#a334-copy-semantics-vs-move-semantics"},"Ownership"),".")),(0,r.kt)("p",null,"Selanjutnya, bandingkan dengan statement berikut:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"let number_one = 24;\nlet number_two = &number_one;\n")),(0,r.kt)("p",null,"Pada contoh di atas, variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number_one")," datanya disimpan di memory dengan lebar 32-bit (masih sama seperti contoh sebelumnya). Namun ada yang berbeda dengan dengan variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number_two"),", variabel ini adalah variabel pointer yang nilainya reference ke alamat memory data variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number_one"),". Yang terjadi di belakang layar, Rust tidak mengalokasikan lagi memory selebar 32-bit untuk menampung data ",(0,r.kt)("inlineCode",{parentName:"p"},"number_two"),", melainkan menggunakan alamat memory data ",(0,r.kt)("inlineCode",{parentName:"p"},"number_one")," sebagai reference, menjadikannya sebagai alamat tujuan variabel pointer ",(0,r.kt)("inlineCode",{parentName:"p"},"number_two"),"."),(0,r.kt)("p",null,"Ok, lanjut. Per sekarang, reference variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number_one")," dan ",(0,r.kt)("inlineCode",{parentName:"p"},"number_two")," adalah sama. Dengan ini, jika dicontohkan isi data satu variabel diubah, maka variabel lainnya juga akan berubah, hal karena reference-nya adalah sama."),(0,r.kt)("h3",{id:"-contoh-ke-1"},"\u25c9 Contoh ke-1"),(0,r.kt)("p",null,"Contoh penerapannya bisa kita lihat pada chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/pointer-references#a315-karakteristik-pointer--reference"},"Pointer & References")," ini, di situ bisa dilihat ada variabel mutable ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," dan ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number")," yang reference-nya adalah sama dengan variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),". Ketika underlying value ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number")," diubah (dari ",(0,r.kt)("inlineCode",{parentName:"p"},"24")," ke ",(0,r.kt)("inlineCode",{parentName:"p"},"12"),"), isi data variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," juga berubah."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Pointer & reference",src:n(5127).Z,width:"488",height:"417"})),(0,r.kt)("h3",{id:"-contoh-ke-2"},"\u25c9 Contoh ke-2"),(0,r.kt)("p",null,"Agar makin familiar dengan cara penerapan pointer & reference, silakan lanjut dengan praktik program berikut:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2514\u2500\u2500\u2500 main.rs\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="Cargo.toml"',title:'"Cargo.toml"'},'# ...\n\n[dependencies]\nrand = "0.8.5"\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="main.rs"',title:'"main.rs"'},'use rand::Rng;\n\nfn main() {\n let mut number = 24;\n println!("number: {}", number);\n\n for _ in 0..=5 {\n change_value(&mut number);\n println!("number: {}", number);\n }\n}\n\nfn change_value(n: &mut i32) {\n *n = generate_random_number()\n}\n\nfn generate_random_number() -> i32 {\n rand::thread_rng().gen_range(0..100)\n}\n')),(0,r.kt)("p",null,"Pada sederhana di atas, ada sebuah variable mutable bernama ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," yang dideklarasikan. Variabel tersebut kemudian diakses ",(0,r.kt)("em",{parentName:"p"},"mutable reference"),"-nya untuk dijadikan argumen statement pemanggilan fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"change_value"),"."),(0,r.kt)("p",null,"Di dalam fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"change_value"),", disiapkan 1 buah angka random hasil pemanggilan fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"generate_random_number"),", yang angka tersebut kemudian dijadikan sebagai nilai baru variable mutable reference yang mengarah ke ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),". Perubahan dalam fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"change_value")," akan mempengaruhi data variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),", karena reference-nya adalah sama."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Pointer & reference",src:n(3319).Z,width:"457",height:"204"})),(0,r.kt)("h2",{id:"a337-reference--borrowing"},"A.33.7. Reference & borrowing"),(0,r.kt)("p",null,"Di Rust, reference (atau pengaksesan alamat memory suatu data) memiliki hubungan yang sangat erat dengan konsep ",(0,r.kt)("strong",{parentName:"p"},"borrowing"),"."),(0,r.kt)("p",null,"Ketika kita mengambil reference suatu data, yang terjadi sebenarnya adalah kita meminjam data tersebut dari owner/pemilik sebenarnya."),(0,r.kt)("p",null,"Pada chapter ini kita tidak akan membahasnya lebih jauh lagi, karena akan ada chapter lain yang fokus mengulas topik tersebut secara detail, yaitu chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/borrowing"},"Borrowing"),"."),(0,r.kt)("p",null,"Untuk sekarang penulis anjurkan untuk lanjut ke chapter berikutnya secara urut."),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,r.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,r.kt)("pre",null,(0,r.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/pointer_references"},"github.com/novalagung/dasarpemrogramanrust-example/../pointer_references")),(0,r.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html"},"https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/marker/trait.Copy.html"},"https://doc.rust-lang.org/std/marker/trait.Copy.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://en.wikipedia.org/wiki/Reference_(computer_science)"},"https://en.wikipedia.org/wiki/Reference_(computer_science)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://progressivecoder.com/understanding-rust-ownership-and-borrowing-with-examples/"},"https://progressivecoder.com/understanding-rust-ownership-and-borrowing-with-examples/")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://os.phil-opp.com/heap-allocation/"},"https://os.phil-opp.com/heap-allocation/"))))}d.isMDXComponent=!0},1007:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/pointer-references-1-f103aebf5517db2d9de53c1fe39be319.png"},6356:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/pointer-references-2-8fdb7f20f15717b7d97311d81ffe005d.png"},8992:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/pointer-references-3-7b60c4bdc0392eb962187ee76ac2ab54.png"},5127:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/pointer-references-4-ba178a14defb70eb04b45ce050af0e6e.png"},3319:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAADMCAIAAACX588hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk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CgCAtgIAANoKAIC2AgCgrQAAcDVt5WMoAEBbj6ytg49h+J2B3AgAgLbOyzP7CqtgNAAAsLu2HsUbOwlhcxldxQoGAGA1bT2SNzbSCgCH0daDeGOPsXCwp9wIAHBL2rq9N3YSC9c2AgDcRty6sTd2IeplOhgAHEBb2/TGHocefng2AgA0pK2te2OHas78VgBoUFsBAABtBQBAWwEA0FYAAEBbAQDQVgAAtBUAAK6mrXwMBQBo67G1VRhhJ9YFqDwAoK3zMxq+b+3dZ2lmAGhNW4/ijR19MTucH9oKAM1q6zG8scdEgRUM2goA7WrrQbyxB3mOA1hGWwHgxrV1S2/sUZo7hZXe2MgrANxo3LqRN3ayqoAya2U6GAAcQFvb8saODxkNLxC2AsBBtLVBb+x4euv5QGEuvNMCgIa0FQAA0FYAALQVAABtBQAAtBUAAG0FAEBbAQDgatrKx1AAgLYeXlullYD2FwAAQFuduto5yIYyKjcCAFxbW4/jjT1YFYTGr2IjAEAT2noMb+xTcrjaRgCAK2vrYbyx0VYAeInauqU3NtoKAC84bt3IGxttBYDb0Na2vLHRVgA4vrY26I2dDTRcZinkgw8AAFfXVgAAQFsBANBWAAC0FQAA0FYAALQVAABtBQAAtBUAAG0FAEBbAQAg4v9FZVTogLiptQAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/0ae704f7.d05f7990.js b/assets/js/0ae704f7.d05f7990.js new file mode 100644 index 00000000..fd91e38b --- /dev/null +++ b/assets/js/0ae704f7.d05f7990.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[2089],{3905:(e,a,n)=>{n.d(a,{Zo:()=>o,kt:()=>k});var t=n(7294);function r(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function i(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function l(e){for(var a=1;a=0||(r[n]=e[n]);return r}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var m=t.createContext({}),u=function(e){var a=t.useContext(m),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},o=function(e){var a=u(e.components);return t.createElement(m.Provider,{value:a},e.children)},d={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},b=t.forwardRef((function(e,a){var n=e.components,r=e.mdxType,i=e.originalType,m=e.parentName,o=p(e,["components","mdxType","originalType","parentName"]),b=u(n),k=r,s=b["".concat(m,".").concat(k)]||b[k]||d[k]||i;return n?t.createElement(s,l(l({ref:a},o),{},{components:n})):t.createElement(s,l({ref:a},o))}));function k(e,a){var n=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=b;var p={};for(var m in a)hasOwnProperty.call(a,m)&&(p[m]=a[m]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var u=2;u{n.r(a),n.d(a,{assets:()=>m,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var t=n(7462),r=(n(7294),n(3905));const i={sidebar_position:33,title:"A.33. Pointer & References",sidebar_label:"A.33. Pointer & References"},l=void 0,p={unversionedId:"basic/pointer-references",id:"basic/pointer-references",title:"A.33. Pointer & References",description:"Chapter ini membahas tentang apa itu pointer, references, dan dereferences. Pembelajaran dimulai tentang konsep dan praktik dasar tentang ketiga topik tersebut, kemudian diikuti dengan pembahasan tentang karakteristik pointer & reference.",source:"@site/docs/basic/pointer-references.md",sourceDirName:"basic",slug:"/basic/pointer-references",permalink:"/basic/pointer-references",draft:!1,tags:[],version:"current",sidebarPosition:33,frontMatter:{sidebar_position:33,title:"A.33. Pointer & References",sidebar_label:"A.33. Pointer & References"},sidebar:"tutorialSidebar",previous:{title:"A.32. Basic Memory Management",permalink:"/basic/basic-memory-management"},next:{title:"A.34. Ownership",permalink:"/basic/ownership"}},m={},u=[{value:"A.33.1. Pointer",id:"a331-pointer",level:2},{value:"A.33.2. Reference (operator &)",id:"a332-reference-operator-",level:2},{value:"A.33.3. Dereference (operator *)",id:"a333-dereference-operator-",level:2},{value:"A.33.4. Mutable References (operator &mut)",id:"a334-mutable-references-operator-mut",level:2},{value:"A.33.5. Aturan Reference",id:"a335-aturan-reference",level:2},{value:"A.33.6. Karakteristik pointer & reference",id:"a336-karakteristik-pointer--reference",level:2},{value:"\u25c9 Contoh ke-1",id:"-contoh-ke-1",level:3},{value:"\u25c9 Contoh ke-2",id:"-contoh-ke-2",level:3},{value:"A.33.7. Reference & borrowing",id:"a337-reference--borrowing",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],o={toc:u};function d(e){let{components:a,...i}=e;return(0,r.kt)("wrapper",(0,t.Z)({},o,i,{components:a,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Chapter ini membahas tentang apa itu pointer, references, dan dereferences. Pembelajaran dimulai tentang konsep dan praktik dasar tentang ketiga topik tersebut, kemudian diikuti dengan pembahasan tentang karakteristik pointer & reference."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Penulis tekankan bahwa ",(0,r.kt)("strong",{parentName:"p"},"pada chapter ini, konsep reference yang dibahas adalah dalam konteks programming secara general.")," Tidak dari sudut pandang ownership.")),(0,r.kt)("p",null,"Reference pada Rust memiliki keunikan, tapi kita akan bahas itu secara terpisah pada chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/borrowing"},"Borrowing"),". Untuk sekarang silakan ikuti terlebih dahulu pembahasan chapter-per-chapter secara berurutan."),(0,r.kt)("h2",{id:"a331-pointer"},"A.33.1. Pointer"),(0,r.kt)("p",null,"Pointer artinya adalah alamat memori. Variabel pointer artinya adalah variabel yang berisi alamat memory (hanya alamat memory-nya saja, bukan value yang sebenarnya)."),(0,r.kt)("p",null,"Di Rust, variabel pointer ditandai dengan adanya karakter ",(0,r.kt)("inlineCode",{parentName:"p"},"&")," pada tipe data. Sebagai contoh ",(0,r.kt)("inlineCode",{parentName:"p"},"&i32")," artinya adalah tipe data pointer ",(0,r.kt)("inlineCode",{parentName:"p"},"i32"),". Contoh lain adalah ",(0,r.kt)("inlineCode",{parentName:"p"},"&bool")," yang merupakan tipe data pointer ",(0,r.kt)("inlineCode",{parentName:"p"},"bool"),"."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Ada dua jenis tipe pointer di Rust programming, yaitu smart pointer dan raw pointer. Pada chapter ini kita tidak membahasnya karena termasuk topik yang cukup advance. Pembahasan akan ada pada chapter terpisah ",(0,r.kt)("a",{parentName:"p",href:"#/wip/smart-pointer-raw-pointer"},"Smart Pointer vs Raw Pointer"),".")),(0,r.kt)("h2",{id:"a332-reference-operator-"},"A.33.2. Reference (operator ",(0,r.kt)("inlineCode",{parentName:"h2"},"&"),")"),(0,r.kt)("p",null,"Ok, selanjutnya apa itu ",(0,r.kt)("em",{parentName:"p"},"reference"),"? Istilah ini sudah beberapa kali disinggung pada chapter sebelum-sebelumnya."),(0,r.kt)("p",null,"Reference artinya adalah pointer dari sebuah variabel atau data. Operasi pengambilan pointer dari variabel disebut dengan ",(0,r.kt)("em",{parentName:"p"},"referencing"),", caranya dilakukan dengan menggunakan karakter ",(0,r.kt)("inlineCode",{parentName:"p"},"&"),"."),(0,r.kt)("p",null,"O iya, semua jenis variabel bisa diambil nilai pointernya. Contohnya bisa dilihat berikut ini:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'let number: i32 = 24;\nprintln!("value: {:?}", number);\n\nlet pointer_number: &i32 = &number;\nprintln!("pointer: {:p}", pointer_number);\n')),(0,r.kt)("p",null,"Pada contoh di atas, sebuah variabel dideklarasikan bernama ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," dengan tipe data adalah numerik dan value ",(0,r.kt)("inlineCode",{parentName:"p"},"24"),". Variabel tersebut jika di-print akan muncul nilainya, yaitu ",(0,r.kt)("inlineCode",{parentName:"p"},"24"),"."),(0,r.kt)("p",null,"Ada satu lagi variabel yang dideklarasikan yaitu ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number"),", yang nilainya adalah ",(0,r.kt)("em",{parentName:"p"},"reference")," dari variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),". Cara pengambilan reference yang dilihat pada contoh, yaitu dengan menambahkan operator ",(0,r.kt)("inlineCode",{parentName:"p"},"&")," pada variabel yang ingin diambil pointernya."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"// variabel pointer_number nilainya adalah reference variabel number.\n// contoh statement:\nlet pointer_number_1 = &number;\nlet pointer_number_2: &i32 = &number;\n")),(0,r.kt)("p",null,"By default, ketika variabel pointer di print, yang muncul adalah ",(0,r.kt)("em",{parentName:"p"},"underlying value")," atau nilai sebenarnya, yang pada contoh di atas adalah ",(0,r.kt)("inlineCode",{parentName:"p"},"24"),". Untuk menampilkan alamat memory gunakan formatted print ",(0,r.kt)("inlineCode",{parentName:"p"},"{:p}"),"."),(0,r.kt)("p",null,"Coba jalankan program kemudian lihat hasilnya. Value muncul sesuai dengan yang ditulis, sedangkan pointer memunculkan data alamat memory yaitu ",(0,r.kt)("inlineCode",{parentName:"p"},"0xa3bbeff6dc"),"."),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"eager",fetchpriority:"high",alt:"pointer & reference",src:n(1007).Z,width:"494",height:"320"})),(0,r.kt)("p",null,"Seperti yang sudah dijelaskan di awal bahwa variabel pointer isinya adalah alamat memory. Penulisannya dalam notasi heksadesimal diawali dengan karakter ",(0,r.kt)("inlineCode",{parentName:"p"},"0x"),". Contohnya adalah nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"0xa3bbeff6dc")," yang merupakan alamat memory, yang alamat tersebut adalah reference ke pemilik data sebenarnya (yaitu variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),")."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Di environment lokal masing-masing, alamat memory yang muncul sangat mungkin berbeda karena alokasi adalah random")),(0,r.kt)("h2",{id:"a333-dereference-operator-"},"A.33.3. Dereference (operator ",(0,r.kt)("inlineCode",{parentName:"h2"},"*"),")"),(0,r.kt)("p",null,"Kita sudah belajar cara mengambil data pointer dari sebuah variabel. Pada bagian ini kita belajar cara mengambil nilai sebenarnya atau underlying value dari sebuah pointer (istilahnya adalah ",(0,r.kt)("em",{parentName:"p"},"dereference"),")."),(0,r.kt)("p",null,"Cara melakukan operasi ",(0,r.kt)("em",{parentName:"p"},"dereferencing")," adalah dengan menambahkan karakter ",(0,r.kt)("inlineCode",{parentName:"p"},"*")," pada variabel pointer. Contohnya seperti berikut, silakan tambahkan kode ini ke program yang sudah ditulis."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'// variabel underlying_value nilainya adalah nilai sebenarnya dari pointer pointer_number\nlet underlying_value = *pointer_number;\nprintln!("value: {:}", underlying_value);\n')),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"lazy",alt:"Dereference",src:n(6356).Z,width:"467",height:"412"})),(0,r.kt)("p",null,"Bisa dilihat, nilai dari variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"underlying_value")," adalah nilai sebenarnya dari pointer ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number"),", yang pastinya adalah sama dengan nilai variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),"."),(0,r.kt)("h2",{id:"a334-mutable-references-operator-mut"},"A.33.4. Mutable References (operator ",(0,r.kt)("inlineCode",{parentName:"h2"},"&mut"),")"),(0,r.kt)("p",null,"By default, reference sifatnya ",(0,r.kt)("em",{parentName:"p"},"read-only")," atau ",(0,r.kt)("em",{parentName:"p"},"immutable"),", artinya tidak bisa diubah ",(0,r.kt)("em",{parentName:"p"},"underlying-value"),"-nya."),(0,r.kt)("p",null,"Jika ada variabel (sebut saja X) yang merupakan underlying value dari reference variabel lain, maka perubahan value pada variabel X tersebut ",(0,r.kt)("em",{parentName:"p"},"default"),"-nya menghasilkan error."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'let mut number = 24;\nprintln!("number: {}", number);\n\nlet pointer_number = &number;\nprintln!("pointer_number: {:p}", pointer_number);\n\n*pointer_number = 12;\n\nprintln!("*pointer_number: {}", *pointer_number);\nprintln!("number: {}", number);\n')),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"lazy",alt:"Pointer & reference",src:n(8992).Z,width:"715",height:"343"})),(0,r.kt)("p",null,"Pada gambar di atas bisa dilihat, variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number")," merupakan reference dari variabel mutable ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),". Setelahnya ada statement ",(0,r.kt)("inlineCode",{parentName:"p"},"*pointer_number = 12"),", yang artinya adalah underlying value dari variabel pointer ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number")," diakses kemudian di-isi nilainya dengan angka ",(0,r.kt)("inlineCode",{parentName:"p"},"12"),"."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Statement ",(0,r.kt)("inlineCode",{parentName:"p"},"*pointer_number = 12")," tidak menghasilkan error, dan statement ini berbeda dengan ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number = 12"),"."),(0,r.kt)("p",{parentName:"blockquote"},"Statement ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number = 12")," menghasilkan error karena ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number")," adalah variabel bertipe ",(0,r.kt)("strong",{parentName:"p"},"pointer ",(0,r.kt)("inlineCode",{parentName:"strong"},"i32")," atau ",(0,r.kt)("inlineCode",{parentName:"strong"},"&i32")," (bukan ",(0,r.kt)("inlineCode",{parentName:"strong"},"i32"),")"),". Jika ingin mengubah nilainya perlu mengakses dulu underlying value-nya menggunakan ",(0,r.kt)("inlineCode",{parentName:"p"},"*pointer_number"),".")),(0,r.kt)("p",null,"Ok, lalu kenapa muncul error? Di gambar terlihat ada garis merah dan popup pesan error muncul, padahal tidak ada yang salah dengan statement-nya."),(0,r.kt)("p",null,"Penyebab erronya bukan dari statement tersebut, tetapi pada baris statement pengambilan reference variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),". Statement ",(0,r.kt)("inlineCode",{parentName:"p"},"&number")," artinya adalah mengambil reference dari variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),". Di atas sempat kita bahas bahwa ",(0,r.kt)("em",{parentName:"p"},"by default")," sebuah reference tidak bisa diubah nilainya (",(0,r.kt)("em",{parentName:"p"},"immutable"),"), dan ini adalah penyebab error yang dialami."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Silakan perhatikan pesan di popup error message agar mudah untuk tau di mana sumber masalahnya.")),(0,r.kt)("p",null,"Perubahan isi nilai variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," tidak menghasilkan error, hal ini karena number adalah variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," adalah mutable. Sedangkan operasi perubahan nilai variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"*pointer_number")," pada contoh di atas, dianggap sebagai error karena variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number")," reference-nya adalah bukan mutable (meskipun reference diperoleh dari variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," yang notabene mutable)."),(0,r.kt)("p",null,"Solusi dari error di atas adalah menerapkan ",(0,r.kt)("strong",{parentName:"p"},"mutable reference"),". Mutable reference sama seperti reference biasa tetapi nilainya diperbolehkan untuk diubah (mutable). Caranya pengaksesan mutable reference dilakukan menggunakan operator ",(0,r.kt)("inlineCode",{parentName:"p"},"&mut"),"."),(0,r.kt)("p",null,"Ok, sekarang ubah statement berikut ini, lalu jalankan program:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"// before\nlet pointer_number = &number;\n\n// after\nlet pointer_number = &mut number;\n")),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"lazy",alt:"Pointer & reference",src:n(5127).Z,width:"488",height:"417"})),(0,r.kt)("p",null,"Deklarasi variable pointer yang menampung mutable reference bisa via metode penulisan ",(0,r.kt)("em",{parentName:"p"},"manifest typing")," atau ",(0,r.kt)("em",{parentName:"p"},"type inference"),". Pada contoh berikut, variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number")," tipe data-nya adalah mutable reference ",(0,r.kt)("inlineCode",{parentName:"p"},"i32"),", maka penulisan tipe data adalah ",(0,r.kt)("inlineCode",{parentName:"p"},"&mut i32"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"// type inference\nlet pointer_number = &mut number;\n\n// manifest typing\nlet pointer_number: &mut i32 = &mut number;\n")),(0,r.kt)("p",null,"Pada contoh ini kita menggunakan tipe data primitif, lalu bagaimana dengan tipe data non-primitive seperti custom type struct atau ",(0,r.kt)("inlineCode",{parentName:"p"},"String"),", apakah penerapan mutable reference juga sama? Jawabannya tidak. Ada beberapa perbedaan dan nantinya kita akan bahas secara detail pada chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/borrowing"},"Borrowing"),". Untuk sekarang, dianjurkan mengikuti pembahasan chapter per chapter secara urut."),(0,r.kt)("h2",{id:"a335-aturan-reference"},"A.33.5. Aturan Reference"),(0,r.kt)("p",null,"Ada dua aturan penting yang harus dipatuhi dalam penerapan reference baik mutable atau immutable reference."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Dalam waktu yang sama, hanya boleh ada satu mutable reference atau banyak immutable reference (keduanya tidak bisa bersamaan, harus salah satu)."),(0,r.kt)("li",{parentName:"ul"},"Reference harus selalu valid.")),(0,r.kt)("p",null,"Mengenai penjelasan tentang dua aturan penting di atas akan bahas pada chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/borrowing"},"Borrowing"),"."),(0,r.kt)("h2",{id:"a336-karakteristik-pointer--reference"},"A.33.6. Karakteristik pointer & reference"),(0,r.kt)("p",null,"Kita sudah belajar tentang definisi beserta cara penerapan pointer, reference, dereference, dan mutable reference. Sekarang lanjut ke pembahasan tentang karakteristik dari pointer & reference."),(0,r.kt)("p",null,"Pointer merupakan variabel yang isinya adalah alamat memory (bukan nilai sebenarnya). Dan reference adalah alamat memory suatu data/variabel. Dengan menerapkan keduanya kita bisa menerapkan efisiensi penggunaan memory yang dampaknya sangat positif terhadap performa program."),(0,r.kt)("p",null,"Sekarang perhatikan statement berikut:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"let number_one = 24;\nlet number_two = number_one;\n")),(0,r.kt)("p",null,"Variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number_one")," adalah data numerik bertipe ",(0,r.kt)("inlineCode",{parentName:"p"},"i32"),", eksekusi statement tersebut menghasilkan alokasi memori selebar 32-bit."),(0,r.kt)("p",null,"Kemudian ada lagi statement ",(0,r.kt)("inlineCode",{parentName:"p"},"number_two"),". Meskipun nilainya didapat dari variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number_one"),", yang terjadi di balik layar adalah Rust akan mengalokasikan lagi alamat memory selebar 32-bit untuk menampung data ",(0,r.kt)("inlineCode",{parentName:"p"},"number_two")," yang didapat dari hasil operasi ",(0,r.kt)("strong",{parentName:"p"},"copy")," dari variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number_one"),"."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Semua variabel primitif di Rust mengadopsi ",(0,r.kt)("em",{parentName:"p"},"copy semantics"),", yang artinya jika variabel tersebut digunakan dalam statement assignment, maka nilai akan di-duplikasi untuk kemudian ditampung pada variabel baru."),(0,r.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai ",(0,r.kt)("em",{parentName:"p"},"copy semantics")," dibahas pada chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/ownership#a334-copy-semantics-vs-move-semantics"},"Ownership"),".")),(0,r.kt)("p",null,"Selanjutnya, bandingkan dengan statement berikut:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"let number_one = 24;\nlet number_two = &number_one;\n")),(0,r.kt)("p",null,"Pada contoh di atas, variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number_one")," datanya disimpan di memory dengan lebar 32-bit (masih sama seperti contoh sebelumnya). Namun ada yang berbeda dengan dengan variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number_two"),", variabel ini adalah variabel pointer yang nilainya reference ke alamat memory data variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number_one"),". Yang terjadi di belakang layar, Rust tidak mengalokasikan lagi memory selebar 32-bit untuk menampung data ",(0,r.kt)("inlineCode",{parentName:"p"},"number_two"),", melainkan menggunakan alamat memory data ",(0,r.kt)("inlineCode",{parentName:"p"},"number_one")," sebagai reference, menjadikannya sebagai alamat tujuan variabel pointer ",(0,r.kt)("inlineCode",{parentName:"p"},"number_two"),"."),(0,r.kt)("p",null,"Ok, lanjut. Per sekarang, reference variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number_one")," dan ",(0,r.kt)("inlineCode",{parentName:"p"},"number_two")," adalah sama. Dengan ini, jika dicontohkan isi data satu variabel diubah, maka variabel lainnya juga akan berubah, hal karena reference-nya adalah sama."),(0,r.kt)("h3",{id:"-contoh-ke-1"},"\u25c9 Contoh ke-1"),(0,r.kt)("p",null,"Contoh penerapannya bisa kita lihat pada chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/pointer-references#a315-karakteristik-pointer--reference"},"Pointer & References")," ini, di situ bisa dilihat ada variabel mutable ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," dan ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number")," yang reference-nya adalah sama dengan variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),". Ketika underlying value ",(0,r.kt)("inlineCode",{parentName:"p"},"pointer_number")," diubah (dari ",(0,r.kt)("inlineCode",{parentName:"p"},"24")," ke ",(0,r.kt)("inlineCode",{parentName:"p"},"12"),"), isi data variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," juga berubah."),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"lazy",alt:"Pointer & reference",src:n(5127).Z,width:"488",height:"417"})),(0,r.kt)("h3",{id:"-contoh-ke-2"},"\u25c9 Contoh ke-2"),(0,r.kt)("p",null,"Agar makin familiar dengan cara penerapan pointer & reference, silakan lanjut dengan praktik program berikut:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2514\u2500\u2500\u2500 main.rs\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="Cargo.toml"',title:'"Cargo.toml"'},'# ...\n\n[dependencies]\nrand = "0.8.5"\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="main.rs"',title:'"main.rs"'},'use rand::Rng;\n\nfn main() {\n let mut number = 24;\n println!("number: {}", number);\n\n for _ in 0..=5 {\n change_value(&mut number);\n println!("number: {}", number);\n }\n}\n\nfn change_value(n: &mut i32) {\n *n = generate_random_number()\n}\n\nfn generate_random_number() -> i32 {\n rand::thread_rng().gen_range(0..100)\n}\n')),(0,r.kt)("p",null,"Pada sederhana di atas, ada sebuah variable mutable bernama ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," yang dideklarasikan. Variabel tersebut kemudian diakses ",(0,r.kt)("em",{parentName:"p"},"mutable reference"),"-nya untuk dijadikan argumen statement pemanggilan fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"change_value"),"."),(0,r.kt)("p",null,"Di dalam fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"change_value"),", disiapkan 1 buah angka random hasil pemanggilan fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"generate_random_number"),", yang angka tersebut kemudian dijadikan sebagai nilai baru variable mutable reference yang mengarah ke ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),". Perubahan dalam fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"change_value")," akan mempengaruhi data variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),", karena reference-nya adalah sama."),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"lazy",alt:"Pointer & reference",src:n(3319).Z,width:"457",height:"204"})),(0,r.kt)("h2",{id:"a337-reference--borrowing"},"A.33.7. Reference & borrowing"),(0,r.kt)("p",null,"Di Rust, reference (atau pengaksesan alamat memory suatu data) memiliki hubungan yang sangat erat dengan konsep ",(0,r.kt)("strong",{parentName:"p"},"borrowing"),"."),(0,r.kt)("p",null,"Ketika kita mengambil reference suatu data, yang terjadi sebenarnya adalah kita meminjam data tersebut dari owner/pemilik sebenarnya."),(0,r.kt)("p",null,"Pada chapter ini kita tidak akan membahasnya lebih jauh lagi, karena akan ada chapter lain yang fokus mengulas topik tersebut secara detail, yaitu chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/borrowing"},"Borrowing"),"."),(0,r.kt)("p",null,"Untuk sekarang penulis anjurkan untuk lanjut ke chapter berikutnya secara urut."),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,r.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,r.kt)("pre",null,(0,r.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/pointer_references"},"github.com/novalagung/dasarpemrogramanrust-example/../pointer_references")),(0,r.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html"},"https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/marker/trait.Copy.html"},"https://doc.rust-lang.org/std/marker/trait.Copy.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://en.wikipedia.org/wiki/Reference_(computer_science)"},"https://en.wikipedia.org/wiki/Reference_(computer_science)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://progressivecoder.com/understanding-rust-ownership-and-borrowing-with-examples/"},"https://progressivecoder.com/understanding-rust-ownership-and-borrowing-with-examples/")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://os.phil-opp.com/heap-allocation/"},"https://os.phil-opp.com/heap-allocation/"))))}d.isMDXComponent=!0},1007:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/pointer-references-1-f103aebf5517db2d9de53c1fe39be319.png"},6356:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/pointer-references-2-8fdb7f20f15717b7d97311d81ffe005d.png"},8992:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/pointer-references-3-7b60c4bdc0392eb962187ee76ac2ab54.png"},5127:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/pointer-references-4-ba178a14defb70eb04b45ce050af0e6e.png"},3319:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAADMCAIAAACX588hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2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BNx61be2HmgKkpC2AoArWtra97YImj1/QQA0Ii2NumNLRRbuWUDADSgrQAAgLYCAKCtAABoKwAAoK0AAGgrAADaCgAAV9NWzKcAAG09vLamhiyJdQEqDwBo6wxd7RxkY23lS1cAaFBbj+KN/ePXYFWAtgLAEbT1SN7YaCsAHEZbD+SNnWsro60AcOvaur83dhKAI68AcJtx67be2DULV7QVABrX1ga9sUvaStgKAM1ra4Pe2NlAw2WWgsgcAODa2goAAGgrAADaCgCAtgIAANoKAIC2AgCgrQAAcDVt5WMoAEBbj6ytg49h+J2B3AgAgLbOyzP7CqtgNAAAsLu2HsUbOwlhcxldxQoGAGA1bT2SNzbSCgCH0daDeGOPsXCwp9wIAHBL2rq9N3YSC9c2AgDcRty6sTd2IeplOhgAHEBb2/TGHocefng2AgA0pK2te2OHas78VgBoUFsBAABtBQBAWwEA0FYAAEBbAQDQVgAAtBUAAK6mrXwMBQBo67G1VRhhJ9YFqDwAoK3zMxq+b+3dZ2lmAGhNW4/ijR19MTucH9oKAM1q6zG8scdEgRUM2goA7WrrQbyxB3mOA1hGWwHgxrV1S2/sUZo7hZXe2MgrANxo3LqRN3ayqoAya2U6GAAcQFvb8saODxkNLxC2AsBBtLVBb+x4euv5QGEuvNMCgIa0FQAA0FYAALQVAABtBQAAtBUAAG0FAEBbAQDgatrKx1AAgLYeXlullYD2FwAAQFuduto5yIYyKjcCAFxbW4/jjT1YFYTGr2IjAEAT2noMb+xTcrjaRgCAK2vrYbyx0VYAeInauqU3NtoKAC84bt3IGxttBYDb0Na2vLHRVgA4vrY26I2dDTRcZinkgw8AAFfXVgAAQFsBANBWAAC0FQAA0FYAALQVAABtBQAAtBUAAG0FAEBbAQAg4v9FZVTogLiptQAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/17896441.0744e752.js b/assets/js/17896441.881624b3.js similarity index 90% rename from assets/js/17896441.0744e752.js rename to assets/js/17896441.881624b3.js index 5e77312d..b4d7d922 100644 --- a/assets/js/17896441.0744e752.js +++ b/assets/js/17896441.881624b3.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[7918],{1970:(e,a,t)=>{t.d(a,{Z:()=>s});var r=t(7294),n=t(2263),o=t(6429),l=t(1262);const m=()=>{const{siteConfig:e}=(0,n.Z)();return r.createElement(r.Fragment,null,r.createElement("iframe",{src:`https://${e.organizationName}.substack.com/embed`,width:"100%",height:"320",className:"substack-iframe",frameborder:"0",scrolling:"no"}))};function s(e){return r.createElement(r.Fragment,null,r.createElement(o.Z,e),r.createElement(l.Z,null,(()=>{var e,a;return"/"===(null==(e=window)||null==(a=e.location)?void 0:a.pathname)&&r.createElement(r.Fragment,null,r.createElement("hr",null),r.createElement(m,null))})))}},718:(e,a,t)=>{t.r(a),t.d(a,{default:()=>c});var r=t(7294),n=t(2263),o=t(3944),l=t(8234),m=t(1262);const s=()=>{const{siteConfig:e}=(0,n.Z)();console.log("siteConfig",e.themeConfig.showContentFooterEbookWrapper);const a=[{id:"dasarpemrogramangolang",name:"Dasar Pemrograman Golang",src:"/img/cover ebook golang.png"},{id:"dasarpemrogramanpython",name:"Dasar Pemrograman Python",src:"/img/cover ebook python.png"},{id:"dasarpemrogramanrust",name:"Dasar Pemrograman Rust",src:"/img/cover ebook rust.png"}].sort(((a,t)=>{const r=a=>String(a.id===e.projectName?-1:1)+a.name;return r(a).localeCompare(r(t))}));return r.createElement(r.Fragment,null,r.createElement("div",{className:"ebook-wrapper"},r.createElement("h3",null,"Serial ebook/webbook ",r.createElement("span",{className:"underline"},"Dasar Pemrograman")," lainnya:"),a.map((a=>r.createElement("div",{className:"ebook "+(a.id===e.projectName?"ebook-current":""),key:a.id},r.createElement("a",{href:`https://${a.id}.novalagung.com/`,target:"_blank"},r.createElement("span",{className:"ebook-checkmark"},"\u2705"),r.createElement("img",{className:"ebook-img",src:a.src}),r.createElement("span",{className:"ebook-title"},"Ebook: ",a.name)))))))};function c(e){const{siteConfig:a}=(0,n.Z)(),{metadata:t}=e.content,{comments:c=!0}=t.frontMatter,i=`${a.title} - ${t.title.split(". ").reverse()[0]}`,g=`${a.url}${t.slug}`;return r.createElement(r.Fragment,null,r.createElement(l.Z,e),r.createElement(m.Z,null,(()=>a.themeConfig.showContentFooterEbookWrapper?r.createElement(s,null):r.createElement(r.Fragment,null))),r.createElement(m.Z,null,(()=>c&&r.createElement(r.Fragment,null,r.createElement("div",{className:"disqus-wrapper"},r.createElement(o.qw,{shortname:"dasarpemrogramangolang",config:{url:g,identifier:g,title:i}}))))))}}}]); \ No newline at end of file +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[7918],{1970:(e,a,t)=>{t.d(a,{Z:()=>s});var r=t(7294),n=t(2263),o=t(4527),l=t(1262);const m=()=>{const{siteConfig:e}=(0,n.Z)();return r.createElement(r.Fragment,null,r.createElement("iframe",{src:`https://${e.organizationName}.substack.com/embed`,width:"100%",height:"320",className:"substack-iframe",frameborder:"0",scrolling:"no"}))};function s(e){return r.createElement(r.Fragment,null,r.createElement(o.Z,e),r.createElement(l.Z,null,(()=>{var e,a;return"/"===(null==(e=window)||null==(a=e.location)?void 0:a.pathname)&&r.createElement(r.Fragment,null,r.createElement("hr",null),r.createElement(m,null))})))}},718:(e,a,t)=>{t.r(a),t.d(a,{default:()=>c});var r=t(7294),n=t(2263),o=t(3944),l=t(8234),m=t(1262);const s=()=>{const{siteConfig:e}=(0,n.Z)();console.log("siteConfig",e.themeConfig.showContentFooterEbookWrapper);const a=[{id:"dasarpemrogramangolang",name:"Dasar Pemrograman Golang",src:"/img/cover ebook golang.png"},{id:"dasarpemrogramanpython",name:"Dasar Pemrograman Python",src:"/img/cover ebook python.png"},{id:"dasarpemrogramanrust",name:"Dasar Pemrograman Rust",src:"/img/cover ebook rust.png"}].sort(((a,t)=>{const r=a=>String(a.id===e.projectName?-1:1)+a.name;return r(a).localeCompare(r(t))}));return r.createElement(r.Fragment,null,r.createElement("div",{className:"ebook-wrapper"},r.createElement("h3",null,"Serial ebook/webbook ",r.createElement("span",{className:"underline"},"Dasar Pemrograman")," lainnya:"),a.map((a=>r.createElement("div",{className:"ebook "+(a.id===e.projectName?"ebook-current":""),key:a.id},r.createElement("a",{href:`https://${a.id}.novalagung.com/`,target:"_blank"},r.createElement("span",{className:"ebook-checkmark"},"\u2705"),r.createElement("img",{className:"ebook-img",src:a.src}),r.createElement("span",{className:"ebook-title"},"Ebook: ",a.name)))))))};function c(e){const{siteConfig:a}=(0,n.Z)(),{metadata:t}=e.content,{comments:c=!0}=t.frontMatter,i=`${a.title} - ${t.title.split(". ").reverse()[0]}`,g=`${a.url}${t.slug}`;return r.createElement(r.Fragment,null,r.createElement(l.Z,e),r.createElement(m.Z,null,(()=>a.themeConfig.showContentFooterEbookWrapper?r.createElement(s,null):r.createElement(r.Fragment,null))),r.createElement(m.Z,null,(()=>c&&r.createElement(r.Fragment,null,r.createElement("div",{className:"disqus-wrapper"},r.createElement(o.qw,{shortname:"dasarpemrogramangolang",config:{url:g,identifier:g,title:i}}))))))}},8063:(e,a,t)=>{t.d(a,{Z:()=>m});var r=t(7462),n=t(7294),o=t(6010);const l="img_CujE";function m(e){return n.createElement("img",(0,r.Z)({},e,{className:(a=e.className,(0,o.Z)(a,l))}));var a}}}]); \ No newline at end of file diff --git a/assets/js/205.e9ca4e1a.js b/assets/js/205.e9ca4e1a.js deleted file mode 100644 index 184fac7c..00000000 --- a/assets/js/205.e9ca4e1a.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[205],{3905:(e,t,n)=>{"use strict";n.d(t,{Zo:()=>u,kt:()=>f});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=s(n),f=o,p=m["".concat(c,".").concat(f)]||m[f]||d[f]||a;return n?r.createElement(p,i(i({ref:t},u),{},{components:n})):r.createElement(p,i({ref:t},u))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var s=2;s{"use strict";n.d(t,{Z:()=>a});var r=n(7294),o=n(2389);function a(e){let{children:t,fallback:n}=e;return(0,o.Z)()?r.createElement(r.Fragment,null,null==t?void 0:t()):n??null}},6429:(e,t,n)=>{"use strict";n.d(t,{Z:()=>we});var r=n(7294),o=n(6010),a=n(5281),i=n(5130),l=n(7462),c=n(5999),s=n(6668);const u="anchorWithStickyNavbar_LWe7",d="anchorWithHideOnScrollNavbar_WYt5";function m(e){let{as:t,id:n,...a}=e;const{navbar:{hideOnScroll:i}}=(0,s.L)();return"h1"!==t&&n?r.createElement(t,(0,l.Z)({},a,{className:(0,o.Z)("anchor",i?d:u),id:n}),a.children,r.createElement("a",{className:"hash-link",href:`#${n}`,title:(0,c.I)({id:"theme.common.headingLinkTitle",message:"Direct link to heading",description:"Title for link to heading"})},"\u200b")):r.createElement(t,(0,l.Z)({},a,{id:void 0}))}var f=n(3905),p=n(5742);var h=n(2389),b=n(2949);function y(){const{prism:e}=(0,s.L)(),{colorMode:t}=(0,b.I)(),n=e.theme,r=e.darkTheme||n;return"dark"===t?r:n}var g=n(7594),v=n.n(g);const E=/title=(?["'])(?.*?)\1/,w=/\{(?<range>[\d,-]+)\}/,_={js:{start:"\\/\\/",end:""},jsBlock:{start:"\\/\\*",end:"\\*\\/"},jsx:{start:"\\{\\s*\\/\\*",end:"\\*\\/\\s*\\}"},bash:{start:"#",end:""},html:{start:"\x3c!--",end:"--\x3e"}};function C(e,t){const n=e.map((e=>{const{start:n,end:r}=_[e];return`(?:${n}\\s*(${t.flatMap((e=>{var t,n;return[e.line,null==(t=e.block)?void 0:t.start,null==(n=e.block)?void 0:n.end].filter(Boolean)})).join("|")})\\s*${r})`})).join("|");return new RegExp(`^\\s*(?:${n})\\s*$`)}function k(e,t){let n=e.replace(/\n$/,"");const{language:r,magicComments:o,metastring:a}=t;if(a&&w.test(a)){const e=a.match(w).groups.range;if(0===o.length)throw new Error(`A highlight range has been given in code block's metastring (\`\`\` ${a}), but no magic comment config is available. Docusaurus applies the first magic comment entry's className for metastring ranges.`);const t=o[0].className,r=v()(e).filter((e=>e>0)).map((e=>[e-1,[t]]));return{lineClassNames:Object.fromEntries(r),code:n}}if(void 0===r)return{lineClassNames:{},code:n};const i=function(e,t){switch(e){case"js":case"javascript":case"ts":case"typescript":return C(["js","jsBlock"],t);case"jsx":case"tsx":return C(["js","jsBlock","jsx"],t);case"html":return C(["js","jsBlock","html"],t);case"python":case"py":case"bash":return C(["bash"],t);case"markdown":case"md":return C(["html","jsx","bash"],t);default:return C(Object.keys(_),t)}}(r,o),l=n.split("\n"),c=Object.fromEntries(o.map((e=>[e.className,{start:0,range:""}]))),s=Object.fromEntries(o.filter((e=>e.line)).map((e=>{let{className:t,line:n}=e;return[n,t]}))),u=Object.fromEntries(o.filter((e=>e.block)).map((e=>{let{className:t,block:n}=e;return[n.start,t]}))),d=Object.fromEntries(o.filter((e=>e.block)).map((e=>{let{className:t,block:n}=e;return[n.end,t]})));for(let f=0;f<l.length;){const e=l[f].match(i);if(!e){f+=1;continue}const t=e.slice(1).find((e=>void 0!==e));s[t]?c[s[t]].range+=`${f},`:u[t]?c[u[t]].start=f:d[t]&&(c[d[t]].range+=`${c[d[t]].start}-${f-1},`),l.splice(f,1)}n=l.join("\n");const m={};return Object.entries(c).forEach((e=>{let[t,{range:n}]=e;v()(n).forEach((e=>{m[e]??=[],m[e].push(t)}))})),{lineClassNames:m,code:n}}const N="codeBlockContainer_Ckt0";function O(e){let{as:t,...n}=e;const i=function(e){const t={color:"--prism-color",backgroundColor:"--prism-background-color"},n={};return Object.entries(e.plain).forEach((e=>{let[r,o]=e;const a=t[r];a&&"string"==typeof o&&(n[a]=o)})),n}(y());return r.createElement(t,(0,l.Z)({},n,{style:i,className:(0,o.Z)(n.className,N,a.k.common.codeBlock)}))}const S={codeBlockContent:"codeBlockContent_biex",codeBlockTitle:"codeBlockTitle_Ktv7",codeBlock:"codeBlock_bY9V",codeBlockStandalone:"codeBlockStandalone_MEMb",codeBlockLines:"codeBlockLines_e6Vv",codeBlockLinesWithNumbering:"codeBlockLinesWithNumbering_o6Pm",buttonGroup:"buttonGroup__atx"};function T(e){let{children:t,className:n}=e;return r.createElement(O,{as:"pre",tabIndex:0,className:(0,o.Z)(S.codeBlockStandalone,"thin-scrollbar",n)},r.createElement("code",{className:S.codeBlockLines},t))}var I=n(902);const L={attributes:!0,characterData:!0,childList:!0,subtree:!0};function M(e,t){const[n,o]=(0,r.useState)(),a=(0,r.useCallback)((()=>{var t;o(null==(t=e.current)?void 0:t.closest("[role=tabpanel][hidden]"))}),[e,o]);(0,r.useEffect)((()=>{a()}),[a]),function(e,t,n){void 0===n&&(n=L);const o=(0,I.zX)(t),a=(0,I.Ql)(n);(0,r.useEffect)((()=>{const t=new MutationObserver(o);return e&&t.observe(e,a),()=>t.disconnect()}),[e,o,a])}(n,(e=>{e.forEach((e=>{"attributes"===e.type&&"hidden"===e.attributeName&&(t(),a())}))}),{attributes:!0,characterData:!1,childList:!1,subtree:!1})}const D={plain:{backgroundColor:"#2a2734",color:"#9a86fd"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#6c6783"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#e09142"}},{types:["property","function"],style:{color:"#9a86fd"}},{types:["tag-id","selector","atrule-id"],style:{color:"#eeebff"}},{types:["attr-name"],style:{color:"#c4b9fe"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","atrule","placeholder","variable"],style:{color:"#ffcc99"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#c4b9fe"}}]};var j={Prism:n(7410).Z,theme:D};function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function x(){return x=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},x.apply(this,arguments)}var R=/\r\n|\r|\n/,B=function(e){0===e.length?e.push({types:["plain"],content:"\n",empty:!0}):1===e.length&&""===e[0].content&&(e[0].content="\n",e[0].empty=!0)},Z=function(e,t){var n=e.length;return n>0&&e[n-1]===t?e:e.concat(t)},A=function(e,t){var n=e.plain,r=Object.create(null),o=e.styles.reduce((function(e,n){var r=n.languages,o=n.style;return r&&!r.includes(t)||n.types.forEach((function(t){var n=x({},e[t],o);e[t]=n})),e}),r);return o.root=n,o.plain=x({},n,{backgroundColor:null}),o};function H(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&-1===t.indexOf(r)&&(n[r]=e[r]);return n}const U=function(e){function t(){for(var t=this,n=[],r=arguments.length;r--;)n[r]=arguments[r];e.apply(this,n),P(this,"getThemeDict",(function(e){if(void 0!==t.themeDict&&e.theme===t.prevTheme&&e.language===t.prevLanguage)return t.themeDict;t.prevTheme=e.theme,t.prevLanguage=e.language;var n=e.theme?A(e.theme,e.language):void 0;return t.themeDict=n})),P(this,"getLineProps",(function(e){var n=e.key,r=e.className,o=e.style,a=x({},H(e,["key","className","style","line"]),{className:"token-line",style:void 0,key:void 0}),i=t.getThemeDict(t.props);return void 0!==i&&(a.style=i.plain),void 0!==o&&(a.style=void 0!==a.style?x({},a.style,o):o),void 0!==n&&(a.key=n),r&&(a.className+=" "+r),a})),P(this,"getStyleForToken",(function(e){var n=e.types,r=e.empty,o=n.length,a=t.getThemeDict(t.props);if(void 0!==a){if(1===o&&"plain"===n[0])return r?{display:"inline-block"}:void 0;if(1===o&&!r)return a[n[0]];var i=r?{display:"inline-block"}:{},l=n.map((function(e){return a[e]}));return Object.assign.apply(Object,[i].concat(l))}})),P(this,"getTokenProps",(function(e){var n=e.key,r=e.className,o=e.style,a=e.token,i=x({},H(e,["key","className","style","token"]),{className:"token "+a.types.join(" "),children:a.content,style:t.getStyleForToken(a),key:void 0});return void 0!==o&&(i.style=void 0!==i.style?x({},i.style,o):o),void 0!==n&&(i.key=n),r&&(i.className+=" "+r),i})),P(this,"tokenize",(function(e,t,n,r){var o={code:t,grammar:n,language:r,tokens:[]};e.hooks.run("before-tokenize",o);var a=o.tokens=e.tokenize(o.code,o.grammar,o.language);return e.hooks.run("after-tokenize",o),a}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.render=function(){var e=this.props,t=e.Prism,n=e.language,r=e.code,o=e.children,a=this.getThemeDict(this.props),i=t.languages[n];return o({tokens:function(e){for(var t=[[]],n=[e],r=[0],o=[e.length],a=0,i=0,l=[],c=[l];i>-1;){for(;(a=r[i]++)<o[i];){var s=void 0,u=t[i],d=n[i][a];if("string"==typeof d?(u=i>0?u:["plain"],s=d):(u=Z(u,d.type),d.alias&&(u=Z(u,d.alias)),s=d.content),"string"==typeof s){var m=s.split(R),f=m.length;l.push({types:u,content:m[0]});for(var p=1;p<f;p++)B(l),c.push(l=[]),l.push({types:u,content:m[p]})}else i++,t.push(u),n.push(s),r.push(0),o.push(s.length)}i--,t.pop(),n.pop(),r.pop(),o.pop()}return B(l),c}(void 0!==i?this.tokenize(t,r,i,n):[r]),className:"prism-code language-"+n,style:void 0!==a?a.root:{},getLineProps:this.getLineProps,getTokenProps:this.getTokenProps})},t}(r.Component),q="codeLine_lJS_",z="codeLineNumber_Tfdd",V="codeLineContent_feaV";function W(e){let{line:t,classNames:n,showLineNumbers:a,getLineProps:i,getTokenProps:c}=e;1===t.length&&"\n"===t[0].content&&(t[0].content="");const s=i({line:t,className:(0,o.Z)(n,a&&q)}),u=t.map(((e,t)=>r.createElement("span",(0,l.Z)({key:t},c({token:e,key:t})))));return r.createElement("span",s,a?r.createElement(r.Fragment,null,r.createElement("span",{className:z}),r.createElement("span",{className:V},u)):u,r.createElement("br",null))}const $={copyButtonCopied:"copyButtonCopied_obH4",copyButtonIcons:"copyButtonIcons_eSgA",copyButtonIcon:"copyButtonIcon_y97N",copyButtonSuccessIcon:"copyButtonSuccessIcon_LjdS"};function Q(e){let{code:t,className:n}=e;const[a,i]=(0,r.useState)(!1),l=(0,r.useRef)(void 0),s=(0,r.useCallback)((()=>{!function(e,t){let{target:n=document.body}=void 0===t?{}:t;const r=document.createElement("textarea"),o=document.activeElement;r.value=e,r.setAttribute("readonly",""),r.style.contain="strict",r.style.position="absolute",r.style.left="-9999px",r.style.fontSize="12pt";const a=document.getSelection();let i=!1;a.rangeCount>0&&(i=a.getRangeAt(0)),n.append(r),r.select(),r.selectionStart=0,r.selectionEnd=e.length;let l=!1;try{l=document.execCommand("copy")}catch{}r.remove(),i&&(a.removeAllRanges(),a.addRange(i)),o&&o.focus()}(t),i(!0),l.current=window.setTimeout((()=>{i(!1)}),1e3)}),[t]);return(0,r.useEffect)((()=>()=>window.clearTimeout(l.current)),[]),r.createElement("button",{type:"button","aria-label":a?(0,c.I)({id:"theme.CodeBlock.copied",message:"Copied",description:"The copied button label on code blocks"}):(0,c.I)({id:"theme.CodeBlock.copyButtonAriaLabel",message:"Copy code to clipboard",description:"The ARIA label for copy code blocks button"}),title:(0,c.I)({id:"theme.CodeBlock.copy",message:"Copy",description:"The copy button label on code blocks"}),className:(0,o.Z)("clean-btn",n,$.copyButton,a&&$.copyButtonCopied),onClick:s},r.createElement("span",{className:$.copyButtonIcons,"aria-hidden":"true"},r.createElement("svg",{className:$.copyButtonIcon,viewBox:"0 0 24 24"},r.createElement("path",{d:"M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"})),r.createElement("svg",{className:$.copyButtonSuccessIcon,viewBox:"0 0 24 24"},r.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))))}const F="wordWrapButtonIcon_Bwma",G="wordWrapButtonEnabled_EoeP";function K(e){let{className:t,onClick:n,isEnabled:a}=e;const i=(0,c.I)({id:"theme.CodeBlock.wordWrapToggle",message:"Toggle word wrap",description:"The title attribute for toggle word wrapping button of code block lines"});return r.createElement("button",{type:"button",onClick:n,className:(0,o.Z)("clean-btn",t,a&&G),"aria-label":i,title:i},r.createElement("svg",{className:F,viewBox:"0 0 24 24","aria-hidden":"true"},r.createElement("path",{fill:"currentColor",d:"M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"})))}function J(e){let{children:t,className:n="",metastring:a,title:i,showLineNumbers:c,language:u}=e;const{prism:{defaultLanguage:d,magicComments:m}}=(0,s.L)(),f=u??function(e){const t=e.split(" ").find((e=>e.startsWith("language-")));return null==t?void 0:t.replace(/language-/,"")}(n)??d,p=y(),h=function(){const[e,t]=(0,r.useState)(!1),[n,o]=(0,r.useState)(!1),a=(0,r.useRef)(null),i=(0,r.useCallback)((()=>{const n=a.current.querySelector("code");e?n.removeAttribute("style"):(n.style.whiteSpace="pre-wrap",n.style.overflowWrap="anywhere"),t((e=>!e))}),[a,e]),l=(0,r.useCallback)((()=>{const{scrollWidth:e,clientWidth:t}=a.current,n=e>t||a.current.querySelector("code").hasAttribute("style");o(n)}),[a]);return M(a,l),(0,r.useEffect)((()=>{l()}),[e,l]),(0,r.useEffect)((()=>(window.addEventListener("resize",l,{passive:!0}),()=>{window.removeEventListener("resize",l)})),[l]),{codeBlockRef:a,isEnabled:e,isCodeScrollable:n,toggle:i}}(),b=function(e){var t;return(null==e||null==(t=e.match(E))?void 0:t.groups.title)??""}(a)||i,{lineClassNames:g,code:v}=k(t,{metastring:a,language:f,magicComments:m}),w=c??function(e){return Boolean(null==e?void 0:e.includes("showLineNumbers"))}(a);return r.createElement(O,{as:"div",className:(0,o.Z)(n,f&&!n.includes(`language-${f}`)&&`language-${f}`)},b&&r.createElement("div",{className:S.codeBlockTitle},b),r.createElement("div",{className:S.codeBlockContent},r.createElement(U,(0,l.Z)({},j,{theme:p,code:v,language:f??"text"}),(e=>{let{className:t,tokens:n,getLineProps:a,getTokenProps:i}=e;return r.createElement("pre",{tabIndex:0,ref:h.codeBlockRef,className:(0,o.Z)(t,S.codeBlock,"thin-scrollbar")},r.createElement("code",{className:(0,o.Z)(S.codeBlockLines,w&&S.codeBlockLinesWithNumbering)},n.map(((e,t)=>r.createElement(W,{key:t,line:e,getLineProps:a,getTokenProps:i,classNames:g[t],showLineNumbers:w})))))})),r.createElement("div",{className:S.buttonGroup},(h.isEnabled||h.isCodeScrollable)&&r.createElement(K,{className:S.codeButton,onClick:()=>h.toggle(),isEnabled:h.isEnabled}),r.createElement(Q,{className:S.codeButton,code:v}))))}function X(e){let{children:t,...n}=e;const o=(0,h.Z)(),a=function(e){return r.Children.toArray(e).some((e=>(0,r.isValidElement)(e)))?e:Array.isArray(e)?e.join(""):e}(t),i="string"==typeof a?J:T;return r.createElement(i,(0,l.Z)({key:String(o)},n),a)}var Y=n(9960);var ee=n(6043);const te="details_lb9f",ne="isBrowser_bmU9",re="collapsibleContent_i85q";function oe(e){return!!e&&("SUMMARY"===e.tagName||oe(e.parentElement))}function ae(e,t){return!!e&&(e===t||ae(e.parentElement,t))}function ie(e){let{summary:t,children:n,...a}=e;const i=(0,h.Z)(),c=(0,r.useRef)(null),{collapsed:s,setCollapsed:u}=(0,ee.u)({initialState:!a.open}),[d,m]=(0,r.useState)(a.open);return r.createElement("details",(0,l.Z)({},a,{ref:c,open:d,"data-collapsed":s,className:(0,o.Z)(te,i&&ne,a.className),onMouseDown:e=>{oe(e.target)&&e.detail>1&&e.preventDefault()},onClick:e=>{e.stopPropagation();const t=e.target;oe(t)&&ae(t,c.current)&&(e.preventDefault(),s?(u(!1),m(!0)):u(!0))}}),t??r.createElement("summary",null,"Details"),r.createElement(ee.z,{lazy:!1,collapsed:s,disableSSRStyle:!0,onCollapseTransitionEnd:e=>{u(e),m(!e)}},r.createElement("div",{className:re},n)))}const le="details_b_Ee";function ce(e){let{...t}=e;return r.createElement(ie,(0,l.Z)({},t,{className:(0,o.Z)("alert alert--info",le,t.className)}))}function se(e){return r.createElement(m,e)}const ue="containsTaskList_mC6p";const de="img_ev3q";const me="admonition_LlT9",fe="admonitionHeading_tbUL",pe="admonitionIcon_kALy",he="admonitionContent_S0QG";const be={note:{infimaClassName:"secondary",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 14 16"},r.createElement("path",{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"}))},label:r.createElement(c.Z,{id:"theme.admonition.note",description:"The default label used for the Note admonition (:::note)"},"note")},tip:{infimaClassName:"success",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 12 16"},r.createElement("path",{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"}))},label:r.createElement(c.Z,{id:"theme.admonition.tip",description:"The default label used for the Tip admonition (:::tip)"},"tip")},danger:{infimaClassName:"danger",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 12 16"},r.createElement("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"}))},label:r.createElement(c.Z,{id:"theme.admonition.danger",description:"The default label used for the Danger admonition (:::danger)"},"danger")},info:{infimaClassName:"info",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 14 16"},r.createElement("path",{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))},label:r.createElement(c.Z,{id:"theme.admonition.info",description:"The default label used for the Info admonition (:::info)"},"info")},caution:{infimaClassName:"warning",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 16 16"},r.createElement("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))},label:r.createElement(c.Z,{id:"theme.admonition.caution",description:"The default label used for the Caution admonition (:::caution)"},"caution")}},ye={secondary:"note",important:"info",success:"tip",warning:"danger"};function ge(e){const{mdxAdmonitionTitle:t,rest:n}=function(e){const t=r.Children.toArray(e),n=t.find((e=>{var t;return r.isValidElement(e)&&"mdxAdmonitionTitle"===(null==(t=e.props)?void 0:t.mdxType)})),o=r.createElement(r.Fragment,null,t.filter((e=>e!==n)));return{mdxAdmonitionTitle:n,rest:o}}(e.children);return{...e,title:e.title??t,children:n}}const ve={head:function(e){const t=r.Children.map(e.children,(e=>r.isValidElement(e)?function(e){var t;if(null!=(t=e.props)&&t.mdxType&&e.props.originalType){const{mdxType:t,originalType:n,...o}=e.props;return r.createElement(e.props.originalType,o)}return e}(e):e));return r.createElement(p.Z,e,t)},code:function(e){const t=["a","abbr","b","br","button","cite","code","del","dfn","em","i","img","input","ins","kbd","label","object","output","q","ruby","s","small","span","strong","sub","sup","time","u","var","wbr"];return r.Children.toArray(e.children).every((e=>{var n;return"string"==typeof e&&!e.includes("\n")||(0,r.isValidElement)(e)&&t.includes(null==(n=e.props)?void 0:n.mdxType)}))?r.createElement("code",e):r.createElement(X,e)},a:function(e){return r.createElement(Y.Z,e)},pre:function(e){var t;return r.createElement(X,(0,r.isValidElement)(e.children)&&"code"===(null==(t=e.children.props)?void 0:t.originalType)?e.children.props:{...e})},details:function(e){const t=r.Children.toArray(e.children),n=t.find((e=>{var t;return r.isValidElement(e)&&"summary"===(null==(t=e.props)?void 0:t.mdxType)})),o=r.createElement(r.Fragment,null,t.filter((e=>e!==n)));return r.createElement(ce,(0,l.Z)({},e,{summary:n}),o)},ul:function(e){return r.createElement("ul",(0,l.Z)({},e,{className:(t=e.className,(0,o.Z)(t,(null==t?void 0:t.includes("contains-task-list"))&&ue))}));var t},img:function(e){return r.createElement("img",(0,l.Z)({loading:"lazy"},e,{className:(t=e.className,(0,o.Z)(t,de))}));var t},h1:e=>r.createElement(se,(0,l.Z)({as:"h1"},e)),h2:e=>r.createElement(se,(0,l.Z)({as:"h2"},e)),h3:e=>r.createElement(se,(0,l.Z)({as:"h3"},e)),h4:e=>r.createElement(se,(0,l.Z)({as:"h4"},e)),h5:e=>r.createElement(se,(0,l.Z)({as:"h5"},e)),h6:e=>r.createElement(se,(0,l.Z)({as:"h6"},e)),admonition:function(e){const{children:t,type:n,title:i,icon:l}=ge(e),c=function(e){const t=ye[e]??e;return be[t]||(console.warn(`No admonition config found for admonition type "${t}". Using Info as fallback.`),be.info)}(n),s=i??c.label,{iconComponent:u}=c,d=l??r.createElement(u,null);return r.createElement("div",{className:(0,o.Z)(a.k.common.admonition,a.k.common.admonitionType(e.type),"alert",`alert--${c.infimaClassName}`,me)},r.createElement("div",{className:fe},r.createElement("span",{className:pe},d),s),r.createElement("div",{className:he},t))},mermaid:()=>null};function Ee(e){let{children:t}=e;return r.createElement(f.Zo,{components:ve},t)}function we(e){let{children:t}=e;const n=function(){const{metadata:e,frontMatter:t,contentTitle:n}=(0,i.k)();return t.hide_title||void 0!==n?null:e.title}();return r.createElement("div",{className:(0,o.Z)(a.k.docs.docMarkdown,"markdown")},n&&r.createElement("header",null,r.createElement(m,{as:"h1"},n)),r.createElement(Ee,null,t))}},8234:(e,t,n)=>{"use strict";n.d(t,{Z:()=>Ne});var r=n(7294),o=n(833),a=n(5130);function i(){const{metadata:e,frontMatter:t,assets:n}=(0,a.k)();return r.createElement(o.d,{title:e.title,description:e.description,keywords:t.keywords,image:n.image??t.image})}var l=n(6010),c=n(7524),s=n(7462),u=n(5999),d=n(9960);function m(e){const{permalink:t,title:n,subLabel:o,isNext:a}=e;return r.createElement(d.Z,{className:(0,l.Z)("pagination-nav__link",a?"pagination-nav__link--next":"pagination-nav__link--prev"),to:t},o&&r.createElement("div",{className:"pagination-nav__sublabel"},o),r.createElement("div",{className:"pagination-nav__label"},n))}function f(e){const{previous:t,next:n}=e;return r.createElement("nav",{className:"pagination-nav docusaurus-mt-lg","aria-label":(0,u.I)({id:"theme.docs.paginator.navAriaLabel",message:"Docs pages navigation",description:"The ARIA label for the docs pagination"})},t&&r.createElement(m,(0,s.Z)({},t,{subLabel:r.createElement(u.Z,{id:"theme.docs.paginator.previous",description:"The label used to navigate to the previous doc"},"Previous")})),n&&r.createElement(m,(0,s.Z)({},n,{subLabel:r.createElement(u.Z,{id:"theme.docs.paginator.next",description:"The label used to navigate to the next doc"},"Next"),isNext:!0})))}function p(){const{metadata:e}=(0,a.k)();return r.createElement(f,{previous:e.previous,next:e.next})}var h=n(2263),b=n(143),y=n(5281),g=n(373),v=n(4477);const E={unreleased:function(e){let{siteTitle:t,versionMetadata:n}=e;return r.createElement(u.Z,{id:"theme.docs.versions.unreleasedVersionLabel",description:"The label used to tell the user that he's browsing an unreleased doc version",values:{siteTitle:t,versionLabel:r.createElement("b",null,n.label)}},"This is unreleased documentation for {siteTitle} {versionLabel} version.")},unmaintained:function(e){let{siteTitle:t,versionMetadata:n}=e;return r.createElement(u.Z,{id:"theme.docs.versions.unmaintainedVersionLabel",description:"The label used to tell the user that he's browsing an unmaintained doc version",values:{siteTitle:t,versionLabel:r.createElement("b",null,n.label)}},"This is documentation for {siteTitle} {versionLabel}, which is no longer actively maintained.")}};function w(e){const t=E[e.versionMetadata.banner];return r.createElement(t,e)}function _(e){let{versionLabel:t,to:n,onClick:o}=e;return r.createElement(u.Z,{id:"theme.docs.versions.latestVersionSuggestionLabel",description:"The label used to tell the user to check the latest version",values:{versionLabel:t,latestVersionLink:r.createElement("b",null,r.createElement(d.Z,{to:n,onClick:o},r.createElement(u.Z,{id:"theme.docs.versions.latestVersionLinkLabel",description:"The label used for the latest version suggestion link label"},"latest version")))}},"For up-to-date documentation, see the {latestVersionLink} ({versionLabel}).")}function C(e){let{className:t,versionMetadata:n}=e;const{siteConfig:{title:o}}=(0,h.Z)(),{pluginId:a}=(0,b.gA)({failfast:!0}),{savePreferredVersionName:i}=(0,g.J)(a),{latestDocSuggestion:c,latestVersionSuggestion:s}=(0,b.Jo)(a),u=c??(d=s).docs.find((e=>e.id===d.mainDocId));var d;return r.createElement("div",{className:(0,l.Z)(t,y.k.docs.docVersionBanner,"alert alert--warning margin-bottom--md"),role:"alert"},r.createElement("div",null,r.createElement(w,{siteTitle:o,versionMetadata:n})),r.createElement("div",{className:"margin-top--md"},r.createElement(_,{versionLabel:s.label,to:u.path,onClick:()=>i(s.name)})))}function k(e){let{className:t}=e;const n=(0,v.E)();return n.banner?r.createElement(C,{className:t,versionMetadata:n}):null}function N(e){let{className:t}=e;const n=(0,v.E)();return n.badge?r.createElement("span",{className:(0,l.Z)(t,y.k.docs.docVersionBadge,"badge badge--secondary")},r.createElement(u.Z,{id:"theme.docs.versionBadge.label",values:{versionLabel:n.label}},"Version: {versionLabel}")):null}function O(e){let{lastUpdatedAt:t,formattedLastUpdatedAt:n}=e;return r.createElement(u.Z,{id:"theme.lastUpdated.atDate",description:"The words used to describe on which date a page has been last updated",values:{date:r.createElement("b",null,r.createElement("time",{dateTime:new Date(1e3*t).toISOString()},n))}}," on {date}")}function S(e){let{lastUpdatedBy:t}=e;return r.createElement(u.Z,{id:"theme.lastUpdated.byUser",description:"The words used to describe by who the page has been last updated",values:{user:r.createElement("b",null,t)}}," by {user}")}function T(e){let{lastUpdatedAt:t,formattedLastUpdatedAt:n,lastUpdatedBy:o}=e;return r.createElement("span",{className:y.k.common.lastUpdated},r.createElement(u.Z,{id:"theme.lastUpdated.lastUpdatedAtBy",description:"The sentence used to display when a page has been last updated, and by who",values:{atDate:t&&n?r.createElement(O,{lastUpdatedAt:t,formattedLastUpdatedAt:n}):"",byUser:o?r.createElement(S,{lastUpdatedBy:o}):""}},"Last updated{atDate}{byUser}"),!1)}const I="iconEdit_Z9Sw";function L(e){let{className:t,...n}=e;return r.createElement("svg",(0,s.Z)({fill:"currentColor",height:"20",width:"20",viewBox:"0 0 40 40",className:(0,l.Z)(I,t),"aria-hidden":"true"},n),r.createElement("g",null,r.createElement("path",{d:"m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"})))}function M(e){let{editUrl:t}=e;return r.createElement("a",{href:t,target:"_blank",rel:"noreferrer noopener",className:y.k.common.editThisPage},r.createElement(L,null),r.createElement(u.Z,{id:"theme.common.editThisPage",description:"The link label to edit the current page"},"Edit this page"))}const D="tag_zVej",j="tagRegular_sFm0",P="tagWithCount_h2kH";function x(e){let{permalink:t,label:n,count:o}=e;return r.createElement(d.Z,{href:t,className:(0,l.Z)(D,o?P:j)},n,o&&r.createElement("span",null,o))}const R="tags_jXut",B="tag_QGVx";function Z(e){let{tags:t}=e;return r.createElement(r.Fragment,null,r.createElement("b",null,r.createElement(u.Z,{id:"theme.tags.tagsListLabel",description:"The label alongside a tag list"},"Tags:")),r.createElement("ul",{className:(0,l.Z)(R,"padding--none","margin-left--sm")},t.map((e=>{let{label:t,permalink:n}=e;return r.createElement("li",{key:n,className:B},r.createElement(x,{label:t,permalink:n}))}))))}const A="lastUpdated_vwxv";function H(e){return r.createElement("div",{className:(0,l.Z)(y.k.docs.docFooterTagsRow,"row margin-bottom--sm")},r.createElement("div",{className:"col"},r.createElement(Z,e)))}function U(e){let{editUrl:t,lastUpdatedAt:n,lastUpdatedBy:o,formattedLastUpdatedAt:a}=e;return r.createElement("div",{className:(0,l.Z)(y.k.docs.docFooterEditMetaRow,"row")},r.createElement("div",{className:"col"},t&&r.createElement(M,{editUrl:t})),r.createElement("div",{className:(0,l.Z)("col",A)},(n||o)&&r.createElement(T,{lastUpdatedAt:n,formattedLastUpdatedAt:a,lastUpdatedBy:o})))}function q(){const{metadata:e}=(0,a.k)(),{editUrl:t,lastUpdatedAt:n,formattedLastUpdatedAt:o,lastUpdatedBy:i,tags:c}=e,s=c.length>0,u=!!(t||n||i);return s||u?r.createElement("footer",{className:(0,l.Z)(y.k.docs.docFooter,"docusaurus-mt-lg")},s&&r.createElement(H,{tags:c}),u&&r.createElement(U,{editUrl:t,lastUpdatedAt:n,lastUpdatedBy:i,formattedLastUpdatedAt:o})):null}var z=n(6043),V=n(6668);function W(e){const t=e.map((e=>({...e,parentIndex:-1,children:[]}))),n=Array(7).fill(-1);t.forEach(((e,t)=>{const r=n.slice(2,e.level);e.parentIndex=Math.max(...r),n[e.level]=t}));const r=[];return t.forEach((e=>{const{parentIndex:n,...o}=e;n>=0?t[n].children.push(o):r.push(o)})),r}function $(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:r}=e;return t.flatMap((e=>{const t=$({toc:e.children,minHeadingLevel:n,maxHeadingLevel:r});return function(e){return e.level>=n&&e.level<=r}(e)?[{...e,children:t}]:t}))}function Q(e){const t=e.getBoundingClientRect();return t.top===t.bottom?Q(e.parentNode):t}function F(e,t){let{anchorTopOffset:n}=t;const r=e.find((e=>Q(e).top>=n));if(r){return function(e){return e.top>0&&e.bottom<window.innerHeight/2}(Q(r))?r:e[e.indexOf(r)-1]??null}return e[e.length-1]??null}function G(){const e=(0,r.useRef)(0),{navbar:{hideOnScroll:t}}=(0,V.L)();return(0,r.useEffect)((()=>{e.current=t?0:document.querySelector(".navbar").clientHeight}),[t]),e}function K(e){const t=(0,r.useRef)(void 0),n=G();(0,r.useEffect)((()=>{if(!e)return()=>{};const{linkClassName:r,linkActiveClassName:o,minHeadingLevel:a,maxHeadingLevel:i}=e;function l(){const e=function(e){return Array.from(document.getElementsByClassName(e))}(r),l=function(e){let{minHeadingLevel:t,maxHeadingLevel:n}=e;const r=[];for(let o=t;o<=n;o+=1)r.push(`h${o}.anchor`);return Array.from(document.querySelectorAll(r.join()))}({minHeadingLevel:a,maxHeadingLevel:i}),c=F(l,{anchorTopOffset:n.current}),s=e.find((e=>c&&c.id===function(e){return decodeURIComponent(e.href.substring(e.href.indexOf("#")+1))}(e)));e.forEach((e=>{!function(e,n){n?(t.current&&t.current!==e&&t.current.classList.remove(o),e.classList.add(o),t.current=e):e.classList.remove(o)}(e,e===s)}))}return document.addEventListener("scroll",l),document.addEventListener("resize",l),l(),()=>{document.removeEventListener("scroll",l),document.removeEventListener("resize",l)}}),[e,n])}function J(e){let{toc:t,className:n,linkClassName:o,isChild:a}=e;return t.length?r.createElement("ul",{className:a?void 0:n},t.map((e=>r.createElement("li",{key:e.id},r.createElement("a",{href:`#${e.id}`,className:o??void 0,dangerouslySetInnerHTML:{__html:e.value}}),r.createElement(J,{isChild:!0,toc:e.children,className:n,linkClassName:o}))))):null}const X=r.memo(J);function Y(e){let{toc:t,className:n="table-of-contents table-of-contents__left-border",linkClassName:o="table-of-contents__link",linkActiveClassName:a,minHeadingLevel:i,maxHeadingLevel:l,...c}=e;const u=(0,V.L)(),d=i??u.tableOfContents.minHeadingLevel,m=l??u.tableOfContents.maxHeadingLevel,f=function(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:o}=e;return(0,r.useMemo)((()=>$({toc:W(t),minHeadingLevel:n,maxHeadingLevel:o})),[t,n,o])}({toc:t,minHeadingLevel:d,maxHeadingLevel:m});return K((0,r.useMemo)((()=>{if(o&&a)return{linkClassName:o,linkActiveClassName:a,minHeadingLevel:d,maxHeadingLevel:m}}),[o,a,d,m])),r.createElement(X,(0,s.Z)({toc:f,className:n,linkClassName:o},c))}const ee="tocCollapsibleButton_TO0P",te="tocCollapsibleButtonExpanded_MG3E";function ne(e){let{collapsed:t,...n}=e;return r.createElement("button",(0,s.Z)({type:"button"},n,{className:(0,l.Z)("clean-btn",ee,!t&&te,n.className)}),r.createElement(u.Z,{id:"theme.TOCCollapsible.toggleButtonLabel",description:"The label used by the button on the collapsible TOC component"},"On this page"))}const re="tocCollapsible_ETCw",oe="tocCollapsibleContent_vkbj",ae="tocCollapsibleExpanded_sAul";function ie(e){let{toc:t,className:n,minHeadingLevel:o,maxHeadingLevel:a}=e;const{collapsed:i,toggleCollapsed:c}=(0,z.u)({initialState:!0});return r.createElement("div",{className:(0,l.Z)(re,!i&&ae,n)},r.createElement(ne,{collapsed:i,onClick:c}),r.createElement(z.z,{lazy:!0,className:oe,collapsed:i},r.createElement(Y,{toc:t,minHeadingLevel:o,maxHeadingLevel:a})))}const le="tocMobile_ITEo";function ce(){const{toc:e,frontMatter:t}=(0,a.k)();return r.createElement(ie,{toc:e,minHeadingLevel:t.toc_min_heading_level,maxHeadingLevel:t.toc_max_heading_level,className:(0,l.Z)(y.k.docs.docTocMobile,le)})}const se="tableOfContents_bqdL";function ue(e){let{className:t,...n}=e;return r.createElement("div",{className:(0,l.Z)(se,"thin-scrollbar",t)},r.createElement(Y,(0,s.Z)({},n,{linkClassName:"table-of-contents__link toc-highlight",linkActiveClassName:"table-of-contents__link--active"})))}function de(){const{toc:e,frontMatter:t}=(0,a.k)();return r.createElement(ue,{toc:e,minHeadingLevel:t.toc_min_heading_level,maxHeadingLevel:t.toc_max_heading_level,className:y.k.docs.docTocDesktop})}var me=n(1970),fe=n(2802),pe=n(8596),he=n(4996);function be(e){return r.createElement("svg",(0,s.Z)({viewBox:"0 0 24 24"},e),r.createElement("path",{d:"M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z",fill:"currentColor"}))}const ye={breadcrumbsContainer:"breadcrumbsContainer_Z_bl",breadcrumbHomeIcon:"breadcrumbHomeIcon_OVgt"};function ge(e){let{children:t,href:n,isLast:o}=e;const a="breadcrumbs__link";return o?r.createElement("span",{className:a,itemProp:"name"},t):n?r.createElement(d.Z,{className:a,href:n,itemProp:"item"},r.createElement("span",{itemProp:"name"},t)):r.createElement("span",{className:a},t)}function ve(e){let{children:t,active:n,index:o,addMicrodata:a}=e;return r.createElement("li",(0,s.Z)({},a&&{itemScope:!0,itemProp:"itemListElement",itemType:"https://schema.org/ListItem"},{className:(0,l.Z)("breadcrumbs__item",{"breadcrumbs__item--active":n})}),t,r.createElement("meta",{itemProp:"position",content:String(o+1)}))}function Ee(){const e=(0,he.Z)("/");return r.createElement("li",{className:"breadcrumbs__item"},r.createElement(d.Z,{"aria-label":(0,u.I)({id:"theme.docs.breadcrumbs.home",message:"Home page",description:"The ARIA label for the home page in the breadcrumbs"}),className:(0,l.Z)("breadcrumbs__link",ye.breadcrumbsItemLink),href:e},r.createElement(be,{className:ye.breadcrumbHomeIcon})))}function we(){const e=(0,fe.s1)(),t=(0,pe.Ns)();return e?r.createElement("nav",{className:(0,l.Z)(y.k.docs.docBreadcrumbs,ye.breadcrumbsContainer),"aria-label":(0,u.I)({id:"theme.docs.breadcrumbs.navAriaLabel",message:"Breadcrumbs",description:"The ARIA label for the breadcrumbs"})},r.createElement("ul",{className:"breadcrumbs",itemScope:!0,itemType:"https://schema.org/BreadcrumbList"},t&&r.createElement(Ee,null),e.map(((t,n)=>{const o=n===e.length-1;return r.createElement(ve,{key:n,active:o,index:n,addMicrodata:!!t.href},r.createElement(ge,{href:t.href,isLast:o},t.label))})))):null}const _e="docItemContainer_Djhp",Ce="docItemCol_VOVn";function ke(e){let{children:t}=e;const n=function(){const{frontMatter:e,toc:t}=(0,a.k)(),n=(0,c.i)(),o=e.hide_table_of_contents,i=!o&&t.length>0;return{hidden:o,mobile:i?r.createElement(ce,null):void 0,desktop:!i||"desktop"!==n&&"ssr"!==n?void 0:r.createElement(de,null)}}();return r.createElement("div",{className:"row"},r.createElement("div",{className:(0,l.Z)("col",!n.hidden&&Ce)},r.createElement(k,null),r.createElement("div",{className:_e},r.createElement("article",null,r.createElement(we,null),r.createElement(N,null),n.mobile,r.createElement(me.Z,null,t),r.createElement(q,null)),r.createElement(p,null))),n.desktop&&r.createElement("div",{className:"col col--3"},n.desktop))}function Ne(e){const t=`docs-doc-id-${e.content.metadata.unversionedId}`,n=e.content;return r.createElement(a.b,{content:e.content},r.createElement(o.FG,{className:t},r.createElement(i,null),r.createElement(ke,null,r.createElement(n,null))))}},5130:(e,t,n)=>{"use strict";n.d(t,{b:()=>i,k:()=>l});var r=n(7294),o=n(902);const a=r.createContext(null);function i(e){let{children:t,content:n}=e;const o=function(e){return(0,r.useMemo)((()=>({metadata:e.metadata,frontMatter:e.frontMatter,assets:e.assets,contentTitle:e.contentTitle,toc:e.toc})),[e])}(n);return r.createElement(a.Provider,{value:o},t)}function l(){const e=(0,r.useContext)(a);if(null===e)throw new o.i6("DocProvider");return e}},4477:(e,t,n)=>{"use strict";n.d(t,{E:()=>l,q:()=>i});var r=n(7294),o=n(902);const a=r.createContext(null);function i(e){let{children:t,version:n}=e;return r.createElement(a.Provider,{value:n},t)}function l(){const e=(0,r.useContext)(a);if(null===e)throw new o.i6("DocsVersionProvider");return e}},2449:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CommentCount=void 0;var r=l(n(7294)),o=l(n(5697)),a=n(6674),i=n(7990);function l(e){return e&&e.__esModule?e:{default:e}}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function s(){return s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t){return f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},f(e,t)}function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=b(e);if(t){var o=b(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return h(this,n)}}function h(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}var y=(0,a.debounce)((function(){window.DISQUSWIDGETS&&window.DISQUSWIDGETS.getCount({reset:!0})}),300,!1),g=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(c,e);var t,n,o,l=p(c);function c(){return d(this,c),l.apply(this,arguments)}return t=c,(n=[{key:"componentDidMount",value:function(){this.loadInstance()}},{key:"shouldComponentUpdate",value:function(e){return this.props!==e&&(0,a.shallowComparison)(this.props,e)}},{key:"componentDidUpdate",value:function(e){this.props.shortname!==e.shortname&&this.cleanInstance(),this.loadInstance()}},{key:"componentWillUnmount",value:function(){this.cleanInstance()}},{key:"loadInstance",value:function(){var e=window.document;e.getElementById(i.COMMENT_COUNT_SCRIPT_ID)?y():(0,a.insertScript)("https://".concat(this.props.shortname,".disqus.com/count.js"),i.COMMENT_COUNT_SCRIPT_ID,e.body)}},{key:"cleanInstance",value:function(){var e=window.document;(0,a.removeScript)(i.COMMENT_COUNT_SCRIPT_ID,e.body),window.DISQUSWIDGETS=void 0,(0,a.removeResources)()}},{key:"render",value:function(){var e=this.props,t=(e.shortname,e.config),n=e.children,o=e.className,a=u(e,["shortname","config","children","className"]),l=o?" ".concat(o):"";return r.default.createElement("span",s({},a,{className:"".concat(i.COMMENT_COUNT_CLASS).concat(l),"data-disqus-identifier":t.identifier,"data-disqus-url":t.url}),n)}}])&&m(t.prototype,n),o&&m(t,o),c}(r.default.Component);t.CommentCount=g,g.propTypes={shortname:o.default.string.isRequired,config:o.default.shape({identifier:o.default.string,url:o.default.string,title:o.default.string}).isRequired,className:o.default.string,children:o.default.node}},5890:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CommentEmbed=void 0;var r=i(n(7294)),o=i(n(5697)),a=n(7990);function i(e){return e&&e.__esModule?e:{default:e}}function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function c(){return c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c.apply(this,arguments)}function s(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function m(e,t){return m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},m(e,t)}function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=h(e);if(t){var o=h(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}var b=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}(i,e);var t,n,o,a=f(i);function i(){return u(this,i),a.apply(this,arguments)}return t=i,(n=[{key:"getSrc",value:function(){var e=Number(this.props.commentId).toString(36),t=this.props.showParentComment?"1":"0",n=this.props.showMedia?"1":"0";return"https://embed.disqus.com/p/".concat(e,"?p=").concat(t,"&m=").concat(n)}},{key:"render",value:function(){var e=this.props,t=e.width,n=e.height,o=(e.commentId,e.showMedia,e.showParentComment,s(e,["width","height","commentId","showMedia","showParentComment"]));return r.default.createElement("iframe",c({},o,{src:this.getSrc(),width:t,height:n,seamless:"seamless",scrolling:"no",frameBorder:"0"}))}}])&&d(t.prototype,n),o&&d(t,o),i}(r.default.Component);t.CommentEmbed=b,b.defaultProps={showMedia:!0,showParentComment:!0,width:a.COMMENT_EMBED_WIDTH,height:a.COMMENT_EMBED_HEIGHT},b.propTypes={commentId:o.default.string.isRequired,showMedia:o.default.bool,showParentComment:o.default.bool,width:o.default.number,height:o.default.number,className:o.default.string}},4811:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiscussionEmbed=void 0;var r=l(n(7294)),o=l(n(5697)),a=n(6674),i=n(7990);function l(e){return e&&e.__esModule?e:{default:e}}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function s(){return s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t){return f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},f(e,t)}function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=b(e);if(t){var o=b(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return h(this,n)}}function h(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}var y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(c,e);var t,n,o,l=p(c);function c(){return d(this,c),l.apply(this,arguments)}return t=c,(n=[{key:"componentDidMount",value:function(){"undefined"!=typeof window&&window.disqus_shortname&&window.disqus_shortname!==this.props.shortname&&this.cleanInstance(),this.loadInstance()}},{key:"shouldComponentUpdate",value:function(e){return this.props!==e&&(0,a.shallowComparison)(this.props,e)}},{key:"componentDidUpdate",value:function(e){this.props.shortname!==e.shortname&&this.cleanInstance(),this.loadInstance()}},{key:"componentWillUnmount",value:function(){this.cleanInstance()}},{key:"loadInstance",value:function(){var e=window.document;window&&window.DISQUS&&e.getElementById(i.EMBED_SCRIPT_ID)?window.DISQUS.reset({reload:!0,config:this.getDisqusConfig(this.props.config)}):(window.disqus_config=this.getDisqusConfig(this.props.config),window.disqus_shortname=this.props.shortname,(0,a.insertScript)("https://".concat(this.props.shortname,".disqus.com/embed.js"),i.EMBED_SCRIPT_ID,e.body))}},{key:"cleanInstance",value:function(){var e=window.document;(0,a.removeScript)(i.EMBED_SCRIPT_ID,e.body),window&&window.DISQUS&&window.DISQUS.reset({});try{delete window.DISQUS}catch(n){window.DISQUS=void 0}var t=e.getElementById(i.THREAD_ID);if(t)for(;t.hasChildNodes();)t.removeChild(t.firstChild);(0,a.removeResources)()}},{key:"getDisqusConfig",value:function(e){return function(){var t=this;this.page.identifier=e.identifier,this.page.url=e.url,this.page.title=e.title,this.page.category_id=e.categoryID,this.page.remote_auth_s3=e.remoteAuthS3,this.page.api_key=e.apiKey,e.sso&&(this.sso=e.sso),e.language&&(this.language=e.language),i.CALLBACKS.forEach((function(n){t.callbacks[n]=[e[n]]}))}}},{key:"render",value:function(){var e=this.props,t=(e.shortname,e.config,u(e,["shortname","config"]));return r.default.createElement("div",s({},t,{id:i.THREAD_ID}))}}])&&m(t.prototype,n),o&&m(t,o),c}(r.default.Component);t.DiscussionEmbed=y,y.propTypes={shortname:o.default.string.isRequired,config:o.default.shape({identifier:o.default.string,url:o.default.string,title:o.default.string,language:o.default.string,categoryID:o.default.string,remoteAuthS3:o.default.string,apiKey:o.default.string,preData:o.default.func,preInit:o.default.func,onInit:o.default.func,onReady:o.default.func,afterRender:o.default.func,preReset:o.default.func,onIdentify:o.default.func,beforeComment:o.default.func,onNewComment:o.default.func,onPaginate:o.default.func,sso:o.default.shape({name:o.default.string,button:o.default.string,icon:o.default.string,url:o.default.string,logout:o.default.string,profile_url:o.default.string,width:o.default.string,height:o.default.string})}).isRequired}},4573:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Recommendations=void 0;var r=l(n(7294)),o=l(n(5697)),a=n(6674),i=n(7990);function l(e){return e&&e.__esModule?e:{default:e}}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function s(){return s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t){return f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},f(e,t)}function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=b(e);if(t){var o=b(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return h(this,n)}}function h(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}var y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(c,e);var t,n,o,l=p(c);function c(){return d(this,c),l.apply(this,arguments)}return t=c,(n=[{key:"componentDidMount",value:function(){this.loadInstance()}},{key:"shouldComponentUpdate",value:function(e){return this.props!==e&&(0,a.shallowComparison)(this.props,e)}},{key:"componentDidUpdate",value:function(){this.loadInstance()}},{key:"componentWillUnmount",value:function(){this.cleanInstance()}},{key:"getDisqusConfig",value:function(e){return function(){this.page.identifier=e.identifier,this.page.url=e.url,this.page.title=e.title,this.language=e.language}}},{key:"loadInstance",value:function(){"undefined"!=typeof window&&window.document&&(window.disqus_config=this.getDisqusConfig(this.props.config),window.document.getElementById(i.RECOMMENDATIONS_SCRIPT_ID)?this.reloadInstance():(0,a.insertScript)("https://".concat(this.props.shortname,".disqus.com/recommendations.js"),i.RECOMMENDATIONS_SCRIPT_ID,window.document.body))}},{key:"reloadInstance",value:function(){window&&window.DISQUS_RECOMMENDATIONS&&window.DISQUS_RECOMMENDATIONS.reset({reload:!0})}},{key:"cleanInstance",value:function(){(0,a.removeScript)(i.RECOMMENDATIONS_SCRIPT_ID,window.document.body);try{delete window.DISQUS_RECOMMENDATIONS}catch(t){window.DISQUS_RECOMMENDATIONS=void 0}var e=window.document.getElementById(i.RECOMMENDATIONS_ID);if(e)for(;e.hasChildNodes();)e.removeChild(e.firstChild);(0,a.removeResources)()}},{key:"render",value:function(){var e=this.props,t=(e.shortname,e.config,u(e,["shortname","config"]));return r.default.createElement("div",s({},t,{id:i.RECOMMENDATIONS_ID}))}}])&&m(t.prototype,n),o&&m(t,o),c}(r.default.Component);t.Recommendations=y,y.propTypes={shortname:o.default.string.isRequired,config:o.default.shape({identifier:o.default.string,url:o.default.string,title:o.default.string,language:o.default.string})}},7990:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CALLBACKS=t.RECOMMENDATIONS_SCRIPT_ID=t.RECOMMENDATIONS_ID=t.COMMENT_EMBED_HEIGHT=t.COMMENT_EMBED_WIDTH=t.COMMENT_COUNT_SCRIPT_ID=t.COMMENT_COUNT_CLASS=t.EMBED_SCRIPT_ID=t.THREAD_ID=void 0;t.THREAD_ID="disqus_thread";t.EMBED_SCRIPT_ID="dsq-embed-scr";t.COMMENT_COUNT_CLASS="disqus-comment-count";t.COMMENT_COUNT_SCRIPT_ID="dsq-count-scr";t.COMMENT_EMBED_WIDTH=420;t.COMMENT_EMBED_HEIGHT=320;t.RECOMMENDATIONS_ID="disqus_recommendations";t.RECOMMENDATIONS_SCRIPT_ID="dsq-recs-scr";t.CALLBACKS=["preData","preInit","onInit","onReady","afterRender","preReset","onIdentify","beforeComment","onNewComment","onPaginate"]},3944:(e,t,n)=>{"use strict";Object.defineProperty(t,"qw",{enumerable:!0,get:function(){return a.DiscussionEmbed}});var r=n(2449),o=n(5890),a=n(4811),i=n(4573);r.CommentCount,o.CommentEmbed,a.DiscussionEmbed,i.Recommendations},6674:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.insertScript=function(e,t,n){var r=window.document.createElement("script");return r.async=!0,r.src=e,r.id=t,n.appendChild(r),r},t.removeScript=function(e,t){var n=window.document.getElementById(e);n&&t.removeChild(n)},t.removeResources=function(){window.document.querySelectorAll('link[href*="disquscdn.com/next/embed"], link[href*="disquscdn.com/next/recommendations"], link[href*="disqus.com/next/config.js"], script[src*="disquscdn.com/next/embed"], script[src*="disqus.com/count-data.js"], iframe[title="Disqus"]').forEach((function(e){return e.remove()}))},t.debounce=function(e,t,n){var r;return function(){var o=this,a=arguments,i=function(){r=null,n||e.apply(o,a)},l=n&&!r;window.clearTimeout(r),r=setTimeout(i,t),l&&e.apply(o,a)}},t.isReactElement=l,t.shallowComparison=function e(t,n){var r,o=function(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e))){var t=0,n=function(){};return{s:n,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o,a=!0,l=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw o}}}}(new Set(Object.keys(t),Object.keys(n)));try{for(o.s();!(r=o.n()).done;){var c=r.value;if("object"===a(t[c])){if(e(t[c],n[c]))return!0}else if(t[c]!==n[c]&&!l(t[c]))return!0}}catch(s){o.e(s)}finally{o.f()}return!1};var r,o=(r=n(7294))&&r.__esModule?r:{default:r};function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function l(e){return!!o.default.isValidElement(e)||!!Array.isArray(e)&&e.some((function(e){return o.default.isValidElement(e)}))}},7594:(e,t)=>{function n(e){let t,n=[];for(let r of e.split(",").map((e=>e.trim())))if(/^-?\d+$/.test(r))n.push(parseInt(r,10));else if(t=r.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/)){let[e,r,o,a]=t;if(r&&a){r=parseInt(r),a=parseInt(a);const e=r<a?1:-1;"-"!==o&&".."!==o&&"\u2025"!==o||(a+=e);for(let t=r;t!==a;t+=e)n.push(t)}}return n}t.default=n,e.exports=n}}]); \ No newline at end of file diff --git a/assets/js/2452d5f5.90d30d71.js b/assets/js/2452d5f5.90d30d71.js new file mode 100644 index 00000000..d5e2f7e9 --- /dev/null +++ b/assets/js/2452d5f5.90d30d71.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[5989],{3905:(A,a,e)=>{e.d(a,{Zo:()=>d,kt:()=>o});var t=e(7294);function n(A,a,e){return a in A?Object.defineProperty(A,a,{value:e,enumerable:!0,configurable:!0,writable:!0}):A[a]=e,A}function i(A,a){var e=Object.keys(A);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(A);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(A,a).enumerable}))),e.push.apply(e,t)}return e}function l(A){for(var a=1;a<arguments.length;a++){var e=null!=arguments[a]?arguments[a]:{};a%2?i(Object(e),!0).forEach((function(a){n(A,a,e[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(e)):i(Object(e)).forEach((function(a){Object.defineProperty(A,a,Object.getOwnPropertyDescriptor(e,a))}))}return A}function p(A,a){if(null==A)return{};var e,t,n=function(A,a){if(null==A)return{};var e,t,n={},i=Object.keys(A);for(t=0;t<i.length;t++)e=i[t],a.indexOf(e)>=0||(n[e]=A[e]);return n}(A,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(A);for(t=0;t<i.length;t++)e=i[t],a.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(A,e)&&(n[e]=A[e])}return n}var c=t.createContext({}),r=function(A){var a=t.useContext(c),e=a;return A&&(e="function"==typeof A?A(a):l(l({},a),A)),e},d=function(A){var a=r(A.components);return t.createElement(c.Provider,{value:a},A.children)},m={inlineCode:"code",wrapper:function(A){var a=A.children;return t.createElement(t.Fragment,{},a)}},u=t.forwardRef((function(A,a){var e=A.components,n=A.mdxType,i=A.originalType,c=A.parentName,d=p(A,["components","mdxType","originalType","parentName"]),u=r(e),o=n,b=u["".concat(c,".").concat(o)]||u[o]||m[o]||i;return e?t.createElement(b,l(l({ref:a},d),{},{components:e})):t.createElement(b,l({ref:a},d))}));function o(A,a){var e=arguments,n=a&&a.mdxType;if("string"==typeof A||n){var i=e.length,l=new Array(i);l[0]=u;var p={};for(var c in a)hasOwnProperty.call(a,c)&&(p[c]=a[c]);p.originalType=A,p.mdxType="string"==typeof A?A:n,l[1]=p;for(var r=2;r<i;r++)l[r]=e[r];return t.createElement.apply(null,l)}return t.createElement.apply(null,e)}u.displayName="MDXCreateElement"},831:(A,a,e)=>{e.r(a),e.d(a,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>r});var t=e(7462),n=(e(7294),e(3905));const i={sidebar_position:27,title:"A.27. Type Alias & Casting",sidebar_label:"A.27. Type Alias & Casting"},l=void 0,p={unversionedId:"basic/type-alias-casting",id:"basic/type-alias-casting",title:"A.27. Type Alias & Casting",description:"Chapter ini membahas tentang type alias dan juga casting (explicit conversion) pada tipe data primitif scalar.",source:"@site/docs/basic/type-alias-casting.md",sourceDirName:"basic",slug:"/basic/type-alias-casting",permalink:"/basic/type-alias-casting",draft:!1,tags:[],version:"current",sidebarPosition:27,frontMatter:{sidebar_position:27,title:"A.27. Type Alias & Casting",sidebar_label:"A.27. Type Alias & Casting"},sidebar:"tutorialSidebar",previous:{title:"A.26. Enum",permalink:"/basic/enum"},next:{title:"A.28. Module System \u279c Visibility & Privacy",permalink:"/basic/visibility-privacy"}},c={},r=[{value:"A.27.1. Type Alias",id:"a271-type-alias",level:2},{value:"A.27.2. Casting tipe data & alias",id:"a272-casting-tipe-data--alias",level:2},{value:"A.27.3. Casting antar tipe scalar",id:"a273-casting-antar-tipe-scalar",level:2},{value:"A.27.4. Konsekuensi casting tipe numerik",id:"a274-konsekuensi-casting-tipe-numerik",level:2},{value:"\u25c9 Module <code>std::time</code>",id:"-module-stdtime",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:r};function m(A){let{components:a,...i}=A;return(0,n.kt)("wrapper",(0,t.Z)({},d,i,{components:a,mdxType:"MDXLayout"}),(0,n.kt)("p",null,"Chapter ini membahas tentang type alias dan juga casting (explicit conversion) pada tipe data primitif scalar."),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Pembahasan mengenai conversion pada tipe data non-primitif scalar (seperti struct dan enum) dibahas pada chapter ",(0,n.kt)("a",{parentName:"p",href:"#/wip/trait-conversion-from-into"},"Trait \u279c Conversion (From & Into)"))),(0,n.kt)("h2",{id:"a271-type-alias"},"A.27.1. Type Alias"),(0,n.kt)("p",null,"Type alias adalah pemberian nama baru ke suatu tipe data. Cara pembuatan alias sangat mudah yaitu menggunakan keyword ",(0,n.kt)("inlineCode",{parentName:"p"},"type"),"."),(0,n.kt)("p",null,"Berikut adalah 2 contoh penerapan type alias untuk membuat tipe data baru:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},"type Inch = u64;\n")),(0,n.kt)("p",null,"Tipe data ",(0,n.kt)("inlineCode",{parentName:"p"},"Inch")," di atas adalah tipe baru yang merupakan alias dari tipe ",(0,n.kt)("inlineCode",{parentName:"p"},"u64"),"."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},"#[derive(Debug)]\nstruct Point {\n x: i32,\n y: i32,\n}\ntype Coordinate = Point;\n")),(0,n.kt)("p",null,"Struct ",(0,n.kt)("inlineCode",{parentName:"p"},"Point")," di atas dibuat memiliki 2 item (",(0,n.kt)("inlineCode",{parentName:"p"},"x")," dan ",(0,n.kt)("inlineCode",{parentName:"p"},"y"),"). Dari struct tersebut dibuat tipe data baru bernama ",(0,n.kt)("inlineCode",{parentName:"p"},"Coordinate")," yang merupakan alias dari ",(0,n.kt)("inlineCode",{parentName:"p"},"Point"),"."),(0,n.kt)("h2",{id:"a272-casting-tipe-data--alias"},"A.27.2. Casting tipe data & alias"),(0,n.kt)("p",null,"Casting adalah pengubahan tipe data tertentu ke tipe data lain yang keduanya masih compatible. Metode casting bisa diterapkan antara tipe data asli dan alias, dan juga antar tipe data scalar lainnya (yang memang compatible satu sama lain)."),(0,n.kt)("p",null,"Pada contoh berikut, tipe data ",(0,n.kt)("inlineCode",{parentName:"p"},"Inch")," di cast ke tipe data ",(0,n.kt)("inlineCode",{parentName:"p"},"u64")," menggunakan keyword ",(0,n.kt)("inlineCode",{parentName:"p"},"as"),"."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'let height: Inch = 6;\nprintln!("height: {height}");\n\nlet height_in_u64 = height as u64;\nprintln!("height_in_u64: {height_in_u64}");\n')),(0,n.kt)("p",null,(0,n.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Type Alias Casting",src:e(7142).Z,width:"564",height:"119"})),(0,n.kt)("p",null,"Contoh lainnya bisa dilihat pada kode berikut, variabel ",(0,n.kt)("inlineCode",{parentName:"p"},"p")," dibuat menggunakan struct ",(0,n.kt)("inlineCode",{parentName:"p"},"Point"),", kemudian di-cast ke tipe ",(0,n.kt)("inlineCode",{parentName:"p"},"Coordinate")," sebagai data mutable lalu diubah nilai itemnya, dan terakhir di-cast sekali lagi ke tipe ",(0,n.kt)("inlineCode",{parentName:"p"},"Point"),"."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'let p = Point{ x: 0, y: 10 };\nprintln!("p: {:?}", p);\n\nlet mut q: Coordinate = p as Coordinate;\nq.x = 12;\nprintln!("q: {:?}", q);\n\nlet r: Point = q as Point;\nprintln!("r: {:?}", r);\n')),(0,n.kt)("p",null,(0,n.kt)("img",{loading:"lazy",alt:"Type Alias Casting",src:e(1812).Z,width:"568",height:"136"})),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Operasi assignment dan type casting pada custom type ",(0,n.kt)("inlineCode",{parentName:"p"},"struct")," membuat owner-nya berpindah. Perpindahan owner ini disebut dengan ",(0,n.kt)("em",{parentName:"p"},"move semantics"),"."),(0,n.kt)("p",{parentName:"blockquote"},"Lebih jelasnya perihal topik ini dibahas pada chapter ",(0,n.kt)("a",{parentName:"p",href:"/basic/ownership"},"Ownership"),".")),(0,n.kt)("h2",{id:"a273-casting-antar-tipe-scalar"},"A.27.3. Casting antar tipe scalar"),(0,n.kt)("p",null,"Casting antar tipe data numerik dilakukan dengan cara yang sama seperti casting antar tipe data dan alias. Contoh:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'let number = 32;\nprintln!("number: {number}");\n\nlet number_in_u8 = number as u8;\nprintln!("number_in_u8: {number_in_u8}");\n\nlet number_in_f64 = number as f64;\nprintln!("number_in_f64: {number_in_f64}");\n\nlet new_number = 23.4 as f32;\nprintln!("new_number: {new_number}");\n')),(0,n.kt)("p",null,(0,n.kt)("img",{loading:"lazy",alt:"Type Alias Casting",src:e(487).Z,width:"567",height:"153"})),(0,n.kt)("p",null,"Tipe data integer, unsigned integer, dan floating point bisa di-cast satu sama lain."),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Selain itu, tipe ",(0,n.kt)("inlineCode",{parentName:"p"},"char")," juga bisa di-cast ke tipe lainnya (selain tipe float)")),(0,n.kt)("h2",{id:"a274-konsekuensi-casting-tipe-numerik"},"A.27.4. Konsekuensi casting tipe numerik"),(0,n.kt)("p",null,"Salah satu hal yang harus diperhatikan dalam casting adalah pemilihan tipe data beserta size yang tepat."),(0,n.kt)("p",null,"Setiap tipe data memiliki besaran alokasi memory yang berbeda. Sebagai contoh, tipe data ",(0,n.kt)("inlineCode",{parentName:"p"},"u64")," bisa menampung angka yang jauh lebih besar dibanding ",(0,n.kt)("inlineCode",{parentName:"p"},"u16"),"."),(0,n.kt)("p",null,"Bagaimana jika misalnya ada data numerik yang angkanya cukup besar dan hanya bisa ditampung pada tipe data ",(0,n.kt)("inlineCode",{parentName:"p"},"u64")," (atau tipe data lainnya yang size-nya lebih besar), kemudian tipe tersebut di-cast ke tipe data yang lebih kecil contohnya ",(0,n.kt)("inlineCode",{parentName:"p"},"u16"),"?"),(0,n.kt)("p",null,"Sebagai contoh pada kode berikut, variabel ",(0,n.kt)("inlineCode",{parentName:"p"},"timestamp")," bertipe ",(0,n.kt)("inlineCode",{parentName:"p"},"u64")," menampung data unix timestamp waktu sekarang. Data tersebut di cast ke tipe yang lebih kecil yaitu ",(0,n.kt)("inlineCode",{parentName:"p"},"u16"),"."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'use std::time::{SystemTime, UNIX_EPOCH};\n\nlet timestamp: u64 = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs();\n\nprintln!("timestamp (u64): {timestamp}");\nprintln!("timestamp (as u16): {}", timestamp as u16);\n')),(0,n.kt)("p",null,(0,n.kt)("img",{loading:"lazy",alt:"Type Alias Casting",src:e(1058).Z,width:"569",height:"119"})),(0,n.kt)("p",null,"Bisa dilihat hasilnya angka menjadi lebih kecil, ini karena ",(0,n.kt)("inlineCode",{parentName:"p"},"u16")," tidak bisa menampung nilai numerik sebesar ",(0,n.kt)("inlineCode",{parentName:"p"},"u64"),". Lalu bagaimana jika angka tersebut di-cast lagi ke tipe ",(0,n.kt)("inlineCode",{parentName:"p"},"u64"),"?"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'let timestamp: u64 = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs();\nprintln!("timestamp (u64): {timestamp}");\nprintln!("timestamp (as u16): {}", timestamp as u16);\nprintln!("from u16 back to u64: {}", (timestamp as u16) as u64);\n')),(0,n.kt)("p",null,(0,n.kt)("img",{loading:"lazy",alt:"Type Alias Casting",src:e(8993).Z,width:"569",height:"130"})),(0,n.kt)("p",null,"Hasilnya adalah nilai tetap tidak akan kembali seperti semula. Jadi silakan berhati-hati dalam melakukan operasi casting antar tipe data numerik."),(0,n.kt)("h3",{id:"-module-stdtime"},"\u25c9 Module ",(0,n.kt)("inlineCode",{parentName:"h3"},"std::time")),(0,n.kt)("p",null,(0,n.kt)("inlineCode",{parentName:"p"},"SystemTime")," dan ",(0,n.kt)("inlineCode",{parentName:"p"},"UNIX_EPOCH")," keduanya merupakan item milik module ",(0,n.kt)("inlineCode",{parentName:"p"},"std::time"),"."),(0,n.kt)("p",null,"Pengaksesan ",(0,n.kt)("inlineCode",{parentName:"p"},"SystemTime::now()")," mengembalikan data waktu sekarang, dan jika di chain dengan method ",(0,n.kt)("inlineCode",{parentName:"p"},"duration_since(UNIX_EPOCH)")," hasilnya adalah data duration bertipe ",(0,n.kt)("inlineCode",{parentName:"p"},"Result<Duration, SystemTimeError>"),"."),(0,n.kt)("p",null,"Dari data tersebut bisa kita chain lagi dengan method ",(0,n.kt)("inlineCode",{parentName:"p"},"unwrap")," dan ",(0,n.kt)("inlineCode",{parentName:"p"},"as_second")," untuk mengambil datanya dalam bentuk ",(0,n.kt)("inlineCode",{parentName:"p"},"u64"),"."),(0,n.kt)("blockquote",null,(0,n.kt)("ul",{parentName:"blockquote"},(0,n.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai module ",(0,n.kt)("inlineCode",{parentName:"li"},"std::time")," dibahas pada chapter ",(0,n.kt)("a",{parentName:"li",href:"/basic/datetime"},"DateTime")),(0,n.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai tipe data ",(0,n.kt)("inlineCode",{parentName:"li"},"Result")," dibahas pada chapter ",(0,n.kt)("a",{parentName:"li",href:"/basic/result-type"},"Tipe Data \u279c Result")))),(0,n.kt)("hr",null),(0,n.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,n.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,n.kt)("pre",null,(0,n.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/type_alias_casting"},"github.com/novalagung/dasarpemrogramanrust-example/../type_alias_casting")),(0,n.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/types/alias.html"},"https://doc.rust-lang.org/rust-by-example/types/alias.html")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/types/cast.html"},"https://doc.rust-lang.org/rust-by-example/types/cast.html"))))}m.isMDXComponent=!0},7142:(A,a,e)=>{e.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjQAAAB3CAIAAACbuk2/AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzE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AGgVAAAAWgUAAIBWAQDA+fI/fZXpdmg/zrMAAAAASUVORK5CYII="}}]); \ No newline at end of file diff --git a/assets/js/2452d5f5.c8d9088c.js b/assets/js/2452d5f5.c8d9088c.js deleted file mode 100644 index 2bda45ca..00000000 --- a/assets/js/2452d5f5.c8d9088c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[5989],{3905:(A,a,e)=>{e.d(a,{Zo:()=>d,kt:()=>o});var t=e(7294);function n(A,a,e){return a in A?Object.defineProperty(A,a,{value:e,enumerable:!0,configurable:!0,writable:!0}):A[a]=e,A}function i(A,a){var e=Object.keys(A);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(A);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(A,a).enumerable}))),e.push.apply(e,t)}return e}function l(A){for(var a=1;a<arguments.length;a++){var e=null!=arguments[a]?arguments[a]:{};a%2?i(Object(e),!0).forEach((function(a){n(A,a,e[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(e)):i(Object(e)).forEach((function(a){Object.defineProperty(A,a,Object.getOwnPropertyDescriptor(e,a))}))}return A}function p(A,a){if(null==A)return{};var e,t,n=function(A,a){if(null==A)return{};var e,t,n={},i=Object.keys(A);for(t=0;t<i.length;t++)e=i[t],a.indexOf(e)>=0||(n[e]=A[e]);return n}(A,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(A);for(t=0;t<i.length;t++)e=i[t],a.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(A,e)&&(n[e]=A[e])}return n}var c=t.createContext({}),r=function(A){var a=t.useContext(c),e=a;return A&&(e="function"==typeof A?A(a):l(l({},a),A)),e},d=function(A){var a=r(A.components);return t.createElement(c.Provider,{value:a},A.children)},m={inlineCode:"code",wrapper:function(A){var a=A.children;return t.createElement(t.Fragment,{},a)}},u=t.forwardRef((function(A,a){var e=A.components,n=A.mdxType,i=A.originalType,c=A.parentName,d=p(A,["components","mdxType","originalType","parentName"]),u=r(e),o=n,b=u["".concat(c,".").concat(o)]||u[o]||m[o]||i;return e?t.createElement(b,l(l({ref:a},d),{},{components:e})):t.createElement(b,l({ref:a},d))}));function o(A,a){var e=arguments,n=a&&a.mdxType;if("string"==typeof A||n){var i=e.length,l=new Array(i);l[0]=u;var p={};for(var c in a)hasOwnProperty.call(a,c)&&(p[c]=a[c]);p.originalType=A,p.mdxType="string"==typeof A?A:n,l[1]=p;for(var r=2;r<i;r++)l[r]=e[r];return t.createElement.apply(null,l)}return t.createElement.apply(null,e)}u.displayName="MDXCreateElement"},831:(A,a,e)=>{e.r(a),e.d(a,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>r});var t=e(7462),n=(e(7294),e(3905));const i={sidebar_position:27,title:"A.27. Type Alias & Casting",sidebar_label:"A.27. Type Alias & Casting"},l=void 0,p={unversionedId:"basic/type-alias-casting",id:"basic/type-alias-casting",title:"A.27. Type Alias & Casting",description:"Chapter ini membahas tentang type alias dan juga casting (explicit conversion) pada tipe data primitif scalar.",source:"@site/docs/basic/type-alias-casting.md",sourceDirName:"basic",slug:"/basic/type-alias-casting",permalink:"/basic/type-alias-casting",draft:!1,tags:[],version:"current",sidebarPosition:27,frontMatter:{sidebar_position:27,title:"A.27. Type Alias & Casting",sidebar_label:"A.27. Type Alias & Casting"},sidebar:"tutorialSidebar",previous:{title:"A.26. Enum",permalink:"/basic/enum"},next:{title:"A.28. Module System \u279c Visibility & Privacy",permalink:"/basic/visibility-privacy"}},c={},r=[{value:"A.27.1. Type Alias",id:"a271-type-alias",level:2},{value:"A.27.2. Casting tipe data & alias",id:"a272-casting-tipe-data--alias",level:2},{value:"A.27.3. Casting antar tipe scalar",id:"a273-casting-antar-tipe-scalar",level:2},{value:"A.27.4. Konsekuensi casting tipe numerik",id:"a274-konsekuensi-casting-tipe-numerik",level:2},{value:"\u25c9 Module <code>std::time</code>",id:"-module-stdtime",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:r};function m(A){let{components:a,...i}=A;return(0,n.kt)("wrapper",(0,t.Z)({},d,i,{components:a,mdxType:"MDXLayout"}),(0,n.kt)("p",null,"Chapter ini membahas tentang type alias dan juga casting (explicit conversion) pada tipe data primitif scalar."),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Pembahasan mengenai conversion pada tipe data non-primitif scalar (seperti struct dan enum) dibahas pada chapter ",(0,n.kt)("a",{parentName:"p",href:"#/wip/trait-conversion-from-into"},"Trait \u279c Conversion (From & Into)"))),(0,n.kt)("h2",{id:"a271-type-alias"},"A.27.1. Type Alias"),(0,n.kt)("p",null,"Type alias adalah pemberian nama baru ke suatu tipe data. Cara pembuatan alias sangat mudah yaitu menggunakan keyword ",(0,n.kt)("inlineCode",{parentName:"p"},"type"),"."),(0,n.kt)("p",null,"Berikut adalah 2 contoh penerapan type alias untuk membuat tipe data baru:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},"type Inch = u64;\n")),(0,n.kt)("p",null,"Tipe data ",(0,n.kt)("inlineCode",{parentName:"p"},"Inch")," di atas adalah tipe baru yang merupakan alias dari tipe ",(0,n.kt)("inlineCode",{parentName:"p"},"u64"),"."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},"#[derive(Debug)]\nstruct Point {\n x: i32,\n y: i32,\n}\ntype Coordinate = Point;\n")),(0,n.kt)("p",null,"Struct ",(0,n.kt)("inlineCode",{parentName:"p"},"Point")," di atas dibuat memiliki 2 item (",(0,n.kt)("inlineCode",{parentName:"p"},"x")," dan ",(0,n.kt)("inlineCode",{parentName:"p"},"y"),"). Dari struct tersebut dibuat tipe data baru bernama ",(0,n.kt)("inlineCode",{parentName:"p"},"Coordinate")," yang merupakan alias dari ",(0,n.kt)("inlineCode",{parentName:"p"},"Point"),"."),(0,n.kt)("h2",{id:"a272-casting-tipe-data--alias"},"A.27.2. Casting tipe data & alias"),(0,n.kt)("p",null,"Casting adalah pengubahan tipe data tertentu ke tipe data lain yang keduanya masih compatible. Metode casting bisa diterapkan antara tipe data asli dan alias, dan juga antar tipe data scalar lainnya (yang memang compatible satu sama lain)."),(0,n.kt)("p",null,"Pada contoh berikut, tipe data ",(0,n.kt)("inlineCode",{parentName:"p"},"Inch")," di cast ke tipe data ",(0,n.kt)("inlineCode",{parentName:"p"},"u64")," menggunakan keyword ",(0,n.kt)("inlineCode",{parentName:"p"},"as"),"."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'let height: Inch = 6;\nprintln!("height: {height}");\n\nlet height_in_u64 = height as u64;\nprintln!("height_in_u64: {height_in_u64}");\n')),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Type Alias Casting",src:e(7142).Z,width:"564",height:"119"})),(0,n.kt)("p",null,"Contoh lainnya bisa dilihat pada kode berikut, variabel ",(0,n.kt)("inlineCode",{parentName:"p"},"p")," dibuat menggunakan struct ",(0,n.kt)("inlineCode",{parentName:"p"},"Point"),", kemudian di-cast ke tipe ",(0,n.kt)("inlineCode",{parentName:"p"},"Coordinate")," sebagai data mutable lalu diubah nilai itemnya, dan terakhir di-cast sekali lagi ke tipe ",(0,n.kt)("inlineCode",{parentName:"p"},"Point"),"."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'let p = Point{ x: 0, y: 10 };\nprintln!("p: {:?}", p);\n\nlet mut q: Coordinate = p as Coordinate;\nq.x = 12;\nprintln!("q: {:?}", q);\n\nlet r: Point = q as Point;\nprintln!("r: {:?}", r);\n')),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Type Alias Casting",src:e(1812).Z,width:"568",height:"136"})),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Operasi assignment dan type casting pada custom type ",(0,n.kt)("inlineCode",{parentName:"p"},"struct")," membuat owner-nya berpindah. Perpindahan owner ini disebut dengan ",(0,n.kt)("em",{parentName:"p"},"move semantics"),"."),(0,n.kt)("p",{parentName:"blockquote"},"Lebih jelasnya perihal topik ini dibahas pada chapter ",(0,n.kt)("a",{parentName:"p",href:"/basic/ownership"},"Ownership"),".")),(0,n.kt)("h2",{id:"a273-casting-antar-tipe-scalar"},"A.27.3. Casting antar tipe scalar"),(0,n.kt)("p",null,"Casting antar tipe data numerik dilakukan dengan cara yang sama seperti casting antar tipe data dan alias. Contoh:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'let number = 32;\nprintln!("number: {number}");\n\nlet number_in_u8 = number as u8;\nprintln!("number_in_u8: {number_in_u8}");\n\nlet number_in_f64 = number as f64;\nprintln!("number_in_f64: {number_in_f64}");\n\nlet new_number = 23.4 as f32;\nprintln!("new_number: {new_number}");\n')),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Type Alias Casting",src:e(487).Z,width:"567",height:"153"})),(0,n.kt)("p",null,"Tipe data integer, unsigned integer, dan floating point bisa di-cast satu sama lain."),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Selain itu, tipe ",(0,n.kt)("inlineCode",{parentName:"p"},"char")," juga bisa di-cast ke tipe lainnya (selain tipe float)")),(0,n.kt)("h2",{id:"a274-konsekuensi-casting-tipe-numerik"},"A.27.4. Konsekuensi casting tipe numerik"),(0,n.kt)("p",null,"Salah satu hal yang harus diperhatikan dalam casting adalah pemilihan tipe data beserta size yang tepat."),(0,n.kt)("p",null,"Setiap tipe data memiliki besaran alokasi memory yang berbeda. Sebagai contoh, tipe data ",(0,n.kt)("inlineCode",{parentName:"p"},"u64")," bisa menampung angka yang jauh lebih besar dibanding ",(0,n.kt)("inlineCode",{parentName:"p"},"u16"),"."),(0,n.kt)("p",null,"Bagaimana jika misalnya ada data numerik yang angkanya cukup besar dan hanya bisa ditampung pada tipe data ",(0,n.kt)("inlineCode",{parentName:"p"},"u64")," (atau tipe data lainnya yang size-nya lebih besar), kemudian tipe tersebut di-cast ke tipe data yang lebih kecil contohnya ",(0,n.kt)("inlineCode",{parentName:"p"},"u16"),"?"),(0,n.kt)("p",null,"Sebagai contoh pada kode berikut, variabel ",(0,n.kt)("inlineCode",{parentName:"p"},"timestamp")," bertipe ",(0,n.kt)("inlineCode",{parentName:"p"},"u64")," menampung data unix timestamp waktu sekarang. Data tersebut di cast ke tipe yang lebih kecil yaitu ",(0,n.kt)("inlineCode",{parentName:"p"},"u16"),"."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'use std::time::{SystemTime, UNIX_EPOCH};\n\nlet timestamp: u64 = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs();\n\nprintln!("timestamp (u64): {timestamp}");\nprintln!("timestamp (as u16): {}", timestamp as u16);\n')),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Type Alias Casting",src:e(1058).Z,width:"569",height:"119"})),(0,n.kt)("p",null,"Bisa dilihat hasilnya angka menjadi lebih kecil, ini karena ",(0,n.kt)("inlineCode",{parentName:"p"},"u16")," tidak bisa menampung nilai numerik sebesar ",(0,n.kt)("inlineCode",{parentName:"p"},"u64"),". Lalu bagaimana jika angka tersebut di-cast lagi ke tipe ",(0,n.kt)("inlineCode",{parentName:"p"},"u64"),"?"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'let timestamp: u64 = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs();\nprintln!("timestamp (u64): {timestamp}");\nprintln!("timestamp (as u16): {}", timestamp as u16);\nprintln!("from u16 back to u64: {}", (timestamp as u16) as u64);\n')),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Type Alias Casting",src:e(8993).Z,width:"569",height:"130"})),(0,n.kt)("p",null,"Hasilnya adalah nilai tetap tidak akan kembali seperti semula. Jadi silakan berhati-hati dalam melakukan operasi casting antar tipe data numerik."),(0,n.kt)("h3",{id:"-module-stdtime"},"\u25c9 Module ",(0,n.kt)("inlineCode",{parentName:"h3"},"std::time")),(0,n.kt)("p",null,(0,n.kt)("inlineCode",{parentName:"p"},"SystemTime")," dan ",(0,n.kt)("inlineCode",{parentName:"p"},"UNIX_EPOCH")," keduanya merupakan item milik module ",(0,n.kt)("inlineCode",{parentName:"p"},"std::time"),"."),(0,n.kt)("p",null,"Pengaksesan ",(0,n.kt)("inlineCode",{parentName:"p"},"SystemTime::now()")," mengembalikan data waktu sekarang, dan jika di chain dengan method ",(0,n.kt)("inlineCode",{parentName:"p"},"duration_since(UNIX_EPOCH)")," hasilnya adalah data duration bertipe ",(0,n.kt)("inlineCode",{parentName:"p"},"Result<Duration, SystemTimeError>"),"."),(0,n.kt)("p",null,"Dari data tersebut bisa kita chain lagi dengan method ",(0,n.kt)("inlineCode",{parentName:"p"},"unwrap")," dan ",(0,n.kt)("inlineCode",{parentName:"p"},"as_second")," untuk mengambil datanya dalam bentuk ",(0,n.kt)("inlineCode",{parentName:"p"},"u64"),"."),(0,n.kt)("blockquote",null,(0,n.kt)("ul",{parentName:"blockquote"},(0,n.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai module ",(0,n.kt)("inlineCode",{parentName:"li"},"std::time")," dibahas pada chapter ",(0,n.kt)("a",{parentName:"li",href:"/basic/datetime"},"DateTime")),(0,n.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai tipe data ",(0,n.kt)("inlineCode",{parentName:"li"},"Result")," dibahas pada chapter ",(0,n.kt)("a",{parentName:"li",href:"/basic/result-type"},"Tipe Data \u279c Result")))),(0,n.kt)("hr",null),(0,n.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,n.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,n.kt)("pre",null,(0,n.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/type_alias_casting"},"github.com/novalagung/dasarpemrogramanrust-example/../type_alias_casting")),(0,n.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/types/alias.html"},"https://doc.rust-lang.org/rust-by-example/types/alias.html")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/types/cast.html"},"https://doc.rust-lang.org/rust-by-example/types/cast.html"))))}m.isMDXComponent=!0},7142:(A,a,e)=>{e.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjQAAAB3CAIAAACbuk2/AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3h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}]); \ No newline at end of file diff --git a/assets/js/2bc2e36b.12a6b370.js b/assets/js/2bc2e36b.12a6b370.js new file mode 100644 index 00000000..76f5cef5 --- /dev/null +++ b/assets/js/2bc2e36b.12a6b370.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[620],{3905:(e,n,a)=>{a.d(n,{Zo:()=>m,kt:()=>s});var t=a(7294);function i(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function l(e,n){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),a.push.apply(a,t)}return a}function r(e){for(var n=1;n<arguments.length;n++){var a=null!=arguments[n]?arguments[n]:{};n%2?l(Object(a),!0).forEach((function(n){i(e,n,a[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):l(Object(a)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(a,n))}))}return e}function p(e,n){if(null==e)return{};var a,t,i=function(e,n){if(null==e)return{};var a,t,i={},l=Object.keys(e);for(t=0;t<l.length;t++)a=l[t],n.indexOf(a)>=0||(i[a]=e[a]);return i}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t<l.length;t++)a=l[t],n.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}var u=t.createContext({}),o=function(e){var n=t.useContext(u),a=n;return e&&(a="function"==typeof e?e(n):r(r({},n),e)),a},m=function(e){var n=o(e.components);return t.createElement(u.Provider,{value:n},e.children)},k={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},d=t.forwardRef((function(e,n){var a=e.components,i=e.mdxType,l=e.originalType,u=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),d=o(a),s=i,c=d["".concat(u,".").concat(s)]||d[s]||k[s]||l;return a?t.createElement(c,r(r({ref:n},m),{},{components:a})):t.createElement(c,r({ref:n},m))}));function s(e,n){var a=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var l=a.length,r=new Array(l);r[0]=d;var p={};for(var u in n)hasOwnProperty.call(n,u)&&(p[u]=n[u]);p.originalType=e,p.mdxType="string"==typeof e?e:i,r[1]=p;for(var o=2;o<l;o++)r[o]=a[o];return t.createElement.apply(null,r)}return t.createElement.apply(null,a)}d.displayName="MDXCreateElement"},8283:(e,n,a)=>{a.r(n),a.d(n,{assets:()=>u,contentTitle:()=>r,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>o});var t=a(7462),i=(a(7294),a(3905));const l={sidebar_position:42,title:"A.42. Pattern Matching",sidebar_label:"A.42. Pattern Matching"},r=void 0,p={unversionedId:"basic/pattern-matching",id:"basic/pattern-matching",title:"A.42. Pattern Matching",description:"Chapter ini membahas tentang pattern matching, sebuah teknik yang lebih advance dibanding seleksi kondisi biasa.",source:"@site/docs/basic/pattern-matching.md",sourceDirName:"basic",slug:"/basic/pattern-matching",permalink:"/basic/pattern-matching",draft:!1,tags:[],version:"current",sidebarPosition:42,frontMatter:{sidebar_position:42,title:"A.42. Pattern Matching",sidebar_label:"A.42. Pattern Matching"},sidebar:"tutorialSidebar",previous:{title:"A.41. Operator ?",permalink:"/basic/operator-tanda-tanya"},next:{title:"A.43. Static Item",permalink:"/basic/static"}},u={},o=[{value:"A.42.1. Keyword <code>match</code>",id:"a421-keyword-match",level:2},{value:"\u25c9 Menampung nilai balik <code>match</code>",id:"-menampung-nilai-balik-match",level:3},{value:"A.42.2. Pattern matching",id:"a422-pattern-matching",level:2},{value:"\u25c9 Pengecekan nilai enum",id:"-pengecekan-nilai-enum",level:3},{value:"\u25c9 Pattern <code>|</code> dan <code>..</code>",id:"-pattern--dan-",level:3},{value:"\u25c9 Match guard",id:"-match-guard",level:3},{value:"\u25c9 Binding <code>@</code>",id:"-binding-",level:3},{value:"\u25c9 <code>if let</code>",id:"-if-let",level:3},{value:"A.42.3. Destructuring assignment",id:"a423-destructuring-assignment",level:2},{value:"\u25c9 Struct destructuring",id:"-struct-destructuring",level:3},{value:"\u25c9 Enum destructuring",id:"-enum-destructuring",level:3},{value:"\u25c9 Tuple destructuring",id:"-tuple-destructuring",level:3},{value:"\u25c9 Variabel <code>_</code>",id:"-variabel-_",level:3},{value:"\u25c9 Operator <code>..</code>",id:"-operator-",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Work in progress",id:"-work-in-progress",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:o};function k(e){let{components:n,...l}=e;return(0,i.kt)("wrapper",(0,t.Z)({},m,l,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Chapter ini membahas tentang pattern matching, sebuah teknik yang lebih ",(0,i.kt)("em",{parentName:"p"},"advance")," dibanding seleksi kondisi biasa."),(0,i.kt)("p",null,"Dalam pattern matching, pengecekan dilakukan dengan melihat kecocokan suatu pola/pattern."),(0,i.kt)("h2",{id:"a421-keyword-match"},"A.42.1. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"match")),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," digunakan untuk pattern matching. Contoh penerapan versi sederhananya bisa dilihat berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let time = "morning";\n\nmatch time {\n "morning" => println!("isuk"),\n "afternoon" => println!("awan"),\n "evening" => println!("bengi"),\n _ => println!("mbuh kapan"),\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Pattern Matching",src:a(9125).Z,width:"529",height:"90"})),(0,i.kt)("p",null,"Pada contoh di atas, ",(0,i.kt)("inlineCode",{parentName:"p"},"time")," dicek nilainya menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," dengan 4 buah klausul:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Jika value-nya ",(0,i.kt)("inlineCode",{parentName:"li"},"morning"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"isuk")),(0,i.kt)("li",{parentName:"ul"},"Jika value-nya ",(0,i.kt)("inlineCode",{parentName:"li"},"afternoon"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"awan")),(0,i.kt)("li",{parentName:"ul"},"Jika value-nya ",(0,i.kt)("inlineCode",{parentName:"li"},"evening"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"bengi")),(0,i.kt)("li",{parentName:"ul"},"Jika tidak ada yang cocok dari klausus di atas, maka tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"mbuh kapan"))),(0,i.kt)("p",null,"Contoh di atas adalah ekuivalen dengan seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let time = "morning";\n\nif time == "morning" {\n println!("isuk")\n} else if time == "afternoon" {\n println!("awan")\n} else if time == "evening" {\n println!("bengi")\n} else {\n println!("mbuh kapan")\n}\n')),(0,i.kt)("p",null,"Ada satu syarat yang harus dipenuhi dalam penerapan pattern matching, yaitu semua kondisi yang memungkinkan harus ditulis, harus lengkap. Ibarat ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," yang harus ada block ",(0,i.kt)("inlineCode",{parentName:"p"},"else"),"-nya."),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"_")," digunakan sebagai else-nya block ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),". Tanpa adanya kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"_")," maka besar kemungkinan block ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," error jika klausulnya tidak lengkap."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Pattern Matching",src:a(9310).Z,width:"755",height:"284"})),(0,i.kt)("h3",{id:"-menampung-nilai-balik-match"},"\u25c9 Menampung nilai balik ",(0,i.kt)("inlineCode",{parentName:"h3"},"match")),(0,i.kt)("p",null,"Block statement ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," bisa saja menghasilkan return value. Contohnya bisa dilihat berikut ini, hasil dari pattern matching ditampung ke variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"time_but_in_javanese"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let time = "morning";\n\nlet time_but_in_javanese = match time {\n "morning" => "isuk",\n "afternoon" => "awan",\n "evening" => "bengi",\n _ => "mbuh kapan",\n};\n\nprintln!("{time_but_in_javanese}");\n')),(0,i.kt)("h2",{id:"a422-pattern-matching"},"A.42.2. Pattern matching"),(0,i.kt)("p",null,"Contoh di atas bisa dikategorikan sebagai seleksi kondisi biasa meskipun menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),". Setelah ini kita akan pelajari macam-macam pattern/pola yang di-support dalam pattern matching di Rust."),(0,i.kt)("h3",{id:"-pengecekan-nilai-enum"},"\u25c9 Pengecekan nilai enum"),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("a",{parentName:"p",href:"/basic/option-type"},"Option")," adalah salah satu enum yang paling sering dipakai pada pattern matching. Enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Option")," memiliki 2 enum value, ",(0,i.kt)("inlineCode",{parentName:"p"},"Some")," yang merepresentasikan sebuah nilai, dan ",(0,i.kt)("inlineCode",{parentName:"p"},"None")," yang berarti tidak ada nilai."),(0,i.kt)("p",null,"Pattern matching pada enum cukup mudah, caranya bisa dilihat pada contoh berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let value: Option<i32> = Option::Some(5);\n\nmatch value {\n Some(1) => println!("one"),\n Some(2) => println!("two"),\n Some(x) => println!("{x} greater than two"),\n _ => println!("none"),\n}\n')),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"value")," nilainya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Some(5)"),". Variabel tersebut dimasukkan ke block ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," dengan 4 buah kondisi pengecekan:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Jika ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},"Some(1)"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"one")),(0,i.kt)("li",{parentName:"ul"},"Jika ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},"Some(2)"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"two")),(0,i.kt)("li",{parentName:"ul"},"Jika ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},"Some(x)"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"{x} greater than two")),(0,i.kt)("li",{parentName:"ul"},"Jika tidak ada yang cocok dari klausus di atas, maka tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"none"))),(0,i.kt)("p",null,"Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Option")," pasti berpotensi berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Some")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),", tidak mungkin selainnya. Klausul terakhir di contoh di atas (",(0,i.kt)("inlineCode",{parentName:"p"},'_ => println!("none")'),") terpenuhi ketika nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"value")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),". Pada konteks ini mengganti ",(0,i.kt)("inlineCode",{parentName:"p"},"_")," dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"None")," menjadikan klausul pada pattern matching tetap lengkap."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'match value {\n Some(1) => println!("one"),\n Some(2) => println!("two"),\n Some(x) => println!("{x} greater than two"),\n None => println!("none"),\n}\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai ",(0,i.kt)("inlineCode",{parentName:"p"},"Some")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"None")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/option-type"},"Tipe Data \u279c Option"))),(0,i.kt)("h3",{id:"-pattern--dan-"},"\u25c9 Pattern ",(0,i.kt)("inlineCode",{parentName:"h3"},"|")," dan ",(0,i.kt)("inlineCode",{parentName:"h3"},"..")),(0,i.kt)("p",null,"Klausul pattern matching bisa berisi operasi ",(0,i.kt)("inlineCode",{parentName:"p"},"OR")," maupun ",(0,i.kt)("inlineCode",{parentName:"p"},"IN")," caranya dengan memanfaatkan operator berikut:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Operator ",(0,i.kt)("inlineCode",{parentName:"li"},"|")," digunakan sebagai logika ",(0,i.kt)("inlineCode",{parentName:"li"},"OR")),(0,i.kt)("li",{parentName:"ul"},"Operator ",(0,i.kt)("inlineCode",{parentName:"li"},"..")," atau ",(0,i.kt)("inlineCode",{parentName:"li"},"..=")," digunakan sebagai logika ",(0,i.kt)("inlineCode",{parentName:"li"},"IN"))),(0,i.kt)("p",null,"Contoh penerapannya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let value = 6;\n\nmatch value {\n 1 | 2 => println!("one or two"),\n 3..=5 => println!("three through five"),\n 6 => println!("six"),\n _ => println!("other number"),\n}\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Jika ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},"1")," atau ",(0,i.kt)("inlineCode",{parentName:"li"},"2"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"one or two")),(0,i.kt)("li",{parentName:"ul"},"Jika ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," nilainya antara ",(0,i.kt)("inlineCode",{parentName:"li"},"3")," hingga ",(0,i.kt)("inlineCode",{parentName:"li"},"5"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"three through five")),(0,i.kt)("li",{parentName:"ul"},"Jika ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},"6"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"six")),(0,i.kt)("li",{parentName:"ul"},"Jika tidak ada yang cocok dari klausus di atas, maka tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"other number"))),(0,i.kt)("p",null,"Pattern di atas juga bisa diterapkan dalam variabel enum value, contohnya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let value: Option<i32> = Some(5);\n\nmatch value {\n Some(1 | 2) => println!("one or two"),\n Some(3..=5) => println!("three through five"),\n Some(6) => println!("six"),\n Some(x) => println!("{x} greater than six"),\n _ => println!("none"),\n}\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Operator ",(0,i.kt)("inlineCode",{parentName:"p"},"|")," memiliki 2 kegunaan:"),(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Pada statement biasa, fungsinya adalah untuk ",(0,i.kt)("strong",{parentName:"li"},"bitwise OR"),"."),(0,i.kt)("li",{parentName:"ul"},"Pada pattern matching, fungsinya untuk ",(0,i.kt)("strong",{parentName:"li"},"OR"),", kegunaannya sama seperti ",(0,i.kt)("inlineCode",{parentName:"li"},"||")," pada statement biasa.")),(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai bitwise operator dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/bitwise-operation"},"Bitwise Operation"))),(0,i.kt)("h3",{id:"-match-guard"},"\u25c9 Match guard"),(0,i.kt)("p",null,"Match guard adalah teknik menambahkan sub seleksi kondisi pada klausul ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),". Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let value = Some(4);\n\nlet message = match value {\n Some(x) if x % 2 == 0 => format!("number {} is even", x),\n Some(x) => format!("number {} is odd", x),\n None => String::new(),\n};\n\nprintln!("{message}");\n')),(0,i.kt)("p",null,"Klausul pertama di atas, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"Some(x)")," ditambahkan match guard ",(0,i.kt)("inlineCode",{parentName:"p"},"if x % 2 == 0"),"."),(0,i.kt)("h3",{id:"-binding-"},"\u25c9 Binding ",(0,i.kt)("inlineCode",{parentName:"h3"},"@")),(0,i.kt)("p",null,"Operator ",(0,i.kt)("inlineCode",{parentName:"p"},"@")," digunakan untuk menampung nilai klausul ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," yang default-nya tidak bisa ditampung. Agar lebih jelas, silakan pelajari pattern matching berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let value = 3;\nmatch value {\n 1 | 2 => println!("one or two"),\n 3..=5 => println!("three through five"),\n 6 => println!("six"),\n _ => println!("other number"),\n}\n')),(0,i.kt)("p",null,"Klausul ",(0,i.kt)("inlineCode",{parentName:"p"},"1 | 2")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"3..=5")," nilai by default tidak bisa diakses. Kita hanya tau bahwa nilai pasti antara ",(0,i.kt)("inlineCode",{parentName:"p"},"1")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"2")," untuk klausul ",(0,i.kt)("inlineCode",{parentName:"p"},"1 | 2"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"3 / 4 / 5")," untuk klausul ",(0,i.kt)("inlineCode",{parentName:"p"},"3..=5"),"."),(0,i.kt)("p",null,"Nilai pasti klausul tersebut bisa ditampung menggunakan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"@"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let value = 3;\nmatch value {\n n @ (1 | 2) => println!("one or two ({})", n),\n n @ 3..=5 => println!("three through five ({})", n),\n 6 => println!("six"),\n _ => println!("other number"),\n}\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Khusus untuk penggunaan ",(0,i.kt)("inlineCode",{parentName:"p"},"@")," binding pada operator ",(0,i.kt)("inlineCode",{parentName:"p"},"|"),", pada penulisan klausul seleksi kondisinya harus diapit tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"()"),".")),(0,i.kt)("h3",{id:"-if-let"},"\u25c9 ",(0,i.kt)("inlineCode",{parentName:"h3"},"if let")),(0,i.kt)("p",null,"Untuk memahami pattern matching menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"if let"),", silakan pelajari kode berikut terlebih dahulu."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let value: Option<i32> = Some(5);\n\nmatch value {\n Some(1) => println!("one"),\n Some(x) => println!("{x} greater than two"),\n _ => println!("none"),\n}\n')),(0,i.kt)("p",null,"Pattern matching di atas cukup mudah dipahami, isinya ada 2 kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Some")," dan 1 buah else (menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"_"),"). "),(0,i.kt)("p",null,"Block kode tersebut jika dikonversi ke bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," hasilnya seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let value = Some(5);\n\nif let Some(1) = value {\n println!("one");\n} else if let Some(x) = value {\n println!("{x} greater than two");\n} else {\n println!("none");\n}\n')),(0,i.kt)("p",null,"Dari sini cukup jelas kegunaan dari ",(0,i.kt)("inlineCode",{parentName:"p"},"if let"),". Meskipun menggunakan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," (bukan ",(0,i.kt)("inlineCode",{parentName:"p"},"=="),") block kode seleksi kondisi di atas adalah pattern matching, yang isinya melakukan pengecekan sama persis seperti pattern matching pada kode sebelumnya."),(0,i.kt)("p",null,"Tambahan contoh, 2 block kode berikut adalah juga ekuivalen."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let value = 6;\nmatch value {\n 1 | 2 => println!("one or two"),\n 3..=5 => println!("three through five"),\n 6 => println!("six"),\n _ => println!("other number"),\n}\n\n// ... vs ...\n\nlet value = Some(5);\nif let Some(1 | 2) = value {\n println!("one or two");\n} else if let Some(3..=5) = value {\n println!("three through five");\n} else if let Some(6) = value {\n println!("six");\n} else {\n println!("other number");\n}\n')),(0,i.kt)("h2",{id:"a423-destructuring-assignment"},"A.42.3. Destructuring assignment"),(0,i.kt)("h3",{id:"-struct-destructuring"},"\u25c9 Struct destructuring"),(0,i.kt)("p",null,"Operasi ",(0,i.kt)("em",{parentName:"p"},"destructuring")," (menampung item suatu tipe) bisa dilakukan menggunakan pattern matching."),(0,i.kt)("p",null,"Pada kode di bawah ini, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"p")," yang bertipe struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Point { x: i32, y: i32 }")," dimasukkan pada block pattern matching. Item dari struct tersebut di-",(0,i.kt)("em",{parentName:"p"},"destructure")," ke variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"y")," masing-masing klausul pattern matching item-nya ditampung ke variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"y"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'struct Point {\n x: i32,\n y: i32,\n}\n\nlet p = Point { x: 0, y: 7 };\n\nmatch p {\n Point { x, y: 0 } => println!("x axis at {x}"),\n Point { x: 0, y } => println!("y axis at {y}"),\n Point { x, y } => println!("axis: ({x}, {y})")\n}\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Jika ",(0,i.kt)("inlineCode",{parentName:"li"},"p.y")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},"0"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"x axis at {x}")),(0,i.kt)("li",{parentName:"ul"},"Jika ",(0,i.kt)("inlineCode",{parentName:"li"},"p.x")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},"0"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"y axis at {y}")),(0,i.kt)("li",{parentName:"ul"},"Jika tidak ada yang cocok dari klausus di atas, maka tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"axis: ({x}, {y})"))),(0,i.kt)("p",null,"Operasi destructuring hasilnya pasti sukses, karena alasan ini keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," boleh tidak digunakan. Contohnya bisa dilihat pada kode berikut, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"p")," di-",(0,i.kt)("em",{parentName:"p"},"destructure")," ke variabel baru yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"y"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let Point { x, y } = p;\n\nprintln!("x: {x}");\nprintln!("y: {y}");\n')),(0,i.kt)("h3",{id:"-enum-destructuring"},"\u25c9 Enum destructuring"),(0,i.kt)("p",null,"Destructuring juga bisa dilakukan pada tipe data enum caranya dengan menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," (wajib menggunakan salah satu keyword tersebut)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'enum Color {\n Black,\n White,\n Rgb(i32, i32, i32)\n}\n\nlet color = Color::Rgb(0, 160, 255);\n\nif let Color::Rgb(r, g, b) = color {\n println!("r: {r}");\n println!("g: {g}");\n println!("b: {b}");\n}\n\nmatch color {\n Color::Rgb(r, g, b) => println!("r: {r}, g: {g}, b: {b}"),\n _ => println!("other color")\n}\n')),(0,i.kt)("h3",{id:"-tuple-destructuring"},"\u25c9 Tuple destructuring"),(0,i.kt)("p",null,"Tuple bisa di-destructure secara langsung tanpa menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let grades = ("A", "B", "C");\n\nlet (grade_a, grade_b, grade_c) = grades;\nprintln!("grade_a: {grade_a}");\nprintln!("grade_b: {grade_b}");\nprintln!("grade_c: {grade_c}");\n\nmatch grades {\n (grade_a, grade_b, grade_c) => {\n println!("grade_a: {grade_a}");\n println!("grade_b: {grade_b}");\n println!("grade_c: {grade_c}");\n }\n}\n')),(0,i.kt)("h3",{id:"-variabel-_"},"\u25c9 Variabel ",(0,i.kt)("inlineCode",{parentName:"h3"},"_")),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"_")," bisa dimanfaatkan pada statement ",(0,i.kt)("em",{parentName:"p"},"destructuring")," untuk menampung item yang tidak digunakan. Contoh penerapannya bisa dilihat di bawah ini. Tuple ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," di-destructure dan hanya diambil elemen ke-2-nya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let numbers = (2, 4, 32);\n\nlet (_, second, _) = numbers;\nprintln!("second number: {second}");\n')),(0,i.kt)("h3",{id:"-operator-"},"\u25c9 Operator ",(0,i.kt)("inlineCode",{parentName:"h3"},"..")),(0,i.kt)("p",null,"Operator ",(0,i.kt)("inlineCode",{parentName:"p"},"..")," bisa digunakan untuk meng-exclude item dalam range tertentu. Sebagai contoh, tuple ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," di-destructure dan hanya diambil nilai elemen ke-1 dan terakhirnya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let numbers = (2, 4, 8, 16, 32);\n\nlet (first, .., last) = numbers;\nprintln!("first number: {first}");\nprintln!("last number: {last}");\n')),(0,i.kt)("p",null,"Opeartor ",(0,i.kt)("inlineCode",{parentName:"p"},"..")," hanya bisa digunakan pada statement destructuring di posisi tengah, awal, atau akhir (pilih salah satu). Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let (first, .., last) = numbers;\nprintln!("first number: {first}");\nprintln!("last number: {last}");\n\nlet (first, ..) = numbers;\nprintln!("first number: {first}");\n\nlet (.., last) = numbers;\nprintln!("last number: {last}");\n')),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/pattern_matching"},"github.com/novalagung/dasarpemrogramanrust-example/../pattern_matching")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/seleksi-kondisi-if"},"Seleksi Kondisi \u279c if, else if, else")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/tuple"},"Tipe Data \u279c Tuple")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/struct"},"Struct")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/enum"},"Enum")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/option-type"},"Tipe Data \u279c Option"))),(0,i.kt)("h3",{id:"-work-in-progress"},"\u25c9 Work in progress"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Pembahasan tentang ",(0,i.kt)("inlineCode",{parentName:"li"},"while let"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html"},"https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/flow_control/match.html"},"https://doc.rust-lang.org/rust-by-example/flow_control/match.html"))))}k.isMDXComponent=!0},9125:(e,n,a)=>{a.d(n,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhEAAABaCAIAAACJ/JPDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOn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qhSMCLx6nKeokHidyQv8fKyLTE2lVVOu0xBhER3xEkXYihqZCGaUGAQN8SX9T1IIgYXwBo147x4cxjN4Fg3D1+eeYP8lJvh1JRTnFeHczUGADSjCP0Myubkc1TUjDME+SldTjTj0hsDoBlvHHdsqqJgCGNTy+0j1OVcmmZ44z2LtvRaGgOgGQAAAGgGAACgGQAAgGYAAACaAQAAaAYAAKAZAAAAaAYAAKAZAACAZgAAAJoBAAAXpxnf/319ff3vx1/ZV/nrx3+jzgMAADQDAAAuXjNGg2YAALwlzWh6/ZZ/v4uHT39ojnRJTr/YmmGcFTcXAAC4QD/DEYTg182wZjSCgcMBAPBWNcMXjYRm/EAwAADermZsTiNN1tR4VDOcVAAA8AY1w9YOIwipsSnJLwEAgDenGd2MhTXd3c929weZ0AAAuHjNsNdHvdpK8Ootm9o4A1HfhXVT7Z/RDQCAS/czAAAAzQAAAEAzAAAAzQAAADQDAADQDAAAQDMAAADNAAAAQDMAAADNAAAANAMAANAMAABYG/8DiOs2Gd7BWQgAAAAASUVORK5CYII="},9310:(e,n,a)=>{a.d(n,{Z:()=>t});const t=a.p+"assets/images/pattern-matching-2-5b5fd279cb60f0d2dc3002667e49a970.png"}}]); \ No newline at end of file diff --git a/assets/js/2bc2e36b.da777af7.js b/assets/js/2bc2e36b.da777af7.js deleted file mode 100644 index 9fc9aad1..00000000 --- a/assets/js/2bc2e36b.da777af7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[620],{3905:(e,n,a)=>{a.d(n,{Zo:()=>m,kt:()=>s});var t=a(7294);function i(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function l(e,n){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),a.push.apply(a,t)}return a}function r(e){for(var n=1;n<arguments.length;n++){var a=null!=arguments[n]?arguments[n]:{};n%2?l(Object(a),!0).forEach((function(n){i(e,n,a[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):l(Object(a)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(a,n))}))}return e}function p(e,n){if(null==e)return{};var a,t,i=function(e,n){if(null==e)return{};var a,t,i={},l=Object.keys(e);for(t=0;t<l.length;t++)a=l[t],n.indexOf(a)>=0||(i[a]=e[a]);return i}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t<l.length;t++)a=l[t],n.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}var u=t.createContext({}),o=function(e){var n=t.useContext(u),a=n;return e&&(a="function"==typeof e?e(n):r(r({},n),e)),a},m=function(e){var n=o(e.components);return t.createElement(u.Provider,{value:n},e.children)},k={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},d=t.forwardRef((function(e,n){var a=e.components,i=e.mdxType,l=e.originalType,u=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),d=o(a),s=i,c=d["".concat(u,".").concat(s)]||d[s]||k[s]||l;return a?t.createElement(c,r(r({ref:n},m),{},{components:a})):t.createElement(c,r({ref:n},m))}));function s(e,n){var a=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var l=a.length,r=new Array(l);r[0]=d;var p={};for(var u in n)hasOwnProperty.call(n,u)&&(p[u]=n[u]);p.originalType=e,p.mdxType="string"==typeof e?e:i,r[1]=p;for(var o=2;o<l;o++)r[o]=a[o];return t.createElement.apply(null,r)}return t.createElement.apply(null,a)}d.displayName="MDXCreateElement"},8283:(e,n,a)=>{a.r(n),a.d(n,{assets:()=>u,contentTitle:()=>r,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>o});var t=a(7462),i=(a(7294),a(3905));const l={sidebar_position:42,title:"A.42. Pattern Matching",sidebar_label:"A.42. Pattern Matching"},r=void 0,p={unversionedId:"basic/pattern-matching",id:"basic/pattern-matching",title:"A.42. Pattern Matching",description:"Chapter ini membahas tentang pattern matching, sebuah teknik yang lebih advance dibanding seleksi kondisi biasa.",source:"@site/docs/basic/pattern-matching.md",sourceDirName:"basic",slug:"/basic/pattern-matching",permalink:"/basic/pattern-matching",draft:!1,tags:[],version:"current",sidebarPosition:42,frontMatter:{sidebar_position:42,title:"A.42. Pattern Matching",sidebar_label:"A.42. Pattern Matching"},sidebar:"tutorialSidebar",previous:{title:"A.41. Operator ?",permalink:"/basic/operator-tanda-tanya"},next:{title:"A.43. Static Item",permalink:"/basic/static"}},u={},o=[{value:"A.42.1. Keyword <code>match</code>",id:"a421-keyword-match",level:2},{value:"\u25c9 Menampung nilai balik <code>match</code>",id:"-menampung-nilai-balik-match",level:3},{value:"A.42.2. Pattern matching",id:"a422-pattern-matching",level:2},{value:"\u25c9 Pengecekan nilai enum",id:"-pengecekan-nilai-enum",level:3},{value:"\u25c9 Pattern <code>|</code> dan <code>..</code>",id:"-pattern--dan-",level:3},{value:"\u25c9 Match guard",id:"-match-guard",level:3},{value:"\u25c9 Binding <code>@</code>",id:"-binding-",level:3},{value:"\u25c9 <code>if let</code>",id:"-if-let",level:3},{value:"A.42.3. Destructuring assignment",id:"a423-destructuring-assignment",level:2},{value:"\u25c9 Struct destructuring",id:"-struct-destructuring",level:3},{value:"\u25c9 Enum destructuring",id:"-enum-destructuring",level:3},{value:"\u25c9 Tuple destructuring",id:"-tuple-destructuring",level:3},{value:"\u25c9 Variabel <code>_</code>",id:"-variabel-_",level:3},{value:"\u25c9 Operator <code>..</code>",id:"-operator-",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Work in progress",id:"-work-in-progress",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:o};function k(e){let{components:n,...l}=e;return(0,i.kt)("wrapper",(0,t.Z)({},m,l,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Chapter ini membahas tentang pattern matching, sebuah teknik yang lebih ",(0,i.kt)("em",{parentName:"p"},"advance")," dibanding seleksi kondisi biasa."),(0,i.kt)("p",null,"Dalam pattern matching, pengecekan dilakukan dengan melihat kecocokan suatu pola/pattern."),(0,i.kt)("h2",{id:"a421-keyword-match"},"A.42.1. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"match")),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," digunakan untuk pattern matching. Contoh penerapan versi sederhananya bisa dilihat berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let time = "morning";\n\nmatch time {\n "morning" => println!("isuk"),\n "afternoon" => println!("awan"),\n "evening" => println!("bengi"),\n _ => println!("mbuh kapan"),\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Pattern Matching",src:a(9125).Z,width:"529",height:"90"})),(0,i.kt)("p",null,"Pada contoh di atas, ",(0,i.kt)("inlineCode",{parentName:"p"},"time")," dicek nilainya menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," dengan 4 buah klausul:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Jika value-nya ",(0,i.kt)("inlineCode",{parentName:"li"},"morning"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"isuk")),(0,i.kt)("li",{parentName:"ul"},"Jika value-nya ",(0,i.kt)("inlineCode",{parentName:"li"},"afternoon"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"awan")),(0,i.kt)("li",{parentName:"ul"},"Jika value-nya ",(0,i.kt)("inlineCode",{parentName:"li"},"evening"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"bengi")),(0,i.kt)("li",{parentName:"ul"},"Jika tidak ada yang cocok dari klausus di atas, maka tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"mbuh kapan"))),(0,i.kt)("p",null,"Contoh di atas adalah ekuivalen dengan seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let time = "morning";\n\nif time == "morning" {\n println!("isuk")\n} else if time == "afternoon" {\n println!("awan")\n} else if time == "evening" {\n println!("bengi")\n} else {\n println!("mbuh kapan")\n}\n')),(0,i.kt)("p",null,"Ada satu syarat yang harus dipenuhi dalam penerapan pattern matching, yaitu semua kondisi yang memungkinkan harus ditulis, harus lengkap. Ibarat ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," yang harus ada block ",(0,i.kt)("inlineCode",{parentName:"p"},"else"),"-nya."),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"_")," digunakan sebagai else-nya block ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),". Tanpa adanya kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"_")," maka besar kemungkinan block ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," error jika klausulnya tidak lengkap."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Pattern Matching",src:a(9310).Z,width:"755",height:"284"})),(0,i.kt)("h3",{id:"-menampung-nilai-balik-match"},"\u25c9 Menampung nilai balik ",(0,i.kt)("inlineCode",{parentName:"h3"},"match")),(0,i.kt)("p",null,"Block statement ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," bisa saja menghasilkan return value. Contohnya bisa dilihat berikut ini, hasil dari pattern matching ditampung ke variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"time_but_in_javanese"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let time = "morning";\n\nlet time_but_in_javanese = match time {\n "morning" => "isuk",\n "afternoon" => "awan",\n "evening" => "bengi",\n _ => "mbuh kapan",\n};\n\nprintln!("{time_but_in_javanese}");\n')),(0,i.kt)("h2",{id:"a422-pattern-matching"},"A.42.2. Pattern matching"),(0,i.kt)("p",null,"Contoh di atas bisa dikategorikan sebagai seleksi kondisi biasa meskipun menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),". Setelah ini kita akan pelajari macam-macam pattern/pola yang di-support dalam pattern matching di Rust."),(0,i.kt)("h3",{id:"-pengecekan-nilai-enum"},"\u25c9 Pengecekan nilai enum"),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("a",{parentName:"p",href:"/basic/option-type"},"Option")," adalah salah satu enum yang paling sering dipakai pada pattern matching. Enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Option")," memiliki 2 enum value, ",(0,i.kt)("inlineCode",{parentName:"p"},"Some")," yang merepresentasikan sebuah nilai, dan ",(0,i.kt)("inlineCode",{parentName:"p"},"None")," yang berarti tidak ada nilai."),(0,i.kt)("p",null,"Pattern matching pada enum cukup mudah, caranya bisa dilihat pada contoh berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let value: Option<i32> = Option::Some(5);\n\nmatch value {\n Some(1) => println!("one"),\n Some(2) => println!("two"),\n Some(x) => println!("{x} greater than two"),\n _ => println!("none"),\n}\n')),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"value")," nilainya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Some(5)"),". Variabel tersebut dimasukkan ke block ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," dengan 4 buah kondisi pengecekan:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Jika ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},"Some(1)"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"one")),(0,i.kt)("li",{parentName:"ul"},"Jika ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},"Some(2)"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"two")),(0,i.kt)("li",{parentName:"ul"},"Jika ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},"Some(x)"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"{x} greater than two")),(0,i.kt)("li",{parentName:"ul"},"Jika tidak ada yang cocok dari klausus di atas, maka tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"none"))),(0,i.kt)("p",null,"Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Option")," pasti berpotensi berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Some")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),", tidak mungkin selainnya. Klausul terakhir di contoh di atas (",(0,i.kt)("inlineCode",{parentName:"p"},'_ => println!("none")'),") terpenuhi ketika nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"value")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),". Pada konteks ini mengganti ",(0,i.kt)("inlineCode",{parentName:"p"},"_")," dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"None")," menjadikan klausul pada pattern matching tetap lengkap."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'match value {\n Some(1) => println!("one"),\n Some(2) => println!("two"),\n Some(x) => println!("{x} greater than two"),\n None => println!("none"),\n}\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai ",(0,i.kt)("inlineCode",{parentName:"p"},"Some")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"None")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/option-type"},"Tipe Data \u279c Option"))),(0,i.kt)("h3",{id:"-pattern--dan-"},"\u25c9 Pattern ",(0,i.kt)("inlineCode",{parentName:"h3"},"|")," dan ",(0,i.kt)("inlineCode",{parentName:"h3"},"..")),(0,i.kt)("p",null,"Klausul pattern matching bisa berisi operasi ",(0,i.kt)("inlineCode",{parentName:"p"},"OR")," maupun ",(0,i.kt)("inlineCode",{parentName:"p"},"IN")," caranya dengan memanfaatkan operator berikut:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Operator ",(0,i.kt)("inlineCode",{parentName:"li"},"|")," digunakan sebagai logika ",(0,i.kt)("inlineCode",{parentName:"li"},"OR")),(0,i.kt)("li",{parentName:"ul"},"Operator ",(0,i.kt)("inlineCode",{parentName:"li"},"..")," atau ",(0,i.kt)("inlineCode",{parentName:"li"},"..=")," digunakan sebagai logika ",(0,i.kt)("inlineCode",{parentName:"li"},"IN"))),(0,i.kt)("p",null,"Contoh penerapannya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let value = 6;\n\nmatch value {\n 1 | 2 => println!("one or two"),\n 3..=5 => println!("three through five"),\n 6 => println!("six"),\n _ => println!("other number"),\n}\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Jika ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},"1")," atau ",(0,i.kt)("inlineCode",{parentName:"li"},"2"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"one or two")),(0,i.kt)("li",{parentName:"ul"},"Jika ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," nilainya antara ",(0,i.kt)("inlineCode",{parentName:"li"},"3")," hingga ",(0,i.kt)("inlineCode",{parentName:"li"},"5"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"three through five")),(0,i.kt)("li",{parentName:"ul"},"Jika ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},"6"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"six")),(0,i.kt)("li",{parentName:"ul"},"Jika tidak ada yang cocok dari klausus di atas, maka tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"other number"))),(0,i.kt)("p",null,"Pattern di atas juga bisa diterapkan dalam variabel enum value, contohnya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let value: Option<i32> = Some(5);\n\nmatch value {\n Some(1 | 2) => println!("one or two"),\n Some(3..=5) => println!("three through five"),\n Some(6) => println!("six"),\n Some(x) => println!("{x} greater than six"),\n _ => println!("none"),\n}\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Operator ",(0,i.kt)("inlineCode",{parentName:"p"},"|")," memiliki 2 kegunaan:"),(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Pada statement biasa, fungsinya adalah untuk ",(0,i.kt)("strong",{parentName:"li"},"bitwise OR"),"."),(0,i.kt)("li",{parentName:"ul"},"Pada pattern matching, fungsinya untuk ",(0,i.kt)("strong",{parentName:"li"},"OR"),", kegunaannya sama seperti ",(0,i.kt)("inlineCode",{parentName:"li"},"||")," pada statement biasa.")),(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai bitwise operator dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/bitwise-operation"},"Bitwise Operation"))),(0,i.kt)("h3",{id:"-match-guard"},"\u25c9 Match guard"),(0,i.kt)("p",null,"Match guard adalah teknik menambahkan sub seleksi kondisi pada klausul ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),". Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let value = Some(4);\n\nlet message = match value {\n Some(x) if x % 2 == 0 => format!("number {} is even", x),\n Some(x) => format!("number {} is odd", x),\n None => String::new(),\n};\n\nprintln!("{message}");\n')),(0,i.kt)("p",null,"Klausul pertama di atas, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"Some(x)")," ditambahkan match guard ",(0,i.kt)("inlineCode",{parentName:"p"},"if x % 2 == 0"),"."),(0,i.kt)("h3",{id:"-binding-"},"\u25c9 Binding ",(0,i.kt)("inlineCode",{parentName:"h3"},"@")),(0,i.kt)("p",null,"Operator ",(0,i.kt)("inlineCode",{parentName:"p"},"@")," digunakan untuk menampung nilai klausul ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," yang default-nya tidak bisa ditampung. Agar lebih jelas, silakan pelajari pattern matching berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let value = 3;\nmatch value {\n 1 | 2 => println!("one or two"),\n 3..=5 => println!("three through five"),\n 6 => println!("six"),\n _ => println!("other number"),\n}\n')),(0,i.kt)("p",null,"Klausul ",(0,i.kt)("inlineCode",{parentName:"p"},"1 | 2")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"3..=5")," nilai by default tidak bisa diakses. Kita hanya tau bahwa nilai pasti antara ",(0,i.kt)("inlineCode",{parentName:"p"},"1")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"2")," untuk klausul ",(0,i.kt)("inlineCode",{parentName:"p"},"1 | 2"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"3 / 4 / 5")," untuk klausul ",(0,i.kt)("inlineCode",{parentName:"p"},"3..=5"),"."),(0,i.kt)("p",null,"Nilai pasti klausul tersebut bisa ditampung menggunakan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"@"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let value = 3;\nmatch value {\n n @ (1 | 2) => println!("one or two ({})", n),\n n @ 3..=5 => println!("three through five ({})", n),\n 6 => println!("six"),\n _ => println!("other number"),\n}\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Khusus untuk penggunaan ",(0,i.kt)("inlineCode",{parentName:"p"},"@")," binding pada operator ",(0,i.kt)("inlineCode",{parentName:"p"},"|"),", pada penulisan klausul seleksi kondisinya harus diapit tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"()"),".")),(0,i.kt)("h3",{id:"-if-let"},"\u25c9 ",(0,i.kt)("inlineCode",{parentName:"h3"},"if let")),(0,i.kt)("p",null,"Untuk memahami pattern matching menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"if let"),", silakan pelajari kode berikut terlebih dahulu."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let value: Option<i32> = Some(5);\n\nmatch value {\n Some(1) => println!("one"),\n Some(x) => println!("{x} greater than two"),\n _ => println!("none"),\n}\n')),(0,i.kt)("p",null,"Pattern matching di atas cukup mudah dipahami, isinya ada 2 kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Some")," dan 1 buah else (menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"_"),"). "),(0,i.kt)("p",null,"Block kode tersebut jika dikonversi ke bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," hasilnya seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let value = Some(5);\n\nif let Some(1) = value {\n println!("one");\n} else if let Some(x) = value {\n println!("{x} greater than two");\n} else {\n println!("none");\n}\n')),(0,i.kt)("p",null,"Dari sini cukup jelas kegunaan dari ",(0,i.kt)("inlineCode",{parentName:"p"},"if let"),". Meskipun menggunakan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," (bukan ",(0,i.kt)("inlineCode",{parentName:"p"},"=="),") block kode seleksi kondisi di atas adalah pattern matching, yang isinya melakukan pengecekan sama persis seperti pattern matching pada kode sebelumnya."),(0,i.kt)("p",null,"Tambahan contoh, 2 block kode berikut adalah juga ekuivalen."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let value = 6;\nmatch value {\n 1 | 2 => println!("one or two"),\n 3..=5 => println!("three through five"),\n 6 => println!("six"),\n _ => println!("other number"),\n}\n\n// ... vs ...\n\nlet value = Some(5);\nif let Some(1 | 2) = value {\n println!("one or two");\n} else if let Some(3..=5) = value {\n println!("three through five");\n} else if let Some(6) = value {\n println!("six");\n} else {\n println!("other number");\n}\n')),(0,i.kt)("h2",{id:"a423-destructuring-assignment"},"A.42.3. Destructuring assignment"),(0,i.kt)("h3",{id:"-struct-destructuring"},"\u25c9 Struct destructuring"),(0,i.kt)("p",null,"Operasi ",(0,i.kt)("em",{parentName:"p"},"destructuring")," (menampung item suatu tipe) bisa dilakukan menggunakan pattern matching."),(0,i.kt)("p",null,"Pada kode di bawah ini, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"p")," yang bertipe struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Point { x: i32, y: i32 }")," dimasukkan pada block pattern matching. Item dari struct tersebut di-",(0,i.kt)("em",{parentName:"p"},"destructure")," ke variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"y")," masing-masing klausul pattern matching item-nya ditampung ke variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"y"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'struct Point {\n x: i32,\n y: i32,\n}\n\nlet p = Point { x: 0, y: 7 };\n\nmatch p {\n Point { x, y: 0 } => println!("x axis at {x}"),\n Point { x: 0, y } => println!("y axis at {y}"),\n Point { x, y } => println!("axis: ({x}, {y})")\n}\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Jika ",(0,i.kt)("inlineCode",{parentName:"li"},"p.y")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},"0"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"x axis at {x}")),(0,i.kt)("li",{parentName:"ul"},"Jika ",(0,i.kt)("inlineCode",{parentName:"li"},"p.x")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},"0"),", tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"y axis at {y}")),(0,i.kt)("li",{parentName:"ul"},"Jika tidak ada yang cocok dari klausus di atas, maka tampilkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"axis: ({x}, {y})"))),(0,i.kt)("p",null,"Operasi destructuring hasilnya pasti sukses, karena alasan ini keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," boleh tidak digunakan. Contohnya bisa dilihat pada kode berikut, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"p")," di-",(0,i.kt)("em",{parentName:"p"},"destructure")," ke variabel baru yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"y"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let Point { x, y } = p;\n\nprintln!("x: {x}");\nprintln!("y: {y}");\n')),(0,i.kt)("h3",{id:"-enum-destructuring"},"\u25c9 Enum destructuring"),(0,i.kt)("p",null,"Destructuring juga bisa dilakukan pada tipe data enum caranya dengan menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," (wajib menggunakan salah satu keyword tersebut)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'enum Color {\n Black,\n White,\n Rgb(i32, i32, i32)\n}\n\nlet color = Color::Rgb(0, 160, 255);\n\nif let Color::Rgb(r, g, b) = color {\n println!("r: {r}");\n println!("g: {g}");\n println!("b: {b}");\n}\n\nmatch color {\n Color::Rgb(r, g, b) => println!("r: {r}, g: {g}, b: {b}"),\n _ => println!("other color")\n}\n')),(0,i.kt)("h3",{id:"-tuple-destructuring"},"\u25c9 Tuple destructuring"),(0,i.kt)("p",null,"Tuple bisa di-destructure secara langsung tanpa menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let grades = ("A", "B", "C");\n\nlet (grade_a, grade_b, grade_c) = grades;\nprintln!("grade_a: {grade_a}");\nprintln!("grade_b: {grade_b}");\nprintln!("grade_c: {grade_c}");\n\nmatch grades {\n (grade_a, grade_b, grade_c) => {\n println!("grade_a: {grade_a}");\n println!("grade_b: {grade_b}");\n println!("grade_c: {grade_c}");\n }\n}\n')),(0,i.kt)("h3",{id:"-variabel-_"},"\u25c9 Variabel ",(0,i.kt)("inlineCode",{parentName:"h3"},"_")),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"_")," bisa dimanfaatkan pada statement ",(0,i.kt)("em",{parentName:"p"},"destructuring")," untuk menampung item yang tidak digunakan. Contoh penerapannya bisa dilihat di bawah ini. Tuple ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," di-destructure dan hanya diambil elemen ke-2-nya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let numbers = (2, 4, 32);\n\nlet (_, second, _) = numbers;\nprintln!("second number: {second}");\n')),(0,i.kt)("h3",{id:"-operator-"},"\u25c9 Operator ",(0,i.kt)("inlineCode",{parentName:"h3"},"..")),(0,i.kt)("p",null,"Operator ",(0,i.kt)("inlineCode",{parentName:"p"},"..")," bisa digunakan untuk meng-exclude item dalam range tertentu. Sebagai contoh, tuple ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," di-destructure dan hanya diambil nilai elemen ke-1 dan terakhirnya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let numbers = (2, 4, 8, 16, 32);\n\nlet (first, .., last) = numbers;\nprintln!("first number: {first}");\nprintln!("last number: {last}");\n')),(0,i.kt)("p",null,"Opeartor ",(0,i.kt)("inlineCode",{parentName:"p"},"..")," hanya bisa digunakan pada statement destructuring di posisi tengah, awal, atau akhir (pilih salah satu). Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let (first, .., last) = numbers;\nprintln!("first number: {first}");\nprintln!("last number: {last}");\n\nlet (first, ..) = numbers;\nprintln!("first number: {first}");\n\nlet (.., last) = numbers;\nprintln!("last number: {last}");\n')),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/pattern_matching"},"github.com/novalagung/dasarpemrogramanrust-example/../pattern_matching")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/seleksi-kondisi-if"},"Seleksi Kondisi \u279c if, else if, else")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/tuple"},"Tipe Data \u279c Tuple")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/struct"},"Struct")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/enum"},"Enum")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/option-type"},"Tipe Data \u279c Option"))),(0,i.kt)("h3",{id:"-work-in-progress"},"\u25c9 Work in progress"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Pembahasan tentang ",(0,i.kt)("inlineCode",{parentName:"li"},"while let"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html"},"https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/flow_control/match.html"},"https://doc.rust-lang.org/rust-by-example/flow_control/match.html"))))}k.isMDXComponent=!0},9125:(e,n,a)=>{a.d(n,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhEAAABaCAIAAACJ/JPDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTItMjFUMTI6NTE6MTArMDc6MDAiIHhtcDpN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T7Z/RDQCAS/czAAAAzQAAAEAzAAAAzQAAADQDAADQDAAAQDMAAADNAAAAQDMAAADNAAAANAMAANAMAABYG/8DiOs2Gd7BWQgAAAAASUVORK5CYII="},9310:(e,n,a)=>{a.d(n,{Z:()=>t});const t=a.p+"assets/images/pattern-matching-2-5b5fd279cb60f0d2dc3002667e49a970.png"}}]); \ No newline at end of file diff --git a/assets/js/3373.e9e6108d.js b/assets/js/3373.e9e6108d.js new file mode 100644 index 00000000..ba125d9e --- /dev/null +++ b/assets/js/3373.e9e6108d.js @@ -0,0 +1 @@ +(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[3373],{3905:(e,t,n)=>{"use strict";n.d(t,{Zo:()=>u,kt:()=>f});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=s(n),f=o,p=m["".concat(c,".").concat(f)]||m[f]||d[f]||a;return n?r.createElement(p,i(i({ref:t},u),{},{components:n})):r.createElement(p,i({ref:t},u))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var s=2;s<a;s++)i[s]=n[s];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},1262:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(7294),o=n(2389);function a(e){let{children:t,fallback:n}=e;return(0,o.Z)()?r.createElement(r.Fragment,null,null==t?void 0:t()):n??null}},4527:(e,t,n)=>{"use strict";n.d(t,{Z:()=>we});var r=n(7294),o=n(6010),a=n(5281),i=n(5130),l=n(7462),c=n(5999),s=n(6668);const u="anchorWithStickyNavbar_LWe7",d="anchorWithHideOnScrollNavbar_WYt5";function m(e){let{as:t,id:n,...a}=e;const{navbar:{hideOnScroll:i}}=(0,s.L)();return"h1"!==t&&n?r.createElement(t,(0,l.Z)({},a,{className:(0,o.Z)("anchor",i?d:u),id:n}),a.children,r.createElement("a",{className:"hash-link",href:`#${n}`,title:(0,c.I)({id:"theme.common.headingLinkTitle",message:"Direct link to heading",description:"Title for link to heading"})},"\u200b")):r.createElement(t,(0,l.Z)({},a,{id:void 0}))}var f=n(3905),p=n(5742);var h=n(2389),b=n(2949);function y(){const{prism:e}=(0,s.L)(),{colorMode:t}=(0,b.I)(),n=e.theme,r=e.darkTheme||n;return"dark"===t?r:n}var g=n(7594),v=n.n(g);const E=/title=(?<quote>["'])(?<title>.*?)\1/,w=/\{(?<range>[\d,-]+)\}/,_={js:{start:"\\/\\/",end:""},jsBlock:{start:"\\/\\*",end:"\\*\\/"},jsx:{start:"\\{\\s*\\/\\*",end:"\\*\\/\\s*\\}"},bash:{start:"#",end:""},html:{start:"\x3c!--",end:"--\x3e"}};function C(e,t){const n=e.map((e=>{const{start:n,end:r}=_[e];return`(?:${n}\\s*(${t.flatMap((e=>{var t,n;return[e.line,null==(t=e.block)?void 0:t.start,null==(n=e.block)?void 0:n.end].filter(Boolean)})).join("|")})\\s*${r})`})).join("|");return new RegExp(`^\\s*(?:${n})\\s*$`)}function k(e,t){let n=e.replace(/\n$/,"");const{language:r,magicComments:o,metastring:a}=t;if(a&&w.test(a)){const e=a.match(w).groups.range;if(0===o.length)throw new Error(`A highlight range has been given in code block's metastring (\`\`\` ${a}), but no magic comment config is available. Docusaurus applies the first magic comment entry's className for metastring ranges.`);const t=o[0].className,r=v()(e).filter((e=>e>0)).map((e=>[e-1,[t]]));return{lineClassNames:Object.fromEntries(r),code:n}}if(void 0===r)return{lineClassNames:{},code:n};const i=function(e,t){switch(e){case"js":case"javascript":case"ts":case"typescript":return C(["js","jsBlock"],t);case"jsx":case"tsx":return C(["js","jsBlock","jsx"],t);case"html":return C(["js","jsBlock","html"],t);case"python":case"py":case"bash":return C(["bash"],t);case"markdown":case"md":return C(["html","jsx","bash"],t);default:return C(Object.keys(_),t)}}(r,o),l=n.split("\n"),c=Object.fromEntries(o.map((e=>[e.className,{start:0,range:""}]))),s=Object.fromEntries(o.filter((e=>e.line)).map((e=>{let{className:t,line:n}=e;return[n,t]}))),u=Object.fromEntries(o.filter((e=>e.block)).map((e=>{let{className:t,block:n}=e;return[n.start,t]}))),d=Object.fromEntries(o.filter((e=>e.block)).map((e=>{let{className:t,block:n}=e;return[n.end,t]})));for(let f=0;f<l.length;){const e=l[f].match(i);if(!e){f+=1;continue}const t=e.slice(1).find((e=>void 0!==e));s[t]?c[s[t]].range+=`${f},`:u[t]?c[u[t]].start=f:d[t]&&(c[d[t]].range+=`${c[d[t]].start}-${f-1},`),l.splice(f,1)}n=l.join("\n");const m={};return Object.entries(c).forEach((e=>{let[t,{range:n}]=e;v()(n).forEach((e=>{m[e]??=[],m[e].push(t)}))})),{lineClassNames:m,code:n}}const N="codeBlockContainer_Ckt0";function O(e){let{as:t,...n}=e;const i=function(e){const t={color:"--prism-color",backgroundColor:"--prism-background-color"},n={};return Object.entries(e.plain).forEach((e=>{let[r,o]=e;const a=t[r];a&&"string"==typeof o&&(n[a]=o)})),n}(y());return r.createElement(t,(0,l.Z)({},n,{style:i,className:(0,o.Z)(n.className,N,a.k.common.codeBlock)}))}const S={codeBlockContent:"codeBlockContent_biex",codeBlockTitle:"codeBlockTitle_Ktv7",codeBlock:"codeBlock_bY9V",codeBlockStandalone:"codeBlockStandalone_MEMb",codeBlockLines:"codeBlockLines_e6Vv",codeBlockLinesWithNumbering:"codeBlockLinesWithNumbering_o6Pm",buttonGroup:"buttonGroup__atx"};function T(e){let{children:t,className:n}=e;return r.createElement(O,{as:"pre",tabIndex:0,className:(0,o.Z)(S.codeBlockStandalone,"thin-scrollbar",n)},r.createElement("code",{className:S.codeBlockLines},t))}var I=n(902);const L={attributes:!0,characterData:!0,childList:!0,subtree:!0};function M(e,t){const[n,o]=(0,r.useState)(),a=(0,r.useCallback)((()=>{var t;o(null==(t=e.current)?void 0:t.closest("[role=tabpanel][hidden]"))}),[e,o]);(0,r.useEffect)((()=>{a()}),[a]),function(e,t,n){void 0===n&&(n=L);const o=(0,I.zX)(t),a=(0,I.Ql)(n);(0,r.useEffect)((()=>{const t=new MutationObserver(o);return e&&t.observe(e,a),()=>t.disconnect()}),[e,o,a])}(n,(e=>{e.forEach((e=>{"attributes"===e.type&&"hidden"===e.attributeName&&(t(),a())}))}),{attributes:!0,characterData:!1,childList:!1,subtree:!1})}const D={plain:{backgroundColor:"#2a2734",color:"#9a86fd"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#6c6783"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#e09142"}},{types:["property","function"],style:{color:"#9a86fd"}},{types:["tag-id","selector","atrule-id"],style:{color:"#eeebff"}},{types:["attr-name"],style:{color:"#c4b9fe"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","atrule","placeholder","variable"],style:{color:"#ffcc99"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#c4b9fe"}}]};var j={Prism:n(7410).Z,theme:D};function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function x(){return x=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},x.apply(this,arguments)}var R=/\r\n|\r|\n/,B=function(e){0===e.length?e.push({types:["plain"],content:"\n",empty:!0}):1===e.length&&""===e[0].content&&(e[0].content="\n",e[0].empty=!0)},A=function(e,t){var n=e.length;return n>0&&e[n-1]===t?e:e.concat(t)},Z=function(e,t){var n=e.plain,r=Object.create(null),o=e.styles.reduce((function(e,n){var r=n.languages,o=n.style;return r&&!r.includes(t)||n.types.forEach((function(t){var n=x({},e[t],o);e[t]=n})),e}),r);return o.root=n,o.plain=x({},n,{backgroundColor:null}),o};function H(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&-1===t.indexOf(r)&&(n[r]=e[r]);return n}const U=function(e){function t(){for(var t=this,n=[],r=arguments.length;r--;)n[r]=arguments[r];e.apply(this,n),P(this,"getThemeDict",(function(e){if(void 0!==t.themeDict&&e.theme===t.prevTheme&&e.language===t.prevLanguage)return t.themeDict;t.prevTheme=e.theme,t.prevLanguage=e.language;var n=e.theme?Z(e.theme,e.language):void 0;return t.themeDict=n})),P(this,"getLineProps",(function(e){var n=e.key,r=e.className,o=e.style,a=x({},H(e,["key","className","style","line"]),{className:"token-line",style:void 0,key:void 0}),i=t.getThemeDict(t.props);return void 0!==i&&(a.style=i.plain),void 0!==o&&(a.style=void 0!==a.style?x({},a.style,o):o),void 0!==n&&(a.key=n),r&&(a.className+=" "+r),a})),P(this,"getStyleForToken",(function(e){var n=e.types,r=e.empty,o=n.length,a=t.getThemeDict(t.props);if(void 0!==a){if(1===o&&"plain"===n[0])return r?{display:"inline-block"}:void 0;if(1===o&&!r)return a[n[0]];var i=r?{display:"inline-block"}:{},l=n.map((function(e){return a[e]}));return Object.assign.apply(Object,[i].concat(l))}})),P(this,"getTokenProps",(function(e){var n=e.key,r=e.className,o=e.style,a=e.token,i=x({},H(e,["key","className","style","token"]),{className:"token "+a.types.join(" "),children:a.content,style:t.getStyleForToken(a),key:void 0});return void 0!==o&&(i.style=void 0!==i.style?x({},i.style,o):o),void 0!==n&&(i.key=n),r&&(i.className+=" "+r),i})),P(this,"tokenize",(function(e,t,n,r){var o={code:t,grammar:n,language:r,tokens:[]};e.hooks.run("before-tokenize",o);var a=o.tokens=e.tokenize(o.code,o.grammar,o.language);return e.hooks.run("after-tokenize",o),a}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.render=function(){var e=this.props,t=e.Prism,n=e.language,r=e.code,o=e.children,a=this.getThemeDict(this.props),i=t.languages[n];return o({tokens:function(e){for(var t=[[]],n=[e],r=[0],o=[e.length],a=0,i=0,l=[],c=[l];i>-1;){for(;(a=r[i]++)<o[i];){var s=void 0,u=t[i],d=n[i][a];if("string"==typeof d?(u=i>0?u:["plain"],s=d):(u=A(u,d.type),d.alias&&(u=A(u,d.alias)),s=d.content),"string"==typeof s){var m=s.split(R),f=m.length;l.push({types:u,content:m[0]});for(var p=1;p<f;p++)B(l),c.push(l=[]),l.push({types:u,content:m[p]})}else i++,t.push(u),n.push(s),r.push(0),o.push(s.length)}i--,t.pop(),n.pop(),r.pop(),o.pop()}return B(l),c}(void 0!==i?this.tokenize(t,r,i,n):[r]),className:"prism-code language-"+n,style:void 0!==a?a.root:{},getLineProps:this.getLineProps,getTokenProps:this.getTokenProps})},t}(r.Component),q="codeLine_lJS_",V="codeLineNumber_Tfdd",z="codeLineContent_feaV";function W(e){let{line:t,classNames:n,showLineNumbers:a,getLineProps:i,getTokenProps:c}=e;1===t.length&&"\n"===t[0].content&&(t[0].content="");const s=i({line:t,className:(0,o.Z)(n,a&&q)}),u=t.map(((e,t)=>r.createElement("span",(0,l.Z)({key:t},c({token:e,key:t})))));return r.createElement("span",s,a?r.createElement(r.Fragment,null,r.createElement("span",{className:V}),r.createElement("span",{className:z},u)):u,r.createElement("br",null))}const $={copyButtonCopied:"copyButtonCopied_obH4",copyButtonIcons:"copyButtonIcons_eSgA",copyButtonIcon:"copyButtonIcon_y97N",copyButtonSuccessIcon:"copyButtonSuccessIcon_LjdS"};function Q(e){let{code:t,className:n}=e;const[a,i]=(0,r.useState)(!1),l=(0,r.useRef)(void 0),s=(0,r.useCallback)((()=>{!function(e,t){let{target:n=document.body}=void 0===t?{}:t;const r=document.createElement("textarea"),o=document.activeElement;r.value=e,r.setAttribute("readonly",""),r.style.contain="strict",r.style.position="absolute",r.style.left="-9999px",r.style.fontSize="12pt";const a=document.getSelection();let i=!1;a.rangeCount>0&&(i=a.getRangeAt(0)),n.append(r),r.select(),r.selectionStart=0,r.selectionEnd=e.length;let l=!1;try{l=document.execCommand("copy")}catch{}r.remove(),i&&(a.removeAllRanges(),a.addRange(i)),o&&o.focus()}(t),i(!0),l.current=window.setTimeout((()=>{i(!1)}),1e3)}),[t]);return(0,r.useEffect)((()=>()=>window.clearTimeout(l.current)),[]),r.createElement("button",{type:"button","aria-label":a?(0,c.I)({id:"theme.CodeBlock.copied",message:"Copied",description:"The copied button label on code blocks"}):(0,c.I)({id:"theme.CodeBlock.copyButtonAriaLabel",message:"Copy code to clipboard",description:"The ARIA label for copy code blocks button"}),title:(0,c.I)({id:"theme.CodeBlock.copy",message:"Copy",description:"The copy button label on code blocks"}),className:(0,o.Z)("clean-btn",n,$.copyButton,a&&$.copyButtonCopied),onClick:s},r.createElement("span",{className:$.copyButtonIcons,"aria-hidden":"true"},r.createElement("svg",{className:$.copyButtonIcon,viewBox:"0 0 24 24"},r.createElement("path",{d:"M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"})),r.createElement("svg",{className:$.copyButtonSuccessIcon,viewBox:"0 0 24 24"},r.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))))}const F="wordWrapButtonIcon_Bwma",G="wordWrapButtonEnabled_EoeP";function K(e){let{className:t,onClick:n,isEnabled:a}=e;const i=(0,c.I)({id:"theme.CodeBlock.wordWrapToggle",message:"Toggle word wrap",description:"The title attribute for toggle word wrapping button of code block lines"});return r.createElement("button",{type:"button",onClick:n,className:(0,o.Z)("clean-btn",t,a&&G),"aria-label":i,title:i},r.createElement("svg",{className:F,viewBox:"0 0 24 24","aria-hidden":"true"},r.createElement("path",{fill:"currentColor",d:"M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"})))}function J(e){let{children:t,className:n="",metastring:a,title:i,showLineNumbers:c,language:u}=e;const{prism:{defaultLanguage:d,magicComments:m}}=(0,s.L)(),f=u??function(e){const t=e.split(" ").find((e=>e.startsWith("language-")));return null==t?void 0:t.replace(/language-/,"")}(n)??d,p=y(),h=function(){const[e,t]=(0,r.useState)(!1),[n,o]=(0,r.useState)(!1),a=(0,r.useRef)(null),i=(0,r.useCallback)((()=>{const n=a.current.querySelector("code");e?n.removeAttribute("style"):(n.style.whiteSpace="pre-wrap",n.style.overflowWrap="anywhere"),t((e=>!e))}),[a,e]),l=(0,r.useCallback)((()=>{const{scrollWidth:e,clientWidth:t}=a.current,n=e>t||a.current.querySelector("code").hasAttribute("style");o(n)}),[a]);return M(a,l),(0,r.useEffect)((()=>{l()}),[e,l]),(0,r.useEffect)((()=>(window.addEventListener("resize",l,{passive:!0}),()=>{window.removeEventListener("resize",l)})),[l]),{codeBlockRef:a,isEnabled:e,isCodeScrollable:n,toggle:i}}(),b=function(e){var t;return(null==e||null==(t=e.match(E))?void 0:t.groups.title)??""}(a)||i,{lineClassNames:g,code:v}=k(t,{metastring:a,language:f,magicComments:m}),w=c??function(e){return Boolean(null==e?void 0:e.includes("showLineNumbers"))}(a);return r.createElement(O,{as:"div",className:(0,o.Z)(n,f&&!n.includes(`language-${f}`)&&`language-${f}`)},b&&r.createElement("div",{className:S.codeBlockTitle},b),r.createElement("div",{className:S.codeBlockContent},r.createElement(U,(0,l.Z)({},j,{theme:p,code:v,language:f??"text"}),(e=>{let{className:t,tokens:n,getLineProps:a,getTokenProps:i}=e;return r.createElement("pre",{tabIndex:0,ref:h.codeBlockRef,className:(0,o.Z)(t,S.codeBlock,"thin-scrollbar")},r.createElement("code",{className:(0,o.Z)(S.codeBlockLines,w&&S.codeBlockLinesWithNumbering)},n.map(((e,t)=>r.createElement(W,{key:t,line:e,getLineProps:a,getTokenProps:i,classNames:g[t],showLineNumbers:w})))))})),r.createElement("div",{className:S.buttonGroup},(h.isEnabled||h.isCodeScrollable)&&r.createElement(K,{className:S.codeButton,onClick:()=>h.toggle(),isEnabled:h.isEnabled}),r.createElement(Q,{className:S.codeButton,code:v}))))}function X(e){let{children:t,...n}=e;const o=(0,h.Z)(),a=function(e){return r.Children.toArray(e).some((e=>(0,r.isValidElement)(e)))?e:Array.isArray(e)?e.join(""):e}(t),i="string"==typeof a?J:T;return r.createElement(i,(0,l.Z)({key:String(o)},n),a)}var Y=n(9960);var ee=n(6043);const te="details_lb9f",ne="isBrowser_bmU9",re="collapsibleContent_i85q";function oe(e){return!!e&&("SUMMARY"===e.tagName||oe(e.parentElement))}function ae(e,t){return!!e&&(e===t||ae(e.parentElement,t))}function ie(e){let{summary:t,children:n,...a}=e;const i=(0,h.Z)(),c=(0,r.useRef)(null),{collapsed:s,setCollapsed:u}=(0,ee.u)({initialState:!a.open}),[d,m]=(0,r.useState)(a.open);return r.createElement("details",(0,l.Z)({},a,{ref:c,open:d,"data-collapsed":s,className:(0,o.Z)(te,i&&ne,a.className),onMouseDown:e=>{oe(e.target)&&e.detail>1&&e.preventDefault()},onClick:e=>{e.stopPropagation();const t=e.target;oe(t)&&ae(t,c.current)&&(e.preventDefault(),s?(u(!1),m(!0)):u(!0))}}),t??r.createElement("summary",null,"Details"),r.createElement(ee.z,{lazy:!1,collapsed:s,disableSSRStyle:!0,onCollapseTransitionEnd:e=>{u(e),m(!e)}},r.createElement("div",{className:re},n)))}const le="details_b_Ee";function ce(e){let{...t}=e;return r.createElement(ie,(0,l.Z)({},t,{className:(0,o.Z)("alert alert--info",le,t.className)}))}function se(e){return r.createElement(m,e)}const ue="containsTaskList_mC6p";var de=n(8063);const me="admonition_LlT9",fe="admonitionHeading_tbUL",pe="admonitionIcon_kALy",he="admonitionContent_S0QG";const be={note:{infimaClassName:"secondary",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 14 16"},r.createElement("path",{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"}))},label:r.createElement(c.Z,{id:"theme.admonition.note",description:"The default label used for the Note admonition (:::note)"},"note")},tip:{infimaClassName:"success",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 12 16"},r.createElement("path",{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"}))},label:r.createElement(c.Z,{id:"theme.admonition.tip",description:"The default label used for the Tip admonition (:::tip)"},"tip")},danger:{infimaClassName:"danger",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 12 16"},r.createElement("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"}))},label:r.createElement(c.Z,{id:"theme.admonition.danger",description:"The default label used for the Danger admonition (:::danger)"},"danger")},info:{infimaClassName:"info",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 14 16"},r.createElement("path",{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))},label:r.createElement(c.Z,{id:"theme.admonition.info",description:"The default label used for the Info admonition (:::info)"},"info")},caution:{infimaClassName:"warning",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 16 16"},r.createElement("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))},label:r.createElement(c.Z,{id:"theme.admonition.caution",description:"The default label used for the Caution admonition (:::caution)"},"caution")}},ye={secondary:"note",important:"info",success:"tip",warning:"danger"};function ge(e){const{mdxAdmonitionTitle:t,rest:n}=function(e){const t=r.Children.toArray(e),n=t.find((e=>{var t;return r.isValidElement(e)&&"mdxAdmonitionTitle"===(null==(t=e.props)?void 0:t.mdxType)})),o=r.createElement(r.Fragment,null,t.filter((e=>e!==n)));return{mdxAdmonitionTitle:n,rest:o}}(e.children);return{...e,title:e.title??t,children:n}}const ve={head:function(e){const t=r.Children.map(e.children,(e=>r.isValidElement(e)?function(e){var t;if(null!=(t=e.props)&&t.mdxType&&e.props.originalType){const{mdxType:t,originalType:n,...o}=e.props;return r.createElement(e.props.originalType,o)}return e}(e):e));return r.createElement(p.Z,e,t)},code:function(e){const t=["a","abbr","b","br","button","cite","code","del","dfn","em","i","img","input","ins","kbd","label","object","output","q","ruby","s","small","span","strong","sub","sup","time","u","var","wbr"];return r.Children.toArray(e.children).every((e=>{var n;return"string"==typeof e&&!e.includes("\n")||(0,r.isValidElement)(e)&&t.includes(null==(n=e.props)?void 0:n.mdxType)}))?r.createElement("code",e):r.createElement(X,e)},a:function(e){return r.createElement(Y.Z,e)},pre:function(e){var t;return r.createElement(X,(0,r.isValidElement)(e.children)&&"code"===(null==(t=e.children.props)?void 0:t.originalType)?e.children.props:{...e})},details:function(e){const t=r.Children.toArray(e.children),n=t.find((e=>{var t;return r.isValidElement(e)&&"summary"===(null==(t=e.props)?void 0:t.mdxType)})),o=r.createElement(r.Fragment,null,t.filter((e=>e!==n)));return r.createElement(ce,(0,l.Z)({},e,{summary:n}),o)},ul:function(e){return r.createElement("ul",(0,l.Z)({},e,{className:(t=e.className,(0,o.Z)(t,(null==t?void 0:t.includes("contains-task-list"))&&ue))}));var t},img:de.Z,h1:e=>r.createElement(se,(0,l.Z)({as:"h1"},e)),h2:e=>r.createElement(se,(0,l.Z)({as:"h2"},e)),h3:e=>r.createElement(se,(0,l.Z)({as:"h3"},e)),h4:e=>r.createElement(se,(0,l.Z)({as:"h4"},e)),h5:e=>r.createElement(se,(0,l.Z)({as:"h5"},e)),h6:e=>r.createElement(se,(0,l.Z)({as:"h6"},e)),admonition:function(e){const{children:t,type:n,title:i,icon:l}=ge(e),c=function(e){const t=ye[e]??e;return be[t]||(console.warn(`No admonition config found for admonition type "${t}". Using Info as fallback.`),be.info)}(n),s=i??c.label,{iconComponent:u}=c,d=l??r.createElement(u,null);return r.createElement("div",{className:(0,o.Z)(a.k.common.admonition,a.k.common.admonitionType(e.type),"alert",`alert--${c.infimaClassName}`,me)},r.createElement("div",{className:fe},r.createElement("span",{className:pe},d),s),r.createElement("div",{className:he},t))},mermaid:()=>null};function Ee(e){let{children:t}=e;return r.createElement(f.Zo,{components:ve},t)}function we(e){let{children:t}=e;const n=function(){const{metadata:e,frontMatter:t,contentTitle:n}=(0,i.k)();return t.hide_title||void 0!==n?null:e.title}();return r.createElement("div",{className:(0,o.Z)(a.k.docs.docMarkdown,"markdown")},n&&r.createElement("header",null,r.createElement(m,{as:"h1"},n)),r.createElement(Ee,null,t))}},8234:(e,t,n)=>{"use strict";n.d(t,{Z:()=>Ne});var r=n(7294),o=n(833),a=n(5130);function i(){const{metadata:e,frontMatter:t,assets:n}=(0,a.k)();return r.createElement(o.d,{title:e.title,description:e.description,keywords:t.keywords,image:n.image??t.image})}var l=n(6010),c=n(7524),s=n(7462),u=n(5999),d=n(9960);function m(e){const{permalink:t,title:n,subLabel:o,isNext:a}=e;return r.createElement(d.Z,{className:(0,l.Z)("pagination-nav__link",a?"pagination-nav__link--next":"pagination-nav__link--prev"),to:t},o&&r.createElement("div",{className:"pagination-nav__sublabel"},o),r.createElement("div",{className:"pagination-nav__label"},n))}function f(e){const{previous:t,next:n}=e;return r.createElement("nav",{className:"pagination-nav docusaurus-mt-lg","aria-label":(0,u.I)({id:"theme.docs.paginator.navAriaLabel",message:"Docs pages navigation",description:"The ARIA label for the docs pagination"})},t&&r.createElement(m,(0,s.Z)({},t,{subLabel:r.createElement(u.Z,{id:"theme.docs.paginator.previous",description:"The label used to navigate to the previous doc"},"Previous")})),n&&r.createElement(m,(0,s.Z)({},n,{subLabel:r.createElement(u.Z,{id:"theme.docs.paginator.next",description:"The label used to navigate to the next doc"},"Next"),isNext:!0})))}function p(){const{metadata:e}=(0,a.k)();return r.createElement(f,{previous:e.previous,next:e.next})}var h=n(2263),b=n(143),y=n(5281),g=n(373),v=n(4477);const E={unreleased:function(e){let{siteTitle:t,versionMetadata:n}=e;return r.createElement(u.Z,{id:"theme.docs.versions.unreleasedVersionLabel",description:"The label used to tell the user that he's browsing an unreleased doc version",values:{siteTitle:t,versionLabel:r.createElement("b",null,n.label)}},"This is unreleased documentation for {siteTitle} {versionLabel} version.")},unmaintained:function(e){let{siteTitle:t,versionMetadata:n}=e;return r.createElement(u.Z,{id:"theme.docs.versions.unmaintainedVersionLabel",description:"The label used to tell the user that he's browsing an unmaintained doc version",values:{siteTitle:t,versionLabel:r.createElement("b",null,n.label)}},"This is documentation for {siteTitle} {versionLabel}, which is no longer actively maintained.")}};function w(e){const t=E[e.versionMetadata.banner];return r.createElement(t,e)}function _(e){let{versionLabel:t,to:n,onClick:o}=e;return r.createElement(u.Z,{id:"theme.docs.versions.latestVersionSuggestionLabel",description:"The label used to tell the user to check the latest version",values:{versionLabel:t,latestVersionLink:r.createElement("b",null,r.createElement(d.Z,{to:n,onClick:o},r.createElement(u.Z,{id:"theme.docs.versions.latestVersionLinkLabel",description:"The label used for the latest version suggestion link label"},"latest version")))}},"For up-to-date documentation, see the {latestVersionLink} ({versionLabel}).")}function C(e){let{className:t,versionMetadata:n}=e;const{siteConfig:{title:o}}=(0,h.Z)(),{pluginId:a}=(0,b.gA)({failfast:!0}),{savePreferredVersionName:i}=(0,g.J)(a),{latestDocSuggestion:c,latestVersionSuggestion:s}=(0,b.Jo)(a),u=c??(d=s).docs.find((e=>e.id===d.mainDocId));var d;return r.createElement("div",{className:(0,l.Z)(t,y.k.docs.docVersionBanner,"alert alert--warning margin-bottom--md"),role:"alert"},r.createElement("div",null,r.createElement(w,{siteTitle:o,versionMetadata:n})),r.createElement("div",{className:"margin-top--md"},r.createElement(_,{versionLabel:s.label,to:u.path,onClick:()=>i(s.name)})))}function k(e){let{className:t}=e;const n=(0,v.E)();return n.banner?r.createElement(C,{className:t,versionMetadata:n}):null}function N(e){let{className:t}=e;const n=(0,v.E)();return n.badge?r.createElement("span",{className:(0,l.Z)(t,y.k.docs.docVersionBadge,"badge badge--secondary")},r.createElement(u.Z,{id:"theme.docs.versionBadge.label",values:{versionLabel:n.label}},"Version: {versionLabel}")):null}function O(e){let{lastUpdatedAt:t,formattedLastUpdatedAt:n}=e;return r.createElement(u.Z,{id:"theme.lastUpdated.atDate",description:"The words used to describe on which date a page has been last updated",values:{date:r.createElement("b",null,r.createElement("time",{dateTime:new Date(1e3*t).toISOString()},n))}}," on {date}")}function S(e){let{lastUpdatedBy:t}=e;return r.createElement(u.Z,{id:"theme.lastUpdated.byUser",description:"The words used to describe by who the page has been last updated",values:{user:r.createElement("b",null,t)}}," by {user}")}function T(e){let{lastUpdatedAt:t,formattedLastUpdatedAt:n,lastUpdatedBy:o}=e;return r.createElement("span",{className:y.k.common.lastUpdated},r.createElement(u.Z,{id:"theme.lastUpdated.lastUpdatedAtBy",description:"The sentence used to display when a page has been last updated, and by who",values:{atDate:t&&n?r.createElement(O,{lastUpdatedAt:t,formattedLastUpdatedAt:n}):"",byUser:o?r.createElement(S,{lastUpdatedBy:o}):""}},"Last updated{atDate}{byUser}"),!1)}const I="iconEdit_Z9Sw";function L(e){let{className:t,...n}=e;return r.createElement("svg",(0,s.Z)({fill:"currentColor",height:"20",width:"20",viewBox:"0 0 40 40",className:(0,l.Z)(I,t),"aria-hidden":"true"},n),r.createElement("g",null,r.createElement("path",{d:"m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"})))}function M(e){let{editUrl:t}=e;return r.createElement("a",{href:t,target:"_blank",rel:"noreferrer noopener",className:y.k.common.editThisPage},r.createElement(L,null),r.createElement(u.Z,{id:"theme.common.editThisPage",description:"The link label to edit the current page"},"Edit this page"))}const D="tag_zVej",j="tagRegular_sFm0",P="tagWithCount_h2kH";function x(e){let{permalink:t,label:n,count:o}=e;return r.createElement(d.Z,{href:t,className:(0,l.Z)(D,o?P:j)},n,o&&r.createElement("span",null,o))}const R="tags_jXut",B="tag_QGVx";function A(e){let{tags:t}=e;return r.createElement(r.Fragment,null,r.createElement("b",null,r.createElement(u.Z,{id:"theme.tags.tagsListLabel",description:"The label alongside a tag list"},"Tags:")),r.createElement("ul",{className:(0,l.Z)(R,"padding--none","margin-left--sm")},t.map((e=>{let{label:t,permalink:n}=e;return r.createElement("li",{key:n,className:B},r.createElement(x,{label:t,permalink:n}))}))))}const Z="lastUpdated_vwxv";function H(e){return r.createElement("div",{className:(0,l.Z)(y.k.docs.docFooterTagsRow,"row margin-bottom--sm")},r.createElement("div",{className:"col"},r.createElement(A,e)))}function U(e){let{editUrl:t,lastUpdatedAt:n,lastUpdatedBy:o,formattedLastUpdatedAt:a}=e;return r.createElement("div",{className:(0,l.Z)(y.k.docs.docFooterEditMetaRow,"row")},r.createElement("div",{className:"col"},t&&r.createElement(M,{editUrl:t})),r.createElement("div",{className:(0,l.Z)("col",Z)},(n||o)&&r.createElement(T,{lastUpdatedAt:n,formattedLastUpdatedAt:a,lastUpdatedBy:o})))}function q(){const{metadata:e}=(0,a.k)(),{editUrl:t,lastUpdatedAt:n,formattedLastUpdatedAt:o,lastUpdatedBy:i,tags:c}=e,s=c.length>0,u=!!(t||n||i);return s||u?r.createElement("footer",{className:(0,l.Z)(y.k.docs.docFooter,"docusaurus-mt-lg")},s&&r.createElement(H,{tags:c}),u&&r.createElement(U,{editUrl:t,lastUpdatedAt:n,lastUpdatedBy:i,formattedLastUpdatedAt:o})):null}var V=n(6043),z=n(6668);function W(e){const t=e.map((e=>({...e,parentIndex:-1,children:[]}))),n=Array(7).fill(-1);t.forEach(((e,t)=>{const r=n.slice(2,e.level);e.parentIndex=Math.max(...r),n[e.level]=t}));const r=[];return t.forEach((e=>{const{parentIndex:n,...o}=e;n>=0?t[n].children.push(o):r.push(o)})),r}function $(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:r}=e;return t.flatMap((e=>{const t=$({toc:e.children,minHeadingLevel:n,maxHeadingLevel:r});return function(e){return e.level>=n&&e.level<=r}(e)?[{...e,children:t}]:t}))}function Q(e){const t=e.getBoundingClientRect();return t.top===t.bottom?Q(e.parentNode):t}function F(e,t){let{anchorTopOffset:n}=t;const r=e.find((e=>Q(e).top>=n));if(r){return function(e){return e.top>0&&e.bottom<window.innerHeight/2}(Q(r))?r:e[e.indexOf(r)-1]??null}return e[e.length-1]??null}function G(){const e=(0,r.useRef)(0),{navbar:{hideOnScroll:t}}=(0,z.L)();return(0,r.useEffect)((()=>{e.current=t?0:document.querySelector(".navbar").clientHeight}),[t]),e}function K(e){const t=(0,r.useRef)(void 0),n=G();(0,r.useEffect)((()=>{if(!e)return()=>{};const{linkClassName:r,linkActiveClassName:o,minHeadingLevel:a,maxHeadingLevel:i}=e;function l(){const e=function(e){return Array.from(document.getElementsByClassName(e))}(r),l=function(e){let{minHeadingLevel:t,maxHeadingLevel:n}=e;const r=[];for(let o=t;o<=n;o+=1)r.push(`h${o}.anchor`);return Array.from(document.querySelectorAll(r.join()))}({minHeadingLevel:a,maxHeadingLevel:i}),c=F(l,{anchorTopOffset:n.current}),s=e.find((e=>c&&c.id===function(e){return decodeURIComponent(e.href.substring(e.href.indexOf("#")+1))}(e)));e.forEach((e=>{!function(e,n){n?(t.current&&t.current!==e&&t.current.classList.remove(o),e.classList.add(o),t.current=e):e.classList.remove(o)}(e,e===s)}))}return document.addEventListener("scroll",l),document.addEventListener("resize",l),l(),()=>{document.removeEventListener("scroll",l),document.removeEventListener("resize",l)}}),[e,n])}function J(e){let{toc:t,className:n,linkClassName:o,isChild:a}=e;return t.length?r.createElement("ul",{className:a?void 0:n},t.map((e=>r.createElement("li",{key:e.id},r.createElement("a",{href:`#${e.id}`,className:o??void 0,dangerouslySetInnerHTML:{__html:e.value}}),r.createElement(J,{isChild:!0,toc:e.children,className:n,linkClassName:o}))))):null}const X=r.memo(J);function Y(e){let{toc:t,className:n="table-of-contents table-of-contents__left-border",linkClassName:o="table-of-contents__link",linkActiveClassName:a,minHeadingLevel:i,maxHeadingLevel:l,...c}=e;const u=(0,z.L)(),d=i??u.tableOfContents.minHeadingLevel,m=l??u.tableOfContents.maxHeadingLevel,f=function(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:o}=e;return(0,r.useMemo)((()=>$({toc:W(t),minHeadingLevel:n,maxHeadingLevel:o})),[t,n,o])}({toc:t,minHeadingLevel:d,maxHeadingLevel:m});return K((0,r.useMemo)((()=>{if(o&&a)return{linkClassName:o,linkActiveClassName:a,minHeadingLevel:d,maxHeadingLevel:m}}),[o,a,d,m])),r.createElement(X,(0,s.Z)({toc:f,className:n,linkClassName:o},c))}const ee="tocCollapsibleButton_TO0P",te="tocCollapsibleButtonExpanded_MG3E";function ne(e){let{collapsed:t,...n}=e;return r.createElement("button",(0,s.Z)({type:"button"},n,{className:(0,l.Z)("clean-btn",ee,!t&&te,n.className)}),r.createElement(u.Z,{id:"theme.TOCCollapsible.toggleButtonLabel",description:"The label used by the button on the collapsible TOC component"},"On this page"))}const re="tocCollapsible_ETCw",oe="tocCollapsibleContent_vkbj",ae="tocCollapsibleExpanded_sAul";function ie(e){let{toc:t,className:n,minHeadingLevel:o,maxHeadingLevel:a}=e;const{collapsed:i,toggleCollapsed:c}=(0,V.u)({initialState:!0});return r.createElement("div",{className:(0,l.Z)(re,!i&&ae,n)},r.createElement(ne,{collapsed:i,onClick:c}),r.createElement(V.z,{lazy:!0,className:oe,collapsed:i},r.createElement(Y,{toc:t,minHeadingLevel:o,maxHeadingLevel:a})))}const le="tocMobile_ITEo";function ce(){const{toc:e,frontMatter:t}=(0,a.k)();return r.createElement(ie,{toc:e,minHeadingLevel:t.toc_min_heading_level,maxHeadingLevel:t.toc_max_heading_level,className:(0,l.Z)(y.k.docs.docTocMobile,le)})}const se="tableOfContents_bqdL";function ue(e){let{className:t,...n}=e;return r.createElement("div",{className:(0,l.Z)(se,"thin-scrollbar",t)},r.createElement(Y,(0,s.Z)({},n,{linkClassName:"table-of-contents__link toc-highlight",linkActiveClassName:"table-of-contents__link--active"})))}function de(){const{toc:e,frontMatter:t}=(0,a.k)();return r.createElement(ue,{toc:e,minHeadingLevel:t.toc_min_heading_level,maxHeadingLevel:t.toc_max_heading_level,className:y.k.docs.docTocDesktop})}var me=n(1970),fe=n(2802),pe=n(8596),he=n(4996);function be(e){return r.createElement("svg",(0,s.Z)({viewBox:"0 0 24 24"},e),r.createElement("path",{d:"M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z",fill:"currentColor"}))}const ye={breadcrumbsContainer:"breadcrumbsContainer_Z_bl",breadcrumbHomeIcon:"breadcrumbHomeIcon_OVgt"};function ge(e){let{children:t,href:n,isLast:o}=e;const a="breadcrumbs__link";return o?r.createElement("span",{className:a,itemProp:"name"},t):n?r.createElement(d.Z,{className:a,href:n,itemProp:"item"},r.createElement("span",{itemProp:"name"},t)):r.createElement("span",{className:a},t)}function ve(e){let{children:t,active:n,index:o,addMicrodata:a}=e;return r.createElement("li",(0,s.Z)({},a&&{itemScope:!0,itemProp:"itemListElement",itemType:"https://schema.org/ListItem"},{className:(0,l.Z)("breadcrumbs__item",{"breadcrumbs__item--active":n})}),t,r.createElement("meta",{itemProp:"position",content:String(o+1)}))}function Ee(){const e=(0,he.Z)("/");return r.createElement("li",{className:"breadcrumbs__item"},r.createElement(d.Z,{"aria-label":(0,u.I)({id:"theme.docs.breadcrumbs.home",message:"Home page",description:"The ARIA label for the home page in the breadcrumbs"}),className:(0,l.Z)("breadcrumbs__link",ye.breadcrumbsItemLink),href:e},r.createElement(be,{className:ye.breadcrumbHomeIcon})))}function we(){const e=(0,fe.s1)(),t=(0,pe.Ns)();return e?r.createElement("nav",{className:(0,l.Z)(y.k.docs.docBreadcrumbs,ye.breadcrumbsContainer),"aria-label":(0,u.I)({id:"theme.docs.breadcrumbs.navAriaLabel",message:"Breadcrumbs",description:"The ARIA label for the breadcrumbs"})},r.createElement("ul",{className:"breadcrumbs",itemScope:!0,itemType:"https://schema.org/BreadcrumbList"},t&&r.createElement(Ee,null),e.map(((t,n)=>{const o=n===e.length-1;return r.createElement(ve,{key:n,active:o,index:n,addMicrodata:!!t.href},r.createElement(ge,{href:t.href,isLast:o},t.label))})))):null}const _e="docItemContainer_Djhp",Ce="docItemCol_VOVn";function ke(e){let{children:t}=e;const n=function(){const{frontMatter:e,toc:t}=(0,a.k)(),n=(0,c.i)(),o=e.hide_table_of_contents,i=!o&&t.length>0;return{hidden:o,mobile:i?r.createElement(ce,null):void 0,desktop:!i||"desktop"!==n&&"ssr"!==n?void 0:r.createElement(de,null)}}();return r.createElement("div",{className:"row"},r.createElement("div",{className:(0,l.Z)("col",!n.hidden&&Ce)},r.createElement(k,null),r.createElement("div",{className:_e},r.createElement("article",null,r.createElement(we,null),r.createElement(N,null),n.mobile,r.createElement(me.Z,null,t),r.createElement(q,null)),r.createElement(p,null))),n.desktop&&r.createElement("div",{className:"col col--3"},n.desktop))}function Ne(e){const t=`docs-doc-id-${e.content.metadata.unversionedId}`,n=e.content;return r.createElement(a.b,{content:e.content},r.createElement(o.FG,{className:t},r.createElement(i,null),r.createElement(ke,null,r.createElement(n,null))))}},5130:(e,t,n)=>{"use strict";n.d(t,{b:()=>i,k:()=>l});var r=n(7294),o=n(902);const a=r.createContext(null);function i(e){let{children:t,content:n}=e;const o=function(e){return(0,r.useMemo)((()=>({metadata:e.metadata,frontMatter:e.frontMatter,assets:e.assets,contentTitle:e.contentTitle,toc:e.toc})),[e])}(n);return r.createElement(a.Provider,{value:o},t)}function l(){const e=(0,r.useContext)(a);if(null===e)throw new o.i6("DocProvider");return e}},4477:(e,t,n)=>{"use strict";n.d(t,{E:()=>l,q:()=>i});var r=n(7294),o=n(902);const a=r.createContext(null);function i(e){let{children:t,version:n}=e;return r.createElement(a.Provider,{value:n},t)}function l(){const e=(0,r.useContext)(a);if(null===e)throw new o.i6("DocsVersionProvider");return e}},2449:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CommentCount=void 0;var r=l(n(7294)),o=l(n(5697)),a=n(6674),i=n(7990);function l(e){return e&&e.__esModule?e:{default:e}}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function s(){return s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t){return f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},f(e,t)}function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=b(e);if(t){var o=b(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return h(this,n)}}function h(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}var y=(0,a.debounce)((function(){window.DISQUSWIDGETS&&window.DISQUSWIDGETS.getCount({reset:!0})}),300,!1),g=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(c,e);var t,n,o,l=p(c);function c(){return d(this,c),l.apply(this,arguments)}return t=c,(n=[{key:"componentDidMount",value:function(){this.loadInstance()}},{key:"shouldComponentUpdate",value:function(e){return this.props!==e&&(0,a.shallowComparison)(this.props,e)}},{key:"componentDidUpdate",value:function(e){this.props.shortname!==e.shortname&&this.cleanInstance(),this.loadInstance()}},{key:"componentWillUnmount",value:function(){this.cleanInstance()}},{key:"loadInstance",value:function(){var e=window.document;e.getElementById(i.COMMENT_COUNT_SCRIPT_ID)?y():(0,a.insertScript)("https://".concat(this.props.shortname,".disqus.com/count.js"),i.COMMENT_COUNT_SCRIPT_ID,e.body)}},{key:"cleanInstance",value:function(){var e=window.document;(0,a.removeScript)(i.COMMENT_COUNT_SCRIPT_ID,e.body),window.DISQUSWIDGETS=void 0,(0,a.removeResources)()}},{key:"render",value:function(){var e=this.props,t=(e.shortname,e.config),n=e.children,o=e.className,a=u(e,["shortname","config","children","className"]),l=o?" ".concat(o):"";return r.default.createElement("span",s({},a,{className:"".concat(i.COMMENT_COUNT_CLASS).concat(l),"data-disqus-identifier":t.identifier,"data-disqus-url":t.url}),n)}}])&&m(t.prototype,n),o&&m(t,o),c}(r.default.Component);t.CommentCount=g,g.propTypes={shortname:o.default.string.isRequired,config:o.default.shape({identifier:o.default.string,url:o.default.string,title:o.default.string}).isRequired,className:o.default.string,children:o.default.node}},5890:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CommentEmbed=void 0;var r=i(n(7294)),o=i(n(5697)),a=n(7990);function i(e){return e&&e.__esModule?e:{default:e}}function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function c(){return c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c.apply(this,arguments)}function s(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function m(e,t){return m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},m(e,t)}function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=h(e);if(t){var o=h(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}var b=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}(i,e);var t,n,o,a=f(i);function i(){return u(this,i),a.apply(this,arguments)}return t=i,(n=[{key:"getSrc",value:function(){var e=Number(this.props.commentId).toString(36),t=this.props.showParentComment?"1":"0",n=this.props.showMedia?"1":"0";return"https://embed.disqus.com/p/".concat(e,"?p=").concat(t,"&m=").concat(n)}},{key:"render",value:function(){var e=this.props,t=e.width,n=e.height,o=(e.commentId,e.showMedia,e.showParentComment,s(e,["width","height","commentId","showMedia","showParentComment"]));return r.default.createElement("iframe",c({},o,{src:this.getSrc(),width:t,height:n,seamless:"seamless",scrolling:"no",frameBorder:"0"}))}}])&&d(t.prototype,n),o&&d(t,o),i}(r.default.Component);t.CommentEmbed=b,b.defaultProps={showMedia:!0,showParentComment:!0,width:a.COMMENT_EMBED_WIDTH,height:a.COMMENT_EMBED_HEIGHT},b.propTypes={commentId:o.default.string.isRequired,showMedia:o.default.bool,showParentComment:o.default.bool,width:o.default.number,height:o.default.number,className:o.default.string}},4811:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiscussionEmbed=void 0;var r=l(n(7294)),o=l(n(5697)),a=n(6674),i=n(7990);function l(e){return e&&e.__esModule?e:{default:e}}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function s(){return s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t){return f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},f(e,t)}function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=b(e);if(t){var o=b(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return h(this,n)}}function h(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}var y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(c,e);var t,n,o,l=p(c);function c(){return d(this,c),l.apply(this,arguments)}return t=c,(n=[{key:"componentDidMount",value:function(){"undefined"!=typeof window&&window.disqus_shortname&&window.disqus_shortname!==this.props.shortname&&this.cleanInstance(),this.loadInstance()}},{key:"shouldComponentUpdate",value:function(e){return this.props!==e&&(0,a.shallowComparison)(this.props,e)}},{key:"componentDidUpdate",value:function(e){this.props.shortname!==e.shortname&&this.cleanInstance(),this.loadInstance()}},{key:"componentWillUnmount",value:function(){this.cleanInstance()}},{key:"loadInstance",value:function(){var e=window.document;window&&window.DISQUS&&e.getElementById(i.EMBED_SCRIPT_ID)?window.DISQUS.reset({reload:!0,config:this.getDisqusConfig(this.props.config)}):(window.disqus_config=this.getDisqusConfig(this.props.config),window.disqus_shortname=this.props.shortname,(0,a.insertScript)("https://".concat(this.props.shortname,".disqus.com/embed.js"),i.EMBED_SCRIPT_ID,e.body))}},{key:"cleanInstance",value:function(){var e=window.document;(0,a.removeScript)(i.EMBED_SCRIPT_ID,e.body),window&&window.DISQUS&&window.DISQUS.reset({});try{delete window.DISQUS}catch(n){window.DISQUS=void 0}var t=e.getElementById(i.THREAD_ID);if(t)for(;t.hasChildNodes();)t.removeChild(t.firstChild);(0,a.removeResources)()}},{key:"getDisqusConfig",value:function(e){return function(){var t=this;this.page.identifier=e.identifier,this.page.url=e.url,this.page.title=e.title,this.page.category_id=e.categoryID,this.page.remote_auth_s3=e.remoteAuthS3,this.page.api_key=e.apiKey,e.sso&&(this.sso=e.sso),e.language&&(this.language=e.language),i.CALLBACKS.forEach((function(n){t.callbacks[n]=[e[n]]}))}}},{key:"render",value:function(){var e=this.props,t=(e.shortname,e.config,u(e,["shortname","config"]));return r.default.createElement("div",s({},t,{id:i.THREAD_ID}))}}])&&m(t.prototype,n),o&&m(t,o),c}(r.default.Component);t.DiscussionEmbed=y,y.propTypes={shortname:o.default.string.isRequired,config:o.default.shape({identifier:o.default.string,url:o.default.string,title:o.default.string,language:o.default.string,categoryID:o.default.string,remoteAuthS3:o.default.string,apiKey:o.default.string,preData:o.default.func,preInit:o.default.func,onInit:o.default.func,onReady:o.default.func,afterRender:o.default.func,preReset:o.default.func,onIdentify:o.default.func,beforeComment:o.default.func,onNewComment:o.default.func,onPaginate:o.default.func,sso:o.default.shape({name:o.default.string,button:o.default.string,icon:o.default.string,url:o.default.string,logout:o.default.string,profile_url:o.default.string,width:o.default.string,height:o.default.string})}).isRequired}},4573:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Recommendations=void 0;var r=l(n(7294)),o=l(n(5697)),a=n(6674),i=n(7990);function l(e){return e&&e.__esModule?e:{default:e}}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function s(){return s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t){return f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},f(e,t)}function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=b(e);if(t){var o=b(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return h(this,n)}}function h(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}var y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(c,e);var t,n,o,l=p(c);function c(){return d(this,c),l.apply(this,arguments)}return t=c,(n=[{key:"componentDidMount",value:function(){this.loadInstance()}},{key:"shouldComponentUpdate",value:function(e){return this.props!==e&&(0,a.shallowComparison)(this.props,e)}},{key:"componentDidUpdate",value:function(){this.loadInstance()}},{key:"componentWillUnmount",value:function(){this.cleanInstance()}},{key:"getDisqusConfig",value:function(e){return function(){this.page.identifier=e.identifier,this.page.url=e.url,this.page.title=e.title,this.language=e.language}}},{key:"loadInstance",value:function(){"undefined"!=typeof window&&window.document&&(window.disqus_config=this.getDisqusConfig(this.props.config),window.document.getElementById(i.RECOMMENDATIONS_SCRIPT_ID)?this.reloadInstance():(0,a.insertScript)("https://".concat(this.props.shortname,".disqus.com/recommendations.js"),i.RECOMMENDATIONS_SCRIPT_ID,window.document.body))}},{key:"reloadInstance",value:function(){window&&window.DISQUS_RECOMMENDATIONS&&window.DISQUS_RECOMMENDATIONS.reset({reload:!0})}},{key:"cleanInstance",value:function(){(0,a.removeScript)(i.RECOMMENDATIONS_SCRIPT_ID,window.document.body);try{delete window.DISQUS_RECOMMENDATIONS}catch(t){window.DISQUS_RECOMMENDATIONS=void 0}var e=window.document.getElementById(i.RECOMMENDATIONS_ID);if(e)for(;e.hasChildNodes();)e.removeChild(e.firstChild);(0,a.removeResources)()}},{key:"render",value:function(){var e=this.props,t=(e.shortname,e.config,u(e,["shortname","config"]));return r.default.createElement("div",s({},t,{id:i.RECOMMENDATIONS_ID}))}}])&&m(t.prototype,n),o&&m(t,o),c}(r.default.Component);t.Recommendations=y,y.propTypes={shortname:o.default.string.isRequired,config:o.default.shape({identifier:o.default.string,url:o.default.string,title:o.default.string,language:o.default.string})}},7990:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CALLBACKS=t.RECOMMENDATIONS_SCRIPT_ID=t.RECOMMENDATIONS_ID=t.COMMENT_EMBED_HEIGHT=t.COMMENT_EMBED_WIDTH=t.COMMENT_COUNT_SCRIPT_ID=t.COMMENT_COUNT_CLASS=t.EMBED_SCRIPT_ID=t.THREAD_ID=void 0;t.THREAD_ID="disqus_thread";t.EMBED_SCRIPT_ID="dsq-embed-scr";t.COMMENT_COUNT_CLASS="disqus-comment-count";t.COMMENT_COUNT_SCRIPT_ID="dsq-count-scr";t.COMMENT_EMBED_WIDTH=420;t.COMMENT_EMBED_HEIGHT=320;t.RECOMMENDATIONS_ID="disqus_recommendations";t.RECOMMENDATIONS_SCRIPT_ID="dsq-recs-scr";t.CALLBACKS=["preData","preInit","onInit","onReady","afterRender","preReset","onIdentify","beforeComment","onNewComment","onPaginate"]},3944:(e,t,n)=>{"use strict";Object.defineProperty(t,"qw",{enumerable:!0,get:function(){return a.DiscussionEmbed}});var r=n(2449),o=n(5890),a=n(4811),i=n(4573);r.CommentCount,o.CommentEmbed,a.DiscussionEmbed,i.Recommendations},6674:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.insertScript=function(e,t,n){var r=window.document.createElement("script");return r.async=!0,r.src=e,r.id=t,n.appendChild(r),r},t.removeScript=function(e,t){var n=window.document.getElementById(e);n&&t.removeChild(n)},t.removeResources=function(){window.document.querySelectorAll('link[href*="disquscdn.com/next/embed"], link[href*="disquscdn.com/next/recommendations"], link[href*="disqus.com/next/config.js"], script[src*="disquscdn.com/next/embed"], script[src*="disqus.com/count-data.js"], iframe[title="Disqus"]').forEach((function(e){return e.remove()}))},t.debounce=function(e,t,n){var r;return function(){var o=this,a=arguments,i=function(){r=null,n||e.apply(o,a)},l=n&&!r;window.clearTimeout(r),r=setTimeout(i,t),l&&e.apply(o,a)}},t.isReactElement=l,t.shallowComparison=function e(t,n){var r,o=function(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e))){var t=0,n=function(){};return{s:n,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o,a=!0,l=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw o}}}}(new Set(Object.keys(t),Object.keys(n)));try{for(o.s();!(r=o.n()).done;){var c=r.value;if("object"===a(t[c])){if(e(t[c],n[c]))return!0}else if(t[c]!==n[c]&&!l(t[c]))return!0}}catch(s){o.e(s)}finally{o.f()}return!1};var r,o=(r=n(7294))&&r.__esModule?r:{default:r};function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function l(e){return!!o.default.isValidElement(e)||!!Array.isArray(e)&&e.some((function(e){return o.default.isValidElement(e)}))}},7594:(e,t)=>{function n(e){let t,n=[];for(let r of e.split(",").map((e=>e.trim())))if(/^-?\d+$/.test(r))n.push(parseInt(r,10));else if(t=r.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/)){let[e,r,o,a]=t;if(r&&a){r=parseInt(r),a=parseInt(a);const e=r<a?1:-1;"-"!==o&&".."!==o&&"\u2025"!==o||(a+=e);for(let t=r;t!==a;t+=e)n.push(t)}}return n}t.default=n,e.exports=n}}]); \ No newline at end of file diff --git a/assets/js/388041ab.64babc7e.js b/assets/js/388041ab.64babc7e.js deleted file mode 100644 index 21bea0ae..00000000 --- a/assets/js/388041ab.64babc7e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[1494],{3905:(a,e,r)=>{r.d(e,{Zo:()=>s,kt:()=>d});var n=r(7294);function t(a,e,r){return e in a?Object.defineProperty(a,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):a[e]=r,a}function i(a,e){var r=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),r.push.apply(r,n)}return r}function l(a){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){t(a,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(r,e))}))}return a}function o(a,e){if(null==a)return{};var r,n,t=function(a,e){if(null==a)return{};var r,n,t={},i=Object.keys(a);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(t[r]=a[r]);return t}(a,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(a,r)&&(t[r]=a[r])}return t}var p=n.createContext({}),u=function(a){var e=n.useContext(p),r=e;return a&&(r="function"==typeof a?a(e):l(l({},e),a)),r},s=function(a){var e=u(a.components);return n.createElement(p.Provider,{value:e},a.children)},k={inlineCode:"code",wrapper:function(a){var e=a.children;return n.createElement(n.Fragment,{},e)}},m=n.forwardRef((function(a,e){var r=a.components,t=a.mdxType,i=a.originalType,p=a.parentName,s=o(a,["components","mdxType","originalType","parentName"]),m=u(r),d=t,c=m["".concat(p,".").concat(d)]||m[d]||k[d]||i;return r?n.createElement(c,l(l({ref:e},s),{},{components:r})):n.createElement(c,l({ref:e},s))}));function d(a,e){var r=arguments,t=e&&e.mdxType;if("string"==typeof a||t){var i=r.length,l=new Array(i);l[0]=m;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=a,o.mdxType="string"==typeof a?a:t,l[1]=o;for(var u=2;u<i;u++)l[u]=r[u];return n.createElement.apply(null,l)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},395:(a,e,r)=>{r.r(e),r.d(e,{assets:()=>p,contentTitle:()=>l,default:()=>k,frontMatter:()=>i,metadata:()=>o,toc:()=>u});var n=r(7462),t=(r(7294),r(3905));const i={sidebar_position:54,title:"A.54. Error \u279c Unrecoverable Error / Panic",sidebar_label:"A.54. Error \u279c Unrecoverable Error / Panic"},l=void 0,o={unversionedId:"basic/unrecoverable-panic-error",id:"basic/unrecoverable-panic-error",title:"A.54. Error \u279c Unrecoverable Error / Panic",description:"Error handling atau penanganan error adalah salah satu aspek penting dalam pemrograman selalu umum. Rust mengenal 2 jenis error yaitu unrecoverable error (panic error) dan recoverable error. Pembahasan chapter ini fokus pada unrecoverable error atau panic error.",source:"@site/docs/basic/unrecoverable-panic-error.md",sourceDirName:"basic",slug:"/basic/unrecoverable-panic-error",permalink:"/basic/unrecoverable-panic-error",draft:!1,tags:[],version:"current",sidebarPosition:54,frontMatter:{sidebar_position:54,title:"A.54. Error \u279c Unrecoverable Error / Panic",sidebar_label:"A.54. Error \u279c Unrecoverable Error / Panic"},sidebar:"tutorialSidebar",previous:{title:"A.53. File, Path, Directory",permalink:"/basic/file-path-directory"},next:{title:"A.55. Error \u279c Recoverable Error & Error Handling",permalink:"/basic/recoverable-error-handling"}},p={},u=[{value:"A.54.1. Unrecoverable error (RUNTIME error & COMPILE-TIME error)",id:"a541-unrecoverable-error-runtime-error--compile-time-error",level:2},{value:"\u25c9 Perbedaan panic saat pengaksesan vector dan error saat pengaksesan array",id:"-perbedaan-panic-saat-pengaksesan-vector-dan-error-saat-pengaksesan-array",level:3},{value:"A.54.2. Macro <code>panic!()</code>",id:"a542-macro-panic",level:2},{value:"\u25c9 Statement <code>io::stdout().flush()</code>",id:"-statement-iostdoutflush",level:3},{value:"A.54.3. Kapan harus menggunakan panic error?",id:"a543-kapan-harus-menggunakan-panic-error",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],s={toc:u};function k(a){let{components:e,...i}=a;return(0,t.kt)("wrapper",(0,n.Z)({},s,i,{components:e,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Error handling atau penanganan error adalah salah satu aspek penting dalam pemrograman selalu umum. Rust mengenal 2 jenis error yaitu ",(0,t.kt)("strong",{parentName:"p"},"unrecoverable error (panic error)")," dan ",(0,t.kt)("strong",{parentName:"p"},"recoverable error"),". Pembahasan chapter ini fokus pada unrecoverable error atau panic error."),(0,t.kt)("h2",{id:"a541-unrecoverable-error-runtime-error--compile-time-error"},"A.54.1. Unrecoverable error (RUNTIME error & COMPILE-TIME error)"),(0,t.kt)("p",null,(0,t.kt)("em",{parentName:"p"},"Unrecoverable error")," adalah error yang tidak bisa ditangani, entah itu karena memang disengaja atau karena ada bug fatal yang menyebabkan program mendapati error jenis ini sehingga program ",(0,t.kt)("em",{parentName:"p"},"crash")," dan berhenti secara paksa."),(0,t.kt)("p",null,"Salah satu operasi yang menyebabkan panic adalah pengaksesan elemen vector menggunakan index di luar kapasitas vector. Contoh:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let data = vec![10, 11, 23];\n\n println!("data index 1: {}", data[1]);\n println!("data index 6: {}", data[6]);\n println!("data index 2: {}", data[2]);\n}\n')),(0,t.kt)("p",null,"Pengaksesan index ke-6 vector ",(0,t.kt)("inlineCode",{parentName:"p"},"data")," menghasilkan panic karena vector tersebut hanya berisi 3 elemen."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Error Handling, Panic, Operator ?",src:r(5767).Z,width:"727",height:"182"})),(0,t.kt)("p",null,"Apa yang bisa dilakukan ketika panic muncul?"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Jika panic muncul ketika program sudah di production, program akan crash karena bug pengaksesan error di atas."),(0,t.kt)("li",{parentName:"ul"},"Jika panic muncul saat pengembangan, maka bisa diperbaiki kodenya, bisa dengan menambahkan pengecekan kapasitas index vector atau lainnya.")),(0,t.kt)("h3",{id:"-perbedaan-panic-saat-pengaksesan-vector-dan-error-saat-pengaksesan-array"},"\u25c9 Perbedaan panic saat pengaksesan vector dan error saat pengaksesan array"),(0,t.kt)("p",null,"Coba ubah kode di atas, tipe data variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"data")," ubah dari vector ke array. Lalu jalankan ulang program."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let data = [10, 11, 23];\n\n println!("data index 1: {}", data[1]);\n println!("data index 6: {}", data[6]);\n println!("data index 2: {}", data[2]);\n}\n')),(0,t.kt)("p",null,"Error masih muncul, tapi pesan error-nya berbeda."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Error Handling, Panic, Operator ?",src:r(5594).Z,width:"764",height:"215"})),(0,t.kt)("p",null,"2 program yang dijalankan keduanya error tapi error-nya sangat berbeda."),(0,t.kt)("table",null,(0,t.kt)("tr",null,(0,t.kt)("td",null,"Pengaksesan elemen vector di luar kapastias memunculkan error saat ",(0,t.kt)("b",null,"RUNTIME"),". Penjelasannya:")),(0,t.kt)("tr",null,(0,t.kt)("td",null,(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("strong",{parentName:"li"},"RUNTIME error")," menandakan kode program sudah berhasil dikompilasi dan program juga berhasil di eksekusi.",(0,t.kt)("ul",{parentName:"li"},(0,t.kt)("li",{parentName:"ul"},"Silakan lihat gambar pertama, ada keterangan ",(0,t.kt)("em",{parentName:"li"},"Finished")," dan ",(0,t.kt)("em",{parentName:"li"},"Running"),"."),(0,t.kt)("li",{parentName:"ul"},"Error ini masuk kategori ",(0,t.kt)("strong",{parentName:"li"},"panic-level error")," atau ",(0,t.kt)("strong",{parentName:"li"},"panic"),"."))),(0,t.kt)("li",{parentName:"ul"},"Error muncul ketika baris kode ",(0,t.kt)("inlineCode",{parentName:"li"},'println!("data index 6: {}", data[6]);')," dieksekusi."),(0,t.kt)("li",{parentName:"ul"},"Kode sebelum baris tersebut masih sempat dieksekusi.",(0,t.kt)("ul",{parentName:"li"},(0,t.kt)("li",{parentName:"ul"},"Silakan lihat gambar pertama, output ",(0,t.kt)("inlineCode",{parentName:"li"},"data index 1: 11")," sempat muncul sebelum error."))),(0,t.kt)("li",{parentName:"ul"},"Tipe data vector tidak tidak mampu mengetahui kapasitas datanya saat kompilasi, inilah kenapa error bisa lolos kompilasi."))))),(0,t.kt)("table",null,(0,t.kt)("tr",null,(0,t.kt)("td",null,"Sedangkan pengaksesan elemen array di luar kapastias memunculkan error saat ",(0,t.kt)("b",null,"COMPILE TIME"),". Penjelasannya:")),(0,t.kt)("tr",null,(0,t.kt)("td",null,(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("strong",{parentName:"li"},"COMPILE TIME error")," menandakan kode program gagal dikompilasi dan tidak sampai dieksekusi.",(0,t.kt)("ul",{parentName:"li"},(0,t.kt)("li",{parentName:"ul"},"Silakan lihat gambar ke-dua, ada keterangan ",(0,t.kt)("em",{parentName:"li"},"Compiling")," diikuti dengan error, dan keterangan ",(0,t.kt)("inlineCode",{parentName:"li"},"could not compile"),"."),(0,t.kt)("li",{parentName:"ul"},"Error ini masuk kategori ",(0,t.kt)("strong",{parentName:"li"},"compile-time-level error")," atau cukup ",(0,t.kt)("strong",{parentName:"li"},"error"),"."))),(0,t.kt)("li",{parentName:"ul"},"Error muncul saat compiler memproses baris kode ",(0,t.kt)("inlineCode",{parentName:"li"},'println!("data index 6: {}", data[6]);'),"."),(0,t.kt)("li",{parentName:"ul"},"Tipe data array kapasitasnya sudah bisa diketahui oleh compiler saat kompilasi, menyebabkan proses kompilasi gagal."))))),(0,t.kt)("h2",{id:"a542-macro-panic"},"A.54.2. Macro ",(0,t.kt)("inlineCode",{parentName:"h2"},"panic!()")),(0,t.kt)("p",null,"Telah kita pelajari bahwa panic muncul karena ",(0,t.kt)("em",{parentName:"p"},"flaw")," atau cacat program, disebabkan oleh bug di kode program. Selain itu, panic bisa dimunculkan dengan sengaja menggunakan macro ",(0,t.kt)("inlineCode",{parentName:"p"},"panic!()"),"."),(0,t.kt)("p",null,"Cara penggunaannya cukup dengan memanggil macro tersebut diikuti dengan argument berisi string keterangan panic errornya."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Bisa dibilang macro ",(0,t.kt)("inlineCode",{parentName:"p"},"panic!()")," adalah media untuk membuat ",(0,t.kt)("em",{parentName:"p"},"recoverable error")," menjadi ",(0,t.kt)("em",{parentName:"p"},"unrecoverable error"),".")),(0,t.kt)("p",null,"Pada contoh berikut, program sederhana dibuat untuk menangkap inputan nama user untuk kemudian di-print. Jika user tidak menginputkan apapun, maka panic sengaja dimunculkan via pemanggilan macro ",(0,t.kt)("inlineCode",{parentName:"p"},"panic!()"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'use std::io;\nuse std::io::Write;\n\nfn main() {\n print!("enter your name: ");\n let _ = io::stdout().flush();\n\n let name = read_entry();\n if name.is_empty() {\n panic!("unable to continue the program");\n }\n\n println!("hi {}", name);\n}\n\npub fn read_entry() -> String {\n let mut message = String::new();\n let reader_res = io::stdin().read_line(&mut message);\n\n if reader_res.is_err() {\n return message;\n }\n\n message.trim().to_string()\n}\n')),(0,t.kt)("p",null,"Output program:"),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Error Handling, Panic, Operator ?",src:r(4274).Z,width:"719",height:"284"})),(0,t.kt)("p",null,"Program dieksekusi 2 kali:"),(0,t.kt)("ol",null,(0,t.kt)("li",{parentName:"ol"},"Eksekusi pertama, inputan ",(0,t.kt)("inlineCode",{parentName:"li"},"noval agung")," digunakan. Hasilnya program berjalan sesuai desain."),(0,t.kt)("li",{parentName:"ol"},"Pada eksekusi ke-2, tidak ada inputan yang ditulis, dan langsung tekan tombol enter, hasilnya panic sengaja dimunculkan via macro ",(0,t.kt)("inlineCode",{parentName:"li"},"panic!()")," dengan pesan ",(0,t.kt)("inlineCode",{parentName:"li"},"unable to continue the program"),".")),(0,t.kt)("h3",{id:"-statement-iostdoutflush"},"\u25c9 Statement ",(0,t.kt)("inlineCode",{parentName:"h3"},"io::stdout().flush()")),(0,t.kt)("p",null,"Dibanding dengan beberapa chapter sebelumnya yang juga ada praktek menangkap inputan user, kode program yang ditulis kali ini disisipi statement baru yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"io::stdout().flush()"),". Kode tersebut berguna untuk mem-",(0,t.kt)("em",{parentName:"p"},"flush")," output STDOUT yang muncul, karena default output STDOUT adalah di-",(0,t.kt)("em",{parentName:"p"},"buffer")," oleh Rust."),(0,t.kt)("p",null,"Jika tidak di-flush, ada kemungkinan text ",(0,t.kt)("inlineCode",{parentName:"p"},"enter your name: ")," muncul setelah user mengisi inputan lalu menekan tombol ",(0,t.kt)("em",{parentName:"p"},"enter"),"."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Untuk menggunakan stdout flush, path ",(0,t.kt)("inlineCode",{parentName:"p"},"std::io::Write")," harus di-import terlebih dahulu.")),(0,t.kt)("h2",{id:"a543-kapan-harus-menggunakan-panic-error"},"A.54.3. Kapan harus menggunakan panic error?"),(0,t.kt)("p",null,"Tidak semua jenis recoverable error harus berakhir dengan panic, ini penting untuk selalu diingat. Adakalanya error perlu di-recover secara gentle, ada kalanya error harus diumumkan via panic agar program terhenti. Contohnya:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Error ketika ada inputan yang tidak valid, maka cukup direspon dengan pesan error saja."),(0,t.kt)("li",{parentName:"ul"},"Error karena ada operasi pembagian terhadap angka ",(0,t.kt)("inlineCode",{parentName:"li"},"0"),", maka tidak perlu menggunakan panic."),(0,t.kt)("li",{parentName:"ul"},"Error karena file konfigurasi yang tidak ditemukan saat eksekusi program, ideal menggunakan panic.")),(0,t.kt)("p",null,"Tergantung tingkat ",(0,t.kt)("em",{parentName:"p"},"severity")," atau keseriusan error, silakan tentukan prosedur penanganannya seperti apa sesuai kebutuhan, juga jangan lupa pertimbangkan implikasinya."),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/unrecoverable_panic_error"},"github.com/novalagung/dasarpemrogramanrust-example/../unrecoverable_panic_error")),(0,t.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/recoverable-error-handling"},"Error \u279c Recoverable Error & Error Handling"))),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-with-panic.html"},"https://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-with-panic.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch09-03-to-panic-or-not-to-panic.html"},"https://doc.rust-lang.org/book/ch09-03-to-panic-or-not-to-panic.html"))))}k.isMDXComponent=!0},5767:(a,e,r)=>{r.d(e,{Z:()=>n});const n=r.p+"assets/images/unrecoverable-panic-error-1-2a22152a19c4dfb91d4f55885880fc08.png"},5594:(a,e,r)=>{r.d(e,{Z:()=>n});const n=r.p+"assets/images/unrecoverable-panic-error-2-1ffea2a5a914b4b95bb2db06c1ac9b53.png"},4274:(a,e,r)=>{r.d(e,{Z:()=>n});const n=r.p+"assets/images/unrecoverable-panic-error-3-4d90d454da4c451e1d9b6c9499ba72c6.png"}}]); \ No newline at end of file diff --git a/assets/js/388041ab.a8d860d1.js b/assets/js/388041ab.a8d860d1.js new file mode 100644 index 00000000..374260be --- /dev/null +++ b/assets/js/388041ab.a8d860d1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[1494],{3905:(a,e,r)=>{r.d(e,{Zo:()=>s,kt:()=>d});var n=r(7294);function t(a,e,r){return e in a?Object.defineProperty(a,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):a[e]=r,a}function i(a,e){var r=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),r.push.apply(r,n)}return r}function l(a){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){t(a,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(r,e))}))}return a}function o(a,e){if(null==a)return{};var r,n,t=function(a,e){if(null==a)return{};var r,n,t={},i=Object.keys(a);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(t[r]=a[r]);return t}(a,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(a,r)&&(t[r]=a[r])}return t}var p=n.createContext({}),u=function(a){var e=n.useContext(p),r=e;return a&&(r="function"==typeof a?a(e):l(l({},e),a)),r},s=function(a){var e=u(a.components);return n.createElement(p.Provider,{value:e},a.children)},k={inlineCode:"code",wrapper:function(a){var e=a.children;return n.createElement(n.Fragment,{},e)}},m=n.forwardRef((function(a,e){var r=a.components,t=a.mdxType,i=a.originalType,p=a.parentName,s=o(a,["components","mdxType","originalType","parentName"]),m=u(r),d=t,c=m["".concat(p,".").concat(d)]||m[d]||k[d]||i;return r?n.createElement(c,l(l({ref:e},s),{},{components:r})):n.createElement(c,l({ref:e},s))}));function d(a,e){var r=arguments,t=e&&e.mdxType;if("string"==typeof a||t){var i=r.length,l=new Array(i);l[0]=m;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=a,o.mdxType="string"==typeof a?a:t,l[1]=o;for(var u=2;u<i;u++)l[u]=r[u];return n.createElement.apply(null,l)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},395:(a,e,r)=>{r.r(e),r.d(e,{assets:()=>p,contentTitle:()=>l,default:()=>k,frontMatter:()=>i,metadata:()=>o,toc:()=>u});var n=r(7462),t=(r(7294),r(3905));const i={sidebar_position:54,title:"A.54. Error \u279c Unrecoverable Error / Panic",sidebar_label:"A.54. Error \u279c Unrecoverable Error / Panic"},l=void 0,o={unversionedId:"basic/unrecoverable-panic-error",id:"basic/unrecoverable-panic-error",title:"A.54. Error \u279c Unrecoverable Error / Panic",description:"Error handling atau penanganan error adalah salah satu aspek penting dalam pemrograman selalu umum. Rust mengenal 2 jenis error yaitu unrecoverable error (panic error) dan recoverable error. Pembahasan chapter ini fokus pada unrecoverable error atau panic error.",source:"@site/docs/basic/unrecoverable-panic-error.md",sourceDirName:"basic",slug:"/basic/unrecoverable-panic-error",permalink:"/basic/unrecoverable-panic-error",draft:!1,tags:[],version:"current",sidebarPosition:54,frontMatter:{sidebar_position:54,title:"A.54. Error \u279c Unrecoverable Error / Panic",sidebar_label:"A.54. Error \u279c Unrecoverable Error / Panic"},sidebar:"tutorialSidebar",previous:{title:"A.53. File, Path, Directory",permalink:"/basic/file-path-directory"},next:{title:"A.55. Error \u279c Recoverable Error & Error Handling",permalink:"/basic/recoverable-error-handling"}},p={},u=[{value:"A.54.1. Unrecoverable error (RUNTIME error & COMPILE-TIME error)",id:"a541-unrecoverable-error-runtime-error--compile-time-error",level:2},{value:"\u25c9 Perbedaan panic saat pengaksesan vector dan error saat pengaksesan array",id:"-perbedaan-panic-saat-pengaksesan-vector-dan-error-saat-pengaksesan-array",level:3},{value:"A.54.2. Macro <code>panic!()</code>",id:"a542-macro-panic",level:2},{value:"\u25c9 Statement <code>io::stdout().flush()</code>",id:"-statement-iostdoutflush",level:3},{value:"A.54.3. Kapan harus menggunakan panic error?",id:"a543-kapan-harus-menggunakan-panic-error",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],s={toc:u};function k(a){let{components:e,...i}=a;return(0,t.kt)("wrapper",(0,n.Z)({},s,i,{components:e,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Error handling atau penanganan error adalah salah satu aspek penting dalam pemrograman selalu umum. Rust mengenal 2 jenis error yaitu ",(0,t.kt)("strong",{parentName:"p"},"unrecoverable error (panic error)")," dan ",(0,t.kt)("strong",{parentName:"p"},"recoverable error"),". Pembahasan chapter ini fokus pada unrecoverable error atau panic error."),(0,t.kt)("h2",{id:"a541-unrecoverable-error-runtime-error--compile-time-error"},"A.54.1. Unrecoverable error (RUNTIME error & COMPILE-TIME error)"),(0,t.kt)("p",null,(0,t.kt)("em",{parentName:"p"},"Unrecoverable error")," adalah error yang tidak bisa ditangani, entah itu karena memang disengaja atau karena ada bug fatal yang menyebabkan program mendapati error jenis ini sehingga program ",(0,t.kt)("em",{parentName:"p"},"crash")," dan berhenti secara paksa."),(0,t.kt)("p",null,"Salah satu operasi yang menyebabkan panic adalah pengaksesan elemen vector menggunakan index di luar kapasitas vector. Contoh:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let data = vec![10, 11, 23];\n\n println!("data index 1: {}", data[1]);\n println!("data index 6: {}", data[6]);\n println!("data index 2: {}", data[2]);\n}\n')),(0,t.kt)("p",null,"Pengaksesan index ke-6 vector ",(0,t.kt)("inlineCode",{parentName:"p"},"data")," menghasilkan panic karena vector tersebut hanya berisi 3 elemen."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Error Handling, Panic, Operator ?",src:r(5767).Z,width:"727",height:"182"})),(0,t.kt)("p",null,"Apa yang bisa dilakukan ketika panic muncul?"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Jika panic muncul ketika program sudah di production, program akan crash karena bug pengaksesan error di atas."),(0,t.kt)("li",{parentName:"ul"},"Jika panic muncul saat pengembangan, maka bisa diperbaiki kodenya, bisa dengan menambahkan pengecekan kapasitas index vector atau lainnya.")),(0,t.kt)("h3",{id:"-perbedaan-panic-saat-pengaksesan-vector-dan-error-saat-pengaksesan-array"},"\u25c9 Perbedaan panic saat pengaksesan vector dan error saat pengaksesan array"),(0,t.kt)("p",null,"Coba ubah kode di atas, tipe data variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"data")," ubah dari vector ke array. Lalu jalankan ulang program."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let data = [10, 11, 23];\n\n println!("data index 1: {}", data[1]);\n println!("data index 6: {}", data[6]);\n println!("data index 2: {}", data[2]);\n}\n')),(0,t.kt)("p",null,"Error masih muncul, tapi pesan error-nya berbeda."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Error Handling, Panic, Operator ?",src:r(5594).Z,width:"764",height:"215"})),(0,t.kt)("p",null,"2 program yang dijalankan keduanya error tapi error-nya sangat berbeda."),(0,t.kt)("table",null,(0,t.kt)("tr",null,(0,t.kt)("td",null,"Pengaksesan elemen vector di luar kapastias memunculkan error saat ",(0,t.kt)("b",null,"RUNTIME"),". Penjelasannya:")),(0,t.kt)("tr",null,(0,t.kt)("td",null,(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("strong",{parentName:"li"},"RUNTIME error")," menandakan kode program sudah berhasil dikompilasi dan program juga berhasil di eksekusi.",(0,t.kt)("ul",{parentName:"li"},(0,t.kt)("li",{parentName:"ul"},"Silakan lihat gambar pertama, ada keterangan ",(0,t.kt)("em",{parentName:"li"},"Finished")," dan ",(0,t.kt)("em",{parentName:"li"},"Running"),"."),(0,t.kt)("li",{parentName:"ul"},"Error ini masuk kategori ",(0,t.kt)("strong",{parentName:"li"},"panic-level error")," atau ",(0,t.kt)("strong",{parentName:"li"},"panic"),"."))),(0,t.kt)("li",{parentName:"ul"},"Error muncul ketika baris kode ",(0,t.kt)("inlineCode",{parentName:"li"},'println!("data index 6: {}", data[6]);')," dieksekusi."),(0,t.kt)("li",{parentName:"ul"},"Kode sebelum baris tersebut masih sempat dieksekusi.",(0,t.kt)("ul",{parentName:"li"},(0,t.kt)("li",{parentName:"ul"},"Silakan lihat gambar pertama, output ",(0,t.kt)("inlineCode",{parentName:"li"},"data index 1: 11")," sempat muncul sebelum error."))),(0,t.kt)("li",{parentName:"ul"},"Tipe data vector tidak tidak mampu mengetahui kapasitas datanya saat kompilasi, inilah kenapa error bisa lolos kompilasi."))))),(0,t.kt)("table",null,(0,t.kt)("tr",null,(0,t.kt)("td",null,"Sedangkan pengaksesan elemen array di luar kapastias memunculkan error saat ",(0,t.kt)("b",null,"COMPILE TIME"),". Penjelasannya:")),(0,t.kt)("tr",null,(0,t.kt)("td",null,(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("strong",{parentName:"li"},"COMPILE TIME error")," menandakan kode program gagal dikompilasi dan tidak sampai dieksekusi.",(0,t.kt)("ul",{parentName:"li"},(0,t.kt)("li",{parentName:"ul"},"Silakan lihat gambar ke-dua, ada keterangan ",(0,t.kt)("em",{parentName:"li"},"Compiling")," diikuti dengan error, dan keterangan ",(0,t.kt)("inlineCode",{parentName:"li"},"could not compile"),"."),(0,t.kt)("li",{parentName:"ul"},"Error ini masuk kategori ",(0,t.kt)("strong",{parentName:"li"},"compile-time-level error")," atau cukup ",(0,t.kt)("strong",{parentName:"li"},"error"),"."))),(0,t.kt)("li",{parentName:"ul"},"Error muncul saat compiler memproses baris kode ",(0,t.kt)("inlineCode",{parentName:"li"},'println!("data index 6: {}", data[6]);'),"."),(0,t.kt)("li",{parentName:"ul"},"Tipe data array kapasitasnya sudah bisa diketahui oleh compiler saat kompilasi, menyebabkan proses kompilasi gagal."))))),(0,t.kt)("h2",{id:"a542-macro-panic"},"A.54.2. Macro ",(0,t.kt)("inlineCode",{parentName:"h2"},"panic!()")),(0,t.kt)("p",null,"Telah kita pelajari bahwa panic muncul karena ",(0,t.kt)("em",{parentName:"p"},"flaw")," atau cacat program, disebabkan oleh bug di kode program. Selain itu, panic bisa dimunculkan dengan sengaja menggunakan macro ",(0,t.kt)("inlineCode",{parentName:"p"},"panic!()"),"."),(0,t.kt)("p",null,"Cara penggunaannya cukup dengan memanggil macro tersebut diikuti dengan argument berisi string keterangan panic errornya."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Bisa dibilang macro ",(0,t.kt)("inlineCode",{parentName:"p"},"panic!()")," adalah media untuk membuat ",(0,t.kt)("em",{parentName:"p"},"recoverable error")," menjadi ",(0,t.kt)("em",{parentName:"p"},"unrecoverable error"),".")),(0,t.kt)("p",null,"Pada contoh berikut, program sederhana dibuat untuk menangkap inputan nama user untuk kemudian di-print. Jika user tidak menginputkan apapun, maka panic sengaja dimunculkan via pemanggilan macro ",(0,t.kt)("inlineCode",{parentName:"p"},"panic!()"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'use std::io;\nuse std::io::Write;\n\nfn main() {\n print!("enter your name: ");\n let _ = io::stdout().flush();\n\n let name = read_entry();\n if name.is_empty() {\n panic!("unable to continue the program");\n }\n\n println!("hi {}", name);\n}\n\npub fn read_entry() -> String {\n let mut message = String::new();\n let reader_res = io::stdin().read_line(&mut message);\n\n if reader_res.is_err() {\n return message;\n }\n\n message.trim().to_string()\n}\n')),(0,t.kt)("p",null,"Output program:"),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Error Handling, Panic, Operator ?",src:r(4274).Z,width:"719",height:"284"})),(0,t.kt)("p",null,"Program dieksekusi 2 kali:"),(0,t.kt)("ol",null,(0,t.kt)("li",{parentName:"ol"},"Eksekusi pertama, inputan ",(0,t.kt)("inlineCode",{parentName:"li"},"noval agung")," digunakan. Hasilnya program berjalan sesuai desain."),(0,t.kt)("li",{parentName:"ol"},"Pada eksekusi ke-2, tidak ada inputan yang ditulis, dan langsung tekan tombol enter, hasilnya panic sengaja dimunculkan via macro ",(0,t.kt)("inlineCode",{parentName:"li"},"panic!()")," dengan pesan ",(0,t.kt)("inlineCode",{parentName:"li"},"unable to continue the program"),".")),(0,t.kt)("h3",{id:"-statement-iostdoutflush"},"\u25c9 Statement ",(0,t.kt)("inlineCode",{parentName:"h3"},"io::stdout().flush()")),(0,t.kt)("p",null,"Dibanding dengan beberapa chapter sebelumnya yang juga ada praktek menangkap inputan user, kode program yang ditulis kali ini disisipi statement baru yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"io::stdout().flush()"),". Kode tersebut berguna untuk mem-",(0,t.kt)("em",{parentName:"p"},"flush")," output STDOUT yang muncul, karena default output STDOUT adalah di-",(0,t.kt)("em",{parentName:"p"},"buffer")," oleh Rust."),(0,t.kt)("p",null,"Jika tidak di-flush, ada kemungkinan text ",(0,t.kt)("inlineCode",{parentName:"p"},"enter your name: ")," muncul setelah user mengisi inputan lalu menekan tombol ",(0,t.kt)("em",{parentName:"p"},"enter"),"."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Untuk menggunakan stdout flush, path ",(0,t.kt)("inlineCode",{parentName:"p"},"std::io::Write")," harus di-import terlebih dahulu.")),(0,t.kt)("h2",{id:"a543-kapan-harus-menggunakan-panic-error"},"A.54.3. Kapan harus menggunakan panic error?"),(0,t.kt)("p",null,"Tidak semua jenis recoverable error harus berakhir dengan panic, ini penting untuk selalu diingat. Adakalanya error perlu di-recover secara gentle, ada kalanya error harus diumumkan via panic agar program terhenti. Contohnya:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Error ketika ada inputan yang tidak valid, maka cukup direspon dengan pesan error saja."),(0,t.kt)("li",{parentName:"ul"},"Error karena ada operasi pembagian terhadap angka ",(0,t.kt)("inlineCode",{parentName:"li"},"0"),", maka tidak perlu menggunakan panic."),(0,t.kt)("li",{parentName:"ul"},"Error karena file konfigurasi yang tidak ditemukan saat eksekusi program, ideal menggunakan panic.")),(0,t.kt)("p",null,"Tergantung tingkat ",(0,t.kt)("em",{parentName:"p"},"severity")," atau keseriusan error, silakan tentukan prosedur penanganannya seperti apa sesuai kebutuhan, juga jangan lupa pertimbangkan implikasinya."),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/unrecoverable_panic_error"},"github.com/novalagung/dasarpemrogramanrust-example/../unrecoverable_panic_error")),(0,t.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/recoverable-error-handling"},"Error \u279c Recoverable Error & Error Handling"))),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-with-panic.html"},"https://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-with-panic.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch09-03-to-panic-or-not-to-panic.html"},"https://doc.rust-lang.org/book/ch09-03-to-panic-or-not-to-panic.html"))))}k.isMDXComponent=!0},5767:(a,e,r)=>{r.d(e,{Z:()=>n});const n=r.p+"assets/images/unrecoverable-panic-error-1-2a22152a19c4dfb91d4f55885880fc08.png"},5594:(a,e,r)=>{r.d(e,{Z:()=>n});const n=r.p+"assets/images/unrecoverable-panic-error-2-1ffea2a5a914b4b95bb2db06c1ac9b53.png"},4274:(a,e,r)=>{r.d(e,{Z:()=>n});const n=r.p+"assets/images/unrecoverable-panic-error-3-4d90d454da4c451e1d9b6c9499ba72c6.png"}}]); \ No newline at end of file diff --git a/assets/js/3aa512bf.35e7bf91.js b/assets/js/3aa512bf.35e7bf91.js deleted file mode 100644 index 14d7ec3c..00000000 --- a/assets/js/3aa512bf.35e7bf91.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[7386],{3905:(a,e,n)=>{n.d(e,{Zo:()=>m,kt:()=>o});var i=n(7294);function t(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function l(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,i)}return n}function r(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){t(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function A(a,e){if(null==a)return{};var n,i,t=function(a,e){if(null==a)return{};var n,i,t={},l=Object.keys(a);for(i=0;i<l.length;i++)n=l[i],e.indexOf(n)>=0||(t[n]=a[n]);return t}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(i=0;i<l.length;i++)n=l[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(t[n]=a[n])}return t}var d=i.createContext({}),u=function(a){var e=i.useContext(d),n=e;return a&&(n="function"==typeof a?a(e):r(r({},e),a)),n},m=function(a){var e=u(a.components);return i.createElement(d.Provider,{value:e},a.children)},p={inlineCode:"code",wrapper:function(a){var e=a.children;return i.createElement(i.Fragment,{},e)}},s=i.forwardRef((function(a,e){var n=a.components,t=a.mdxType,l=a.originalType,d=a.parentName,m=A(a,["components","mdxType","originalType","parentName"]),s=u(n),o=t,k=s["".concat(d,".").concat(o)]||s[o]||p[o]||l;return n?i.createElement(k,r(r({ref:e},m),{},{components:n})):i.createElement(k,r({ref:e},m))}));function o(a,e){var n=arguments,t=e&&e.mdxType;if("string"==typeof a||t){var l=n.length,r=new Array(l);r[0]=s;var A={};for(var d in e)hasOwnProperty.call(e,d)&&(A[d]=e[d]);A.originalType=a,A.mdxType="string"==typeof a?a:t,r[1]=A;for(var u=2;u<l;u++)r[u]=n[u];return i.createElement.apply(null,r)}return i.createElement.apply(null,n)}s.displayName="MDXCreateElement"},7495:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>d,contentTitle:()=>r,default:()=>p,frontMatter:()=>l,metadata:()=>A,toc:()=>u});var i=n(7462),t=(n(7294),n(3905));const l={sidebar_position:21,title:"A.21. Module System \u279c Inline Module",sidebar_label:"A.21. Module System \u279c Inline Module"},r=void 0,A={unversionedId:"basic/module-inline",id:"basic/module-inline",title:"A.21. Module System \u279c Inline Module",description:"Pada chapter sebelumnya kita telah belajar cara manajemen module. Pembahasan tersebut dilanjut pada chapter ini, yaitu tentang inline module.",source:"@site/docs/basic/module-inline.md",sourceDirName:"basic",slug:"/basic/module-inline",permalink:"/basic/module-inline",draft:!1,tags:[],version:"current",sidebarPosition:21,frontMatter:{sidebar_position:21,title:"A.21. Module System \u279c Inline Module",sidebar_label:"A.21. Module System \u279c Inline Module"},sidebar:"tutorialSidebar",previous:{title:"A.20. Module System \u279c Module",permalink:"/basic/module-basic"},next:{title:"A.22. Module System \u279c Scope & Akses Item",permalink:"/basic/module-scope-item-access"}},d={},u=[{value:"A.21.1. Inline Module",id:"a211-inline-module",level:2},{value:"A.21.2. Praktik inline module",id:"a212-praktik-inline-module",level:2},{value:"A.21.3. Inline module item",id:"a213-inline-module-item",level:2},{value:"A.21.4. Inline module file <code>nama_module.rs</code> atau <code>nama_module/mod.rs</code>",id:"a214-inline-module-file-nama_modulers-atau-nama_modulemodrs",level:2},{value:"A.21.5. Inline module <code>path</code> attribute",id:"a215-inline-module-path-attribute",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:u};function p(a){let{components:e,...l}=a;return(0,t.kt)("wrapper",(0,i.Z)({},m,l,{components:e,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Pada chapter sebelumnya kita telah belajar cara manajemen module. Pembahasan tersebut dilanjut pada chapter ini, yaitu tentang inline module."),(0,t.kt)("h2",{id:"a211-inline-module"},"A.21.1. Inline Module"),(0,t.kt)("p",null,"Inline module adalah cara lain dalam pendefinisian module beserta item-nya, caranya dengan tetap menggunakan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"mod")," hanya saja isi/item ditulis di dalam blok kode keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"mod")," tersebut. Agar lebih jelas silakan lihat penerapan inline module berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"mod module_a {\n\n pub fn fungsi_satu() {\n // ...\n }\n\n pub mod submodule_b {\n\n pub const PI: u32 = 3.14;\n\n pub fn fungsi_dua() {\n // ...\n }\n }\n}\n")),(0,t.kt)("p",null,"Inline module cukup mudah diterapkan, yang sebelumnya module dan submodule di-manage dengan mengacu ke penamaan file, dalam inline module cukup tulis saja sebagai blok kode definisi module."),(0,t.kt)("p",null,"Pada contoh di atas, ",(0,t.kt)("inlineCode",{parentName:"p"},"module_a")," memiliki beberapa item:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Item berupa fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"module_a::fungsi_satu")),(0,t.kt)("li",{parentName:"ul"},"Item berupa submodule ",(0,t.kt)("inlineCode",{parentName:"li"},"module_a::submodule_b")),(0,t.kt)("li",{parentName:"ul"},"Item berupa konstanta ",(0,t.kt)("inlineCode",{parentName:"li"},"module_a::submodule_b::PI")),(0,t.kt)("li",{parentName:"ul"},"Item berupa fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"module_a::submodule_b::fungsi_dua"))),(0,t.kt)("p",null,"Aturan definisi submodule dan item pada inline module masih sama seperti pada ",(0,t.kt)("em",{parentName:"p"},"normal module"),", salah satunya adalah agar item bisa diakses dari luar module maka perlu menggunakan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub"),"."),(0,t.kt)("h2",{id:"a212-praktik-inline-module"},"A.21.2. Praktik inline module"),(0,t.kt)("p",null,"Mari lanjut proses pembalajaran dengan praktik. Kita akan buat program sederhana yang di dalamnya ada proses generate random string, yang kemudian di-hash."),(0,t.kt)("p",null,"Silakan buat package baru menggunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"cargo new"),". Penulis di sini memilih nama ",(0,t.kt)("inlineCode",{parentName:"p"},"inline_module_1")," sebagai nama package. Setelah itu, siapkan fungsi main dan juga module bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities")," dengan penulisan kode menerapkan inline module. O iya, tulis keduanya (",(0,t.kt)("inlineCode",{parentName:"p"},"module utilities")," dan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),") dalam satu file yang sama yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"mod utilities {\n\n pub mod random {\n\n pub fn string(length: u32) -> String {\n // ... isi fungsi string milik module utilities::random\n }\n }\n\n pub mod password {\n\n pub fn hash(text: &str) -> String {\n // ... isi fungsi hash milik module utilities::password\n }\n\n pub fn is_valid(plain: &str, hashed: &str) -> bool {\n // ... isi fungsi is_valid milik module utilities::password\n }\n }\n}\n\nfn main() {\n // ... isi fungsi main\n}\n")),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Item ",(0,t.kt)("inlineCode",{parentName:"li"},"utilities::random::string")," adalah fungsi nantinya digunakan untuk generate data random string"),(0,t.kt)("li",{parentName:"ul"},"Item ",(0,t.kt)("inlineCode",{parentName:"li"},"utilities::password::hash")," adalah fungsi untuk melakukan proses hashing password menggunakan ",(0,t.kt)("a",{parentName:"li",href:"https://en.wikipedia.org/wiki/Bcrypt"},"bcrypt")),(0,t.kt)("li",{parentName:"ul"},"Item ",(0,t.kt)("inlineCode",{parentName:"li"},"utilities::password::is_valid")," adalah fungsi untuk pengecekan apakah password sama dengan data setelah di-hash")),(0,t.kt)("p",null,"Ketiga fungsi tersebut kemudian diterapkan pada program kecil yang logic-nya ditulis dalam fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Pada contoh di atas, semua item dan sub-item milik ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities")," didefinisikan public menggunakan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub")," agar bisa diakses dari module."),(0,t.kt)("p",{parentName:"blockquote"},"Sedangkan module ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities")," sendiri tidak wajib di-expose menggunakan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub"),", karena definisi module-nya berada dalam satu file yang sama dengan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),", yaitu file ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),"."),(0,t.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub")," dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/visibility-privacy"},"Module System \u279c Visibility & Privacy"))),(0,t.kt)("p",null,"Sebelum lanjut proses koding, silakan tambahkan dulu beberapa dependencies berikut pada ",(0,t.kt)("inlineCode",{parentName:"p"},"Cargo.toml"),", kemudian jalankan ",(0,t.kt)("inlineCode",{parentName:"p"},"cargo build")," di-download."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="Cargo.toml"',title:'"Cargo.toml"'},'[package]\nname = "module_inline_1"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nbcrypt = "0.13"\nrand = "0.8.5"\n')),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Package ",(0,t.kt)("a",{parentName:"li",href:"https://crates.io/keywords/bcrypt"},(0,t.kt)("inlineCode",{parentName:"a"},"bcrypt"))," adalah crate yang isinya banyak fungsi untuk kebutuhan enkripsi bcrypt"),(0,t.kt)("li",{parentName:"ul"},"Package ",(0,t.kt)("a",{parentName:"li",href:"https://crates.io/keywords/rand"},(0,t.kt)("inlineCode",{parentName:"a"},"rand"))," berisi item untuk keperluan generate data random. Kita sudah beberapa kali menggunakan crate ini.")),(0,t.kt)("p",null,"Ok, sekarang kembali ke source code. Tulis isi fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities::random::string")," berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod utilities {\n\n pub mod random {\n\n pub fn string(length: u32) -> String {\n use rand::Rng;\n \n const CHARSET: &[u8] = "abcdefghijklmnopqrstuvwxyz".as_bytes();\n let mut arr = Vec::new();\n for _ in 0..=length {\n let n = rand::thread_rng().gen_range(0..(CHARSET.len()));\n let char = CHARSET[n];\n arr.push(char);\n }\n\n std::str::from_utf8(&arr[..]).unwrap().to_string()\n }\n }\n\n // ...\n}\n')),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Di atas adalah salah satu contoh penerapan generate random string dengan lebar ",(0,t.kt)("em",{parentName:"p"},"parameterized"),"."),(0,t.kt)("p",{parentName:"blockquote"},"Cara tersebut sebenarnya bukan yang paling efisien, namun karena jumlah topik yang kita pelajari masih belum terlalu banyak, penulis menghindari penerapan beberapa hal yang sifatnya baru dan bikin tambah bingung.")),(0,t.kt)("p",null,"Lanjut, silakan tulis kode untuk hashing password dan juga untuk validasi password berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"mod utilities {\n\n // ...\n\n pub mod password {\n\n pub fn hash(text: &str) -> String {\n let result = bcrypt::hash(text, bcrypt::DEFAULT_COST).unwrap();\n result\n }\n\n pub fn is_valid(plain: &str, hashed: &str) -> bool {\n let valid = bcrypt::verify(plain, hashed).unwrap();\n valid\n }\n }\n}\n")),(0,t.kt)("p",null,"Dalam enkripsi menggunakan bcrypt ada dua hal yang penting diketahui, yang pertama adalah data yang akan di-hash (pada contoh di atas adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"text"),"), dan ",(0,t.kt)("em",{parentName:"p"},"cost")," atau biaya enkripsi dalam bentuk numerik. Pada praktik ini, ",(0,t.kt)("inlineCode",{parentName:"p"},"bcrypt::DEFAULT_COST")," digunakan sebagai cost enkripsi."),(0,t.kt)("p",null,"Pengecekan apakah data terenkripsi adalah sama dengan data asli dilakukan menggunakan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"bcrypt::verify"),"."),(0,t.kt)("p",null,"Kedua fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"bcrypt::hash")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"bcrypt::verify")," menghasilkan data bertipe ",(0,t.kt)("em",{parentName:"p"},"generic result type")," atau ",(0,t.kt)("inlineCode",{parentName:"p"},"Result<T, E>"),". Tipe ini memiliki method bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"unwrap")," yang berguna untuk pengambilan result atau nilai."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Lebih jelasnya tentang result type dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/result-type"},"Tipe Data \u279c Result"))),(0,t.kt)("p",null,"Oke, sekarang fungsi utility sudah siap, mari implementasikan semua fungsi tersebut pada ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,t.kt)("p",null,"Silakan tulis kode berikut. Sebuah variabel bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"password")," dibuat, diisi dengan kombinasi dari string dan juga random string. Lalu data password tersebut di-hash kemudian dicek nilainya."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'fn main() {\n let password = format!("zereth mortis {}", utilities::random::string(10));\n println!("raw password: {}", password);\n\n let hashed = utilities::password::hash(&password);\n println!("hashed password: {}", hashed);\n\n let is_valid = utilities::password::is_valid(&password, &hashed);\n println!("is password matched? {}", is_valid);\n}\n')),(0,t.kt)("p",null,"Jalankan program untuk melihat hasilnya."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Rust Inline Module",src:n(9632).Z,width:"605",height:"125"})),(0,t.kt)("p",null,"Statement ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities::random::string(10)")," menghasilkan random string dengan lebar ",(0,t.kt)("inlineCode",{parentName:"p"},"10"),", sesuai kebutuhan. Hasil dari pemanggilan fungsi tersebut di-concat dengan text kemudian ditampung variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"password"),"."),(0,t.kt)("p",null,"Variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"password")," kemudian di-hash menggunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities::password::hash"),", kemudian dibandingkan hasil hash-nya apakah cocok dengan text aslinya menggunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities::password::is_valid"),"."),(0,t.kt)("h2",{id:"a213-inline-module-item"},"A.21.3. Inline module item"),(0,t.kt)("p",null,"Module item dalam inline module masih sama seperti pada module normal, yaitu adalah apapun yang didefinisikan di dalam sebuah module. Bisa berupa fungsi, konstanta, submodule, dan lainnya. Pada contoh di atas ada beberapa item didefinisikan:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Item ",(0,t.kt)("inlineCode",{parentName:"li"},"utilities::random")," yang merupakan sebuah submodule (inline module)."),(0,t.kt)("li",{parentName:"ul"},"Item ",(0,t.kt)("inlineCode",{parentName:"li"},"utilities::random::string")," yang merupakan sebuah fungsi."),(0,t.kt)("li",{parentName:"ul"},"Item ",(0,t.kt)("inlineCode",{parentName:"li"},"utilities::password")," yang merupakan sebuah submodule (inline module)."),(0,t.kt)("li",{parentName:"ul"},"Item ",(0,t.kt)("inlineCode",{parentName:"li"},"utilities::password::hash")," yang merupakan sebuah fungsi."),(0,t.kt)("li",{parentName:"ul"},"Item ",(0,t.kt)("inlineCode",{parentName:"li"},"utilities::password::is_valid")," yang merupakan sebuah fungsi.")),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Lebih jelasnya tentang macam-macam item dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/path-item"},"Module System \u279c Path & Item"))),(0,t.kt)("h2",{id:"a214-inline-module-file-nama_modulers-atau-nama_modulemodrs"},"A.21.4. Inline module file ",(0,t.kt)("inlineCode",{parentName:"h2"},"nama_module.rs")," atau ",(0,t.kt)("inlineCode",{parentName:"h2"},"nama_module/mod.rs")),(0,t.kt)("p",null,"Dalam ",(0,t.kt)("em",{parentName:"p"},"real project")," hampir tidak mungkin semua kode ditulis di file ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),". Pastinya kode akan di-split menjadi banyak module sesuai kebutuhan."),(0,t.kt)("p",null,"Kode sebelumya, akan kita refactor. Module ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities")," yang berada di ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs")," perlu dipindah ke file baru yang sesuai dengan aturan penulisan module, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module.rs")," atau ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module/mod.rs"),". Di sini penulis memilih ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module.rs"),", jadi silakan buat file bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities.rs"),", lalu pindah isi itemnya kesana (statement definisi inline module ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities")," tidak perlu ikut dipindah, hanya isinya saja, seperti normalnya definisi module)."),(0,t.kt)("p",null,"O iya, jangan lupa untuk menambahkan statement ",(0,t.kt)("inlineCode",{parentName:"p"},"mod utilities")," pada ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),", agar module terdaftar dan bisa digunakan."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Rust Inline Module",src:n(3009).Z,width:"775",height:"963"})),(0,t.kt)("p",null,"Jalankan program untuk melihat hasilnya."),(0,t.kt)("p",null,"Pada contoh ke-2 ini modul ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities")," didefinisikan menggunakan cara biasa, sedang isi dari module tersebut didefinisikan menggunakan teknik inline module."),(0,t.kt)("h2",{id:"a215-inline-module-path-attribute"},"A.21.5. Inline module ",(0,t.kt)("inlineCode",{parentName:"h2"},"path")," attribute"),(0,t.kt)("p",null,(0,t.kt)("inlineCode",{parentName:"p"},"path")," attribute bisa digunakan dalam manajemen inline module. Silakan utak-atik kode yang sudah dibuat dengan mengikuti step berikut:"),(0,t.kt)("ol",null,(0,t.kt)("li",{parentName:"ol"},(0,t.kt)("p",{parentName:"li"},"Buat file baru bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities/password.rs"),", kemudian pindah isi definisi module ",(0,t.kt)("inlineCode",{parentName:"p"},"password")," ke file tersebut.")),(0,t.kt)("li",{parentName:"ol"},(0,t.kt)("p",{parentName:"li"},"Buat file baru bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities/random.rs"),", kemudian pindah isi definisi module ",(0,t.kt)("inlineCode",{parentName:"p"},"random")," ke file tersebut.")),(0,t.kt)("li",{parentName:"ol"},(0,t.kt)("p",{parentName:"li"},"Hapus file ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities.rs"),", pindah definisi module ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities")," ke file ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),", hasilnya kurang lebih seperti ini:"),(0,t.kt)("pre",{parentName:"li"},(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod utilities {\n #[path = "random.rs"]\n pub mod random;\n\n #[path = "password.rs"]\n pub mod password;\n}\n\nfn main() {\n // ...\n}\n')))),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Rust Inline Module",src:n(6633).Z,width:"920",height:"954"})),(0,t.kt)("p",null,"Jalankan program untuk melihat hasilnya."),(0,t.kt)("p",null,"Pada kode di atas, ",(0,t.kt)("inlineCode",{parentName:"p"},"path")," yang digunakan bukan ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities/random.rs")," melainkan ",(0,t.kt)("inlineCode",{parentName:"p"},"random.rs"),", hail ini dikarenakan ",(0,t.kt)("inlineCode",{parentName:"p"},"path")," attribute dipanggil ",(0,t.kt)("strong",{parentName:"p"},"di dalam module ",(0,t.kt)("inlineCode",{parentName:"strong"},"utilities")),", menjadikan current path pada blok kode tersebut menjadi ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities/"),"."),(0,t.kt)("p",null,"Silakan coba ubah isi ",(0,t.kt)("inlineCode",{parentName:"p"},"path")," attribute menjadi ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities/random.rs"),", hasilnya adalah error. Rust akan menggunakan gabungan dari current path (",(0,t.kt)("inlineCode",{parentName:"p"},"utilities/"),") dan path pada ",(0,t.kt)("inlineCode",{parentName:"p"},"path")," attribute (",(0,t.kt)("inlineCode",{parentName:"p"},"utilities/random.rs"),") dalam lookup, jadinya yang di-lookup adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities/utilities/random.rs"),", dan hasilnya error karena tidak ada file di sana."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Rust Inline Module",src:n(1081).Z,width:"772",height:"188"})),(0,t.kt)("p",null,"Module system di Rust merupakan topik yang cukup membingungkan (menurut penulis) karena desain-nya yang cukup unik jika dibandingkan dengan bagaimana bahasa pemrograman lain mengelola module-nya. Penulis anjurkan untuk mencoba praktik membuat program lainnya yang menerapkan module system, agar cepat terbiasa."),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/module_inline"},"github.com/novalagung/dasarpemrogramanrust-example/../module_inline")),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html"},"https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.mod.html"},"https://doc.rust-lang.org/std/keyword.mod.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/mod.html"},"https://doc.rust-lang.org/rust-by-example/mod.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://aloso.github.io/2021/03/28/module-system.html"},"https://aloso.github.io/2021/03/28/module-system.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/69275034/what-is-the-difference-between-use-and-pub-use"},"https://stackoverflow.com/questions/69275034/what-is-the-difference-between-use-and-pub-use"))))}p.isMDXComponent=!0},9632:(a,e,n)=>{n.d(e,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl0AAAB9CAIAAAAX00FjAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2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CAAAAIC7u/8Dd9E0Fm64vPIAAAAASUVORK5CYII="},3009:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/module-inline-2-c6d08bd6d0d03ddba99457fd3c0bdc5d.png"},6633:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/module-inline-3-9234cea75bd46ea1eea49d0320315320.png"},1081:(a,e,n)=>{n.d(e,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwQAAAC8CAIAAABJ6P4wAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rv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MqQwlv03GffUAAAAwnDIEAAAAgAwBAAAAIEMAAAAAyBAAAAAAMgQAAACADAEAAAAgQwAAAADIEAAAAAAyBAAAAIAMAQAAACBDAAAAAMgQAAAAADIEAAAAgAwBAAAAIEMAAAAw3Pw/GeaY/+PLIkYAAAAASUVORK5CYII="}}]); \ No newline at end of file diff --git a/assets/js/3aa512bf.f1ba8026.js b/assets/js/3aa512bf.f1ba8026.js new file mode 100644 index 00000000..fd40e7ec --- /dev/null +++ b/assets/js/3aa512bf.f1ba8026.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[7386],{3905:(a,e,n)=>{n.d(e,{Zo:()=>m,kt:()=>o});var i=n(7294);function t(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function l(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,i)}return n}function r(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){t(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function A(a,e){if(null==a)return{};var n,i,t=function(a,e){if(null==a)return{};var n,i,t={},l=Object.keys(a);for(i=0;i<l.length;i++)n=l[i],e.indexOf(n)>=0||(t[n]=a[n]);return t}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(i=0;i<l.length;i++)n=l[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(t[n]=a[n])}return t}var d=i.createContext({}),u=function(a){var e=i.useContext(d),n=e;return a&&(n="function"==typeof a?a(e):r(r({},e),a)),n},m=function(a){var e=u(a.components);return i.createElement(d.Provider,{value:e},a.children)},p={inlineCode:"code",wrapper:function(a){var e=a.children;return i.createElement(i.Fragment,{},e)}},s=i.forwardRef((function(a,e){var n=a.components,t=a.mdxType,l=a.originalType,d=a.parentName,m=A(a,["components","mdxType","originalType","parentName"]),s=u(n),o=t,k=s["".concat(d,".").concat(o)]||s[o]||p[o]||l;return n?i.createElement(k,r(r({ref:e},m),{},{components:n})):i.createElement(k,r({ref:e},m))}));function o(a,e){var n=arguments,t=e&&e.mdxType;if("string"==typeof a||t){var l=n.length,r=new Array(l);r[0]=s;var A={};for(var d in e)hasOwnProperty.call(e,d)&&(A[d]=e[d]);A.originalType=a,A.mdxType="string"==typeof a?a:t,r[1]=A;for(var u=2;u<l;u++)r[u]=n[u];return i.createElement.apply(null,r)}return i.createElement.apply(null,n)}s.displayName="MDXCreateElement"},7495:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>d,contentTitle:()=>r,default:()=>p,frontMatter:()=>l,metadata:()=>A,toc:()=>u});var i=n(7462),t=(n(7294),n(3905));const l={sidebar_position:21,title:"A.21. Module System \u279c Inline Module",sidebar_label:"A.21. Module System \u279c Inline Module"},r=void 0,A={unversionedId:"basic/module-inline",id:"basic/module-inline",title:"A.21. Module System \u279c Inline Module",description:"Pada chapter sebelumnya kita telah belajar cara manajemen module. Pembahasan tersebut dilanjut pada chapter ini, yaitu tentang inline module.",source:"@site/docs/basic/module-inline.md",sourceDirName:"basic",slug:"/basic/module-inline",permalink:"/basic/module-inline",draft:!1,tags:[],version:"current",sidebarPosition:21,frontMatter:{sidebar_position:21,title:"A.21. Module System \u279c Inline Module",sidebar_label:"A.21. Module System \u279c Inline Module"},sidebar:"tutorialSidebar",previous:{title:"A.20. Module System \u279c Module",permalink:"/basic/module-basic"},next:{title:"A.22. Module System \u279c Scope & Akses Item",permalink:"/basic/module-scope-item-access"}},d={},u=[{value:"A.21.1. Inline Module",id:"a211-inline-module",level:2},{value:"A.21.2. Praktik inline module",id:"a212-praktik-inline-module",level:2},{value:"A.21.3. Inline module item",id:"a213-inline-module-item",level:2},{value:"A.21.4. Inline module file <code>nama_module.rs</code> atau <code>nama_module/mod.rs</code>",id:"a214-inline-module-file-nama_modulers-atau-nama_modulemodrs",level:2},{value:"A.21.5. Inline module <code>path</code> attribute",id:"a215-inline-module-path-attribute",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:u};function p(a){let{components:e,...l}=a;return(0,t.kt)("wrapper",(0,i.Z)({},m,l,{components:e,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Pada chapter sebelumnya kita telah belajar cara manajemen module. Pembahasan tersebut dilanjut pada chapter ini, yaitu tentang inline module."),(0,t.kt)("h2",{id:"a211-inline-module"},"A.21.1. Inline Module"),(0,t.kt)("p",null,"Inline module adalah cara lain dalam pendefinisian module beserta item-nya, caranya dengan tetap menggunakan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"mod")," hanya saja isi/item ditulis di dalam blok kode keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"mod")," tersebut. Agar lebih jelas silakan lihat penerapan inline module berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"mod module_a {\n\n pub fn fungsi_satu() {\n // ...\n }\n\n pub mod submodule_b {\n\n pub const PI: u32 = 3.14;\n\n pub fn fungsi_dua() {\n // ...\n }\n }\n}\n")),(0,t.kt)("p",null,"Inline module cukup mudah diterapkan, yang sebelumnya module dan submodule di-manage dengan mengacu ke penamaan file, dalam inline module cukup tulis saja sebagai blok kode definisi module."),(0,t.kt)("p",null,"Pada contoh di atas, ",(0,t.kt)("inlineCode",{parentName:"p"},"module_a")," memiliki beberapa item:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Item berupa fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"module_a::fungsi_satu")),(0,t.kt)("li",{parentName:"ul"},"Item berupa submodule ",(0,t.kt)("inlineCode",{parentName:"li"},"module_a::submodule_b")),(0,t.kt)("li",{parentName:"ul"},"Item berupa konstanta ",(0,t.kt)("inlineCode",{parentName:"li"},"module_a::submodule_b::PI")),(0,t.kt)("li",{parentName:"ul"},"Item berupa fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"module_a::submodule_b::fungsi_dua"))),(0,t.kt)("p",null,"Aturan definisi submodule dan item pada inline module masih sama seperti pada ",(0,t.kt)("em",{parentName:"p"},"normal module"),", salah satunya adalah agar item bisa diakses dari luar module maka perlu menggunakan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub"),"."),(0,t.kt)("h2",{id:"a212-praktik-inline-module"},"A.21.2. Praktik inline module"),(0,t.kt)("p",null,"Mari lanjut proses pembalajaran dengan praktik. Kita akan buat program sederhana yang di dalamnya ada proses generate random string, yang kemudian di-hash."),(0,t.kt)("p",null,"Silakan buat package baru menggunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"cargo new"),". Penulis di sini memilih nama ",(0,t.kt)("inlineCode",{parentName:"p"},"inline_module_1")," sebagai nama package. Setelah itu, siapkan fungsi main dan juga module bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities")," dengan penulisan kode menerapkan inline module. O iya, tulis keduanya (",(0,t.kt)("inlineCode",{parentName:"p"},"module utilities")," dan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),") dalam satu file yang sama yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"mod utilities {\n\n pub mod random {\n\n pub fn string(length: u32) -> String {\n // ... isi fungsi string milik module utilities::random\n }\n }\n\n pub mod password {\n\n pub fn hash(text: &str) -> String {\n // ... isi fungsi hash milik module utilities::password\n }\n\n pub fn is_valid(plain: &str, hashed: &str) -> bool {\n // ... isi fungsi is_valid milik module utilities::password\n }\n }\n}\n\nfn main() {\n // ... isi fungsi main\n}\n")),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Item ",(0,t.kt)("inlineCode",{parentName:"li"},"utilities::random::string")," adalah fungsi nantinya digunakan untuk generate data random string"),(0,t.kt)("li",{parentName:"ul"},"Item ",(0,t.kt)("inlineCode",{parentName:"li"},"utilities::password::hash")," adalah fungsi untuk melakukan proses hashing password menggunakan ",(0,t.kt)("a",{parentName:"li",href:"https://en.wikipedia.org/wiki/Bcrypt"},"bcrypt")),(0,t.kt)("li",{parentName:"ul"},"Item ",(0,t.kt)("inlineCode",{parentName:"li"},"utilities::password::is_valid")," adalah fungsi untuk pengecekan apakah password sama dengan data setelah di-hash")),(0,t.kt)("p",null,"Ketiga fungsi tersebut kemudian diterapkan pada program kecil yang logic-nya ditulis dalam fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Pada contoh di atas, semua item dan sub-item milik ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities")," didefinisikan public menggunakan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub")," agar bisa diakses dari module."),(0,t.kt)("p",{parentName:"blockquote"},"Sedangkan module ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities")," sendiri tidak wajib di-expose menggunakan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub"),", karena definisi module-nya berada dalam satu file yang sama dengan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),", yaitu file ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),"."),(0,t.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub")," dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/visibility-privacy"},"Module System \u279c Visibility & Privacy"))),(0,t.kt)("p",null,"Sebelum lanjut proses koding, silakan tambahkan dulu beberapa dependencies berikut pada ",(0,t.kt)("inlineCode",{parentName:"p"},"Cargo.toml"),", kemudian jalankan ",(0,t.kt)("inlineCode",{parentName:"p"},"cargo build")," di-download."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="Cargo.toml"',title:'"Cargo.toml"'},'[package]\nname = "module_inline_1"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nbcrypt = "0.13"\nrand = "0.8.5"\n')),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Package ",(0,t.kt)("a",{parentName:"li",href:"https://crates.io/keywords/bcrypt"},(0,t.kt)("inlineCode",{parentName:"a"},"bcrypt"))," adalah crate yang isinya banyak fungsi untuk kebutuhan enkripsi bcrypt"),(0,t.kt)("li",{parentName:"ul"},"Package ",(0,t.kt)("a",{parentName:"li",href:"https://crates.io/keywords/rand"},(0,t.kt)("inlineCode",{parentName:"a"},"rand"))," berisi item untuk keperluan generate data random. Kita sudah beberapa kali menggunakan crate ini.")),(0,t.kt)("p",null,"Ok, sekarang kembali ke source code. Tulis isi fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities::random::string")," berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod utilities {\n\n pub mod random {\n\n pub fn string(length: u32) -> String {\n use rand::Rng;\n \n const CHARSET: &[u8] = "abcdefghijklmnopqrstuvwxyz".as_bytes();\n let mut arr = Vec::new();\n for _ in 0..=length {\n let n = rand::thread_rng().gen_range(0..(CHARSET.len()));\n let char = CHARSET[n];\n arr.push(char);\n }\n\n std::str::from_utf8(&arr[..]).unwrap().to_string()\n }\n }\n\n // ...\n}\n')),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Di atas adalah salah satu contoh penerapan generate random string dengan lebar ",(0,t.kt)("em",{parentName:"p"},"parameterized"),"."),(0,t.kt)("p",{parentName:"blockquote"},"Cara tersebut sebenarnya bukan yang paling efisien, namun karena jumlah topik yang kita pelajari masih belum terlalu banyak, penulis menghindari penerapan beberapa hal yang sifatnya baru dan bikin tambah bingung.")),(0,t.kt)("p",null,"Lanjut, silakan tulis kode untuk hashing password dan juga untuk validasi password berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"mod utilities {\n\n // ...\n\n pub mod password {\n\n pub fn hash(text: &str) -> String {\n let result = bcrypt::hash(text, bcrypt::DEFAULT_COST).unwrap();\n result\n }\n\n pub fn is_valid(plain: &str, hashed: &str) -> bool {\n let valid = bcrypt::verify(plain, hashed).unwrap();\n valid\n }\n }\n}\n")),(0,t.kt)("p",null,"Dalam enkripsi menggunakan bcrypt ada dua hal yang penting diketahui, yang pertama adalah data yang akan di-hash (pada contoh di atas adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"text"),"), dan ",(0,t.kt)("em",{parentName:"p"},"cost")," atau biaya enkripsi dalam bentuk numerik. Pada praktik ini, ",(0,t.kt)("inlineCode",{parentName:"p"},"bcrypt::DEFAULT_COST")," digunakan sebagai cost enkripsi."),(0,t.kt)("p",null,"Pengecekan apakah data terenkripsi adalah sama dengan data asli dilakukan menggunakan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"bcrypt::verify"),"."),(0,t.kt)("p",null,"Kedua fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"bcrypt::hash")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"bcrypt::verify")," menghasilkan data bertipe ",(0,t.kt)("em",{parentName:"p"},"generic result type")," atau ",(0,t.kt)("inlineCode",{parentName:"p"},"Result<T, E>"),". Tipe ini memiliki method bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"unwrap")," yang berguna untuk pengambilan result atau nilai."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Lebih jelasnya tentang result type dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/result-type"},"Tipe Data \u279c Result"))),(0,t.kt)("p",null,"Oke, sekarang fungsi utility sudah siap, mari implementasikan semua fungsi tersebut pada ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,t.kt)("p",null,"Silakan tulis kode berikut. Sebuah variabel bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"password")," dibuat, diisi dengan kombinasi dari string dan juga random string. Lalu data password tersebut di-hash kemudian dicek nilainya."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'fn main() {\n let password = format!("zereth mortis {}", utilities::random::string(10));\n println!("raw password: {}", password);\n\n let hashed = utilities::password::hash(&password);\n println!("hashed password: {}", hashed);\n\n let is_valid = utilities::password::is_valid(&password, &hashed);\n println!("is password matched? {}", is_valid);\n}\n')),(0,t.kt)("p",null,"Jalankan program untuk melihat hasilnya."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Rust Inline Module",src:n(9632).Z,width:"605",height:"125"})),(0,t.kt)("p",null,"Statement ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities::random::string(10)")," menghasilkan random string dengan lebar ",(0,t.kt)("inlineCode",{parentName:"p"},"10"),", sesuai kebutuhan. Hasil dari pemanggilan fungsi tersebut di-concat dengan text kemudian ditampung variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"password"),"."),(0,t.kt)("p",null,"Variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"password")," kemudian di-hash menggunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities::password::hash"),", kemudian dibandingkan hasil hash-nya apakah cocok dengan text aslinya menggunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities::password::is_valid"),"."),(0,t.kt)("h2",{id:"a213-inline-module-item"},"A.21.3. Inline module item"),(0,t.kt)("p",null,"Module item dalam inline module masih sama seperti pada module normal, yaitu adalah apapun yang didefinisikan di dalam sebuah module. Bisa berupa fungsi, konstanta, submodule, dan lainnya. Pada contoh di atas ada beberapa item didefinisikan:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Item ",(0,t.kt)("inlineCode",{parentName:"li"},"utilities::random")," yang merupakan sebuah submodule (inline module)."),(0,t.kt)("li",{parentName:"ul"},"Item ",(0,t.kt)("inlineCode",{parentName:"li"},"utilities::random::string")," yang merupakan sebuah fungsi."),(0,t.kt)("li",{parentName:"ul"},"Item ",(0,t.kt)("inlineCode",{parentName:"li"},"utilities::password")," yang merupakan sebuah submodule (inline module)."),(0,t.kt)("li",{parentName:"ul"},"Item ",(0,t.kt)("inlineCode",{parentName:"li"},"utilities::password::hash")," yang merupakan sebuah fungsi."),(0,t.kt)("li",{parentName:"ul"},"Item ",(0,t.kt)("inlineCode",{parentName:"li"},"utilities::password::is_valid")," yang merupakan sebuah fungsi.")),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Lebih jelasnya tentang macam-macam item dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/path-item"},"Module System \u279c Path & Item"))),(0,t.kt)("h2",{id:"a214-inline-module-file-nama_modulers-atau-nama_modulemodrs"},"A.21.4. Inline module file ",(0,t.kt)("inlineCode",{parentName:"h2"},"nama_module.rs")," atau ",(0,t.kt)("inlineCode",{parentName:"h2"},"nama_module/mod.rs")),(0,t.kt)("p",null,"Dalam ",(0,t.kt)("em",{parentName:"p"},"real project")," hampir tidak mungkin semua kode ditulis di file ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),". Pastinya kode akan di-split menjadi banyak module sesuai kebutuhan."),(0,t.kt)("p",null,"Kode sebelumya, akan kita refactor. Module ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities")," yang berada di ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs")," perlu dipindah ke file baru yang sesuai dengan aturan penulisan module, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module.rs")," atau ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module/mod.rs"),". Di sini penulis memilih ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module.rs"),", jadi silakan buat file bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities.rs"),", lalu pindah isi itemnya kesana (statement definisi inline module ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities")," tidak perlu ikut dipindah, hanya isinya saja, seperti normalnya definisi module)."),(0,t.kt)("p",null,"O iya, jangan lupa untuk menambahkan statement ",(0,t.kt)("inlineCode",{parentName:"p"},"mod utilities")," pada ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),", agar module terdaftar dan bisa digunakan."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Rust Inline Module",src:n(3009).Z,width:"775",height:"963"})),(0,t.kt)("p",null,"Jalankan program untuk melihat hasilnya."),(0,t.kt)("p",null,"Pada contoh ke-2 ini modul ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities")," didefinisikan menggunakan cara biasa, sedang isi dari module tersebut didefinisikan menggunakan teknik inline module."),(0,t.kt)("h2",{id:"a215-inline-module-path-attribute"},"A.21.5. Inline module ",(0,t.kt)("inlineCode",{parentName:"h2"},"path")," attribute"),(0,t.kt)("p",null,(0,t.kt)("inlineCode",{parentName:"p"},"path")," attribute bisa digunakan dalam manajemen inline module. Silakan utak-atik kode yang sudah dibuat dengan mengikuti step berikut:"),(0,t.kt)("ol",null,(0,t.kt)("li",{parentName:"ol"},(0,t.kt)("p",{parentName:"li"},"Buat file baru bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities/password.rs"),", kemudian pindah isi definisi module ",(0,t.kt)("inlineCode",{parentName:"p"},"password")," ke file tersebut.")),(0,t.kt)("li",{parentName:"ol"},(0,t.kt)("p",{parentName:"li"},"Buat file baru bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities/random.rs"),", kemudian pindah isi definisi module ",(0,t.kt)("inlineCode",{parentName:"p"},"random")," ke file tersebut.")),(0,t.kt)("li",{parentName:"ol"},(0,t.kt)("p",{parentName:"li"},"Hapus file ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities.rs"),", pindah definisi module ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities")," ke file ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),", hasilnya kurang lebih seperti ini:"),(0,t.kt)("pre",{parentName:"li"},(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod utilities {\n #[path = "random.rs"]\n pub mod random;\n\n #[path = "password.rs"]\n pub mod password;\n}\n\nfn main() {\n // ...\n}\n')))),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Rust Inline Module",src:n(6633).Z,width:"920",height:"954"})),(0,t.kt)("p",null,"Jalankan program untuk melihat hasilnya."),(0,t.kt)("p",null,"Pada kode di atas, ",(0,t.kt)("inlineCode",{parentName:"p"},"path")," yang digunakan bukan ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities/random.rs")," melainkan ",(0,t.kt)("inlineCode",{parentName:"p"},"random.rs"),", hail ini dikarenakan ",(0,t.kt)("inlineCode",{parentName:"p"},"path")," attribute dipanggil ",(0,t.kt)("strong",{parentName:"p"},"di dalam module ",(0,t.kt)("inlineCode",{parentName:"strong"},"utilities")),", menjadikan current path pada blok kode tersebut menjadi ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities/"),"."),(0,t.kt)("p",null,"Silakan coba ubah isi ",(0,t.kt)("inlineCode",{parentName:"p"},"path")," attribute menjadi ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities/random.rs"),", hasilnya adalah error. Rust akan menggunakan gabungan dari current path (",(0,t.kt)("inlineCode",{parentName:"p"},"utilities/"),") dan path pada ",(0,t.kt)("inlineCode",{parentName:"p"},"path")," attribute (",(0,t.kt)("inlineCode",{parentName:"p"},"utilities/random.rs"),") dalam lookup, jadinya yang di-lookup adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"utilities/utilities/random.rs"),", dan hasilnya error karena tidak ada file di sana."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Rust Inline Module",src:n(1081).Z,width:"772",height:"188"})),(0,t.kt)("p",null,"Module system di Rust merupakan topik yang cukup membingungkan (menurut penulis) karena desain-nya yang cukup unik jika dibandingkan dengan bagaimana bahasa pemrograman lain mengelola module-nya. Penulis anjurkan untuk mencoba praktik membuat program lainnya yang menerapkan module system, agar cepat terbiasa."),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/module_inline"},"github.com/novalagung/dasarpemrogramanrust-example/../module_inline")),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html"},"https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.mod.html"},"https://doc.rust-lang.org/std/keyword.mod.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/mod.html"},"https://doc.rust-lang.org/rust-by-example/mod.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://aloso.github.io/2021/03/28/module-system.html"},"https://aloso.github.io/2021/03/28/module-system.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/69275034/what-is-the-difference-between-use-and-pub-use"},"https://stackoverflow.com/questions/69275034/what-is-the-difference-between-use-and-pub-use"))))}p.isMDXComponent=!0},9632:(a,e,n)=>{n.d(e,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl0AAAB9CAIAAAAX00FjAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTAtMTlUMTg6MDI6MjYrMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyLTEwLTE5VDE5OjE3OjEyKzA3OjAwIiB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fmycfpp2c6qZeC3lQ3v/RJ0wEyHdlczakTAXf4wlupyiwrnnsSbOL3qI8c2Zce71uxPYdJ37M1wtXsy3f8SBP2E6Xc1FvBgWvi47Xtmts98hXrwTetSmInT1bmYhp9OXyvI208vva9O3r14Br4+6+5+o6moaTSxGm/YgMC2R1s0ROfav8yo0t+3FWe/hTfPiBeJGL7A472U166Mf192LxrykL6ZWfPAFruTV5hIcAC9eSa2OIYTzRt+KfNpbZScv3Ku46gNeBPAiLw+4KD/51Vw1BeBFAC8CAAAA8CIAAAAALwIAAADwIgAAAPD6eLG+W+9GcPJvao4X3hrOqbwe/RcAAIAXr5IXY0ltJUgZukbnqmUsAQDgknnxZnG1vBj6BB5eBACA7XlRqLnkj1vC1FekIVyxitbVLAtvSLzOfl0RdiOhZu8+FqtIyiCBq7/41AsAAC/6bk7Y67kuDeGad4Supiy8TqqhvHqcUPMqf7E2iMWLlhQtAADAiwYvRkUirlZDOHDvbXEtf+3I+jfhrxRqNlTSo7xYGGSxFC0AAMCLym+Ter9tXrwiDWGLF+3C10djfAd4pVBz+DJTyYshqralaAEAAF7UvCg9kIi/eDUawooXncL7Eq8tEjpGqHknXmRTEQAAL67hRX/z6bo0hKO8KAtfF7qlvLpSqNnUFg60jcWLmZSjWSQAAIAXtYilVohtRr94DeE2LxrytnW1POXVI4Wa47xYF0kbZArVH7x1igQAAPiLx4H1OAAAAPAivAgAAABehBcBAADAiwAAAAC8CAAAAMCLAAAAALwIAAAAwIsAAAAAvAgAAADAiwAAAAC8CAAAAIC7u/8Dd9E0Fm64vPIAAAAASUVORK5CYII="},3009:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/module-inline-2-c6d08bd6d0d03ddba99457fd3c0bdc5d.png"},6633:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/module-inline-3-9234cea75bd46ea1eea49d0320315320.png"},1081:(a,e,n)=>{n.d(e,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSU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+bM/ZSh2oFIylHpMyzLklsYqkaHEaZI8TRqpDMnymaVNWXsjOqqlTvNsXj27a1UvVH6jV3GExpIhK5Pk8TNkCAAABlSG4jLZ6EDJUGuZIak15WVIKlT6ZzWZISvTIzNDjv3400ip00T2c3iX6n/u7K65xI3czJD5ExkCAIBhlqGoNCbLZLOVz6bungxFk3sSTcnmA8WTmj0yJKf+tCJD0dwgOWcoeZxJkjUzqYQMCY8RU3bilE9ehmQbp0MpQ8/N7VJSpTpZPbtLdC7nDIlcVF6GosKcnFSUnzP07vIhPpcAAND3MjQyMnqgYeZP13FfWVcmUHvuDhO3jLkTqKecW89alKER624yMQV78kKy8PiialxqArVb4ZI3cJ0d9d4FJicJWZ1kM6mjTuI/o+Ja5jGiH6NZARkSjc9uVm0sGTq0/K6yofXlGT6YAADQ/zJUN90sk/UTfV54WnidzBAAACBDyNBwytCiLpFhQgAAgAwhQ8MqQwAAAMhQL8kQAAAAIEPIEAAAACBDAAAAAMgQAAAAADIEAAAAgAwBAAAAIEO9wuLy79/89Yab//6pRd5GAAAA6CUZ0r/MatOY3lbXDrzyxoYPl/+INxIAAAB6R4Zs6vmh1oyTG2++cRtvJAAAAPSoDI0fPdk4MFrjBpAhAAAA6F0Z2jbdqDUthAwBAABAL8tQ7WkhxUOf+vDXG1/hnQQAAICekyGdFqpx6rTtQxvIDwEAAEBvydD40ZMnj47XvgcnN3J3PQAAAPSeDHUtLcScIQAAAOg9GYq+aqgLaSFkCAAAAHpShroIMgQAAADDLEN8AzUAAAAMqQwlv03GffUAAAAwnDIEAAAAgAwBAAAAIEMAAAAAyBAAAAAAMgQAAACADAEAAAAgQwAAAADIEAAAAAAyBAAAAIAMAQAAACBDAAAAAMgQAAAAADIEAAAAgAwBAAAAIEMAAAAw3Pw/GeaY/+PLIkYAAAAASUVORK5CYII="}}]); \ No newline at end of file diff --git a/assets/js/3b1dfe68.a3e9cea9.js b/assets/js/3b1dfe68.acf67d2c.js similarity index 54% rename from assets/js/3b1dfe68.a3e9cea9.js rename to assets/js/3b1dfe68.acf67d2c.js index 36b7f22d..c79ec344 100644 --- a/assets/js/3b1dfe68.a3e9cea9.js +++ b/assets/js/3b1dfe68.acf67d2c.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[6161],{3905:(e,a,n)=>{n.d(a,{Zo:()=>u,kt:()=>k});var i=n(7294);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);a&&(i=i.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?l(Object(n),!0).forEach((function(a){t(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function s(e,a){if(null==e)return{};var n,i,t=function(e,a){if(null==e)return{};var n,i,t={},l=Object.keys(e);for(i=0;i<l.length;i++)n=l[i],a.indexOf(n)>=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(i=0;i<l.length;i++)n=l[i],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var m=i.createContext({}),p=function(e){var a=i.useContext(m),n=a;return e&&(n="function"==typeof e?e(a):r(r({},a),e)),n},u=function(e){var a=p(e.components);return i.createElement(m.Provider,{value:a},e.children)},d={inlineCode:"code",wrapper:function(e){var a=e.children;return i.createElement(i.Fragment,{},a)}},o=i.forwardRef((function(e,a){var n=e.components,t=e.mdxType,l=e.originalType,m=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),o=p(n),k=t,g=o["".concat(m,".").concat(k)]||o[k]||d[k]||l;return n?i.createElement(g,r(r({ref:a},u),{},{components:n})):i.createElement(g,r({ref:a},u))}));function k(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var l=n.length,r=new Array(l);r[0]=o;var s={};for(var m in a)hasOwnProperty.call(a,m)&&(s[m]=a[m]);s.originalType=e,s.mdxType="string"==typeof e?e:t,r[1]=s;for(var p=2;p<l;p++)r[p]=n[p];return i.createElement.apply(null,r)}return i.createElement.apply(null,n)}o.displayName="MDXCreateElement"},4008:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>m,contentTitle:()=>r,default:()=>d,frontMatter:()=>l,metadata:()=>s,toc:()=>p});var i=n(7462),t=(n(7294),n(3905));const l={sidebar_position:28,title:"A.28. Module System \u279c Visibility & Privacy",sidebar_label:"A.28. Module System \u279c Visibility & Privacy"},r=void 0,s={unversionedId:"basic/visibility-privacy",id:"basic/visibility-privacy",title:"A.28. Module System \u279c Visibility & Privacy",description:"Kita sebenarnya sudah mempelajari banyak hal yang berhubungan dengan visibility & privacy pada beberapa chapter sebelumnya. Jika pembaca mempelajari ebook ini secara urut, maka pastinya sudah familiar dengan keyword pub, self, crate, dan super.",source:"@site/docs/basic/visibility-privacy.md",sourceDirName:"basic",slug:"/basic/visibility-privacy",permalink:"/basic/visibility-privacy",draft:!1,tags:[],version:"current",sidebarPosition:28,frontMatter:{sidebar_position:28,title:"A.28. Module System \u279c Visibility & Privacy",sidebar_label:"A.28. Module System \u279c Visibility & Privacy"},sidebar:"tutorialSidebar",previous:{title:"A.27. Type Alias & Casting",permalink:"/basic/type-alias-casting"},next:{title:"A.29. Module System \u279c Use, Import, Re-export",permalink:"/basic/use"}},m={},p=[{value:"A.28.1. Pembahasan module system",id:"a281-pembahasan-module-system",level:2},{value:"A.28.2. Default visibility",id:"a282-default-visibility",level:2},{value:"A.28.3. Re-export item",id:"a283-re-export-item",level:2},{value:"A.28.4. Public visibility scope",id:"a284-public-visibility-scope",level:2},{value:"\u25c9 Keyword <code>pub</code>",id:"-keyword-pub",level:3},{value:"\u25c9 Keyword <code>pub(in path)</code>",id:"-keyword-pubin-path",level:3},{value:"\u25c9 Keyword <code>pub(crate)</code>",id:"-keyword-pubcrate",level:3},{value:"\u25c9 Keyword <code>pub(super)</code>",id:"-keyword-pubsuper",level:3},{value:"\u25c9 Keyword <code>pub(self)</code>",id:"-keyword-pubself",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],u={toc:p};function d(e){let{components:a,...l}=e;return(0,t.kt)("wrapper",(0,i.Z)({},u,l,{components:a,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Kita sebenarnya sudah mempelajari banyak hal yang berhubungan dengan visibility & privacy pada beberapa chapter sebelumnya. Jika pembaca mempelajari ebook ini secara urut, maka pastinya sudah familiar dengan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub"),", ",(0,t.kt)("inlineCode",{parentName:"p"},"self"),", ",(0,t.kt)("inlineCode",{parentName:"p"},"crate"),", dan ",(0,t.kt)("inlineCode",{parentName:"p"},"super"),"."),(0,t.kt)("p",null,"Chapter ini merupakan pembahasan tambahan untuk ke-4 keyword tersebut, dan fokusnya lebih ke visibility & privacy di Rust secara general."),(0,t.kt)("p",null,"O iya, perihal ",(0,t.kt)("em",{parentName:"p"},"visbility")," dan ",(0,t.kt)("em",{parentName:"p"},"privacy")," itu sendiri, kedua istilah tersebut di sini kita maknai sama, yang artinya kurang lebih adalah tentang manajemen akses item di Rust."),(0,t.kt)("h2",{id:"a281-pembahasan-module-system"},"A.28.1. Pembahasan module system"),(0,t.kt)("p",null,"Pastikan sudah mempelajari 5 buah chapter tentang module system yang sebelumnya sudah dibahas. Kesemua chapter tersebut sangat berhubungan dengan pembahasan chapter ini."),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/path-item"},"A.18. Module System \u279c Path & Item")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/package-crate"},"A.19. Module System \u279c Package & Crate")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/module-basic"},"A.20. Module System \u279c Module")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/module-inline"},"A.21. Module System \u279c Inline Module")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/module-scope-item-access"},"A.22. Module System \u279c Scope & Akses Item"))),(0,t.kt)("h2",{id:"a282-default-visibility"},"A.28.2. Default visibility"),(0,t.kt)("p",null,"Di Rust, ",(0,t.kt)("em",{parentName:"p"},"by default"),", hampir semua item adalah private. Apa efeknya ketika item adalah private atau publik? Silakan ingat 2 aturan penting berikut:"),(0,t.kt)("ol",null,(0,t.kt)("li",{parentName:"ol"},"Jika suatu item adalah private, maka item tersebut hanya bisa diakses dari ",(0,t.kt)("em",{parentName:"li"},"current module scope")," dan dari ",(0,t.kt)("em",{parentName:"li"},"submodules")," milik ",(0,t.kt)("em",{parentName:"li"},"current module"),"."),(0,t.kt)("li",{parentName:"ol"},"Jika suatu item adalah publik, maka dia bisa diakses dari module lain di luar ",(0,t.kt)("em",{parentName:"li"},"current module scope"),", dengan catatan parent module scope item tersebut harus publik.")),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Kita sepakati di sini, pada istilah ",(0,t.kt)("strong",{parentName:"p"},"current module")," kata ",(0,t.kt)("em",{parentName:"p"},"module")," di situ bisa saja tertuju untuk module atau juga submodule")),(0,t.kt)("p",null,"Dua point di atas sangat penting untuk dipahami, karena digunakan sebagai landasan pertimbangan dalam penyusunan hirarki module. Sebagai contoh, kita bisa membuat program yang hanya meng-expose API tertentu (yang memang diperlukan untuk diakses oleh publik), tanpa perlu ikut meng-expose detail implementasinya."),(0,t.kt)("p",null,"Ok, sekarang silakan perhatikan path sederhana di bawah ini. Diasumsikan ada sebuah fungsi yang path aksesnya adalah berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-bash"},"messaging::service_layer::some_black_magic\n")),(0,t.kt)("p",null,"Segmen pertama yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"messaging")," pasti adalah publik, karena di-import ke ",(0,t.kt)("em",{parentName:"p"},"crate root"),". Lalu bagaimana dengan segmen ",(0,t.kt)("inlineCode",{parentName:"p"},"service_layer")," dan juga ",(0,t.kt)("inlineCode",{parentName:"p"},"some_black_magic"),"?"),(0,t.kt)("p",null,"Jika item ",(0,t.kt)("inlineCode",{parentName:"p"},"some_black_magic")," di situ adalah publik, maka idealnya pengaksesan menggunakan path tersebut memungkinkan. Tapi kembali ke point ke-2 aturan yang sudah dibahas di atas, yaitu meskipun ",(0,t.kt)("inlineCode",{parentName:"p"},"some_black_magic")," adalah publik, jika parent-nya (yang pada konteks ini adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"service_layer"),") adalah private, maka pengaksesan menggunakan path tersebut menghasilkan error."),(0,t.kt)("p",null,"Intinya, ",(0,t.kt)("strong",{parentName:"p"},"sebuah item bisa diakses jika item tersebut adalah publik, dan parent item tersebut juga publik. Sedangkan default visibility untuk hampir semua item adalah private.")),(0,t.kt)("p",null,"Ok, sekarang mari lanjut ke praktik menggunakan contoh dengan pembahasan yang lebih mendetail. Silakan perhatikan dan praktikkan kode berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 messaging.rs\n \u2514\u2500\u2500\u2500 main.rs\n")),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/messaging.rs"',title:'"src/messaging.rs"'},'const SOME_MESSAGE: &str = "hello rust";\n\nmod service_layer {\n\n pub fn some_black_magic() {\n println!("{}", crate::messaging::SOME_MESSAGE)\n }\n}\n\npub fn say_hello() {\n service_layer::some_black_magic();\n}\n')),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"mod messaging;\n\nfn main() {\n messaging::say_hello();\n}\n")),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Konstanta ",(0,t.kt)("inlineCode",{parentName:"p"},"messaging::SOME_MESSAGE")," adalah ",(0,t.kt)("strong",{parentName:"p"},"private"),". Penjelasan:"),(0,t.kt)("ul",{parentName:"li"},(0,t.kt)("li",{parentName:"ul"},"Konstanta ini merupakan module item milik ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),"."),(0,t.kt)("li",{parentName:"ul"},"Konstanta ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari ",(0,t.kt)("em",{parentName:"li"},"current module scope")," (",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),")."),(0,t.kt)("li",{parentName:"ul"},"Konstanta ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari submodule milik ",(0,t.kt)("em",{parentName:"li"},"current module"),", yaitu submodule dari ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),". Contohnya bisa dilihat pada fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer::some_black_magic")," yang di situ ada statement pemanggilan ",(0,t.kt)("inlineCode",{parentName:"li"},"SOME_MESSAGE"),"."),(0,t.kt)("li",{parentName:"ul"},"Konstanta ini ",(0,t.kt)("strong",{parentName:"li"},"tidak bisa diakses")," dari luar ",(0,t.kt)("em",{parentName:"li"},"current module scope")," (",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),")."))),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Submodule ",(0,t.kt)("inlineCode",{parentName:"p"},"messaging::service_layer")," adalah ",(0,t.kt)("strong",{parentName:"p"},"private"),". Penjelasan:"),(0,t.kt)("ul",{parentName:"li"},(0,t.kt)("li",{parentName:"ul"},"Submodule ini merupakan module item milik ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),"."),(0,t.kt)("li",{parentName:"ul"},"Submodule ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari ",(0,t.kt)("em",{parentName:"li"},"current module scope")," (",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),"). Contohnya bisa dilihat pada fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::say_hello")," yang di situ ada statement pemanggilan ",(0,t.kt)("inlineCode",{parentName:"li"},"service_layer"),"."),(0,t.kt)("li",{parentName:"ul"},"Submodule ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari submodule milik ",(0,t.kt)("em",{parentName:"li"},"current module"),", yaitu submodule dari ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),"."),(0,t.kt)("li",{parentName:"ul"},"Submodule ini ",(0,t.kt)("strong",{parentName:"li"},"tidak bisa diakses")," dari luar ",(0,t.kt)("em",{parentName:"li"},"current module scope")," (",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),")."))),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"messaging::service_layer::some_black_magic")," adalah ",(0,t.kt)("strong",{parentName:"p"},"publik"),". Penjelasan:"),(0,t.kt)("ul",{parentName:"li"},(0,t.kt)("li",{parentName:"ul"},"Fungsi ini merupakan module item milik ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer"),"."),(0,t.kt)("li",{parentName:"ul"},"Fungsi ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari ",(0,t.kt)("em",{parentName:"li"},"current module scope")," (",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer"),")."),(0,t.kt)("li",{parentName:"ul"},"Fungsi ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari submodule milik ",(0,t.kt)("em",{parentName:"li"},"current module"),", yaitu submodule dari ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer"),". Contohnya bisa dilihat pada fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::say_hello")," yang di situ ada statement pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"some_black_magic"),"."),(0,t.kt)("li",{parentName:"ul"},"Fungsi ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari luar ",(0,t.kt)("em",{parentName:"li"},"current module scope")," (",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer"),")."),(0,t.kt)("li",{parentName:"ul"},"Namun meskipun demikian, bisa tidaknya fungsi ini diakses dari luar ",(0,t.kt)("em",{parentName:"li"},"current module scope")," (",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer"),") juga tergantung dengan visibility dari current module itu sendiri, yaitu ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer"),"."),(0,t.kt)("li",{parentName:"ul"},"Karena module ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer")," adalah private, meskipun fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"some_black_magic")," di dalamnya adalah publik, pengaksesan fungsi tersebut dari luar module scope ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer")," tidak dimungkinkan.",(0,t.kt)("ul",{parentName:"li"},(0,t.kt)("li",{parentName:"ul"},"Pengaksesan ",(0,t.kt)("inlineCode",{parentName:"li"},"service_layer::some_black_magic")," dari ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::say_hello")," tidak error karena submodule ",(0,t.kt)("inlineCode",{parentName:"li"},"service_layer")," meskipun private, posisinya adalah masih dalam satu module scope yang sama dengan fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"say_hello"),"."),(0,t.kt)("li",{parentName:"ul"},"Dimisalkan jika ",(0,t.kt)("inlineCode",{parentName:"li"},"service_layer::some_black_magic")," dipaksa diakses dari ",(0,t.kt)("inlineCode",{parentName:"li"},"main"),", maka muncul error karena ",(0,t.kt)("inlineCode",{parentName:"li"},"service_layer")," adalah private dan posisinya tidak berada dalam module scope yang sama dengan crate root (",(0,t.kt)("inlineCode",{parentName:"li"},"main"),")."))))),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"messaging::say_hello")," adalah ",(0,t.kt)("strong",{parentName:"p"},"public"),". Penjelasan:"),(0,t.kt)("ul",{parentName:"li"},(0,t.kt)("li",{parentName:"ul"},"Fungsi ini merupakan module item milik ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),"."),(0,t.kt)("li",{parentName:"ul"},"Fungsi ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari ",(0,t.kt)("em",{parentName:"li"},"current module scope")," (",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),")."),(0,t.kt)("li",{parentName:"ul"},"Fungsi ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari submodule milik ",(0,t.kt)("em",{parentName:"li"},"current module"),", yaitu submodule dari ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),"."),(0,t.kt)("li",{parentName:"ul"},"Fungsi ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari luar ",(0,t.kt)("em",{parentName:"li"},"current module scope")," (",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),"). Contohnya bisa dilihat pada crate root fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"main"),", di situ ada pemanggilan statement ",(0,t.kt)("inlineCode",{parentName:"li"},"say_hello"),".")))),(0,t.kt)("h2",{id:"a283-re-export-item"},"A.28.3. Re-export item"),(0,t.kt)("p",null,"Pada contoh, fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"messaging::say_hello")," didesain sebagai media untuk mengakses fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"some_black_magic"),". Di situasi ",(0,t.kt)("em",{parentName:"p"},"real world")," pastinya sangat jarang terjadi sebuah fungsi isinya hanya satu baris pemanggilan fungsi lainnya. Jika memang ada situasi seperti itu, (kontekstual) lebih baik hapus saja fungsi yang jadi media pemanggilan dan langsung saja panggil fungsi di dalamnya sesuai kebutuhan."),(0,t.kt)("p",null,"Pada praktik selanjutnya ini kita misalkan bahwa fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello")," isinya memang hanya 1 baris, dan yang paling penting adalah isi fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"some_black_magic")," perlu untuk bisa diakses dari ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),". Untuk kasus seperti ini ada 3 alternatif solusi:"),(0,t.kt)("ol",null,(0,t.kt)("li",{parentName:"ol"},"Tidak perlu mengubah apapun, gunakan saja kode yang sudah ditulis di atas. Kode tersebut sudah bisa mengakomodir pemanggilan ",(0,t.kt)("inlineCode",{parentName:"li"},"some_black_magic")," via ",(0,t.kt)("inlineCode",{parentName:"li"},"say_hello"),"."),(0,t.kt)("li",{parentName:"ol"},"Atau, hapus saja fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"say_hello"),", lalu ubah visibility module ",(0,t.kt)("inlineCode",{parentName:"li"},"service_layer")," menjadi publik, dengan demikian kita bisa mengakses ",(0,t.kt)("inlineCode",{parentName:"li"},"some_black_magic")," dari ",(0,t.kt)("inlineCode",{parentName:"li"},"main")," menggunakan path ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer::some_black_magic"),"."),(0,t.kt)("li",{parentName:"ol"},"Atau, gunakan teknik ",(0,t.kt)("strong",{parentName:"li"},"re-export item"),".")),(0,t.kt)("p",null,"Re-export item adalah sebuah cara untuk mem-",(0,t.kt)("em",{parentName:"p"},"bypass")," pengaksesan item yang secara hirarki memang tidak bisa diakses dari luar module (bisa jadi karena visibility item ataupun parent module nya adalah private). Dengan teknik ini, maka item pasti bisa diakses dari luar module."),(0,t.kt)("p",null,"Item yang di-re-export akan menjadi item milik ",(0,t.kt)("em",{parentName:"p"},"current module")," di mana statement re-export tersebut ditulis."),(0,t.kt)("p",null,"Cara re-export item adalah menggunakan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub use")," kemudian diikuti dengan path yang ingin di-export dan juga nama export item dengan notasi penulisan berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"pub use the_path as exported_name;\npub use self::service_layer::some_black_magic as say_hello;\n")),(0,t.kt)("p",null,"Contoh jika diterapkan pada program yang sebelumnya sudah ditulis:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/messaging.rs"',title:'"src/messaging.rs"'},'pub use self::service_layer::some_black_magic as say_hello;\n\nconst SOME_MESSAGE: &str = "hello rust";\n\nmod service_layer {\n\n pub fn some_black_magic() {\n println!("{}", crate::messaging::SOME_MESSAGE)\n }\n}\n')),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"mod messaging;\n\nfn main() {\n messaging::say_hello();\n}\n")),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Visibility & Privacy",src:n(2201).Z,width:"466",height:"109"})),(0,t.kt)("p",null,"Bisa dilihat di contoh di atas, fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello")," dihapus, kemudian item ",(0,t.kt)("inlineCode",{parentName:"p"},"service_layer::some_black_magic")," di-re-export dengan nama ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello"),". Dengannya kita bisa mengakses ",(0,t.kt)("inlineCode",{parentName:"p"},"some_black_magic")," dari luar module ",(0,t.kt)("inlineCode",{parentName:"p"},"messaging")," menggunakan path ",(0,t.kt)("inlineCode",{parentName:"p"},"messaging::say_hello"),"."),(0,t.kt)("p",null,"Jika item ingin di-re-export tanpa perubahan nama item, bisa gunakan notasi berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"pub use the_path;\npub use self::service_layer::some_black_magic;\n")),(0,t.kt)("p",null,"Jika diterapkan pada program sebelumnya, kurang lebih seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/messaging.rs"',title:'"src/messaging.rs"'},'pub use self::service_layer::some_black_magic;\n\nconst SOME_MESSAGE: &str = "hello rust";\n\nmod service_layer {\n\n pub fn some_black_magic() {\n println!("{}", crate::messaging::SOME_MESSAGE)\n }\n}\n')),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"mod messaging;\n\nfn main() {\n messaging::some_black_magic();\n}\n")),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"use")," dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/use"},"Module System \u279c Use"))),(0,t.kt)("h2",{id:"a284-public-visibility-scope"},"A.28.4. Public visibility scope"),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub")," digunakan untuk mengubah visibility item menjadi publik. Keyword ini bisa dikombinasikan dengan salah satu dari keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"self"),", ",(0,t.kt)("inlineCode",{parentName:"p"},"crate"),", dan ",(0,t.kt)("inlineCode",{parentName:"p"},"super"),"; denganya kita bisa menentukan visibility sebuah publik item dengan scope yang lebih spesifik."),(0,t.kt)("h3",{id:"-keyword-pub"},"\u25c9 Keyword ",(0,t.kt)("inlineCode",{parentName:"h3"},"pub")),(0,t.kt)("p",null,"Penulis rasa untuk penerapan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub")," ini sudah sangat jelas, kita beberapa kali mempraktikkannya."),(0,t.kt)("p",null,"Dengan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub"),", sebuah item visibility-nya menjadi publik."),(0,t.kt)("h3",{id:"-keyword-pubin-path"},"\u25c9 Keyword ",(0,t.kt)("inlineCode",{parentName:"h3"},"pub(in path)")),(0,t.kt)("p",null,"Keyword ini menjadikan visibility item hanya di dalam ",(0,t.kt)("inlineCode",{parentName:"p"},"path")," yang ditulis di ",(0,t.kt)("inlineCode",{parentName:"p"},"pub(in path)"),", dengan ketentuan ",(0,t.kt)("inlineCode",{parentName:"p"},"path")," tersebut merupakan parent dari module item di mana keyword digunakan."),(0,t.kt)("p",null,"Contohnya bisa dilihat pada kode berikut. Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello")," didefinisikan publik dengan scope path ditentukan secara eksplisit adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"crate::outer_mod"),". Dengan demikian fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello")," hanya bisa diakses dari dalam ",(0,t.kt)("inlineCode",{parentName:"p"},"outer_mod"),"."),(0,t.kt)("p",null,"Bisa dilihat di contoh, fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello")," diakses dari ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something"),". Silakan coba saja paksa untuk mengaksesnya dari fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),", hasilnya pasti error."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'pub mod outer_mod {\n\n pub mod inner_mod {\n\n // fungsi say_hello berikut hanya bisa diakses dari dalam `outer_mod`.\n // pengaksesannya dari luar `outer_mod` menghasilkan error.\n pub(in crate::outer_mod) fn say_hello() {\n println!("hello rust")\n }\n }\n\n pub fn do_something() {\n inner_mod::say_hello();\n }\n}\n\nfn main() {\n outer_mod::do_something();\n}\n')),(0,t.kt)("h3",{id:"-keyword-pubcrate"},"\u25c9 Keyword ",(0,t.kt)("inlineCode",{parentName:"h3"},"pub(crate)")),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub(crate)")," digunakan untuk membuat visibility item menjadi publik dengan scope akses ",(0,t.kt)("em",{parentName:"p"},"current crate"),". Dengan ini item bisa diakses dari manapun asalakan masih dalam crate yang sama."),(0,t.kt)("p",null,"Contoh penerapannya bisa dilihat berikut ini. Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello")," visibility scope nya ditentukan adalah ",(0,t.kt)("em",{parentName:"p"},"current crate"),". Fungsi tersebut bisa diakses dari ",(0,t.kt)("inlineCode",{parentName:"p"},"outer_mod_one::do_something"),", dari ",(0,t.kt)("inlineCode",{parentName:"p"},"outer_mod_two::do_something"),", dan juga dari fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'pub mod outer_mod_one {\n\n pub mod inner_mod {\n\n // fungsi ini visibility scope-nya di level crate\n pub(crate) fn say_hello() {\n println!("hello rust")\n }\n }\n\n pub fn do_something() {\n inner_mod::say_hello();\n }\n}\n\npub mod outer_mod_two {\n\n pub fn do_something() {\n crate::outer_mod_one::inner_mod::say_hello();\n }\n}\n\nfn main() {\n outer_mod_one::inner_mod::say_hello();\n outer_mod_one::do_something();\n outer_mod_two::do_something();\n}\n')),(0,t.kt)("h3",{id:"-keyword-pubsuper"},"\u25c9 Keyword ",(0,t.kt)("inlineCode",{parentName:"h3"},"pub(super)")),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub(super)")," digunakan untuk membuat visibility item menjadi publik dengan scope akses ",(0,t.kt)("em",{parentName:"p"},"parent module"),"."),(0,t.kt)("p",null,"Pada contoh berikut, fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello")," visibility scope nya ditentukan adalah ",(0,t.kt)("em",{parentName:"p"},"parent module"),", artinya fungsi tersebut hanya bisa diakses dari dalam ",(0,t.kt)("em",{parentName:"p"},"parent module")," (yang pada konteks ini adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"outer_mod"),")."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'pub mod outer_mod {\n\n pub mod inner_mod {\n\n // fungsi ini visibility scope-nya di parent module scope,\n // yaitu `outer_mod`\n pub(super) fn say_hello() {\n println!("hello rust")\n }\n }\n\n pub fn do_something() {\n inner_mod::say_hello();\n }\n}\n\nfn main() {\n outer_mod::do_something();\n}\n')),(0,t.kt)("h3",{id:"-keyword-pubself"},"\u25c9 Keyword ",(0,t.kt)("inlineCode",{parentName:"h3"},"pub(self)")),(0,t.kt)("p",null,"Keyword ini digunakan untuk membuat visibility item menjadi publik dengan scope akses hanya pada current module. Contohnya bisa dilihat pada kode program berikut."),(0,t.kt)("p",null,"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello")," visibility scope-nya adalah ",(0,t.kt)("em",{parentName:"p"},"current module"),". Fungsi tersebut hanya bisa diakses dari tempat yang merupakan module item dari ",(0,t.kt)("em",{parentName:"p"},"current module")," yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"inner_mod"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'pub mod outer_mod {\n\n pub mod inner_mod {\n\n // fungsi ini visibility scope-nya di current module scope,\n // yaitu `inner_mod`\n pub(self) fn say_hello() {\n println!("hello rust")\n }\n\n pub fn do_something() {\n say_hello();\n }\n }\n}\n\nfn main() {\n outer_mod::inner_mod::do_something();\n}\n')),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/visibility_privacy"},"github.com/novalagung/dasarpemrogramanrust-example/../visibility_privacy")),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/visibility-and-privacy.html"},"https://doc.rust-lang.org/reference/visibility-and-privacy.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://aloso.github.io/2021/03/28/module-system.html"},"https://aloso.github.io/2021/03/28/module-system.html"))))}d.isMDXComponent=!0},2201:(e,a,n)=>{n.d(a,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdIAAABtCAIAAACa6Xd1AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jl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0O3HNAFFw0Kq5gcPbYkNInTkG7xyKJ5zZRjnFbb3usq6u93eaGp563s7XiaUkNK21uZpF2T4roE5ad57sj7R6gq33T9Vy/rfXSrvvcGEHarQ9xkGFHzgWLwHqn0VnquUIbRZhe4lja9deTvEzaJQiCIO0SBEEQpF2CIAjSLkEQBEHaJQiCIO0SBEEQpF2CIAjSLkEQBGlX4PvvP3//++VO2iG4AV4kCIIg7a5Au8YNxbmsh1///f3z+zu7nCAI0i5plyAI0q7Koi/clUQKpuBBwqc+2h0z/GuTYkeaY2FtHlFmwY+gSu2l8DcDHQRBnIl2B2ps/t39q2HNgOxC5nTQbnhLm7/Ohj09j3T757dGu5pDTW+XIIgTBxmGHy9UFjBcTGx52g04OxuAaNKOmbcpLdpF+ZB2CYI4P+3K1Xsp7WbdY4s0tSDDFLkIbyHtEgRxG7SrEmWxt5v8XEC70EUm7RIEcQNBBisg64jthrSYhoadtNtf7PzbtLgoz0wBBEEQZ6DdS3JMoKU1EXqApwn624OTDObpAuyrjrn++f0rfBLgPNVDFwRBEBXSLkEQBEHaJQiCIO0SBEEQpF2CIAjSLkEQBGmXIAiCIO0SBEGQdgmCIAjSLkEQBGmXIAiCIO0SBEGQdgmCIEi7BEEQxCb4HzjE/yVJRbnzAAAAAElFTkSuQmCC"}}]); \ No newline at end of file +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[6161],{3905:(e,a,n)=>{n.d(a,{Zo:()=>u,kt:()=>k});var i=n(7294);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);a&&(i=i.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?l(Object(n),!0).forEach((function(a){t(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function s(e,a){if(null==e)return{};var n,i,t=function(e,a){if(null==e)return{};var n,i,t={},l=Object.keys(e);for(i=0;i<l.length;i++)n=l[i],a.indexOf(n)>=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(i=0;i<l.length;i++)n=l[i],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var m=i.createContext({}),p=function(e){var a=i.useContext(m),n=a;return e&&(n="function"==typeof e?e(a):r(r({},a),e)),n},u=function(e){var a=p(e.components);return i.createElement(m.Provider,{value:a},e.children)},d={inlineCode:"code",wrapper:function(e){var a=e.children;return i.createElement(i.Fragment,{},a)}},o=i.forwardRef((function(e,a){var n=e.components,t=e.mdxType,l=e.originalType,m=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),o=p(n),k=t,g=o["".concat(m,".").concat(k)]||o[k]||d[k]||l;return n?i.createElement(g,r(r({ref:a},u),{},{components:n})):i.createElement(g,r({ref:a},u))}));function k(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var l=n.length,r=new Array(l);r[0]=o;var s={};for(var m in a)hasOwnProperty.call(a,m)&&(s[m]=a[m]);s.originalType=e,s.mdxType="string"==typeof e?e:t,r[1]=s;for(var p=2;p<l;p++)r[p]=n[p];return i.createElement.apply(null,r)}return i.createElement.apply(null,n)}o.displayName="MDXCreateElement"},4008:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>m,contentTitle:()=>r,default:()=>d,frontMatter:()=>l,metadata:()=>s,toc:()=>p});var i=n(7462),t=(n(7294),n(3905));const l={sidebar_position:28,title:"A.28. Module System \u279c Visibility & Privacy",sidebar_label:"A.28. Module System \u279c Visibility & Privacy"},r=void 0,s={unversionedId:"basic/visibility-privacy",id:"basic/visibility-privacy",title:"A.28. Module System \u279c Visibility & Privacy",description:"Kita sebenarnya sudah mempelajari banyak hal yang berhubungan dengan visibility & privacy pada beberapa chapter sebelumnya. Jika pembaca mempelajari ebook ini secara urut, maka pastinya sudah familiar dengan keyword pub, self, crate, dan super.",source:"@site/docs/basic/visibility-privacy.md",sourceDirName:"basic",slug:"/basic/visibility-privacy",permalink:"/basic/visibility-privacy",draft:!1,tags:[],version:"current",sidebarPosition:28,frontMatter:{sidebar_position:28,title:"A.28. Module System \u279c Visibility & Privacy",sidebar_label:"A.28. Module System \u279c Visibility & Privacy"},sidebar:"tutorialSidebar",previous:{title:"A.27. Type Alias & Casting",permalink:"/basic/type-alias-casting"},next:{title:"A.29. Module System \u279c Use, Import, Re-export",permalink:"/basic/use"}},m={},p=[{value:"A.28.1. Pembahasan module system",id:"a281-pembahasan-module-system",level:2},{value:"A.28.2. Default visibility",id:"a282-default-visibility",level:2},{value:"A.28.3. Re-export item",id:"a283-re-export-item",level:2},{value:"A.28.4. Public visibility scope",id:"a284-public-visibility-scope",level:2},{value:"\u25c9 Keyword <code>pub</code>",id:"-keyword-pub",level:3},{value:"\u25c9 Keyword <code>pub(in path)</code>",id:"-keyword-pubin-path",level:3},{value:"\u25c9 Keyword <code>pub(crate)</code>",id:"-keyword-pubcrate",level:3},{value:"\u25c9 Keyword <code>pub(super)</code>",id:"-keyword-pubsuper",level:3},{value:"\u25c9 Keyword <code>pub(self)</code>",id:"-keyword-pubself",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],u={toc:p};function d(e){let{components:a,...l}=e;return(0,t.kt)("wrapper",(0,i.Z)({},u,l,{components:a,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Kita sebenarnya sudah mempelajari banyak hal yang berhubungan dengan visibility & privacy pada beberapa chapter sebelumnya. Jika pembaca mempelajari ebook ini secara urut, maka pastinya sudah familiar dengan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub"),", ",(0,t.kt)("inlineCode",{parentName:"p"},"self"),", ",(0,t.kt)("inlineCode",{parentName:"p"},"crate"),", dan ",(0,t.kt)("inlineCode",{parentName:"p"},"super"),"."),(0,t.kt)("p",null,"Chapter ini merupakan pembahasan tambahan untuk ke-4 keyword tersebut, dan fokusnya lebih ke visibility & privacy di Rust secara general."),(0,t.kt)("p",null,"O iya, perihal ",(0,t.kt)("em",{parentName:"p"},"visbility")," dan ",(0,t.kt)("em",{parentName:"p"},"privacy")," itu sendiri, kedua istilah tersebut di sini kita maknai sama, yang artinya kurang lebih adalah tentang manajemen akses item di Rust."),(0,t.kt)("h2",{id:"a281-pembahasan-module-system"},"A.28.1. Pembahasan module system"),(0,t.kt)("p",null,"Pastikan sudah mempelajari 5 buah chapter tentang module system yang sebelumnya sudah dibahas. Kesemua chapter tersebut sangat berhubungan dengan pembahasan chapter ini."),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/path-item"},"A.18. Module System \u279c Path & Item")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/package-crate"},"A.19. Module System \u279c Package & Crate")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/module-basic"},"A.20. Module System \u279c Module")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/module-inline"},"A.21. Module System \u279c Inline Module")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/module-scope-item-access"},"A.22. Module System \u279c Scope & Akses Item"))),(0,t.kt)("h2",{id:"a282-default-visibility"},"A.28.2. Default visibility"),(0,t.kt)("p",null,"Di Rust, ",(0,t.kt)("em",{parentName:"p"},"by default"),", hampir semua item adalah private. Apa efeknya ketika item adalah private atau publik? Silakan ingat 2 aturan penting berikut:"),(0,t.kt)("ol",null,(0,t.kt)("li",{parentName:"ol"},"Jika suatu item adalah private, maka item tersebut hanya bisa diakses dari ",(0,t.kt)("em",{parentName:"li"},"current module scope")," dan dari ",(0,t.kt)("em",{parentName:"li"},"submodules")," milik ",(0,t.kt)("em",{parentName:"li"},"current module"),"."),(0,t.kt)("li",{parentName:"ol"},"Jika suatu item adalah publik, maka dia bisa diakses dari module lain di luar ",(0,t.kt)("em",{parentName:"li"},"current module scope"),", dengan catatan parent module scope item tersebut harus publik.")),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Kita sepakati di sini, pada istilah ",(0,t.kt)("strong",{parentName:"p"},"current module")," kata ",(0,t.kt)("em",{parentName:"p"},"module")," di situ bisa saja tertuju untuk module atau juga submodule")),(0,t.kt)("p",null,"Dua point di atas sangat penting untuk dipahami, karena digunakan sebagai landasan pertimbangan dalam penyusunan hirarki module. Sebagai contoh, kita bisa membuat program yang hanya meng-expose API tertentu (yang memang diperlukan untuk diakses oleh publik), tanpa perlu ikut meng-expose detail implementasinya."),(0,t.kt)("p",null,"Ok, sekarang silakan perhatikan path sederhana di bawah ini. Diasumsikan ada sebuah fungsi yang path aksesnya adalah berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-bash"},"messaging::service_layer::some_black_magic\n")),(0,t.kt)("p",null,"Segmen pertama yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"messaging")," pasti adalah publik, karena di-import ke ",(0,t.kt)("em",{parentName:"p"},"crate root"),". Lalu bagaimana dengan segmen ",(0,t.kt)("inlineCode",{parentName:"p"},"service_layer")," dan juga ",(0,t.kt)("inlineCode",{parentName:"p"},"some_black_magic"),"?"),(0,t.kt)("p",null,"Jika item ",(0,t.kt)("inlineCode",{parentName:"p"},"some_black_magic")," di situ adalah publik, maka idealnya pengaksesan menggunakan path tersebut memungkinkan. Tapi kembali ke point ke-2 aturan yang sudah dibahas di atas, yaitu meskipun ",(0,t.kt)("inlineCode",{parentName:"p"},"some_black_magic")," adalah publik, jika parent-nya (yang pada konteks ini adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"service_layer"),") adalah private, maka pengaksesan menggunakan path tersebut menghasilkan error."),(0,t.kt)("p",null,"Intinya, ",(0,t.kt)("strong",{parentName:"p"},"sebuah item bisa diakses jika item tersebut adalah publik, dan parent item tersebut juga publik. Sedangkan default visibility untuk hampir semua item adalah private.")),(0,t.kt)("p",null,"Ok, sekarang mari lanjut ke praktik menggunakan contoh dengan pembahasan yang lebih mendetail. Silakan perhatikan dan praktikkan kode berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 messaging.rs\n \u2514\u2500\u2500\u2500 main.rs\n")),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/messaging.rs"',title:'"src/messaging.rs"'},'const SOME_MESSAGE: &str = "hello rust";\n\nmod service_layer {\n\n pub fn some_black_magic() {\n println!("{}", crate::messaging::SOME_MESSAGE)\n }\n}\n\npub fn say_hello() {\n service_layer::some_black_magic();\n}\n')),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"mod messaging;\n\nfn main() {\n messaging::say_hello();\n}\n")),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Konstanta ",(0,t.kt)("inlineCode",{parentName:"p"},"messaging::SOME_MESSAGE")," adalah ",(0,t.kt)("strong",{parentName:"p"},"private"),". Penjelasan:"),(0,t.kt)("ul",{parentName:"li"},(0,t.kt)("li",{parentName:"ul"},"Konstanta ini merupakan module item milik ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),"."),(0,t.kt)("li",{parentName:"ul"},"Konstanta ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari ",(0,t.kt)("em",{parentName:"li"},"current module scope")," (",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),")."),(0,t.kt)("li",{parentName:"ul"},"Konstanta ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari submodule milik ",(0,t.kt)("em",{parentName:"li"},"current module"),", yaitu submodule dari ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),". Contohnya bisa dilihat pada fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer::some_black_magic")," yang di situ ada statement pemanggilan ",(0,t.kt)("inlineCode",{parentName:"li"},"SOME_MESSAGE"),"."),(0,t.kt)("li",{parentName:"ul"},"Konstanta ini ",(0,t.kt)("strong",{parentName:"li"},"tidak bisa diakses")," dari luar ",(0,t.kt)("em",{parentName:"li"},"current module scope")," (",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),")."))),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Submodule ",(0,t.kt)("inlineCode",{parentName:"p"},"messaging::service_layer")," adalah ",(0,t.kt)("strong",{parentName:"p"},"private"),". Penjelasan:"),(0,t.kt)("ul",{parentName:"li"},(0,t.kt)("li",{parentName:"ul"},"Submodule ini merupakan module item milik ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),"."),(0,t.kt)("li",{parentName:"ul"},"Submodule ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari ",(0,t.kt)("em",{parentName:"li"},"current module scope")," (",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),"). Contohnya bisa dilihat pada fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::say_hello")," yang di situ ada statement pemanggilan ",(0,t.kt)("inlineCode",{parentName:"li"},"service_layer"),"."),(0,t.kt)("li",{parentName:"ul"},"Submodule ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari submodule milik ",(0,t.kt)("em",{parentName:"li"},"current module"),", yaitu submodule dari ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),"."),(0,t.kt)("li",{parentName:"ul"},"Submodule ini ",(0,t.kt)("strong",{parentName:"li"},"tidak bisa diakses")," dari luar ",(0,t.kt)("em",{parentName:"li"},"current module scope")," (",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),")."))),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"messaging::service_layer::some_black_magic")," adalah ",(0,t.kt)("strong",{parentName:"p"},"publik"),". Penjelasan:"),(0,t.kt)("ul",{parentName:"li"},(0,t.kt)("li",{parentName:"ul"},"Fungsi ini merupakan module item milik ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer"),"."),(0,t.kt)("li",{parentName:"ul"},"Fungsi ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari ",(0,t.kt)("em",{parentName:"li"},"current module scope")," (",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer"),")."),(0,t.kt)("li",{parentName:"ul"},"Fungsi ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari submodule milik ",(0,t.kt)("em",{parentName:"li"},"current module"),", yaitu submodule dari ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer"),". Contohnya bisa dilihat pada fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::say_hello")," yang di situ ada statement pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"some_black_magic"),"."),(0,t.kt)("li",{parentName:"ul"},"Fungsi ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari luar ",(0,t.kt)("em",{parentName:"li"},"current module scope")," (",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer"),")."),(0,t.kt)("li",{parentName:"ul"},"Namun meskipun demikian, bisa tidaknya fungsi ini diakses dari luar ",(0,t.kt)("em",{parentName:"li"},"current module scope")," (",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer"),") juga tergantung dengan visibility dari current module itu sendiri, yaitu ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer"),"."),(0,t.kt)("li",{parentName:"ul"},"Karena module ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer")," adalah private, meskipun fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"some_black_magic")," di dalamnya adalah publik, pengaksesan fungsi tersebut dari luar module scope ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer")," tidak dimungkinkan.",(0,t.kt)("ul",{parentName:"li"},(0,t.kt)("li",{parentName:"ul"},"Pengaksesan ",(0,t.kt)("inlineCode",{parentName:"li"},"service_layer::some_black_magic")," dari ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::say_hello")," tidak error karena submodule ",(0,t.kt)("inlineCode",{parentName:"li"},"service_layer")," meskipun private, posisinya adalah masih dalam satu module scope yang sama dengan fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"say_hello"),"."),(0,t.kt)("li",{parentName:"ul"},"Dimisalkan jika ",(0,t.kt)("inlineCode",{parentName:"li"},"service_layer::some_black_magic")," dipaksa diakses dari ",(0,t.kt)("inlineCode",{parentName:"li"},"main"),", maka muncul error karena ",(0,t.kt)("inlineCode",{parentName:"li"},"service_layer")," adalah private dan posisinya tidak berada dalam module scope yang sama dengan crate root (",(0,t.kt)("inlineCode",{parentName:"li"},"main"),")."))))),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"messaging::say_hello")," adalah ",(0,t.kt)("strong",{parentName:"p"},"public"),". Penjelasan:"),(0,t.kt)("ul",{parentName:"li"},(0,t.kt)("li",{parentName:"ul"},"Fungsi ini merupakan module item milik ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),"."),(0,t.kt)("li",{parentName:"ul"},"Fungsi ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari ",(0,t.kt)("em",{parentName:"li"},"current module scope")," (",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),")."),(0,t.kt)("li",{parentName:"ul"},"Fungsi ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari submodule milik ",(0,t.kt)("em",{parentName:"li"},"current module"),", yaitu submodule dari ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),"."),(0,t.kt)("li",{parentName:"ul"},"Fungsi ini ",(0,t.kt)("strong",{parentName:"li"},"bisa diakses")," dari luar ",(0,t.kt)("em",{parentName:"li"},"current module scope")," (",(0,t.kt)("inlineCode",{parentName:"li"},"messaging"),"). Contohnya bisa dilihat pada crate root fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"main"),", di situ ada pemanggilan statement ",(0,t.kt)("inlineCode",{parentName:"li"},"say_hello"),".")))),(0,t.kt)("h2",{id:"a283-re-export-item"},"A.28.3. Re-export item"),(0,t.kt)("p",null,"Pada contoh, fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"messaging::say_hello")," didesain sebagai media untuk mengakses fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"some_black_magic"),". Di situasi ",(0,t.kt)("em",{parentName:"p"},"real world")," pastinya sangat jarang terjadi sebuah fungsi isinya hanya satu baris pemanggilan fungsi lainnya. Jika memang ada situasi seperti itu, (kontekstual) lebih baik hapus saja fungsi yang jadi media pemanggilan dan langsung saja panggil fungsi di dalamnya sesuai kebutuhan."),(0,t.kt)("p",null,"Pada praktik selanjutnya ini kita misalkan bahwa fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello")," isinya memang hanya 1 baris, dan yang paling penting adalah isi fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"some_black_magic")," perlu untuk bisa diakses dari ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),". Untuk kasus seperti ini ada 3 alternatif solusi:"),(0,t.kt)("ol",null,(0,t.kt)("li",{parentName:"ol"},"Tidak perlu mengubah apapun, gunakan saja kode yang sudah ditulis di atas. Kode tersebut sudah bisa mengakomodir pemanggilan ",(0,t.kt)("inlineCode",{parentName:"li"},"some_black_magic")," via ",(0,t.kt)("inlineCode",{parentName:"li"},"say_hello"),"."),(0,t.kt)("li",{parentName:"ol"},"Atau, hapus saja fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"say_hello"),", lalu ubah visibility module ",(0,t.kt)("inlineCode",{parentName:"li"},"service_layer")," menjadi publik, dengan demikian kita bisa mengakses ",(0,t.kt)("inlineCode",{parentName:"li"},"some_black_magic")," dari ",(0,t.kt)("inlineCode",{parentName:"li"},"main")," menggunakan path ",(0,t.kt)("inlineCode",{parentName:"li"},"messaging::service_layer::some_black_magic"),"."),(0,t.kt)("li",{parentName:"ol"},"Atau, gunakan teknik ",(0,t.kt)("strong",{parentName:"li"},"re-export item"),".")),(0,t.kt)("p",null,"Re-export item adalah sebuah cara untuk mem-",(0,t.kt)("em",{parentName:"p"},"bypass")," pengaksesan item yang secara hirarki memang tidak bisa diakses dari luar module (bisa jadi karena visibility item ataupun parent module nya adalah private). Dengan teknik ini, maka item pasti bisa diakses dari luar module."),(0,t.kt)("p",null,"Item yang di-re-export akan menjadi item milik ",(0,t.kt)("em",{parentName:"p"},"current module")," di mana statement re-export tersebut ditulis."),(0,t.kt)("p",null,"Cara re-export item adalah menggunakan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub use")," kemudian diikuti dengan path yang ingin di-export dan juga nama export item dengan notasi penulisan berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"pub use the_path as exported_name;\npub use self::service_layer::some_black_magic as say_hello;\n")),(0,t.kt)("p",null,"Contoh jika diterapkan pada program yang sebelumnya sudah ditulis:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/messaging.rs"',title:'"src/messaging.rs"'},'pub use self::service_layer::some_black_magic as say_hello;\n\nconst SOME_MESSAGE: &str = "hello rust";\n\nmod service_layer {\n\n pub fn some_black_magic() {\n println!("{}", crate::messaging::SOME_MESSAGE)\n }\n}\n')),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"mod messaging;\n\nfn main() {\n messaging::say_hello();\n}\n")),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Visibility & Privacy",src:n(2201).Z,width:"466",height:"109"})),(0,t.kt)("p",null,"Bisa dilihat di contoh di atas, fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello")," dihapus, kemudian item ",(0,t.kt)("inlineCode",{parentName:"p"},"service_layer::some_black_magic")," di-re-export dengan nama ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello"),". Dengannya kita bisa mengakses ",(0,t.kt)("inlineCode",{parentName:"p"},"some_black_magic")," dari luar module ",(0,t.kt)("inlineCode",{parentName:"p"},"messaging")," menggunakan path ",(0,t.kt)("inlineCode",{parentName:"p"},"messaging::say_hello"),"."),(0,t.kt)("p",null,"Jika item ingin di-re-export tanpa perubahan nama item, bisa gunakan notasi berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"pub use the_path;\npub use self::service_layer::some_black_magic;\n")),(0,t.kt)("p",null,"Jika diterapkan pada program sebelumnya, kurang lebih seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/messaging.rs"',title:'"src/messaging.rs"'},'pub use self::service_layer::some_black_magic;\n\nconst SOME_MESSAGE: &str = "hello rust";\n\nmod service_layer {\n\n pub fn some_black_magic() {\n println!("{}", crate::messaging::SOME_MESSAGE)\n }\n}\n')),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"mod messaging;\n\nfn main() {\n messaging::some_black_magic();\n}\n")),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"use")," dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/use"},"Module System \u279c Use"))),(0,t.kt)("h2",{id:"a284-public-visibility-scope"},"A.28.4. Public visibility scope"),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub")," digunakan untuk mengubah visibility item menjadi publik. Keyword ini bisa dikombinasikan dengan salah satu dari keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"self"),", ",(0,t.kt)("inlineCode",{parentName:"p"},"crate"),", dan ",(0,t.kt)("inlineCode",{parentName:"p"},"super"),"; denganya kita bisa menentukan visibility sebuah publik item dengan scope yang lebih spesifik."),(0,t.kt)("h3",{id:"-keyword-pub"},"\u25c9 Keyword ",(0,t.kt)("inlineCode",{parentName:"h3"},"pub")),(0,t.kt)("p",null,"Penulis rasa untuk penerapan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub")," ini sudah sangat jelas, kita beberapa kali mempraktikkannya."),(0,t.kt)("p",null,"Dengan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub"),", sebuah item visibility-nya menjadi publik."),(0,t.kt)("h3",{id:"-keyword-pubin-path"},"\u25c9 Keyword ",(0,t.kt)("inlineCode",{parentName:"h3"},"pub(in path)")),(0,t.kt)("p",null,"Keyword ini menjadikan visibility item hanya di dalam ",(0,t.kt)("inlineCode",{parentName:"p"},"path")," yang ditulis di ",(0,t.kt)("inlineCode",{parentName:"p"},"pub(in path)"),", dengan ketentuan ",(0,t.kt)("inlineCode",{parentName:"p"},"path")," tersebut merupakan parent dari module item di mana keyword digunakan."),(0,t.kt)("p",null,"Contohnya bisa dilihat pada kode berikut. Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello")," didefinisikan publik dengan scope path ditentukan secara eksplisit adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"crate::outer_mod"),". Dengan demikian fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello")," hanya bisa diakses dari dalam ",(0,t.kt)("inlineCode",{parentName:"p"},"outer_mod"),"."),(0,t.kt)("p",null,"Bisa dilihat di contoh, fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello")," diakses dari ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something"),". Silakan coba saja paksa untuk mengaksesnya dari fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),", hasilnya pasti error."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'pub mod outer_mod {\n\n pub mod inner_mod {\n\n // fungsi say_hello berikut hanya bisa diakses dari dalam `outer_mod`.\n // pengaksesannya dari luar `outer_mod` menghasilkan error.\n pub(in crate::outer_mod) fn say_hello() {\n println!("hello rust")\n }\n }\n\n pub fn do_something() {\n inner_mod::say_hello();\n }\n}\n\nfn main() {\n outer_mod::do_something();\n}\n')),(0,t.kt)("h3",{id:"-keyword-pubcrate"},"\u25c9 Keyword ",(0,t.kt)("inlineCode",{parentName:"h3"},"pub(crate)")),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub(crate)")," digunakan untuk membuat visibility item menjadi publik dengan scope akses ",(0,t.kt)("em",{parentName:"p"},"current crate"),". Dengan ini item bisa diakses dari manapun asalakan masih dalam crate yang sama."),(0,t.kt)("p",null,"Contoh penerapannya bisa dilihat berikut ini. Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello")," visibility scope nya ditentukan adalah ",(0,t.kt)("em",{parentName:"p"},"current crate"),". Fungsi tersebut bisa diakses dari ",(0,t.kt)("inlineCode",{parentName:"p"},"outer_mod_one::do_something"),", dari ",(0,t.kt)("inlineCode",{parentName:"p"},"outer_mod_two::do_something"),", dan juga dari fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'pub mod outer_mod_one {\n\n pub mod inner_mod {\n\n // fungsi ini visibility scope-nya di level crate\n pub(crate) fn say_hello() {\n println!("hello rust")\n }\n }\n\n pub fn do_something() {\n inner_mod::say_hello();\n }\n}\n\npub mod outer_mod_two {\n\n pub fn do_something() {\n crate::outer_mod_one::inner_mod::say_hello();\n }\n}\n\nfn main() {\n outer_mod_one::inner_mod::say_hello();\n outer_mod_one::do_something();\n outer_mod_two::do_something();\n}\n')),(0,t.kt)("h3",{id:"-keyword-pubsuper"},"\u25c9 Keyword ",(0,t.kt)("inlineCode",{parentName:"h3"},"pub(super)")),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub(super)")," digunakan untuk membuat visibility item menjadi publik dengan scope akses ",(0,t.kt)("em",{parentName:"p"},"parent module"),"."),(0,t.kt)("p",null,"Pada contoh berikut, fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello")," visibility scope nya ditentukan adalah ",(0,t.kt)("em",{parentName:"p"},"parent module"),", artinya fungsi tersebut hanya bisa diakses dari dalam ",(0,t.kt)("em",{parentName:"p"},"parent module")," (yang pada konteks ini adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"outer_mod"),")."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'pub mod outer_mod {\n\n pub mod inner_mod {\n\n // fungsi ini visibility scope-nya di parent module scope,\n // yaitu `outer_mod`\n pub(super) fn say_hello() {\n println!("hello rust")\n }\n }\n\n pub fn do_something() {\n inner_mod::say_hello();\n }\n}\n\nfn main() {\n outer_mod::do_something();\n}\n')),(0,t.kt)("h3",{id:"-keyword-pubself"},"\u25c9 Keyword ",(0,t.kt)("inlineCode",{parentName:"h3"},"pub(self)")),(0,t.kt)("p",null,"Keyword ini digunakan untuk membuat visibility item menjadi publik dengan scope akses hanya pada current module. Contohnya bisa dilihat pada kode program berikut."),(0,t.kt)("p",null,"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello")," visibility scope-nya adalah ",(0,t.kt)("em",{parentName:"p"},"current module"),". Fungsi tersebut hanya bisa diakses dari tempat yang merupakan module item dari ",(0,t.kt)("em",{parentName:"p"},"current module")," yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"inner_mod"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'pub mod outer_mod {\n\n pub mod inner_mod {\n\n // fungsi ini visibility scope-nya di current module scope,\n // yaitu `inner_mod`\n pub(self) fn say_hello() {\n println!("hello rust")\n }\n\n pub fn do_something() {\n say_hello();\n }\n }\n}\n\nfn main() {\n outer_mod::inner_mod::do_something();\n}\n')),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/visibility_privacy"},"github.com/novalagung/dasarpemrogramanrust-example/../visibility_privacy")),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/visibility-and-privacy.html"},"https://doc.rust-lang.org/reference/visibility-and-privacy.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://aloso.github.io/2021/03/28/module-system.html"},"https://aloso.github.io/2021/03/28/module-system.html"))))}d.isMDXComponent=!0},2201:(e,a,n)=>{n.d(a,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdIAAABtCAIAAACa6Xd1AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6T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EC70EUm7RIEcQNBBisg64jthrSYhoadtNtf7PzbtLgoz0wBBEEQZ6DdS3JMoKU1EXqApwn624OTDObpAuyrjrn++f0rfBLgPNVDFwRBEBXSLkEQBEHaJQiCIO0SBEEQpF2CIAjSLkEQBGmXIAiCIO0SBEGQdgmCIAjSLkEQBGmXIAiCIO0SBEGQdgmCIEi7BEEQxCb4HzjE/yVJRbnzAAAAAElFTkSuQmCC"}}]); \ No newline at end of file diff --git a/assets/js/3d2f5b0c.1f148699.js b/assets/js/3d2f5b0c.1f148699.js deleted file mode 100644 index 72d44f9e..00000000 --- a/assets/js/3d2f5b0c.1f148699.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[676],{3905:(e,a,n)=>{n.d(a,{Zo:()=>u,kt:()=>m});var t=n(7294);function r(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function i(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function l(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?i(Object(n),!0).forEach((function(a){r(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function p(e,a){if(null==e)return{};var n,t,r=function(e,a){if(null==e)return{};var n,t,r={},i=Object.keys(e);for(t=0;t<i.length;t++)n=i[t],a.indexOf(n)>=0||(r[n]=e[n]);return r}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t<i.length;t++)n=i[t],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var o=t.createContext({}),d=function(e){var a=t.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},u=function(e){var a=d(e.components);return t.createElement(o.Provider,{value:a},e.children)},s={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},k=t.forwardRef((function(e,a){var n=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),k=d(n),m=r,g=k["".concat(o,".").concat(m)]||k[m]||s[m]||i;return n?t.createElement(g,l(l({ref:a},u),{},{components:n})):t.createElement(g,l({ref:a},u))}));function m(e,a){var n=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=k;var p={};for(var o in a)hasOwnProperty.call(a,o)&&(p[o]=a[o]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var d=2;d<i;d++)l[d]=n[d];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}k.displayName="MDXCreateElement"},5569:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>l,default:()=>s,frontMatter:()=>i,metadata:()=>p,toc:()=>d});var t=n(7462),r=(n(7294),n(3905));const i={sidebar_position:41,title:"A.41. Operator ?",sidebar_label:"A.41. Operator ?"},l=void 0,p={unversionedId:"basic/operator-tanda-tanya",id:"basic/operator-tanda-tanya",title:"A.41. Operator ?",description:"Operator ? (atau question mark operator) adalah operator yang cukup berguna untuk operasi unwrap nilai dari tipe Result atau Option. Pada chapter ini kita akan belajar tentang operator tersebut.",source:"@site/docs/basic/operator-tanda-tanya.md",sourceDirName:"basic",slug:"/basic/operator-tanda-tanya",permalink:"/basic/operator-tanda-tanya",draft:!1,tags:[],version:"current",sidebarPosition:41,frontMatter:{sidebar_position:41,title:"A.41. Operator ?",sidebar_label:"A.41. Operator ?"},sidebar:"tutorialSidebar",previous:{title:"A.40. Tipe Data \u279c Result",permalink:"/basic/result-type"},next:{title:"A.42. Pattern Matching",permalink:"/basic/pattern-matching"}},o={},d=[{value:"A.41.1. Operator ?",id:"a411-operator-",level:2},{value:"\u25c9 Refactor ke-1",id:"-refactor-ke-1",level:3},{value:"\u25c9 Refactor ke-2",id:"-refactor-ke-2",level:3},{value:"\u25c9 Refactor ke-3",id:"-refactor-ke-3",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Work in progress",id:"-work-in-progress",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],u={toc:d};function s(e){let{components:a,...i}=e;return(0,r.kt)("wrapper",(0,t.Z)({},u,i,{components:a,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Operator ",(0,r.kt)("inlineCode",{parentName:"p"},"?")," (atau ",(0,r.kt)("em",{parentName:"p"},"question mark operator"),") adalah operator yang cukup berguna untuk operasi ",(0,r.kt)("strong",{parentName:"p"},"unwrap")," nilai dari tipe ",(0,r.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," atau ",(0,r.kt)("inlineCode",{parentName:"p"},"Option<T>"),". Pada chapter ini kita akan belajar tentang operator tersebut."),(0,r.kt)("h2",{id:"a411-operator-"},"A.41.1. Operator ?"),(0,r.kt)("p",null,"Operator ",(0,r.kt)("inlineCode",{parentName:"p"},"?")," digunakan untuk operasi ",(0,r.kt)("strong",{parentName:"p"},"unwrap")," value dari tipe data ",(0,r.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," (dan ",(0,r.kt)("inlineCode",{parentName:"p"},"Option<T>"),")."),(0,r.kt)("p",null,"Penggunaannya terhadap tipe data ",(0,r.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," cukup umum untuk keperluan penanganan error (atau ",(0,r.kt)("em",{parentName:"p"},"error propagation"),"). Ketika suatu object dengan tipe tersebut di-unwrap menggunakan operator ",(0,r.kt)("inlineCode",{parentName:"p"},"?"),", maka:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Jika nilai object adalah bertipe ",(0,r.kt)("inlineCode",{parentName:"li"},"T"),", maka yang dikembalikan adalah nilai ",(0,r.kt)("inlineCode",{parentName:"li"},"T")),(0,r.kt)("li",{parentName:"ul"},"Jika nilai object adalah bertipe ",(0,r.kt)("inlineCode",{parentName:"li"},"E"),", maka yang dikembalikan adalah nilai ",(0,r.kt)("inlineCode",{parentName:"li"},"E")," atau error.")),(0,r.kt)("p",null,"Agar lebih mudah memahami kegunaan dari operator ini, pembelajaran lebih baik dimulai dengan praktik kode yang didalamnya ada penerapan tipe data ",(0,r.kt)("inlineCode",{parentName:"p"},"Result")," (atau ",(0,r.kt)("inlineCode",{parentName:"p"},"Option"),"). Di contoh berikut, tipe data ",(0,r.kt)("inlineCode",{parentName:"p"},"Result")," kita pilih untuk praktek."),(0,r.kt)("p",null,"Silakan tulis kode berikut, pelajari, kemudian jalankan."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n do_some_math();\n}\n\nfn do_some_math() {\n let result1 = divider(10.0, 5.0);\n match result1 {\n Err(m) => println!("ERROR! {:?}", m),\n Ok(r) => println!("result: {r:.2}"),\n }\n \n let result2 = divider(10.0, 0.0);\n match result2 {\n Err(m) => println!("ERROR! {:?}", m),\n Ok(r) => println!("result: {r:.2}"),\n }\n \n let result3 = divider(10.0, 2.0);\n match result3 {\n Err(m) => println!("ERROR! {:?}", m),\n Ok(r) => println!("result: {r:.2}"),\n }\n}\n\nfn divider(a: f64, b: f64) -> Result<f64, &\'static str> {\n if b == 0.0 {\n return Err("division by zero error");\n }\n\n let result = a / b;\n return Ok(result);\n}\n')),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Pada contoh di atas, operasi aritmatika ditempatkan dalam fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"do_some_math()")," dan tidak langsung dalam fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main()"),". Ini disengaja karena berhubungan dengan contoh berikutnya. ")),(0,r.kt)("p",null,"Fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"divider()")," dibuat dengan kegunaan sangat spesifik, yaitu melakukan operasi aritmatika pembagian. Fungsi tersebut menghasilkan error jika ditemukan nilai pembagi adalah angka ",(0,r.kt)("inlineCode",{parentName:"p"},"0"),"."),(0,r.kt)("p",null,"Output program:"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Operator ? / tanda tanya / question mark",src:n(8889).Z,width:"530",height:"149"})),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Hasil statement ",(0,r.kt)("inlineCode",{parentName:"li"},"divider(10.0, 5.0)")," memenuhi kriteria ",(0,r.kt)("inlineCode",{parentName:"li"},"Ok(r)"),", maka outputnya adalah ",(0,r.kt)("inlineCode",{parentName:"li"},"result: 2.00")),(0,r.kt)("li",{parentName:"ul"},"Hasil statement ",(0,r.kt)("inlineCode",{parentName:"li"},"divider(10.0, 0.0)")," memenuhi kriteria ",(0,r.kt)("inlineCode",{parentName:"li"},"Err(m)"),", maka outputnya adalah ",(0,r.kt)("inlineCode",{parentName:"li"},'ERROR! "division by zero error"')),(0,r.kt)("li",{parentName:"ul"},"Hasil statement ",(0,r.kt)("inlineCode",{parentName:"li"},"divider(10.0, 2.0)")," memenuhi kriteria ",(0,r.kt)("inlineCode",{parentName:"li"},"Ok(r)"),", maka outputnya adalah ",(0,r.kt)("inlineCode",{parentName:"li"},"result: 5.00"))),(0,r.kt)("p",null,"Sampai sini penulis rasa cukup jelas. Selanjutnya kode tersebut akan di-refactor, beberapa statement disederhanakan menggunakan operator ",(0,r.kt)("inlineCode",{parentName:"p"},"?"),"."),(0,r.kt)("h3",{id:"-refactor-ke-1"},"\u25c9 Refactor ke-1"),(0,r.kt)("p",null,"Ubah fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"do_some_math()")," menjadi seperti ini:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'fn do_some_math() {\n let r1 = divider(10.0, 5.0)?;\n println!("result: {r1:.2}");\n \n let r2 = divider(10.0, 0.0)?;\n println!("result: {r2:.2}");\n \n let r3 = divider(10.0, 2.0)?;\n println!("result: {r3:.2}");\n}\n')),(0,r.kt)("p",null,"Sekilas perbandingan fungsi sebelum dan setelah dimodifikasi bisa dilihat pada dua gambar berikut."),(0,r.kt)("table",null,(0,r.kt)("tr",null,(0,r.kt)("td",null,(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Operator ? / tanda tanya / question mark",src:n(9692).Z,width:"1292",height:"1402"}))),(0,r.kt)("td",null,(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Operator ? / tanda tanya / question mark",src:n(7725).Z,width:"1032",height:"916"}))))),(0,r.kt)("p",null,"Implementasi operator ",(0,r.kt)("inlineCode",{parentName:"p"},"?")," dilakukan dengan cukup menuliskannya setelah memanggil fungsi yang memiliki tipe nilai balik ",(0,r.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," (atau ",(0,r.kt)("inlineCode",{parentName:"p"},"Option<T>"),") yang pada contoh ini adalah fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"divider()"),". Operator tersebut meng-unwrap nilai balik fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"divider()")," yang bertipe ",(0,r.kt)("inlineCode",{parentName:"p"},"Result<f64, &'static str>")," dengan ketentuan:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Jila nilai balik ",(0,r.kt)("inlineCode",{parentName:"p"},"Result<f64, &'static str>")," berisi nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"Ok(f64)"),", maka nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"f64")," dikembalikan."),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},"Statement ",(0,r.kt)("inlineCode",{parentName:"li"},"let r1 = divider(10.0, 5.0)?;"),", variabel ",(0,r.kt)("inlineCode",{parentName:"li"},"r1")," berisi nilai bertipe ",(0,r.kt)("inlineCode",{parentName:"li"},"f64"),"."),(0,r.kt)("li",{parentName:"ul"},"Statement ",(0,r.kt)("inlineCode",{parentName:"li"},"let r3 = divider(10.0, 2.0)?;"),", variabel ",(0,r.kt)("inlineCode",{parentName:"li"},"r3")," berisi nilai bertipe ",(0,r.kt)("inlineCode",{parentName:"li"},"f64"),"."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Jila nilai balik ",(0,r.kt)("inlineCode",{parentName:"p"},"Result<f64, &'static str>")," berisi nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"Err(&'static str)"),", maka nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"&'static str")," dikembalikan."),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},"Statement ",(0,r.kt)("inlineCode",{parentName:"li"},"let r2 = divider(10.0, 0.0)?;"),", variabel ",(0,r.kt)("inlineCode",{parentName:"li"},"r2")," berisi nilai bertipe ",(0,r.kt)("inlineCode",{parentName:"li"},"&'static str"),".")))),(0,r.kt)("p",null,"Sampai sini semoga cukup jelas."),(0,r.kt)("p",null,"Namun tunggu, kode baru yang telah ditulis sebenarnya tidak valid. Kode penulis buat untuk mempermudah mempelajari perbedaan cara konvensional vs menggunakan operator ",(0,r.kt)("inlineCode",{parentName:"p"},"?"),". Ada beberapa hal lagi yang harus dilakukan sebelum kode benar-benar bisa digunakan."),(0,r.kt)("h3",{id:"-refactor-ke-2"},"\u25c9 Refactor ke-2"),(0,r.kt)("p",null,"Rust mewajibkan penggunaan operator ",(0,r.kt)("inlineCode",{parentName:"p"},"?")," pada statement untuk diterapkan di dalam fungsi yang mengembalikan nilai balik bertipe ",(0,r.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," (atau ",(0,r.kt)("inlineCode",{parentName:"p"},"Option<T>"),") tergantung tipe apa yang digunakan pada kode-kode di dalam blok fungsi tersebut. Bahkan meskipun nilai tidak digunakan, aturan tersebut tetap harus dipatuhi. Syarat ini hukumnya wajib."),(0,r.kt)("p",null,"Kembali ke contoh kode yang telah ditulis, kode tersebut harus dimodifikasi lagi menjadi seperti berikut:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'fn do_some_math() -> Result<f64, &\'static str> {\n let r1 = divider(10.0, 5.0)?;\n println!("result: {r1:.2}");\n \n let r2 = divider(10.0, 0.0)?;\n println!("result: {r2:.2}");\n \n let r3 = divider(10.0, 2.0)?;\n println!("result: {r3:.2}");\n\n return Ok(0.0)\n}\n')),(0,r.kt)("p",null,"Fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"do_some_math()")," dimodifikasi dengan ditambahi nilai balik bertipe ",(0,r.kt)("inlineCode",{parentName:"p"},"Result<f64, &'static str>"),". Karena sebenarnya kita tidak memerlukan fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"do_some_math()")," untuk menghasilkan nilai balik, maka penulis hardcode saja nilai baliknya dengan nilai apapun yang penting valid, misalnya ",(0,r.kt)("inlineCode",{parentName:"p"},"Ok(0.0)"),"."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Silakan gunakan nilai lainnya seperti ",(0,r.kt)("inlineCode",{parentName:"p"},"Ok(r1)"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Ok(r2)")," atau lainnya, bebas karena nilai ini ditulis di kode hanya agar syarat penerapan operator ",(0,r.kt)("inlineCode",{parentName:"p"},"?")," terpenuhi."),(0,r.kt)("p",{parentName:"blockquote"},"Boleh juga menggunakan notasi tipe lainnya seperti ",(0,r.kt)("inlineCode",{parentName:"p"},"Result<(), &'static str>")," dimana dengan tipe tersebut untuk nilai balik bisa menggunakan ",(0,r.kt)("inlineCode",{parentName:"p"},"Ok(())"))),(0,r.kt)("p",null,"Perbandingan terbaru fungsi sebelum dan setelah dimodifikasi bisa dilihat di bawah ini."),(0,r.kt)("table",null,(0,r.kt)("tr",null,(0,r.kt)("td",null,(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Operator ? / tanda tanya / question mark",src:n(9692).Z,width:"1292",height:"1402"}))),(0,r.kt)("td",null,(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Operator ? / tanda tanya / question mark",src:n(456).Z,width:"1358",height:"1024"}))))),(0,r.kt)("p",null,"Sekarang coba jalankan program, dan lihat outputnya."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Operator ? / tanda tanya / question mark",src:n(7136).Z,width:"618",height:"97"})),(0,r.kt)("p",null,"Output yang muncul hanya nilai variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"r2"),". Statement ",(0,r.kt)("inlineCode",{parentName:"p"},"let r2 = divider(10.0, 0.0)?;")," dan seterusnya tidak menghasilkan output apapun, hal ini karena ketika proses unwrap nilai menggunakan operator ",(0,r.kt)("inlineCode",{parentName:"p"},"?")," menghasilkan nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"E"),", fungsi langsung terhenti eksekusinya dan nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"Err(E)")," dikembalikan. Menandai akhir pemanggilan ",(0,r.kt)("inlineCode",{parentName:"p"},"do_some_math()")," dengan informasi error pemanggilan statement ",(0,r.kt)("inlineCode",{parentName:"p"},"let r2 = divider(10.0, 0.0)?;")," langsung dikembalikan."),(0,r.kt)("h3",{id:"-refactor-ke-3"},"\u25c9 Refactor ke-3"),(0,r.kt)("p",null,"Sebenarnya aturan di atas (kenapa fungsi yang didalamnya ada penerapan operator ",(0,r.kt)("inlineCode",{parentName:"p"},"?")," diwajibkan untuk mengembalikan nilai balik bertipe ",(0,r.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," (atau ",(0,r.kt)("inlineCode",{parentName:"p"},"Option<T>"),")) bukan hanya sebatas syarat, tapi memang benar-benar diperlukan."),(0,r.kt)("p",null,"Ketika operasi menghasilkan error, eksekusi blok fungsi menjadi terhenti dan error otomatis dikembalikan sebagai nilai balik fungsi. Hal ini berguna agar kita bisa melakukan pengecekan tambahan untuk mengidentifikasi apakah eksekusi fungsi menghasilkan error atau sukses."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Inilah bagaimana penanganan error di Rust dilakukan."),(0,r.kt)("p",{parentName:"blockquote"},"Lebih detailnya mengenai ",(0,r.kt)("em",{parentName:"p"},"error propagation")," atau ",(0,r.kt)("em",{parentName:"p"},"error propagation")," dibahas pada chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/recoverable-error-handling"},"Error \u279c Recoverable Error & Error Handling"),".")),(0,r.kt)("p",null,"Coba sekarang ubah lagi kode yang sudah ditulis, kita coba cek error apa yang muncul saat pemanggilan fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"do_some_math()"),". Ubah isi fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main()")," dengan menambahkan keyword ",(0,r.kt)("inlineCode",{parentName:"p"},"match")," untuk mengecek nilai balik eksekusi fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"do_some_math()"),". Kode setelah diubah:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n match do_some_math() {\n Err(m) => println!("ERROR! {:?}", m),\n Ok(_) => {},\n }\n}\n\nfn do_some_math() -> Result<f64, &\'static str> {\n let r1 = divider(10.0, 5.0)?;\n println!("result: {r1:.2}");\n \n let r2 = divider(10.0, 0.0)?;\n println!("result: {r2:.2}");\n \n let r3 = divider(10.0, 2.0)?;\n println!("result: {r3:.2}");\n\n return Ok(0.0)\n}\n\nfn divider(a: f64, b: f64) -> Result<f64, &\'static str> {\n if b == 0.0 {\n return Err("division by zero error");\n }\n\n let result = a / b;\n return Ok(result);\n}\n')),(0,r.kt)("p",null,"Outputnya bisa dilihat di bawah ini. Pemanggilan fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"do_some_math()")," memang menghasilkan error, yaitu saat eksekusi statement ",(0,r.kt)("inlineCode",{parentName:"p"},"let r2 = divider(10.0, 0.0)?;"),". Informasi errornya bisa dilihat via blok ",(0,r.kt)("inlineCode",{parentName:"p"},'Err(m) => println!("ERROR! {:?}", m)'),"."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Operator ? / tanda tanya / question mark",src:n(2880).Z,width:"534",height:"118"})),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Pada kode di atas terdapat penerapan statement ",(0,r.kt)("inlineCode",{parentName:"p"},"Ok(_) => {},"),", pembahasan mengenai statement tersebut dibahas di chapter selanjutnya, yaitu ",(0,r.kt)("a",{parentName:"p",href:"/basic/pattern-matching"},"Pattern Matching"))),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,r.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,r.kt)("pre",null,(0,r.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/operator_tanda_tanya"},"github.com/novalagung/dasarpemrogramanrust-example/../operator_tanda_tanya")),(0,r.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/basic/result-type"},"Tipe Data \u279c Result")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/basic/recoverable-error-handling"},"Error \u279c Recoverable Error & Error Handling"))),(0,r.kt)("h3",{id:"-work-in-progress"},"\u25c9 Work in progress"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Contoh menggunakan tipe ",(0,r.kt)("inlineCode",{parentName:"li"},"Option<T>"))),(0,r.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/result/index.html"},"https://doc.rust-lang.org/std/result/index.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/expressions/operator-expr.html#the-question-mark-operator"},"https://doc.rust-lang.org/reference/expressions/operator-expr.html#the-question-mark-operator")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html"},"https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html"))))}s.isMDXComponent=!0},8889:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/operator-tanda-tanya-1-24d0c7ef806198ea77f652c1267d13e9.png"},9692:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/operator-tanda-tanya-2-edc32921914c938294f2ee9ded7bcd17.png"},7725:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/operator-tanda-tanya-3-186ecf58877055d7fdef25594040d662.png"},456:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/operator-tanda-tanya-4-162dd4d9f23151b811c1f27d7754cc69.png"},7136:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAmoAAABhCAYAAABmio2VAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAk8UlEQVR4nO2de1hVVd7HvwcEUjAl5FLYhMJ4kNTCwcsQzouFlc4hLgZl2Q2c154GH21i8NIrkTZpJA6m+cQ8Uo/zTpESIXFetZGUjJdJReiK4nDzTW1CEYlLAwrn/WOfvdnnnH05Z58LG/p9nsfnkbP2Wuu3f+u39v7ttX5rLU1QUJABBEEQBEEQhOpwG24BCIIgCIIgCGHIUSMIgiAIglAp5KgRBEEQBEGoFHLUCIIgCIIgVAo5agRBEARBECqFHDWCIAiCIAiVQo4aQRAEQRCESiFHjSAIgiAIQqWQo0YQBEEQBKFSyFEjCIIgCIJQKeSoEQRBEARBqJQR6ahVNs1Hw5dhSBk3fDKsyS+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Xo2SXvEwsQ07acuQKLCAIiGamMMv2beLqZO7dB/c8m405HszCifRFobh27qhkGsWnEQRBEARhjiYoKMigNLNU8L7lyk5mivPpF29Y/M5fncnfu2ygpxZH6n+Jhf6VePi5by3ymeeVWmlq66pP9vpgsxUOAz21eGU5MwXKyurF+01IDv7UrlQaQRAEQRAEH7scNYIgCIIgCMJ50Ia3BEEQBEEQKoUcNYIgCIIgCJVCjhpBEARBEIRKIUeNIAiCIAhCpZCjRhAEQRAEoVLIUSMIgiAIglAp5KgRBEEQBEGoFHLUCIIgCIIgVAo5agRBEARBECqFHDWCIAiCIAiVQo4aQRAEQRCESiFHjSAIgiAIQqWQo0YQBEEQBKFS/h+2ra3MqCJw9gAAAABJRU5ErkJggg=="},2880:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/operator-tanda-tanya-6-31dccee9d16f41b3a88637a21ca2e330.png"}}]); \ No newline at end of file diff --git a/assets/js/3d2f5b0c.e9f6457c.js b/assets/js/3d2f5b0c.e9f6457c.js new file mode 100644 index 00000000..63f593e4 --- /dev/null +++ b/assets/js/3d2f5b0c.e9f6457c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[676],{3905:(e,a,n)=>{n.d(a,{Zo:()=>u,kt:()=>m});var t=n(7294);function i(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function r(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function l(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?r(Object(n),!0).forEach((function(a){i(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function p(e,a){if(null==e)return{};var n,t,i=function(e,a){if(null==e)return{};var n,t,i={},r=Object.keys(e);for(t=0;t<r.length;t++)n=r[t],a.indexOf(n)>=0||(i[n]=e[n]);return i}(e,a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t<r.length;t++)n=r[t],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var o=t.createContext({}),d=function(e){var a=t.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},u=function(e){var a=d(e.components);return t.createElement(o.Provider,{value:a},e.children)},s={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},k=t.forwardRef((function(e,a){var n=e.components,i=e.mdxType,r=e.originalType,o=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),k=d(n),m=i,g=k["".concat(o,".").concat(m)]||k[m]||s[m]||r;return n?t.createElement(g,l(l({ref:a},u),{},{components:n})):t.createElement(g,l({ref:a},u))}));function m(e,a){var n=arguments,i=a&&a.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=k;var p={};for(var o in a)hasOwnProperty.call(a,o)&&(p[o]=a[o]);p.originalType=e,p.mdxType="string"==typeof e?e:i,l[1]=p;for(var d=2;d<r;d++)l[d]=n[d];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}k.displayName="MDXCreateElement"},5569:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>l,default:()=>s,frontMatter:()=>r,metadata:()=>p,toc:()=>d});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:41,title:"A.41. Operator ?",sidebar_label:"A.41. Operator ?"},l=void 0,p={unversionedId:"basic/operator-tanda-tanya",id:"basic/operator-tanda-tanya",title:"A.41. Operator ?",description:"Operator ? (atau question mark operator) adalah operator yang cukup berguna untuk operasi unwrap nilai dari tipe Result atau Option. Pada chapter ini kita akan belajar tentang operator tersebut.",source:"@site/docs/basic/operator-tanda-tanya.md",sourceDirName:"basic",slug:"/basic/operator-tanda-tanya",permalink:"/basic/operator-tanda-tanya",draft:!1,tags:[],version:"current",sidebarPosition:41,frontMatter:{sidebar_position:41,title:"A.41. Operator ?",sidebar_label:"A.41. Operator ?"},sidebar:"tutorialSidebar",previous:{title:"A.40. Tipe Data \u279c Result",permalink:"/basic/result-type"},next:{title:"A.42. Pattern Matching",permalink:"/basic/pattern-matching"}},o={},d=[{value:"A.41.1. Operator ?",id:"a411-operator-",level:2},{value:"\u25c9 Refactor ke-1",id:"-refactor-ke-1",level:3},{value:"\u25c9 Refactor ke-2",id:"-refactor-ke-2",level:3},{value:"\u25c9 Refactor ke-3",id:"-refactor-ke-3",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Work in progress",id:"-work-in-progress",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],u={toc:d};function s(e){let{components:a,...r}=e;return(0,i.kt)("wrapper",(0,t.Z)({},u,r,{components:a,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Operator ",(0,i.kt)("inlineCode",{parentName:"p"},"?")," (atau ",(0,i.kt)("em",{parentName:"p"},"question mark operator"),") adalah operator yang cukup berguna untuk operasi ",(0,i.kt)("strong",{parentName:"p"},"unwrap")," nilai dari tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"Option<T>"),". Pada chapter ini kita akan belajar tentang operator tersebut."),(0,i.kt)("h2",{id:"a411-operator-"},"A.41.1. Operator ?"),(0,i.kt)("p",null,"Operator ",(0,i.kt)("inlineCode",{parentName:"p"},"?")," digunakan untuk operasi ",(0,i.kt)("strong",{parentName:"p"},"unwrap")," value dari tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," (dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Option<T>"),")."),(0,i.kt)("p",null,"Penggunaannya terhadap tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," cukup umum untuk keperluan penanganan error (atau ",(0,i.kt)("em",{parentName:"p"},"error propagation"),"). Ketika suatu object dengan tipe tersebut di-unwrap menggunakan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"?"),", maka:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Jika nilai object adalah bertipe ",(0,i.kt)("inlineCode",{parentName:"li"},"T"),", maka yang dikembalikan adalah nilai ",(0,i.kt)("inlineCode",{parentName:"li"},"T")),(0,i.kt)("li",{parentName:"ul"},"Jika nilai object adalah bertipe ",(0,i.kt)("inlineCode",{parentName:"li"},"E"),", maka yang dikembalikan adalah nilai ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," atau error.")),(0,i.kt)("p",null,"Agar lebih mudah memahami kegunaan dari operator ini, pembelajaran lebih baik dimulai dengan praktik kode yang didalamnya ada penerapan tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," (atau ",(0,i.kt)("inlineCode",{parentName:"p"},"Option"),"). Di contoh berikut, tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," kita pilih untuk praktek."),(0,i.kt)("p",null,"Silakan tulis kode berikut, pelajari, kemudian jalankan."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n do_some_math();\n}\n\nfn do_some_math() {\n let result1 = divider(10.0, 5.0);\n match result1 {\n Err(m) => println!("ERROR! {:?}", m),\n Ok(r) => println!("result: {r:.2}"),\n }\n \n let result2 = divider(10.0, 0.0);\n match result2 {\n Err(m) => println!("ERROR! {:?}", m),\n Ok(r) => println!("result: {r:.2}"),\n }\n \n let result3 = divider(10.0, 2.0);\n match result3 {\n Err(m) => println!("ERROR! {:?}", m),\n Ok(r) => println!("result: {r:.2}"),\n }\n}\n\nfn divider(a: f64, b: f64) -> Result<f64, &\'static str> {\n if b == 0.0 {\n return Err("division by zero error");\n }\n\n let result = a / b;\n return Ok(result);\n}\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pada contoh di atas, operasi aritmatika ditempatkan dalam fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"do_some_math()")," dan tidak langsung dalam fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main()"),". Ini disengaja karena berhubungan dengan contoh berikutnya. ")),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider()")," dibuat dengan kegunaan sangat spesifik, yaitu melakukan operasi aritmatika pembagian. Fungsi tersebut menghasilkan error jika ditemukan nilai pembagi adalah angka ",(0,i.kt)("inlineCode",{parentName:"p"},"0"),"."),(0,i.kt)("p",null,"Output program:"),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Operator ? / tanda tanya / question mark",src:n(8889).Z,width:"530",height:"149"})),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Hasil statement ",(0,i.kt)("inlineCode",{parentName:"li"},"divider(10.0, 5.0)")," memenuhi kriteria ",(0,i.kt)("inlineCode",{parentName:"li"},"Ok(r)"),", maka outputnya adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"result: 2.00")),(0,i.kt)("li",{parentName:"ul"},"Hasil statement ",(0,i.kt)("inlineCode",{parentName:"li"},"divider(10.0, 0.0)")," memenuhi kriteria ",(0,i.kt)("inlineCode",{parentName:"li"},"Err(m)"),", maka outputnya adalah ",(0,i.kt)("inlineCode",{parentName:"li"},'ERROR! "division by zero error"')),(0,i.kt)("li",{parentName:"ul"},"Hasil statement ",(0,i.kt)("inlineCode",{parentName:"li"},"divider(10.0, 2.0)")," memenuhi kriteria ",(0,i.kt)("inlineCode",{parentName:"li"},"Ok(r)"),", maka outputnya adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"result: 5.00"))),(0,i.kt)("p",null,"Sampai sini penulis rasa cukup jelas. Selanjutnya kode tersebut akan di-refactor, beberapa statement disederhanakan menggunakan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"?"),"."),(0,i.kt)("h3",{id:"-refactor-ke-1"},"\u25c9 Refactor ke-1"),(0,i.kt)("p",null,"Ubah fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"do_some_math()")," menjadi seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn do_some_math() {\n let r1 = divider(10.0, 5.0)?;\n println!("result: {r1:.2}");\n \n let r2 = divider(10.0, 0.0)?;\n println!("result: {r2:.2}");\n \n let r3 = divider(10.0, 2.0)?;\n println!("result: {r3:.2}");\n}\n')),(0,i.kt)("p",null,"Sekilas perbandingan fungsi sebelum dan setelah dimodifikasi bisa dilihat pada dua gambar berikut."),(0,i.kt)("table",null,(0,i.kt)("tr",null,(0,i.kt)("td",null,(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Operator ? / tanda tanya / question mark",src:n(9692).Z,width:"1292",height:"1402"}))),(0,i.kt)("td",null,(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Operator ? / tanda tanya / question mark",src:n(7725).Z,width:"1032",height:"916"}))))),(0,i.kt)("p",null,"Implementasi operator ",(0,i.kt)("inlineCode",{parentName:"p"},"?")," dilakukan dengan cukup menuliskannya setelah memanggil fungsi yang memiliki tipe nilai balik ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," (atau ",(0,i.kt)("inlineCode",{parentName:"p"},"Option<T>"),") yang pada contoh ini adalah fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider()"),". Operator tersebut meng-unwrap nilai balik fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider()")," yang bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<f64, &'static str>")," dengan ketentuan:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Jila nilai balik ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<f64, &'static str>")," berisi nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok(f64)"),", maka nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"f64")," dikembalikan."),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"Statement ",(0,i.kt)("inlineCode",{parentName:"li"},"let r1 = divider(10.0, 5.0)?;"),", variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"r1")," berisi nilai bertipe ",(0,i.kt)("inlineCode",{parentName:"li"},"f64"),"."),(0,i.kt)("li",{parentName:"ul"},"Statement ",(0,i.kt)("inlineCode",{parentName:"li"},"let r3 = divider(10.0, 2.0)?;"),", variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"r3")," berisi nilai bertipe ",(0,i.kt)("inlineCode",{parentName:"li"},"f64"),"."))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Jila nilai balik ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<f64, &'static str>")," berisi nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"Err(&'static str)"),", maka nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"&'static str")," dikembalikan."),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"Statement ",(0,i.kt)("inlineCode",{parentName:"li"},"let r2 = divider(10.0, 0.0)?;"),", variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"r2")," berisi nilai bertipe ",(0,i.kt)("inlineCode",{parentName:"li"},"&'static str"),".")))),(0,i.kt)("p",null,"Sampai sini semoga cukup jelas."),(0,i.kt)("p",null,"Namun tunggu, kode baru yang telah ditulis sebenarnya tidak valid. Kode penulis buat untuk mempermudah mempelajari perbedaan cara konvensional vs menggunakan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"?"),". Ada beberapa hal lagi yang harus dilakukan sebelum kode benar-benar bisa digunakan."),(0,i.kt)("h3",{id:"-refactor-ke-2"},"\u25c9 Refactor ke-2"),(0,i.kt)("p",null,"Rust mewajibkan penggunaan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"?")," pada statement untuk diterapkan di dalam fungsi yang mengembalikan nilai balik bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," (atau ",(0,i.kt)("inlineCode",{parentName:"p"},"Option<T>"),") tergantung tipe apa yang digunakan pada kode-kode di dalam blok fungsi tersebut. Bahkan meskipun nilai tidak digunakan, aturan tersebut tetap harus dipatuhi. Syarat ini hukumnya wajib."),(0,i.kt)("p",null,"Kembali ke contoh kode yang telah ditulis, kode tersebut harus dimodifikasi lagi menjadi seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn do_some_math() -> Result<f64, &\'static str> {\n let r1 = divider(10.0, 5.0)?;\n println!("result: {r1:.2}");\n \n let r2 = divider(10.0, 0.0)?;\n println!("result: {r2:.2}");\n \n let r3 = divider(10.0, 2.0)?;\n println!("result: {r3:.2}");\n\n return Ok(0.0)\n}\n')),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"do_some_math()")," dimodifikasi dengan ditambahi nilai balik bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<f64, &'static str>"),". Karena sebenarnya kita tidak memerlukan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"do_some_math()")," untuk menghasilkan nilai balik, maka penulis hardcode saja nilai baliknya dengan nilai apapun yang penting valid, misalnya ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok(0.0)"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Silakan gunakan nilai lainnya seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok(r1)"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok(r2)")," atau lainnya, bebas karena nilai ini ditulis di kode hanya agar syarat penerapan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"?")," terpenuhi."),(0,i.kt)("p",{parentName:"blockquote"},"Boleh juga menggunakan notasi tipe lainnya seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<(), &'static str>")," dimana dengan tipe tersebut untuk nilai balik bisa menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok(())"))),(0,i.kt)("p",null,"Perbandingan terbaru fungsi sebelum dan setelah dimodifikasi bisa dilihat di bawah ini."),(0,i.kt)("table",null,(0,i.kt)("tr",null,(0,i.kt)("td",null,(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Operator ? / tanda tanya / question mark",src:n(9692).Z,width:"1292",height:"1402"}))),(0,i.kt)("td",null,(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Operator ? / tanda tanya / question mark",src:n(456).Z,width:"1358",height:"1024"}))))),(0,i.kt)("p",null,"Sekarang coba jalankan program, dan lihat outputnya."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Operator ? / tanda tanya / question mark",src:n(7136).Z,width:"618",height:"97"})),(0,i.kt)("p",null,"Output yang muncul hanya nilai variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"r2"),". Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"let r2 = divider(10.0, 0.0)?;")," dan seterusnya tidak menghasilkan output apapun, hal ini karena ketika proses unwrap nilai menggunakan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"?")," menghasilkan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"E"),", fungsi langsung terhenti eksekusinya dan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"Err(E)")," dikembalikan. Menandai akhir pemanggilan ",(0,i.kt)("inlineCode",{parentName:"p"},"do_some_math()")," dengan informasi error pemanggilan statement ",(0,i.kt)("inlineCode",{parentName:"p"},"let r2 = divider(10.0, 0.0)?;")," langsung dikembalikan."),(0,i.kt)("h3",{id:"-refactor-ke-3"},"\u25c9 Refactor ke-3"),(0,i.kt)("p",null,"Sebenarnya aturan di atas (kenapa fungsi yang didalamnya ada penerapan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"?")," diwajibkan untuk mengembalikan nilai balik bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," (atau ",(0,i.kt)("inlineCode",{parentName:"p"},"Option<T>"),")) bukan hanya sebatas syarat, tapi memang benar-benar diperlukan."),(0,i.kt)("p",null,"Ketika operasi menghasilkan error, eksekusi blok fungsi menjadi terhenti dan error otomatis dikembalikan sebagai nilai balik fungsi. Hal ini berguna agar kita bisa melakukan pengecekan tambahan untuk mengidentifikasi apakah eksekusi fungsi menghasilkan error atau sukses."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Inilah bagaimana penanganan error di Rust dilakukan."),(0,i.kt)("p",{parentName:"blockquote"},"Lebih detailnya mengenai ",(0,i.kt)("em",{parentName:"p"},"error propagation")," atau ",(0,i.kt)("em",{parentName:"p"},"error propagation")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/recoverable-error-handling"},"Error \u279c Recoverable Error & Error Handling"),".")),(0,i.kt)("p",null,"Coba sekarang ubah lagi kode yang sudah ditulis, kita coba cek error apa yang muncul saat pemanggilan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"do_some_math()"),". Ubah isi fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main()")," dengan menambahkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," untuk mengecek nilai balik eksekusi fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"do_some_math()"),". Kode setelah diubah:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n match do_some_math() {\n Err(m) => println!("ERROR! {:?}", m),\n Ok(_) => {},\n }\n}\n\nfn do_some_math() -> Result<f64, &\'static str> {\n let r1 = divider(10.0, 5.0)?;\n println!("result: {r1:.2}");\n \n let r2 = divider(10.0, 0.0)?;\n println!("result: {r2:.2}");\n \n let r3 = divider(10.0, 2.0)?;\n println!("result: {r3:.2}");\n\n return Ok(0.0)\n}\n\nfn divider(a: f64, b: f64) -> Result<f64, &\'static str> {\n if b == 0.0 {\n return Err("division by zero error");\n }\n\n let result = a / b;\n return Ok(result);\n}\n')),(0,i.kt)("p",null,"Outputnya bisa dilihat di bawah ini. Pemanggilan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"do_some_math()")," memang menghasilkan error, yaitu saat eksekusi statement ",(0,i.kt)("inlineCode",{parentName:"p"},"let r2 = divider(10.0, 0.0)?;"),". Informasi errornya bisa dilihat via blok ",(0,i.kt)("inlineCode",{parentName:"p"},'Err(m) => println!("ERROR! {:?}", m)'),"."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Operator ? / tanda tanya / question mark",src:n(2880).Z,width:"534",height:"118"})),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pada kode di atas terdapat penerapan statement ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok(_) => {},"),", pembahasan mengenai statement tersebut dibahas di chapter selanjutnya, yaitu ",(0,i.kt)("a",{parentName:"p",href:"/basic/pattern-matching"},"Pattern Matching"))),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/operator_tanda_tanya"},"github.com/novalagung/dasarpemrogramanrust-example/../operator_tanda_tanya")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/result-type"},"Tipe Data \u279c Result")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/recoverable-error-handling"},"Error \u279c Recoverable Error & Error Handling"))),(0,i.kt)("h3",{id:"-work-in-progress"},"\u25c9 Work in progress"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Contoh menggunakan tipe ",(0,i.kt)("inlineCode",{parentName:"li"},"Option<T>"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/result/index.html"},"https://doc.rust-lang.org/std/result/index.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/expressions/operator-expr.html#the-question-mark-operator"},"https://doc.rust-lang.org/reference/expressions/operator-expr.html#the-question-mark-operator")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html"},"https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html"))))}s.isMDXComponent=!0},8889:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/operator-tanda-tanya-1-24d0c7ef806198ea77f652c1267d13e9.png"},9692:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/operator-tanda-tanya-2-edc32921914c938294f2ee9ded7bcd17.png"},7725:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/operator-tanda-tanya-3-186ecf58877055d7fdef25594040d662.png"},456:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/operator-tanda-tanya-4-162dd4d9f23151b811c1f27d7754cc69.png"},7136:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAmoAAABhCAYAAABmio2VAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAk8UlEQVR4nO2de1hVVd7HvwcEUjAl5FLYhMJ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yMWoAMHZuDvbr9chLdsN7yaW4aPCXTLt93ogKFyQIgiAIwgXY7R1cO3eUGwlqq85Bqg4IiM2Br2YKHt+vx+O8awd6agEwI2Ah+eVcenvdtmEdBZMjMbsIcWGteDc126pRL3fv2cha34J3U3Uo6mWmQxM1lyXTvjshPp1KEARBEMTPEycO4zBxZ0W9wqn5a+KRDzZ2LBN7NwNPv6g+Z4WJf9PgeN7zovfCp+NsB3rRjRre9cx0aAc6zg6KpjXStCdBEARBEGY4ZdXn5aoKtHZNwcO5K2WvHRzTgM5u098Cg+cB4MdwWUfr1W6T6VU+7v3pKCjXo2SXvEwsQ07acuQKLCAIiGamMMv2beLqZO7dB/c8m405HszCifRFobh27qhkGsWnEQRBEARhjiYoKMigNLNU8L7lyk5mivPpF29Y/M5fncnfu2ygpxZH6n+Jhf6VePi5by3ymeeVWmlq66pP9vpgsxUOAz21eGU5MwXKyurF+01IDv7UrlQaQRAEQRAEH7scNYIgCIIgCMJ50Ia3BEEQBEEQKoUcNYIgCIIgCJVCjhpBEARBEIRKIUeNIAiCIAhCpZCjRhAEQRAEoVLIUSMIgiAIglAp5KgRBEEQBEGoFHLUCIIgCIIgVAo5agRBEARBECqFHDWCIAiCIAiVQo4aQRAEQRCESiFHjSAIgiAIQqWQo0YQBEEQBKFS/h+2ra3MqCJw9gAAAABJRU5ErkJggg=="},2880:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/operator-tanda-tanya-6-31dccee9d16f41b3a88637a21ca2e330.png"}}]); \ No newline at end of file diff --git a/assets/js/4232c3ed.1e04009f.js b/assets/js/4232c3ed.1e04009f.js new file mode 100644 index 00000000..87dd021f --- /dev/null +++ b/assets/js/4232c3ed.1e04009f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[8308],{3905:(a,e,n)=>{n.d(e,{Zo:()=>d,kt:()=>A});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function l(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function r(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function p(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},l=Object.keys(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var u=t.createContext({}),m=function(a){var e=t.useContext(u),n=e;return a&&(n="function"==typeof a?a(e):r(r({},e),a)),n},d=function(a){var e=m(a.components);return t.createElement(u.Provider,{value:e},a.children)},o={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},k=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,l=a.originalType,u=a.parentName,d=p(a,["components","mdxType","originalType","parentName"]),k=m(n),A=i,s=k["".concat(u,".").concat(A)]||k[A]||o[A]||l;return n?t.createElement(s,r(r({ref:e},d),{},{components:n})):t.createElement(s,r({ref:e},d))}));function A(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var l=n.length,r=new Array(l);r[0]=k;var p={};for(var u in e)hasOwnProperty.call(e,u)&&(p[u]=e[u]);p.originalType=a,p.mdxType="string"==typeof a?a:i,r[1]=p;for(var m=2;m<l;m++)r[m]=n[m];return t.createElement.apply(null,r)}return t.createElement.apply(null,n)}k.displayName="MDXCreateElement"},1597:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>u,contentTitle:()=>r,default:()=>o,frontMatter:()=>l,metadata:()=>p,toc:()=>m});var t=n(7462),i=(n(7294),n(3905));const l={sidebar_position:26,title:"A.26. Enum",sidebar_label:"A.26. Enum"},r=void 0,p={unversionedId:"basic/enum",id:"basic/enum",title:"A.26. Enum",description:"Enum atau enumerated type adalah sebuah tipe data yang digunakan untuk menampung nilai konstan. Pada chapter ini kita akan mempelajarinya.",source:"@site/docs/basic/enum.md",sourceDirName:"basic",slug:"/basic/enum",permalink:"/basic/enum",draft:!1,tags:[],version:"current",sidebarPosition:26,frontMatter:{sidebar_position:26,title:"A.26. Enum",sidebar_label:"A.26. Enum"},sidebar:"tutorialSidebar",previous:{title:"A.25. Method",permalink:"/basic/method"},next:{title:"A.27. Type Alias & Casting",permalink:"/basic/type-alias-casting"}},u={},m=[{value:"A.26.1. Keyword <code>enum</code>",id:"a261-keyword-enum",level:2},{value:"A.26.2. <em>Naming convention</em> enum",id:"a262-naming-convention-enum",level:2},{value:"A.26.3. Seleksi kondisi enum",id:"a263-seleksi-kondisi-enum",level:2},{value:"A.26.4. Keyword <code>match</code>",id:"a264-keyword-match",level:2},{value:"A.26.5. Enum value \u279c <em>tuple struct</em>-like",id:"a265-enum-value--tuple-struct-like",level:2},{value:"A.26.6. Enum value \u279c <em>struct</em>-like",id:"a266-enum-value--struct-like",level:2},{value:"A.26.7. Aturan <em>pattern matching</em> enum",id:"a267-aturan-pattern-matching-enum",level:2},{value:"A.26.8. Enum module & visibility",id:"a268-enum-module--visibility",level:2},{value:"A.26.9. Generic pada enum",id:"a269-generic-pada-enum",level:2},{value:"A.26.10. Pembahasan lanjutan <em>pattern matching</em>",id:"a2610-pembahasan-lanjutan-pattern-matching",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Work in progress",id:"-work-in-progress",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:m};function o(a){let{components:e,...l}=a;return(0,i.kt)("wrapper",(0,t.Z)({},d,l,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Enum atau ",(0,i.kt)("em",{parentName:"p"},"enumerated type")," adalah sebuah tipe data yang digunakan untuk menampung nilai konstan. Pada chapter ini kita akan mempelajarinya."),(0,i.kt)("p",null,"Enum ada sedikit kemiripan dengan konstanta, bedanya ada pada nilai atau ",(0,i.kt)("em",{parentName:"p"},"underlying value"),"-nya. Jika di konstanta, yang didefinisikan adalah nama beserta value-nya, di enum yang didefinisikan adalah tipe data enum dan enum value. Enum value ini bentuknya seperti variabel tanpa nilai (lebih tepatnya nama dari enum value tersebut adalah nilainya). Lebih jelasnya silakan ikut pembahasan chapter ini."),(0,i.kt)("h2",{id:"a261-keyword-enum"},"A.26.1. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"enum")),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"enum")," digunakan untuk membuat ",(0,i.kt)("em",{parentName:"p"},"enumerated type"),". Cara penulisannya seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"enum NamaEnum {\n NilaiEnum1,\n Nilai2,\n NilaiEnumKe3,\n // ...\n}\n")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"NamaEnum")," di atas adalah tipe data custom yang didefinisikan bertipe enum. Sedangkan ",(0,i.kt)("inlineCode",{parentName:"p"},"NilaiEnum1"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Nilai2"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"NilaiEnumKe3")," adalah yang disebut dengan enum value. Dengan itu maka ketiga enum values tersebut tipe datanya adalah sama, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"NamaEnum"),"."),(0,i.kt)("p",null,"Mari kita lanjut praktik. Berikut ini adalah definisi konstanta yang menggunakan tipe data string untuk menampung nilai konstan-nya. Lalu di bawahnya ada lagi definisi nilai konstan tetapi menggunakan enum sebagai tipe data yang digunakan."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'// definisi konstanta\nconst SuperheroSuperman: &str = "superman";\nconst SuperheroOmniMan: &str = "omniman";\nconst SuperheroHomelander: &str = "homelander";\nconst SuperheroHyperion: &str = "hyperion";\n\n// definisi enum\nenum Superhero {\n Superman,\n OmniMan,\n Homelander,\n Hyperion,\n};\n')),(0,i.kt)("p",null,"Di contoh bisa dilihat, ",(0,i.kt)("inlineCode",{parentName:"p"},"Superhero")," adalah tipe data enum baru. Dari tipe data tersebut dibuat 4 buah enum values, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"Superman"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"OmniMan"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Homelander"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Hyperion"),"."),(0,i.kt)("p",null,"Pada pembuatan konstanta, tipe data beserta value-nya harus ditentukan di awal. Pada enum, yang perlu didefinisikan adalah tipe data enum-nya (sebagai contoh ",(0,i.kt)("inlineCode",{parentName:"p"},"Superhero"),") kemudian diikut dengan enum value yang dituliskan tanpa pengisian nilai."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Definisi variabel dengan isi konstanta:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let value1: &str = SuperheroSuperman;\nlet value2 = SuperheroOmniMan;\n// ...\n"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Definisi variabel bertipe data enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Superhero"),":"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let value3: Superhero = Superhero::Superman;\nlet value4 = Superhero::OmniMan;\n// ...\n")))),(0,i.kt)("p",null,"Notasi path digunakan dalam penulisan enum value dengan format ",(0,i.kt)("inlineCode",{parentName:"p"},"NamaEnum::EnumValue")),(0,i.kt)("h2",{id:"a262-naming-convention-enum"},"A.26.2. ",(0,i.kt)("em",{parentName:"h2"},"Naming convention")," enum"),(0,i.kt)("p",null,"Sesuai anjuran di ",(0,i.kt)("a",{parentName:"p",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"halaman dokumentasi Rust"),", upper camel case digunakan dalam penamaan Enum beserta value-nya."),(0,i.kt)("p",null,"Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"enum Superhero {\n Superman,\n OmniMan,\n Homelander,\n Hyperion,\n};\n")),(0,i.kt)("h2",{id:"a263-seleksi-kondisi-enum"},"A.26.3. Seleksi kondisi enum"),(0,i.kt)("p",null,"Tipe data enum biasa dipakai pada seleksi kondisi, namun caranya sedikit berbeda. Default-nya keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," tidak bisa digunakan pada tipe data enum."),(0,i.kt)("p",null,"Pada contoh berikut, statement seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"value3")," menghasilkan error:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'// seleksi kondisi pada konstanta\nif value1 == SuperheroSuperman {\n println!("hello superman!");\n}\n\n// seleksi kondisi pada enum\nif value3 == Superhero::Superman {\n println!("hello superman!");\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Enum",src:n(1179).Z,width:"859",height:"378"})),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Error tersebut muncul karena tipe data enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Superhero")," tidak memiliki trait ",(0,i.kt)("inlineCode",{parentName:"p"},"PartialEq"),". Lebih jelasnya mengenai trait dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/traits"},"Traits"),".")),(0,i.kt)("p",null,"Lalu bagaimana cara pengaplikasian seleksi kondisi pada tipe enum? Ada beberapa cara, namun yang paling praktis adalah keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),"."),(0,i.kt)("h2",{id:"a264-keyword-match"},"A.26.4. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"match")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"match")," adalah salah satu keyword untuk operasi seleksi kondisi di Rust. Penerapan keyword ini cukup luas, namun pada chapter ini hanya akan dibahas penerapannya yang relevan dengan topik enum."),(0,i.kt)("p",null,"Mari kita pelajarinya sembari praktik. Silakan buat package baru, lalu definisikan tipe enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Food")," berikut beserta 4 enum value-nya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"enum Food {\n PenyetanTerangBulan,\n PizzaNanas,\n EsKrimIkanMujaer,\n MiGorengKuah,\n}\n")),(0,i.kt)("p",null,"Lalu buat sebuah variabel bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"makanan_favorit")," untuk menampung salah satu nilai enum. Kemudian gunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," untuk menerapkan operasi seleksi kondisi dengan aksi menampilkan sebuah pesan sesuai dengan nilai yang cocok."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let makanan_favorit: Food = Food::PenyetanTerangBulan;\n \n match makanan_favorit {\n Food::PenyetanTerangBulan => {\n println!("your food taste is quite ... unique");\n },\n Food::PizzaNanas => {\n println!("it\'s morally wrong to have pineaple on top of pizza");\n },\n Food::EsKrimIkanMujaer => {\n println!("I don\'t know what to say");\n },\n Food::MiGorengKuah => {\n println!("sometimes people do eat this, but it\'s ok");\n }\n }\n}\n')),(0,i.kt)("p",null,"Di atas bisa dilihat bagaimana cara penggunaan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," untuk penerapan seleksi kondisi pada tipe data enum."),(0,i.kt)("p",null,"Notasi penulisannya kurang lebih seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"}," match variabel_enum {\n TipeEnum::ValueEnum1 => {\n // ...\n },\n TipeEnum::ValueEnum2 => {\n // ...\n },\n \n // ...\n}\n")),(0,i.kt)("p",null,"Kembali ke contoh program, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"makanan_favorit")," dicek nilainya menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Jika nilainya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::PenyetanTerangBulan"),", muncul pesan:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'"your food taste is quite ... unique"\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Jika nilainya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::PizzaNanas"),", muncul pesan:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'"it is morally wrong to have pineaple on top of pizza"\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Jika nilainya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::EsKrimIkanMujaer"),", muncul pesan:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'"I don\'t know what to say"\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Jika nilainya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MiGorengKuah"),", muncul pesan:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'"sometimes people do eat this, but it\'s ok"\n')))),(0,i.kt)("p",null,"Jalankan program untuk melihat hasilnya:"),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Enum",src:n(5543).Z,width:"450",height:"82"})),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," ini sebenarnya tidak hanya digunakan untuk seleksi kondisi saja. Di Rust ada yang disebut dengan ",(0,i.kt)("em",{parentName:"p"},"pattern matching"),". Metode ",(0,i.kt)("em",{parentName:"p"},"pattern matching")," ini memahami ",(0,i.kt)("em",{parentName:"p"},"special syntax")," yang kegunaanya lebih luas dibanding hanya sekedar seleksi kondisi biasa."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai ",(0,i.kt)("em",{parentName:"p"},"pattern matching")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pattern-matching"},"Pattern Matching"))),(0,i.kt)("h2",{id:"a265-enum-value--tuple-struct-like"},"A.26.5. Enum value \u279c ",(0,i.kt)("em",{parentName:"h2"},"tuple struct"),"-like"),(0,i.kt)("p",null,"Enum value di struct bisa juga didesain seperti ",(0,i.kt)("em",{parentName:"p"},"tuple struct"),". Sebagai contoh, enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Food")," di atas akan kita tambahi dengan satu enum value baru berbentuk ",(0,i.kt)("em",{parentName:"p"},"tuple struct"),"."),(0,i.kt)("p",null,"Silakan tambahkan enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"MakananLainnya")," berikut. Enum ini kita fungsikan untuk mengidentifikasi data makanan lainnya selain dari yang sudah ada di enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Food"),". Notasi penulisan ",(0,i.kt)("em",{parentName:"p"},"tuple struct")," ",(0,i.kt)("inlineCode",{parentName:"p"},"MakananLainnya(String)")," artinya enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"MakananLainnya")," didefinisikan untuk bisa menampung data property dalam bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"enum Food {\n PenyetanTerangBulan,\n PizzaNanas,\n EsKrimIkanMujaer,\n MiGorengKuah,\n MakananLainnya(String), // <---- enum value baru\n}\n")),(0,i.kt)("p",null,"Sekarang ubah isi variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"makanan_favorit")," dengan enum value baru yang sudah dibuat. Syntax ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MakananLainnya(nasi_goreng)")," artinya enum value yang digunakan adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MakananLainnya")," dengan isi property didapat dari variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"nasi_goreng"),"."),(0,i.kt)("p",null,"Tambahkan juga ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MakananLainnya")," dalam blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n // enum value MakananLainnya digunakan\n // dengan isi property adalah string "nasi goreng"\n let nasi_goreng = String::from("nasi goreng");\n let makanan_favorit = Food::MakananLainnya(nasi_goreng);\n \n match makanan_favorit {\n Food::PenyetanTerangBulan => {\n println!("your food taste is quite ... unique");\n },\n Food::PizzaNanas => {\n println!("it\'s morally wrong to have pineaple on top of pizza");\n },\n Food::EsKrimIkanMujaer => {\n println!("I don\'t know what to say. this should be illegal");\n },\n Food::MiGorengKuah => {\n println!("sometimes people do eat this, but it\'s ok");\n },\n Food::MakananLainnya(m) => { // <---- seleksi kondisi baru\n println!("do you like {m}? nice taste!");\n }\n }\n}\n')),(0,i.kt)("p",null,"Bisa dilihat ada keunikan dalam penulisan seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MakananLainnya")," dalam blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),". Di situ ada parameter bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"m")," yang parameter tersebut akan berisi data property jika memang ",(0,i.kt)("em",{parentName:"p"},"match")," dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"makanan_favorit"),"."),(0,i.kt)("p",null,"Coba jalankan untuk melihat hasilnya:"),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Enum",src:n(8424).Z,width:"462",height:"87"})),(0,i.kt)("p",null,"O iya, jumlah property value enum berbentuk ",(0,i.kt)("em",{parentName:"p"},"tuple struct")," ini tidak terbatas ya. Pada contoh di atas, ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MakananLainnya")," hanya memiliki 1 property. Lebih dari satu juga bisa."),(0,i.kt)("h2",{id:"a266-enum-value--struct-like"},"A.26.6. Enum value \u279c ",(0,i.kt)("em",{parentName:"h2"},"struct"),"-like"),(0,i.kt)("p",null,"Enum value bisa juga didesain memiliki property seperti ",(0,i.kt)("em",{parentName:"p"},"struct"),"."),(0,i.kt)("p",null,"Mari kita terapkan pada kode sebelumnya. Tambahkan 1 buah enum value lagi dengan nama ",(0,i.kt)("inlineCode",{parentName:"p"},"MieSetan")," yang ditulis dalam bentuk ",(0,i.kt)("em",{parentName:"p"},"struct"),"-like, dan memiliki 2 buah property."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"enum Food {\n PenyetanTerangBulan,\n PizzaNanas,\n EsKrimIkanMujaer,\n MiGorengKuah,\n MakananLainnya(String),\n MieSetan { level_pedas: i32, pakek_piring: bool }\n}\n")),(0,i.kt)("p",null,"Setelah itu, isi variabel dengan nilai adalah enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MieSetan"),", level pedasnya 5, dan tanpa piring."),(0,i.kt)("p",null,"Tak lupa tambahkan seleksi kondisi untuk ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MieSetan")," pada blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let makanan_favorit = Food::MieSetan { \n level_pedas: 5,\n pakek_piring: false\n };\n \n match makanan_favorit {\n Food::PenyetanTerangBulan => {\n println!("your food taste is quite ... unique");\n },\n Food::PizzaNanas => {\n println!("it\'s morally wrong to have pineaple on top of pizza");\n },\n Food::EsKrimIkanMujaer => {\n println!("I don\'t know what to say. this should be illegal");\n },\n Food::MiGorengKuah => {\n println!("sometimes people do eat this, but it\'s ok");\n },\n Food::MakananLainnya(m) => {\n println!("do you like {m}? nice taste!");\n },\n Food::MieSetan { level_pedas, pakek_piring } => {\n if level_pedas > 3 {\n println!("mie setan lvl {} is too much!", level_pedas);\n } else {\n println!("mie setan lvl {} is perfect!", level_pedas);\n }\n\n if !pakek_piring {\n println!("how are you going to eat the food without a plate, huh?");\n }\n }\n }\n}\n')),(0,i.kt)("p",null,"Dalam seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MieSetan")," bisa dilihat ada beberapa statement. Kurang lebih jika nilai dari variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"makanan_favorit")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MieSetan")," maka:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Akan memunculkan pesan yang berbeda tergantung level pedasnya"),(0,i.kt)("li",{parentName:"ul"},"Dan jika terdeteksi tidak menggunakan piring, dimunculkan pesan tambahan")),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Enum",src:n(6989).Z,width:"448",height:"98"})),(0,i.kt)("h2",{id:"a267-aturan-pattern-matching-enum"},"A.26.7. Aturan ",(0,i.kt)("em",{parentName:"h2"},"pattern matching")," enum"),(0,i.kt)("p",null,"Dalam blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),", semua enum value harus dituliskan. Jika tidak, pasti muncul error. Contohnya bisa dilihat di gambar berikut, beberapa seleksi kondisi enum value di-remark, hasilnya ada error."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Enum",src:n(2930).Z,width:"1096",height:"309"})),(0,i.kt)("p",null,"Error tersebut sebenarnya bisa diantisipasi dengan menambahkan seleksi kondisi dengan penulisan seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'match makanan_favorit {\n Food::PenyetanTerangBulan => {\n println!("your food taste is quite ... unique");\n },\n Food::PizzaNanas => {\n println!("it\'s morally wrong to have pineaple on top of pizza");\n },\n _ => {\n println!("never heard about that food");\n }\n}\n')),(0,i.kt)("p",null,"Menggunakan blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," di atas, jika nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"makanan_favorit")," adalah selain ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::PenyetanTerangBulan")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::PizzaNanas"),", maka pesan ",(0,i.kt)("inlineCode",{parentName:"p"},"never heard about that food")," adalah yang muncul di layar."),(0,i.kt)("p",null,"Selain variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"_")," bisa juga menggunakan nama variabel apapun, misalnya ",(0,i.kt)("inlineCode",{parentName:"p"},"some_var"),". Namun jika variabel tersebut tidak digunakan dalam blok kode, akan muncul warning."),(0,i.kt)("h2",{id:"a268-enum-module--visibility"},"A.26.8. Enum module & visibility"),(0,i.kt)("p",null,"Mari kita coba cek perihal visibility dari enum. Siapkan package baru dengan struktur seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 constants.rs\n \u2514\u2500\u2500\u2500 main.rs\n")),(0,i.kt)("p",null,"Pada file ",(0,i.kt)("inlineCode",{parentName:"p"},"constants.rs"),", tambahkan enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Company")," berikut. Pastikan enum adalah publik dengan menambahkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," pada deklarasinya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/constants.rs"',title:'"src/constants.rs"'},"pub enum Company {\n Apple,\n Microsoft,\n Google,\n Github\n}\n")),(0,i.kt)("p",null,"Kemudian tambahkan kode berikut di ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod constants;\n\nfn main() {\n let company = constants::Company::Apple;\n \n match company {\n constants::Company::Apple => {\n print!("apple")\n },\n _ => {\n print!("other than apple")\n }\n }\n}\n')),(0,i.kt)("p",null,"Jalankan, hasilnya tidak error, karena ",(0,i.kt)("inlineCode",{parentName:"p"},"Company")," didefinisikan publik."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Enum",src:n(3101).Z,width:"457",height:"85"})),(0,i.kt)("p",null,"Coba lakukan modifikasi dengan menghilangkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," saat definisi enum, hasilnya pasti error."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pada tipe data enum, keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," cukup ditambahkan pada definisi enum type, tidak perlu ditambahkan satu persatu di tiap enum values.")),(0,i.kt)("h2",{id:"a269-generic-pada-enum"},"A.26.9. Generic pada enum"),(0,i.kt)("p",null,"Pembahasan mengenai generic pada enum ada pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/generics#a368-generics-enum"},"Generics"),"."),(0,i.kt)("h2",{id:"a2610-pembahasan-lanjutan-pattern-matching"},"A.26.10. Pembahasan lanjutan ",(0,i.kt)("em",{parentName:"h2"},"pattern matching")),(0,i.kt)("p",null,"Pembahasan yang lebih mendetail tentang keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," dan ",(0,i.kt)("em",{parentName:"p"},"pattern matching")," ada pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pattern-matching"},"Pattern Matching"),"."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/enum"},"github.com/novalagung/dasarpemrogramanrust-example/../enum")),(0,i.kt)("h3",{id:"-work-in-progress"},"\u25c9 Work in progress"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Pembahasan tentang associated function dan method pada enum")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch06-01-defining-an-enum.html"},"https://doc.rust-lang.org/book/ch06-01-defining-an-enum.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/custom_types/enum.html"},"https://doc.rust-lang.org/rust-by-example/custom_types/enum.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/items/enumerations.html"},"https://doc.rust-lang.org/reference/items/enumerations.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch06-02-match.html"},"https://doc.rust-lang.org/book/ch06-02-match.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.enum.html"},"https://doc.rust-lang.org/std/keyword.enum.html"))))}o.isMDXComponent=!0},1179:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/enum-1-15c91a97fbd3c87f01a4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OMnx/L1zdZv3LTJExDQLS4t1PN6BXSlF2jj6XabsbpGnoCAAgIKAICAAgAgoAAAgIACACCgAAAIKAAAAgoAgIACAAACCgCAgAIAIKAAAAgoAAAc+B86KtU7hT6iaAAAAABJRU5ErkJggg=="},2930:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/enum-5-c9da1005565fda09175ddda67f9a16b5.png"},3101:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAABVCAIAAACtjoiqAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkF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Ai54T6DNVz+tWL+vgWLfOmbo4eGv2pNGJ2pOBdQG3urOmuQsHvdM2bm5PJlnhKt2qxbAiZfUEbq1qPCFW9T+850tdHOht7qTRoVzTWUqlW/2Khrg1KlY1j6f+syTu5DdPWsHVurWxYTXr2v28VZ+yemAwa8q33bp7VOh61tTFob9mShq9sswLRG9bqRUNcKvXIu9KQU2bLAq6icubX6q7Xw38rW+AJbv1vHhzrMdJie5+2vSUTcY83b0XSzu58wO4lS7ocX6LsI5hZ3TrGZIxX3U7AXDrcnDnBGYUq3Jlu1xhna+dwbU/D/YDbgUAwK0AAIBbAQBwKwAAbgUAANwKAIBbAQBwKwAA4FYAANwKAIBbAQAAtwIAXJlbn94//9V8vNHpAIBbSxsWtwIAbsWtAACTurW/rP/3+f7ULDn87+3DudpXF8bcKraJcwHgBt369P5RC7UWYmXX2oyNaI82PfpRXai7VbzbbRMA4FbnBFpFuqo8mPLzXV34pLv18J4rWuQKADfnVnH53l7CB6r896EufFPd6m2wD3YBAG7FrUdHfspJgfFxKze2AAC3ulOjYdzayVddqOq02hB2BYBbnhOQd/TfRdwaXNDnF4qnAtTCAAA349aYb4O4k0t9AADcCgCAWwEArt6tAACAWwEAcCsAAG4FAADcCgCAWwEAcCsAAG4FAADcCgCAWwEAcCsAAOBWAADcCgBwK/wHIqOHFo62hqAAAAAASUVORK5CYII="}}]); \ No newline at end of file diff --git a/assets/js/4232c3ed.32b73572.js b/assets/js/4232c3ed.32b73572.js deleted file mode 100644 index 87502edf..00000000 --- a/assets/js/4232c3ed.32b73572.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[8308],{3905:(a,e,n)=>{n.d(e,{Zo:()=>d,kt:()=>A});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function l(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function r(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function p(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},l=Object.keys(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var u=t.createContext({}),m=function(a){var e=t.useContext(u),n=e;return a&&(n="function"==typeof a?a(e):r(r({},e),a)),n},d=function(a){var e=m(a.components);return t.createElement(u.Provider,{value:e},a.children)},o={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},k=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,l=a.originalType,u=a.parentName,d=p(a,["components","mdxType","originalType","parentName"]),k=m(n),A=i,s=k["".concat(u,".").concat(A)]||k[A]||o[A]||l;return n?t.createElement(s,r(r({ref:e},d),{},{components:n})):t.createElement(s,r({ref:e},d))}));function A(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var l=n.length,r=new Array(l);r[0]=k;var p={};for(var u in e)hasOwnProperty.call(e,u)&&(p[u]=e[u]);p.originalType=a,p.mdxType="string"==typeof a?a:i,r[1]=p;for(var m=2;m<l;m++)r[m]=n[m];return t.createElement.apply(null,r)}return t.createElement.apply(null,n)}k.displayName="MDXCreateElement"},1597:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>u,contentTitle:()=>r,default:()=>o,frontMatter:()=>l,metadata:()=>p,toc:()=>m});var t=n(7462),i=(n(7294),n(3905));const l={sidebar_position:26,title:"A.26. Enum",sidebar_label:"A.26. Enum"},r=void 0,p={unversionedId:"basic/enum",id:"basic/enum",title:"A.26. Enum",description:"Enum atau enumerated type adalah sebuah tipe data yang digunakan untuk menampung nilai konstan. Pada chapter ini kita akan mempelajarinya.",source:"@site/docs/basic/enum.md",sourceDirName:"basic",slug:"/basic/enum",permalink:"/basic/enum",draft:!1,tags:[],version:"current",sidebarPosition:26,frontMatter:{sidebar_position:26,title:"A.26. Enum",sidebar_label:"A.26. Enum"},sidebar:"tutorialSidebar",previous:{title:"A.25. Method",permalink:"/basic/method"},next:{title:"A.27. Type Alias & Casting",permalink:"/basic/type-alias-casting"}},u={},m=[{value:"A.26.1. Keyword <code>enum</code>",id:"a261-keyword-enum",level:2},{value:"A.26.2. <em>Naming convention</em> enum",id:"a262-naming-convention-enum",level:2},{value:"A.26.3. Seleksi kondisi enum",id:"a263-seleksi-kondisi-enum",level:2},{value:"A.26.4. Keyword <code>match</code>",id:"a264-keyword-match",level:2},{value:"A.26.5. Enum value \u279c <em>tuple struct</em>-like",id:"a265-enum-value--tuple-struct-like",level:2},{value:"A.26.6. Enum value \u279c <em>struct</em>-like",id:"a266-enum-value--struct-like",level:2},{value:"A.26.7. Aturan <em>pattern matching</em> enum",id:"a267-aturan-pattern-matching-enum",level:2},{value:"A.26.8. Enum module & visibility",id:"a268-enum-module--visibility",level:2},{value:"A.26.9. Generic pada enum",id:"a269-generic-pada-enum",level:2},{value:"A.26.10. Pembahasan lanjutan <em>pattern matching</em>",id:"a2610-pembahasan-lanjutan-pattern-matching",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Work in progress",id:"-work-in-progress",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:m};function o(a){let{components:e,...l}=a;return(0,i.kt)("wrapper",(0,t.Z)({},d,l,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Enum atau ",(0,i.kt)("em",{parentName:"p"},"enumerated type")," adalah sebuah tipe data yang digunakan untuk menampung nilai konstan. Pada chapter ini kita akan mempelajarinya."),(0,i.kt)("p",null,"Enum ada sedikit kemiripan dengan konstanta, bedanya ada pada nilai atau ",(0,i.kt)("em",{parentName:"p"},"underlying value"),"-nya. Jika di konstanta, yang didefinisikan adalah nama beserta value-nya, di enum yang didefinisikan adalah tipe data enum dan enum value. Enum value ini bentuknya seperti variabel tanpa nilai (lebih tepatnya nama dari enum value tersebut adalah nilainya). Lebih jelasnya silakan ikut pembahasan chapter ini."),(0,i.kt)("h2",{id:"a261-keyword-enum"},"A.26.1. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"enum")),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"enum")," digunakan untuk membuat ",(0,i.kt)("em",{parentName:"p"},"enumerated type"),". Cara penulisannya seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"enum NamaEnum {\n NilaiEnum1,\n Nilai2,\n NilaiEnumKe3,\n // ...\n}\n")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"NamaEnum")," di atas adalah tipe data custom yang didefinisikan bertipe enum. Sedangkan ",(0,i.kt)("inlineCode",{parentName:"p"},"NilaiEnum1"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Nilai2"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"NilaiEnumKe3")," adalah yang disebut dengan enum value. Dengan itu maka ketiga enum values tersebut tipe datanya adalah sama, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"NamaEnum"),"."),(0,i.kt)("p",null,"Mari kita lanjut praktik. Berikut ini adalah definisi konstanta yang menggunakan tipe data string untuk menampung nilai konstan-nya. Lalu di bawahnya ada lagi definisi nilai konstan tetapi menggunakan enum sebagai tipe data yang digunakan."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'// definisi konstanta\nconst SuperheroSuperman: &str = "superman";\nconst SuperheroOmniMan: &str = "omniman";\nconst SuperheroHomelander: &str = "homelander";\nconst SuperheroHyperion: &str = "hyperion";\n\n// definisi enum\nenum Superhero {\n Superman,\n OmniMan,\n Homelander,\n Hyperion,\n};\n')),(0,i.kt)("p",null,"Di contoh bisa dilihat, ",(0,i.kt)("inlineCode",{parentName:"p"},"Superhero")," adalah tipe data enum baru. Dari tipe data tersebut dibuat 4 buah enum values, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"Superman"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"OmniMan"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Homelander"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Hyperion"),"."),(0,i.kt)("p",null,"Pada pembuatan konstanta, tipe data beserta value-nya harus ditentukan di awal. Pada enum, yang perlu didefinisikan adalah tipe data enum-nya (sebagai contoh ",(0,i.kt)("inlineCode",{parentName:"p"},"Superhero"),") kemudian diikut dengan enum value yang dituliskan tanpa pengisian nilai."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Definisi variabel dengan isi konstanta:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let value1: &str = SuperheroSuperman;\nlet value2 = SuperheroOmniMan;\n// ...\n"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Definisi variabel bertipe data enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Superhero"),":"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let value3: Superhero = Superhero::Superman;\nlet value4 = Superhero::OmniMan;\n// ...\n")))),(0,i.kt)("p",null,"Notasi path digunakan dalam penulisan enum value dengan format ",(0,i.kt)("inlineCode",{parentName:"p"},"NamaEnum::EnumValue")),(0,i.kt)("h2",{id:"a262-naming-convention-enum"},"A.26.2. ",(0,i.kt)("em",{parentName:"h2"},"Naming convention")," enum"),(0,i.kt)("p",null,"Sesuai anjuran di ",(0,i.kt)("a",{parentName:"p",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"halaman dokumentasi Rust"),", upper camel case digunakan dalam penamaan Enum beserta value-nya."),(0,i.kt)("p",null,"Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"enum Superhero {\n Superman,\n OmniMan,\n Homelander,\n Hyperion,\n};\n")),(0,i.kt)("h2",{id:"a263-seleksi-kondisi-enum"},"A.26.3. Seleksi kondisi enum"),(0,i.kt)("p",null,"Tipe data enum biasa dipakai pada seleksi kondisi, namun caranya sedikit berbeda. Default-nya keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," tidak bisa digunakan pada tipe data enum."),(0,i.kt)("p",null,"Pada contoh berikut, statement seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"value3")," menghasilkan error:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'// seleksi kondisi pada konstanta\nif value1 == SuperheroSuperman {\n println!("hello superman!");\n}\n\n// seleksi kondisi pada enum\nif value3 == Superhero::Superman {\n println!("hello superman!");\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Enum",src:n(1179).Z,width:"859",height:"378"})),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Error tersebut muncul karena tipe data enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Superhero")," tidak memiliki trait ",(0,i.kt)("inlineCode",{parentName:"p"},"PartialEq"),". Lebih jelasnya mengenai trait dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/traits"},"Traits"),".")),(0,i.kt)("p",null,"Lalu bagaimana cara pengaplikasian seleksi kondisi pada tipe enum? Ada beberapa cara, namun yang paling praktis adalah keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),"."),(0,i.kt)("h2",{id:"a264-keyword-match"},"A.26.4. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"match")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"match")," adalah salah satu keyword untuk operasi seleksi kondisi di Rust. Penerapan keyword ini cukup luas, namun pada chapter ini hanya akan dibahas penerapannya yang relevan dengan topik enum."),(0,i.kt)("p",null,"Mari kita pelajarinya sembari praktik. Silakan buat package baru, lalu definisikan tipe enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Food")," berikut beserta 4 enum value-nya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"enum Food {\n PenyetanTerangBulan,\n PizzaNanas,\n EsKrimIkanMujaer,\n MiGorengKuah,\n}\n")),(0,i.kt)("p",null,"Lalu buat sebuah variabel bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"makanan_favorit")," untuk menampung salah satu nilai enum. Kemudian gunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," untuk menerapkan operasi seleksi kondisi dengan aksi menampilkan sebuah pesan sesuai dengan nilai yang cocok."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let makanan_favorit: Food = Food::PenyetanTerangBulan;\n \n match makanan_favorit {\n Food::PenyetanTerangBulan => {\n println!("your food taste is quite ... unique");\n },\n Food::PizzaNanas => {\n println!("it\'s morally wrong to have pineaple on top of pizza");\n },\n Food::EsKrimIkanMujaer => {\n println!("I don\'t know what to say");\n },\n Food::MiGorengKuah => {\n println!("sometimes people do eat this, but it\'s ok");\n }\n }\n}\n')),(0,i.kt)("p",null,"Di atas bisa dilihat bagaimana cara penggunaan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," untuk penerapan seleksi kondisi pada tipe data enum."),(0,i.kt)("p",null,"Notasi penulisannya kurang lebih seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"}," match variabel_enum {\n TipeEnum::ValueEnum1 => {\n // ...\n },\n TipeEnum::ValueEnum2 => {\n // ...\n },\n \n // ...\n}\n")),(0,i.kt)("p",null,"Kembali ke contoh program, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"makanan_favorit")," dicek nilainya menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Jika nilainya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::PenyetanTerangBulan"),", muncul pesan:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'"your food taste is quite ... unique"\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Jika nilainya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::PizzaNanas"),", muncul pesan:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'"it is morally wrong to have pineaple on top of pizza"\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Jika nilainya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::EsKrimIkanMujaer"),", muncul pesan:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'"I don\'t know what to say"\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Jika nilainya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MiGorengKuah"),", muncul pesan:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'"sometimes people do eat this, but it\'s ok"\n')))),(0,i.kt)("p",null,"Jalankan program untuk melihat hasilnya:"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Enum",src:n(5543).Z,width:"450",height:"82"})),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," ini sebenarnya tidak hanya digunakan untuk seleksi kondisi saja. Di Rust ada yang disebut dengan ",(0,i.kt)("em",{parentName:"p"},"pattern matching"),". Metode ",(0,i.kt)("em",{parentName:"p"},"pattern matching")," ini memahami ",(0,i.kt)("em",{parentName:"p"},"special syntax")," yang kegunaanya lebih luas dibanding hanya sekedar seleksi kondisi biasa."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai ",(0,i.kt)("em",{parentName:"p"},"pattern matching")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pattern-matching"},"Pattern Matching"))),(0,i.kt)("h2",{id:"a265-enum-value--tuple-struct-like"},"A.26.5. Enum value \u279c ",(0,i.kt)("em",{parentName:"h2"},"tuple struct"),"-like"),(0,i.kt)("p",null,"Enum value di struct bisa juga didesain seperti ",(0,i.kt)("em",{parentName:"p"},"tuple struct"),". Sebagai contoh, enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Food")," di atas akan kita tambahi dengan satu enum value baru berbentuk ",(0,i.kt)("em",{parentName:"p"},"tuple struct"),"."),(0,i.kt)("p",null,"Silakan tambahkan enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"MakananLainnya")," berikut. Enum ini kita fungsikan untuk mengidentifikasi data makanan lainnya selain dari yang sudah ada di enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Food"),". Notasi penulisan ",(0,i.kt)("em",{parentName:"p"},"tuple struct")," ",(0,i.kt)("inlineCode",{parentName:"p"},"MakananLainnya(String)")," artinya enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"MakananLainnya")," didefinisikan untuk bisa menampung data property dalam bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"enum Food {\n PenyetanTerangBulan,\n PizzaNanas,\n EsKrimIkanMujaer,\n MiGorengKuah,\n MakananLainnya(String), // <---- enum value baru\n}\n")),(0,i.kt)("p",null,"Sekarang ubah isi variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"makanan_favorit")," dengan enum value baru yang sudah dibuat. Syntax ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MakananLainnya(nasi_goreng)")," artinya enum value yang digunakan adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MakananLainnya")," dengan isi property didapat dari variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"nasi_goreng"),"."),(0,i.kt)("p",null,"Tambahkan juga ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MakananLainnya")," dalam blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n // enum value MakananLainnya digunakan\n // dengan isi property adalah string "nasi goreng"\n let nasi_goreng = String::from("nasi goreng");\n let makanan_favorit = Food::MakananLainnya(nasi_goreng);\n \n match makanan_favorit {\n Food::PenyetanTerangBulan => {\n println!("your food taste is quite ... unique");\n },\n Food::PizzaNanas => {\n println!("it\'s morally wrong to have pineaple on top of pizza");\n },\n Food::EsKrimIkanMujaer => {\n println!("I don\'t know what to say. this should be illegal");\n },\n Food::MiGorengKuah => {\n println!("sometimes people do eat this, but it\'s ok");\n },\n Food::MakananLainnya(m) => { // <---- seleksi kondisi baru\n println!("do you like {m}? nice taste!");\n }\n }\n}\n')),(0,i.kt)("p",null,"Bisa dilihat ada keunikan dalam penulisan seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MakananLainnya")," dalam blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),". Di situ ada parameter bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"m")," yang parameter tersebut akan berisi data property jika memang ",(0,i.kt)("em",{parentName:"p"},"match")," dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"makanan_favorit"),"."),(0,i.kt)("p",null,"Coba jalankan untuk melihat hasilnya:"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Enum",src:n(8424).Z,width:"462",height:"87"})),(0,i.kt)("p",null,"O iya, jumlah property value enum berbentuk ",(0,i.kt)("em",{parentName:"p"},"tuple struct")," ini tidak terbatas ya. Pada contoh di atas, ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MakananLainnya")," hanya memiliki 1 property. Lebih dari satu juga bisa."),(0,i.kt)("h2",{id:"a266-enum-value--struct-like"},"A.26.6. Enum value \u279c ",(0,i.kt)("em",{parentName:"h2"},"struct"),"-like"),(0,i.kt)("p",null,"Enum value bisa juga didesain memiliki property seperti ",(0,i.kt)("em",{parentName:"p"},"struct"),"."),(0,i.kt)("p",null,"Mari kita terapkan pada kode sebelumnya. Tambahkan 1 buah enum value lagi dengan nama ",(0,i.kt)("inlineCode",{parentName:"p"},"MieSetan")," yang ditulis dalam bentuk ",(0,i.kt)("em",{parentName:"p"},"struct"),"-like, dan memiliki 2 buah property."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"enum Food {\n PenyetanTerangBulan,\n PizzaNanas,\n EsKrimIkanMujaer,\n MiGorengKuah,\n MakananLainnya(String),\n MieSetan { level_pedas: i32, pakek_piring: bool }\n}\n")),(0,i.kt)("p",null,"Setelah itu, isi variabel dengan nilai adalah enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MieSetan"),", level pedasnya 5, dan tanpa piring."),(0,i.kt)("p",null,"Tak lupa tambahkan seleksi kondisi untuk ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MieSetan")," pada blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let makanan_favorit = Food::MieSetan { \n level_pedas: 5,\n pakek_piring: false\n };\n \n match makanan_favorit {\n Food::PenyetanTerangBulan => {\n println!("your food taste is quite ... unique");\n },\n Food::PizzaNanas => {\n println!("it\'s morally wrong to have pineaple on top of pizza");\n },\n Food::EsKrimIkanMujaer => {\n println!("I don\'t know what to say. this should be illegal");\n },\n Food::MiGorengKuah => {\n println!("sometimes people do eat this, but it\'s ok");\n },\n Food::MakananLainnya(m) => {\n println!("do you like {m}? nice taste!");\n },\n Food::MieSetan { level_pedas, pakek_piring } => {\n if level_pedas > 3 {\n println!("mie setan lvl {} is too much!", level_pedas);\n } else {\n println!("mie setan lvl {} is perfect!", level_pedas);\n }\n\n if !pakek_piring {\n println!("how are you going to eat the food without a plate, huh?");\n }\n }\n }\n}\n')),(0,i.kt)("p",null,"Dalam seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MieSetan")," bisa dilihat ada beberapa statement. Kurang lebih jika nilai dari variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"makanan_favorit")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::MieSetan")," maka:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Akan memunculkan pesan yang berbeda tergantung level pedasnya"),(0,i.kt)("li",{parentName:"ul"},"Dan jika terdeteksi tidak menggunakan piring, dimunculkan pesan tambahan")),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Enum",src:n(6989).Z,width:"448",height:"98"})),(0,i.kt)("h2",{id:"a267-aturan-pattern-matching-enum"},"A.26.7. Aturan ",(0,i.kt)("em",{parentName:"h2"},"pattern matching")," enum"),(0,i.kt)("p",null,"Dalam blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),", semua enum value harus dituliskan. Jika tidak, pasti muncul error. Contohnya bisa dilihat di gambar berikut, beberapa seleksi kondisi enum value di-remark, hasilnya ada error."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Enum",src:n(2930).Z,width:"1096",height:"309"})),(0,i.kt)("p",null,"Error tersebut sebenarnya bisa diantisipasi dengan menambahkan seleksi kondisi dengan penulisan seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'match makanan_favorit {\n Food::PenyetanTerangBulan => {\n println!("your food taste is quite ... unique");\n },\n Food::PizzaNanas => {\n println!("it\'s morally wrong to have pineaple on top of pizza");\n },\n _ => {\n println!("never heard about that food");\n }\n}\n')),(0,i.kt)("p",null,"Menggunakan blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," di atas, jika nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"makanan_favorit")," adalah selain ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::PenyetanTerangBulan")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Food::PizzaNanas"),", maka pesan ",(0,i.kt)("inlineCode",{parentName:"p"},"never heard about that food")," adalah yang muncul di layar."),(0,i.kt)("p",null,"Selain variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"_")," bisa juga menggunakan nama variabel apapun, misalnya ",(0,i.kt)("inlineCode",{parentName:"p"},"some_var"),". Namun jika variabel tersebut tidak digunakan dalam blok kode, akan muncul warning."),(0,i.kt)("h2",{id:"a268-enum-module--visibility"},"A.26.8. Enum module & visibility"),(0,i.kt)("p",null,"Mari kita coba cek perihal visibility dari enum. Siapkan package baru dengan struktur seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 constants.rs\n \u2514\u2500\u2500\u2500 main.rs\n")),(0,i.kt)("p",null,"Pada file ",(0,i.kt)("inlineCode",{parentName:"p"},"constants.rs"),", tambahkan enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Company")," berikut. Pastikan enum adalah publik dengan menambahkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," pada deklarasinya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/constants.rs"',title:'"src/constants.rs"'},"pub enum Company {\n Apple,\n Microsoft,\n Google,\n Github\n}\n")),(0,i.kt)("p",null,"Kemudian tambahkan kode berikut di ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod constants;\n\nfn main() {\n let company = constants::Company::Apple;\n \n match company {\n constants::Company::Apple => {\n print!("apple")\n },\n _ => {\n print!("other than apple")\n }\n }\n}\n')),(0,i.kt)("p",null,"Jalankan, hasilnya tidak error, karena ",(0,i.kt)("inlineCode",{parentName:"p"},"Company")," didefinisikan publik."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Enum",src:n(3101).Z,width:"457",height:"85"})),(0,i.kt)("p",null,"Coba lakukan modifikasi dengan menghilangkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," saat definisi enum, hasilnya pasti error."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pada tipe data enum, keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," cukup ditambahkan pada definisi enum type, tidak perlu ditambahkan satu persatu di tiap enum values.")),(0,i.kt)("h2",{id:"a269-generic-pada-enum"},"A.26.9. Generic pada enum"),(0,i.kt)("p",null,"Pembahasan mengenai generic pada enum ada pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/generics#a368-generics-enum"},"Generics"),"."),(0,i.kt)("h2",{id:"a2610-pembahasan-lanjutan-pattern-matching"},"A.26.10. Pembahasan lanjutan ",(0,i.kt)("em",{parentName:"h2"},"pattern matching")),(0,i.kt)("p",null,"Pembahasan yang lebih mendetail tentang keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," dan ",(0,i.kt)("em",{parentName:"p"},"pattern matching")," ada pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pattern-matching"},"Pattern Matching"),"."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/enum"},"github.com/novalagung/dasarpemrogramanrust-example/../enum")),(0,i.kt)("h3",{id:"-work-in-progress"},"\u25c9 Work in progress"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Pembahasan tentang associated function dan method pada enum")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch06-01-defining-an-enum.html"},"https://doc.rust-lang.org/book/ch06-01-defining-an-enum.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/custom_types/enum.html"},"https://doc.rust-lang.org/rust-by-example/custom_types/enum.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/items/enumerations.html"},"https://doc.rust-lang.org/reference/items/enumerations.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch06-02-match.html"},"https://doc.rust-lang.org/book/ch06-02-match.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.enum.html"},"https://doc.rust-lang.org/std/keyword.enum.html"))))}o.isMDXComponent=!0},1179:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/enum-1-15c91a97fbd3c87f01a4c4c5060b5fd8.png"},5543:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAABSCAIAAABIa0PlAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw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v28VZ+yemAwa8q33bp7VOh61tTFob9mShq9sswLRG9bqRUNcKvXIu9KQU2bLAq6icubX6q7Xw38rW+AJbv1vHhzrMdJie5+2vSUTcY83b0XSzu58wO4lS7ocX6LsI5hZ3TrGZIxX3U7AXDrcnDnBGYUq3Jlu1xhna+dwbU/D/YDbgUAwK0AAIBbAQBwKwAAbgUAANwKAIBbAQBwKwAA4FYAANwKAIBbAQAAtwIAXJlbn94//9V8vNHpAIBbSxsWtwIAbsWtAACTurW/rP/3+f7ULDn87+3DudpXF8bcKraJcwHgBt369P5RC7UWYmXX2oyNaI82PfpRXai7VbzbbRMA4FbnBFpFuqo8mPLzXV34pLv18J4rWuQKADfnVnH53l7CB6r896EufFPd6m2wD3YBAG7FrUdHfspJgfFxKze2AAC3ulOjYdzayVddqOq02hB2BYBbnhOQd/TfRdwaXNDnF4qnAtTCAAA349aYb4O4k0t9AADcCgCAWwEArt6tAACAWwEAcCsAAG4FAADcCgCAWwEAcCsAAG4FAADcCgCAWwEAcCsAAOBWAADcCgBwK/wHIqOHFo62hqAAAAAASUVORK5CYII="}}]); \ No newline at end of file diff --git a/assets/js/4513d9f5.6e9469f3.js b/assets/js/4513d9f5.6e9469f3.js new file mode 100644 index 00000000..a1c673bd --- /dev/null +++ b/assets/js/4513d9f5.6e9469f3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[5729],{3905:(a,e,i)=>{i.d(e,{Zo:()=>s,kt:()=>u});var t=i(7294);function n(a,e,i){return e in a?Object.defineProperty(a,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[e]=i,a}function l(a,e){var i=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),i.push.apply(i,t)}return i}function r(a){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?l(Object(i),!0).forEach((function(e){n(a,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):l(Object(i)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(i,e))}))}return a}function m(a,e){if(null==a)return{};var i,t,n=function(a,e){if(null==a)return{};var i,t,n={},l=Object.keys(a);for(t=0;t<l.length;t++)i=l[t],e.indexOf(i)>=0||(n[i]=a[i]);return n}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(t=0;t<l.length;t++)i=l[t],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(a,i)&&(n[i]=a[i])}return n}var c=t.createContext({}),p=function(a){var e=t.useContext(c),i=e;return a&&(i="function"==typeof a?a(e):r(r({},e),a)),i},s=function(a){var e=p(a.components);return t.createElement(c.Provider,{value:e},a.children)},o={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},d=t.forwardRef((function(a,e){var i=a.components,n=a.mdxType,l=a.originalType,c=a.parentName,s=m(a,["components","mdxType","originalType","parentName"]),d=p(i),u=n,k=d["".concat(c,".").concat(u)]||d[u]||o[u]||l;return i?t.createElement(k,r(r({ref:e},s),{},{components:i})):t.createElement(k,r({ref:e},s))}));function u(a,e){var i=arguments,n=e&&e.mdxType;if("string"==typeof a||n){var l=i.length,r=new Array(l);r[0]=d;var m={};for(var c in e)hasOwnProperty.call(e,c)&&(m[c]=e[c]);m.originalType=a,m.mdxType="string"==typeof a?a:n,r[1]=m;for(var p=2;p<l;p++)r[p]=i[p];return t.createElement.apply(null,r)}return t.createElement.apply(null,i)}d.displayName="MDXCreateElement"},2589:(a,e,i)=>{i.r(e),i.d(e,{assets:()=>c,contentTitle:()=>r,default:()=>o,frontMatter:()=>l,metadata:()=>m,toc:()=>p});var t=i(7462),n=(i(7294),i(3905));const l={sidebar_position:45,title:"A.45. Slice Memory Management",sidebar_label:"A.45. Slice Memory Management"},r=void 0,m={unversionedId:"basic/slice-memory-management",id:"basic/slice-memory-management",title:"A.45. Slice Memory Management",description:"Kita telah mempelajari tipe data Array dan Vector, serta sudah beberapa kali menggunakan tipe data string slice (String). 3 tipe data itu memiliki kemiripan, yaitu kesemuanya termasuk dalam kategori tipe data slice.",source:"@site/docs/basic/slice-memory-management.md",sourceDirName:"basic",slug:"/basic/slice-memory-management",permalink:"/basic/slice-memory-management",draft:!1,tags:[],version:"current",sidebarPosition:45,frontMatter:{sidebar_position:45,title:"A.45. Slice Memory Management",sidebar_label:"A.45. Slice Memory Management"},sidebar:"tutorialSidebar",previous:{title:"A.44. Lifetime",permalink:"/basic/lifetime"},next:{title:"A.46. String Literal (&str) vs. String Custom Type",permalink:"/basic/string-slice-vs-string-literal"}},c={},p=[{value:"A.45.1. Konsep slice",id:"a451-konsep-slice",level:2},{value:"A.45.2. Memory management pada slice",id:"a452-memory-management-pada-slice",level:2},{value:"A.45.2. Mutable slice",id:"a452-mutable-slice",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],s={toc:p};function o(a){let{components:e,...l}=a;return(0,n.kt)("wrapper",(0,t.Z)({},s,l,{components:e,mdxType:"MDXLayout"}),(0,n.kt)("p",null,"Kita telah mempelajari tipe data ",(0,n.kt)("a",{parentName:"p",href:"/basic/array"},"Array")," dan ",(0,n.kt)("a",{parentName:"p",href:"/basic/vector"},"Vector"),", serta sudah beberapa kali menggunakan tipe data string slice (",(0,n.kt)("inlineCode",{parentName:"p"},"String"),"). 3 tipe data itu memiliki kemiripan, yaitu kesemuanya termasuk dalam kategori tipe data slice."),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Ciri khas dari tipe data yang termasuk dalam kategori slice adalah jika diakses reference-nya menghasilkan data bertipe ",(0,n.kt)("inlineCode",{parentName:"p"},"&[T]")," yang mana ",(0,n.kt)("inlineCode",{parentName:"p"},"T")," adalah tipe data elemen.")),(0,n.kt)("p",null,"Pada chapter ini, kita akan bahas lebih dalam lagi tentang apa itu slice terutama bagian memory management-nya."),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Perbedaan chapter ini dengan chapter ini dengan chapter ",(0,n.kt)("a",{parentName:"p",href:"/basic/slice"},"Slice (Basic)")," adalah di sini fokusnya lebih banyak di memory management.")),(0,n.kt)("h2",{id:"a451-konsep-slice"},"A.45.1. Konsep slice"),(0,n.kt)("p",null,"Slice adalah representasi ",(0,n.kt)("em",{parentName:"p"},"block of memory")," berbentuk pointer dan memiliki size yang dinamis, dengan isi adalah koleksi element data. Slice merupakan reference atau data pinjaman (borrow)."),(0,n.kt)("p",null,"Pada program berikut, beberapa variabel dideklarasikan menggunakan tiga tipe data di atas, kemudian masing-masing data dipinjam kemudian di-print."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'let data_arr = [1, 2, 3];\nprintln!("data_arr: {} {:?}", data_arr.len(), data_arr);\nlet slice1 = &data_arr[1..];\nprintln!("slice1 : {} {:?}", slice1.len(), slice1);\nlet slice2 = &data_arr[..2];\nprintln!("slice2 : {} {:?}", slice2.len(), slice2);\n\nlet data_vec = vec![1, 2, 3];\nprintln!("data_vec: {} {:?}", data_vec.len(), data_vec);\nlet slice1 = &data_vec[1..];\nprintln!("slice1 : {} {:?}", slice1.len(), slice1);\nlet slice2 = &data_vec[..2];\nprintln!("slice2 : {} {:?}", slice2.len(), slice2);\n\nlet data_str = String::from("sesuk prei jarene, mosokk");\nprintln!("data_str: {} {:?}", data_str.len(), data_str);\nlet slice1 = &data_str[1..];\nprintln!("slice1 : {} {:?}", slice1.len(), slice1);\nlet slice2 = &data_str[..2];\nprintln!("slice2 : {} {:?}", slice2.len(), slice2);\n')),(0,n.kt)("p",null,(0,n.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Slice memory management",src:i(4505).Z,width:"302",height:"205"})),(0,n.kt)("p",null,"Terlihat kemiripan-nya, slice bisa terbentuk dari ketiga jenis data di atas."),(0,n.kt)("p",null,"Penulis ingatkan lagi, bahwa slice adalah tipe data reference yang berarti isi adalah data pinjaman (borrow). Tipe data slice selalu ",(0,n.kt)("inlineCode",{parentName:"p"},"&[T]")," yang mana ",(0,n.kt)("inlineCode",{parentName:"p"},"T")," adalah tipe data element."),(0,n.kt)("p",null,"Karena slice adalah data borrow, maka operasi standar borrowing termasuk mutable borrowing bisa dilakukan di slice."),(0,n.kt)("h2",{id:"a452-memory-management-pada-slice"},"A.45.2. Memory management pada slice"),(0,n.kt)("p",null,"Sekarang lanjut ke pembahasan tentang bagaimana data bertipe slice di-manage di memory. Sebagai bahan belajar, kita perlu memilih satu dari 3 tipe data slice yang ada. Bebas sebenarnya mau pilih yang mana. Penulis memilih ",(0,n.kt)("inlineCode",{parentName:"p"},"String")," untuk memulai pembahasan."),(0,n.kt)("p",null,"Silakan perhatikan statement sederhana berikut:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'let data_str = String::from("sesuk preiii");\n')),(0,n.kt)("p",null,"Ada sebuah data ",(0,n.kt)("inlineCode",{parentName:"p"},"String")," dideklarasikan, value-nya adalah ",(0,n.kt)("inlineCode",{parentName:"p"},"sesuk preiii"),", dan owner-nya adalah variabel ",(0,n.kt)("inlineCode",{parentName:"p"},"data_str"),". Data variabel ",(0,n.kt)("inlineCode",{parentName:"p"},"data_str")," disimpan di memory pada 2 tempat, yaitu ",(0,n.kt)("strong",{parentName:"p"},"heap")," dan ",(0,n.kt)("strong",{parentName:"p"},"stack"),"."),(0,n.kt)("p",null,"Selanjutnya, 2 buah slice tercipta hasil operasi slicing pada variabel ",(0,n.kt)("inlineCode",{parentName:"p"},"data_str"),"."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'let data_str = String::from("sesuk preiii"); // "sesuk preiii"\nlet slice1 = &data_str[8..]; // "eiii"\nlet slice2 = &data_str[..5]; // "sesuk"\n')),(0,n.kt)("p",null,"Slice adalah data borrow, artinya jika ada beberapa variabel baru dibuat hasil dari operasi slicing, maka isi variabel tersebut merupakan reference yang mengarah ke data sebenarnya. Di heap memory tidak ada perubahan, namun di stack memory ada beberapa data baru. Lebih jelasnya silakan perhatikan ilustrasi berikut."),(0,n.kt)("p",null,(0,n.kt)("img",{loading:"lazy",alt:"Slice memory management",src:i(2236).Z,width:"739",height:"713"})),(0,n.kt)("p",null,"Sekarang di stack memory ada 3 buah metadata informasi disimpan, yaitu ",(0,n.kt)("inlineCode",{parentName:"p"},"data_str")," (yang merupakan owner sebenarnya data), dan ",(0,n.kt)("inlineCode",{parentName:"p"},"slice1")," & ",(0,n.kt)("inlineCode",{parentName:"p"},"slice2"),". Sedangkan untuk data-nya sendiri tetap berada di heap memory tanpa ada perubahan."),(0,n.kt)("p",null,"Tiga variabel di atas kesemuanya mengakses reference yang sama, yang membedakan adalah elemen-nya saja. Owner (yaitu ",(0,n.kt)("inlineCode",{parentName:"p"},"data_str"),") bisa mengakses seluruh data, selain itu juga tau informasi kapasitas data. Sedangkan borrower hanya bisa mengakses data yang dia pinjam sesuai dengan operasi slicing-nya. Borrower tidak mengetahui kapasitas data, namun ia tau size dari elemen yang ia pinjam."),(0,n.kt)("h2",{id:"a452-mutable-slice"},"A.45.2. Mutable slice"),(0,n.kt)("p",null,"Bagaimana dengan ",(0,n.kt)("em",{parentName:"p"},"mutability")," pada slice, apa yang terjadi di belakang layar ketika elemen slice nilainya diubah?"),(0,n.kt)("p",null,"Ok, mari kita bahas dengan contoh. Pada kode berikut ada sebuah data mutable array bertipe ",(0,n.kt)("inlineCode",{parentName:"p"},"[i32; 6]")," dengan owner bernama ",(0,n.kt)("inlineCode",{parentName:"p"},"numbers"),". Dari variabel tersebut, dilakukan operasi mutable borrowing untuk disimpan pada variabel ",(0,n.kt)("inlineCode",{parentName:"p"},"n1"),"."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'let mut numbers = [24, 12, 8, 7, 9, 2];\nprintln!("numbers: {:?}", numbers);\nlet n1 = &mut numbers[2..];\nprintln!("n1 : {:?}", n1);\nn1[0] = 3022;\nprintln!("numbers: {:?}", numbers);\n')),(0,n.kt)("p",null,(0,n.kt)("img",{loading:"lazy",alt:"Slice memory management",src:i(743).Z,width:"409",height:"147"})),(0,n.kt)("p",null,"Salah satu elemen ",(0,n.kt)("inlineCode",{parentName:"p"},"n1")," diubah nilainya, maka efeknya juga berpengaruh pada owner. Ketika variabel ",(0,n.kt)("inlineCode",{parentName:"p"},"numbers")," di-print, element indeks ",(0,n.kt)("inlineCode",{parentName:"p"},"2")," berubah nilainya dari yang sebelumnya ",(0,n.kt)("inlineCode",{parentName:"p"},"8")," sekarang ",(0,n.kt)("inlineCode",{parentName:"p"},"3022"),"."),(0,n.kt)("p",null,"Visualisasi memory management-nya kurang lebih seperti ini:"),(0,n.kt)("p",null,(0,n.kt)("img",{loading:"lazy",alt:"Slice memory management",src:i(7609).Z,width:"718",height:"1088"})),(0,n.kt)("p",null,"Variabel ",(0,n.kt)("inlineCode",{parentName:"p"},"numbers")," dan ",(0,n.kt)("inlineCode",{parentName:"p"},"n1")," sama-sama mengarah ke reference yang sama. Itulah kenapa perubahan data pada peminjam membawa efek ke owner."),(0,n.kt)("hr",null),(0,n.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,n.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,n.kt)("pre",null,(0,n.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/slice_memory_management"},"github.com/novalagung/dasarpemrogramanrust-example/../slice_memory_management")),(0,n.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/array"},"Array")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/slice"},"Slice (Basic)")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/vector"},"Vector")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/basic-memory-management"},"Basic Memory Management")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/tipe-data-custom-type-string-slice"},"Tipe Data \u279c String Custom Type")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/string-slice-vs-string-literal"},"String Literal (&str) vs. String Custom Type"))),(0,n.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch04-03-slices.html"},"https://doc.rust-lang.org/book/ch04-03-slices.html")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://users.rust-lang.org/t/why-rust-slice-has-not-ownership/27356"},"https://users.rust-lang.org/t/why-rust-slice-has-not-ownership/27356"))))}o.isMDXComponent=!0},4505:(a,e,i)=>{i.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAS4AAADNCAIAAACJhQqMAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF32lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cD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o4Y9VsV9nKA0djh5IC6JJxLFGiNiMB6ZlCx/HrL3eV8UrHie78pwSJUyU8OB7xcTQJ/4p3Cg9mJEJYD1FRfdh4PIKECVMlPAUFZV2M6gontxcAOusuZp7Uo9a1KhIlDBRwlNWUMWIXpuKQlhYPoB1iopew7g9oEJFooSJEp6jojbXNI6KyTnaOSsYwbKg+FxswTyXKGGihOeqaLrlkNZyhEla6v5z8L1iZnm+ZoJKlDBRwsNVFGMrxWBTNQJVCss1BLDWHG1l6HCP13UQJWzaO1HCXUZFuMRPXkQJ3xJURMVL6nDrKGFURMWq6TZRwqgIgIoAgIoAqAgAn6Tit4QON0ajTUqKCl8/KnYOHW6IlRm1I1SEj1Wx5cu0iN7uIpp31BgYOik/MXyLinNCh8MPVDneFDpcM6p2iX8FuGDo8PVVtCcYBuit4sTQ4Z+Jj1rV7cieYBig873i7NDheY92NWQOtyUYBhixbDM8dHjai/467cieYBigp4pjQ4d76NEjdLjmhPBrBQxXcVrocC6it5uKjTuyJxgGGDUqAgAqAqAiAKAiACoCACoCoCIAoCIAKgIAKgKgIgCgIgCgIsBV+A89TcdB11uFfAAAAABJRU5ErkJggg=="},2236:(a,e,i)=>{i.d(e,{Z:()=>t});const t=i.p+"assets/images/slice-memory-management-2-97ee1868013eb53b825e4c59489aa236.png"},743:(a,e,i)=>{i.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZkAAACTCAIAAADTK/NLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI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=>t});const t=i.p+"assets/images/slice-memory-management-4-25a4c7b54f07cac6f773e2ff178a6d32.png"}}]); \ No newline at end of file diff --git a/assets/js/4513d9f5.f786dcf5.js b/assets/js/4513d9f5.f786dcf5.js deleted file mode 100644 index a46918be..00000000 --- a/assets/js/4513d9f5.f786dcf5.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[5729],{3905:(a,e,t)=>{t.d(e,{Zo:()=>p,kt:()=>u});var i=t(7294);function n(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function l(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),t.push.apply(t,i)}return t}function r(a){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?l(Object(t),!0).forEach((function(e){n(a,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(t,e))}))}return a}function m(a,e){if(null==a)return{};var t,i,n=function(a,e){if(null==a)return{};var t,i,n={},l=Object.keys(a);for(i=0;i<l.length;i++)t=l[i],e.indexOf(t)>=0||(n[t]=a[t]);return n}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(i=0;i<l.length;i++)t=l[i],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(a,t)&&(n[t]=a[t])}return n}var c=i.createContext({}),s=function(a){var e=i.useContext(c),t=e;return a&&(t="function"==typeof a?a(e):r(r({},e),a)),t},p=function(a){var e=s(a.components);return i.createElement(c.Provider,{value:e},a.children)},d={inlineCode:"code",wrapper:function(a){var e=a.children;return i.createElement(i.Fragment,{},e)}},o=i.forwardRef((function(a,e){var t=a.components,n=a.mdxType,l=a.originalType,c=a.parentName,p=m(a,["components","mdxType","originalType","parentName"]),o=s(t),u=n,k=o["".concat(c,".").concat(u)]||o[u]||d[u]||l;return t?i.createElement(k,r(r({ref:e},p),{},{components:t})):i.createElement(k,r({ref:e},p))}));function u(a,e){var t=arguments,n=e&&e.mdxType;if("string"==typeof a||n){var l=t.length,r=new Array(l);r[0]=o;var m={};for(var c in e)hasOwnProperty.call(e,c)&&(m[c]=e[c]);m.originalType=a,m.mdxType="string"==typeof a?a:n,r[1]=m;for(var s=2;s<l;s++)r[s]=t[s];return i.createElement.apply(null,r)}return i.createElement.apply(null,t)}o.displayName="MDXCreateElement"},2589:(a,e,t)=>{t.r(e),t.d(e,{assets:()=>c,contentTitle:()=>r,default:()=>d,frontMatter:()=>l,metadata:()=>m,toc:()=>s});var i=t(7462),n=(t(7294),t(3905));const l={sidebar_position:45,title:"A.45. Slice Memory Management",sidebar_label:"A.45. Slice Memory Management"},r=void 0,m={unversionedId:"basic/slice-memory-management",id:"basic/slice-memory-management",title:"A.45. Slice Memory Management",description:"Kita telah mempelajari tipe data Array dan Vector, serta sudah beberapa kali menggunakan tipe data string slice (String). 3 tipe data itu memiliki kemiripan, yaitu kesemuanya termasuk dalam kategori tipe data slice.",source:"@site/docs/basic/slice-memory-management.md",sourceDirName:"basic",slug:"/basic/slice-memory-management",permalink:"/basic/slice-memory-management",draft:!1,tags:[],version:"current",sidebarPosition:45,frontMatter:{sidebar_position:45,title:"A.45. Slice Memory Management",sidebar_label:"A.45. Slice Memory Management"},sidebar:"tutorialSidebar",previous:{title:"A.44. Lifetime",permalink:"/basic/lifetime"},next:{title:"A.46. String Literal (&str) vs. String Custom Type",permalink:"/basic/string-slice-vs-string-literal"}},c={},s=[{value:"A.45.1. Konsep slice",id:"a451-konsep-slice",level:2},{value:"A.45.2. Memory management pada slice",id:"a452-memory-management-pada-slice",level:2},{value:"A.45.2. Mutable slice",id:"a452-mutable-slice",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],p={toc:s};function d(a){let{components:e,...l}=a;return(0,n.kt)("wrapper",(0,i.Z)({},p,l,{components:e,mdxType:"MDXLayout"}),(0,n.kt)("p",null,"Kita telah mempelajari tipe data ",(0,n.kt)("a",{parentName:"p",href:"/basic/array"},"Array")," dan ",(0,n.kt)("a",{parentName:"p",href:"/basic/vector"},"Vector"),", serta sudah beberapa kali menggunakan tipe data string slice (",(0,n.kt)("inlineCode",{parentName:"p"},"String"),"). 3 tipe data itu memiliki kemiripan, yaitu kesemuanya termasuk dalam kategori tipe data slice."),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Ciri khas dari tipe data yang termasuk dalam kategori slice adalah jika diakses reference-nya menghasilkan data bertipe ",(0,n.kt)("inlineCode",{parentName:"p"},"&[T]")," yang mana ",(0,n.kt)("inlineCode",{parentName:"p"},"T")," adalah tipe data elemen.")),(0,n.kt)("p",null,"Pada chapter ini, kita akan bahas lebih dalam lagi tentang apa itu slice terutama bagian memory management-nya."),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Perbedaan chapter ini dengan chapter ini dengan chapter ",(0,n.kt)("a",{parentName:"p",href:"/basic/slice"},"Slice (Basic)")," adalah di sini fokusnya lebih banyak di memory management.")),(0,n.kt)("h2",{id:"a451-konsep-slice"},"A.45.1. Konsep slice"),(0,n.kt)("p",null,"Slice adalah representasi ",(0,n.kt)("em",{parentName:"p"},"block of memory")," berbentuk pointer dan memiliki size yang dinamis, dengan isi adalah koleksi element data. Slice merupakan reference atau data pinjaman (borrow)."),(0,n.kt)("p",null,"Pada program berikut, beberapa variabel dideklarasikan menggunakan tiga tipe data di atas, kemudian masing-masing data dipinjam kemudian di-print."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'let data_arr = [1, 2, 3];\nprintln!("data_arr: {} {:?}", data_arr.len(), data_arr);\nlet slice1 = &data_arr[1..];\nprintln!("slice1 : {} {:?}", slice1.len(), slice1);\nlet slice2 = &data_arr[..2];\nprintln!("slice2 : {} {:?}", slice2.len(), slice2);\n\nlet data_vec = vec![1, 2, 3];\nprintln!("data_vec: {} {:?}", data_vec.len(), data_vec);\nlet slice1 = &data_vec[1..];\nprintln!("slice1 : {} {:?}", slice1.len(), slice1);\nlet slice2 = &data_vec[..2];\nprintln!("slice2 : {} {:?}", slice2.len(), slice2);\n\nlet data_str = String::from("sesuk prei jarene, mosokk");\nprintln!("data_str: {} {:?}", data_str.len(), data_str);\nlet slice1 = &data_str[1..];\nprintln!("slice1 : {} {:?}", slice1.len(), slice1);\nlet slice2 = &data_str[..2];\nprintln!("slice2 : {} {:?}", slice2.len(), slice2);\n')),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Slice memory management",src:t(4505).Z,width:"302",height:"205"})),(0,n.kt)("p",null,"Terlihat kemiripan-nya, slice bisa terbentuk dari ketiga jenis data di atas."),(0,n.kt)("p",null,"Penulis ingatkan lagi, bahwa slice adalah tipe data reference yang berarti isi adalah data pinjaman (borrow). Tipe data slice selalu ",(0,n.kt)("inlineCode",{parentName:"p"},"&[T]")," yang mana ",(0,n.kt)("inlineCode",{parentName:"p"},"T")," adalah tipe data element."),(0,n.kt)("p",null,"Karena slice adalah data borrow, maka operasi standar borrowing termasuk mutable borrowing bisa dilakukan di slice."),(0,n.kt)("h2",{id:"a452-memory-management-pada-slice"},"A.45.2. Memory management pada slice"),(0,n.kt)("p",null,"Sekarang lanjut ke pembahasan tentang bagaimana data bertipe slice di-manage di memory. Sebagai bahan belajar, kita perlu memilih satu dari 3 tipe data slice yang ada. Bebas sebenarnya mau pilih yang mana. Penulis memilih ",(0,n.kt)("inlineCode",{parentName:"p"},"String")," untuk memulai pembahasan."),(0,n.kt)("p",null,"Silakan perhatikan statement sederhana berikut:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'let data_str = String::from("sesuk preiii");\n')),(0,n.kt)("p",null,"Ada sebuah data ",(0,n.kt)("inlineCode",{parentName:"p"},"String")," dideklarasikan, value-nya adalah ",(0,n.kt)("inlineCode",{parentName:"p"},"sesuk preiii"),", dan owner-nya adalah variabel ",(0,n.kt)("inlineCode",{parentName:"p"},"data_str"),". Data variabel ",(0,n.kt)("inlineCode",{parentName:"p"},"data_str")," disimpan di memory pada 2 tempat, yaitu ",(0,n.kt)("strong",{parentName:"p"},"heap")," dan ",(0,n.kt)("strong",{parentName:"p"},"stack"),"."),(0,n.kt)("p",null,"Selanjutnya, 2 buah slice tercipta hasil operasi slicing pada variabel ",(0,n.kt)("inlineCode",{parentName:"p"},"data_str"),"."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'let data_str = String::from("sesuk preiii"); // "sesuk preiii"\nlet slice1 = &data_str[8..]; // "eiii"\nlet slice2 = &data_str[..5]; // "sesuk"\n')),(0,n.kt)("p",null,"Slice adalah data borrow, artinya jika ada beberapa variabel baru dibuat hasil dari operasi slicing, maka isi variabel tersebut merupakan reference yang mengarah ke data sebenarnya. Di heap memory tidak ada perubahan, namun di stack memory ada beberapa data baru. Lebih jelasnya silakan perhatikan ilustrasi berikut."),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Slice memory management",src:t(2236).Z,width:"739",height:"713"})),(0,n.kt)("p",null,"Sekarang di stack memory ada 3 buah metadata informasi disimpan, yaitu ",(0,n.kt)("inlineCode",{parentName:"p"},"data_str")," (yang merupakan owner sebenarnya data), dan ",(0,n.kt)("inlineCode",{parentName:"p"},"slice1")," & ",(0,n.kt)("inlineCode",{parentName:"p"},"slice2"),". Sedangkan untuk data-nya sendiri tetap berada di heap memory tanpa ada perubahan."),(0,n.kt)("p",null,"Tiga variabel di atas kesemuanya mengakses reference yang sama, yang membedakan adalah elemen-nya saja. Owner (yaitu ",(0,n.kt)("inlineCode",{parentName:"p"},"data_str"),") bisa mengakses seluruh data, selain itu juga tau informasi kapasitas data. Sedangkan borrower hanya bisa mengakses data yang dia pinjam sesuai dengan operasi slicing-nya. Borrower tidak mengetahui kapasitas data, namun ia tau size dari elemen yang ia pinjam."),(0,n.kt)("h2",{id:"a452-mutable-slice"},"A.45.2. Mutable slice"),(0,n.kt)("p",null,"Bagaimana dengan ",(0,n.kt)("em",{parentName:"p"},"mutability")," pada slice, apa yang terjadi di belakang layar ketika elemen slice nilainya diubah?"),(0,n.kt)("p",null,"Ok, mari kita bahas dengan contoh. Pada kode berikut ada sebuah data mutable array bertipe ",(0,n.kt)("inlineCode",{parentName:"p"},"[i32; 6]")," dengan owner bernama ",(0,n.kt)("inlineCode",{parentName:"p"},"numbers"),". Dari variabel tersebut, dilakukan operasi mutable borrowing untuk disimpan pada variabel ",(0,n.kt)("inlineCode",{parentName:"p"},"n1"),"."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'let mut numbers = [24, 12, 8, 7, 9, 2];\nprintln!("numbers: {:?}", numbers);\nlet n1 = &mut numbers[2..];\nprintln!("n1 : {:?}", n1);\nn1[0] = 3022;\nprintln!("numbers: {:?}", numbers);\n')),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Slice memory management",src:t(743).Z,width:"409",height:"147"})),(0,n.kt)("p",null,"Salah satu elemen ",(0,n.kt)("inlineCode",{parentName:"p"},"n1")," diubah nilainya, maka efeknya juga berpengaruh pada owner. Ketika variabel ",(0,n.kt)("inlineCode",{parentName:"p"},"numbers")," di-print, element indeks ",(0,n.kt)("inlineCode",{parentName:"p"},"2")," berubah nilainya dari yang sebelumnya ",(0,n.kt)("inlineCode",{parentName:"p"},"8")," sekarang ",(0,n.kt)("inlineCode",{parentName:"p"},"3022"),"."),(0,n.kt)("p",null,"Visualisasi memory management-nya kurang lebih seperti ini:"),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Slice memory management",src:t(7609).Z,width:"718",height:"1088"})),(0,n.kt)("p",null,"Variabel ",(0,n.kt)("inlineCode",{parentName:"p"},"numbers")," dan ",(0,n.kt)("inlineCode",{parentName:"p"},"n1")," sama-sama mengarah ke reference yang sama. Itulah kenapa perubahan data pada peminjam membawa efek ke owner."),(0,n.kt)("hr",null),(0,n.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,n.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,n.kt)("pre",null,(0,n.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/slice_memory_management"},"github.com/novalagung/dasarpemrogramanrust-example/../slice_memory_management")),(0,n.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/array"},"Array")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/slice"},"Slice (Basic)")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/vector"},"Vector")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/basic-memory-management"},"Basic Memory Management")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/tipe-data-custom-type-string-slice"},"Tipe Data \u279c String Custom Type")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/string-slice-vs-string-literal"},"String Literal (&str) vs. String Custom Type"))),(0,n.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch04-03-slices.html"},"https://doc.rust-lang.org/book/ch04-03-slices.html")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://users.rust-lang.org/t/why-rust-slice-has-not-ownership/27356"},"https://users.rust-lang.org/t/why-rust-slice-has-not-ownership/27356"))))}d.isMDXComponent=!0},4505:(a,e,t)=>{t.d(e,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAS4AAADNCAIAAACJhQqMAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF32lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTItMTNUMTg6MDkrMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDI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KgIAKgKgIgCgIgCgIsBV+A89TcdB11uFfAAAAABJRU5ErkJggg=="},2236:(a,e,t)=>{t.d(e,{Z:()=>i});const i=t.p+"assets/images/slice-memory-management-2-97ee1868013eb53b825e4c59489aa236.png"},743:(a,e,t)=>{t.d(e,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZkAAACTCAIAAADTK/NLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTItMTRUMTQ6MjE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i27P4ErBjfEkhXTKfYmvzXGUVjinGwFLqud5M0x6TytnGPXwOhmQW1TTEpOEuQyyWXdJ21dWRs00wS1WvpQ1fpK5rfNQQTksnY6njNOYjFpXbyZUV86JScJcpkSl/36qblijkMqwwuYbaICJpR0Knce5cg35cbKJ3pSSHL8BAtqLp2Sk8QNcFmwBvbm47JoEQwu6pgeDwRh69bLMiM8uaHkLY2kimpBxW9+TJwSZjmXVkZklJwkyGXzh2me2G9amlyGXlEC1xGXxdPRyH9bflPOfHMKCtH6FRbHPM2CivOE75eFry0sXTolJ4mzcdnh0bSH1jK53TzPzUqn5CRBLjsaly0jkbh+npuVTslJglx2RS7jeczzdSa5jLg5LiMIglxGEARBLiMIgiCXEQRBkMsIgiCXEQRBkMsIgiDIZQRBEOQygiDIZQRBEOQygiAIchlBEEQV/gfiH8m6S53t7QAAAABJRU5ErkJggg=="},7609:(a,e,t)=>{t.d(e,{Z:()=>i});const i=t.p+"assets/images/slice-memory-management-4-25a4c7b54f07cac6f773e2ff178a6d32.png"}}]); \ No newline at end of file diff --git a/assets/js/475d163e.60520781.js b/assets/js/475d163e.60520781.js deleted file mode 100644 index 82793d6c..00000000 --- a/assets/js/475d163e.60520781.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[6403],{3905:(a,e,n)=>{n.d(e,{Zo:()=>u,kt:()=>m});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function l(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function r(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function A(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},l=Object.keys(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var d=t.createContext({}),p=function(a){var e=t.useContext(d),n=e;return a&&(n="function"==typeof a?a(e):r(r({},e),a)),n},u=function(a){var e=p(a.components);return t.createElement(d.Provider,{value:e},a.children)},k={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},o=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,l=a.originalType,d=a.parentName,u=A(a,["components","mdxType","originalType","parentName"]),o=p(n),m=i,c=o["".concat(d,".").concat(m)]||o[m]||k[m]||l;return n?t.createElement(c,r(r({ref:e},u),{},{components:n})):t.createElement(c,r({ref:e},u))}));function m(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var l=n.length,r=new Array(l);r[0]=o;var A={};for(var d in e)hasOwnProperty.call(e,d)&&(A[d]=e[d]);A.originalType=a,A.mdxType="string"==typeof a?a:i,r[1]=A;for(var p=2;p<l;p++)r[p]=n[p];return t.createElement.apply(null,r)}return t.createElement.apply(null,n)}o.displayName="MDXCreateElement"},6889:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>d,contentTitle:()=>r,default:()=>k,frontMatter:()=>l,metadata:()=>A,toc:()=>p});var t=n(7462),i=(n(7294),n(3905));const l={sidebar_position:10,title:"A.10. Perulangan \u279c while",sidebar_label:"A.10. Perulangan \u279c while"},r=void 0,A={unversionedId:"basic/perulangan-while",id:"basic/perulangan-while",title:"A.10. Perulangan \u279c while",description:"Di Rust ada beberapa cara untuk melakukan perulangan, salah satunya adalah dengan menggunakan keyword while, dan pada chapter ini kita akan mempelajarinya.",source:"@site/docs/basic/perulangan-while.md",sourceDirName:"basic",slug:"/basic/perulangan-while",permalink:"/basic/perulangan-while",draft:!1,tags:[],version:"current",sidebarPosition:10,frontMatter:{sidebar_position:10,title:"A.10. Perulangan \u279c while",sidebar_label:"A.10. Perulangan \u279c while"},sidebar:"tutorialSidebar",previous:{title:"A.9. Seleksi Kondisi \u279c if, else if, else",permalink:"/basic/seleksi-kondisi-if"},next:{title:"A.11. Perulangan \u279c loop, break, continue, label",permalink:"/basic/perulangan-loop-break-continue-label"}},d={},p=[{value:"A.10.1. Keyword <code>while</code>",id:"a101-keyword-while",level:2},{value:"A.10.2. Nested <code>while</code>",id:"a102-nested-while",level:2},{value:"\u25c9 Macro <code>print</code>",id:"-macro-print",level:3},{value:"A.10.3. Keyword <code>while let</code>",id:"a103-keyword-while-let",level:2},{value:"A.10.4. Menambahkan delay dalam perulangan",id:"a104-menambahkan-delay-dalam-perulangan",level:2},{value:"\u25c9 Keyword <code>use</code> dan module dalam Rust",id:"-keyword-use-dan-module-dalam-rust",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],u={toc:p};function k(a){let{components:e,...l}=a;return(0,i.kt)("wrapper",(0,t.Z)({},u,l,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Di Rust ada beberapa cara untuk melakukan perulangan, salah satunya adalah dengan menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"while"),", dan pada chapter ini kita akan mempelajarinya."),(0,i.kt)("p",null,"Perulangan sendiri merupakan teknik untuk mengulang-ulang eksekusi blok kode dengan kondisi tertentu. Perulangan akan terus menerus dieksekusi ketika kondisi perulangan nilainya ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),", dan hanya akan berhenti kita nilainya ",(0,i.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,i.kt)("h2",{id:"a101-keyword-while"},"A.10.1. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"while")),(0,i.kt)("p",null,"Perulangan menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"while")," mengharuskan kondisi perulangan dituliskan di awal dengan notasi penulisan sebagai berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"while kondisi {\n \n}\n")),(0,i.kt)("p",null,"Contoh berikut adalah penerapan ",(0,i.kt)("inlineCode",{parentName:"p"},"while")," untuk operasi perulangan yang isinya menampilkan angka ",(0,i.kt)("inlineCode",{parentName:"p"},"i")," dengan kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"i")," di bawah ",(0,i.kt)("inlineCode",{parentName:"p"},"max"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut i = 0;\nlet max = 5;\n\nwhile i < max {\n println!("nilai: {i}");\n i += 1;\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"keyword while",src:n(4735).Z,width:"463",height:"163"})),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"i")," pada contoh di atas menjadi penentu kapan perulangan berhenti. Di dalam blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"while")," (yang mana akan dieksekusi setiap kondisi menghasilkan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),"), nilai variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"i")," di-increment, membuat variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"i")," nilainya selalu bertambah 1 setiap kali perulangan. Perulangan akan berhenti ketika nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"i")," sudah tidak di bawah ",(0,i.kt)("inlineCode",{parentName:"p"},"max")," lagi."),(0,i.kt)("h2",{id:"a102-nested-while"},"A.10.2. Nested ",(0,i.kt)("inlineCode",{parentName:"h2"},"while")),(0,i.kt)("p",null,"Penerapan nested while (atau ",(0,i.kt)("inlineCode",{parentName:"p"},"while")," di dalam ",(0,i.kt)("inlineCode",{parentName:"p"},"while"),") cukup mudah, tulis saja statement ",(0,i.kt)("inlineCode",{parentName:"p"},"while")," di dalam ",(0,i.kt)("inlineCode",{parentName:"p"},"while")," sesuai kebutuhan. Contoh bisa dilihat pada kode berikut, yaitu penerapan teknik nested while untuk print karakter ",(0,i.kt)("inlineCode",{parentName:"p"},"*")," membuat bentuk segitiga."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut i = 0;\nlet max = 5;\n\nwhile i < max {\n let mut j = 0;\n let max_inner = i;\n\n while j <= max_inner {\n print!("* ");\n j += 1;\n }\n \n println!();\n i += 1;\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"nested while",src:n(8423).Z,width:"448",height:"172"})),(0,i.kt)("h3",{id:"-macro-print"},"\u25c9 Macro ",(0,i.kt)("inlineCode",{parentName:"h3"},"print")),(0,i.kt)("p",null,"Macro ",(0,i.kt)("inlineCode",{parentName:"p"},"print")," kegunaannya mirip dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),", hanya saja tanpa ",(0,i.kt)("em",{parentName:"p"},"newline")," atau baris baru. Jadi semua string yang di-print menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"print")," akan muncul menyamping ke kanan dan tidak di baris baru. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'print!("* ");\nprint!("* ");\nprint!("* ");\nprint!("* ");\n')),(0,i.kt)("p",null,"Akan menghasilkan output:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"* * * * \n")),(0,i.kt)("h2",{id:"a103-keyword-while-let"},"A.10.3. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"while let")),(0,i.kt)("p",null,"Kita akan bahas keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"while let")," pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pattern-matching"},"Pattern Matching"),"."),(0,i.kt)("h2",{id:"a104-menambahkan-delay-dalam-perulangan"},"A.10.4. Menambahkan delay dalam perulangan"),(0,i.kt)("p",null,"Eksekusi statement perulangan pada program sangatlah cepat. Bisa jadi dalam 1 detik ada ribuan (atau bahkan jauh lebih banyak) statement dalam perulangan yang dieksekusi. Di-tiap eksekusinya, delay bisa saja ditambahkan, misalnya 1 detik, dan pada contoh di bawah ini kita akan coba mengaplikasikannya."),(0,i.kt)("p",null,"Silakan tulis kode program berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'use std::thread::sleep;\nuse std::time::Duration;\n\nfn main() {\n let mut i = 0;\n let max = 5;\n\n while i < max {\n println!("nilai: {i}");\n i += 1;\n\n sleep(Duration::from_secs(1));\n }\n}\n')),(0,i.kt)("p",null,"Ada beberapa keyword baru dipergunakan pada source code di atas. Untuk sekarang coba jalankan terlebih dahulu program yang baru dibuat, kemudian stop. Text ",(0,i.kt)("inlineCode",{parentName:"p"},"nilai: {i}")," akan muncul di console setiap satu detik, dan hanya akan berhenti ketika program di stop."),(0,i.kt)("p",null,"Selanjutnya kita akan beberapa sintaks baru di atas."),(0,i.kt)("h3",{id:"-keyword-use-dan-module-dalam-rust"},"\u25c9 Keyword ",(0,i.kt)("inlineCode",{parentName:"h3"},"use")," dan module dalam Rust"),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"use")," memiliki banyak kegunaan. Pada contoh ini ",(0,i.kt)("inlineCode",{parentName:"p"},"use")," difungsikan untuk ",(0,i.kt)("em",{parentName:"p"},"import module"),", yang di bahasa Rust dikenal dengan istilah ",(0,i.kt)("strong",{parentName:"p"},"import paths"),"."),(0,i.kt)("p",null,"Notasi penulisan ",(0,i.kt)("em",{parentName:"p"},"module path")," di Rust dinotasikan dengan separator ",(0,i.kt)("inlineCode",{parentName:"p"},"::"),", contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"std::thread::sleep")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"std::time::Duration"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"use std::thread::sleep")," artinya path ",(0,i.kt)("inlineCode",{parentName:"p"},"std::thread::sleep")," digunakan dalam kode program. ",(0,i.kt)("inlineCode",{parentName:"p"},"sleep")," adalah sebuah fungsi yang gunanya untuk menambahkan jeda dengan durasi sesuai keinginan, contohnya, 1 detik, 30 menit, dst.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"use std::time::Duration")," artinya path ",(0,i.kt)("inlineCode",{parentName:"p"},"std::time::Duration")," digunakan dalam kode program. ",(0,i.kt)("inlineCode",{parentName:"p"},"Duration")," merupakan sebuah struct yang isinya banyak hal untuk keperluan yang berhubungan dengan waktu atau ",(0,i.kt)("em",{parentName:"p"},"duration"),"."))),(0,i.kt)("p",null,"Pada contoh di atas, fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"sleep")," dipanggil dalam blok kode perulangan agar ada jeda ditiap eksekusinya. Sedangkan durasi jedanya sendiri ditentukan oleh argument ",(0,i.kt)("inlineCode",{parentName:"p"},"Duration::from_secs(1)")," yang artinya durasi ",(0,i.kt)("inlineCode",{parentName:"p"},"1 detik"),". Dengan ini durasi delay adalah 1 detik."),(0,i.kt)("p",null,"Jika ingin jeda durasi yang lebih lama, ubah saja angka ",(0,i.kt)("inlineCode",{parentName:"p"},"1")," pada ",(0,i.kt)("inlineCode",{parentName:"p"},"Duration::from_secs(1)"),". Contoh: ",(0,i.kt)("inlineCode",{parentName:"p"},"Duration::from_secs(5)")," berarti jeda 5 detik."),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya perihal path dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/path-item"},"Module System \u279c Pach & Item")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya perihal keyword ",(0,i.kt)("inlineCode",{parentName:"li"},"use")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/use"},"Module System \u279c Use")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya perihal fungsi dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/function"},"Function")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya perihal struct dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/struct"},"Struct")))),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/perulangan_while"},"github.com/novalagung/dasarpemrogramanrust-example/../perulangan_while")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch03-05-control-flow.html"},"https://doc.rust-lang.org/book/ch03-05-control-flow.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.while.html"},"https://doc.rust-lang.org/std/keyword.while.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.use.html"},"https://doc.rust-lang.org/std/keyword.use.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/flow_control/while.html"},"https://doc.rust-lang.org/rust-by-example/flow_control/while.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/stable/std/time/struct.Duration.html"},"https://doc.rust-lang.org/stable/std/time/struct.Duration.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/expressions/while-expr.html"},"https://doc.rust-lang.org/reference/expressions/while-expr.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/paths.html"},"https://doc.rust-lang.org/reference/paths.html"))))}k.isMDXComponent=!0},4735:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc8AAACjCAIAAABjWwLpAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF5WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzd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gCKAAAKIIACgAAiiCAAgCAIgigAACgCAIoAAAoggAKAACKIIACAIAiN0OoDPUyACCDZF2oDPUyACCz3AChMtTLAIBscpOEylAvAwAyRdaFylAvAwAyy80QKkO9DADIIBAqAwCAIlgHCgAAiiCAAgCAIgigAACgCAIoAAAoggAKAACKIIACAIAiCKAAAKAIAigAACiCAAoAAIoggAIAgCK3TagM9TIAYG7cHqEy1MsAgDlzq4TKUC8DAObJ7RQqQ70MAJgDt0eoDPUyAGDO3DahMtTLAIC5AaEyAAAognWgAACgCAIoAAAoggAKAACKIIACAIAiCKAAAKAIAigAACiCAAoAAIoggAIAgCIIoAAAoAgCKAAAKIIACgAAiiCAAgCAIgigAACgyP8DCN5kHb5KvhgAAAAASUVORK5CYII="}}]); \ No newline at end of file diff --git a/assets/js/475d163e.ea0532e5.js b/assets/js/475d163e.ea0532e5.js new file mode 100644 index 00000000..30ba1d61 --- /dev/null +++ b/assets/js/475d163e.ea0532e5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[6403],{3905:(a,e,n)=>{n.d(e,{Zo:()=>u,kt:()=>m});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function l(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function r(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function A(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},l=Object.keys(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var d=t.createContext({}),p=function(a){var e=t.useContext(d),n=e;return a&&(n="function"==typeof a?a(e):r(r({},e),a)),n},u=function(a){var e=p(a.components);return t.createElement(d.Provider,{value:e},a.children)},k={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},o=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,l=a.originalType,d=a.parentName,u=A(a,["components","mdxType","originalType","parentName"]),o=p(n),m=i,c=o["".concat(d,".").concat(m)]||o[m]||k[m]||l;return n?t.createElement(c,r(r({ref:e},u),{},{components:n})):t.createElement(c,r({ref:e},u))}));function m(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var l=n.length,r=new Array(l);r[0]=o;var A={};for(var d in e)hasOwnProperty.call(e,d)&&(A[d]=e[d]);A.originalType=a,A.mdxType="string"==typeof a?a:i,r[1]=A;for(var p=2;p<l;p++)r[p]=n[p];return t.createElement.apply(null,r)}return t.createElement.apply(null,n)}o.displayName="MDXCreateElement"},6889:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>d,contentTitle:()=>r,default:()=>k,frontMatter:()=>l,metadata:()=>A,toc:()=>p});var t=n(7462),i=(n(7294),n(3905));const l={sidebar_position:10,title:"A.10. Perulangan \u279c while",sidebar_label:"A.10. Perulangan \u279c while"},r=void 0,A={unversionedId:"basic/perulangan-while",id:"basic/perulangan-while",title:"A.10. Perulangan \u279c while",description:"Di Rust ada beberapa cara untuk melakukan perulangan, salah satunya adalah dengan menggunakan keyword while, dan pada chapter ini kita akan mempelajarinya.",source:"@site/docs/basic/perulangan-while.md",sourceDirName:"basic",slug:"/basic/perulangan-while",permalink:"/basic/perulangan-while",draft:!1,tags:[],version:"current",sidebarPosition:10,frontMatter:{sidebar_position:10,title:"A.10. Perulangan \u279c while",sidebar_label:"A.10. Perulangan \u279c while"},sidebar:"tutorialSidebar",previous:{title:"A.9. Seleksi Kondisi \u279c if, else if, else",permalink:"/basic/seleksi-kondisi-if"},next:{title:"A.11. Perulangan \u279c loop, break, continue, label",permalink:"/basic/perulangan-loop-break-continue-label"}},d={},p=[{value:"A.10.1. Keyword <code>while</code>",id:"a101-keyword-while",level:2},{value:"A.10.2. Nested <code>while</code>",id:"a102-nested-while",level:2},{value:"\u25c9 Macro <code>print</code>",id:"-macro-print",level:3},{value:"A.10.3. Keyword <code>while let</code>",id:"a103-keyword-while-let",level:2},{value:"A.10.4. Menambahkan delay dalam perulangan",id:"a104-menambahkan-delay-dalam-perulangan",level:2},{value:"\u25c9 Keyword <code>use</code> dan module dalam Rust",id:"-keyword-use-dan-module-dalam-rust",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],u={toc:p};function k(a){let{components:e,...l}=a;return(0,i.kt)("wrapper",(0,t.Z)({},u,l,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Di Rust ada beberapa cara untuk melakukan perulangan, salah satunya adalah dengan menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"while"),", dan pada chapter ini kita akan mempelajarinya."),(0,i.kt)("p",null,"Perulangan sendiri merupakan teknik untuk mengulang-ulang eksekusi blok kode dengan kondisi tertentu. Perulangan akan terus menerus dieksekusi ketika kondisi perulangan nilainya ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),", dan hanya akan berhenti kita nilainya ",(0,i.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,i.kt)("h2",{id:"a101-keyword-while"},"A.10.1. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"while")),(0,i.kt)("p",null,"Perulangan menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"while")," mengharuskan kondisi perulangan dituliskan di awal dengan notasi penulisan sebagai berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"while kondisi {\n \n}\n")),(0,i.kt)("p",null,"Contoh berikut adalah penerapan ",(0,i.kt)("inlineCode",{parentName:"p"},"while")," untuk operasi perulangan yang isinya menampilkan angka ",(0,i.kt)("inlineCode",{parentName:"p"},"i")," dengan kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"i")," di bawah ",(0,i.kt)("inlineCode",{parentName:"p"},"max"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut i = 0;\nlet max = 5;\n\nwhile i < max {\n println!("nilai: {i}");\n i += 1;\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"keyword while",src:n(4735).Z,width:"463",height:"163"})),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"i")," pada contoh di atas menjadi penentu kapan perulangan berhenti. Di dalam blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"while")," (yang mana akan dieksekusi setiap kondisi menghasilkan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),"), nilai variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"i")," di-increment, membuat variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"i")," nilainya selalu bertambah 1 setiap kali perulangan. Perulangan akan berhenti ketika nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"i")," sudah tidak di bawah ",(0,i.kt)("inlineCode",{parentName:"p"},"max")," lagi."),(0,i.kt)("h2",{id:"a102-nested-while"},"A.10.2. Nested ",(0,i.kt)("inlineCode",{parentName:"h2"},"while")),(0,i.kt)("p",null,"Penerapan nested while (atau ",(0,i.kt)("inlineCode",{parentName:"p"},"while")," di dalam ",(0,i.kt)("inlineCode",{parentName:"p"},"while"),") cukup mudah, tulis saja statement ",(0,i.kt)("inlineCode",{parentName:"p"},"while")," di dalam ",(0,i.kt)("inlineCode",{parentName:"p"},"while")," sesuai kebutuhan. Contoh bisa dilihat pada kode berikut, yaitu penerapan teknik nested while untuk print karakter ",(0,i.kt)("inlineCode",{parentName:"p"},"*")," membuat bentuk segitiga."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut i = 0;\nlet max = 5;\n\nwhile i < max {\n let mut j = 0;\n let max_inner = i;\n\n while j <= max_inner {\n print!("* ");\n j += 1;\n }\n \n println!();\n i += 1;\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"nested while",src:n(8423).Z,width:"448",height:"172"})),(0,i.kt)("h3",{id:"-macro-print"},"\u25c9 Macro ",(0,i.kt)("inlineCode",{parentName:"h3"},"print")),(0,i.kt)("p",null,"Macro ",(0,i.kt)("inlineCode",{parentName:"p"},"print")," kegunaannya mirip dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),", hanya saja tanpa ",(0,i.kt)("em",{parentName:"p"},"newline")," atau baris baru. Jadi semua string yang di-print menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"print")," akan muncul menyamping ke kanan dan tidak di baris baru. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'print!("* ");\nprint!("* ");\nprint!("* ");\nprint!("* ");\n')),(0,i.kt)("p",null,"Akan menghasilkan output:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"* * * * \n")),(0,i.kt)("h2",{id:"a103-keyword-while-let"},"A.10.3. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"while let")),(0,i.kt)("p",null,"Kita akan bahas keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"while let")," pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pattern-matching"},"Pattern Matching"),"."),(0,i.kt)("h2",{id:"a104-menambahkan-delay-dalam-perulangan"},"A.10.4. Menambahkan delay dalam perulangan"),(0,i.kt)("p",null,"Eksekusi statement perulangan pada program sangatlah cepat. Bisa jadi dalam 1 detik ada ribuan (atau bahkan jauh lebih banyak) statement dalam perulangan yang dieksekusi. Di-tiap eksekusinya, delay bisa saja ditambahkan, misalnya 1 detik, dan pada contoh di bawah ini kita akan coba mengaplikasikannya."),(0,i.kt)("p",null,"Silakan tulis kode program berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'use std::thread::sleep;\nuse std::time::Duration;\n\nfn main() {\n let mut i = 0;\n let max = 5;\n\n while i < max {\n println!("nilai: {i}");\n i += 1;\n\n sleep(Duration::from_secs(1));\n }\n}\n')),(0,i.kt)("p",null,"Ada beberapa keyword baru dipergunakan pada source code di atas. Untuk sekarang coba jalankan terlebih dahulu program yang baru dibuat, kemudian stop. Text ",(0,i.kt)("inlineCode",{parentName:"p"},"nilai: {i}")," akan muncul di console setiap satu detik, dan hanya akan berhenti ketika program di stop."),(0,i.kt)("p",null,"Selanjutnya kita akan beberapa sintaks baru di atas."),(0,i.kt)("h3",{id:"-keyword-use-dan-module-dalam-rust"},"\u25c9 Keyword ",(0,i.kt)("inlineCode",{parentName:"h3"},"use")," dan module dalam Rust"),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"use")," memiliki banyak kegunaan. Pada contoh ini ",(0,i.kt)("inlineCode",{parentName:"p"},"use")," difungsikan untuk ",(0,i.kt)("em",{parentName:"p"},"import module"),", yang di bahasa Rust dikenal dengan istilah ",(0,i.kt)("strong",{parentName:"p"},"import paths"),"."),(0,i.kt)("p",null,"Notasi penulisan ",(0,i.kt)("em",{parentName:"p"},"module path")," di Rust dinotasikan dengan separator ",(0,i.kt)("inlineCode",{parentName:"p"},"::"),", contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"std::thread::sleep")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"std::time::Duration"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"use std::thread::sleep")," artinya path ",(0,i.kt)("inlineCode",{parentName:"p"},"std::thread::sleep")," digunakan dalam kode program. ",(0,i.kt)("inlineCode",{parentName:"p"},"sleep")," adalah sebuah fungsi yang gunanya untuk menambahkan jeda dengan durasi sesuai keinginan, contohnya, 1 detik, 30 menit, dst.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"use std::time::Duration")," artinya path ",(0,i.kt)("inlineCode",{parentName:"p"},"std::time::Duration")," digunakan dalam kode program. ",(0,i.kt)("inlineCode",{parentName:"p"},"Duration")," merupakan sebuah struct yang isinya banyak hal untuk keperluan yang berhubungan dengan waktu atau ",(0,i.kt)("em",{parentName:"p"},"duration"),"."))),(0,i.kt)("p",null,"Pada contoh di atas, fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"sleep")," dipanggil dalam blok kode perulangan agar ada jeda ditiap eksekusinya. Sedangkan durasi jedanya sendiri ditentukan oleh argument ",(0,i.kt)("inlineCode",{parentName:"p"},"Duration::from_secs(1)")," yang artinya durasi ",(0,i.kt)("inlineCode",{parentName:"p"},"1 detik"),". Dengan ini durasi delay adalah 1 detik."),(0,i.kt)("p",null,"Jika ingin jeda durasi yang lebih lama, ubah saja angka ",(0,i.kt)("inlineCode",{parentName:"p"},"1")," pada ",(0,i.kt)("inlineCode",{parentName:"p"},"Duration::from_secs(1)"),". Contoh: ",(0,i.kt)("inlineCode",{parentName:"p"},"Duration::from_secs(5)")," berarti jeda 5 detik."),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya perihal path dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/path-item"},"Module System \u279c Pach & Item")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya perihal keyword ",(0,i.kt)("inlineCode",{parentName:"li"},"use")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/use"},"Module System \u279c Use")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya perihal fungsi dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/function"},"Function")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya perihal struct dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/struct"},"Struct")))),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/perulangan_while"},"github.com/novalagung/dasarpemrogramanrust-example/../perulangan_while")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch03-05-control-flow.html"},"https://doc.rust-lang.org/book/ch03-05-control-flow.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.while.html"},"https://doc.rust-lang.org/std/keyword.while.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.use.html"},"https://doc.rust-lang.org/std/keyword.use.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/flow_control/while.html"},"https://doc.rust-lang.org/rust-by-example/flow_control/while.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/stable/std/time/struct.Duration.html"},"https://doc.rust-lang.org/stable/std/time/struct.Duration.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/expressions/while-expr.html"},"https://doc.rust-lang.org/reference/expressions/while-expr.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/paths.html"},"https://doc.rust-lang.org/reference/paths.html"))))}k.isMDXComponent=!0},4735:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc8AAACjCAIAAABjWwLpAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF5WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2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DADIIBAqAwCAIlgHCgAAiiCAAgCAIgigAACgCAIoAAAoggAKAACKIIACAIAiCKAAAKAIAigAACiCAAoAAIoggAIAgCK3TagM9TIAYG7cHqEy1MsAgDlzq4TKUC8DAObJ7RQqQ70MAJgDt0eoDPUyAGDO3DahMtTLAIC5AaEyAAAognWgAACgCAIoAAAoggAKAACKIIACAIAiCKAAAKAIAigAACiCAAoAAIoggAIAgCIIoAAAoAgCKAAAKIIACgAAiiCAAgCAIgigAACgyP8DCN5kHb5KvhgAAAAASUVORK5CYII="}}]); \ No newline at end of file diff --git a/assets/js/496dcc30.29121ef9.js b/assets/js/496dcc30.29121ef9.js new file mode 100644 index 00000000..4270754a --- /dev/null +++ b/assets/js/496dcc30.29121ef9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4738],{3905:(a,e,n)=>{n.d(e,{Zo:()=>s,kt:()=>k});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function p(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},r=Object.keys(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var o=t.createContext({}),u=function(a){var e=t.useContext(o),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},s=function(a){var e=u(a.components);return t.createElement(o.Provider,{value:e},a.children)},d={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},m=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,r=a.originalType,o=a.parentName,s=p(a,["components","mdxType","originalType","parentName"]),m=u(n),k=i,g=m["".concat(o,".").concat(k)]||m[k]||d[k]||r;return n?t.createElement(g,l(l({ref:e},s),{},{components:n})):t.createElement(g,l({ref:e},s))}));function k(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=n.length,l=new Array(r);l[0]=m;var p={};for(var o in e)hasOwnProperty.call(e,o)&&(p[o]=e[o]);p.originalType=a,p.mdxType="string"==typeof a?a:i,l[1]=p;for(var u=2;u<r;u++)l[u]=n[u];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}m.displayName="MDXCreateElement"},4547:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>o,contentTitle:()=>l,default:()=>d,frontMatter:()=>r,metadata:()=>p,toc:()=>u});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:1,title:"A.1. Program Pertama \u279c Hello Rust",sidebar_label:"A.1. Program Pertama \u279c Hello Rust",description:"Belajar membuat program hello world di Rust, dimulai dengan pembuatan program Hello World sederhana.",keywords:["rust","belajar rust","hello world","hello rust"]},l=void 0,p={unversionedId:"basic/hello-rust",id:"basic/hello-rust",title:"A.1. Program Pertama \u279c Hello Rust",description:"Belajar membuat program hello world di Rust, dimulai dengan pembuatan program Hello World sederhana.",source:"@site/docs/basic/hello-rust.md",sourceDirName:"basic",slug:"/basic/hello-rust",permalink:"/basic/hello-rust",draft:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,title:"A.1. Program Pertama \u279c Hello Rust",sidebar_label:"A.1. Program Pertama \u279c Hello Rust",description:"Belajar membuat program hello world di Rust, dimulai dengan pembuatan program Hello World sederhana.",keywords:["rust","belajar rust","hello world","hello rust"]},sidebar:"tutorialSidebar",previous:{title:"Rust Editor & Plugin",permalink:"/installation/rust-editor-plugin"},next:{title:"A.2. Build dan Run Program Rust",permalink:"/basic/build-dan-run-program-rust"}},o={},u=[{value:"A.1.1. Pembuatan project/package",id:"a11-pembuatan-projectpackage",level:2},{value:"A.1.2. Run project <code>Hello Rust</code>",id:"a12-run-project-hello-rust",level:2},{value:"A.1.3. Penjelasan blok kode <code>main.rs</code>",id:"a13-penjelasan-blok-kode-mainrs",level:2},{value:"\u25c9 Notasi pendefinisian fungsi",id:"-notasi-pendefinisian-fungsi",level:3},{value:"\u25c9 Notasi pemanggilan fungsi",id:"-notasi-pemanggilan-fungsi",level:3},{value:"\u25c9 Macro <code>println</code>",id:"-macro-println",level:3},{value:"\u25c9 Notasi penulisan statement",id:"-notasi-penulisan-statement",level:3},{value:"\u25c9 Indentation",id:"-indentation",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],s={toc:u};function d(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,t.Z)({},s,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Seperti pada umumnya bahasa pemrograman, belajar membuat program pasti diawali dengan aplikasi ",(0,i.kt)("inlineCode",{parentName:"p"},"Hello World"),", dan pada chapter ini kita akan melakukannya. Kita akan buat program bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"Hello Rust")," menggunakan pemrograman Rust."),(0,i.kt)("h2",{id:"a11-pembuatan-projectpackage"},"A.1.1. Pembuatan project/package"),(0,i.kt)("p",null,"Pembuatan project baru di Rust bisa dilakukan dengan 2 cara, dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo")," atau tanpanya. Di sini kita akan skip bagian pembuatan project tanpa ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo"),", karena akan butuh effort lebih banyak nantinya dalam mengelola package dan manajemen build."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Di Rust istilah project lebih dikenal dengan ",(0,i.kt)("strong",{parentName:"p"},"package"),", dan pada ebook ini maknanya adalah sama.")),(0,i.kt)("p",null,"Ok langsung saja, buat project baru dengan mengeksekusi command berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"cargo new hello_rust\ncd hello_rust\n")),(0,i.kt)("p",null,"Command di atas menghasilkan sebuah folder baru bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"hello_rust")," dengan isi beberapa file:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"Cargo.toml")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},".gitignore")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"src/main.rs"))),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Struktur project hello_rust",src:n(4222).Z,width:"126",height:"129"})),(0,i.kt)("p",null,"File ",(0,i.kt)("inlineCode",{parentName:"p"},"src/main.rs")," adalah file penting dalam pemrograman Rust. File ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs")," merupakan file pertama yang dipanggil saat proses build program Rust (yang kemudian di-run). Source code program harus berada dalam folder ",(0,i.kt)("inlineCode",{parentName:"p"},"src"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pembahasan detail mengenai file ",(0,i.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," nantinya ada pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/package-crate"},"Module System \u279c Package & Crate"),". Untuk sekarang penulis anjurkan untuk mengikuti pembelajaran tiap chapter secara urut.")),(0,i.kt)("h2",{id:"a12-run-project-hello-rust"},"A.1.2. Run project ",(0,i.kt)("inlineCode",{parentName:"h2"},"Hello Rust")),(0,i.kt)("p",null,"Sebelum membahas isi kode program dalam ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs"),", ada baiknya kita run terlebih dahulu program ini untuk melihat hasilnya. Jalankan command berikut untuk run program."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"cargo run\n")),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Run project hello_rust",src:n(5872).Z,width:"470",height:"315"})),(0,i.kt)("p",null,"Bisa dilihat pada gambar di atas pesan ",(0,i.kt)("inlineCode",{parentName:"p"},"Hello, world!")," yang ada dalam file ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs")," muncul, menandakan proses eksekusi program sukses."),(0,i.kt)("p",null,"Command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run")," digunakan untuk menjalankan aplikasi saat proses development. Perlu diingat bahwa Rust merupakan bahasa pemrograman yang kategorinya ",(0,i.kt)("inlineCode",{parentName:"p"},"compiled language")," yang artinya kode program akan dikompilasi terlebih dahulu untuk menghasilkan file binary, dan kemudian file binary itulah yang dijalankan."),(0,i.kt)("p",null,"Command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run")," merupakan shorthand untuk memperpendek proses kompilasi dan eksekusi. Dalam command tersebut, kode program akan di-compile terlebih dahulu, dan hasilnya adalah file executable binary bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"hello_rust.exe")," (karena penulis menggunakan windows). File binary tersebut berada dalam project dalam path ",(0,i.kt)("inlineCode",{parentName:"p"},"hello_rust/target/debug/hello_rust.exe"),". Setelah proses kompilasi, file binary tersebut dijalankan, dan hasilnya adalah pesan ",(0,i.kt)("inlineCode",{parentName:"p"},"Hello, world!")," yang muncul di layar"),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Untuk pengguna windows, file binary akan ber-ekstensi ",(0,i.kt)("inlineCode",{parentName:"p"},".exe")," seperti pada contoh yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"hello_rust.exe"),". Sedangkan untuk non-windows, file tidak mempunyai ekstensi, ",(0,i.kt)("inlineCode",{parentName:"p"},"hello_rust"),".")),(0,i.kt)("p",null,"Command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run")," akan sering kita pakai dalam proses development."),(0,i.kt)("h2",{id:"a13-penjelasan-blok-kode-mainrs"},"A.1.3. Penjelasan blok kode ",(0,i.kt)("inlineCode",{parentName:"h2"},"main.rs")),(0,i.kt)("p",null,"Berikut adalah isi (default) dari file ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs"),", dan kita akan bahas setiap barisnya (hanya 3 baris)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'fn main() {\n println!("Hello, world!");\n}\n')),(0,i.kt)("h3",{id:"-notasi-pendefinisian-fungsi"},"\u25c9 Notasi pendefinisian fungsi"),(0,i.kt)("p",null,"Pembuatan fungsi di Rust menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"fn")," dengan notasi penulisan sebagai berikut, contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"fn nama_fungsi() {\n\n}\n")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"nama_fungsi")," di atas adalah nama fungsi. Pada program yang sudah kita buat, fungsi bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),". Penulisan nama fungsi diikuti dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"()")," kemudian kurung kurawal ",(0,i.kt)("inlineCode",{parentName:"p"},"{ }"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Sintaks ",(0,i.kt)("inlineCode",{parentName:"li"},"()")," nantinya bisa diisi dengan definisi parameter. Pada contoh ini tidak ada parameter yang ditulis."),(0,i.kt)("li",{parentName:"ul"},"Sintaks ",(0,i.kt)("inlineCode",{parentName:"li"},"{}")," dituliskan dalam baris berbeda, isinya adalah kode program.")),(0,i.kt)("h3",{id:"-notasi-pemanggilan-fungsi"},"\u25c9 Notasi pemanggilan fungsi"),(0,i.kt)("p",null,"Notasi penulisan pemanggilan fungsi adalah cukup dengan menuliskan nama fungsinya kemudian diikuti dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"()"),", seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"nama_fungsi();\n")),(0,i.kt)("p",null,"Jika ada argument parameter yang perlu disisipkan saat pemanggilan fungsi, dituliskan di antara kurung ",(0,i.kt)("inlineCode",{parentName:"p"},"()"),". Contoh pemanggilan ",(0,i.kt)("inlineCode",{parentName:"p"},"sebuahFungsi")," dengan argument berupa string ",(0,i.kt)("inlineCode",{parentName:"p"},'"sebuah argument"'),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'sebuahFungsi("sebuah argument");\n')),(0,i.kt)("p",null,"Ok, sampai sini penulis rasa cukup jelas. Sekarang kita fokus ke ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),", ada yang aneh dengan pemanggilan fungsi ini. Kenapa ",(0,i.kt)("inlineCode",{parentName:"p"},"println")," tidak dituliskan dalam bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},'println("Hello, world!")')," melainkan ",(0,i.kt)("inlineCode",{parentName:"p"},'println!("Hello, world!")'),"?"),(0,i.kt)("p",null,"Sekadar informasi saja, berdasarkan versi Rust terbaru, tidak ada fungsi bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),", yang ada adalah macro bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),"."),(0,i.kt)("h3",{id:"-macro-println"},"\u25c9 Macro ",(0,i.kt)("inlineCode",{parentName:"h3"},"println")),(0,i.kt)("p",null,"Agar pembaca tidak bertambah bingung, setidaknya untuk sekarang pada chapter awal ini anggap saja macro adalah fungsi ... tapi sedikit berbeda. Yang paling terlihat bedanya secara sintaktis adalah tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"!"),". Pemanggilan macro pasti diikuti tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"!")," sebelum ",(0,i.kt)("inlineCode",{parentName:"p"},"()"),". Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'println!("Hello, world!");\n')),(0,i.kt)("p",null,"Macro ",(0,i.kt)("inlineCode",{parentName:"p"},"println")," digunakan untuk menampilkan string atau pesan ke console output (",(0,i.kt)("inlineCode",{parentName:"p"},"stdout"),") dan diikuti oleh baris baru (newline/enter). Agar lebih jelas jalankan kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'fn main() {\n println!("Hello, world!");\n println!("How");\n println!("are");\n println!("you?");\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"println macro",src:n(7465).Z,width:"514",height:"401"})),(0,i.kt)("p",null,"Bisa dilihat, setiap pesan yang ditampilkan menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"println")," muncul di baris baru."),(0,i.kt)("h3",{id:"-notasi-penulisan-statement"},"\u25c9 Notasi penulisan statement"),(0,i.kt)("p",null,"Di Rust, statement harus diikuti dengan tanda ",(0,i.kt)("inlineCode",{parentName:"p"},";")," atau titik koma. Wajib hukumnya. Tanpa tanda ",(0,i.kt)("inlineCode",{parentName:"p"},";")," maka beberapa statement akan dianggap 1 baris dan kemungkinan menghasilkan error jika sintaks dianggap tidak valid. Tanda ",(0,i.kt)("inlineCode",{parentName:"p"},";")," adalah penanda akhir statement. Contoh ",(0,i.kt)("inlineCode",{parentName:"p"},'println!("Hello, world!");'),"."),(0,i.kt)("h3",{id:"-indentation"},"\u25c9 Indentation"),(0,i.kt)("p",null,"Mengacu ke keterangan pada dokumentasi Rust, standar indentasi untuk kode program Rust adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"4 space characters")," atau 4 karakter space."),(0,i.kt)("hr",null),(0,i.kt)("p",null,"Ok, penulis rasa cukup untuk program pertama ini, semoga tidak membingungkan. Silakan diulang-ulang jika perlu. Jika sudah siap, kita akan lanjut ke pembahasan dasar pemrograman Rust pada chapter berikutnya."),(0,i.kt)("p",null,"Selamat! Anda telah menjadi programmer Rust!"),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/hello_rust"},"github.com/novalagung/dasarpemrogramanrust-example/../hello_rust")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch01-03-hello-cargo.html"},"https://doc.rust-lang.org/book/ch01-03-hello-cargo.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/macro.println.html"},"https://doc.rust-lang.org/std/macro.println.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/hello/print.html"},"https://doc.rust-lang.org/rust-by-example/hello/print.html"))))}d.isMDXComponent=!0},4222:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAACBCAIAAACJhZkTAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0Y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VpmcWZYLW0s9PahhLbDCQW8hXleJOxJBT0hFkEevqGct8LREzNXGHqmmUU6Nlgzm1yfSa71eswF+Hq0SvKxevLOA6fD6k0mq6XVWtfS74vLFnyKd7fn6i3gEOkejtyPE9BrxCKQ3TdPEK3UnJkrBD0n3v4VzuqjA6E49/dKxd5VfAvPBYkz2CZavUosAt5pQQMRBIJ8KWUPh5S5ktA3WK4/6J2L3rTT6VbHaMDjvFqmqd0K3FCmCobPKi8WobLRV3QsAgwaA3pAD+gBPaAHAfSAHgTQA3oQQA/oQQA9oAcB9IAeRCb/A8d3FqM8+LSSAAAAAElFTkSuQmCC"},5872:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/hello-rust-2-275752b62e2a0b25dbf8ee21f9817ea0.png"},7465:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/hello-rust-3-6c6265ba2c94ac92baf92b864094ca1c.png"}}]); \ No newline at end of file diff --git a/assets/js/496dcc30.2c33b3bd.js b/assets/js/496dcc30.2c33b3bd.js deleted file mode 100644 index 8685567c..00000000 --- a/assets/js/496dcc30.2c33b3bd.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4738],{3905:(a,e,n)=>{n.d(e,{Zo:()=>s,kt:()=>k});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function p(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},r=Object.keys(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var o=t.createContext({}),u=function(a){var e=t.useContext(o),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},s=function(a){var e=u(a.components);return t.createElement(o.Provider,{value:e},a.children)},d={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},m=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,r=a.originalType,o=a.parentName,s=p(a,["components","mdxType","originalType","parentName"]),m=u(n),k=i,g=m["".concat(o,".").concat(k)]||m[k]||d[k]||r;return n?t.createElement(g,l(l({ref:e},s),{},{components:n})):t.createElement(g,l({ref:e},s))}));function k(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=n.length,l=new Array(r);l[0]=m;var p={};for(var o in e)hasOwnProperty.call(e,o)&&(p[o]=e[o]);p.originalType=a,p.mdxType="string"==typeof a?a:i,l[1]=p;for(var u=2;u<r;u++)l[u]=n[u];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}m.displayName="MDXCreateElement"},4547:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>o,contentTitle:()=>l,default:()=>d,frontMatter:()=>r,metadata:()=>p,toc:()=>u});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:1,title:"A.1. Program Pertama \u279c Hello Rust",sidebar_label:"A.1. Program Pertama \u279c Hello Rust",description:"Belajar membuat program hello world di Rust, dimulai dengan pembuatan program Hello World sederhana.",keywords:["rust","belajar rust","hello world","hello rust"]},l=void 0,p={unversionedId:"basic/hello-rust",id:"basic/hello-rust",title:"A.1. Program Pertama \u279c Hello Rust",description:"Belajar membuat program hello world di Rust, dimulai dengan pembuatan program Hello World sederhana.",source:"@site/docs/basic/hello-rust.md",sourceDirName:"basic",slug:"/basic/hello-rust",permalink:"/basic/hello-rust",draft:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,title:"A.1. Program Pertama \u279c Hello Rust",sidebar_label:"A.1. Program Pertama \u279c Hello Rust",description:"Belajar membuat program hello world di Rust, dimulai dengan pembuatan program Hello World sederhana.",keywords:["rust","belajar rust","hello world","hello rust"]},sidebar:"tutorialSidebar",previous:{title:"Rust Editor & Plugin",permalink:"/installation/rust-editor-plugin"},next:{title:"A.2. Build dan Run Program Rust",permalink:"/basic/build-dan-run-program-rust"}},o={},u=[{value:"A.1.1. Pembuatan project/package",id:"a11-pembuatan-projectpackage",level:2},{value:"A.1.2. Run project <code>Hello Rust</code>",id:"a12-run-project-hello-rust",level:2},{value:"A.1.3. Penjelasan blok kode <code>main.rs</code>",id:"a13-penjelasan-blok-kode-mainrs",level:2},{value:"\u25c9 Notasi pendefinisian fungsi",id:"-notasi-pendefinisian-fungsi",level:3},{value:"\u25c9 Notasi pemanggilan fungsi",id:"-notasi-pemanggilan-fungsi",level:3},{value:"\u25c9 Macro <code>println</code>",id:"-macro-println",level:3},{value:"\u25c9 Notasi penulisan statement",id:"-notasi-penulisan-statement",level:3},{value:"\u25c9 Indentation",id:"-indentation",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],s={toc:u};function d(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,t.Z)({},s,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Seperti pada umumnya bahasa pemrograman, belajar membuat program pasti diawali dengan aplikasi ",(0,i.kt)("inlineCode",{parentName:"p"},"Hello World"),", dan pada chapter ini kita akan melakukannya. Kita akan buat program bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"Hello Rust")," menggunakan pemrograman Rust."),(0,i.kt)("h2",{id:"a11-pembuatan-projectpackage"},"A.1.1. Pembuatan project/package"),(0,i.kt)("p",null,"Pembuatan project baru di Rust bisa dilakukan dengan 2 cara, dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo")," atau tanpanya. Di sini kita akan skip bagian pembuatan project tanpa ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo"),", karena akan butuh effort lebih banyak nantinya dalam mengelola package dan manajemen build."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Di Rust istilah project lebih dikenal dengan ",(0,i.kt)("strong",{parentName:"p"},"package"),", dan pada ebook ini maknanya adalah sama.")),(0,i.kt)("p",null,"Ok langsung saja, buat project baru dengan mengeksekusi command berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"cargo new hello_rust\ncd hello_rust\n")),(0,i.kt)("p",null,"Command di atas menghasilkan sebuah folder baru bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"hello_rust")," dengan isi beberapa file:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"Cargo.toml")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},".gitignore")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"src/main.rs"))),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Struktur project hello_rust",src:n(4222).Z,width:"126",height:"129"})),(0,i.kt)("p",null,"File ",(0,i.kt)("inlineCode",{parentName:"p"},"src/main.rs")," adalah file penting dalam pemrograman Rust. File ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs")," merupakan file pertama yang dipanggil saat proses build program Rust (yang kemudian di-run). Source code program harus berada dalam folder ",(0,i.kt)("inlineCode",{parentName:"p"},"src"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pembahasan detail mengenai file ",(0,i.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," nantinya ada pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/package-crate"},"Module System \u279c Package & Crate"),". Untuk sekarang penulis anjurkan untuk mengikuti pembelajaran tiap chapter secara urut.")),(0,i.kt)("h2",{id:"a12-run-project-hello-rust"},"A.1.2. Run project ",(0,i.kt)("inlineCode",{parentName:"h2"},"Hello Rust")),(0,i.kt)("p",null,"Sebelum membahas isi kode program dalam ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs"),", ada baiknya kita run terlebih dahulu program ini untuk melihat hasilnya. Jalankan command berikut untuk run program."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"cargo run\n")),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Run project hello_rust",src:n(5872).Z,width:"470",height:"315"})),(0,i.kt)("p",null,"Bisa dilihat pada gambar di atas pesan ",(0,i.kt)("inlineCode",{parentName:"p"},"Hello, world!")," yang ada dalam file ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs")," muncul, menandakan proses eksekusi program sukses."),(0,i.kt)("p",null,"Command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run")," digunakan untuk menjalankan aplikasi saat proses development. Perlu diingat bahwa Rust merupakan bahasa pemrograman yang kategorinya ",(0,i.kt)("inlineCode",{parentName:"p"},"compiled language")," yang artinya kode program akan dikompilasi terlebih dahulu untuk menghasilkan file binary, dan kemudian file binary itulah yang dijalankan."),(0,i.kt)("p",null,"Command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run")," merupakan shorthand untuk memperpendek proses kompilasi dan eksekusi. Dalam command tersebut, kode program akan di-compile terlebih dahulu, dan hasilnya adalah file executable binary bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"hello_rust.exe")," (karena penulis menggunakan windows). File binary tersebut berada dalam project dalam path ",(0,i.kt)("inlineCode",{parentName:"p"},"hello_rust/target/debug/hello_rust.exe"),". Setelah proses kompilasi, file binary tersebut dijalankan, dan hasilnya adalah pesan ",(0,i.kt)("inlineCode",{parentName:"p"},"Hello, world!")," yang muncul di layar"),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Untuk pengguna windows, file binary akan ber-ekstensi ",(0,i.kt)("inlineCode",{parentName:"p"},".exe")," seperti pada contoh yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"hello_rust.exe"),". Sedangkan untuk non-windows, file tidak mempunyai ekstensi, ",(0,i.kt)("inlineCode",{parentName:"p"},"hello_rust"),".")),(0,i.kt)("p",null,"Command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run")," akan sering kita pakai dalam proses development."),(0,i.kt)("h2",{id:"a13-penjelasan-blok-kode-mainrs"},"A.1.3. Penjelasan blok kode ",(0,i.kt)("inlineCode",{parentName:"h2"},"main.rs")),(0,i.kt)("p",null,"Berikut adalah isi (default) dari file ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs"),", dan kita akan bahas setiap barisnya (hanya 3 baris)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'fn main() {\n println!("Hello, world!");\n}\n')),(0,i.kt)("h3",{id:"-notasi-pendefinisian-fungsi"},"\u25c9 Notasi pendefinisian fungsi"),(0,i.kt)("p",null,"Pembuatan fungsi di Rust menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"fn")," dengan notasi penulisan sebagai berikut, contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"fn nama_fungsi() {\n\n}\n")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"nama_fungsi")," di atas adalah nama fungsi. Pada program yang sudah kita buat, fungsi bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),". Penulisan nama fungsi diikuti dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"()")," kemudian kurung kurawal ",(0,i.kt)("inlineCode",{parentName:"p"},"{ }"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Sintaks ",(0,i.kt)("inlineCode",{parentName:"li"},"()")," nantinya bisa diisi dengan definisi parameter. Pada contoh ini tidak ada parameter yang ditulis."),(0,i.kt)("li",{parentName:"ul"},"Sintaks ",(0,i.kt)("inlineCode",{parentName:"li"},"{}")," dituliskan dalam baris berbeda, isinya adalah kode program.")),(0,i.kt)("h3",{id:"-notasi-pemanggilan-fungsi"},"\u25c9 Notasi pemanggilan fungsi"),(0,i.kt)("p",null,"Notasi penulisan pemanggilan fungsi adalah cukup dengan menuliskan nama fungsinya kemudian diikuti dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"()"),", seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"nama_fungsi();\n")),(0,i.kt)("p",null,"Jika ada argument parameter yang perlu disisipkan saat pemanggilan fungsi, dituliskan di antara kurung ",(0,i.kt)("inlineCode",{parentName:"p"},"()"),". Contoh pemanggilan ",(0,i.kt)("inlineCode",{parentName:"p"},"sebuahFungsi")," dengan argument berupa string ",(0,i.kt)("inlineCode",{parentName:"p"},'"sebuah argument"'),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'sebuahFungsi("sebuah argument");\n')),(0,i.kt)("p",null,"Ok, sampai sini penulis rasa cukup jelas. Sekarang kita fokus ke ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),", ada yang aneh dengan pemanggilan fungsi ini. Kenapa ",(0,i.kt)("inlineCode",{parentName:"p"},"println")," tidak dituliskan dalam bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},'println("Hello, world!")')," melainkan ",(0,i.kt)("inlineCode",{parentName:"p"},'println!("Hello, world!")'),"?"),(0,i.kt)("p",null,"Sekadar informasi saja, berdasarkan versi Rust terbaru, tidak ada fungsi bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),", yang ada adalah macro bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),"."),(0,i.kt)("h3",{id:"-macro-println"},"\u25c9 Macro ",(0,i.kt)("inlineCode",{parentName:"h3"},"println")),(0,i.kt)("p",null,"Agar pembaca tidak bertambah bingung, setidaknya untuk sekarang pada chapter awal ini anggap saja macro adalah fungsi ... tapi sedikit berbeda. Yang paling terlihat bedanya secara sintaktis adalah tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"!"),". Pemanggilan macro pasti diikuti tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"!")," sebelum ",(0,i.kt)("inlineCode",{parentName:"p"},"()"),". Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'println!("Hello, world!");\n')),(0,i.kt)("p",null,"Macro ",(0,i.kt)("inlineCode",{parentName:"p"},"println")," digunakan untuk menampilkan string atau pesan ke console output (",(0,i.kt)("inlineCode",{parentName:"p"},"stdout"),") dan diikuti oleh baris baru (newline/enter). Agar lebih jelas jalankan kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'fn main() {\n println!("Hello, world!");\n println!("How");\n println!("are");\n println!("you?");\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"println macro",src:n(7465).Z,width:"514",height:"401"})),(0,i.kt)("p",null,"Bisa dilihat, setiap pesan yang ditampilkan menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"println")," muncul di baris baru."),(0,i.kt)("h3",{id:"-notasi-penulisan-statement"},"\u25c9 Notasi penulisan statement"),(0,i.kt)("p",null,"Di Rust, statement harus diikuti dengan tanda ",(0,i.kt)("inlineCode",{parentName:"p"},";")," atau titik koma. Wajib hukumnya. Tanpa tanda ",(0,i.kt)("inlineCode",{parentName:"p"},";")," maka beberapa statement akan dianggap 1 baris dan kemungkinan menghasilkan error jika sintaks dianggap tidak valid. Tanda ",(0,i.kt)("inlineCode",{parentName:"p"},";")," adalah penanda akhir statement. Contoh ",(0,i.kt)("inlineCode",{parentName:"p"},'println!("Hello, world!");'),"."),(0,i.kt)("h3",{id:"-indentation"},"\u25c9 Indentation"),(0,i.kt)("p",null,"Mengacu ke keterangan pada dokumentasi Rust, standar indentasi untuk kode program Rust adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"4 space characters")," atau 4 karakter space."),(0,i.kt)("hr",null),(0,i.kt)("p",null,"Ok, penulis rasa cukup untuk program pertama ini, semoga tidak membingungkan. Silakan diulang-ulang jika perlu. Jika sudah siap, kita akan lanjut ke pembahasan dasar pemrograman Rust pada chapter berikutnya."),(0,i.kt)("p",null,"Selamat! Anda telah menjadi programmer Rust!"),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/hello_rust"},"github.com/novalagung/dasarpemrogramanrust-example/../hello_rust")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch01-03-hello-cargo.html"},"https://doc.rust-lang.org/book/ch01-03-hello-cargo.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/macro.println.html"},"https://doc.rust-lang.org/std/macro.println.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/hello/print.html"},"https://doc.rust-lang.org/rust-by-example/hello/print.html"))))}d.isMDXComponent=!0},4222:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANS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UlbYF2k3H/Lyl1svBWcEOhPDDlyzIYrby/v0AFppB4fiZMNZBI2yiZlZufIMllpSC6VxYfnDGb1lx1d8yzlSD/iWyyeCMt99HqBNhjIbCMbhUsTVcTQAXS3eDQwjRRSgH0jObNMm1Kz4Xy9fTShhj46P2y7rII+5z2IedRDB8Q5VTkUpX4EvVpmcWZYLW0s9PahhLbDCQW8hXleJOxJBT0hFkEevqGct8LREzNXGHqmmUU6Nlgzm1yfSa71eswF+Hq0SvKxevLOA6fD6k0mq6XVWtfS74vLFnyKd7fn6i3gEOkejtyPE9BrxCKQ3TdPEK3UnJkrBD0n3v4VzuqjA6E49/dKxd5VfAvPBYkz2CZavUosAt5pQQMRBIJ8KWUPh5S5ktA3WK4/6J2L3rTT6VbHaMDjvFqmqd0K3FCmCobPKi8WobLRV3QsAgwaA3pAD+gBPaAHAfSAHgTQA3oQQA/oQQA9oAcB9IAeRCb/A8d3FqM8+LSSAAAAAElFTkSuQmCC"},5872:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/hello-rust-2-275752b62e2a0b25dbf8ee21f9817ea0.png"},7465:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/hello-rust-3-6c6265ba2c94ac92baf92b864094ca1c.png"}}]); \ No newline at end of file diff --git a/assets/js/4c7e7ada.14a0abb4.js b/assets/js/4c7e7ada.14a0abb4.js deleted file mode 100644 index e3ffa7b9..00000000 --- a/assets/js/4c7e7ada.14a0abb4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[2706],{3905:(e,a,n)=>{n.d(a,{Zo:()=>s,kt:()=>k});var i=n(7294);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function r(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);a&&(i=i.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,i)}return n}function l(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?r(Object(n),!0).forEach((function(a){t(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function m(e,a){if(null==e)return{};var n,i,t=function(e,a){if(null==e)return{};var n,i,t={},r=Object.keys(e);for(i=0;i<r.length;i++)n=r[i],a.indexOf(n)>=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)n=r[i],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var u=i.createContext({}),d=function(e){var a=i.useContext(u),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},s=function(e){var a=d(e.components);return i.createElement(u.Provider,{value:a},e.children)},o={inlineCode:"code",wrapper:function(e){var a=e.children;return i.createElement(i.Fragment,{},a)}},p=i.forwardRef((function(e,a){var n=e.components,t=e.mdxType,r=e.originalType,u=e.parentName,s=m(e,["components","mdxType","originalType","parentName"]),p=d(n),k=t,b=p["".concat(u,".").concat(k)]||p[k]||o[k]||r;return n?i.createElement(b,l(l({ref:a},s),{},{components:n})):i.createElement(b,l({ref:a},s))}));function k(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var r=n.length,l=new Array(r);l[0]=p;var m={};for(var u in a)hasOwnProperty.call(a,u)&&(m[u]=a[u]);m.originalType=e,m.mdxType="string"==typeof e?e:t,l[1]=m;for(var d=2;d<r;d++)l[d]=n[d];return i.createElement.apply(null,l)}return i.createElement.apply(null,n)}p.displayName="MDXCreateElement"},5442:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>u,contentTitle:()=>l,default:()=>o,frontMatter:()=>r,metadata:()=>m,toc:()=>d});var i=n(7462),t=(n(7294),n(3905));const r={sidebar_position:20,title:"A.20. Module System \u279c Module",sidebar_label:"A.20. Module System \u279c Module"},l=void 0,m={unversionedId:"basic/module-basic",id:"basic/module-basic",title:"A.20. Module System \u279c Module",description:"Module adalah salah satu chapter yang cukup penting dalam pemrograman Rust. Pada bagian ini kita akan mempelajari dasarnya.",source:"@site/docs/basic/module-basic.md",sourceDirName:"basic",slug:"/basic/module-basic",permalink:"/basic/module-basic",draft:!1,tags:[],version:"current",sidebarPosition:20,frontMatter:{sidebar_position:20,title:"A.20. Module System \u279c Module",sidebar_label:"A.20. Module System \u279c Module"},sidebar:"tutorialSidebar",previous:{title:"A.19. Module System \u279c Package & Crate",permalink:"/basic/package-crate"},next:{title:"A.21. Module System \u279c Inline Module",permalink:"/basic/module-inline"}},u={},d=[{value:"A.20.1. Rust module system",id:"a201-rust-module-system",level:2},{value:"A.20.2. Praktik #1 - <code>nama_module.rs</code>",id:"a202-praktik-1---nama_modulers",level:2},{value:"\u25c9 Summary praktik #1",id:"-summary-praktik-1",level:3},{value:"\u25c9 <em>Naming convention</em> module",id:"-naming-convention-module",level:3},{value:"\u25c9 Module item",id:"-module-item",level:3},{value:"A.20.3. Praktik #2 - <code>nama_module/mod.rs</code>",id:"a203-praktik-2---nama_modulemodrs",level:2},{value:"\u25c9 Summary praktik #2",id:"-summary-praktik-2",level:3},{value:"\u25c9 Konversi string ke numerik",id:"-konversi-string-ke-numerik",level:3},{value:"A.20.4. Submodules",id:"a204-submodules",level:2},{value:"\u25c9 Summary praktik #3",id:"-summary-praktik-3",level:3},{value:"A.20.5. Penerapan keyword <code>use</code>",id:"a205-penerapan-keyword-use",level:2},{value:"A.20.6. Module <code>path</code> attribute",id:"a206-module-path-attribute",level:2},{value:"\u25c9 Summary praktik #4",id:"-summary-praktik-4",level:3},{value:"A.20.7. Pembahasan lanjutan",id:"a207-pembahasan-lanjutan",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],s={toc:d};function o(e){let{components:a,...r}=e;return(0,t.kt)("wrapper",(0,i.Z)({},s,r,{components:a,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Module adalah salah satu chapter yang cukup penting dalam pemrograman Rust. Pada bagian ini kita akan mempelajari dasarnya."),(0,t.kt)("h2",{id:"a201-rust-module-system"},"A.20.1. Rust module system"),(0,t.kt)("p",null,"Setiap bahasa pemrograman memiliki caranya sendiri dalam hal pengelolahan struktur files dan folder dalam project. Project yang isinya ada sangat banyak hal diatur sedemikian rupa menjadi beberapa bagian dan/atau sub-bagian sesuai dengan fungsinya masing-masing."),(0,t.kt)("p",null,"Di Rust, module memiliki hirarki (biasa disebut dengan ",(0,t.kt)("em",{parentName:"p"},"module tree"),") yang ",(0,t.kt)("em",{parentName:"p"},"root"),"/akarnya adalah file entrypoint crate, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs")," untuk ",(0,t.kt)("em",{parentName:"p"},"binary crate")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"lib.rs")," untuk ",(0,t.kt)("em",{parentName:"p"},"library crate"),". Kedua file ini biasa disebut dengan ",(0,t.kt)("em",{parentName:"p"},"crate root file"),"."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Di sini pembahasan akan fokus pada penerapan module dalam ",(0,t.kt)("em",{parentName:"p"},"binary crate"),". Kita belum masuk ke pembahasan tentang ",(0,t.kt)("em",{parentName:"p"},"library crate"),".")),(0,t.kt)("p",null,"Rust memiliki 2 jenis modul, yaitu ",(0,t.kt)("em",{parentName:"p"},"normal module")," dan ",(0,t.kt)("em",{parentName:"p"},"inline module"),". Pembahasan dimulai dengan normal module terlebih dahulu."),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"mod")," digunakan untuk mendefinisikan/mendaftarkan sebuah module. Nama module menjadi path di mana isi module atau ",(0,t.kt)("em",{parentName:"p"},"module item")," harus berada. Sebagai contoh:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"module yang didefinisikan dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number"),", maka item-nya harus berada pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number.rs")," atau ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number/mod.rs")),(0,t.kt)("li",{parentName:"ul"},"module yang didefinisikan dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io"),", maka item-nya harus berada pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io.rs")," atau ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io/mod.rs"))),(0,t.kt)("p",null,"Pendefinisian nama module sendiri berada pada file entrypoint ",(0,t.kt)("em",{parentName:"p"},"crate")," yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs")," (atau ",(0,t.kt)("inlineCode",{parentName:"p"},"lib.rs")," untuk library crate). Jadi pendefinisian nama module dan isi/item-nya terpisah."),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Nama module ditulis di ",(0,t.kt)("inlineCode",{parentName:"li"},"main.rs")," (atau ",(0,t.kt)("inlineCode",{parentName:"li"},"lib.rs")," untuk library crate)"),(0,t.kt)("li",{parentName:"ul"},"Item atau isi module ditulis dalam file ",(0,t.kt)("inlineCode",{parentName:"li"},"nama_module.rs")," atau ",(0,t.kt)("inlineCode",{parentName:"li"},"nama_module/mod.rs"))),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Sebenarnya ada beberapa hal lainnya lagi yang masih relevan yang perlu dibahas di-awal, yaitu perihal sub-module. Akan tetapi agar tidak makin bingung, mari kita lanjut ke praktik terlebih dahulu.")),(0,t.kt)("h2",{id:"a202-praktik-1---nama_modulers"},"A.20.2. Praktik #1 - ",(0,t.kt)("inlineCode",{parentName:"h2"},"nama_module.rs")),(0,t.kt)("p",null,"Mari buat program sederhana, yang isinya mencakup pembahasan tentang module. Pada program kecil ini, inputan user ditampung ke sebuah variabel, kemudian ditampilkan ke layar. Proses pembacaan inputan user akan di-split sebagai module."),(0,t.kt)("p",null,"Ok, langsung saja, buat package/project baru dengan nama bebas. Di sini penulis menggunakan nama package ",(0,t.kt)("inlineCode",{parentName:"p"},"module_1"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"cargo new module_1\n")),(0,t.kt)("p",null,"Setelah itu siapkan 1 buah file bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io.rs"),", letakan di dalam folder ",(0,t.kt)("inlineCode",{parentName:"p"},"src")," (1 level dengan file ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),"). File ini difungsikan sebagai tempat definisi ",(0,t.kt)("em",{parentName:"p"},"module item")," milik sebuah module bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io")," (io di sini kependekan dari ",(0,t.kt)("em",{parentName:"p"},"input output"),")."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"module_1\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 main.rs\n \u2514\u2500\u2500\u2500 my_io.rs\n")),(0,t.kt)("p",null,"Lanjut, definisikan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"read_entry")," di file ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io.rs"),", isinya kurang lebih adalah kode untuk membaca inputan user lalu mengembalikannya dalam bentuk ",(0,t.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/my_io.rs"',title:'"src/my_io.rs"'},'pub fn read_entry() -> String {\n let mut message = std::string::String::new();\n let stdin_reader = std::io::stdin(); \n let reader_res = stdin_reader.read_line(&mut message);\n\n if reader_res.is_err() {\n println!("error! {:?}", reader_res.err());\n }\n\n message.trim().to_string()\n}\n')),(0,t.kt)("p",null,"Ok, kita telah menyiapkan satu item milik module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io")," yaitu sebuah fungsi bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"read_entry"),". 1 hal yang sedikit berbeda pada definisi fungsi di atas adalah penambahan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub")," yang ditulis sebagai prefix definisi fungsi."),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub")," digunakan untuk menjadikan suatu item menjadi ",(0,t.kt)("strong",{parentName:"p"},"public"),", agar bisa diakses dari luar module."),(0,t.kt)("p",null,"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"read_entry")," ini berada dalam module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io"),". Jika tidak ada keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub")," di situ, maka fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"read_entry")," hanya bisa diakses dari dalam ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io")," saja, tidak bisa diakses dari luar module contohnya seperti dari ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),". Dengan menjadikan ",(0,t.kt)("inlineCode",{parentName:"p"},"read_entry")," sebagai fungsi yang public, maka fungsi tersebut bisa diakses dari ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),"."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub")," dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/visibility-privacy"},"Module System \u279c Visibility & Privacy"))),(0,t.kt)("p",null,"Isi module sudah siap, selanjutnya lanjut ke pendefinisian modul. Umumnya pada bahasa pemrograman, definisi module adalah ada dalam file di mana isi module berada, namun tidak untuk Rust."),(0,t.kt)("p",null,"Di Rust, definisi sebuah module (sekali lagi bukan item/isinya ya, tapi definisi dari module itu sendiri) dituliskan pada file terpisah, yaitu di file entrypoint crate, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs")," atau ",(0,t.kt)("inlineCode",{parentName:"p"},"lib.rs"),"."),(0,t.kt)("p",null,"Lanjut, sekarang buka file ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs")," dan tulis definisi modul ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io")," menggunakan statement ",(0,t.kt)("inlineCode",{parentName:"p"},"mod my_io"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"// definisi module my_io\nmod my_io;\n\n// fungsi main\nfn main() {\n // ...\n}\n")),(0,t.kt)("p",null,"Sekarang aplikasikan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"read_entry")," milik module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io")," di fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main")," untuk membaca inputan user."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod my_io;\n\nfn main() {\n println!("enter any number:");\n let message = my_io::read_entry();\n println!("your number: {}", message);\n}\n')),(0,t.kt)("p",null,"Jalankan program, masukan sebuah angka, lalu enter. Lihat hasilnya, program berjalan sesuai harapan."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Rust module",src:n(5152).Z,width:"762",height:"717"})),(0,t.kt)("p",null,"Cara pengaksesan item dari sebuah module yang kita definisikan sendiri adalah sama seperti pengaksesan item dari crate lainnya, yaitu menggunakan ",(0,t.kt)("em",{parentName:"p"},"path"),". Statement ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io::read_entry()")," artinya item ",(0,t.kt)("inlineCode",{parentName:"p"},"read_entry")," yang merupakan fungsi dalam module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io")," digunakan."),(0,t.kt)("h3",{id:"-summary-praktik-1"},"\u25c9 Summary praktik #1"),(0,t.kt)("p",null,"Pada praktik pertama ini kita telah belajar penerapan module dengan mengaplikasikan beberapa hal berikut:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Penggunaan normal module dalam binary crate"),(0,t.kt)("li",{parentName:"ul"},"Pembuatan module dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io"),", dengan isi/item ditulis pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io.rs")),(0,t.kt)("li",{parentName:"ul"},"Penggunaan keyword ",(0,t.kt)("inlineCode",{parentName:"li"},"pub")," untuk meng-export atau menjadikan item menjadi public, agar bisa diakses dari luar module"),(0,t.kt)("li",{parentName:"ul"},"Pengaksesan item milik module, yaitu: ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io::read_entry"))),(0,t.kt)("h3",{id:"-naming-convention-module"},"\u25c9 ",(0,t.kt)("em",{parentName:"h3"},"Naming convention")," module"),(0,t.kt)("p",null,"Sesuai anjuran di ",(0,t.kt)("a",{parentName:"p",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"halaman dokumentasi Rust"),", aturan penulisan nama module adalah menggunakan snake case, contohnya ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io"),"."),(0,t.kt)("h3",{id:"-module-item"},"\u25c9 Module item"),(0,t.kt)("p",null,"Module item adalah apapun yang didefinisikan di dalam sebuah module. Pada contoh praktik ke-1 di atas, module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io")," memiliki 1 buah item yaitu fungsi bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"read_entry"),"."),(0,t.kt)("p",null,"Selain fungsi, module item bisa dalam bentuk lainnya, contohnya: konstanta, submodule, struct, dan lainnya."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Lebih jelasnya tentang macam-macam item dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/path-item"},"Module System \u279c Path & Item"))),(0,t.kt)("h2",{id:"a203-praktik-2---nama_modulemodrs"},"A.20.3. Praktik #2 - ",(0,t.kt)("inlineCode",{parentName:"h2"},"nama_module/mod.rs")),(0,t.kt)("p",null,"Bagian ini merupakan kelanjutan dari praktik sebelumnya. Program sederhana yang sudah di-buat ditambahi beberapa hal. Data inputan user dikonversi ke bentuk angka untuk kemudian dicek apakah angka tersebut bilangan ganjil atau genap."),(0,t.kt)("p",null,"Fungsi untuk konversi string ke bentuk numerik dan juga untuk pengecekan bilangan ganjil genap, adalah dua buah item milik module bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number")," yang akan kita definisikan sebentar lagi."),(0,t.kt)("p",null,"Definisi item module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io")," menggunakan notasi penulisan file ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module.rs")," (yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io.rs"),"). Pada module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number")," ini kita akan gunakan notasi penulisan ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module/mod.rs")," (menjadi ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/mod.rs"),") untuk menampung definisi item module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"module_1\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 my_number\n \u2502 \u2514\u2500\u2500\u2500 mod.rs\n \u2502\u2500\u2500\u2500 main.rs\n \u2514\u2500\u2500\u2500 my_io.rs\n")),(0,t.kt)("p",null,"Ok, sekarang buat saja folder dan filenya, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/mod.rs"),". Lalu pada file ",(0,t.kt)("inlineCode",{parentName:"p"},"mod.rs")," tulis 2 buah fungsi berikut:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Fungsi untuk konversi string ke numerik ",(0,t.kt)("inlineCode",{parentName:"p"},"i32")),(0,t.kt)("pre",{parentName:"li"},(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/my_number/mod.rs"',title:'"src/my_number/mod.rs"'},"pub fn string_to_number(text: String) -> i32 {\n return text.parse::<i32>().unwrap();\n}\n"))),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Fungsi untuk pengecekan bilangan ganjil"),(0,t.kt)("pre",{parentName:"li"},(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/my_number/mod.rs"',title:'"src/my_number/mod.rs"'},"// ...\n\npub fn is_odd_number(number: i32) -> bool {\n number % 2 == 1\n}\n")))),(0,t.kt)("p",null,"Kemudian tulis definisi module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number")," dalam file entrypoint crate, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"// definisi module my_io\nmod my_io;\n\n// definisi module my_number\nmod my_number;\n\n// fungsi main\nfn main() {\n // ...\n}\n")),(0,t.kt)("p",null,"Terakhir, aplikasikan dua buah fungsi yang sudah didefinisikan."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'fn main() {\n println!("enter any number:");\n let message = my_io::read_entry();\n println!("your number: {}", message);\n\n let number = my_number::string_to_number(message);\n let result = my_number::is_odd_number(number);\n println!("is odd number: {}", result);\n}\n')),(0,t.kt)("p",null,"Jalankan program, lihat hasilnya."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Rust module",src:n(7050).Z,width:"777",height:"872"})),(0,t.kt)("h3",{id:"-summary-praktik-2"},"\u25c9 Summary praktik #2"),(0,t.kt)("p",null,"Hingga praktik ke-2 ini, kita telah belajar penerapan module dengan mengaplikasikan beberapa hal berikut:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Penggunaan normal module dalam binary crate"),(0,t.kt)("li",{parentName:"ul"},"Pembuatan module dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io"),", dengan isi/item ditulis pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io.rs")),(0,t.kt)("li",{parentName:"ul"},"Pembuatan module dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number"),", dengan isi/item ditulis pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number/mod.rs")),(0,t.kt)("li",{parentName:"ul"},"Penggunaan keyword ",(0,t.kt)("inlineCode",{parentName:"li"},"pub")," untuk meng-export atau menjadikan item menjadi public, agar bisa diakses dari luar module"),(0,t.kt)("li",{parentName:"ul"},"Pengaksesan item milik module, yaitu: ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io::read_entry"),", ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number::string_to_number"),", dan ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number::is_odd_number"))),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Penerapan notasi penulisan isi module ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module.rs")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module/mod.rs")," bisa diterapkan dalam satu package")),(0,t.kt)("h3",{id:"-konversi-string-ke-numerik"},"\u25c9 Konversi string ke numerik"),(0,t.kt)("p",null,"Rust mengenal beberapa jenis konversi antar tipe data. Teknik konversi yang kita praktikkan pada chapter ini menggunakan method ",(0,t.kt)("inlineCode",{parentName:"p"},".parse()"),", cara ini bisa dilakukan untuk konversi tipe data dari custom types ke primitive. Contohnya seperti di atas, dari ",(0,t.kt)("inlineCode",{parentName:"p"},"String")," ke ",(0,t.kt)("inlineCode",{parentName:"p"},"i32"),"."),(0,t.kt)("p",null,"Penggunaannya cukup mudah, akses saja method ",(0,t.kt)("inlineCode",{parentName:"p"},".parse()")," kemudian sisipkan tipe data sebagai parameter generic. Lalu chain dengan method ",(0,t.kt)("inlineCode",{parentName:"p"},"unwrap")," (yang method tersebut merupakan item milik tipe data ",(0,t.kt)("em",{parentName:"p"},"generic result type")," atau ",(0,t.kt)("inlineCode",{parentName:"p"},"Result<T, E>"),")."),(0,t.kt)("p",null,"Contoh lain untuk konversi dari tipe primitif lainnya bisa dilihat berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let data_number = "24".parse::<i32>().unwrap();\nlet data_bool = "true".parse::<bool>().unwrap();\nlet data_float = "3.14".parse::<f64>().unwrap();\n')),(0,t.kt)("p",null,"Method ",(0,t.kt)("inlineCode",{parentName:"p"},"parse")," menghasilkan data bertipe ",(0,t.kt)("em",{parentName:"p"},"generic result type")," atau ",(0,t.kt)("inlineCode",{parentName:"p"},"Result<T, E>"),". Tipe ini memiliki method bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"unwrap")," yang berguna untuk mengambil nilai."),(0,t.kt)("blockquote",null,(0,t.kt)("ul",{parentName:"blockquote"},(0,t.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai casting dibahas pada chapter ",(0,t.kt)("a",{parentName:"li",href:"/basic/type-alias-casting"},"Type Alias & Casting")," dan ",(0,t.kt)("a",{parentName:"li",href:"#/wip/trait-conversion-from-into"},"Trait \u279c Conversion (From & Into)")),(0,t.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai generic dibahas pada chapter ",(0,t.kt)("a",{parentName:"li",href:"/basic/generics"},"Generics")),(0,t.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai result type dibahas pada chapter ",(0,t.kt)("a",{parentName:"li",href:"/basic/result-type"},"Tipe Data \u279c Result")))),(0,t.kt)("h2",{id:"a204-submodules"},"A.20.4. Submodules"),(0,t.kt)("p",null,"Sampai bagian ini kita telah belajar tentang module beserta 2 macam cara penerapannya."),(0,t.kt)("p",null,"Sebuah module bisa saja memiliki module di bawahnya (biasa disebut submodule), dan hal ini adalah konsep yang umum dalam bahasa pemrograman. Di Rust, aturan dalam pembuatan submodule masih sama seperti module, perbedaannya adalah tempat di mana submodule didefinisikan. Jika pada root module definisi ada pada file ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs")," atau ",(0,t.kt)("inlineCode",{parentName:"p"},"lib.rs"),", maka pada submodule definisi ada pada file di mana ",(0,t.kt)("em",{parentName:"p"},"parent module")," berada."),(0,t.kt)("p",null,"Sebagai contoh jika pada program sebelumnya kita tambahkan module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number")," yang sudah dibuat, jika ada submodule dengan nama ",(0,t.kt)("inlineCode",{parentName:"p"},"conversion_utility"),", maka definisi module berada di ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/mod.rs")," dan itemnya di ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/conversion_utility/mod.rs"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 main.rs\n \u2502\u2500\u2500\u2500 my_io.rs\n \u2514\u2500\u2500\u2500 my_number\n \u2502\u2500\u2500\u2500 mod.rs // <----- definisi submodule conversion_utility\n \u2514\u2500\u2500\u2500 conversion_utility\n \u2514\u2500\u2500\u2500 mod.rs // <----- definisi item/isi conversion_utility\n")),(0,t.kt)("p",null,"Atau definisi module tetap di ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/mod.rs")," namun itemnya di ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/conversion_utility.rs"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 main.rs\n \u2502\u2500\u2500\u2500 my_io.rs\n \u2514\u2500\u2500\u2500 my_number\n \u2502\u2500\u2500\u2500 mod.rs // <----- definisi submodule conversion_utility\n \u2514\u2500\u2500\u2500 conversion_utility.rs // <----- definisi item/isi conversion_utility\n")),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Penerapan notasi penulisan ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module.rs")," biasanya dalam case ketika module tersebut tidak memiliki submodule."),(0,t.kt)("p",{parentName:"blockquote"},"Untuk module yang memiliki submodule, parent module harus menerapkan notasi penulisan ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module/mod.rs"),", hal ini karena pendefinisian submodule berada pada file ",(0,t.kt)("inlineCode",{parentName:"p"},"mod.rs")," dalam parent module tersebut.")),(0,t.kt)("p",null,"Lalu bagaimana jika sebuah submodule memiliki submodule yang memiliki submodule ... dst, aturannya tetap sama seperti aturan submodule."),(0,t.kt)("p",null,"Mari lanjut praktik agar tidak bingung. Kita akan modifikasi program sebelumnya. Item ",(0,t.kt)("inlineCode",{parentName:"p"},"string_to_number")," yang sebelumnya adalah item milik ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number")," kita pindah ke sebuah module baru bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"conversion_utility")," yang merupakan submodule dari ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number"),". Silakan buat file baru ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/conversion_utility/mod.rs"),", kemudian isi dengan fungsi berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/my_number/conversion_utility/mod.rs"',title:'"src/my_number/conversion_utility/mod.rs"'},"pub fn string_to_number(text: String) -> i32 {\n return text.parse::<i32>().unwrap();\n}\n")),(0,t.kt)("p",null,"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"string_to_number")," yang sebelumnya ada di ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/mod.rs")," silakan dihapus."),(0,t.kt)("p",null,"Kemudian pada file ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/mod.rs"),", tambahkan definisi submodule ",(0,t.kt)("inlineCode",{parentName:"p"},"conversion_utility"),". Isi file tersebut kurang lebih menjadi seperti berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/my_number/mod.rs"',title:'"src/my_number/mod.rs"'},"pub mod conversion_utility;\n\npub fn is_odd_number(number: i32) -> bool {\n number % 2 == 1\n}\n")),(0,t.kt)("p",null,"O iya, karena submodule merupakan sebuah item milik module, maka harus ditambahkan juga keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub"),", agar submodule bisa diakses dari luar scope-nya. Contoh penerapannya bisa dilihat di atas."),(0,t.kt)("p",null,"Terakhir, pada ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),", ubah pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"string_to_number")," dari ..."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"let number = my_number::string_to_number(message);\n")),(0,t.kt)("p",null,"... menjadi ..."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"let number = my_number::conversion_utility::string_to_number(message);\n")),(0,t.kt)("p",null,"Kurang lebih strukturnya menjadi seperti berikut:"),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Rust submodule",src:n(3749).Z,width:"940",height:"955"})),(0,t.kt)("p",null,"Jalankan program untuk mengetest hasilnya."),(0,t.kt)("h3",{id:"-summary-praktik-3"},"\u25c9 Summary praktik #3"),(0,t.kt)("p",null,"Hingga pembahasan pada praktik submodule, kita telah belajar penerapan module dengan mengaplikasikan beberapa hal berikut:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Penggunaan normal module dalam binary crate"),(0,t.kt)("li",{parentName:"ul"},"Pembuatan module dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io"),", dengan isi/item ditulis pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io.rs")),(0,t.kt)("li",{parentName:"ul"},"Pembuatan module dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number"),", dengan isi/item ditulis pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number/mod.rs")),(0,t.kt)("li",{parentName:"ul"},"Pembuatan submodule dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number/conversion_utility"),", dengan isi/item ditulis pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number/conversion.rs")," yang di-import menggunakan ",(0,t.kt)("inlineCode",{parentName:"li"},"path")," attribute."),(0,t.kt)("li",{parentName:"ul"},"Penggunaan keyword ",(0,t.kt)("inlineCode",{parentName:"li"},"pub")," pada fungsi agar bisa diakses dari luar module"),(0,t.kt)("li",{parentName:"ul"},"Penggunaan keyword ",(0,t.kt)("inlineCode",{parentName:"li"},"pub")," pada submodule agar bisa diakses dari luar parent module"),(0,t.kt)("li",{parentName:"ul"},"Pengaksesan item milik module, yaitu: ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io::read_entry"),", ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number::conversion_utility::string_to_number"),", dan ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number::is_odd_number"))),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Penerapan notasi penulisan isi module ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module.rs")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module/mod.rs")," bisa diterapkan dalam satu package")),(0,t.kt)("h2",{id:"a205-penerapan-keyword-use"},"A.20.5. Penerapan keyword ",(0,t.kt)("inlineCode",{parentName:"h2"},"use")),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"use")," bisa digunakan untuk meng-import module atau item tertentu, dan dengannya pengaksesan item menjadi lebih pendek. Contohnya:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"my_number::conversion_utility::string_to_number(message);\n")),(0,t.kt)("p",null,"... bisa dituliskan menjadi ..."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"use my_number::conversion_utility::string_to_number;\nstring_to_number(message);\n")),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"use")," dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/use"},"Module System \u279c Use"))),(0,t.kt)("h2",{id:"a206-module-path-attribute"},"A.20.6. Module ",(0,t.kt)("inlineCode",{parentName:"h2"},"path")," attribute"),(0,t.kt)("p",null,"Selain menggunakan dua teknik definisi module item di atas yang fokusnya ada pada penamaan file, ada juga cara lain pendefinisian module item, yaitu dengan memanfaatkan ",(0,t.kt)("inlineCode",{parentName:"p"},"path")," attribute."),(0,t.kt)("p",null,"Mari kita praktikkan, silakan ubah struktur package yang sudah dibuat dari ..."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 main.rs\n \u2502\u2500\u2500\u2500 my_io.rs\n \u2514\u2500\u2500\u2500 my_number\n \u2502\u2500\u2500\u2500 mod.rs // <----- definisi submodule conversion_utility\n \u2514\u2500\u2500\u2500 conversion_utility.rs // <----- definisi item/isi conversion_utility\n")),(0,t.kt)("p",null,"... menjadi ..."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 main.rs\n \u2502\u2500\u2500\u2500 my_io.rs\n \u2514\u2500\u2500\u2500 my_number\n \u2502\u2500\u2500\u2500 mod.rs // <----- definisi submodule conversion_utility\n \u2514\u2500\u2500\u2500 conversion.rs // <----- definisi item/isi conversion_utility\n")),(0,t.kt)("p",null,"Yang telah kita lakukan adalah me-rename file ",(0,t.kt)("inlineCode",{parentName:"p"},"conversion_utility.rs")," menjadi ",(0,t.kt)("inlineCode",{parentName:"p"},"conversion.rs"),". Efeknya akan muncul error dalam pengaksesan module item, karena submodule ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/conversion_utility")," isi/item-nya harus berada pada file ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/conversion_utility.rs")," atau ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/conversion_utility/mod.rs"),". Sedangkan file ",(0,t.kt)("inlineCode",{parentName:"p"},"conversion.rs")," tidak memenuhi kriteria tersebut."),(0,t.kt)("p",null,"Sekarang buka isi file ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/mod.rs"),", lalu ubah statement pendefinisian submodule dari ..."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/my_number/mod.rs"',title:'"src/my_number/mod.rs"'},"pub mod conversion_utility;\n")),(0,t.kt)("p",null,"... menjadi ..."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/my_number/mod.rs"',title:'"src/my_number/mod.rs"'},'#[path = "conversion.rs"]\npub mod conversion_utility;\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Rust module",src:n(6827).Z,width:"690",height:"365"})),(0,t.kt)("p",null,"Lalu run, dan program akan jalan normal tanpa error."),(0,t.kt)("p",null,"Statement ",(0,t.kt)("inlineCode",{parentName:"p"},'#[path = "conversion.rs"]')," di atas merupakan contoh penerapan dari Rust path attributes. Dengannya kita bisa menempatkan isi sebuah module pada file yang namanya bebas (pada contoh di atas, file bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"conversion.rs"),")."),(0,t.kt)("h3",{id:"-summary-praktik-4"},"\u25c9 Summary praktik #4"),(0,t.kt)("p",null,"Hingga pembahasan pada praktik module ",(0,t.kt)("inlineCode",{parentName:"p"},"path")," attribute, kita telah belajar penerapan module dengan mengaplikasikan beberapa hal berikut:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Penggunaan normal module dalam binary crate"),(0,t.kt)("li",{parentName:"ul"},"Pembuatan module dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io"),", dengan isi/item ditulis pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io.rs")),(0,t.kt)("li",{parentName:"ul"},"Pembuatan module dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number"),", dengan isi/item ditulis pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number/mod.rs")),(0,t.kt)("li",{parentName:"ul"},"Pembuatan submodule dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number/conversion_utility"),", dengan isi/item ditulis pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number/conversion_utility/mod.rs")),(0,t.kt)("li",{parentName:"ul"},"Penggunaan keyword ",(0,t.kt)("inlineCode",{parentName:"li"},"pub")," pada fungsi agar bisa diakses dari luar module"),(0,t.kt)("li",{parentName:"ul"},"Penggunaan keyword ",(0,t.kt)("inlineCode",{parentName:"li"},"pub")," pada submodule agar bisa diakses dari luar parent module"),(0,t.kt)("li",{parentName:"ul"},"Pengaksesan item milik module, yaitu: ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io::read_entry"),", ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number::conversion_utility::string_to_number"),", dan ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number::is_odd_number"))),(0,t.kt)("h2",{id:"a207-pembahasan-lanjutan"},"A.20.7. Pembahasan lanjutan"),(0,t.kt)("p",null,"Pembahasan topik module dilanjutkan pada beberapa chapter lain. Pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/module-inline"},"Module System \u279c Inline Module")," kita akan bahas secara mendetail mengenai apa itu inline module dan perbedaannya dibanding normal module. Lalu nantinya di cahpter ",(0,t.kt)("a",{parentName:"p",href:"/basic/visibility-privacy"},"Module System \u279c Visibility & Privacy")," akan dibahas secara lengkap mengenai keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub")," dan kontrol privasi lainnya di pemrograman Rust."),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/module_basic"},"github.com/novalagung/dasarpemrogramanrust-example/../module_basic")),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html"},"https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.pub.html"},"https://doc.rust-lang.org/std/keyword.pub.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.mod.html"},"https://doc.rust-lang.org/std/keyword.mod.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/mod.html"},"https://doc.rust-lang.org/rust-by-example/mod.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://aloso.github.io/2021/03/28/module-system.html"},"https://aloso.github.io/2021/03/28/module-system.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/69275034/what-is-the-difference-between-use-and-pub-use"},"https://stackoverflow.com/questions/69275034/what-is-the-difference-between-use-and-pub-use"))))}o.isMDXComponent=!0},5152:(e,a,n)=>{n.d(a,{Z:()=>i});const i=n.p+"assets/images/module-1-0eea2521d2399e73e455b90f5c2f97fa.png"},7050:(e,a,n)=>{n.d(a,{Z:()=>i});const i=n.p+"assets/images/module-2-d8f6f3862036da93c4b7920e144a3a3f.png"},3749:(e,a,n)=>{n.d(a,{Z:()=>i});const i=n.p+"assets/images/module-3-b8f34c47b905cadb9001a866ebb80809.png"},6827:(e,a,n)=>{n.d(a,{Z:()=>i});const i=n.p+"assets/images/module-4-e83e7a2e8d7d6d4d11ec121d6dc184d0.png"}}]); \ No newline at end of file diff --git a/assets/js/4c7e7ada.33f8371a.js b/assets/js/4c7e7ada.33f8371a.js new file mode 100644 index 00000000..5b19b425 --- /dev/null +++ b/assets/js/4c7e7ada.33f8371a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[2706],{3905:(e,a,n)=>{n.d(a,{Zo:()=>s,kt:()=>k});var i=n(7294);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function r(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);a&&(i=i.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,i)}return n}function l(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?r(Object(n),!0).forEach((function(a){t(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function m(e,a){if(null==e)return{};var n,i,t=function(e,a){if(null==e)return{};var n,i,t={},r=Object.keys(e);for(i=0;i<r.length;i++)n=r[i],a.indexOf(n)>=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)n=r[i],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var u=i.createContext({}),d=function(e){var a=i.useContext(u),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},s=function(e){var a=d(e.components);return i.createElement(u.Provider,{value:a},e.children)},o={inlineCode:"code",wrapper:function(e){var a=e.children;return i.createElement(i.Fragment,{},a)}},p=i.forwardRef((function(e,a){var n=e.components,t=e.mdxType,r=e.originalType,u=e.parentName,s=m(e,["components","mdxType","originalType","parentName"]),p=d(n),k=t,b=p["".concat(u,".").concat(k)]||p[k]||o[k]||r;return n?i.createElement(b,l(l({ref:a},s),{},{components:n})):i.createElement(b,l({ref:a},s))}));function k(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var r=n.length,l=new Array(r);l[0]=p;var m={};for(var u in a)hasOwnProperty.call(a,u)&&(m[u]=a[u]);m.originalType=e,m.mdxType="string"==typeof e?e:t,l[1]=m;for(var d=2;d<r;d++)l[d]=n[d];return i.createElement.apply(null,l)}return i.createElement.apply(null,n)}p.displayName="MDXCreateElement"},5442:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>u,contentTitle:()=>l,default:()=>o,frontMatter:()=>r,metadata:()=>m,toc:()=>d});var i=n(7462),t=(n(7294),n(3905));const r={sidebar_position:20,title:"A.20. Module System \u279c Module",sidebar_label:"A.20. Module System \u279c Module"},l=void 0,m={unversionedId:"basic/module-basic",id:"basic/module-basic",title:"A.20. Module System \u279c Module",description:"Module adalah salah satu chapter yang cukup penting dalam pemrograman Rust. Pada bagian ini kita akan mempelajari dasarnya.",source:"@site/docs/basic/module-basic.md",sourceDirName:"basic",slug:"/basic/module-basic",permalink:"/basic/module-basic",draft:!1,tags:[],version:"current",sidebarPosition:20,frontMatter:{sidebar_position:20,title:"A.20. Module System \u279c Module",sidebar_label:"A.20. Module System \u279c Module"},sidebar:"tutorialSidebar",previous:{title:"A.19. Module System \u279c Package & Crate",permalink:"/basic/package-crate"},next:{title:"A.21. Module System \u279c Inline Module",permalink:"/basic/module-inline"}},u={},d=[{value:"A.20.1. Rust module system",id:"a201-rust-module-system",level:2},{value:"A.20.2. Praktik #1 - <code>nama_module.rs</code>",id:"a202-praktik-1---nama_modulers",level:2},{value:"\u25c9 Summary praktik #1",id:"-summary-praktik-1",level:3},{value:"\u25c9 <em>Naming convention</em> module",id:"-naming-convention-module",level:3},{value:"\u25c9 Module item",id:"-module-item",level:3},{value:"A.20.3. Praktik #2 - <code>nama_module/mod.rs</code>",id:"a203-praktik-2---nama_modulemodrs",level:2},{value:"\u25c9 Summary praktik #2",id:"-summary-praktik-2",level:3},{value:"\u25c9 Konversi string ke numerik",id:"-konversi-string-ke-numerik",level:3},{value:"A.20.4. Submodules",id:"a204-submodules",level:2},{value:"\u25c9 Summary praktik #3",id:"-summary-praktik-3",level:3},{value:"A.20.5. Penerapan keyword <code>use</code>",id:"a205-penerapan-keyword-use",level:2},{value:"A.20.6. Module <code>path</code> attribute",id:"a206-module-path-attribute",level:2},{value:"\u25c9 Summary praktik #4",id:"-summary-praktik-4",level:3},{value:"A.20.7. Pembahasan lanjutan",id:"a207-pembahasan-lanjutan",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],s={toc:d};function o(e){let{components:a,...r}=e;return(0,t.kt)("wrapper",(0,i.Z)({},s,r,{components:a,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Module adalah salah satu chapter yang cukup penting dalam pemrograman Rust. Pada bagian ini kita akan mempelajari dasarnya."),(0,t.kt)("h2",{id:"a201-rust-module-system"},"A.20.1. Rust module system"),(0,t.kt)("p",null,"Setiap bahasa pemrograman memiliki caranya sendiri dalam hal pengelolahan struktur files dan folder dalam project. Project yang isinya ada sangat banyak hal diatur sedemikian rupa menjadi beberapa bagian dan/atau sub-bagian sesuai dengan fungsinya masing-masing."),(0,t.kt)("p",null,"Di Rust, module memiliki hirarki (biasa disebut dengan ",(0,t.kt)("em",{parentName:"p"},"module tree"),") yang ",(0,t.kt)("em",{parentName:"p"},"root"),"/akarnya adalah file entrypoint crate, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs")," untuk ",(0,t.kt)("em",{parentName:"p"},"binary crate")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"lib.rs")," untuk ",(0,t.kt)("em",{parentName:"p"},"library crate"),". Kedua file ini biasa disebut dengan ",(0,t.kt)("em",{parentName:"p"},"crate root file"),"."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Di sini pembahasan akan fokus pada penerapan module dalam ",(0,t.kt)("em",{parentName:"p"},"binary crate"),". Kita belum masuk ke pembahasan tentang ",(0,t.kt)("em",{parentName:"p"},"library crate"),".")),(0,t.kt)("p",null,"Rust memiliki 2 jenis modul, yaitu ",(0,t.kt)("em",{parentName:"p"},"normal module")," dan ",(0,t.kt)("em",{parentName:"p"},"inline module"),". Pembahasan dimulai dengan normal module terlebih dahulu."),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"mod")," digunakan untuk mendefinisikan/mendaftarkan sebuah module. Nama module menjadi path di mana isi module atau ",(0,t.kt)("em",{parentName:"p"},"module item")," harus berada. Sebagai contoh:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"module yang didefinisikan dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number"),", maka item-nya harus berada pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number.rs")," atau ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number/mod.rs")),(0,t.kt)("li",{parentName:"ul"},"module yang didefinisikan dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io"),", maka item-nya harus berada pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io.rs")," atau ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io/mod.rs"))),(0,t.kt)("p",null,"Pendefinisian nama module sendiri berada pada file entrypoint ",(0,t.kt)("em",{parentName:"p"},"crate")," yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs")," (atau ",(0,t.kt)("inlineCode",{parentName:"p"},"lib.rs")," untuk library crate). Jadi pendefinisian nama module dan isi/item-nya terpisah."),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Nama module ditulis di ",(0,t.kt)("inlineCode",{parentName:"li"},"main.rs")," (atau ",(0,t.kt)("inlineCode",{parentName:"li"},"lib.rs")," untuk library crate)"),(0,t.kt)("li",{parentName:"ul"},"Item atau isi module ditulis dalam file ",(0,t.kt)("inlineCode",{parentName:"li"},"nama_module.rs")," atau ",(0,t.kt)("inlineCode",{parentName:"li"},"nama_module/mod.rs"))),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Sebenarnya ada beberapa hal lainnya lagi yang masih relevan yang perlu dibahas di-awal, yaitu perihal sub-module. Akan tetapi agar tidak makin bingung, mari kita lanjut ke praktik terlebih dahulu.")),(0,t.kt)("h2",{id:"a202-praktik-1---nama_modulers"},"A.20.2. Praktik #1 - ",(0,t.kt)("inlineCode",{parentName:"h2"},"nama_module.rs")),(0,t.kt)("p",null,"Mari buat program sederhana, yang isinya mencakup pembahasan tentang module. Pada program kecil ini, inputan user ditampung ke sebuah variabel, kemudian ditampilkan ke layar. Proses pembacaan inputan user akan di-split sebagai module."),(0,t.kt)("p",null,"Ok, langsung saja, buat package/project baru dengan nama bebas. Di sini penulis menggunakan nama package ",(0,t.kt)("inlineCode",{parentName:"p"},"module_1"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"cargo new module_1\n")),(0,t.kt)("p",null,"Setelah itu siapkan 1 buah file bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io.rs"),", letakan di dalam folder ",(0,t.kt)("inlineCode",{parentName:"p"},"src")," (1 level dengan file ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),"). File ini difungsikan sebagai tempat definisi ",(0,t.kt)("em",{parentName:"p"},"module item")," milik sebuah module bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io")," (io di sini kependekan dari ",(0,t.kt)("em",{parentName:"p"},"input output"),")."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"module_1\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 main.rs\n \u2514\u2500\u2500\u2500 my_io.rs\n")),(0,t.kt)("p",null,"Lanjut, definisikan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"read_entry")," di file ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io.rs"),", isinya kurang lebih adalah kode untuk membaca inputan user lalu mengembalikannya dalam bentuk ",(0,t.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/my_io.rs"',title:'"src/my_io.rs"'},'pub fn read_entry() -> String {\n let mut message = std::string::String::new();\n let stdin_reader = std::io::stdin(); \n let reader_res = stdin_reader.read_line(&mut message);\n\n if reader_res.is_err() {\n println!("error! {:?}", reader_res.err());\n }\n\n message.trim().to_string()\n}\n')),(0,t.kt)("p",null,"Ok, kita telah menyiapkan satu item milik module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io")," yaitu sebuah fungsi bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"read_entry"),". 1 hal yang sedikit berbeda pada definisi fungsi di atas adalah penambahan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub")," yang ditulis sebagai prefix definisi fungsi."),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub")," digunakan untuk menjadikan suatu item menjadi ",(0,t.kt)("strong",{parentName:"p"},"public"),", agar bisa diakses dari luar module."),(0,t.kt)("p",null,"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"read_entry")," ini berada dalam module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io"),". Jika tidak ada keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub")," di situ, maka fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"read_entry")," hanya bisa diakses dari dalam ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io")," saja, tidak bisa diakses dari luar module contohnya seperti dari ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),". Dengan menjadikan ",(0,t.kt)("inlineCode",{parentName:"p"},"read_entry")," sebagai fungsi yang public, maka fungsi tersebut bisa diakses dari ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),"."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub")," dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/visibility-privacy"},"Module System \u279c Visibility & Privacy"))),(0,t.kt)("p",null,"Isi module sudah siap, selanjutnya lanjut ke pendefinisian modul. Umumnya pada bahasa pemrograman, definisi module adalah ada dalam file di mana isi module berada, namun tidak untuk Rust."),(0,t.kt)("p",null,"Di Rust, definisi sebuah module (sekali lagi bukan item/isinya ya, tapi definisi dari module itu sendiri) dituliskan pada file terpisah, yaitu di file entrypoint crate, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs")," atau ",(0,t.kt)("inlineCode",{parentName:"p"},"lib.rs"),"."),(0,t.kt)("p",null,"Lanjut, sekarang buka file ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs")," dan tulis definisi modul ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io")," menggunakan statement ",(0,t.kt)("inlineCode",{parentName:"p"},"mod my_io"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"// definisi module my_io\nmod my_io;\n\n// fungsi main\nfn main() {\n // ...\n}\n")),(0,t.kt)("p",null,"Sekarang aplikasikan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"read_entry")," milik module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io")," di fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main")," untuk membaca inputan user."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod my_io;\n\nfn main() {\n println!("enter any number:");\n let message = my_io::read_entry();\n println!("your number: {}", message);\n}\n')),(0,t.kt)("p",null,"Jalankan program, masukan sebuah angka, lalu enter. Lihat hasilnya, program berjalan sesuai harapan."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Rust module",src:n(5152).Z,width:"762",height:"717"})),(0,t.kt)("p",null,"Cara pengaksesan item dari sebuah module yang kita definisikan sendiri adalah sama seperti pengaksesan item dari crate lainnya, yaitu menggunakan ",(0,t.kt)("em",{parentName:"p"},"path"),". Statement ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io::read_entry()")," artinya item ",(0,t.kt)("inlineCode",{parentName:"p"},"read_entry")," yang merupakan fungsi dalam module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io")," digunakan."),(0,t.kt)("h3",{id:"-summary-praktik-1"},"\u25c9 Summary praktik #1"),(0,t.kt)("p",null,"Pada praktik pertama ini kita telah belajar penerapan module dengan mengaplikasikan beberapa hal berikut:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Penggunaan normal module dalam binary crate"),(0,t.kt)("li",{parentName:"ul"},"Pembuatan module dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io"),", dengan isi/item ditulis pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io.rs")),(0,t.kt)("li",{parentName:"ul"},"Penggunaan keyword ",(0,t.kt)("inlineCode",{parentName:"li"},"pub")," untuk meng-export atau menjadikan item menjadi public, agar bisa diakses dari luar module"),(0,t.kt)("li",{parentName:"ul"},"Pengaksesan item milik module, yaitu: ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io::read_entry"))),(0,t.kt)("h3",{id:"-naming-convention-module"},"\u25c9 ",(0,t.kt)("em",{parentName:"h3"},"Naming convention")," module"),(0,t.kt)("p",null,"Sesuai anjuran di ",(0,t.kt)("a",{parentName:"p",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"halaman dokumentasi Rust"),", aturan penulisan nama module adalah menggunakan snake case, contohnya ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io"),"."),(0,t.kt)("h3",{id:"-module-item"},"\u25c9 Module item"),(0,t.kt)("p",null,"Module item adalah apapun yang didefinisikan di dalam sebuah module. Pada contoh praktik ke-1 di atas, module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io")," memiliki 1 buah item yaitu fungsi bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"read_entry"),"."),(0,t.kt)("p",null,"Selain fungsi, module item bisa dalam bentuk lainnya, contohnya: konstanta, submodule, struct, dan lainnya."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Lebih jelasnya tentang macam-macam item dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/path-item"},"Module System \u279c Path & Item"))),(0,t.kt)("h2",{id:"a203-praktik-2---nama_modulemodrs"},"A.20.3. Praktik #2 - ",(0,t.kt)("inlineCode",{parentName:"h2"},"nama_module/mod.rs")),(0,t.kt)("p",null,"Bagian ini merupakan kelanjutan dari praktik sebelumnya. Program sederhana yang sudah di-buat ditambahi beberapa hal. Data inputan user dikonversi ke bentuk angka untuk kemudian dicek apakah angka tersebut bilangan ganjil atau genap."),(0,t.kt)("p",null,"Fungsi untuk konversi string ke bentuk numerik dan juga untuk pengecekan bilangan ganjil genap, adalah dua buah item milik module bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number")," yang akan kita definisikan sebentar lagi."),(0,t.kt)("p",null,"Definisi item module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io")," menggunakan notasi penulisan file ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module.rs")," (yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"my_io.rs"),"). Pada module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number")," ini kita akan gunakan notasi penulisan ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module/mod.rs")," (menjadi ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/mod.rs"),") untuk menampung definisi item module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"module_1\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 my_number\n \u2502 \u2514\u2500\u2500\u2500 mod.rs\n \u2502\u2500\u2500\u2500 main.rs\n \u2514\u2500\u2500\u2500 my_io.rs\n")),(0,t.kt)("p",null,"Ok, sekarang buat saja folder dan filenya, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/mod.rs"),". Lalu pada file ",(0,t.kt)("inlineCode",{parentName:"p"},"mod.rs")," tulis 2 buah fungsi berikut:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Fungsi untuk konversi string ke numerik ",(0,t.kt)("inlineCode",{parentName:"p"},"i32")),(0,t.kt)("pre",{parentName:"li"},(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/my_number/mod.rs"',title:'"src/my_number/mod.rs"'},"pub fn string_to_number(text: String) -> i32 {\n return text.parse::<i32>().unwrap();\n}\n"))),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Fungsi untuk pengecekan bilangan ganjil"),(0,t.kt)("pre",{parentName:"li"},(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/my_number/mod.rs"',title:'"src/my_number/mod.rs"'},"// ...\n\npub fn is_odd_number(number: i32) -> bool {\n number % 2 == 1\n}\n")))),(0,t.kt)("p",null,"Kemudian tulis definisi module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number")," dalam file entrypoint crate, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"// definisi module my_io\nmod my_io;\n\n// definisi module my_number\nmod my_number;\n\n// fungsi main\nfn main() {\n // ...\n}\n")),(0,t.kt)("p",null,"Terakhir, aplikasikan dua buah fungsi yang sudah didefinisikan."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'fn main() {\n println!("enter any number:");\n let message = my_io::read_entry();\n println!("your number: {}", message);\n\n let number = my_number::string_to_number(message);\n let result = my_number::is_odd_number(number);\n println!("is odd number: {}", result);\n}\n')),(0,t.kt)("p",null,"Jalankan program, lihat hasilnya."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Rust module",src:n(7050).Z,width:"777",height:"872"})),(0,t.kt)("h3",{id:"-summary-praktik-2"},"\u25c9 Summary praktik #2"),(0,t.kt)("p",null,"Hingga praktik ke-2 ini, kita telah belajar penerapan module dengan mengaplikasikan beberapa hal berikut:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Penggunaan normal module dalam binary crate"),(0,t.kt)("li",{parentName:"ul"},"Pembuatan module dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io"),", dengan isi/item ditulis pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io.rs")),(0,t.kt)("li",{parentName:"ul"},"Pembuatan module dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number"),", dengan isi/item ditulis pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number/mod.rs")),(0,t.kt)("li",{parentName:"ul"},"Penggunaan keyword ",(0,t.kt)("inlineCode",{parentName:"li"},"pub")," untuk meng-export atau menjadikan item menjadi public, agar bisa diakses dari luar module"),(0,t.kt)("li",{parentName:"ul"},"Pengaksesan item milik module, yaitu: ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io::read_entry"),", ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number::string_to_number"),", dan ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number::is_odd_number"))),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Penerapan notasi penulisan isi module ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module.rs")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module/mod.rs")," bisa diterapkan dalam satu package")),(0,t.kt)("h3",{id:"-konversi-string-ke-numerik"},"\u25c9 Konversi string ke numerik"),(0,t.kt)("p",null,"Rust mengenal beberapa jenis konversi antar tipe data. Teknik konversi yang kita praktikkan pada chapter ini menggunakan method ",(0,t.kt)("inlineCode",{parentName:"p"},".parse()"),", cara ini bisa dilakukan untuk konversi tipe data dari custom types ke primitive. Contohnya seperti di atas, dari ",(0,t.kt)("inlineCode",{parentName:"p"},"String")," ke ",(0,t.kt)("inlineCode",{parentName:"p"},"i32"),"."),(0,t.kt)("p",null,"Penggunaannya cukup mudah, akses saja method ",(0,t.kt)("inlineCode",{parentName:"p"},".parse()")," kemudian sisipkan tipe data sebagai parameter generic. Lalu chain dengan method ",(0,t.kt)("inlineCode",{parentName:"p"},"unwrap")," (yang method tersebut merupakan item milik tipe data ",(0,t.kt)("em",{parentName:"p"},"generic result type")," atau ",(0,t.kt)("inlineCode",{parentName:"p"},"Result<T, E>"),")."),(0,t.kt)("p",null,"Contoh lain untuk konversi dari tipe primitif lainnya bisa dilihat berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let data_number = "24".parse::<i32>().unwrap();\nlet data_bool = "true".parse::<bool>().unwrap();\nlet data_float = "3.14".parse::<f64>().unwrap();\n')),(0,t.kt)("p",null,"Method ",(0,t.kt)("inlineCode",{parentName:"p"},"parse")," menghasilkan data bertipe ",(0,t.kt)("em",{parentName:"p"},"generic result type")," atau ",(0,t.kt)("inlineCode",{parentName:"p"},"Result<T, E>"),". Tipe ini memiliki method bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"unwrap")," yang berguna untuk mengambil nilai."),(0,t.kt)("blockquote",null,(0,t.kt)("ul",{parentName:"blockquote"},(0,t.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai casting dibahas pada chapter ",(0,t.kt)("a",{parentName:"li",href:"/basic/type-alias-casting"},"Type Alias & Casting")," dan ",(0,t.kt)("a",{parentName:"li",href:"#/wip/trait-conversion-from-into"},"Trait \u279c Conversion (From & Into)")),(0,t.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai generic dibahas pada chapter ",(0,t.kt)("a",{parentName:"li",href:"/basic/generics"},"Generics")),(0,t.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai result type dibahas pada chapter ",(0,t.kt)("a",{parentName:"li",href:"/basic/result-type"},"Tipe Data \u279c Result")))),(0,t.kt)("h2",{id:"a204-submodules"},"A.20.4. Submodules"),(0,t.kt)("p",null,"Sampai bagian ini kita telah belajar tentang module beserta 2 macam cara penerapannya."),(0,t.kt)("p",null,"Sebuah module bisa saja memiliki module di bawahnya (biasa disebut submodule), dan hal ini adalah konsep yang umum dalam bahasa pemrograman. Di Rust, aturan dalam pembuatan submodule masih sama seperti module, perbedaannya adalah tempat di mana submodule didefinisikan. Jika pada root module definisi ada pada file ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs")," atau ",(0,t.kt)("inlineCode",{parentName:"p"},"lib.rs"),", maka pada submodule definisi ada pada file di mana ",(0,t.kt)("em",{parentName:"p"},"parent module")," berada."),(0,t.kt)("p",null,"Sebagai contoh jika pada program sebelumnya kita tambahkan module ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number")," yang sudah dibuat, jika ada submodule dengan nama ",(0,t.kt)("inlineCode",{parentName:"p"},"conversion_utility"),", maka definisi module berada di ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/mod.rs")," dan itemnya di ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/conversion_utility/mod.rs"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 main.rs\n \u2502\u2500\u2500\u2500 my_io.rs\n \u2514\u2500\u2500\u2500 my_number\n \u2502\u2500\u2500\u2500 mod.rs // <----- definisi submodule conversion_utility\n \u2514\u2500\u2500\u2500 conversion_utility\n \u2514\u2500\u2500\u2500 mod.rs // <----- definisi item/isi conversion_utility\n")),(0,t.kt)("p",null,"Atau definisi module tetap di ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/mod.rs")," namun itemnya di ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/conversion_utility.rs"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 main.rs\n \u2502\u2500\u2500\u2500 my_io.rs\n \u2514\u2500\u2500\u2500 my_number\n \u2502\u2500\u2500\u2500 mod.rs // <----- definisi submodule conversion_utility\n \u2514\u2500\u2500\u2500 conversion_utility.rs // <----- definisi item/isi conversion_utility\n")),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Penerapan notasi penulisan ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module.rs")," biasanya dalam case ketika module tersebut tidak memiliki submodule."),(0,t.kt)("p",{parentName:"blockquote"},"Untuk module yang memiliki submodule, parent module harus menerapkan notasi penulisan ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module/mod.rs"),", hal ini karena pendefinisian submodule berada pada file ",(0,t.kt)("inlineCode",{parentName:"p"},"mod.rs")," dalam parent module tersebut.")),(0,t.kt)("p",null,"Lalu bagaimana jika sebuah submodule memiliki submodule yang memiliki submodule ... dst, aturannya tetap sama seperti aturan submodule."),(0,t.kt)("p",null,"Mari lanjut praktik agar tidak bingung. Kita akan modifikasi program sebelumnya. Item ",(0,t.kt)("inlineCode",{parentName:"p"},"string_to_number")," yang sebelumnya adalah item milik ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number")," kita pindah ke sebuah module baru bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"conversion_utility")," yang merupakan submodule dari ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number"),". Silakan buat file baru ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/conversion_utility/mod.rs"),", kemudian isi dengan fungsi berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/my_number/conversion_utility/mod.rs"',title:'"src/my_number/conversion_utility/mod.rs"'},"pub fn string_to_number(text: String) -> i32 {\n return text.parse::<i32>().unwrap();\n}\n")),(0,t.kt)("p",null,"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"string_to_number")," yang sebelumnya ada di ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/mod.rs")," silakan dihapus."),(0,t.kt)("p",null,"Kemudian pada file ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/mod.rs"),", tambahkan definisi submodule ",(0,t.kt)("inlineCode",{parentName:"p"},"conversion_utility"),". Isi file tersebut kurang lebih menjadi seperti berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/my_number/mod.rs"',title:'"src/my_number/mod.rs"'},"pub mod conversion_utility;\n\npub fn is_odd_number(number: i32) -> bool {\n number % 2 == 1\n}\n")),(0,t.kt)("p",null,"O iya, karena submodule merupakan sebuah item milik module, maka harus ditambahkan juga keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub"),", agar submodule bisa diakses dari luar scope-nya. Contoh penerapannya bisa dilihat di atas."),(0,t.kt)("p",null,"Terakhir, pada ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),", ubah pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"string_to_number")," dari ..."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"let number = my_number::string_to_number(message);\n")),(0,t.kt)("p",null,"... menjadi ..."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"let number = my_number::conversion_utility::string_to_number(message);\n")),(0,t.kt)("p",null,"Kurang lebih strukturnya menjadi seperti berikut:"),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Rust submodule",src:n(3749).Z,width:"940",height:"955"})),(0,t.kt)("p",null,"Jalankan program untuk mengetest hasilnya."),(0,t.kt)("h3",{id:"-summary-praktik-3"},"\u25c9 Summary praktik #3"),(0,t.kt)("p",null,"Hingga pembahasan pada praktik submodule, kita telah belajar penerapan module dengan mengaplikasikan beberapa hal berikut:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Penggunaan normal module dalam binary crate"),(0,t.kt)("li",{parentName:"ul"},"Pembuatan module dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io"),", dengan isi/item ditulis pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io.rs")),(0,t.kt)("li",{parentName:"ul"},"Pembuatan module dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number"),", dengan isi/item ditulis pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number/mod.rs")),(0,t.kt)("li",{parentName:"ul"},"Pembuatan submodule dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number/conversion_utility"),", dengan isi/item ditulis pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number/conversion.rs")," yang di-import menggunakan ",(0,t.kt)("inlineCode",{parentName:"li"},"path")," attribute."),(0,t.kt)("li",{parentName:"ul"},"Penggunaan keyword ",(0,t.kt)("inlineCode",{parentName:"li"},"pub")," pada fungsi agar bisa diakses dari luar module"),(0,t.kt)("li",{parentName:"ul"},"Penggunaan keyword ",(0,t.kt)("inlineCode",{parentName:"li"},"pub")," pada submodule agar bisa diakses dari luar parent module"),(0,t.kt)("li",{parentName:"ul"},"Pengaksesan item milik module, yaitu: ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io::read_entry"),", ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number::conversion_utility::string_to_number"),", dan ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number::is_odd_number"))),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Penerapan notasi penulisan isi module ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module.rs")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_module/mod.rs")," bisa diterapkan dalam satu package")),(0,t.kt)("h2",{id:"a205-penerapan-keyword-use"},"A.20.5. Penerapan keyword ",(0,t.kt)("inlineCode",{parentName:"h2"},"use")),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"use")," bisa digunakan untuk meng-import module atau item tertentu, dan dengannya pengaksesan item menjadi lebih pendek. Contohnya:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"my_number::conversion_utility::string_to_number(message);\n")),(0,t.kt)("p",null,"... bisa dituliskan menjadi ..."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"use my_number::conversion_utility::string_to_number;\nstring_to_number(message);\n")),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"use")," dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/use"},"Module System \u279c Use"))),(0,t.kt)("h2",{id:"a206-module-path-attribute"},"A.20.6. Module ",(0,t.kt)("inlineCode",{parentName:"h2"},"path")," attribute"),(0,t.kt)("p",null,"Selain menggunakan dua teknik definisi module item di atas yang fokusnya ada pada penamaan file, ada juga cara lain pendefinisian module item, yaitu dengan memanfaatkan ",(0,t.kt)("inlineCode",{parentName:"p"},"path")," attribute."),(0,t.kt)("p",null,"Mari kita praktikkan, silakan ubah struktur package yang sudah dibuat dari ..."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 main.rs\n \u2502\u2500\u2500\u2500 my_io.rs\n \u2514\u2500\u2500\u2500 my_number\n \u2502\u2500\u2500\u2500 mod.rs // <----- definisi submodule conversion_utility\n \u2514\u2500\u2500\u2500 conversion_utility.rs // <----- definisi item/isi conversion_utility\n")),(0,t.kt)("p",null,"... menjadi ..."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 main.rs\n \u2502\u2500\u2500\u2500 my_io.rs\n \u2514\u2500\u2500\u2500 my_number\n \u2502\u2500\u2500\u2500 mod.rs // <----- definisi submodule conversion_utility\n \u2514\u2500\u2500\u2500 conversion.rs // <----- definisi item/isi conversion_utility\n")),(0,t.kt)("p",null,"Yang telah kita lakukan adalah me-rename file ",(0,t.kt)("inlineCode",{parentName:"p"},"conversion_utility.rs")," menjadi ",(0,t.kt)("inlineCode",{parentName:"p"},"conversion.rs"),". Efeknya akan muncul error dalam pengaksesan module item, karena submodule ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/conversion_utility")," isi/item-nya harus berada pada file ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/conversion_utility.rs")," atau ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/conversion_utility/mod.rs"),". Sedangkan file ",(0,t.kt)("inlineCode",{parentName:"p"},"conversion.rs")," tidak memenuhi kriteria tersebut."),(0,t.kt)("p",null,"Sekarang buka isi file ",(0,t.kt)("inlineCode",{parentName:"p"},"my_number/mod.rs"),", lalu ubah statement pendefinisian submodule dari ..."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/my_number/mod.rs"',title:'"src/my_number/mod.rs"'},"pub mod conversion_utility;\n")),(0,t.kt)("p",null,"... menjadi ..."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/my_number/mod.rs"',title:'"src/my_number/mod.rs"'},'#[path = "conversion.rs"]\npub mod conversion_utility;\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Rust module",src:n(6827).Z,width:"690",height:"365"})),(0,t.kt)("p",null,"Lalu run, dan program akan jalan normal tanpa error."),(0,t.kt)("p",null,"Statement ",(0,t.kt)("inlineCode",{parentName:"p"},'#[path = "conversion.rs"]')," di atas merupakan contoh penerapan dari Rust path attributes. Dengannya kita bisa menempatkan isi sebuah module pada file yang namanya bebas (pada contoh di atas, file bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"conversion.rs"),")."),(0,t.kt)("h3",{id:"-summary-praktik-4"},"\u25c9 Summary praktik #4"),(0,t.kt)("p",null,"Hingga pembahasan pada praktik module ",(0,t.kt)("inlineCode",{parentName:"p"},"path")," attribute, kita telah belajar penerapan module dengan mengaplikasikan beberapa hal berikut:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Penggunaan normal module dalam binary crate"),(0,t.kt)("li",{parentName:"ul"},"Pembuatan module dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io"),", dengan isi/item ditulis pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io.rs")),(0,t.kt)("li",{parentName:"ul"},"Pembuatan module dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number"),", dengan isi/item ditulis pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number/mod.rs")),(0,t.kt)("li",{parentName:"ul"},"Pembuatan submodule dengan nama ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number/conversion_utility"),", dengan isi/item ditulis pada file ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number/conversion_utility/mod.rs")),(0,t.kt)("li",{parentName:"ul"},"Penggunaan keyword ",(0,t.kt)("inlineCode",{parentName:"li"},"pub")," pada fungsi agar bisa diakses dari luar module"),(0,t.kt)("li",{parentName:"ul"},"Penggunaan keyword ",(0,t.kt)("inlineCode",{parentName:"li"},"pub")," pada submodule agar bisa diakses dari luar parent module"),(0,t.kt)("li",{parentName:"ul"},"Pengaksesan item milik module, yaitu: ",(0,t.kt)("inlineCode",{parentName:"li"},"my_io::read_entry"),", ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number::conversion_utility::string_to_number"),", dan ",(0,t.kt)("inlineCode",{parentName:"li"},"my_number::is_odd_number"))),(0,t.kt)("h2",{id:"a207-pembahasan-lanjutan"},"A.20.7. Pembahasan lanjutan"),(0,t.kt)("p",null,"Pembahasan topik module dilanjutkan pada beberapa chapter lain. Pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/module-inline"},"Module System \u279c Inline Module")," kita akan bahas secara mendetail mengenai apa itu inline module dan perbedaannya dibanding normal module. Lalu nantinya di cahpter ",(0,t.kt)("a",{parentName:"p",href:"/basic/visibility-privacy"},"Module System \u279c Visibility & Privacy")," akan dibahas secara lengkap mengenai keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"pub")," dan kontrol privasi lainnya di pemrograman Rust."),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/module_basic"},"github.com/novalagung/dasarpemrogramanrust-example/../module_basic")),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html"},"https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.pub.html"},"https://doc.rust-lang.org/std/keyword.pub.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.mod.html"},"https://doc.rust-lang.org/std/keyword.mod.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/mod.html"},"https://doc.rust-lang.org/rust-by-example/mod.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://aloso.github.io/2021/03/28/module-system.html"},"https://aloso.github.io/2021/03/28/module-system.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/69275034/what-is-the-difference-between-use-and-pub-use"},"https://stackoverflow.com/questions/69275034/what-is-the-difference-between-use-and-pub-use"))))}o.isMDXComponent=!0},5152:(e,a,n)=>{n.d(a,{Z:()=>i});const i=n.p+"assets/images/module-1-0eea2521d2399e73e455b90f5c2f97fa.png"},7050:(e,a,n)=>{n.d(a,{Z:()=>i});const i=n.p+"assets/images/module-2-d8f6f3862036da93c4b7920e144a3a3f.png"},3749:(e,a,n)=>{n.d(a,{Z:()=>i});const i=n.p+"assets/images/module-3-b8f34c47b905cadb9001a866ebb80809.png"},6827:(e,a,n)=>{n.d(a,{Z:()=>i});const i=n.p+"assets/images/module-4-e83e7a2e8d7d6d4d11ec121d6dc184d0.png"}}]); \ No newline at end of file diff --git a/assets/js/5925ce9f.4587ec2a.js b/assets/js/5925ce9f.4587ec2a.js deleted file mode 100644 index 38ce0d0c..00000000 --- a/assets/js/5925ce9f.4587ec2a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[9831],{3905:(a,e,n)=>{n.d(e,{Zo:()=>m,kt:()=>g});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function d(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},r=Object.keys(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var p=t.createContext({}),s=function(a){var e=t.useContext(p),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},m=function(a){var e=s(a.components);return t.createElement(p.Provider,{value:e},a.children)},u={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},k=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,r=a.originalType,p=a.parentName,m=d(a,["components","mdxType","originalType","parentName"]),k=s(n),g=i,o=k["".concat(p,".").concat(g)]||k[g]||u[g]||r;return n?t.createElement(o,l(l({ref:e},m),{},{components:n})):t.createElement(o,l({ref:e},m))}));function g(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=n.length,l=new Array(r);l[0]=k;var d={};for(var p in e)hasOwnProperty.call(e,p)&&(d[p]=e[p]);d.originalType=a,d.mdxType="string"==typeof a?a:i,l[1]=d;for(var s=2;s<r;s++)l[s]=n[s];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}k.displayName="MDXCreateElement"},3121:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>r,metadata:()=>d,toc:()=>s});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:38,title:"A.38. Generics",sidebar_label:"A.38. Generics"},l=void 0,d={unversionedId:"basic/generics",id:"basic/generics",title:"A.38. Generics",description:"Chapter ini membahas tentang generics.",source:"@site/docs/basic/generics.md",sourceDirName:"basic",slug:"/basic/generics",permalink:"/basic/generics",draft:!1,tags:[],version:"current",sidebarPosition:38,frontMatter:{sidebar_position:38,title:"A.38. Generics",sidebar_label:"A.38. Generics"},sidebar:"tutorialSidebar",previous:{title:"A.37. Traits \u279c Advanced",permalink:"/basic/advanced-traits"},next:{title:"A.39. Tipe Data \u279c Option",permalink:"/basic/option-type"}},p={},s=[{value:"A.38.1. Generics basic",id:"a381-generics-basic",level:2},{value:"A.38.2. Mengasosiasikan traits ke parameter generic",id:"a382-mengasosiasikan-traits-ke-parameter-generic",level:2},{value:"\u25c9 Contoh ke-1",id:"-contoh-ke-1",level:3},{value:"\u25c9 Contoh ke-2",id:"-contoh-ke-2",level:3},{value:"\u25c9 Contoh ke-3",id:"-contoh-ke-3",level:3},{value:"A.38.3. Multi traits pada parameter generic",id:"a383-multi-traits-pada-parameter-generic",level:2},{value:"A.38.4. Keyword <code>where</code>",id:"a384-keyword-where",level:2},{value:"A.38.5. Generics struct",id:"a385-generics-struct",level:2},{value:"A.38.6. Generics method",id:"a386-generics-method",level:2},{value:"A.38.7. Method khusus untuk spesifik tipe parameter generic tertentu",id:"a387-method-khusus-untuk-spesifik-tipe-parameter-generic-tertentu",level:2},{value:"A.38.8. Generics enum",id:"a388-generics-enum",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:s};function u(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,t.Z)({},m,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Chapter ini membahas tentang generics."),(0,i.kt)("p",null,"Generics sendiri merupakan salah satu fitur yang ada pada beberapa bahasa pemrograman (termasuk Rust), yang digunakan untuk menambahkan fleksibilitas dalam pemanfaatan tipe data pada suatu block kode. Dengan adanya generics, kita bisa menentukan tipe data yang digunakan pada parameter maupun return value sbuah block fungsi, method dan lainnya."),(0,i.kt)("p",null,"Generics dinotasikan dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"<T>"),". Kita sempat sedikit memanfaatkan generic pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/vector"},"Vector")," di mana dalam pendefinisian tipe data harus dituliskan juga tipe data item (via generics parameter), contoh ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<i32>"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<&str>"),", dll. Kita juga sempat sedikit belajar tentang topik generic pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/traits"},"Traits"),"."),(0,i.kt)("h2",{id:"a381-generics-basic"},"A.38.1. Generics basic"),(0,i.kt)("p",null,"Mari mulai pembahasan dengan sebauh contoh definisi fungsi yang memiliki generics."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something<T>(arg1: i32, arg2: T) {\n // ...\n}\n")),(0,i.kt)("p",null,"Pada contoh di atas, fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"do_something")," didefinisikan dengan 2 buah parameter argument dan 1 buah parameter generics. Parameter argument pertama, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"arg1")," bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),", kemudian diikuti parameter ke-2 bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," adalah parameter generic fungsi."),(0,i.kt)("p",null,"Dalam pemanggilan fungsi tersebut, ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," generics dan tipe data argument ",(0,i.kt)("inlineCode",{parentName:"p"},"arg2")," harus sama. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn main() {\n do_something::<bool>(24, false);\n}\n")),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"do_something")," dipanggil dengan disisipi argument ",(0,i.kt)("inlineCode",{parentName:"p"},"24")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"false"),". Parameter ke-2 fungsi tersebut tipe data-nya jelas ",(0,i.kt)("inlineCode",{parentName:"p"},"bool")," karena pada argument-nya nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"false")," digunakan, oleh karena itu tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"bool")," disisipkan pada parameter generics saat pemanggilan fungsi; dengan notasi penulisan adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"::<tipe_data>"),", posisi penulisannya di antara nama fungsi dan tanda kurung pemanggilan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"("),"."),(0,i.kt)("p",null,"Apa yang terjadi jika nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," diisi dengan tipe data argument ",(0,i.kt)("inlineCode",{parentName:"p"},"arg2")," berbeda? program error."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Generics",src:n(7757).Z,width:"690",height:"169"})),(0,i.kt)("p",null,"Ok sampai sini semoga jelas."),(0,i.kt)("p",null,"Khusus untuk fungsi yang generic parameter-nya dipergunakan sebagai tipe data parameter, maka boleh untuk tidak ditentukan tipe data-nya saat pemanggilan fungsi. Contohnya bisa dilihat pada kode berikut, dua statements ini adalah ekuivalen."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"do_something::<bool>(24, false);\n// T adalah bool, karena ditulis secara eksplisit\n\ndo_something(24, false);\n// T adalah bool, karena diketahui dari tipe data argument.\n// nilai `false` pasti tipe data-nya bool\n")),(0,i.kt)("p",null,"Tipe data generic boleh tidak ditulis karena nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," bisa diketahui dari argument pemanggilan fungsi. Sedangkan jika nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," tidak digunakan sebagai tipe data parameter, maka wajib untuk di-isi nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," saat pemanggilan fungsi."),(0,i.kt)("p",null,"O iya, jumlah parameter generics tidak ada batasan. Bisa saja ada lebih dari satu parameter generic yang didefinisikan, contohnya bisa dilihat pada fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"do_something_v2")," ini yang memiliki 2 buah parameter generic, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"R")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"T"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something_v2<R, T>(arg1: R, arg2: T) {\n // ...\n}\n")),(0,i.kt)("p",null,"Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"R")," digunakan sebagai tipe parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"arg1")," dan tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," pada parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"arg2"),"."),(0,i.kt)("h2",{id:"a382-mengasosiasikan-traits-ke-parameter-generic"},"A.38.2. Mengasosiasikan traits ke parameter generic"),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"do_something")," yang telah dipraktikkan, susah untuk diisi dengan apapun. Memang parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"arg1")," tipe-nya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),", dan harusnya mudah untuk bermain-main dengan parameter tersebut. Yang agak repot adalah parameter ke-2, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"arg2")," yang bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"T"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something<T>(arg1: i32, arg2: T) {\n // ...\n}\n")),(0,i.kt)("p",null,"Parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"arg2")," hampir tidak bisa diapa-apakan."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Misal mau di-print, tidak bisa, karena tipe ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," tidak implement trait ",(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/fmt/trait.Debug.html"},(0,i.kt)("inlineCode",{parentName:"a"},"std::fmt::Debug")),"."),(0,i.kt)("li",{parentName:"ul"},"Misal diisi nilai numerik kemudian dijadikan operand operasi aritmatika, juga tidak bisa karena tipe ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," tidak implement trait ",(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/ops/trait.Add.html"},(0,i.kt)("inlineCode",{parentName:"a"},"std::ops::Add")),", dan trait operasi bilangan lainnya."),(0,i.kt)("li",{parentName:"ul"},"Misal diisi dengan nilai ",(0,i.kt)("inlineCode",{parentName:"li"},"bool"),", tidak bisa digunakan pada seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"li"},"if")," karena tipe ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," tidak implement trait ",(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html"},(0,i.kt)("inlineCode",{parentName:"a"},"std::cmp::PartialOrd")),", dan trait operasi logika lainnya.")),(0,i.kt)("p",null,"Repot kan? Tapi tenang, tidak usah khawatir, ada soluasi agar tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," bisa dimanfaatkan, yaitu dengan mengasosiasikan trait ke tipe data generic (sesuai kebutuhan)."),(0,i.kt)("h3",{id:"-contoh-ke-1"},"\u25c9 Contoh ke-1"),(0,i.kt)("p",null,"Contoh pengaplikasiannya bisa dilihat pada kode berikut. Ada sebuah fungsi bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"print_x_times")," yang tugasnya adalah menampilkan data ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," sejumlah ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," kali, yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," adalah parameter generics."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n print_x_times("Hello guys", 10);\n}\n\nfn print_x_times<T: std::fmt::Debug>(data: T, x: i32) {\n for _ in 0..x {\n println!("{:?}", data);\n }\n}\n')),(0,i.kt)("p",null,"Parameter generic ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," diasosiasikan dengan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug"),", dengan ini maka kita akan bisa print parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"data")," yang tipe data-nya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"T"),"."),(0,i.kt)("p",null,"Untuk mengetes hasilnya, jalankan program. Bisa dilihat text ",(0,i.kt)("inlineCode",{parentName:"p"},"Hello guys")," muncul 10x."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Generics",src:n(4541).Z,width:"315",height:"248"})),(0,i.kt)("p",null,"Cara untuk mengasosiasikan trait ke parameter generic adalah dengan menuliskannya dalam notasi berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn nama_fungsi<T: TraitYangInginDiasosiasikan>(arg1 ...) {\n // ...\n}\n")),(0,i.kt)("h3",{id:"-contoh-ke-2"},"\u25c9 Contoh ke-2"),(0,i.kt)("p",null,"Pada contoh ke-2 ini, dideklarasikan sebuah fungsi bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"find_largest_number")," yang tugasnya adalah mencari nilai maksimum dari sebuah tipe slice."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn find_largest_number<T: std::cmp::PartialOrd>(list: &[T]) -> &T {\n let mut largest = &list[0];\n\n for item in list {\n if item > largest {\n largest = item;\n }\n }\n\n largest\n}\n")),(0,i.kt)("p",null,"Seperti yang sudah dibahas pada bagian sebelumnya, bahwa tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," tidak akan bisa diapa-apakan kalau tidak diasosiasikan dengan trait. Maka pada contoh ini, tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," diasosiasikan dengan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::cmp::PartialOrd"),". Benefitnya, semua data dengan tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," bisa dipergunakan dalam operasi perbandingan."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Tanpa adanya trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::cmp::PartialOrd"),", maka statement ",(0,i.kt)("inlineCode",{parentName:"p"},"if item > largest { ... }")," menghasilkan error.")),(0,i.kt)("p",null,"Ok, sekarang panggil fungsi tersebut 2x, yang pertama diisi dengan data slice dari sebuah array, dan yang kedua data slice dari sebuah vector."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let data_arr = [0, 1, 2, 3];\n let largest_number1 = find_largest_number(&data_arr);\n println!("largest_number1: {:?}", largest_number1);\n \n let data_vec = vec![4, 5, 6, 7];\n let largest_number2 = find_largest_number(&data_vec);\n println!("largest_number2: {:?}", largest_number2);\n}\n')),(0,i.kt)("p",null,"Hasilnya sesuai harapan."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Generics",src:n(7811).Z,width:"461",height:"113"})),(0,i.kt)("h3",{id:"-contoh-ke-3"},"\u25c9 Contoh ke-3"),(0,i.kt)("p",null,"Trait yang bisa diasosiasikan dengan parameter generics adalah semua jenis traits (tanpa terkecuali), termasuk custom trait yang kita buat sendiri."),(0,i.kt)("p",null,"Contohnya bisa dilihat pada kode berikut. Ada custom trait bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"MyTrait")," dideklarasikan, kemudian diasosiasikan dengan parameter generic ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," milik fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"do_something_v3"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"trait MyTrait {\n // methods declaration\n}\n\nfn do_something_v3<T: MyTrait>(arg1: T) {\n // do something\n}\n")),(0,i.kt)("h2",{id:"a383-multi-traits-pada-parameter-generic"},"A.38.3. Multi traits pada parameter generic"),(0,i.kt)("p",null,"Bagaimana jika ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," perlu untuk diasosiasikan dengan banyak traits (lebih dari satu), apakah bisa? Bisa. Cara penulisannya kurang lebih seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'// fn nama_fungsi<T: Trait1 + Trait2 + ...>(arg1 ...)\n\nfn print_largest_number<T: std::cmp::PartialOrd + std::fmt::Debug>(list: &[T]) {\n let largest = find_largest_number::<T>(list);\n println!("largest number: {:?}", largest);\n}\n')),(0,i.kt)("p",null,"Fungsi di atas adalah fungsi baru, namanya ",(0,i.kt)("inlineCode",{parentName:"p"},"print_largest_number"),", tugasnya adalah mencari nilai maksimum kemudian menampilkannya."),(0,i.kt)("p",null,"Proses pencarian nilai maksimum dilakukan dengan memanfaatkan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"find_largest_number")," yang sebelumnya sudah dibuat. Fungsi tersebut memerlukan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::cmp::PartialOrd")," untuk diasosiasikan dengan tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"T"),"."),(0,i.kt)("p",null,"Setelah nilai maksimum diketemukan, nilainya di-print ke stdout menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),". Nilai maksimum ditampung pada variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"largest"),", tipe data-nya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"T"),". Agar bisa di-print maka perlu diasosiasikan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Debug"),"."),(0,i.kt)("p",null,"Bisa dilihat cara penulisan asosiasi multi trait ke parameter generic seperti apa. Cukup tulis saja dengan separator tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"+"),"."),(0,i.kt)("h2",{id:"a384-keyword-where"},"A.38.4. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"where")),(0,i.kt)("p",null,"Selain notasi penulisan yang sudah dipelajari di atas ada lagi alternatif lainnya, yaitu menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"where"),". Kurang lebih seperti berikut penerapannya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn print_largest_number<T: std::cmp::PartialOrd + std::fmt::Debug>(list: &[T]) {\n let largest = find_largest_number::<T>(list);\n println!("largest number: {:?}", largest);\n}\n\n// ... adalah ekuivalen dengan ...\n\nfn print_largest_number<T>(list: &[T]) \nwhere\n T: std::cmp::PartialOrd + std::fmt::Debug,\n{\n let largest = find_largest_number::<T>(list);\n println!("largest number: {:?}", largest);\n}\n')),(0,i.kt)("p",null,"Silakan gunakan sesuai preferensi dan kesepakatan tim. Kalau penulis lebih suka cara ke-2, karena terasa lebih rapi untuk penulisan fungsi yang ada banyak parameter generic beserta asosiasi traits-nya. Contohnya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something<T, U, V>(arg1: T, arg2: U, arg3: V) \nwhere\n T: some::traits:TraitA,\n U: some::traits:TraitB + some::traits:TraitC + some::traits:TraitD,\n V: some::traits:TraitA + some::traits:TraitD,\n{\n // do something\n}\n")),(0,i.kt)("h2",{id:"a385-generics-struct"},"A.38.5. Generics struct"),(0,i.kt)("p",null,"Selain diterapkan di fungsi, generics bisa juga diterapkan di struct. Cara penulisannya, tambahkan notasi parameter generic di antara nama struct dan block struct."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"struct Point<T, U> {\n x: T,\n y: T,\n z: U\n}\n\nfn main() {\n let num_one: Point<i32, f64> = Point { x: 502, y: 120, z: 4.5 };\n let num_two: Point<f64, i32> = Point { x: 1.2, y: 4.3, z: 534 };\n}\n")),(0,i.kt)("p",null,"Pada contoh di atas, struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Point")," memiliki 2 parameter generic. Kemudian struct tersebut digunakan untuk membuat dua variabel berbeda:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"num_one"),", bertipe ",(0,i.kt)("inlineCode",{parentName:"li"},"Point<i32, f64>"),". Tipe data property ",(0,i.kt)("inlineCode",{parentName:"li"},"x")," dan ",(0,i.kt)("inlineCode",{parentName:"li"},"y")," adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"i32")," sedangkan tipe data property ",(0,i.kt)("inlineCode",{parentName:"li"},"z")," adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"f64"),"."),(0,i.kt)("li",{parentName:"ul"},"Variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"num_two"),", bertipe ",(0,i.kt)("inlineCode",{parentName:"li"},"Point<f64, i32>"),". Tipe data property ",(0,i.kt)("inlineCode",{parentName:"li"},"x")," dan ",(0,i.kt)("inlineCode",{parentName:"li"},"y")," adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"f64")," sedangkan tipe data property ",(0,i.kt)("inlineCode",{parentName:"li"},"z")," adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"i32"),".")),(0,i.kt)("h2",{id:"a386-generics-method"},"A.38.6. Generics method"),(0,i.kt)("p",null,"Generic bisa diterapkan pada method. Notasi penulisannya kurang lebih sama seperti pada penulisan method, hanya saja pada syntax ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," perlu diikuti block parameter generics. Perbandingannya kurang lebih seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"// method biasa\nimpl Square {\n fn x(&self) -> &i32 {\n &self.x\n }\n}\n\n// method dengan generic\nimpl<T> Square<T> {\n fn x(&self) -> &T {\n &self.x\n }\n}\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Di syntax bagian ",(0,i.kt)("inlineCode",{parentName:"p"},"impl<T>")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Square<T>"),", penulisan parameter generics di keduanya harus sama persis. Misal pada struct ada 3 buah parameter generic ",(0,i.kt)("inlineCode",{parentName:"p"},"Square<T, U, V>")," maka pada syntax ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," juga harus sama, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"impl<T, U, V>"),"."),(0,i.kt)("p",{parentName:"blockquote"},"Jika tidak sama akan muncul error.")),(0,i.kt)("p",null,"Ok, sekarang mari kita praktikkan. Struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Point")," yang sudah dibuat, kita siapkan method-nya. Ada 3 buah method yang akan dibuat dan kesemuanya adalah method ",(0,i.kt)("em",{parentName:"p"},"getter")," untuk masing-masing property struct (yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"x"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"y"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"z"),")."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"struct Point<T, U> {\n x: T,\n y: T,\n z: U\n}\n\nimpl<T, U> Point<T, U> {\n\n fn get_x(&self) -> &T {\n &self.x\n }\n\n fn get_y(&self) -> &T {\n &self.y\n }\n\n fn get_z(&self) -> &U {\n &self.z\n }\n}\n")),(0,i.kt)("p",null,"Bisa dilihat pada kode di atas, ada method ",(0,i.kt)("inlineCode",{parentName:"p"},"get_x")," untuk mengambil nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"x"),". Nilai baliknya bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," yang tipe tersebut juga dipakai sebagai tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"x"),"."),(0,i.kt)("p",null,"Kemudian coba gunakan struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Point")," untuk membuat satu atau dua variabel, lalu akses method-nya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let num_one: Point<i32, f64> = Point { x: 502, y: 120, z: 4.5 };\n println!("{} {} {}", num_one.get_x(), num_one.get_y(), num_one.get_z());\n // 502 120 4.5\n\n let num_two: Point<f64, i32> = Point { x: 1.2, y: 4.3, z: 534 };\n println!("{} {} {}", num_two.get_x(), num_two.get_y(), num_two.get_z());\n // 1.2 4.3 534\n}\n')),(0,i.kt)("p",null,"Hasilnya ketika di-run:"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Generics",src:n(5243).Z,width:"319",height:"110"})),(0,i.kt)("h2",{id:"a387-method-khusus-untuk-spesifik-tipe-parameter-generic-tertentu"},"A.38.7. Method khusus untuk spesifik tipe parameter generic tertentu"),(0,i.kt)("p",null,"Pada contoh di atas, struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Point<T, U>")," bisa digunakan dalam banyak kombinasi tipe data, misalnya: ",(0,i.kt)("inlineCode",{parentName:"p"},"Point<i32, f64>"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Point<i8, i32>"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Point<f32, u64>"),", dan lainya."),(0,i.kt)("p",null,"Di luar itu, bisa lho mendefinisikan method hanya untuk tipe parameter generic. Misalnya, method hanya bisa diakses ketika ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"i32")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"U")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"f64"),". Caranya kurang lebih seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"impl Point<i32, f64> {\n\n fn get_x(&self) -> &i32 {\n &self.x\n }\n\n fn get_y(&self) -> &i32 {\n &self.y\n }\n\n fn get_z(&self) -> &f64 {\n &self.z\n }\n}\n")),(0,i.kt)("p",null,"Block kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," tidak diterapkan dengan notasi penulisan ",(0,i.kt)("inlineCode",{parentName:"p"},"impl<T, U> Point<T, U>"),", melainkan ",(0,i.kt)("inlineCode",{parentName:"p"},"impl Point<i32, f64>"),". Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," diganti dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"i32")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"U")," diganti ",(0,i.kt)("inlineCode",{parentName:"p"},"f64"),". Dengan penulisan yang seperti ini, maka method dalam block kode hanya bisa diakses ketika data memiliki tipe data sesuai dengan yang dideklarasikan di block kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," (yang pada contoh di atas adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Point<i32, f64>"),")."),(0,i.kt)("p",null,"Bisa dilihat pada gambar berikut, sekarang statement pengaksesan method ",(0,i.kt)("inlineCode",{parentName:"p"},"num_two")," menjadi error, karena method-method tersebut hanya tersedia untuk tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Point<i32, f64>")," sedangkan ",(0,i.kt)("inlineCode",{parentName:"p"},"num_two")," bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Point<f64, i32>"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Generics",src:n(6714).Z,width:"851",height:"501"})),(0,i.kt)("p",null,"Jika ada keperluan untuk mendeklarasikan method lainnya khusus untuk tipe lainnya, cukup tulis lagi block ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," diikuti dengan tipe yang diinginkan. Misalnya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"impl Point<i32, f64> {\n // method untuk tipe data Point<i32, f64>\n}\n\nimpl Point<f32, u64> {\n // method untuk tipe data Point<f32, u64>\n}\n\nimpl Point<i8, i64> {\n // method untuk tipe data Point<i8, i64>\n}\n\n// ...\n")),(0,i.kt)("h2",{id:"a388-generics-enum"},"A.38.8. Generics enum"),(0,i.kt)("p",null,"Generic juga bisa diterapkan pada tipe enum. Caranya tulis saja deklarasi parameter generic setelah nama enum, lalu gunakan parameter generic-nya sesuai kebutuhan."),(0,i.kt)("p",null,"Contohnya pada kode berikut ini, enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Kendaraan")," memiliki parameter generic ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," yang tipe tersebut dipakai pada value enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Gledekan(T)"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'enum Kendaraan<T> {\n Skateboard,\n SepedaPancal,\n Gledekan(T),\n}\n\nlet kendaraan1 = Kendaraan::<&str>::Skateboard;\nlet kendaraan2 = Kendaraan::<&str>::SepedaPancal;\nlet kendaraan3 = Kendaraan::<&str>::Gledekan("Artco");\n')),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/generics"},"github.com/novalagung/dasarpemrogramanrust-example/../generics")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch10-01-syntax.html"},"https://doc.rust-lang.org/book/ch10-01-syntax.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/fmt/trait.Debug.html"},"https://doc.rust-lang.org/std/fmt/trait.Debug.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/ops/trait.Add.html"},"https://doc.rust-lang.org/std/ops/trait.Add.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html"},"https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html"))))}u.isMDXComponent=!0},7757:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw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U4qIZ4yboddFzCfFdioJezHqhVdAbNnsLUbiA5SCoA+luF2HmRU8mlBoOaG2r/mEhaN701vgE2BFaDA0l6Phhw+hyQoy5jqRdoga90PLpdYaKUuYIK0I3ZpOLzieUUQB54h0STC+0aHrpJJF/OUvf83gSUQteuFYh5ehxQh3plXIEQYseOUMQBHohCAK9EAR6IQgCvRAEgV4IgkAvBIFeCIJmRm/kSc+q0JFe40lP93Ck78n63KeiK1KHoJnTy3jSS/iovfNrerKe9H7wVNCM318YvTB1CJohvVlPepn4ZwWMBf5AmaA5r10vennqEDTbeW/P9Ko96dXw5uil0VukDkEroVdzrJXSk57OZwvmvYG7sX+tJHUIWhO9ea+7Dp70HR6hjt4ydQhaOr0aF98RPOnZkPZi69QhaEH0Rm9cSr3zGeuXeoujOulOtv5cdNheaNH0Mp709zxpeu98Pb36A+RYn/tcdNALrcH2QhAEeiEIAr0QBHohCAK9EASBXgiCQC8EgV4IgkAvBEGgF4JALwRBoBeCoCH1PxzpY8lPbg24AAAAAElFTkSuQmCC"},6714:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/generics-5-9f575c9b47e95f4301f0e9db22059d17.png"}}]); \ No newline at end of file diff --git a/assets/js/5925ce9f.e1fc4851.js b/assets/js/5925ce9f.e1fc4851.js new file mode 100644 index 00000000..dc1f93df --- /dev/null +++ b/assets/js/5925ce9f.e1fc4851.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[9831],{3905:(a,e,n)=>{n.d(e,{Zo:()=>m,kt:()=>g});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function d(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},r=Object.keys(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var p=t.createContext({}),s=function(a){var e=t.useContext(p),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},m=function(a){var e=s(a.components);return t.createElement(p.Provider,{value:e},a.children)},u={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},k=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,r=a.originalType,p=a.parentName,m=d(a,["components","mdxType","originalType","parentName"]),k=s(n),g=i,o=k["".concat(p,".").concat(g)]||k[g]||u[g]||r;return n?t.createElement(o,l(l({ref:e},m),{},{components:n})):t.createElement(o,l({ref:e},m))}));function g(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=n.length,l=new Array(r);l[0]=k;var d={};for(var p in e)hasOwnProperty.call(e,p)&&(d[p]=e[p]);d.originalType=a,d.mdxType="string"==typeof a?a:i,l[1]=d;for(var s=2;s<r;s++)l[s]=n[s];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}k.displayName="MDXCreateElement"},3121:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>r,metadata:()=>d,toc:()=>s});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:38,title:"A.38. Generics",sidebar_label:"A.38. Generics"},l=void 0,d={unversionedId:"basic/generics",id:"basic/generics",title:"A.38. Generics",description:"Chapter ini membahas tentang generics.",source:"@site/docs/basic/generics.md",sourceDirName:"basic",slug:"/basic/generics",permalink:"/basic/generics",draft:!1,tags:[],version:"current",sidebarPosition:38,frontMatter:{sidebar_position:38,title:"A.38. Generics",sidebar_label:"A.38. Generics"},sidebar:"tutorialSidebar",previous:{title:"A.37. Traits \u279c Advanced",permalink:"/basic/advanced-traits"},next:{title:"A.39. Tipe Data \u279c Option",permalink:"/basic/option-type"}},p={},s=[{value:"A.38.1. Generics basic",id:"a381-generics-basic",level:2},{value:"A.38.2. Mengasosiasikan traits ke parameter generic",id:"a382-mengasosiasikan-traits-ke-parameter-generic",level:2},{value:"\u25c9 Contoh ke-1",id:"-contoh-ke-1",level:3},{value:"\u25c9 Contoh ke-2",id:"-contoh-ke-2",level:3},{value:"\u25c9 Contoh ke-3",id:"-contoh-ke-3",level:3},{value:"A.38.3. Multi traits pada parameter generic",id:"a383-multi-traits-pada-parameter-generic",level:2},{value:"A.38.4. Keyword <code>where</code>",id:"a384-keyword-where",level:2},{value:"A.38.5. Generics struct",id:"a385-generics-struct",level:2},{value:"A.38.6. Generics method",id:"a386-generics-method",level:2},{value:"A.38.7. Method khusus untuk spesifik tipe parameter generic tertentu",id:"a387-method-khusus-untuk-spesifik-tipe-parameter-generic-tertentu",level:2},{value:"A.38.8. Generics enum",id:"a388-generics-enum",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:s};function u(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,t.Z)({},m,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Chapter ini membahas tentang generics."),(0,i.kt)("p",null,"Generics sendiri merupakan salah satu fitur yang ada pada beberapa bahasa pemrograman (termasuk Rust), yang digunakan untuk menambahkan fleksibilitas dalam pemanfaatan tipe data pada suatu block kode. Dengan adanya generics, kita bisa menentukan tipe data yang digunakan pada parameter maupun return value sbuah block fungsi, method dan lainnya."),(0,i.kt)("p",null,"Generics dinotasikan dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"<T>"),". Kita sempat sedikit memanfaatkan generic pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/vector"},"Vector")," di mana dalam pendefinisian tipe data harus dituliskan juga tipe data item (via generics parameter), contoh ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<i32>"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<&str>"),", dll. Kita juga sempat sedikit belajar tentang topik generic pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/traits"},"Traits"),"."),(0,i.kt)("h2",{id:"a381-generics-basic"},"A.38.1. Generics basic"),(0,i.kt)("p",null,"Mari mulai pembahasan dengan sebauh contoh definisi fungsi yang memiliki generics."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something<T>(arg1: i32, arg2: T) {\n // ...\n}\n")),(0,i.kt)("p",null,"Pada contoh di atas, fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"do_something")," didefinisikan dengan 2 buah parameter argument dan 1 buah parameter generics. Parameter argument pertama, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"arg1")," bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),", kemudian diikuti parameter ke-2 bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," adalah parameter generic fungsi."),(0,i.kt)("p",null,"Dalam pemanggilan fungsi tersebut, ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," generics dan tipe data argument ",(0,i.kt)("inlineCode",{parentName:"p"},"arg2")," harus sama. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn main() {\n do_something::<bool>(24, false);\n}\n")),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"do_something")," dipanggil dengan disisipi argument ",(0,i.kt)("inlineCode",{parentName:"p"},"24")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"false"),". Parameter ke-2 fungsi tersebut tipe data-nya jelas ",(0,i.kt)("inlineCode",{parentName:"p"},"bool")," karena pada argument-nya nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"false")," digunakan, oleh karena itu tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"bool")," disisipkan pada parameter generics saat pemanggilan fungsi; dengan notasi penulisan adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"::<tipe_data>"),", posisi penulisannya di antara nama fungsi dan tanda kurung pemanggilan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"("),"."),(0,i.kt)("p",null,"Apa yang terjadi jika nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," diisi dengan tipe data argument ",(0,i.kt)("inlineCode",{parentName:"p"},"arg2")," berbeda? program error."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Generics",src:n(7757).Z,width:"690",height:"169"})),(0,i.kt)("p",null,"Ok sampai sini semoga jelas."),(0,i.kt)("p",null,"Khusus untuk fungsi yang generic parameter-nya dipergunakan sebagai tipe data parameter, maka boleh untuk tidak ditentukan tipe data-nya saat pemanggilan fungsi. Contohnya bisa dilihat pada kode berikut, dua statements ini adalah ekuivalen."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"do_something::<bool>(24, false);\n// T adalah bool, karena ditulis secara eksplisit\n\ndo_something(24, false);\n// T adalah bool, karena diketahui dari tipe data argument.\n// nilai `false` pasti tipe data-nya bool\n")),(0,i.kt)("p",null,"Tipe data generic boleh tidak ditulis karena nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," bisa diketahui dari argument pemanggilan fungsi. Sedangkan jika nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," tidak digunakan sebagai tipe data parameter, maka wajib untuk di-isi nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," saat pemanggilan fungsi."),(0,i.kt)("p",null,"O iya, jumlah parameter generics tidak ada batasan. Bisa saja ada lebih dari satu parameter generic yang didefinisikan, contohnya bisa dilihat pada fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"do_something_v2")," ini yang memiliki 2 buah parameter generic, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"R")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"T"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something_v2<R, T>(arg1: R, arg2: T) {\n // ...\n}\n")),(0,i.kt)("p",null,"Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"R")," digunakan sebagai tipe parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"arg1")," dan tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," pada parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"arg2"),"."),(0,i.kt)("h2",{id:"a382-mengasosiasikan-traits-ke-parameter-generic"},"A.38.2. Mengasosiasikan traits ke parameter generic"),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"do_something")," yang telah dipraktikkan, susah untuk diisi dengan apapun. Memang parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"arg1")," tipe-nya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),", dan harusnya mudah untuk bermain-main dengan parameter tersebut. Yang agak repot adalah parameter ke-2, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"arg2")," yang bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"T"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something<T>(arg1: i32, arg2: T) {\n // ...\n}\n")),(0,i.kt)("p",null,"Parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"arg2")," hampir tidak bisa diapa-apakan."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Misal mau di-print, tidak bisa, karena tipe ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," tidak implement trait ",(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/fmt/trait.Debug.html"},(0,i.kt)("inlineCode",{parentName:"a"},"std::fmt::Debug")),"."),(0,i.kt)("li",{parentName:"ul"},"Misal diisi nilai numerik kemudian dijadikan operand operasi aritmatika, juga tidak bisa karena tipe ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," tidak implement trait ",(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/ops/trait.Add.html"},(0,i.kt)("inlineCode",{parentName:"a"},"std::ops::Add")),", dan trait operasi bilangan lainnya."),(0,i.kt)("li",{parentName:"ul"},"Misal diisi dengan nilai ",(0,i.kt)("inlineCode",{parentName:"li"},"bool"),", tidak bisa digunakan pada seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"li"},"if")," karena tipe ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," tidak implement trait ",(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html"},(0,i.kt)("inlineCode",{parentName:"a"},"std::cmp::PartialOrd")),", dan trait operasi logika lainnya.")),(0,i.kt)("p",null,"Repot kan? Tapi tenang, tidak usah khawatir, ada soluasi agar tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," bisa dimanfaatkan, yaitu dengan mengasosiasikan trait ke tipe data generic (sesuai kebutuhan)."),(0,i.kt)("h3",{id:"-contoh-ke-1"},"\u25c9 Contoh ke-1"),(0,i.kt)("p",null,"Contoh pengaplikasiannya bisa dilihat pada kode berikut. Ada sebuah fungsi bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"print_x_times")," yang tugasnya adalah menampilkan data ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," sejumlah ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," kali, yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," adalah parameter generics."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n print_x_times("Hello guys", 10);\n}\n\nfn print_x_times<T: std::fmt::Debug>(data: T, x: i32) {\n for _ in 0..x {\n println!("{:?}", data);\n }\n}\n')),(0,i.kt)("p",null,"Parameter generic ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," diasosiasikan dengan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug"),", dengan ini maka kita akan bisa print parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"data")," yang tipe data-nya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"T"),"."),(0,i.kt)("p",null,"Untuk mengetes hasilnya, jalankan program. Bisa dilihat text ",(0,i.kt)("inlineCode",{parentName:"p"},"Hello guys")," muncul 10x."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Generics",src:n(4541).Z,width:"315",height:"248"})),(0,i.kt)("p",null,"Cara untuk mengasosiasikan trait ke parameter generic adalah dengan menuliskannya dalam notasi berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn nama_fungsi<T: TraitYangInginDiasosiasikan>(arg1 ...) {\n // ...\n}\n")),(0,i.kt)("h3",{id:"-contoh-ke-2"},"\u25c9 Contoh ke-2"),(0,i.kt)("p",null,"Pada contoh ke-2 ini, dideklarasikan sebuah fungsi bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"find_largest_number")," yang tugasnya adalah mencari nilai maksimum dari sebuah tipe slice."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn find_largest_number<T: std::cmp::PartialOrd>(list: &[T]) -> &T {\n let mut largest = &list[0];\n\n for item in list {\n if item > largest {\n largest = item;\n }\n }\n\n largest\n}\n")),(0,i.kt)("p",null,"Seperti yang sudah dibahas pada bagian sebelumnya, bahwa tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," tidak akan bisa diapa-apakan kalau tidak diasosiasikan dengan trait. Maka pada contoh ini, tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," diasosiasikan dengan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::cmp::PartialOrd"),". Benefitnya, semua data dengan tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," bisa dipergunakan dalam operasi perbandingan."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Tanpa adanya trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::cmp::PartialOrd"),", maka statement ",(0,i.kt)("inlineCode",{parentName:"p"},"if item > largest { ... }")," menghasilkan error.")),(0,i.kt)("p",null,"Ok, sekarang panggil fungsi tersebut 2x, yang pertama diisi dengan data slice dari sebuah array, dan yang kedua data slice dari sebuah vector."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let data_arr = [0, 1, 2, 3];\n let largest_number1 = find_largest_number(&data_arr);\n println!("largest_number1: {:?}", largest_number1);\n \n let data_vec = vec![4, 5, 6, 7];\n let largest_number2 = find_largest_number(&data_vec);\n println!("largest_number2: {:?}", largest_number2);\n}\n')),(0,i.kt)("p",null,"Hasilnya sesuai harapan."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Generics",src:n(7811).Z,width:"461",height:"113"})),(0,i.kt)("h3",{id:"-contoh-ke-3"},"\u25c9 Contoh ke-3"),(0,i.kt)("p",null,"Trait yang bisa diasosiasikan dengan parameter generics adalah semua jenis traits (tanpa terkecuali), termasuk custom trait yang kita buat sendiri."),(0,i.kt)("p",null,"Contohnya bisa dilihat pada kode berikut. Ada custom trait bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"MyTrait")," dideklarasikan, kemudian diasosiasikan dengan parameter generic ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," milik fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"do_something_v3"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"trait MyTrait {\n // methods declaration\n}\n\nfn do_something_v3<T: MyTrait>(arg1: T) {\n // do something\n}\n")),(0,i.kt)("h2",{id:"a383-multi-traits-pada-parameter-generic"},"A.38.3. Multi traits pada parameter generic"),(0,i.kt)("p",null,"Bagaimana jika ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," perlu untuk diasosiasikan dengan banyak traits (lebih dari satu), apakah bisa? Bisa. Cara penulisannya kurang lebih seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'// fn nama_fungsi<T: Trait1 + Trait2 + ...>(arg1 ...)\n\nfn print_largest_number<T: std::cmp::PartialOrd + std::fmt::Debug>(list: &[T]) {\n let largest = find_largest_number::<T>(list);\n println!("largest number: {:?}", largest);\n}\n')),(0,i.kt)("p",null,"Fungsi di atas adalah fungsi baru, namanya ",(0,i.kt)("inlineCode",{parentName:"p"},"print_largest_number"),", tugasnya adalah mencari nilai maksimum kemudian menampilkannya."),(0,i.kt)("p",null,"Proses pencarian nilai maksimum dilakukan dengan memanfaatkan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"find_largest_number")," yang sebelumnya sudah dibuat. Fungsi tersebut memerlukan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::cmp::PartialOrd")," untuk diasosiasikan dengan tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"T"),"."),(0,i.kt)("p",null,"Setelah nilai maksimum diketemukan, nilainya di-print ke stdout menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),". Nilai maksimum ditampung pada variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"largest"),", tipe data-nya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"T"),". Agar bisa di-print maka perlu diasosiasikan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Debug"),"."),(0,i.kt)("p",null,"Bisa dilihat cara penulisan asosiasi multi trait ke parameter generic seperti apa. Cukup tulis saja dengan separator tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"+"),"."),(0,i.kt)("h2",{id:"a384-keyword-where"},"A.38.4. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"where")),(0,i.kt)("p",null,"Selain notasi penulisan yang sudah dipelajari di atas ada lagi alternatif lainnya, yaitu menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"where"),". Kurang lebih seperti berikut penerapannya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn print_largest_number<T: std::cmp::PartialOrd + std::fmt::Debug>(list: &[T]) {\n let largest = find_largest_number::<T>(list);\n println!("largest number: {:?}", largest);\n}\n\n// ... adalah ekuivalen dengan ...\n\nfn print_largest_number<T>(list: &[T]) \nwhere\n T: std::cmp::PartialOrd + std::fmt::Debug,\n{\n let largest = find_largest_number::<T>(list);\n println!("largest number: {:?}", largest);\n}\n')),(0,i.kt)("p",null,"Silakan gunakan sesuai preferensi dan kesepakatan tim. Kalau penulis lebih suka cara ke-2, karena terasa lebih rapi untuk penulisan fungsi yang ada banyak parameter generic beserta asosiasi traits-nya. Contohnya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something<T, U, V>(arg1: T, arg2: U, arg3: V) \nwhere\n T: some::traits:TraitA,\n U: some::traits:TraitB + some::traits:TraitC + some::traits:TraitD,\n V: some::traits:TraitA + some::traits:TraitD,\n{\n // do something\n}\n")),(0,i.kt)("h2",{id:"a385-generics-struct"},"A.38.5. Generics struct"),(0,i.kt)("p",null,"Selain diterapkan di fungsi, generics bisa juga diterapkan di struct. Cara penulisannya, tambahkan notasi parameter generic di antara nama struct dan block struct."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"struct Point<T, U> {\n x: T,\n y: T,\n z: U\n}\n\nfn main() {\n let num_one: Point<i32, f64> = Point { x: 502, y: 120, z: 4.5 };\n let num_two: Point<f64, i32> = Point { x: 1.2, y: 4.3, z: 534 };\n}\n")),(0,i.kt)("p",null,"Pada contoh di atas, struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Point")," memiliki 2 parameter generic. Kemudian struct tersebut digunakan untuk membuat dua variabel berbeda:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"num_one"),", bertipe ",(0,i.kt)("inlineCode",{parentName:"li"},"Point<i32, f64>"),". Tipe data property ",(0,i.kt)("inlineCode",{parentName:"li"},"x")," dan ",(0,i.kt)("inlineCode",{parentName:"li"},"y")," adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"i32")," sedangkan tipe data property ",(0,i.kt)("inlineCode",{parentName:"li"},"z")," adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"f64"),"."),(0,i.kt)("li",{parentName:"ul"},"Variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"num_two"),", bertipe ",(0,i.kt)("inlineCode",{parentName:"li"},"Point<f64, i32>"),". Tipe data property ",(0,i.kt)("inlineCode",{parentName:"li"},"x")," dan ",(0,i.kt)("inlineCode",{parentName:"li"},"y")," adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"f64")," sedangkan tipe data property ",(0,i.kt)("inlineCode",{parentName:"li"},"z")," adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"i32"),".")),(0,i.kt)("h2",{id:"a386-generics-method"},"A.38.6. Generics method"),(0,i.kt)("p",null,"Generic bisa diterapkan pada method. Notasi penulisannya kurang lebih sama seperti pada penulisan method, hanya saja pada syntax ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," perlu diikuti block parameter generics. Perbandingannya kurang lebih seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"// method biasa\nimpl Square {\n fn x(&self) -> &i32 {\n &self.x\n }\n}\n\n// method dengan generic\nimpl<T> Square<T> {\n fn x(&self) -> &T {\n &self.x\n }\n}\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Di syntax bagian ",(0,i.kt)("inlineCode",{parentName:"p"},"impl<T>")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Square<T>"),", penulisan parameter generics di keduanya harus sama persis. Misal pada struct ada 3 buah parameter generic ",(0,i.kt)("inlineCode",{parentName:"p"},"Square<T, U, V>")," maka pada syntax ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," juga harus sama, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"impl<T, U, V>"),"."),(0,i.kt)("p",{parentName:"blockquote"},"Jika tidak sama akan muncul error.")),(0,i.kt)("p",null,"Ok, sekarang mari kita praktikkan. Struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Point")," yang sudah dibuat, kita siapkan method-nya. Ada 3 buah method yang akan dibuat dan kesemuanya adalah method ",(0,i.kt)("em",{parentName:"p"},"getter")," untuk masing-masing property struct (yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"x"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"y"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"z"),")."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"struct Point<T, U> {\n x: T,\n y: T,\n z: U\n}\n\nimpl<T, U> Point<T, U> {\n\n fn get_x(&self) -> &T {\n &self.x\n }\n\n fn get_y(&self) -> &T {\n &self.y\n }\n\n fn get_z(&self) -> &U {\n &self.z\n }\n}\n")),(0,i.kt)("p",null,"Bisa dilihat pada kode di atas, ada method ",(0,i.kt)("inlineCode",{parentName:"p"},"get_x")," untuk mengambil nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"x"),". Nilai baliknya bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," yang tipe tersebut juga dipakai sebagai tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"x"),"."),(0,i.kt)("p",null,"Kemudian coba gunakan struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Point")," untuk membuat satu atau dua variabel, lalu akses method-nya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let num_one: Point<i32, f64> = Point { x: 502, y: 120, z: 4.5 };\n println!("{} {} {}", num_one.get_x(), num_one.get_y(), num_one.get_z());\n // 502 120 4.5\n\n let num_two: Point<f64, i32> = Point { x: 1.2, y: 4.3, z: 534 };\n println!("{} {} {}", num_two.get_x(), num_two.get_y(), num_two.get_z());\n // 1.2 4.3 534\n}\n')),(0,i.kt)("p",null,"Hasilnya ketika di-run:"),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Generics",src:n(5243).Z,width:"319",height:"110"})),(0,i.kt)("h2",{id:"a387-method-khusus-untuk-spesifik-tipe-parameter-generic-tertentu"},"A.38.7. Method khusus untuk spesifik tipe parameter generic tertentu"),(0,i.kt)("p",null,"Pada contoh di atas, struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Point<T, U>")," bisa digunakan dalam banyak kombinasi tipe data, misalnya: ",(0,i.kt)("inlineCode",{parentName:"p"},"Point<i32, f64>"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Point<i8, i32>"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Point<f32, u64>"),", dan lainya."),(0,i.kt)("p",null,"Di luar itu, bisa lho mendefinisikan method hanya untuk tipe parameter generic. Misalnya, method hanya bisa diakses ketika ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"i32")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"U")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"f64"),". Caranya kurang lebih seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"impl Point<i32, f64> {\n\n fn get_x(&self) -> &i32 {\n &self.x\n }\n\n fn get_y(&self) -> &i32 {\n &self.y\n }\n\n fn get_z(&self) -> &f64 {\n &self.z\n }\n}\n")),(0,i.kt)("p",null,"Block kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," tidak diterapkan dengan notasi penulisan ",(0,i.kt)("inlineCode",{parentName:"p"},"impl<T, U> Point<T, U>"),", melainkan ",(0,i.kt)("inlineCode",{parentName:"p"},"impl Point<i32, f64>"),". Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," diganti dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"i32")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"U")," diganti ",(0,i.kt)("inlineCode",{parentName:"p"},"f64"),". Dengan penulisan yang seperti ini, maka method dalam block kode hanya bisa diakses ketika data memiliki tipe data sesuai dengan yang dideklarasikan di block kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," (yang pada contoh di atas adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Point<i32, f64>"),")."),(0,i.kt)("p",null,"Bisa dilihat pada gambar berikut, sekarang statement pengaksesan method ",(0,i.kt)("inlineCode",{parentName:"p"},"num_two")," menjadi error, karena method-method tersebut hanya tersedia untuk tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Point<i32, f64>")," sedangkan ",(0,i.kt)("inlineCode",{parentName:"p"},"num_two")," bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Point<f64, i32>"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Generics",src:n(6714).Z,width:"851",height:"501"})),(0,i.kt)("p",null,"Jika ada keperluan untuk mendeklarasikan method lainnya khusus untuk tipe lainnya, cukup tulis lagi block ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," diikuti dengan tipe yang diinginkan. Misalnya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"impl Point<i32, f64> {\n // method untuk tipe data Point<i32, f64>\n}\n\nimpl Point<f32, u64> {\n // method untuk tipe data Point<f32, u64>\n}\n\nimpl Point<i8, i64> {\n // method untuk tipe data Point<i8, i64>\n}\n\n// ...\n")),(0,i.kt)("h2",{id:"a388-generics-enum"},"A.38.8. Generics enum"),(0,i.kt)("p",null,"Generic juga bisa diterapkan pada tipe enum. Caranya tulis saja deklarasi parameter generic setelah nama enum, lalu gunakan parameter generic-nya sesuai kebutuhan."),(0,i.kt)("p",null,"Contohnya pada kode berikut ini, enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Kendaraan")," memiliki parameter generic ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," yang tipe tersebut dipakai pada value enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Gledekan(T)"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'enum Kendaraan<T> {\n Skateboard,\n SepedaPancal,\n Gledekan(T),\n}\n\nlet kendaraan1 = Kendaraan::<&str>::Skateboard;\nlet kendaraan2 = Kendaraan::<&str>::SepedaPancal;\nlet kendaraan3 = Kendaraan::<&str>::Gledekan("Artco");\n')),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/generics"},"github.com/novalagung/dasarpemrogramanrust-example/../generics")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch10-01-syntax.html"},"https://doc.rust-lang.org/book/ch10-01-syntax.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/fmt/trait.Debug.html"},"https://doc.rust-lang.org/std/fmt/trait.Debug.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/ops/trait.Add.html"},"https://doc.rust-lang.org/std/ops/trait.Add.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html"},"https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html"))))}u.isMDXComponent=!0},7757:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAArIAAACpCAIAAABYlUmmAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItM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ohCAK9EAR6IQiaP733f//9R/T6HF2uL7HXZD2/HsL9+3vPpUSil930GJzeVpsjCFoivTELFXnHVl/91wQgAZtrKXJf/x4ocqH46FxCGXZfX1+z9ObuA0FLpfc+xC6ihUDHslvjLmBWR88nxD3XM+iFQK/U1ikeZvwboZqmN0tjHT2fEHc70AuBXmaWaNmxeBz/cLgU4qIZ4yboddFzCfFdioJezHqhVdAbNnsLUbiA5SCoA+luF2HmRU8mlBoOaG2r/mEhaN701vgE2BFaDA0l6Phhw+hyQoy5jqRdoga90PLpdYaKUuYIK0I3ZpOLzieUUQB54h0STC+0aHrpJJF/OUvf83gSUQteuFYh5ehxQh3plXIEQYseOUMQBHohCAK9EAR6IQgCvRAEgV4IgkAvBIFeCIJmRm/kSc+q0JFe40lP93Ck78n63KeiK1KHoJnTy3jSS/iovfNrerKe9H7wVNCM318YvTB1CJohvVlPepn4ZwWMBf5AmaA5r10vennqEDTbeW/P9Ko96dXw5uil0VukDkEroVdzrJXSk57OZwvmvYG7sX+tJHUIWhO9ea+7Dp70HR6hjt4ydQhaOr0aF98RPOnZkPZi69QhaEH0Rm9cSr3zGeuXeoujOulOtv5cdNheaNH0Mp709zxpeu98Pb36A+RYn/tcdNALrcH2QhAEeiEIAr0QBHohCAK9EASBXgiCQC8EgV4IgkAvBEGgF4JALwRBoBeCoCH1PxzpY8lPbg24AAAAAElFTkSuQmCC"},6714:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/generics-5-9f575c9b47e95f4301f0e9db22059d17.png"}}]); \ No newline at end of file diff --git a/assets/js/5f289fb7.118b786b.js b/assets/js/5f289fb7.118b786b.js new file mode 100644 index 00000000..467ef27a --- /dev/null +++ b/assets/js/5f289fb7.118b786b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[2870],{3905:(a,e,n)=>{n.d(e,{Zo:()=>m,kt:()=>s});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function u(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},r=Object.keys(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var p=t.createContext({}),d=function(a){var e=t.useContext(p),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},m=function(a){var e=d(a.components);return t.createElement(p.Provider,{value:e},a.children)},k={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},o=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,r=a.originalType,p=a.parentName,m=u(a,["components","mdxType","originalType","parentName"]),o=d(n),s=i,g=o["".concat(p,".").concat(s)]||o[s]||k[s]||r;return n?t.createElement(g,l(l({ref:e},m),{},{components:n})):t.createElement(g,l({ref:e},m))}));function s(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=n.length,l=new Array(r);l[0]=o;var u={};for(var p in e)hasOwnProperty.call(e,p)&&(u[p]=e[p]);u.originalType=a,u.mdxType="string"==typeof a?a:i,l[1]=u;for(var d=2;d<r;d++)l[d]=n[d];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}o.displayName="MDXCreateElement"},4950:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>p,contentTitle:()=>l,default:()=>k,frontMatter:()=>r,metadata:()=>u,toc:()=>d});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:51,title:"A.51. Attributes",sidebar_label:"A.51. Attributes"},l=void 0,u={unversionedId:"basic/attributes",id:"basic/attributes",title:"A.51. Attributes",description:"Kita telah beberapa kali menggunakan attributes pada chapter-chapter sebelumnya, contohnya seperti #[derive(Debug)]. Pada chapter ini kita akan bahas tentang apa sebenarnya attributes, macam-macam jenisnya, beserta kegunaannya.",source:"@site/docs/basic/attributes.md",sourceDirName:"basic",slug:"/basic/attributes",permalink:"/basic/attributes",draft:!1,tags:[],version:"current",sidebarPosition:51,frontMatter:{sidebar_position:51,title:"A.51. Attributes",sidebar_label:"A.51. Attributes"},sidebar:"tutorialSidebar",previous:{title:"A.50. Trait \u279c Iterator",permalink:"/basic/trait-iterator"},next:{title:"A.52. Date Time",permalink:"/basic/datetime"}},p={},d=[{value:"A.51.1. Konsep attributes",id:"a511-konsep-attributes",level:2},{value:"A.51.2. Attribute <code>derive</code>",id:"a512-attribute-derive",level:2},{value:"A.51.3. Attribute <code>cfg</code> / <em>configuration</em>",id:"a513-attribute-cfg--configuration",level:2},{value:"\u25c9 Configuration <code>target_os</code>",id:"-configuration-target_os",level:3},{value:"\u25c9 Configuration <code>target_arch</code>",id:"-configuration-target_arch",level:3},{value:"\u25c9 Macro <code>cfg!()</code> dan conditional compilation",id:"-macro-cfg-dan-conditional-compilation",level:3},{value:"\u25c9 Configuration <code>debug_assertions</code>",id:"-configuration-debug_assertions",level:3},{value:"\u25c9 Other configuration",id:"-other-configuration",level:3},{value:"A.51.4. Attribute <em>linting</em> & <em>diagnostic</em>",id:"a514-attribute-linting--diagnostic",level:2},{value:"A.51.5. Attribute <em>type system</em>",id:"a515-attribute-type-system",level:2},{value:"A.51.6. Attribute <em>modules</em>",id:"a516-attribute-modules",level:2},{value:"A.51.7. Attribute <em>testing</em>",id:"a517-attribute-testing",level:2},{value:"A.51.8. Attribute <em>macros</em>",id:"a518-attribute-macros",level:2},{value:"A.51.9 Attribute lainnya",id:"a519-attribute-lainnya",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:d};function k(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,t.Z)({},m,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Kita telah beberapa kali menggunakan attributes pada chapter-chapter sebelumnya, contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"#[derive(Debug)]"),". Pada chapter ini kita akan bahas tentang apa sebenarnya attributes, macam-macam jenisnya, beserta kegunaannya."),(0,i.kt)("h2",{id:"a511-konsep-attributes"},"A.51.1. Konsep attributes"),(0,i.kt)("p",null,"Attributes adalah metadata yang didefinisikan untuk suatu crate, module, atau module item. Kegunaan dari attributes berbeda satu sama lain, tergantung attribute apa yang dipakai (kita akan bahas satu per satu)."),(0,i.kt)("p",null,"Attribute dikategorikan menjadi 2:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Outer attributes"),(0,i.kt)("li",{parentName:"ul"},"Inner attributes")),(0,i.kt)("p",null,"Keduanya memiliki kegunaan yang sama, pembedanya adalah posisi di mana attribute harus dituliskan."),(0,i.kt)("p",null,"Outer attribute dituliskan tepat sebelum target (crate, module, module item, atau lainnya) dengan notasi penulisan seperti berikut:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},'#[attribute = "value"]')),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},'#[attribute(key = "value")]')),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[attribute(value)]")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},'#[attribute(not(key = "value"))]')," untuk operasi ",(0,i.kt)("strong",{parentName:"li"},"NOT")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[attribute(not(value))]")," untuk operasi ",(0,i.kt)("strong",{parentName:"li"},"NOT"))),(0,i.kt)("p",null,"Contoh penerapan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"#[derive(Debug)]\nstruct LegoSet {\n code: i32,\n name: String,\n category: String,\n age_minimum: i32,\n}\n")),(0,i.kt)("p",null,"Sedikit berbeda dengan inner attribute, penulisannya berada di dalam target (crate, module, module item, atau lainnya). Notasi penulisannya:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},'#![attribute = "value"]')),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},'#![attribute(key = "value")]')),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#![attribute(value)]")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},'#![attribute(not(key = "value"))]')," untuk operasi ",(0,i.kt)("strong",{parentName:"li"},"NOT")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#![attribute(not(value))]")," untuk operasi ",(0,i.kt)("strong",{parentName:"li"},"NOT"))),(0,i.kt)("p",null,"Rust mengenal beberapa jenis attributes, dan kita akan membahasnya satu per satu."),(0,i.kt)("h2",{id:"a512-attribute-derive"},"A.51.2. Attribute ",(0,i.kt)("inlineCode",{parentName:"h2"},"derive")),(0,i.kt)("p",null,"Attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"derive")," digunakan untuk mempermudah implementasi suatu trait ke tipe data."),(0,i.kt)("p",null,"Kita telah mempelajari cara implementasi trait pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/traits"},"Traits")," yaitu menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"for"),", kemudian diikuti dengan method serta implementasinya."),(0,i.kt)("p",null,"Dengan memanfaatkan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"derive")," kita tidak perlu menggunakan cara tersebut. Cukup tulis saja attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"derive")," beserta trait yang ingin diimplementasikan."),(0,i.kt)("p",null,"Agar lebih jelas, silakan pelajari contoh berikut terlebih dahulu:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'const SuperheroSuperman: &str = "superman";\nconst SuperheroOmniMan: &str = "omniman";\nconst SuperheroHyperion: &str = "hyperion";\n\nenum Superhero {\n Superman,\n OmniMan,\n Hyperion,\n}\n\nfn main() {\n let value: Superhero = Superhero::Superman;\n\n if value == Superhero::Superman {\n println!("hello superman!");\n }\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Attribute",src:n(253).Z,width:"958",height:"719"})),(0,i.kt)("p",null,"Kode di atas menghasilkan error karena enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Superhero")," tidak mengadopsi trait ",(0,i.kt)("inlineCode",{parentName:"p"},"PartialEq")," yang mana trait ini diperlukan dalam seleksi kondisi menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," dan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"=="),"."),(0,i.kt)("p",null,"Cara mengatasi error tersebut adalah dengan mengimplementasikan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"PartialEq")," secara eksplisit. Sekarang coba tambahkan kode berikut pada deklarasi enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Superhero"),", maka error akan hilang."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"enum Superhero {\n Superman,\n OmniMan,\n Hyperion,\n}\n\nimpl PartialEq for Superhero {\n\n fn eq(&self, other: &Self) -> bool {\n match (self, other) {\n (Superhero::Superman, Superhero::Superman) => true,\n (Superhero::OmniMan, Superhero::OmniMan) => true,\n (Superhero::Hyperion, Superhero::Hyperion) => true,\n _ => false,\n }\n }\n}\n")),(0,i.kt)("p",null,"Cara lain untuk mengatasi error di atas, selain menggunakan teknik implementasi trait secara eksplisit, adalah dengan menggunakan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"derive")," disertai trait ",(0,i.kt)("inlineCode",{parentName:"p"},"PartialEq"),". Kurang lebih penulisan cara ini bisa dilihat di bawah ini. Cukup hapus block kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," lalu tambahkan attribute pada deklarasi enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Superhero"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"#[derive(PartialEq)]\nenum Superhero {\n Superman,\n OmniMan,\n Hyperion,\n}\n")),(0,i.kt)("p",null,"Cukup mudah bukan?"),(0,i.kt)("p",null,"Contoh lainnya, misalnya variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"value")," ingin di-print seperti pada kode berikut ini, pasti hasilnya error."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let value: Superhero = Superhero::Superman;\n\n if value == Superhero::Superman {\n println!("hello superman!");\n }\n\n println!("{value} (via `Display` trait)");\n println!("{value:#?} (via `Debug` trait)");\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Attribute",src:n(7095).Z,width:"900",height:"461"})),(0,i.kt)("p",null,"Cara ",(0,i.kt)("em",{parentName:"p"},"resolve")," error di atas adalah dengan mengimplementasikan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Display")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," secara eksplisit. Atau, bisa juga menggunakan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"derive")," yang pastinya lebih praktis."),(0,i.kt)("p",null,"Kabar buruknya, hanya trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," yang menyediakan fitur implementasi trait menggunakan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"derive"),". Untuk trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Display")," kita perlu melakukan implementasi secara eksplisit."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Untuk tau mana trait yang bisa di-",(0,i.kt)("em",{parentName:"p"},"derive")," atau tidak, cukup lihat saja ",(0,i.kt)("em",{parentName:"p"},"highlight")," error yang muncul saat penulisan kode atau kompilasi.")),(0,i.kt)("p",null,"Ok, kita implementasikan saja keduanya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[derive(PartialEq, Debug)]\nenum Superhero {\n Superman,\n OmniMan,\n Hyperion,\n}\n\nimpl std::fmt::Display for Superhero {\n\n fn fmt(&self, f: &mut std::fmt::Formatter<\'_>) -> std::fmt::Result {\n write!(f, "{self:?}")\n }\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Attribute",src:n(635).Z,width:"537",height:"127"})),(0,i.kt)("p",null,"Bisa dilihat, hasilnya program tereksekusi tanpa error. Enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Superhero")," kini mengadopsi 3 trait:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Trait ",(0,i.kt)("inlineCode",{parentName:"li"},"PartialEq")," via attribute ",(0,i.kt)("inlineCode",{parentName:"li"},"derive")),(0,i.kt)("li",{parentName:"ul"},"Trait ",(0,i.kt)("inlineCode",{parentName:"li"},"Debug")," via attribute ",(0,i.kt)("inlineCode",{parentName:"li"},"derive")),(0,i.kt)("li",{parentName:"ul"},"Trait ",(0,i.kt)("inlineCode",{parentName:"li"},"Display")," via implementasi eksplisit")),(0,i.kt)("h2",{id:"a513-attribute-cfg--configuration"},"A.51.3. Attribute ",(0,i.kt)("inlineCode",{parentName:"h2"},"cfg")," / ",(0,i.kt)("em",{parentName:"h2"},"configuration")),(0,i.kt)("p",null,"Attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg")," digunakan untuk operasi-operasi yang berhubungan dengan target arsitekture hardware/prosesor, misalnya seperti conditional compilation ketika OS adalah linux, dan lainnya."),(0,i.kt)("p",null,"Salah satu contoh penerapannya bisa dilihat pada kode berikut. Ada 2 buah module yang namanya sama persis, perbedaannya adalah satu didefinisikan khusus untuk platform ",(0,i.kt)("inlineCode",{parentName:"p"},"linux"),", dan satunya lagi untuk platform ",(0,i.kt)("inlineCode",{parentName:"p"},"windows"),". Hal seperti ini bisa dilakukan menggunakan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg")," dengan key ",(0,i.kt)("inlineCode",{parentName:"p"},"target_os"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[cfg(target_os = "linux")]\nmod util {\n\n pub fn say_hello() {\n println!("hello (from linux)")\n }\n}\n\n#[cfg(target_os = "windows")]\nmod util {\n\n pub fn say_hello() {\n println!("hello (from windows)")\n }\n\n pub fn say_something() {\n println!("how are you")\n }\n}\n')),(0,i.kt)("p",null,"Bisa dilihat cara penulisannya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg()")," kemudian diisi key ",(0,i.kt)("inlineCode",{parentName:"p"},"target_os")," dengan value adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"windows")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"linux"),"."),(0,i.kt)("p",null,"Dengan kondisi kode seperti di atas, ketika berada di sistem operasi ",(0,i.kt)("inlineCode",{parentName:"p"},"linux"),", item ",(0,i.kt)("inlineCode",{parentName:"p"},"util::say_hello")," bisa diakses. Sedangkan pada sistem operasi ",(0,i.kt)("inlineCode",{parentName:"p"},"windows"),", item ",(0,i.kt)("inlineCode",{parentName:"p"},"util::say_hello")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"util::say_something")," bisa diakses."),(0,i.kt)("p",null,"Attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg(target_os)")," juga bisa diterapkan pada block kode. Contohnya seperti pada kode berikut. Item ",(0,i.kt)("inlineCode",{parentName:"p"},"util::say_hello")," dipanggil di fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),". Dan khusus untuk sistem operasi ",(0,i.kt)("inlineCode",{parentName:"p"},"windows"),", block kode berisi pemanggilan ",(0,i.kt)("inlineCode",{parentName:"p"},"util::say_something")," juga dipanggil."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n util::say_hello();\n\n #[cfg(target_os = "windows")]\n {\n util::say_something();\n }\n}\n')),(0,i.kt)("p",null,"Ada beberapa key yang tersedia pada attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg"),", di antaranya:"),(0,i.kt)("h3",{id:"-configuration-target_os"},"\u25c9 Configuration ",(0,i.kt)("inlineCode",{parentName:"h3"},"target_os")),(0,i.kt)("p",null,"Digunakan untuk menandai bahwa item atau statement di bawah definisi attribute ini dikhususkan untuk sistem operasi tertentu."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[cfg(target_os = "value")]\n')),(0,i.kt)("p",null,"Opsi value yang tersedia:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"windows")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"macos")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"ios")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"linux")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"android")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"freebsd")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"dragonfly")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"openbsd")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"netbsd"))),(0,i.kt)("h3",{id:"-configuration-target_arch"},"\u25c9 Configuration ",(0,i.kt)("inlineCode",{parentName:"h3"},"target_arch")),(0,i.kt)("p",null,"Digunakan untuk menandai bahwa item atau statement di bawah definisi attribute ini dikhususkan untuk arsitektur CPU tertentu."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[cfg(target_arch = "value")]\n')),(0,i.kt)("p",null,"Opsi value yang tersedia:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"x86")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"x86_64")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"mips")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"powerpc")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"powerpc64")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"arm")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"aarch64"))),(0,i.kt)("h3",{id:"-macro-cfg-dan-conditional-compilation"},"\u25c9 Macro ",(0,i.kt)("inlineCode",{parentName:"h3"},"cfg!()")," dan conditional compilation"),(0,i.kt)("p",null,"Attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg")," juga tersedia versi macro-nya, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg!()"),". Macro ini kegunaannya sama seperti attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg"),", perbedaannya macro ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg!()")," mengembalikan nilai boolean, yang darinya bisa dikombinasikan dengan seleksi kondisi untuk keperluan conditional compilation. Contoh penggunaan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg!()"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n #[cfg(target_os = "linux")]\n {\n println!("hello linux. from attribute cfg")\n }\n\n #[cfg(target_os = "windows")]\n {\n println!("hello windows. from attribute cfg")\n }\n\n if cfg!(target_os = "linux") {\n println!("hello linux. from macro cfg!()");\n } else if cfg!(target_os = "windows") {\n println!("hello windows. from macro cfg!()");\n }\n}\n')),(0,i.kt)("p",null,"Penjelasan:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Kode block ",(0,i.kt)("inlineCode",{parentName:"li"},'#[cfg(target_os = "linux")]')," hanya dieksekusi ketika program dijalankan di Linux."),(0,i.kt)("li",{parentName:"ul"},"Kode block ",(0,i.kt)("inlineCode",{parentName:"li"},'#[cfg(target_os = "windows")]')," hanya dieksekusi ketika program dijalankan di Windows."),(0,i.kt)("li",{parentName:"ul"},"Seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"li"},"cfg!(target_os = ...)")," merupakan alternatif penulisan 2 kode sebelumnya yang digabung menjadi 1 rantai seleksi kondisi.",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"Kondisi ",(0,i.kt)("inlineCode",{parentName:"li"},'cfg!(target_os = "linux")')," terpenuhi ketika program dijalankan di Linux"),(0,i.kt)("li",{parentName:"ul"},"Kondisi ",(0,i.kt)("inlineCode",{parentName:"li"},'cfg!(target_os = "windows")')," terpenuhi ketika program dijalankan di Windows")))),(0,i.kt)("p",null,"Output program ketika dijalankan di komputer penulis yang menggunakan Windows:"),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Attribute",src:n(2329).Z,width:"467",height:"108"})),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih detailnya mengenai macro akan dibahas di chapter terpisah.")),(0,i.kt)("h3",{id:"-configuration-debug_assertions"},"\u25c9 Configuration ",(0,i.kt)("inlineCode",{parentName:"h3"},"debug_assertions")),(0,i.kt)("p",null,"By default, Rust menggunakan profil kompilasi ",(0,i.kt)("strong",{parentName:"p"},"debug")," saat eksekusi command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run"),". Di kode program, penanda apakah profil kompilasi debug digunakan atau tidak bisa dilihat dari nilai konfigurasi ",(0,i.kt)("inlineCode",{parentName:"p"},"#[cfg(debug_assertions)]")," via attribute, dan ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg!(debug_assertions)")," via macro."),(0,i.kt)("p",null,"Nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg!(debug_assertions)")," selalu bernilai ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," kecuali command yang digunakan saat eksekusi program adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run --release"),". Flag ",(0,i.kt)("inlineCode",{parentName:"p"},"--release")," saat eksekusi program membuat nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"debug_assertions")," menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,i.kt)("p",null,"Contoh penerapan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n #[cfg(debug_assertions)]\n {\n println!("debug mode. from attribute cfg")\n }\n\n #[cfg(not(debug_assertions))]\n {\n println!("release mode. from attribute cfg")\n }\n\n if cfg!(debug_assertions) {\n println!("debug mode. from macro cfg!()");\n } else {\n println!("release mode. from macro cfg!()");\n }\n}\n')),(0,i.kt)("p",null,"Output eksekusi program menggunakan command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run")," vs ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run --release"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Attribute",src:n(7964).Z,width:"499",height:"200"})),(0,i.kt)("p",null,"Pada profil release, kode program dikompilasi sekaligus dioptimisasi. Penggunaan profil ini dianjurkan untuk distribusi production binary. "),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Di beberapa bahasa pemrograman lain deteksi profile dilakukan mengunakan kombinasi keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," dan nilai environment variable (",(0,i.kt)("inlineCode",{parentName:"p"},"ENV"),"). Dari situ bisa dilihat apakah environment yang digunakan adalah production, staging, atau local.")),(0,i.kt)("h3",{id:"-other-configuration"},"\u25c9 Other configuration"),(0,i.kt)("p",null,"Ada beberapa key konfigurasi lainnya yang tersedia. Lebih detailnya silakan lihat di ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/reference/conditional-compilation.html"},"https://doc.rust-lang.org/reference/conditional-compilation.html")),(0,i.kt)("h2",{id:"a514-attribute-linting--diagnostic"},"A.51.4. Attribute ",(0,i.kt)("em",{parentName:"h2"},"linting")," & ",(0,i.kt)("em",{parentName:"h2"},"diagnostic")),(0,i.kt)("p",null,"Ada beberapa attribute name yang bisa digunakan untuk meng-override ",(0,i.kt)("em",{parentName:"p"},"default linting")," milik Rust ataupun menandai indikator ",(0,i.kt)("em",{parentName:"p"},"diagnostic")," lainnya, seperti warning yang muncul karena ada kode yang tidak digunakan, dll; Warning sejenis ini bisa di-override menggunakan attribute."),(0,i.kt)("p",null,"Contoh kasus yang berhubungan dengan ",(0,i.kt)("em",{parentName:"p"},"linting")," bisa dilihat pada kode berikut."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Attribute",src:n(7812).Z,width:"351",height:"363"})),(0,i.kt)("p",null,"Kode di atas tidak menghasilkan error. Kode akan dieksekusi tanpa error. Namun ada 3 buah warning yang muncul karena beberapa baris kode tidak digunakan atau sia-sia."),(0,i.kt)("p",null,"Cara agar warning tidak muncul bisa dengan menggunakan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"#[allow(value)]"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[allow(unused_imports)]\nuse std::fmt::Display;\n\nfn say_hello() {\n println!("hello")\n}\n\n#[allow(dead_code)]\nfn say_something() {\n println!("how are you")\n}\n\npub mod m1 {\n #[allow(missing_docs)]\n pub fn undocumented_one() -> i32 { 1 }\n\n #[warn(missing_docs)]\n pub fn undocumented_too() -> i32 { 2 }\n\n // #[deny(missing_docs)]\n // pub fn undocumented_end() -> i32 { 3 }\n}\n\nfn main() {\n #[allow(unused_variables)]\n let name = "noval agung";\n\n say_hello();\n}\n')),(0,i.kt)("p",null,"Pada kode di atas, ada beberapa attribute yang digunakan:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[allow(unused_imports)]")," digunakan untuk antisipasi error yang muncul ketika module item di-import namun tidak digunakan."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[allow(dead_code)]")," digunakan untuk membolehkan kode yang tidak digunakan."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[allow(unused_variables)]")," digunakan untuk membolehkan variabel yang didefinisikan tapi tidak dimanfaatkan."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[allow(missing_docs)]")," membolehkan kode di bawahnya untuk tidak memiliki komentar/dokumentasi."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[warn(missing_docs)]")," memunculkan warning jika kode di bawahnya tidak memiliki komentar/dokumentasi."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[deny(missing_docs)]")," memunculkan error jika kode di bawahnya tidak memiliki komentar/dokumentasi. Kode ini sengaja di-remark agar eksekusi program tidak menghasilkan error.")),(0,i.kt)("p",null,"Dengan penambahan 3 attribute di atas program akan tereksekusi tanpa warning."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Attribute",src:n(2259).Z,width:"463",height:"107"})),(0,i.kt)("p",null,"Ada beberapa attribute ",(0,i.kt)("em",{parentName:"p"},"key")," yang bisa digunakan untuk override ",(0,i.kt)("em",{parentName:"p"},"lint")," warning:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"#[allow(lint_rule)]")," untuk membolehkan suatu ",(0,i.kt)("em",{parentName:"p"},"lint rule"),".",(0,i.kt)("br",null),"List ",(0,i.kt)("inlineCode",{parentName:"p"},"lint_rule")," bisa dilihat di ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html"},"https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html"),".")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"#[warn(lint_rule)]")," untuk memunculkan warning untuk suatu ",(0,i.kt)("em",{parentName:"p"},"lint rule")," yang ",(0,i.kt)("em",{parentName:"p"},"default"),"-nya tidak memunculkan warning.",(0,i.kt)("br",null),"List ",(0,i.kt)("inlineCode",{parentName:"p"},"lint_rule")," bisa dilihat di ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html"},"https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html"),".")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"#[deny(lint_rule)]")," untuk melarang suatu ",(0,i.kt)("em",{parentName:"p"},"lint rule")," yang ",(0,i.kt)("em",{parentName:"p"},"default"),"-nya adalah diperbolehkan.",(0,i.kt)("br",null),"List ",(0,i.kt)("inlineCode",{parentName:"p"},"lint_rule")," bisa dilihat di ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/rustc/lints/listing/deny-by-default.html"},"https://doc.rust-lang.org/rustc/lints/listing/deny-by-default.html"),".")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"#[forbid(lint_rule)]")," untuk melarang suatu ",(0,i.kt)("em",{parentName:"p"},"lint rule")," yang ",(0,i.kt)("em",{parentName:"p"},"default"),"-nya adalah diperbolehkan ",(0,i.kt)("strong",{parentName:"p"},"dengan catatan kode beserta isi yang dituju lint tersebut tidak bisa diubah menjadi ",(0,i.kt)("em",{parentName:"strong"},"lint rule"),"-nya menjadi ",(0,i.kt)("inlineCode",{parentName:"strong"},"allow")," lagi"),". Penjelasan detailnya ada di ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/reference/attributes/diagnostics.html"},"https://doc.rust-lang.org/reference/attributes/diagnostics.html")),(0,i.kt)("p",{parentName:"li"}," Contoh penerapan:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"#[forbid(missing_docs)]\npub mod m3 {\n #[allow(missing_docs)]\n pub fn undocumented_too() -> i32 { 2 }\n}\n")),(0,i.kt)("p",{parentName:"li"}," Attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"#[forbid(missing_docs)]")," pada module ",(0,i.kt)("inlineCode",{parentName:"p"},"m3")," menjadikan seluruh isi block module tersebut harus memiliki dokumentasi, mirip seperti penggunaan ",(0,i.kt)("inlineCode",{parentName:"p"},"#[deny(missing_docs)]"),"."),(0,i.kt)("p",{parentName:"li"}," Penggunaan ",(0,i.kt)("inlineCode",{parentName:"p"},"allow")," di dalam block tersebut membuat eksekusi program menghasilkan error, karena meskipun attribute tersebut ditujukan untuk fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"undocumented_too()")," pada parent block (yaitu module ",(0,i.kt)("inlineCode",{parentName:"p"},"m3"),") sudah ditentukan aturannya menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"forbid"),"."))),(0,i.kt)("p",null,"Selain 3 attribute di atas, ada juga beberapa attribute lainnya untuk keperluan ",(0,i.kt)("em",{parentName:"p"},"diagnostic"),", di antaranya:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[deprecated]")," digunakan untuk menandai bahwa kode di bawahnya adalah ",(0,i.kt)("em",{parentName:"li"},"deprecated"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[must_use]")," digunakan untuk mendandai bahwa kode di bawahnya harus digunakan, jika tidak maka akan muncul error.")),(0,i.kt)("h2",{id:"a515-attribute-type-system"},"A.51.5. Attribute ",(0,i.kt)("em",{parentName:"h2"},"type system")),(0,i.kt)("p",null,"Ada sebuah attribute bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"non_exhaustive")," gunanya untuk mem-",(0,i.kt)("em",{parentName:"p"},"bypass")," error yang muncul karena ada pattern matching yang tidak meng-cover semua kondisi, atau untuk mengantisipasi error yang muncul saat deklarasi variabel bertipe struct tapi value property-nya tidak diisi."),(0,i.kt)("p",null,"Salah satu contoh error yang dimaksud bisa dilihat pada kode berikut. Error ini muncul karena enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Superhero::Superhero")," tidak ter-cover dalam pattern matching."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Attribute",src:n(7483).Z,width:"671",height:"669"})),(0,i.kt)("p",null,"Solusi untuk mengatasi error di atas bisa dengan cukup menambahkan case kondisi yang belum ter-cover:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'match value {\n Superhero::Superman => println!("stronk"),\n Superhero::OmniMan => println!("stronk"),\n Superhero::Hyperion => println!("stronk"),\n}\n')),(0,i.kt)("p",null,"Atau dengan memanfaatkan kondisi ",(0,i.kt)("em",{parentName:"p"},"other")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"_"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'match value {\n Superhero::Superman => println!("stronk"),\n Superhero::OmniMan => println!("stronk"),\n _ => println!("stronk"),\n}\n')),(0,i.kt)("p",null,"Atau, bisa dengan menggunakan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"non_exhaustive"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[non_exhaustive]\npub enum Superhero {\n Superman,\n OmniMan,\n Hyperion,\n}\n\nfn main() {\n let value = Superhero::Superman;\n\n match value {\n Superhero::Superman => println!("stronk"),\n Superhero::OmniMan => println!("stronk"),\n }\n}\n')),(0,i.kt)("p",null,"Sayangnya dalam penggunaan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"non_exhaustive")," ini, efeknya ",(0,i.kt)("strong",{parentName:"p"},"hanya bisa dirasakan jika digunakan pada enum atau struct yang berbeda crate"),"."),(0,i.kt)("p",null,"Pada contoh di atas, tempat di mana enum dideklarasikan dan digunakan adalah masih dalam satu crate yang sama, jadi kode tetap menghasilkan error."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"non_exhaustive")," ini jika digunakan pada struct efeknya saat deklarasi variabel boleh tidak menuliskan value property.")),(0,i.kt)("h2",{id:"a516-attribute-modules"},"A.51.6. Attribute ",(0,i.kt)("em",{parentName:"h2"},"modules")),(0,i.kt)("p",null,"Aturan manajemen di Rust cukup ketat, dan sudah dibahas secara mendetal pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/module-basic"},"Module System \u279c Module"),", yang intinya adalah ada dua cara pembuatan module:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Cara ke-1: dengan mendefinisikan module pada file bernama ",(0,i.kt)("inlineCode",{parentName:"li"},"nama_module.rs")),(0,i.kt)("li",{parentName:"ul"},"Cara ke-2: dengan mendefinisikan module pada file bernama ",(0,i.kt)("inlineCode",{parentName:"li"},"nama_module/mod.rs"))),(0,i.kt)("p",null,"Rust memiliki sebuah attribute bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"path")," yang berguna untuk meng-override 2 aturan di atas secara paksa. Dengan memanfaatkan attribute ini kita bisa menulis module dengan nama sesuka hati."),(0,i.kt)("p",null,"Mari kita praktekan agar lebih jelas. Silakan buat package baru dengan struktur seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 main.rs\n \u2502\u2500\u2500\u2500 util1.rs\n \u2502\u2500\u2500\u2500 util2\n \u2502 \u2514\u2500\u2500\u2500 mod.rs\n \u2514\u2500\u2500\u2500 util3_mymodule.rs\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="util1.rs"',title:'"util1.rs"'},'pub fn say_hello() {\n println!("hello (from util1)")\n}\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="util2/mod.rs"',title:'"util2/mod.rs"'},'pub fn say_hello() {\n println!("hello (from util2)")\n}\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="util3_mymodule.rs"',title:'"util3_mymodule.rs"'},'pub fn say_hello() {\n println!("hello (from util3_mymodule)")\n}\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="main.rs"',title:'"main.rs"'},'mod util1;\nmod util2;\n\n#[path = "util3_mymodule.rs"]\nmod util3;\n\nfn main() {\n util1::say_hello();\n util2::say_hello();\n util3::say_hello();\n}\n')),(0,i.kt)("p",null,"Pada kode di atas bisa dilihat, module ",(0,i.kt)("inlineCode",{parentName:"p"},"util1")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"util2")," patuh mengikuti aturan deklarasi module system. Berbeda dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"util3")," yang sebenarnya dideklarasikan dengan nama ",(0,i.kt)("inlineCode",{parentName:"p"},"util3_mymodule")," (karena filename-nya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"util3_mymodule.rs"),"). Nama module satu ini diubah menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"util3")," lalu dengan memanfaatkan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"path")," kita arahkan isi module ",(0,i.kt)("inlineCode",{parentName:"p"},"util3")," adalah berada di ",(0,i.kt)("inlineCode",{parentName:"p"},"util3_mymodule.rs"),"."),(0,i.kt)("p",null,"Jialankan program, harusnya tidak ada error."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Attribute",src:n(6245).Z,width:"456",height:"147"})),(0,i.kt)("h2",{id:"a517-attribute-testing"},"A.51.7. Attribute ",(0,i.kt)("em",{parentName:"h2"},"testing")),(0,i.kt)("p",null,"Lebih detailnya mengenai attribute testing dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/testing"},"Testing"),"."),(0,i.kt)("h2",{id:"a518-attribute-macros"},"A.51.8. Attribute ",(0,i.kt)("em",{parentName:"h2"},"macros")),(0,i.kt)("p",null,"Lebih detailnya mengenai attribute macros dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/macro"},"Macro"),"."),(0,i.kt)("h2",{id:"a519-attribute-lainnya"},"A.51.9 Attribute lainnya"),(0,i.kt)("p",null,"Rust memiliki cukup banyak attribute yang list-nya bisa dilihat pada link ini ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/reference/attributes.html"},"https://doc.rust-lang.org/reference/attributes.html"),"."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/attributes"},"github.com/novalagung/dasarpemrogramanrust-example/../attributes")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/module-basic"},"Module System \u279c Module")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/enum"},"Enum")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/pattern-matching"},"Pattern Matching")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/attributes.html"},"https://doc.rust-lang.org/reference/attributes.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/items/implementations.html"},"https://doc.rust-lang.org/reference/items/implementations.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rustc/lints/index.html"},"https://doc.rust-lang.org/rustc/lints/index.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/attributes/diagnostics.html"},"https://doc.rust-lang.org/reference/attributes/diagnostics.html"))))}k.isMDXComponent=!0},253:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/attribute-1-c3fd3abaf784b196c8b4da4512bb8abd.png"},7095:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/attribute-2-935bd54d9113cbcfb6a5c07a7ebd9f68.png"},635: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uPsLlHrwUkq5pw+/TsRHFWil4RpVEBHJgGojO7ZyuhUxHLpFhTHJ+ySk1TMSbZ9Er+29gwsDVcCnLbuH4K4MaiM7sHK6FR2HH9u13GhXDq74ji7S45SMX/7lVz2bGNnBgzcbWCyiiBuDCqjWzHk/sroVARy6eyK4+xt5BAVc7I723zHt4UlBQsLEQjiWaAyugcro1P5cdb7VLl0RsVxqktStpykYn6s9vpT6yh7GMLSn4pV3Pjkodyoh0wyUKsMcTq2qpiTO19EszA6C/YaIojn4nlvUiAeh60q5mRPxfTUH5q/drxmW1lGVE2JaJMvgngiOOZF5GACKubKjTvfzOoj73F4j27adTzldAFqnyOTBIy8CIIgcoOrDQiCIHKDkRdBEERuMPIiCILIDUZeBEEQucHIiyAIIjcYeREEQeQGIy+CIIjc/DecT72QQDsWUAAAAABJRU5ErkJggg=="},7964:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/attribute-5-b485867d9d43b989698d4f1a231cfb4b.png"},7812:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/attribute-6-0ae9faf44e5f0113b2599d985a7f331d.png"},2259:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc8AAABrCAIAAACe4J4wAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAE72lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4wLWMwMDAgMTM3LmRhNGE3ZTUsIDIwMjIvMTEvMjctMDk6MzU6MDMgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZ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A3714Kh2/qlar1eoLZenxD8+2gtS79eyHx0vKC/3jID198V3wxhMEQVwZeHvb9itt8Ln7U6s/lysCfHdXbL/Sx7O7z39qzxW/DtDdfleV5to/6cPZ3ef/pvTFu9TdEgRxjZnUJr51awnEx/X64/GWfkAnZr/XmrBugiCIq8c0726Ybj3XXK4IoM/VFnNzU7SDIAgi+Uy6JmH3p1ZffDzxZOv3/9EGff4XYOvZ12JfqdNCXIIgrjETj213n38Lz354Op5L6Csvvn0O5ioFeFyvP4b2q+rTFrbx+6dVeFF/Wq8/BQBov6rSkgSCIK419KYcgiCIOKCnGwiCIOKAeluCIIg4oN6WIAgiDqi3JQiCiAPqbQmCIOKAeluCIIg4oN6WIAgiDqi3JQiCiAPqbQmCIOKAeluCIIg4oN6WIAgiDv4f9cqCOM6DZ8gAAAAASUVORK5CYII="},7483:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/attribute-8-edad9c816a2c847561bcc988d0905b16.png"},6245:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcgAAACTCAIAAACF/R49AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFf2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4wLWMwMDAgMTM3LmRhNGE3ZTUsIDIwMjIvMTEvMjctMDk6MzU6MDMgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvM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LUsRIEQYQMdawEQRAhQx0rQRBEyFDHShAEETL/D9VV2vf3UVXEAAAAAElFTkSuQmCC"}}]); \ No newline at end of file diff --git a/assets/js/5f289fb7.1391b360.js b/assets/js/5f289fb7.1391b360.js deleted file mode 100644 index d3a542b2..00000000 --- a/assets/js/5f289fb7.1391b360.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[2870],{3905:(a,e,n)=>{n.d(e,{Zo:()=>m,kt:()=>s});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function u(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},r=Object.keys(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var p=t.createContext({}),d=function(a){var e=t.useContext(p),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},m=function(a){var e=d(a.components);return t.createElement(p.Provider,{value:e},a.children)},k={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},o=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,r=a.originalType,p=a.parentName,m=u(a,["components","mdxType","originalType","parentName"]),o=d(n),s=i,g=o["".concat(p,".").concat(s)]||o[s]||k[s]||r;return n?t.createElement(g,l(l({ref:e},m),{},{components:n})):t.createElement(g,l({ref:e},m))}));function s(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=n.length,l=new Array(r);l[0]=o;var u={};for(var p in e)hasOwnProperty.call(e,p)&&(u[p]=e[p]);u.originalType=a,u.mdxType="string"==typeof a?a:i,l[1]=u;for(var d=2;d<r;d++)l[d]=n[d];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}o.displayName="MDXCreateElement"},4950:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>p,contentTitle:()=>l,default:()=>k,frontMatter:()=>r,metadata:()=>u,toc:()=>d});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:51,title:"A.51. Attributes",sidebar_label:"A.51. Attributes"},l=void 0,u={unversionedId:"basic/attributes",id:"basic/attributes",title:"A.51. Attributes",description:"Kita telah beberapa kali menggunakan attributes pada chapter-chapter sebelumnya, contohnya seperti #[derive(Debug)]. Pada chapter ini kita akan bahas tentang apa sebenarnya attributes, macam-macam jenisnya, beserta kegunaannya.",source:"@site/docs/basic/attributes.md",sourceDirName:"basic",slug:"/basic/attributes",permalink:"/basic/attributes",draft:!1,tags:[],version:"current",sidebarPosition:51,frontMatter:{sidebar_position:51,title:"A.51. Attributes",sidebar_label:"A.51. Attributes"},sidebar:"tutorialSidebar",previous:{title:"A.50. Trait \u279c Iterator",permalink:"/basic/trait-iterator"},next:{title:"A.52. Date Time",permalink:"/basic/datetime"}},p={},d=[{value:"A.51.1. Konsep attributes",id:"a511-konsep-attributes",level:2},{value:"A.51.2. Attribute <code>derive</code>",id:"a512-attribute-derive",level:2},{value:"A.51.3. Attribute <code>cfg</code> / <em>configuration</em>",id:"a513-attribute-cfg--configuration",level:2},{value:"\u25c9 Configuration <code>target_os</code>",id:"-configuration-target_os",level:3},{value:"\u25c9 Configuration <code>target_arch</code>",id:"-configuration-target_arch",level:3},{value:"\u25c9 Macro <code>cfg!()</code> dan conditional compilation",id:"-macro-cfg-dan-conditional-compilation",level:3},{value:"\u25c9 Configuration <code>debug_assertions</code>",id:"-configuration-debug_assertions",level:3},{value:"\u25c9 Other configuration",id:"-other-configuration",level:3},{value:"A.51.4. Attribute <em>linting</em> & <em>diagnostic</em>",id:"a514-attribute-linting--diagnostic",level:2},{value:"A.51.5. Attribute <em>type system</em>",id:"a515-attribute-type-system",level:2},{value:"A.51.6. Attribute <em>modules</em>",id:"a516-attribute-modules",level:2},{value:"A.51.7. Attribute <em>testing</em>",id:"a517-attribute-testing",level:2},{value:"A.51.8. Attribute <em>macros</em>",id:"a518-attribute-macros",level:2},{value:"A.51.9 Attribute lainnya",id:"a519-attribute-lainnya",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:d};function k(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,t.Z)({},m,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Kita telah beberapa kali menggunakan attributes pada chapter-chapter sebelumnya, contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"#[derive(Debug)]"),". Pada chapter ini kita akan bahas tentang apa sebenarnya attributes, macam-macam jenisnya, beserta kegunaannya."),(0,i.kt)("h2",{id:"a511-konsep-attributes"},"A.51.1. Konsep attributes"),(0,i.kt)("p",null,"Attributes adalah metadata yang didefinisikan untuk suatu crate, module, atau module item. Kegunaan dari attributes berbeda satu sama lain, tergantung attribute apa yang dipakai (kita akan bahas satu per satu)."),(0,i.kt)("p",null,"Attribute dikategorikan menjadi 2:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Outer attributes"),(0,i.kt)("li",{parentName:"ul"},"Inner attributes")),(0,i.kt)("p",null,"Keduanya memiliki kegunaan yang sama, pembedanya adalah posisi di mana attribute harus dituliskan."),(0,i.kt)("p",null,"Outer attribute dituliskan tepat sebelum target (crate, module, module item, atau lainnya) dengan notasi penulisan seperti berikut:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},'#[attribute = "value"]')),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},'#[attribute(key = "value")]')),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[attribute(value)]")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},'#[attribute(not(key = "value"))]')," untuk operasi ",(0,i.kt)("strong",{parentName:"li"},"NOT")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[attribute(not(value))]")," untuk operasi ",(0,i.kt)("strong",{parentName:"li"},"NOT"))),(0,i.kt)("p",null,"Contoh penerapan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"#[derive(Debug)]\nstruct LegoSet {\n code: i32,\n name: String,\n category: String,\n age_minimum: i32,\n}\n")),(0,i.kt)("p",null,"Sedikit berbeda dengan inner attribute, penulisannya berada di dalam target (crate, module, module item, atau lainnya). Notasi penulisannya:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},'#![attribute = "value"]')),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},'#![attribute(key = "value")]')),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#![attribute(value)]")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},'#![attribute(not(key = "value"))]')," untuk operasi ",(0,i.kt)("strong",{parentName:"li"},"NOT")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#![attribute(not(value))]")," untuk operasi ",(0,i.kt)("strong",{parentName:"li"},"NOT"))),(0,i.kt)("p",null,"Rust mengenal beberapa jenis attributes, dan kita akan membahasnya satu per satu."),(0,i.kt)("h2",{id:"a512-attribute-derive"},"A.51.2. Attribute ",(0,i.kt)("inlineCode",{parentName:"h2"},"derive")),(0,i.kt)("p",null,"Attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"derive")," digunakan untuk mempermudah implementasi suatu trait ke tipe data."),(0,i.kt)("p",null,"Kita telah mempelajari cara implementasi trait pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/traits"},"Traits")," yaitu menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"for"),", kemudian diikuti dengan method serta implementasinya."),(0,i.kt)("p",null,"Dengan memanfaatkan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"derive")," kita tidak perlu menggunakan cara tersebut. Cukup tulis saja attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"derive")," beserta trait yang ingin diimplementasikan."),(0,i.kt)("p",null,"Agar lebih jelas, silakan pelajari contoh berikut terlebih dahulu:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'const SuperheroSuperman: &str = "superman";\nconst SuperheroOmniMan: &str = "omniman";\nconst SuperheroHyperion: &str = "hyperion";\n\nenum Superhero {\n Superman,\n OmniMan,\n Hyperion,\n}\n\nfn main() {\n let value: Superhero = Superhero::Superman;\n\n if value == Superhero::Superman {\n println!("hello superman!");\n }\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Attribute",src:n(253).Z,width:"958",height:"719"})),(0,i.kt)("p",null,"Kode di atas menghasilkan error karena enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Superhero")," tidak mengadopsi trait ",(0,i.kt)("inlineCode",{parentName:"p"},"PartialEq")," yang mana trait ini diperlukan dalam seleksi kondisi menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," dan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"=="),"."),(0,i.kt)("p",null,"Cara mengatasi error tersebut adalah dengan mengimplementasikan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"PartialEq")," secara eksplisit. Sekarang coba tambahkan kode berikut pada deklarasi enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Superhero"),", maka error akan hilang."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"enum Superhero {\n Superman,\n OmniMan,\n Hyperion,\n}\n\nimpl PartialEq for Superhero {\n\n fn eq(&self, other: &Self) -> bool {\n match (self, other) {\n (Superhero::Superman, Superhero::Superman) => true,\n (Superhero::OmniMan, Superhero::OmniMan) => true,\n (Superhero::Hyperion, Superhero::Hyperion) => true,\n _ => false,\n }\n }\n}\n")),(0,i.kt)("p",null,"Cara lain untuk mengatasi error di atas, selain menggunakan teknik implementasi trait secara eksplisit, adalah dengan menggunakan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"derive")," disertai trait ",(0,i.kt)("inlineCode",{parentName:"p"},"PartialEq"),". Kurang lebih penulisan cara ini bisa dilihat di bawah ini. Cukup hapus block kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," lalu tambahkan attribute pada deklarasi enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Superhero"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"#[derive(PartialEq)]\nenum Superhero {\n Superman,\n OmniMan,\n Hyperion,\n}\n")),(0,i.kt)("p",null,"Cukup mudah bukan?"),(0,i.kt)("p",null,"Contoh lainnya, misalnya variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"value")," ingin di-print seperti pada kode berikut ini, pasti hasilnya error."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let value: Superhero = Superhero::Superman;\n\n if value == Superhero::Superman {\n println!("hello superman!");\n }\n\n println!("{value} (via `Display` trait)");\n println!("{value:#?} (via `Debug` trait)");\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Attribute",src:n(7095).Z,width:"900",height:"461"})),(0,i.kt)("p",null,"Cara ",(0,i.kt)("em",{parentName:"p"},"resolve")," error di atas adalah dengan mengimplementasikan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Display")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," secara eksplisit. Atau, bisa juga menggunakan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"derive")," yang pastinya lebih praktis."),(0,i.kt)("p",null,"Kabar buruknya, hanya trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," yang menyediakan fitur implementasi trait menggunakan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"derive"),". Untuk trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Display")," kita perlu melakukan implementasi secara eksplisit."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Untuk tau mana trait yang bisa di-",(0,i.kt)("em",{parentName:"p"},"derive")," atau tidak, cukup lihat saja ",(0,i.kt)("em",{parentName:"p"},"highlight")," error yang muncul saat penulisan kode atau kompilasi.")),(0,i.kt)("p",null,"Ok, kita implementasikan saja keduanya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[derive(PartialEq, Debug)]\nenum Superhero {\n Superman,\n OmniMan,\n Hyperion,\n}\n\nimpl std::fmt::Display for Superhero {\n\n fn fmt(&self, f: &mut std::fmt::Formatter<\'_>) -> std::fmt::Result {\n write!(f, "{self:?}")\n }\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Attribute",src:n(635).Z,width:"537",height:"127"})),(0,i.kt)("p",null,"Bisa dilihat, hasilnya program tereksekusi tanpa error. Enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Superhero")," kini mengadopsi 3 trait:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Trait ",(0,i.kt)("inlineCode",{parentName:"li"},"PartialEq")," via attribute ",(0,i.kt)("inlineCode",{parentName:"li"},"derive")),(0,i.kt)("li",{parentName:"ul"},"Trait ",(0,i.kt)("inlineCode",{parentName:"li"},"Debug")," via attribute ",(0,i.kt)("inlineCode",{parentName:"li"},"derive")),(0,i.kt)("li",{parentName:"ul"},"Trait ",(0,i.kt)("inlineCode",{parentName:"li"},"Display")," via implementasi eksplisit")),(0,i.kt)("h2",{id:"a513-attribute-cfg--configuration"},"A.51.3. Attribute ",(0,i.kt)("inlineCode",{parentName:"h2"},"cfg")," / ",(0,i.kt)("em",{parentName:"h2"},"configuration")),(0,i.kt)("p",null,"Attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg")," digunakan untuk operasi-operasi yang berhubungan dengan target arsitekture hardware/prosesor, misalnya seperti conditional compilation ketika OS adalah linux, dan lainnya."),(0,i.kt)("p",null,"Salah satu contoh penerapannya bisa dilihat pada kode berikut. Ada 2 buah module yang namanya sama persis, perbedaannya adalah satu didefinisikan khusus untuk platform ",(0,i.kt)("inlineCode",{parentName:"p"},"linux"),", dan satunya lagi untuk platform ",(0,i.kt)("inlineCode",{parentName:"p"},"windows"),". Hal seperti ini bisa dilakukan menggunakan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg")," dengan key ",(0,i.kt)("inlineCode",{parentName:"p"},"target_os"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[cfg(target_os = "linux")]\nmod util {\n\n pub fn say_hello() {\n println!("hello (from linux)")\n }\n}\n\n#[cfg(target_os = "windows")]\nmod util {\n\n pub fn say_hello() {\n println!("hello (from windows)")\n }\n\n pub fn say_something() {\n println!("how are you")\n }\n}\n')),(0,i.kt)("p",null,"Bisa dilihat cara penulisannya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg()")," kemudian diisi key ",(0,i.kt)("inlineCode",{parentName:"p"},"target_os")," dengan value adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"windows")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"linux"),"."),(0,i.kt)("p",null,"Dengan kondisi kode seperti di atas, ketika berada di sistem operasi ",(0,i.kt)("inlineCode",{parentName:"p"},"linux"),", item ",(0,i.kt)("inlineCode",{parentName:"p"},"util::say_hello")," bisa diakses. Sedangkan pada sistem operasi ",(0,i.kt)("inlineCode",{parentName:"p"},"windows"),", item ",(0,i.kt)("inlineCode",{parentName:"p"},"util::say_hello")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"util::say_something")," bisa diakses."),(0,i.kt)("p",null,"Attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg(target_os)")," juga bisa diterapkan pada block kode. Contohnya seperti pada kode berikut. Item ",(0,i.kt)("inlineCode",{parentName:"p"},"util::say_hello")," dipanggil di fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),". Dan khusus untuk sistem operasi ",(0,i.kt)("inlineCode",{parentName:"p"},"windows"),", block kode berisi pemanggilan ",(0,i.kt)("inlineCode",{parentName:"p"},"util::say_something")," juga dipanggil."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n util::say_hello();\n\n #[cfg(target_os = "windows")]\n {\n util::say_something();\n }\n}\n')),(0,i.kt)("p",null,"Ada beberapa key yang tersedia pada attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg"),", di antaranya:"),(0,i.kt)("h3",{id:"-configuration-target_os"},"\u25c9 Configuration ",(0,i.kt)("inlineCode",{parentName:"h3"},"target_os")),(0,i.kt)("p",null,"Digunakan untuk menandai bahwa item atau statement di bawah definisi attribute ini dikhususkan untuk sistem operasi tertentu."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[cfg(target_os = "value")]\n')),(0,i.kt)("p",null,"Opsi value yang tersedia:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"windows")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"macos")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"ios")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"linux")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"android")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"freebsd")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"dragonfly")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"openbsd")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"netbsd"))),(0,i.kt)("h3",{id:"-configuration-target_arch"},"\u25c9 Configuration ",(0,i.kt)("inlineCode",{parentName:"h3"},"target_arch")),(0,i.kt)("p",null,"Digunakan untuk menandai bahwa item atau statement di bawah definisi attribute ini dikhususkan untuk arsitektur CPU tertentu."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[cfg(target_arch = "value")]\n')),(0,i.kt)("p",null,"Opsi value yang tersedia:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"x86")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"x86_64")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"mips")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"powerpc")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"powerpc64")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"arm")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"aarch64"))),(0,i.kt)("h3",{id:"-macro-cfg-dan-conditional-compilation"},"\u25c9 Macro ",(0,i.kt)("inlineCode",{parentName:"h3"},"cfg!()")," dan conditional compilation"),(0,i.kt)("p",null,"Attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg")," juga tersedia versi macro-nya, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg!()"),". Macro ini kegunaannya sama seperti attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg"),", perbedaannya macro ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg!()")," mengembalikan nilai boolean, yang darinya bisa dikombinasikan dengan seleksi kondisi untuk keperluan conditional compilation. Contoh penggunaan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg!()"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n #[cfg(target_os = "linux")]\n {\n println!("hello linux. from attribute cfg")\n }\n\n #[cfg(target_os = "windows")]\n {\n println!("hello windows. from attribute cfg")\n }\n\n if cfg!(target_os = "linux") {\n println!("hello linux. from macro cfg!()");\n } else if cfg!(target_os = "windows") {\n println!("hello windows. from macro cfg!()");\n }\n}\n')),(0,i.kt)("p",null,"Penjelasan:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Kode block ",(0,i.kt)("inlineCode",{parentName:"li"},'#[cfg(target_os = "linux")]')," hanya dieksekusi ketika program dijalankan di Linux."),(0,i.kt)("li",{parentName:"ul"},"Kode block ",(0,i.kt)("inlineCode",{parentName:"li"},'#[cfg(target_os = "windows")]')," hanya dieksekusi ketika program dijalankan di Windows."),(0,i.kt)("li",{parentName:"ul"},"Seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"li"},"cfg!(target_os = ...)")," merupakan alternatif penulisan 2 kode sebelumnya yang digabung menjadi 1 rantai seleksi kondisi.",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"Kondisi ",(0,i.kt)("inlineCode",{parentName:"li"},'cfg!(target_os = "linux")')," terpenuhi ketika program dijalankan di Linux"),(0,i.kt)("li",{parentName:"ul"},"Kondisi ",(0,i.kt)("inlineCode",{parentName:"li"},'cfg!(target_os = "windows")')," terpenuhi ketika program dijalankan di Windows")))),(0,i.kt)("p",null,"Output program ketika dijalankan di komputer penulis yang menggunakan Windows:"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Attribute",src:n(2329).Z,width:"467",height:"108"})),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih detailnya mengenai macro akan dibahas di chapter terpisah.")),(0,i.kt)("h3",{id:"-configuration-debug_assertions"},"\u25c9 Configuration ",(0,i.kt)("inlineCode",{parentName:"h3"},"debug_assertions")),(0,i.kt)("p",null,"By default, Rust menggunakan profil kompilasi ",(0,i.kt)("strong",{parentName:"p"},"debug")," saat eksekusi command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run"),". Di kode program, penanda apakah profil kompilasi debug digunakan atau tidak bisa dilihat dari nilai konfigurasi ",(0,i.kt)("inlineCode",{parentName:"p"},"#[cfg(debug_assertions)]")," via attribute, dan ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg!(debug_assertions)")," via macro."),(0,i.kt)("p",null,"Nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"cfg!(debug_assertions)")," selalu bernilai ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," kecuali command yang digunakan saat eksekusi program adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run --release"),". Flag ",(0,i.kt)("inlineCode",{parentName:"p"},"--release")," saat eksekusi program membuat nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"debug_assertions")," menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,i.kt)("p",null,"Contoh penerapan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n #[cfg(debug_assertions)]\n {\n println!("debug mode. from attribute cfg")\n }\n\n #[cfg(not(debug_assertions))]\n {\n println!("release mode. from attribute cfg")\n }\n\n if cfg!(debug_assertions) {\n println!("debug mode. from macro cfg!()");\n } else {\n println!("release mode. from macro cfg!()");\n }\n}\n')),(0,i.kt)("p",null,"Output eksekusi program menggunakan command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run")," vs ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run --release"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Attribute",src:n(7964).Z,width:"499",height:"200"})),(0,i.kt)("p",null,"Pada profil release, kode program dikompilasi sekaligus dioptimisasi. Penggunaan profil ini dianjurkan untuk distribusi production binary. "),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Di beberapa bahasa pemrograman lain deteksi profile dilakukan mengunakan kombinasi keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," dan nilai environment variable (",(0,i.kt)("inlineCode",{parentName:"p"},"ENV"),"). Dari situ bisa dilihat apakah environment yang digunakan adalah production, staging, atau local.")),(0,i.kt)("h3",{id:"-other-configuration"},"\u25c9 Other configuration"),(0,i.kt)("p",null,"Ada beberapa key konfigurasi lainnya yang tersedia. Lebih detailnya silakan lihat di ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/reference/conditional-compilation.html"},"https://doc.rust-lang.org/reference/conditional-compilation.html")),(0,i.kt)("h2",{id:"a514-attribute-linting--diagnostic"},"A.51.4. Attribute ",(0,i.kt)("em",{parentName:"h2"},"linting")," & ",(0,i.kt)("em",{parentName:"h2"},"diagnostic")),(0,i.kt)("p",null,"Ada beberapa attribute name yang bisa digunakan untuk meng-override ",(0,i.kt)("em",{parentName:"p"},"default linting")," milik Rust ataupun menandai indikator ",(0,i.kt)("em",{parentName:"p"},"diagnostic")," lainnya, seperti warning yang muncul karena ada kode yang tidak digunakan, dll; Warning sejenis ini bisa di-override menggunakan attribute."),(0,i.kt)("p",null,"Contoh kasus yang berhubungan dengan ",(0,i.kt)("em",{parentName:"p"},"linting")," bisa dilihat pada kode berikut."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Attribute",src:n(7812).Z,width:"351",height:"363"})),(0,i.kt)("p",null,"Kode di atas tidak menghasilkan error. Kode akan dieksekusi tanpa error. Namun ada 3 buah warning yang muncul karena beberapa baris kode tidak digunakan atau sia-sia."),(0,i.kt)("p",null,"Cara agar warning tidak muncul bisa dengan menggunakan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"#[allow(value)]"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[allow(unused_imports)]\nuse std::fmt::Display;\n\nfn say_hello() {\n println!("hello")\n}\n\n#[allow(dead_code)]\nfn say_something() {\n println!("how are you")\n}\n\npub mod m1 {\n #[allow(missing_docs)]\n pub fn undocumented_one() -> i32 { 1 }\n\n #[warn(missing_docs)]\n pub fn undocumented_too() -> i32 { 2 }\n\n // #[deny(missing_docs)]\n // pub fn undocumented_end() -> i32 { 3 }\n}\n\nfn main() {\n #[allow(unused_variables)]\n let name = "noval agung";\n\n say_hello();\n}\n')),(0,i.kt)("p",null,"Pada kode di atas, ada beberapa attribute yang digunakan:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[allow(unused_imports)]")," digunakan untuk antisipasi error yang muncul ketika module item di-import namun tidak digunakan."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[allow(dead_code)]")," digunakan untuk membolehkan kode yang tidak digunakan."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[allow(unused_variables)]")," digunakan untuk membolehkan variabel yang didefinisikan tapi tidak dimanfaatkan."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[allow(missing_docs)]")," membolehkan kode di bawahnya untuk tidak memiliki komentar/dokumentasi."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[warn(missing_docs)]")," memunculkan warning jika kode di bawahnya tidak memiliki komentar/dokumentasi."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[deny(missing_docs)]")," memunculkan error jika kode di bawahnya tidak memiliki komentar/dokumentasi. Kode ini sengaja di-remark agar eksekusi program tidak menghasilkan error.")),(0,i.kt)("p",null,"Dengan penambahan 3 attribute di atas program akan tereksekusi tanpa warning."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Attribute",src:n(2259).Z,width:"463",height:"107"})),(0,i.kt)("p",null,"Ada beberapa attribute ",(0,i.kt)("em",{parentName:"p"},"key")," yang bisa digunakan untuk override ",(0,i.kt)("em",{parentName:"p"},"lint")," warning:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"#[allow(lint_rule)]")," untuk membolehkan suatu ",(0,i.kt)("em",{parentName:"p"},"lint rule"),".",(0,i.kt)("br",null),"List ",(0,i.kt)("inlineCode",{parentName:"p"},"lint_rule")," bisa dilihat di ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html"},"https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html"),".")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"#[warn(lint_rule)]")," untuk memunculkan warning untuk suatu ",(0,i.kt)("em",{parentName:"p"},"lint rule")," yang ",(0,i.kt)("em",{parentName:"p"},"default"),"-nya tidak memunculkan warning.",(0,i.kt)("br",null),"List ",(0,i.kt)("inlineCode",{parentName:"p"},"lint_rule")," bisa dilihat di ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html"},"https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html"),".")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"#[deny(lint_rule)]")," untuk melarang suatu ",(0,i.kt)("em",{parentName:"p"},"lint rule")," yang ",(0,i.kt)("em",{parentName:"p"},"default"),"-nya adalah diperbolehkan.",(0,i.kt)("br",null),"List ",(0,i.kt)("inlineCode",{parentName:"p"},"lint_rule")," bisa dilihat di ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/rustc/lints/listing/deny-by-default.html"},"https://doc.rust-lang.org/rustc/lints/listing/deny-by-default.html"),".")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"#[forbid(lint_rule)]")," untuk melarang suatu ",(0,i.kt)("em",{parentName:"p"},"lint rule")," yang ",(0,i.kt)("em",{parentName:"p"},"default"),"-nya adalah diperbolehkan ",(0,i.kt)("strong",{parentName:"p"},"dengan catatan kode beserta isi yang dituju lint tersebut tidak bisa diubah menjadi ",(0,i.kt)("em",{parentName:"strong"},"lint rule"),"-nya menjadi ",(0,i.kt)("inlineCode",{parentName:"strong"},"allow")," lagi"),". Penjelasan detailnya ada di ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/reference/attributes/diagnostics.html"},"https://doc.rust-lang.org/reference/attributes/diagnostics.html")),(0,i.kt)("p",{parentName:"li"}," Contoh penerapan:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"#[forbid(missing_docs)]\npub mod m3 {\n #[allow(missing_docs)]\n pub fn undocumented_too() -> i32 { 2 }\n}\n")),(0,i.kt)("p",{parentName:"li"}," Attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"#[forbid(missing_docs)]")," pada module ",(0,i.kt)("inlineCode",{parentName:"p"},"m3")," menjadikan seluruh isi block module tersebut harus memiliki dokumentasi, mirip seperti penggunaan ",(0,i.kt)("inlineCode",{parentName:"p"},"#[deny(missing_docs)]"),"."),(0,i.kt)("p",{parentName:"li"}," Penggunaan ",(0,i.kt)("inlineCode",{parentName:"p"},"allow")," di dalam block tersebut membuat eksekusi program menghasilkan error, karena meskipun attribute tersebut ditujukan untuk fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"undocumented_too()")," pada parent block (yaitu module ",(0,i.kt)("inlineCode",{parentName:"p"},"m3"),") sudah ditentukan aturannya menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"forbid"),"."))),(0,i.kt)("p",null,"Selain 3 attribute di atas, ada juga beberapa attribute lainnya untuk keperluan ",(0,i.kt)("em",{parentName:"p"},"diagnostic"),", di antaranya:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[deprecated]")," digunakan untuk menandai bahwa kode di bawahnya adalah ",(0,i.kt)("em",{parentName:"li"},"deprecated"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"#[must_use]")," digunakan untuk mendandai bahwa kode di bawahnya harus digunakan, jika tidak maka akan muncul error.")),(0,i.kt)("h2",{id:"a515-attribute-type-system"},"A.51.5. Attribute ",(0,i.kt)("em",{parentName:"h2"},"type system")),(0,i.kt)("p",null,"Ada sebuah attribute bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"non_exhaustive")," gunanya untuk mem-",(0,i.kt)("em",{parentName:"p"},"bypass")," error yang muncul karena ada pattern matching yang tidak meng-cover semua kondisi, atau untuk mengantisipasi error yang muncul saat deklarasi variabel bertipe struct tapi value property-nya tidak diisi."),(0,i.kt)("p",null,"Salah satu contoh error yang dimaksud bisa dilihat pada kode berikut. Error ini muncul karena enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Superhero::Superhero")," tidak ter-cover dalam pattern matching."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Attribute",src:n(7483).Z,width:"671",height:"669"})),(0,i.kt)("p",null,"Solusi untuk mengatasi error di atas bisa dengan cukup menambahkan case kondisi yang belum ter-cover:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'match value {\n Superhero::Superman => println!("stronk"),\n Superhero::OmniMan => println!("stronk"),\n Superhero::Hyperion => println!("stronk"),\n}\n')),(0,i.kt)("p",null,"Atau dengan memanfaatkan kondisi ",(0,i.kt)("em",{parentName:"p"},"other")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"_"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'match value {\n Superhero::Superman => println!("stronk"),\n Superhero::OmniMan => println!("stronk"),\n _ => println!("stronk"),\n}\n')),(0,i.kt)("p",null,"Atau, bisa dengan menggunakan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"non_exhaustive"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[non_exhaustive]\npub enum Superhero {\n Superman,\n OmniMan,\n Hyperion,\n}\n\nfn main() {\n let value = Superhero::Superman;\n\n match value {\n Superhero::Superman => println!("stronk"),\n Superhero::OmniMan => println!("stronk"),\n }\n}\n')),(0,i.kt)("p",null,"Sayangnya dalam penggunaan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"non_exhaustive")," ini, efeknya ",(0,i.kt)("strong",{parentName:"p"},"hanya bisa dirasakan jika digunakan pada enum atau struct yang berbeda crate"),"."),(0,i.kt)("p",null,"Pada contoh di atas, tempat di mana enum dideklarasikan dan digunakan adalah masih dalam satu crate yang sama, jadi kode tetap menghasilkan error."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"non_exhaustive")," ini jika digunakan pada struct efeknya saat deklarasi variabel boleh tidak menuliskan value property.")),(0,i.kt)("h2",{id:"a516-attribute-modules"},"A.51.6. Attribute ",(0,i.kt)("em",{parentName:"h2"},"modules")),(0,i.kt)("p",null,"Aturan manajemen di Rust cukup ketat, dan sudah dibahas secara mendetal pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/module-basic"},"Module System \u279c Module"),", yang intinya adalah ada dua cara pembuatan module:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Cara ke-1: dengan mendefinisikan module pada file bernama ",(0,i.kt)("inlineCode",{parentName:"li"},"nama_module.rs")),(0,i.kt)("li",{parentName:"ul"},"Cara ke-2: dengan mendefinisikan module pada file bernama ",(0,i.kt)("inlineCode",{parentName:"li"},"nama_module/mod.rs"))),(0,i.kt)("p",null,"Rust memiliki sebuah attribute bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"path")," yang berguna untuk meng-override 2 aturan di atas secara paksa. Dengan memanfaatkan attribute ini kita bisa menulis module dengan nama sesuka hati."),(0,i.kt)("p",null,"Mari kita praktekan agar lebih jelas. Silakan buat package baru dengan struktur seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 main.rs\n \u2502\u2500\u2500\u2500 util1.rs\n \u2502\u2500\u2500\u2500 util2\n \u2502 \u2514\u2500\u2500\u2500 mod.rs\n \u2514\u2500\u2500\u2500 util3_mymodule.rs\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="util1.rs"',title:'"util1.rs"'},'pub fn say_hello() {\n println!("hello (from util1)")\n}\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="util2/mod.rs"',title:'"util2/mod.rs"'},'pub fn say_hello() {\n println!("hello (from util2)")\n}\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="util3_mymodule.rs"',title:'"util3_mymodule.rs"'},'pub fn say_hello() {\n println!("hello (from util3_mymodule)")\n}\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="main.rs"',title:'"main.rs"'},'mod util1;\nmod util2;\n\n#[path = "util3_mymodule.rs"]\nmod util3;\n\nfn main() {\n util1::say_hello();\n util2::say_hello();\n util3::say_hello();\n}\n')),(0,i.kt)("p",null,"Pada kode di atas bisa dilihat, module ",(0,i.kt)("inlineCode",{parentName:"p"},"util1")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"util2")," patuh mengikuti aturan deklarasi module system. Berbeda dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"util3")," yang sebenarnya dideklarasikan dengan nama ",(0,i.kt)("inlineCode",{parentName:"p"},"util3_mymodule")," (karena filename-nya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"util3_mymodule.rs"),"). Nama module satu ini diubah menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"util3")," lalu dengan memanfaatkan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"path")," kita arahkan isi module ",(0,i.kt)("inlineCode",{parentName:"p"},"util3")," adalah berada di ",(0,i.kt)("inlineCode",{parentName:"p"},"util3_mymodule.rs"),"."),(0,i.kt)("p",null,"Jialankan program, harusnya tidak ada error."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Attribute",src:n(6245).Z,width:"456",height:"147"})),(0,i.kt)("h2",{id:"a517-attribute-testing"},"A.51.7. Attribute ",(0,i.kt)("em",{parentName:"h2"},"testing")),(0,i.kt)("p",null,"Lebih detailnya mengenai attribute testing dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/testing"},"Testing"),"."),(0,i.kt)("h2",{id:"a518-attribute-macros"},"A.51.8. Attribute ",(0,i.kt)("em",{parentName:"h2"},"macros")),(0,i.kt)("p",null,"Lebih detailnya mengenai attribute macros dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/macro"},"Macro"),"."),(0,i.kt)("h2",{id:"a519-attribute-lainnya"},"A.51.9 Attribute lainnya"),(0,i.kt)("p",null,"Rust memiliki cukup banyak attribute yang list-nya bisa dilihat pada link ini ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/reference/attributes.html"},"https://doc.rust-lang.org/reference/attributes.html"),"."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/attributes"},"github.com/novalagung/dasarpemrogramanrust-example/../attributes")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/module-basic"},"Module System \u279c Module")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/enum"},"Enum")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/pattern-matching"},"Pattern Matching")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/attributes.html"},"https://doc.rust-lang.org/reference/attributes.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/items/implementations.html"},"https://doc.rust-lang.org/reference/items/implementations.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rustc/lints/index.html"},"https://doc.rust-lang.org/rustc/lints/index.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/attributes/diagnostics.html"},"https://doc.rust-lang.org/reference/attributes/diagnostics.html"))))}k.isMDXComponent=!0},253:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/attribute-1-c3fd3abaf784b196c8b4da4512bb8abd.png"},7095:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/attribute-2-935bd54d9113cbcfb6a5c07a7ebd9f68.png"},635:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhkAAAB/CAIAAADNSkeyAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAE72lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4wLWMwMDAgMTM3LmRhNGE3ZTUsIDIwMjIvMTEvMjctMDk6MzU6MDMgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6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jx+R9wrGp+46dK3v+vTeaJdQyEcSz8LzVhrGp+zbnalYXuHsPJEreNQ+lkredZef06a9uXTQsUiz7oiO1eNtyx7iIIC4FldE9WBlduZGe8vyIUC6dnCtWHGd0ycJNziEq5gJxsnlF+Uqvi79647TA1v6DF5a8nlfodxr37SKeDiqje7YyOjWlWC4daIrjNrlExX4VcyI5Jsg2J2kur11pDlHeIUJICOLRoDK6ZyujU1OK5dKpiuPsLlHrwUkq5pw+/TsRHFWil4RpVEBHJgGojO7ZyuhUxHLpFhTHJ+ySk1TMSbZ9Er+29gwsDVcCnLbuH4K4MaiM7sHK6FR2HH9u13GhXDq74ji7S45SMX/7lVz2bGNnBgzcbWCyiiBuDCqjWzHk/sroVARy6eyK4+xt5BAVc7I723zHt4UlBQsLEQjiWaAyugcro1P5cdb7VLl0RsVxqktStpykYn6s9vpT6yh7GMLSn4pV3Pjkodyoh0wyUKsMcTq2qpiTO19EszA6C/YaIojn4nlvUiAeh60q5mRPxfTUH5q/drxmW1lGVE2JaJMvgngiOOZF5GACKubKjTvfzOoj73F4j27adTzldAFqnyOTBIy8CIIgcoOrDQiCIHKDkRdBEERuMPIiCILIDUZeBEEQucHIiyAIIjcYeREEQeQGIy+CIIjc/DecT72QQDsWUAAAAABJRU5ErkJggg=="},7964:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/attribute-5-b485867d9d43b989698d4f1a231cfb4b.png"},7812:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/attribute-6-0ae9faf44e5f0113b2599d985a7f331d.png"},2259:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc8AAABrCAIAAACe4J4wAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAE72lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6e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TVjqogqTYEG9LUEQRBwkdU0CQRDE9YJ6W4IgiDig3pYgCCIOqLclCIKIA+ptCYIg4oB6W4IgiDig3pYgCCIOqLclCIKIA54nd7ee/fA091P16fd8u0pzAADtV+MPoBsJgiA+KUIe2+4+/7Zarb5Q+r4bCYIgPiloJoEgCCIO+B1g372oPxYBLNMB5gzBRFME4wIB+sqLb5/vBvw8QRDEFYJ3bCs+/rr3QpsPEL9+tgUA3714Kh2/qlar1eoLZenxD8+2gtS79eyHx0vKC/3jID198V3wxhMEQVwZeHvb9itt8Ln7U6s/lysCfHdXbL/Sx7O7z39qzxW/DtDdfleV5to/6cPZ3ef/pvTFu9TdEgRxjZnUJr51awnEx/X64/GWfkAnZr/XmrBugiCIq8c0726Ybj3XXK4IoM/VFnNzU7SDIAgi+Uy6JmH3p1ZffDzxZOv3/9EGff4XYOvZ12JfqdNCXIIgrjETj213n38Lz354Op5L6Csvvn0O5ioFeFyvP4b2q+rTFrbx+6dVeFF/Wq8/BQBov6rSkgSCIK419KYcgiCIOKCnGwiCIOKAeluCIIg4oN6WIAgiDqi3JQiCiAPqbQmCIOKAeluCIIg4oN6WIAgiDqi3JQiCiAPqbQmCIOKAeluCIIg4oN6WIAgiDv4f9cqCOM6DZ8gAAAAASUVORK5CYII="},7483:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/attribute-8-edad9c816a2c847561bcc988d0905b16.png"},6245:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcgAAACTCAIAAACF/R49AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFf2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4wLWMwM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WboIg0TVPmOGLrq0bhx32P3/T2N5eVr2ue+3m0CTXyvsbijaZb+xX1K2nzDBz6IHDjrvRCrJ0E8RM2a2+FNE1N1E0YkexTQQxcWbIFfBFiK75KVV87yeYNGTpJgiNGRqxAsA1HhFZn3G1gC0T6LtGRI1gQq4AgtCZtY6VIAgi8szQUgBBEMRsQB0rQRBEyFDHShAEETLUsRIEQYQMdawEQRAhQx0rQRBEyFDHShAEETLUsRIEQYQMdawEQRAhQx0rQRBEyFDHShAEETL/D9VV2vf3UVXEAAAAAElFTkSuQmCC"}}]); \ No newline at end of file diff --git a/assets/js/62b99870.eac41936.js b/assets/js/62b99870.eac41936.js deleted file mode 100644 index f2ce815f..00000000 --- a/assets/js/62b99870.eac41936.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[1422],{3905:(a,e,n)=>{n.d(e,{Zo:()=>m,kt:()=>c});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function l(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function r(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function p(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},l=Object.keys(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var s=t.createContext({}),d=function(a){var e=t.useContext(s),n=e;return a&&(n="function"==typeof a?a(e):r(r({},e),a)),n},m=function(a){var e=d(a.components);return t.createElement(s.Provider,{value:e},a.children)},A={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},u=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,l=a.originalType,s=a.parentName,m=p(a,["components","mdxType","originalType","parentName"]),u=d(n),c=i,b=u["".concat(s,".").concat(c)]||u[c]||A[c]||l;return n?t.createElement(b,r(r({ref:e},m),{},{components:n})):t.createElement(b,r({ref:e},m))}));function c(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var l=n.length,r=new Array(l);r[0]=u;var p={};for(var s in e)hasOwnProperty.call(e,s)&&(p[s]=e[s]);p.originalType=a,p.mdxType="string"==typeof a?a:i,r[1]=p;for(var d=2;d<l;d++)r[d]=n[d];return t.createElement.apply(null,r)}return t.createElement.apply(null,n)}u.displayName="MDXCreateElement"},1569:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>s,contentTitle:()=>r,default:()=>A,frontMatter:()=>l,metadata:()=>p,toc:()=>d});var t=n(7462),i=(n(7294),n(3905));const l={sidebar_position:14,title:"A.14. Slice (Basic)",sidebar_label:"A.14. Slice (Basic)"},r=void 0,p={unversionedId:"basic/slice",id:"basic/slice",title:"A.14. Slice (Basic)",description:"Pada bab ini kita belajar tentang apa itu slice, apa perbedaan slice dan array, slicing atau borrowing pada slice, dan juga slice mutability.",source:"@site/docs/basic/slice.md",sourceDirName:"basic",slug:"/basic/slice",permalink:"/basic/slice",draft:!1,tags:[],version:"current",sidebarPosition:14,frontMatter:{sidebar_position:14,title:"A.14. Slice (Basic)",sidebar_label:"A.14. Slice (Basic)"},sidebar:"tutorialSidebar",previous:{title:"A.13. Array",permalink:"/basic/array"},next:{title:"A.15. Tuple",permalink:"/basic/tuple"}},s={},d=[{value:"A.14.1. Tipe data slice",id:"a141-tipe-data-slice",level:2},{value:"A.14.2. Size slice",id:"a142-size-slice",level:2},{value:"A.14.3. Slice <em>range syntax</em>",id:"a143-slice-range-syntax",level:2},{value:"A.14.4. Mutability pada slice",id:"a144-mutability-pada-slice",level:2},{value:"A.14.5. Perulangan <code>for in</code> pada slice",id:"a145-perulangan-for-in-pada-slice",level:2},{value:"A.14.6. Perulangan <code>for in</code> pada mutable slice",id:"a146-perulangan-for-in-pada-mutable-slice",level:2},{value:"A.14.7. Append slice",id:"a147-append-slice",level:2},{value:"A.14.8. Memory management pada slice",id:"a148-memory-management-pada-slice",level:2},{value:"A.14.9. Summary",id:"a149-summary",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:d};function A(a){let{components:e,...l}=a;return(0,i.kt)("wrapper",(0,t.Z)({},m,l,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada bab ini kita belajar tentang apa itu slice, apa perbedaan slice dan array, ",(0,i.kt)("em",{parentName:"p"},"slicing")," atau ",(0,i.kt)("em",{parentName:"p"},"borrowing")," pada slice, dan juga slice mutability."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pada chapter ini kita akan bahas slice secara garis besar saja, tanpa menyinggung masalah memory management."),(0,i.kt)("p",{parentName:"blockquote"},"Pembahasan lebih dalam perihal slice ada pada chapter terpisah (",(0,i.kt)("a",{parentName:"p",href:"/basic/slice-memory-management"},"Memory Management \u279c Slice"),"), setelah kita mempelajari dasar-dasar memory management nantinya.")),(0,i.kt)("h2",{id:"a141-tipe-data-slice"},"A.14.1. Tipe data slice"),(0,i.kt)("p",null,"Array adalah tipe data kolektif yang isinya bertipe sejenis. Contohnya ",(0,i.kt)("inlineCode",{parentName:"p"},'["a", "b", "c"]')," adalah sebuah array dengan elemen bertipe string dan array tersebut memiliki size ",(0,i.kt)("inlineCode",{parentName:"p"},"3"),"."),(0,i.kt)("p",null,"Lalu apa itu slice? menurut laman dokumentasi Rust, slice adalah:"),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"A slice is a dynamically sized type representing a 'view' into a sequence of elements of type T. The slice type is written as ","[T]"),(0,i.kt)("p",{parentName:"blockquote"},"A dynamically-sized view into a contiguous sequence, ","[T]",". Contiguous here means that elements are laid out so that every element is the same distance from its neighbors."),(0,i.kt)("p",{parentName:"blockquote"},"Slices are a view into a block of memory represented as a pointer and a size.")),(0,i.kt)("p",null,"Slice adalah representasi ",(0,i.kt)("em",{parentName:"p"},"block of memory")," berbentuk pointer dan memiliki size yang dinamis (tidak fixed seperti array). Notasi tipe data slice adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"&[T]")," yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," adalah tipe data element."),(0,i.kt)("p",null,"Slice bisa dibuat dari data array (atau dari tipe kolektif data lainnya) dengan menggunakan kombinasi operator ",(0,i.kt)("inlineCode",{parentName:"p"},"&")," dan ",(0,i.kt)("em",{parentName:"p"},"range syntax")," ",(0,i.kt)("inlineCode",{parentName:"p"},"..")," dengan notasi penulisan seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let sliced_value1 = &data[start_index..end_index]\nlet sliced_value2 = &data[start_index..=end_index]\nlet sliced_value3 = &data[start_index..end_index]\n...\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Slice juga bisa dibuat dari tipe data vector. Lebih jelasnya dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/vector"},"Vector"),".")),(0,i.kt)("p",null,"Silakan perhatikan contoh berikut dan praktikkan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let numbers = [12, 16, 8, 3];\nprintln!("numbers : {:?}, len: {}", numbers, numbers.len());\nprintln!("numbers[0]: {:?}", numbers[0]);\nprintln!("numbers[1]: {:?}", numbers[1]);\n\nlet slice_a = &numbers[0..3];\nprintln!("slice_a : {:?}, len: {}", slice_a, slice_a.len());\nprintln!("slice_a[0]: {:?}", slice_a[0]);\nprintln!("slice_a[1]: {:?}", slice_a[1]);\n\nlet slice_b = &slice_a[1..=2];\nprintln!("slice_b : {:?}, len: {}", slice_b, slice_b.len());\nprintln!("slice_b[0]: {:?}", slice_b[0]);\nprintln!("slice_b[1]: {:?}", slice_b[1]);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"slice",src:n(8493).Z,width:"463",height:"256"})),(0,i.kt)("p",null,"Pada contoh di atas, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," didefinisikan bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"[i32; 4]"),". Data pada variabel tersebut kemudian dipinjam ditampung pada variabel baru beranama ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a")," yang merupakan slice bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&[i32]"),", dengan isi adalah element array ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," indeks ke ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," hingga sebelum ",(0,i.kt)("inlineCode",{parentName:"p"},"3")," (yang berarti index ke-",(0,i.kt)("inlineCode",{parentName:"p"},"2"),"). Dengan ini maka ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a")," nilainya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"[12, 16, 8]")," dengan size ",(0,i.kt)("inlineCode",{parentName:"p"},"3"),"."),(0,i.kt)("p",null,"Bisa dilihat pada statement print ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a[0]")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a[1]"),", nilai elemennya sesuai dengan dengan hasil peminjaman data array ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Data yang tipenya ",(0,i.kt)("inlineCode",{parentName:"p"},"&[T]")," biasa disebut sebagai ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/reference/types/slice.html"},(0,i.kt)("em",{parentName:"a"},"shared slice"))," atau cukup ",(0,i.kt)("em",{parentName:"p"},"slice"),". Contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a")," dengan tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"&[i32]"),".")),(0,i.kt)("p",null,"Slice ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a")," bukan merupakan pemilik sebenarnya data ",(0,i.kt)("inlineCode",{parentName:"p"},"[12, 16, 8]"),", slice tersebut hanya meminjam datanya dari ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," yang notabene dalah owner data ",(0,i.kt)("inlineCode",{parentName:"p"},"[12, 16, 8]"),"."),(0,i.kt)("p",null,"Meminjam di sini artinya variabel baru ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a")," memiliki data yang sama, dan alamat memori (atau pointer) data tersebut juga sama yaitu mengarah ke owner sebenarnya, yang pada contoh ini adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Di Rust, proses meminjam data secara umum disebut dengan ",(0,i.kt)("strong",{parentName:"p"},"borrowing"),". Variabel atau data hasil dari borrowing biasa disebut dengan ",(0,i.kt)("strong",{parentName:"p"},"reference"),". Lebih jelasnya akan dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References")," dan ",(0,i.kt)("a",{parentName:"p",href:"/basic/borrowing"},"Borrowing"),"."),(0,i.kt)("p",{parentName:"blockquote"},"Variabel pemilik data yang sebenarnya disebut dengan ",(0,i.kt)("strong",{parentName:"p"},"owner"),". Lebih jelasnya mengenai ownership dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/ownership"},"Ownership")),(0,i.kt)("p",{parentName:"blockquote"},"Dalam konteks slice, proses meminjam data (yg menggunakan teknik borrowing dan range syntax) disebut dengan ",(0,i.kt)("strong",{parentName:"p"},"slicing"),".")),(0,i.kt)("p",null,"Dengan menggunakan VSCode ",(0,i.kt)("inlineCode",{parentName:"p"},"rust-analyzer")," kita bisa melihat dengan mudah tipe sebuah slice."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"slice",src:n(2462).Z,width:"540",height:"346"})),(0,i.kt)("p",null,"Kembali ke pembahasan pada contoh di atas. Selain ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a"),", ada juga slice ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_b")," yang isinya merupakan data pinjaman dari ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a"),". Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"&slice_a[1..=2]")," artinya adalah ",(0,i.kt)("em",{parentName:"p"},"borrowing")," slice ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a")," mulai dari indeks ke-",(0,i.kt)("inlineCode",{parentName:"p"},"1")," hingga ",(0,i.kt)("inlineCode",{parentName:"p"},"2"),". Dengan ini indeks ke-1 milik ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a")," menjadi indeks ke-0 milik ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_b"),", ... dan seterusnya. Hasilnya, nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_b")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"[16, 8]")," dengan size ",(0,i.kt)("inlineCode",{parentName:"p"},"2"),"."),(0,i.kt)("p",null,"Silakan juga cek penjelasan tambahan berikut, agar semakin paham tentang slice."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let numbers = [12, 16, 8, 3];\n// variabel numbers isinya array [12, 16, 8, 3]\n\nlet slice_a = &numbers[0..3];\n// meminjam data milik numbers elemen ke-0 hingga sebelum 3 (yaitu 2)\n// hasilnya adalah [12, 16, 8]\n\nlet slice_b = &slice_a[1..=2];\n// meminjam data milik slice_a elemen ke-1 hingga 2\n// hasilnya adalah [16, 8]\n")),(0,i.kt)("h2",{id:"a142-size-slice"},"A.14.2. Size slice"),(0,i.kt)("p",null,"Gunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"len")," untuk mencari tau size dari slice."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let numbers = [12, 16, 8, 3];\nprintln!("{}", numbers.len());\n// output: 4\n\nlet slice_a = &numbers[0..3];\nprintln!("{}", slice_a.len());\n// output: 3\n\nlet slice_b = &slice_a[1..=2];\nprintln!("{}", slice_b.len());\n// output: 2\n')),(0,i.kt)("h2",{id:"a143-slice-range-syntax"},"A.14.3. Slice ",(0,i.kt)("em",{parentName:"h2"},"range syntax")),(0,i.kt)("p",null,"Di bawah ini adalah range syntax yang bisa digunakan untuk slicing. Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"data")," pada contoh berikut dijadikan sebagai bahan slicing."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data = ["a", "b", "c", "d"];\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"&data[start_index..end_index]")," untuk slicing data dari ",(0,i.kt)("inlineCode",{parentName:"p"},"start_index")," hingga sebelum ",(0,i.kt)("inlineCode",{parentName:"p"},"end_index")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let sliced_data = &data[1..3];\nprintln!("{:?}", sliced_data);\n// output => ["b", "c"]\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"&data[start_index..=end_index]")," untuk slicing data dari ",(0,i.kt)("inlineCode",{parentName:"p"},"start_index")," hingga ",(0,i.kt)("inlineCode",{parentName:"p"},"end_index")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let sliced_data = &data[1..=3];\nprintln!("{:?}", sliced_data);\n// output => ["b", "c", "d"]\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"&data[..end_index]")," untuk slicing data dari 0 hingga sebelum ",(0,i.kt)("inlineCode",{parentName:"p"},"end_index")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let sliced_data = &data[..3];\nprintln!("{:?}", sliced_data);\n// output => ["a", "b", "c"]\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"&data[..=end_index]")," untuk slicing data dari 0 hingga ",(0,i.kt)("inlineCode",{parentName:"p"},"end_index")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let sliced_data = &data[..=2];\nprintln!("{:?}", sliced_data);\n// output => ["a", "b", "c"]\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"&data[start_index..]")," untuk slicing data dari ",(0,i.kt)("inlineCode",{parentName:"p"},"start_index")," hingga indeks terakhir"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let sliced_data = &data[1..];\nprintln!("{:?}", sliced_data);\n// output => ["b", "c", "d"]\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"&data[..]")," untuk slicing semua elemen yang ada"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let sliced_data = &data[..];\nprintln!("{:?}", sliced_data);\n// output => ["A", "b", "c", "d"]\n')))),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Perihal apa itu borrowing dan kegunaan dari operator ",(0,i.kt)("inlineCode",{parentName:"p"},"&")," yang ditulis di awal variabel dibahas lebih detail pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"),".")),(0,i.kt)("h2",{id:"a144-mutability-pada-slice"},"A.14.4. Mutability pada slice"),(0,i.kt)("p",null,"Ada dua jenis data hasil operasi ",(0,i.kt)("em",{parentName:"p"},"borrowing")," (atau biasa disebut dengan data ",(0,i.kt)("em",{parentName:"p"},"reference"),")."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Read only atau shared reference, operator yang digunakan adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"&"),"."),(0,i.kt)("li",{parentName:"ul"},"Mutable reference, operator yang digunakan adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"&mut"),".")),(0,i.kt)("p",null,"Kita akan bahas garis besarnya saja pada chapter ini. Intinya, shared reference adalah data hasil peminjaman/borrowing yang hanya bisa dibaca. Sedangkan mutable reference adalah data hasil borrowing yang bisa diubah nilainya, yang jika ini dilakukan maka akan mengubah juga data pemilik sebenarnya."),(0,i.kt)("p",null,"Contoh berikut adalah salah satu penerapan ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut"),". Variabel slice ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers2")," dipinjam beberapa elemennya dengan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut")," ke variabel baru bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_e"),". Dengan operator tersebut maka borrowing menghasilkan data ",(0,i.kt)("em",{parentName:"p"},"mutable reference"),", data yang nilainya diperbolehkan untuk diubah meskipun data pinjaman."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut numbers2 = [12, 16, 8, 3];\nprintln!("===== before =====");\nprintln!("numbers2 : {:?}", numbers2);\n\nlet slice_e = &mut numbers2[..=2];\nslice_e[1] = 99;\n\nprintln!("===== after =====");\nprintln!("slice_e : {:?}", slice_e);\nprintln!("numbers2 : {:?}", numbers2);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"slice",src:n(7858).Z,width:"457",height:"189"})),(0,i.kt)("p",null,"Bisa dilihat, indeks ke-1 ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_e")," diubah nilainya yang sebelumnya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"16")," menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"99"),". Setelah itu di-print, di output nilai variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers2")," juga ikut berubah. Hal ini karena perubahan data pada variabel mutable reference juga punya pengaruh ke variabel pemilik data sebenarnya (yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers2"),")."),(0,i.kt)("p",null,"O iya, penggunaan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut")," mengharuskan kita untuk tidak menuliskan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"mut")," pada variabel yang menampung nilai borrowing."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"// statement yang direkomendasikan\nlet slice_e = &mut numbers2[..=2];\n\n// statement yang TIDAK DIREKOMENDASIKAN dan akan memunculkan warning.\nlet mut slice_e = &mut numbers2[..=2];\n")),(0,i.kt)("h2",{id:"a145-perulangan-for-in-pada-slice"},"A.14.5. Perulangan ",(0,i.kt)("inlineCode",{parentName:"h2"},"for in")," pada slice"),(0,i.kt)("p",null,"Slice merupakan tipe data yang implement trait Iterator (seperti array), dan semua data yang memiliki trait tersebut bisa digunakan pada perulangan. Slice ",(0,i.kt)("inlineCode",{parentName:"p"},"&[T]")," jika dipergunakan dalam ",(0,i.kt)("inlineCode",{parentName:"p"},"for in"),", tipe data penampung iterasi perulangan adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"&T"),", bukan ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," yaa jadi jangan sampai keliru."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let scores1 = [7, 8, 9];\n\nfor score in &scores1[..] {\n print!("{:?} ", score);\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"slice",src:n(6760).Z,width:"462",height:"272"})),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Sangat dianjurkan menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"rust-analyzer")," jika menggunakan VSCode, agar lebih mudah melihat tipe data variabel dan informasi penting lainnya yang berguna dalam proses coding atau development."),(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai traits dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai trait ",(0,i.kt)("inlineCode",{parentName:"li"},"Iterator")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/trait-iterator"},"Trait \u279c Iterator")))),(0,i.kt)("h2",{id:"a146-perulangan-for-in-pada-mutable-slice"},"A.14.6. Perulangan ",(0,i.kt)("inlineCode",{parentName:"h2"},"for in")," pada mutable slice"),(0,i.kt)("p",null,"Sama seperti penggunaan ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," pada shared slice, pada contoh kasus mutable slice perbedaannya hanyalah pada tipe data penampung iterasi yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut T"),", bukan ",(0,i.kt)("inlineCode",{parentName:"p"},"&T"),"."),(0,i.kt)("p",null,"Pada contoh berikut kita coba eksperimen mengubah nilai elemen sebuah mutable slice yang data aslinya juga hasil dari peminjaman mutable slice."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut scores2 = [7, 8, 9];\nprintln!("(before) scores2 : {:?}", scores2);\n\nlet slice_f = &mut scores2[..];\n\nfor score in &mut slice_f[..] {\n *score += 1;\n}\n\nprintln!("(after) scores2 : {:?}", scores2);\n')),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"scores")," dipinjam menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut")," ke variabel baru bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_f"),". Kemudian ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_f")," dipinjam juga sebagai mutable slice pada perulangan ",(0,i.kt)("inlineCode",{parentName:"p"},"for in"),"."),(0,i.kt)("p",null,"Setelah di-increment nilainya menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"*score += 1")," bisa dilihat hasil akhirnya juga mengubah nilai variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"scores2")," yang merupakan ",(0,i.kt)("em",{parentName:"p"},"owner")," atau pemilik data sebenarnya."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"slice",src:n(4820).Z,width:"467",height:"376"})),(0,i.kt)("p",null,"Operasi increment pada ",(0,i.kt)("inlineCode",{parentName:"p"},"score")," tidak bisa dituliskan dalam bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"score += 1")," karena tipe data score adalah pointer mutable reference (ditandai dengan adanya ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut"),"), untuk increment nilainya perlu di-",(0,i.kt)("em",{parentName:"p"},"dereference")," terlebih dahulu menggunakan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"*"),". Lebih jelasnya kita bahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"),"."),(0,i.kt)("h2",{id:"a147-append-slice"},"A.14.7. Append slice"),(0,i.kt)("p",null,"Slice by default tidak mendukung operasi append. Sebenarnya bisa saja dilakukan tapi agak panjang caranya (silakan cari referensinya di Google untuk ini)."),(0,i.kt)("p",null,"Perlu diketahui, jika kebutuhannya adalah untuk menampung jenis data yang size-nya bisa bertamah, penulis anjurkan untuk menggunakan ",(0,i.kt)("a",{parentName:"p",href:"/basic/vector"},"Vector")," yang beberapa bab lagi akan kita bahas."),(0,i.kt)("h2",{id:"a148-memory-management-pada-slice"},"A.14.8. Memory management pada slice"),(0,i.kt)("p",null,"Nantinya setelah selesai dengan pembahasan dasar memory management di Rust, kita akan bahas lagi topik slice tapi dari sudut pandang memory management pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/slice-memory-management"},"Memory Management \u279c Slice"),"."),(0,i.kt)("h2",{id:"a149-summary"},"A.14.9. Summary"),(0,i.kt)("p",null,"Catatan ringkas perihal slice:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Slice memiliki notasi ",(0,i.kt)("inlineCode",{parentName:"li"},"&[T]"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"&")," di situ artinya adalah operasi borrowing/peminjaman"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"T")," adalah tipe data tiap elemen"))),(0,i.kt)("li",{parentName:"ul"},"Slice bisa terbentuk dari hasil meminjam data array, vector, atau tipe data kolektif lainnya"),(0,i.kt)("li",{parentName:"ul"},"Data slice adalah selalu data pinjaman"),(0,i.kt)("li",{parentName:"ul"},"Slice memiliki lebar/size"),(0,i.kt)("li",{parentName:"ul"},"Slicing adalah cara pengaksesan slice menggunakan ",(0,i.kt)("em",{parentName:"li"},"range syntax")),(0,i.kt)("li",{parentName:"ul"},"Slice bisa immutable, bisa juga mutable (menggunakan ",(0,i.kt)("inlineCode",{parentName:"li"},"&mut"),")")),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/slice"},"github.com/novalagung/dasarpemrogramanrust-example/../slice")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch04-03-slices.html#the-slice-type"},"https://doc.rust-lang.org/book/ch04-03-slices.html#the-slice-type")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/primitive.slice.html"},"https://doc.rust-lang.org/std/primitive.slice.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/iter/trait.Iterator.html"},"https://doc.rust-lang.org/std/iter/trait.Iterator.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/types/slice.html"},"https://doc.rust-lang.org/reference/types/slice.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/nomicon/references.html"},"https://doc.rust-lang.org/nomicon/references.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/primitives/array.html"},"https://doc.rust-lang.org/rust-by-example/primitives/array.html"))))}A.isMDXComponent=!0},8493:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc8AAAEACAIAAABapGodAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZ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avSTFQTjy5tDReGy7u8ha2xJjj3JExLUCSuxis7O1yZeyvu6Lck0tyTMLGbYbuZbqgAgDtt6WuAZSzynfidNACAUqFOAgCACIv27IY81cSl4ElY6eskzN9NAICMlj6TAACwFJBJAAAQAdEWAEAERFsAABFQTRwAQIRKVhMnXqyfs5p4/GYJhGsAyKyC1cT5lb/nojXbOkVVw6fVewQASFC5auIJlb9ntDlj0yO1baYXIAMA4KpcNXF+5e85tc49Xbds07FaWvNIlbwOJrYAkE1Fq4lnkKqaeMsyjA7pjDFL6drI2gJAZlWsJl6CaF5uOKbNLNZuFHSrBQDcGZWrJl6G8MmSxw4RtSyDbKYbJjmY4AJAepWrJp5ZymriUi26w8HckUlkrAeASkg/t52oJj5eC1xnTJ+oJj5Y2HKOD6nZtqK8QZCLGF02I0ExSDpMXS3eJdVizJr/GxbxHMrMXgIA8Cx9DTBUEweApYA6CQAAIqCaOACACEufSQAAWArIJAAAiIBoCwAgAqItAIAIiLYAACIg2gIAiIBoCwAgAqItAIAIiLYAACIg2gIAiIBoCwAgAqItAIAI/x+K0xtQhqLb3AAAAABJRU5ErkJggg=="},2462:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/slice-2-f573e34bdab45ca8821163ae546a42ba.png"},7858:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAAC9CAIAAABXmRFFAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5z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E+WoEZXzxr/mt1TKG8n7LpWf4nVUVtXYibMkfmXuCfDpaWMXt6VO/eSTX2kGICwjrgk0jmwxkk5fcGkQSyjaIxhtJafKiwZJ20GK1x1Tt89Vkr8yN586NbSxh2LIbWlaXmqcYBMPgNDc9F6WMV/1V7zu+0z2zNtfmXtUdWoxLJY2tt3dmVJVq27glAQA4bhp25qKRTttImLuZfv5w0xl7rHUqcdmcbWxayf1J3K4JWQAgNBzAuaSYLHskHcNJlPalTr1k1EVr/vK3L7q1Gw+YW3skFUy99pwlSEAIRHlt9YOnu5WVVXTVOroR3onHwuKbc//7Uk9t+I1U5m76KtOLZj518YOWyW8JgDASEAHK4iF1MaGtDYAU+Cm11sXmBnUxoa0NgDTAn5rENATcAM9AQB4gW0FAADxLIaeAAAAzBawrQAAIB7YVgAAEA9sKwAAiAe2FQAAxAPbCgAA4oFtBQAA8cC2AgCAeGBbAQBAPLCtAAAgHthWAAAQD2wrAACIB7YVAADEA9sKAADigW0FAADx/DdZCPKsAGKjBwAAAABJRU5ErkJggg=="},6760:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/slice-5-541f1e4111281ebbac474d8d9828c0e8.png"},4820:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/slice-6-393c62bd8cdd9da05fcae56436a3cacd.png"}}]); \ No newline at end of file diff --git a/assets/js/62b99870.ede91e5e.js b/assets/js/62b99870.ede91e5e.js new file mode 100644 index 00000000..82e63a96 --- /dev/null +++ b/assets/js/62b99870.ede91e5e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[1422],{3905:(a,e,n)=>{n.d(e,{Zo:()=>m,kt:()=>c});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function l(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function r(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function p(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},l=Object.keys(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var s=t.createContext({}),d=function(a){var e=t.useContext(s),n=e;return a&&(n="function"==typeof a?a(e):r(r({},e),a)),n},m=function(a){var e=d(a.components);return t.createElement(s.Provider,{value:e},a.children)},A={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},u=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,l=a.originalType,s=a.parentName,m=p(a,["components","mdxType","originalType","parentName"]),u=d(n),c=i,b=u["".concat(s,".").concat(c)]||u[c]||A[c]||l;return n?t.createElement(b,r(r({ref:e},m),{},{components:n})):t.createElement(b,r({ref:e},m))}));function c(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var l=n.length,r=new Array(l);r[0]=u;var p={};for(var s in e)hasOwnProperty.call(e,s)&&(p[s]=e[s]);p.originalType=a,p.mdxType="string"==typeof a?a:i,r[1]=p;for(var d=2;d<l;d++)r[d]=n[d];return t.createElement.apply(null,r)}return t.createElement.apply(null,n)}u.displayName="MDXCreateElement"},1569:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>s,contentTitle:()=>r,default:()=>A,frontMatter:()=>l,metadata:()=>p,toc:()=>d});var t=n(7462),i=(n(7294),n(3905));const l={sidebar_position:14,title:"A.14. Slice (Basic)",sidebar_label:"A.14. Slice (Basic)"},r=void 0,p={unversionedId:"basic/slice",id:"basic/slice",title:"A.14. Slice (Basic)",description:"Pada bab ini kita belajar tentang apa itu slice, apa perbedaan slice dan array, slicing atau borrowing pada slice, dan juga slice mutability.",source:"@site/docs/basic/slice.md",sourceDirName:"basic",slug:"/basic/slice",permalink:"/basic/slice",draft:!1,tags:[],version:"current",sidebarPosition:14,frontMatter:{sidebar_position:14,title:"A.14. Slice (Basic)",sidebar_label:"A.14. Slice (Basic)"},sidebar:"tutorialSidebar",previous:{title:"A.13. Array",permalink:"/basic/array"},next:{title:"A.15. Tuple",permalink:"/basic/tuple"}},s={},d=[{value:"A.14.1. Tipe data slice",id:"a141-tipe-data-slice",level:2},{value:"A.14.2. Size slice",id:"a142-size-slice",level:2},{value:"A.14.3. Slice <em>range syntax</em>",id:"a143-slice-range-syntax",level:2},{value:"A.14.4. Mutability pada slice",id:"a144-mutability-pada-slice",level:2},{value:"A.14.5. Perulangan <code>for in</code> pada slice",id:"a145-perulangan-for-in-pada-slice",level:2},{value:"A.14.6. Perulangan <code>for in</code> pada mutable slice",id:"a146-perulangan-for-in-pada-mutable-slice",level:2},{value:"A.14.7. Append slice",id:"a147-append-slice",level:2},{value:"A.14.8. Memory management pada slice",id:"a148-memory-management-pada-slice",level:2},{value:"A.14.9. Summary",id:"a149-summary",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:d};function A(a){let{components:e,...l}=a;return(0,i.kt)("wrapper",(0,t.Z)({},m,l,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada bab ini kita belajar tentang apa itu slice, apa perbedaan slice dan array, ",(0,i.kt)("em",{parentName:"p"},"slicing")," atau ",(0,i.kt)("em",{parentName:"p"},"borrowing")," pada slice, dan juga slice mutability."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pada chapter ini kita akan bahas slice secara garis besar saja, tanpa menyinggung masalah memory management."),(0,i.kt)("p",{parentName:"blockquote"},"Pembahasan lebih dalam perihal slice ada pada chapter terpisah (",(0,i.kt)("a",{parentName:"p",href:"/basic/slice-memory-management"},"Memory Management \u279c Slice"),"), setelah kita mempelajari dasar-dasar memory management nantinya.")),(0,i.kt)("h2",{id:"a141-tipe-data-slice"},"A.14.1. Tipe data slice"),(0,i.kt)("p",null,"Array adalah tipe data kolektif yang isinya bertipe sejenis. Contohnya ",(0,i.kt)("inlineCode",{parentName:"p"},'["a", "b", "c"]')," adalah sebuah array dengan elemen bertipe string dan array tersebut memiliki size ",(0,i.kt)("inlineCode",{parentName:"p"},"3"),"."),(0,i.kt)("p",null,"Lalu apa itu slice? menurut laman dokumentasi Rust, slice adalah:"),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"A slice is a dynamically sized type representing a 'view' into a sequence of elements of type T. The slice type is written as ","[T]"),(0,i.kt)("p",{parentName:"blockquote"},"A dynamically-sized view into a contiguous sequence, ","[T]",". Contiguous here means that elements are laid out so that every element is the same distance from its neighbors."),(0,i.kt)("p",{parentName:"blockquote"},"Slices are a view into a block of memory represented as a pointer and a size.")),(0,i.kt)("p",null,"Slice adalah representasi ",(0,i.kt)("em",{parentName:"p"},"block of memory")," berbentuk pointer dan memiliki size yang dinamis (tidak fixed seperti array). Notasi tipe data slice adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"&[T]")," yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," adalah tipe data element."),(0,i.kt)("p",null,"Slice bisa dibuat dari data array (atau dari tipe kolektif data lainnya) dengan menggunakan kombinasi operator ",(0,i.kt)("inlineCode",{parentName:"p"},"&")," dan ",(0,i.kt)("em",{parentName:"p"},"range syntax")," ",(0,i.kt)("inlineCode",{parentName:"p"},"..")," dengan notasi penulisan seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let sliced_value1 = &data[start_index..end_index]\nlet sliced_value2 = &data[start_index..=end_index]\nlet sliced_value3 = &data[start_index..end_index]\n...\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Slice juga bisa dibuat dari tipe data vector. Lebih jelasnya dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/vector"},"Vector"),".")),(0,i.kt)("p",null,"Silakan perhatikan contoh berikut dan praktikkan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let numbers = [12, 16, 8, 3];\nprintln!("numbers : {:?}, len: {}", numbers, numbers.len());\nprintln!("numbers[0]: {:?}", numbers[0]);\nprintln!("numbers[1]: {:?}", numbers[1]);\n\nlet slice_a = &numbers[0..3];\nprintln!("slice_a : {:?}, len: {}", slice_a, slice_a.len());\nprintln!("slice_a[0]: {:?}", slice_a[0]);\nprintln!("slice_a[1]: {:?}", slice_a[1]);\n\nlet slice_b = &slice_a[1..=2];\nprintln!("slice_b : {:?}, len: {}", slice_b, slice_b.len());\nprintln!("slice_b[0]: {:?}", slice_b[0]);\nprintln!("slice_b[1]: {:?}", slice_b[1]);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"slice",src:n(8493).Z,width:"463",height:"256"})),(0,i.kt)("p",null,"Pada contoh di atas, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," didefinisikan bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"[i32; 4]"),". Data pada variabel tersebut kemudian dipinjam ditampung pada variabel baru beranama ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a")," yang merupakan slice bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&[i32]"),", dengan isi adalah element array ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," indeks ke ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," hingga sebelum ",(0,i.kt)("inlineCode",{parentName:"p"},"3")," (yang berarti index ke-",(0,i.kt)("inlineCode",{parentName:"p"},"2"),"). Dengan ini maka ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a")," nilainya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"[12, 16, 8]")," dengan size ",(0,i.kt)("inlineCode",{parentName:"p"},"3"),"."),(0,i.kt)("p",null,"Bisa dilihat pada statement print ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a[0]")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a[1]"),", nilai elemennya sesuai dengan dengan hasil peminjaman data array ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Data yang tipenya ",(0,i.kt)("inlineCode",{parentName:"p"},"&[T]")," biasa disebut sebagai ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/reference/types/slice.html"},(0,i.kt)("em",{parentName:"a"},"shared slice"))," atau cukup ",(0,i.kt)("em",{parentName:"p"},"slice"),". Contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a")," dengan tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"&[i32]"),".")),(0,i.kt)("p",null,"Slice ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a")," bukan merupakan pemilik sebenarnya data ",(0,i.kt)("inlineCode",{parentName:"p"},"[12, 16, 8]"),", slice tersebut hanya meminjam datanya dari ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," yang notabene dalah owner data ",(0,i.kt)("inlineCode",{parentName:"p"},"[12, 16, 8]"),"."),(0,i.kt)("p",null,"Meminjam di sini artinya variabel baru ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a")," memiliki data yang sama, dan alamat memori (atau pointer) data tersebut juga sama yaitu mengarah ke owner sebenarnya, yang pada contoh ini adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Di Rust, proses meminjam data secara umum disebut dengan ",(0,i.kt)("strong",{parentName:"p"},"borrowing"),". Variabel atau data hasil dari borrowing biasa disebut dengan ",(0,i.kt)("strong",{parentName:"p"},"reference"),". Lebih jelasnya akan dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References")," dan ",(0,i.kt)("a",{parentName:"p",href:"/basic/borrowing"},"Borrowing"),"."),(0,i.kt)("p",{parentName:"blockquote"},"Variabel pemilik data yang sebenarnya disebut dengan ",(0,i.kt)("strong",{parentName:"p"},"owner"),". Lebih jelasnya mengenai ownership dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/ownership"},"Ownership")),(0,i.kt)("p",{parentName:"blockquote"},"Dalam konteks slice, proses meminjam data (yg menggunakan teknik borrowing dan range syntax) disebut dengan ",(0,i.kt)("strong",{parentName:"p"},"slicing"),".")),(0,i.kt)("p",null,"Dengan menggunakan VSCode ",(0,i.kt)("inlineCode",{parentName:"p"},"rust-analyzer")," kita bisa melihat dengan mudah tipe sebuah slice."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"slice",src:n(2462).Z,width:"540",height:"346"})),(0,i.kt)("p",null,"Kembali ke pembahasan pada contoh di atas. Selain ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a"),", ada juga slice ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_b")," yang isinya merupakan data pinjaman dari ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a"),". Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"&slice_a[1..=2]")," artinya adalah ",(0,i.kt)("em",{parentName:"p"},"borrowing")," slice ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a")," mulai dari indeks ke-",(0,i.kt)("inlineCode",{parentName:"p"},"1")," hingga ",(0,i.kt)("inlineCode",{parentName:"p"},"2"),". Dengan ini indeks ke-1 milik ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_a")," menjadi indeks ke-0 milik ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_b"),", ... dan seterusnya. Hasilnya, nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_b")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"[16, 8]")," dengan size ",(0,i.kt)("inlineCode",{parentName:"p"},"2"),"."),(0,i.kt)("p",null,"Silakan juga cek penjelasan tambahan berikut, agar semakin paham tentang slice."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let numbers = [12, 16, 8, 3];\n// variabel numbers isinya array [12, 16, 8, 3]\n\nlet slice_a = &numbers[0..3];\n// meminjam data milik numbers elemen ke-0 hingga sebelum 3 (yaitu 2)\n// hasilnya adalah [12, 16, 8]\n\nlet slice_b = &slice_a[1..=2];\n// meminjam data milik slice_a elemen ke-1 hingga 2\n// hasilnya adalah [16, 8]\n")),(0,i.kt)("h2",{id:"a142-size-slice"},"A.14.2. Size slice"),(0,i.kt)("p",null,"Gunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"len")," untuk mencari tau size dari slice."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let numbers = [12, 16, 8, 3];\nprintln!("{}", numbers.len());\n// output: 4\n\nlet slice_a = &numbers[0..3];\nprintln!("{}", slice_a.len());\n// output: 3\n\nlet slice_b = &slice_a[1..=2];\nprintln!("{}", slice_b.len());\n// output: 2\n')),(0,i.kt)("h2",{id:"a143-slice-range-syntax"},"A.14.3. Slice ",(0,i.kt)("em",{parentName:"h2"},"range syntax")),(0,i.kt)("p",null,"Di bawah ini adalah range syntax yang bisa digunakan untuk slicing. Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"data")," pada contoh berikut dijadikan sebagai bahan slicing."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data = ["a", "b", "c", "d"];\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"&data[start_index..end_index]")," untuk slicing data dari ",(0,i.kt)("inlineCode",{parentName:"p"},"start_index")," hingga sebelum ",(0,i.kt)("inlineCode",{parentName:"p"},"end_index")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let sliced_data = &data[1..3];\nprintln!("{:?}", sliced_data);\n// output => ["b", "c"]\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"&data[start_index..=end_index]")," untuk slicing data dari ",(0,i.kt)("inlineCode",{parentName:"p"},"start_index")," hingga ",(0,i.kt)("inlineCode",{parentName:"p"},"end_index")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let sliced_data = &data[1..=3];\nprintln!("{:?}", sliced_data);\n// output => ["b", "c", "d"]\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"&data[..end_index]")," untuk slicing data dari 0 hingga sebelum ",(0,i.kt)("inlineCode",{parentName:"p"},"end_index")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let sliced_data = &data[..3];\nprintln!("{:?}", sliced_data);\n// output => ["a", "b", "c"]\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"&data[..=end_index]")," untuk slicing data dari 0 hingga ",(0,i.kt)("inlineCode",{parentName:"p"},"end_index")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let sliced_data = &data[..=2];\nprintln!("{:?}", sliced_data);\n// output => ["a", "b", "c"]\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"&data[start_index..]")," untuk slicing data dari ",(0,i.kt)("inlineCode",{parentName:"p"},"start_index")," hingga indeks terakhir"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let sliced_data = &data[1..];\nprintln!("{:?}", sliced_data);\n// output => ["b", "c", "d"]\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"&data[..]")," untuk slicing semua elemen yang ada"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let sliced_data = &data[..];\nprintln!("{:?}", sliced_data);\n// output => ["A", "b", "c", "d"]\n')))),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Perihal apa itu borrowing dan kegunaan dari operator ",(0,i.kt)("inlineCode",{parentName:"p"},"&")," yang ditulis di awal variabel dibahas lebih detail pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"),".")),(0,i.kt)("h2",{id:"a144-mutability-pada-slice"},"A.14.4. Mutability pada slice"),(0,i.kt)("p",null,"Ada dua jenis data hasil operasi ",(0,i.kt)("em",{parentName:"p"},"borrowing")," (atau biasa disebut dengan data ",(0,i.kt)("em",{parentName:"p"},"reference"),")."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Read only atau shared reference, operator yang digunakan adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"&"),"."),(0,i.kt)("li",{parentName:"ul"},"Mutable reference, operator yang digunakan adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"&mut"),".")),(0,i.kt)("p",null,"Kita akan bahas garis besarnya saja pada chapter ini. Intinya, shared reference adalah data hasil peminjaman/borrowing yang hanya bisa dibaca. Sedangkan mutable reference adalah data hasil borrowing yang bisa diubah nilainya, yang jika ini dilakukan maka akan mengubah juga data pemilik sebenarnya."),(0,i.kt)("p",null,"Contoh berikut adalah salah satu penerapan ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut"),". Variabel slice ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers2")," dipinjam beberapa elemennya dengan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut")," ke variabel baru bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_e"),". Dengan operator tersebut maka borrowing menghasilkan data ",(0,i.kt)("em",{parentName:"p"},"mutable reference"),", data yang nilainya diperbolehkan untuk diubah meskipun data pinjaman."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut numbers2 = [12, 16, 8, 3];\nprintln!("===== before =====");\nprintln!("numbers2 : {:?}", numbers2);\n\nlet slice_e = &mut numbers2[..=2];\nslice_e[1] = 99;\n\nprintln!("===== after =====");\nprintln!("slice_e : {:?}", slice_e);\nprintln!("numbers2 : {:?}", numbers2);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"slice",src:n(7858).Z,width:"457",height:"189"})),(0,i.kt)("p",null,"Bisa dilihat, indeks ke-1 ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_e")," diubah nilainya yang sebelumnya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"16")," menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"99"),". Setelah itu di-print, di output nilai variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers2")," juga ikut berubah. Hal ini karena perubahan data pada variabel mutable reference juga punya pengaruh ke variabel pemilik data sebenarnya (yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers2"),")."),(0,i.kt)("p",null,"O iya, penggunaan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut")," mengharuskan kita untuk tidak menuliskan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"mut")," pada variabel yang menampung nilai borrowing."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"// statement yang direkomendasikan\nlet slice_e = &mut numbers2[..=2];\n\n// statement yang TIDAK DIREKOMENDASIKAN dan akan memunculkan warning.\nlet mut slice_e = &mut numbers2[..=2];\n")),(0,i.kt)("h2",{id:"a145-perulangan-for-in-pada-slice"},"A.14.5. Perulangan ",(0,i.kt)("inlineCode",{parentName:"h2"},"for in")," pada slice"),(0,i.kt)("p",null,"Slice merupakan tipe data yang implement trait Iterator (seperti array), dan semua data yang memiliki trait tersebut bisa digunakan pada perulangan. Slice ",(0,i.kt)("inlineCode",{parentName:"p"},"&[T]")," jika dipergunakan dalam ",(0,i.kt)("inlineCode",{parentName:"p"},"for in"),", tipe data penampung iterasi perulangan adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"&T"),", bukan ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," yaa jadi jangan sampai keliru."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let scores1 = [7, 8, 9];\n\nfor score in &scores1[..] {\n print!("{:?} ", score);\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"slice",src:n(6760).Z,width:"462",height:"272"})),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Sangat dianjurkan menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"rust-analyzer")," jika menggunakan VSCode, agar lebih mudah melihat tipe data variabel dan informasi penting lainnya yang berguna dalam proses coding atau development."),(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai traits dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai trait ",(0,i.kt)("inlineCode",{parentName:"li"},"Iterator")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/trait-iterator"},"Trait \u279c Iterator")))),(0,i.kt)("h2",{id:"a146-perulangan-for-in-pada-mutable-slice"},"A.14.6. Perulangan ",(0,i.kt)("inlineCode",{parentName:"h2"},"for in")," pada mutable slice"),(0,i.kt)("p",null,"Sama seperti penggunaan ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," pada shared slice, pada contoh kasus mutable slice perbedaannya hanyalah pada tipe data penampung iterasi yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut T"),", bukan ",(0,i.kt)("inlineCode",{parentName:"p"},"&T"),"."),(0,i.kt)("p",null,"Pada contoh berikut kita coba eksperimen mengubah nilai elemen sebuah mutable slice yang data aslinya juga hasil dari peminjaman mutable slice."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut scores2 = [7, 8, 9];\nprintln!("(before) scores2 : {:?}", scores2);\n\nlet slice_f = &mut scores2[..];\n\nfor score in &mut slice_f[..] {\n *score += 1;\n}\n\nprintln!("(after) scores2 : {:?}", scores2);\n')),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"scores")," dipinjam menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut")," ke variabel baru bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_f"),". Kemudian ",(0,i.kt)("inlineCode",{parentName:"p"},"slice_f")," dipinjam juga sebagai mutable slice pada perulangan ",(0,i.kt)("inlineCode",{parentName:"p"},"for in"),"."),(0,i.kt)("p",null,"Setelah di-increment nilainya menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"*score += 1")," bisa dilihat hasil akhirnya juga mengubah nilai variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"scores2")," yang merupakan ",(0,i.kt)("em",{parentName:"p"},"owner")," atau pemilik data sebenarnya."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"slice",src:n(4820).Z,width:"467",height:"376"})),(0,i.kt)("p",null,"Operasi increment pada ",(0,i.kt)("inlineCode",{parentName:"p"},"score")," tidak bisa dituliskan dalam bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"score += 1")," karena tipe data score adalah pointer mutable reference (ditandai dengan adanya ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut"),"), untuk increment nilainya perlu di-",(0,i.kt)("em",{parentName:"p"},"dereference")," terlebih dahulu menggunakan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"*"),". Lebih jelasnya kita bahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"),"."),(0,i.kt)("h2",{id:"a147-append-slice"},"A.14.7. Append slice"),(0,i.kt)("p",null,"Slice by default tidak mendukung operasi append. Sebenarnya bisa saja dilakukan tapi agak panjang caranya (silakan cari referensinya di Google untuk ini)."),(0,i.kt)("p",null,"Perlu diketahui, jika kebutuhannya adalah untuk menampung jenis data yang size-nya bisa bertamah, penulis anjurkan untuk menggunakan ",(0,i.kt)("a",{parentName:"p",href:"/basic/vector"},"Vector")," yang beberapa bab lagi akan kita bahas."),(0,i.kt)("h2",{id:"a148-memory-management-pada-slice"},"A.14.8. Memory management pada slice"),(0,i.kt)("p",null,"Nantinya setelah selesai dengan pembahasan dasar memory management di Rust, kita akan bahas lagi topik slice tapi dari sudut pandang memory management pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/slice-memory-management"},"Memory Management \u279c Slice"),"."),(0,i.kt)("h2",{id:"a149-summary"},"A.14.9. Summary"),(0,i.kt)("p",null,"Catatan ringkas perihal slice:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Slice memiliki notasi ",(0,i.kt)("inlineCode",{parentName:"li"},"&[T]"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"&")," di situ artinya adalah operasi borrowing/peminjaman"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"T")," adalah tipe data tiap elemen"))),(0,i.kt)("li",{parentName:"ul"},"Slice bisa terbentuk dari hasil meminjam data array, vector, atau tipe data kolektif lainnya"),(0,i.kt)("li",{parentName:"ul"},"Data slice adalah selalu data pinjaman"),(0,i.kt)("li",{parentName:"ul"},"Slice memiliki lebar/size"),(0,i.kt)("li",{parentName:"ul"},"Slicing adalah cara pengaksesan slice menggunakan ",(0,i.kt)("em",{parentName:"li"},"range syntax")),(0,i.kt)("li",{parentName:"ul"},"Slice bisa immutable, bisa juga mutable (menggunakan ",(0,i.kt)("inlineCode",{parentName:"li"},"&mut"),")")),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/slice"},"github.com/novalagung/dasarpemrogramanrust-example/../slice")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch04-03-slices.html#the-slice-type"},"https://doc.rust-lang.org/book/ch04-03-slices.html#the-slice-type")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/primitive.slice.html"},"https://doc.rust-lang.org/std/primitive.slice.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/iter/trait.Iterator.html"},"https://doc.rust-lang.org/std/iter/trait.Iterator.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/types/slice.html"},"https://doc.rust-lang.org/reference/types/slice.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/nomicon/references.html"},"https://doc.rust-lang.org/nomicon/references.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/primitives/array.html"},"https://doc.rust-lang.org/rust-by-example/primitives/array.html"))))}A.isMDXComponent=!0},8493:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc8AAAEACAIAAABapGodAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMDktMjdUMTY6MjA6MDErMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyM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/slice-5-541f1e4111281ebbac474d8d9828c0e8.png"},4820:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/slice-6-393c62bd8cdd9da05fcae56436a3cacd.png"}}]); \ No newline at end of file diff --git a/assets/js/68e1906b.57a9a7b8.js b/assets/js/68e1906b.57a9a7b8.js deleted file mode 100644 index ff557937..00000000 --- a/assets/js/68e1906b.57a9a7b8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4758],{3905:(e,a,t)=>{t.d(a,{Zo:()=>o,kt:()=>c});var n=t(7294);function r(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function i(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function l(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?i(Object(t),!0).forEach((function(a){r(e,a,t[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}))}return e}function d(e,a){if(null==e)return{};var t,n,r=function(e,a){if(null==e)return{};var t,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],a.indexOf(t)>=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],a.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var p=n.createContext({}),m=function(e){var a=n.useContext(p),t=a;return e&&(t="function"==typeof e?e(a):l(l({},a),e)),t},o=function(e){var a=m(e.components);return n.createElement(p.Provider,{value:a},e.children)},u={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},s=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,o=d(e,["components","mdxType","originalType","parentName"]),s=m(t),c=r,A=s["".concat(p,".").concat(c)]||s[c]||u[c]||i;return t?n.createElement(A,l(l({ref:a},o),{},{components:t})):n.createElement(A,l({ref:a},o))}));function c(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var i=t.length,l=new Array(i);l[0]=s;var d={};for(var p in a)hasOwnProperty.call(a,p)&&(d[p]=a[p]);d.originalType=e,d.mdxType="string"==typeof e?e:r,l[1]=d;for(var m=2;m<i;m++)l[m]=t[m];return n.createElement.apply(null,l)}return n.createElement.apply(null,t)}s.displayName="MDXCreateElement"},7630:(e,a,t)=>{t.r(a),t.d(a,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>i,metadata:()=>d,toc:()=>m});var n=t(7462),r=(t(7294),t(3905));const i={sidebar_position:25,title:"A.25. Method",sidebar_label:"A.25. Method"},l=void 0,d={unversionedId:"basic/method",id:"basic/method",title:"A.25. Method",description:"Pada chapter ini kita akan belajar tentang method beserta perbedaannya dengan associated function.",source:"@site/docs/basic/method.md",sourceDirName:"basic",slug:"/basic/method",permalink:"/basic/method",draft:!1,tags:[],version:"current",sidebarPosition:25,frontMatter:{sidebar_position:25,title:"A.25. Method",sidebar_label:"A.25. Method"},sidebar:"tutorialSidebar",previous:{title:"A.24. Associated Function",permalink:"/basic/associated-function"},next:{title:"A.26. Enum",permalink:"/basic/enum"}},p={},m=[{value:"A.25.1. Method vs <em>associated function</em>",id:"a251-method-vs-associated-function",level:2},{value:"A.25.2. Deklarasi method",id:"a252-deklarasi-method",level:2},{value:"\u25c9 <em>Naming convention</em> method",id:"-naming-convention-method",level:3},{value:"A.25.3. Method parameter",id:"a253-method-parameter",level:2},{value:"A.25.4. Struct property mutability via method",id:"a254-struct-property-mutability-via-method",level:2},{value:"A.25.5. Generic pada method",id:"a255-generic-pada-method",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],o={toc:m};function u(e){let{components:a,...i}=e;return(0,r.kt)("wrapper",(0,n.Z)({},o,i,{components:a,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Pada chapter ini kita akan belajar tentang method beserta perbedaannya dengan ",(0,r.kt)("em",{parentName:"p"},"associated function"),"."),(0,r.kt)("h2",{id:"a251-method-vs-associated-function"},"A.25.1. Method vs ",(0,r.kt)("em",{parentName:"h2"},"associated function")),(0,r.kt)("p",null,"Method adalah ",(0,r.kt)("em",{parentName:"p"},"associated item")," yang hanya bisa diakses lewat instance/object, berbeda dengan ",(0,r.kt)("em",{parentName:"p"},"associated function")," yang pengaksesan fungsinya via tipe data struct."),(0,r.kt)("p",null,"Silakan lihat ilustrasi kode berikut, lalu pelajari penjelasan di bawahnya untuk mencari tau perbedaan ",(0,r.kt)("em",{parentName:"p"},"associated function")," vs method."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"struct Car {\n // ...\n}\n\nimpl Car {\n // ...\n}\n\n// associated function\nlet my_car: Car = Car::new();\n\n// method\nlet info: String = my_car.info();\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Fungsi ",(0,r.kt)("inlineCode",{parentName:"li"},"new")," di situ adalah ",(0,r.kt)("em",{parentName:"li"},"associated function")," milik struct ",(0,r.kt)("inlineCode",{parentName:"li"},"Car"),". Dengannya object baru bernama ",(0,r.kt)("inlineCode",{parentName:"li"},"my_car")," bertipe ",(0,r.kt)("inlineCode",{parentName:"li"},"Car")," dibuat."),(0,r.kt)("li",{parentName:"ul"},"Object ",(0,r.kt)("inlineCode",{parentName:"li"},"my_car")," adalah variabel bertipe ",(0,r.kt)("inlineCode",{parentName:"li"},"Car"),". Via object tersebut method bernama ",(0,r.kt)("inlineCode",{parentName:"li"},"info")," diakses."),(0,r.kt)("li",{parentName:"ul"},"Method ",(0,r.kt)("inlineCode",{parentName:"li"},"info")," tidak bisa diakses via struct ",(0,r.kt)("inlineCode",{parentName:"li"},"Car"),". Dan ",(0,r.kt)("em",{parentName:"li"},"associated function")," ",(0,r.kt)("inlineCode",{parentName:"li"},"new")," juga tidak bisa diakses dari instance/object ",(0,r.kt)("inlineCode",{parentName:"li"},"my_car"),".")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Di bahasa pemrograman lain, ",(0,r.kt)("em",{parentName:"p"},"associated function")," disebut dengan ",(0,r.kt)("strong",{parentName:"p"},"class method"),", sedangkan method disebut dengan ",(0,r.kt)("strong",{parentName:"p"},"instance method"))),(0,r.kt)("p",null,"Pengaksesan ",(0,r.kt)("em",{parentName:"p"},"associated function")," dilakukan menggunakan notasi path dengan separator ",(0,r.kt)("inlineCode",{parentName:"p"},"::"),", contohnya seperti ",(0,r.kt)("inlineCode",{parentName:"p"},"Car::new()"),". Sedangkan pengaksesan method menggunakan separator ",(0,r.kt)("inlineCode",{parentName:"p"},"."),", contoh: ",(0,r.kt)("inlineCode",{parentName:"p"},"my_car.info()"),"."),(0,r.kt)("p",null,"Agar lebih jelas, mari lanjut ke bagian praktik. Siapkan package dengan struktur seperti berikut:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 main.rs\n \u2514\u2500\u2500\u2500 models.rs\n")),(0,r.kt)("p",null,"Buka file ",(0,r.kt)("inlineCode",{parentName:"p"},"models.rs"),", isi dengan deklarasi struct ",(0,r.kt)("inlineCode",{parentName:"p"},"Car")," berikut diikuti dengan blok kode ",(0,r.kt)("inlineCode",{parentName:"p"},"impl")," untuk associated items-nya."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/models.rs"',title:'"src/models.rs"'},"#[derive(Debug)]\npub struct Car {\n brand: String,\n model: String,\n manufacture_year: i32\n}\n\nimpl Car {\n // ...\n}\n")),(0,r.kt)("h2",{id:"a252-deklarasi-method"},"A.25.2. Deklarasi method"),(0,r.kt)("p",null,"Cara deklarasi method mirip dengan ",(0,r.kt)("em",{parentName:"p"},"associated function"),", perbedaannya adalah parameter pertama harus diisi dengan ",(0,r.kt)("inlineCode",{parentName:"p"},"&self")," pada deklarasi method. Parameter tersebut menjadi identifier apakah fungsi merupakan ",(0,r.kt)("em",{parentName:"p"},"associated function")," atau ",(0,r.kt)("em",{parentName:"p"},"method"),"."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Object ",(0,r.kt)("inlineCode",{parentName:"p"},"self")," merupakan representasi dari ",(0,r.kt)("em",{parentName:"p"},"current instance")," atau ",(0,r.kt)("em",{parentName:"p"},"current object"),"."),(0,r.kt)("p",{parentName:"blockquote"},"Statement ",(0,r.kt)("inlineCode",{parentName:"p"},"&self")," artinya kita melakukan operasi ",(0,r.kt)("em",{parentName:"p"},"borrowing")," terhadap object ",(0,r.kt)("inlineCode",{parentName:"p"},"self"),"."),(0,r.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai borrowing dibahas pada chapter terpisah.")),(0,r.kt)("p",null,"Silakan tambahkan ",(0,r.kt)("em",{parentName:"p"},"associated function")," bernama ",(0,r.kt)("inlineCode",{parentName:"p"},"new")," dan method bernama ",(0,r.kt)("inlineCode",{parentName:"p"},"info")," berikut. Tulis keduanya dalam blok kode ",(0,r.kt)("inlineCode",{parentName:"p"},"impl"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/models.rs"',title:'"src/models.rs"'},'// ...\n\nimpl Car {\n \n pub fn new(brand: String, model: String) -> Self {\n Self { brand, model, manufacture_year: 0 }\n }\n\n pub fn info(&self) -> String {\n if self.manufacture_year == 0 {\n format!("{} model {}", self.brand, self.model)\n } else {\n format!(\n "{} model {}, manufactured at {}",\n self.brand,\n self.model,\n self.manufacture_year\n )\n }\n }\n}\n')),(0,r.kt)("p",null,"Bisa dilihat, deklarasi method adalah mirip dengan fungsi biasa, perbedaannya ada pada deklarasi parameter pertama fungsi yang diisi dengan ",(0,r.kt)("inlineCode",{parentName:"p"},"&self"),"."),(0,r.kt)("p",null,"Cara mengakses property milik ",(0,r.kt)("em",{parentName:"p"},"current object")," dari dalam method adalah menggunakan keyword ",(0,r.kt)("inlineCode",{parentName:"p"},"self"),", contohnya seperti ",(0,r.kt)("inlineCode",{parentName:"p"},"self.brand"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"self.model"),", dan ",(0,r.kt)("inlineCode",{parentName:"p"},"self.manufacture_year"),", pemanggilan ketiganya adalah mengarah ke value property milik ",(0,r.kt)("em",{parentName:"p"},"current object")," (",(0,r.kt)("inlineCode",{parentName:"p"},"self"),")."),(0,r.kt)("p",null,"Selanjutnya panggil keduanya di fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod models;\n\nfn main() {\n let car = models::Car::new(\n String::from("Mercedes-Benz"),\n String::from("Vision Gran Turismo")\n );\n println!("car: {:?}", car);\n\n let info = car.info();\n println!("info: {:?}", info);\n}\n')),(0,r.kt)("p",null,"Bisa dilihat, variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"car")," adalah instance dari struct ",(0,r.kt)("inlineCode",{parentName:"p"},"models::Car"),", dibuat menggunakan ",(0,r.kt)("em",{parentName:"p"},"associated function")," ",(0,r.kt)("inlineCode",{parentName:"p"},"models::Car::new"),". Dari variabel tersebut kemudian diakses method ",(0,r.kt)("inlineCode",{parentName:"p"},"info"),"."),(0,r.kt)("p",null,"Jalankan program untuk melihat hasilnya."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Method",src:t(2693).Z,width:"626",height:"110"})),(0,r.kt)("h3",{id:"-naming-convention-method"},"\u25c9 ",(0,r.kt)("em",{parentName:"h3"},"Naming convention")," method"),(0,r.kt)("p",null,"Sesuai anjuran di ",(0,r.kt)("a",{parentName:"p",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"halaman dokumentasi Rust"),", snake case digunakan dalam penamaan method. Contoh:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"impl NamaStruct {\n\n fn nama_method(&self) {\n // ...\n }\n}\n")),(0,r.kt)("h2",{id:"a253-method-parameter"},"A.25.3. Method parameter"),(0,r.kt)("p",null,"Ok, penulis rasa sudah cukup jelas perihal perbedaan ",(0,r.kt)("em",{parentName:"p"},"associated function")," dengan method. Sekarang, bagaimana dengan method yang ada parameternya? Cara deklarasinya adalah cukup dengan menuliskan parameter yang diinginkan setelah ",(0,r.kt)("inlineCode",{parentName:"p"},"&self"),"."),(0,r.kt)("p",null,"Lanjut ke praktik berikutnya. Silakan buat method baru bernama ",(0,r.kt)("inlineCode",{parentName:"p"},"congratulate")," yang memiliki 1 buah parameter bertipe ",(0,r.kt)("inlineCode",{parentName:"p"},"String"),", dengan tugas adalah menampilkan pesan selamat."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/models.rs"',title:'"src/models.rs"'},'// ...\n\nimpl Car {\n \n // ...\n \n pub fn congratulate(&self, name: String) {\n println!("hello {}", name);\n println!("congrats with your new car {}", self.info());\n println!("vroooom vroooooooommmmm!");\n }\n}\n')),(0,r.kt)("p",null,"Dalam method ",(0,r.kt)("inlineCode",{parentName:"p"},"congratulate")," ada statement pemanggilan method ",(0,r.kt)("inlineCode",{parentName:"p"},"info"),", yang return value-nya ikut di-print. Notasi ",(0,r.kt)("inlineCode",{parentName:"p"},"self.nama_method()")," digunakan untuk pemanggilan method dari dalam method. Mirip seperti pemanggilan property yaitu ",(0,r.kt)("inlineCode",{parentName:"p"},"self.nama_property"),"."),(0,r.kt)("p",null,"Selanjutnya, panggil method ",(0,r.kt)("inlineCode",{parentName:"p"},"congratulate")," di fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main"),". Isi argumen pemanggilan method dengan sebuah ",(0,r.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'// ...\n\nfn main() {\n let car = models::Car::new(\n String::from("Mercedes-Benz"),\n String::from("Vision Gran Turismo")\n );\n\n car.congratulate(String::from("Sylvanas Windrunner"));\n}\n')),(0,r.kt)("p",null,"Meskipun pada definisi method parameter pertama adalah ",(0,r.kt)("inlineCode",{parentName:"p"},"&self"),", pada saat pemanggilan method yang menjadi parameter pertama adalah parameter setelah ",(0,r.kt)("inlineCode",{parentName:"p"},"&self")," yaitu ",(0,r.kt)("inlineCode",{parentName:"p"},"name"),"."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Method",src:t(1460).Z,width:"487",height:"128"})),(0,r.kt)("h2",{id:"a254-struct-property-mutability-via-method"},"A.25.4. Struct property mutability via method"),(0,r.kt)("p",null,"Nilai property struct bisa diubah dari dalam method. Pada bagian ini kita akan buat method baru untuk struct ",(0,r.kt)("inlineCode",{parentName:"p"},"Car")," dengan nama ",(0,r.kt)("inlineCode",{parentName:"p"},"set_manufacture_year"),". Method ini bertugas untuk melakukan perubahan nilai property ",(0,r.kt)("inlineCode",{parentName:"p"},"manufacture_year"),"."),(0,r.kt)("p",null,"Silakan tulis kode berikut:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/models.rs"',title:'"src/models.rs"'},"// ...\n\nimpl Car {\n \n // ...\n \n pub fn set_manufacture_year(&self, year: i32) {\n self.manufacture_year = year\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Method",src:t(2653).Z,width:"678",height:"195"})),(0,r.kt)("p",null,"Hmm, tapi kenapa terdeteksi error? Penyebabnya error tersebut adalah karena ",(0,r.kt)("strong",{parentName:"p"},"mutable reference")," tidak digunakan dalam pengaksesan current object yang padahal ada operasi ",(0,r.kt)("em",{parentName:"p"},"mutable")," atau perubahan nilai terhadap property di situ. Syntax ",(0,r.kt)("inlineCode",{parentName:"p"},"&self")," artinya operasi peminjaman object ",(0,r.kt)("inlineCode",{parentName:"p"},"self")," adalah ",(0,r.kt)("em",{parentName:"p"},"read only"),"."),(0,r.kt)("p",null,"Cara mengambil mutable reference dari object ",(0,r.kt)("inlineCode",{parentName:"p"},"self")," adalah dengan menggunakan ",(0,r.kt)("inlineCode",{parentName:"p"},"&mut self"),". Cara tersebut kurang lebih sama seperti pengambilan mutable reference dari variabel biasa."),(0,r.kt)("p",null,"Ok, sekarang kita coba modifikasi deklarasi method ",(0,r.kt)("inlineCode",{parentName:"p"},"set_manufacture_year")," menjadi seperti berikut:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/models.rs"',title:'"src/models.rs"'},"// ...\n\nimpl Car {\n \n // ...\n \n pub fn set_manufacture_year(&mut self, year: i32) {\n self.manufacture_year = year\n }\n}\n")),(0,r.kt)("p",null,"Lalu panggil method ",(0,r.kt)("inlineCode",{parentName:"p"},"set_manufacture_year")," di fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'// ...\n\nfn main() {\n let mut car = models::Car::new(\n String::from("Mercedes-Benz"),\n String::from("Vision Gran Turismo")\n );\n\n let info = car.info();\n println!("info: {:?}", info);\n\n car.set_manufacture_year(2013);\n let detailed_info = car.info();\n println!("detailed info: {:?}", detailed_info);\n}\n')),(0,r.kt)("p",null,"Jalankan program, lihat hasilnya."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Method",src:t(7797).Z,width:"570",height:"109"})),(0,r.kt)("p",null,"Setelah ",(0,r.kt)("inlineCode",{parentName:"p"},"manufacture_year")," di-set, method ",(0,r.kt)("inlineCode",{parentName:"p"},"info")," mengembalikan pesan yang berbeda. Dari sini bisa disimpulkan bahwa method ",(0,r.kt)("inlineCode",{parentName:"p"},"set_manufacture_year")," sukses menjalankan tugasnya untuk mengubah property ",(0,r.kt)("inlineCode",{parentName:"p"},"manufacture_year"),"."),(0,r.kt)("h2",{id:"a255-generic-pada-method"},"A.25.5. Generic pada method"),(0,r.kt)("p",null,"Pembahasan mengenai generic pada method ada pada chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/generics#a366-generics-method"},"Generics"),"."),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,r.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,r.kt)("pre",null,(0,r.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/method"},"github.com/novalagung/dasarpemrogramanrust-example/../method")),(0,r.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch05-03-method-syntax.html"},"https://doc.rust-lang.org/book/ch05-03-method-syntax.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.impl.html"},"https://doc.rust-lang.org/std/keyword.impl.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.SelfTy.html"},"https://doc.rust-lang.org/std/keyword.SelfTy.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.self.html"},"https://doc.rust-lang.org/std/keyword.self.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/fn/methods.html"},"https://doc.rust-lang.org/rust-by-example/fn/methods.html"))))}u.isMDXComponent=!0},2693:(e,a,t)=>{t.d(a,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAnIAAABuCAIAAAAsx2kLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTAtMjlUMTY6NDg6NDYrMDc6MDAiIHht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O76kFXyKob4nbMy2DY/UzqX6DrURgtoIIYSgNkIIIaiNEEJQGyGEENRGCCEEtRFCCGojhBCC2gghhKA2QghBbYQQQlAbIYQQ1EYIIaiNEEIIaiOEECqq/wFIh6r0VqkeMQAAAABJRU5ErkJggg=="},2653:(e,a,t)=>{t.d(a,{Z:()=>n});const n=t.p+"assets/images/method-3-2b2f604aaaa2cd04220b106aec22800d.png"},7797:(e,a,t)=>{t.d(a,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjoAAABtCAIAAAAnPlzxAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclR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AONy6hO17VbVHxrdb+2d9y5xuTRLJfudfQzYvfuk12/HTnepiSN2yjC6JprvjfCWxFsSb8lT9JaU0mwXnYwNIlRTm9zlaU0xY0hb6KTbc+EEqE2/+eqxy9M90y1xOipfHGDa5CrTu2/6WffUpR5laHRNzJMrvCWjuAFvSXG2xlvy4mi8JdV3/hobJCu6ktO0zdXW9iw1Aca55srHWDYvBhzvCRS5KrG9aalcJS0KpQEiB57TcmV3TawkV3hL4i2Jt+SxeEtqcmVtkBy5EtJUNc0uVxOT54wJUJl+s+TKu9sIIip9DaHs09CFcqU6x/llSt3/2eTK5pq4QnSFtyTeknhLHrK35LQBWKnoajrNcnK1ZAJUp9+8mEwxbpOXLpR0F97tvzMPgQzvPmlXVex0Z+8Lu2tiBbnCWzIlV3hLTjQd3pKplHO9JS2Xup6mrUHkamozQzytacNOXCKztefCCVCdfo3BTqhV4WfSmFe3Wiy62TfvDLR690XBZ7hj0HO6mzCgU5z6kq6Jk5Ew3pIXeEviLXmc3pLR3a552GQ0iFRNcWaQ0tSuTWFWNLfnwglQLWdi66x6vUs7LcXLzX0iUOpbmryECQCOhvQ6NZw2yBUAHItSoVXIFQAAAHIFAACAXAEAAHIFAACAXAEAACBXAACAXAEAACBXAAAAyBUAACBXAAAAyBUAAJwb/wPjXPAdfiGIFQAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/68e1906b.8899b955.js b/assets/js/68e1906b.8899b955.js new file mode 100644 index 00000000..f3da0e60 --- /dev/null +++ b/assets/js/68e1906b.8899b955.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4758],{3905:(e,a,t)=>{t.d(a,{Zo:()=>o,kt:()=>c});var n=t(7294);function r(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function i(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function l(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?i(Object(t),!0).forEach((function(a){r(e,a,t[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}))}return e}function d(e,a){if(null==e)return{};var t,n,r=function(e,a){if(null==e)return{};var t,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],a.indexOf(t)>=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],a.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var p=n.createContext({}),m=function(e){var a=n.useContext(p),t=a;return e&&(t="function"==typeof e?e(a):l(l({},a),e)),t},o=function(e){var a=m(e.components);return n.createElement(p.Provider,{value:a},e.children)},u={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},s=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,o=d(e,["components","mdxType","originalType","parentName"]),s=m(t),c=r,A=s["".concat(p,".").concat(c)]||s[c]||u[c]||i;return t?n.createElement(A,l(l({ref:a},o),{},{components:t})):n.createElement(A,l({ref:a},o))}));function c(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var i=t.length,l=new Array(i);l[0]=s;var d={};for(var p in a)hasOwnProperty.call(a,p)&&(d[p]=a[p]);d.originalType=e,d.mdxType="string"==typeof e?e:r,l[1]=d;for(var m=2;m<i;m++)l[m]=t[m];return n.createElement.apply(null,l)}return n.createElement.apply(null,t)}s.displayName="MDXCreateElement"},7630:(e,a,t)=>{t.r(a),t.d(a,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>i,metadata:()=>d,toc:()=>m});var n=t(7462),r=(t(7294),t(3905));const i={sidebar_position:25,title:"A.25. Method",sidebar_label:"A.25. Method"},l=void 0,d={unversionedId:"basic/method",id:"basic/method",title:"A.25. Method",description:"Pada chapter ini kita akan belajar tentang method beserta perbedaannya dengan associated function.",source:"@site/docs/basic/method.md",sourceDirName:"basic",slug:"/basic/method",permalink:"/basic/method",draft:!1,tags:[],version:"current",sidebarPosition:25,frontMatter:{sidebar_position:25,title:"A.25. Method",sidebar_label:"A.25. Method"},sidebar:"tutorialSidebar",previous:{title:"A.24. Associated Function",permalink:"/basic/associated-function"},next:{title:"A.26. Enum",permalink:"/basic/enum"}},p={},m=[{value:"A.25.1. Method vs <em>associated function</em>",id:"a251-method-vs-associated-function",level:2},{value:"A.25.2. Deklarasi method",id:"a252-deklarasi-method",level:2},{value:"\u25c9 <em>Naming convention</em> method",id:"-naming-convention-method",level:3},{value:"A.25.3. Method parameter",id:"a253-method-parameter",level:2},{value:"A.25.4. Struct property mutability via method",id:"a254-struct-property-mutability-via-method",level:2},{value:"A.25.5. Generic pada method",id:"a255-generic-pada-method",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],o={toc:m};function u(e){let{components:a,...i}=e;return(0,r.kt)("wrapper",(0,n.Z)({},o,i,{components:a,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Pada chapter ini kita akan belajar tentang method beserta perbedaannya dengan ",(0,r.kt)("em",{parentName:"p"},"associated function"),"."),(0,r.kt)("h2",{id:"a251-method-vs-associated-function"},"A.25.1. Method vs ",(0,r.kt)("em",{parentName:"h2"},"associated function")),(0,r.kt)("p",null,"Method adalah ",(0,r.kt)("em",{parentName:"p"},"associated item")," yang hanya bisa diakses lewat instance/object, berbeda dengan ",(0,r.kt)("em",{parentName:"p"},"associated function")," yang pengaksesan fungsinya via tipe data struct."),(0,r.kt)("p",null,"Silakan lihat ilustrasi kode berikut, lalu pelajari penjelasan di bawahnya untuk mencari tau perbedaan ",(0,r.kt)("em",{parentName:"p"},"associated function")," vs method."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"struct Car {\n // ...\n}\n\nimpl Car {\n // ...\n}\n\n// associated function\nlet my_car: Car = Car::new();\n\n// method\nlet info: String = my_car.info();\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Fungsi ",(0,r.kt)("inlineCode",{parentName:"li"},"new")," di situ adalah ",(0,r.kt)("em",{parentName:"li"},"associated function")," milik struct ",(0,r.kt)("inlineCode",{parentName:"li"},"Car"),". Dengannya object baru bernama ",(0,r.kt)("inlineCode",{parentName:"li"},"my_car")," bertipe ",(0,r.kt)("inlineCode",{parentName:"li"},"Car")," dibuat."),(0,r.kt)("li",{parentName:"ul"},"Object ",(0,r.kt)("inlineCode",{parentName:"li"},"my_car")," adalah variabel bertipe ",(0,r.kt)("inlineCode",{parentName:"li"},"Car"),". Via object tersebut method bernama ",(0,r.kt)("inlineCode",{parentName:"li"},"info")," diakses."),(0,r.kt)("li",{parentName:"ul"},"Method ",(0,r.kt)("inlineCode",{parentName:"li"},"info")," tidak bisa diakses via struct ",(0,r.kt)("inlineCode",{parentName:"li"},"Car"),". Dan ",(0,r.kt)("em",{parentName:"li"},"associated function")," ",(0,r.kt)("inlineCode",{parentName:"li"},"new")," juga tidak bisa diakses dari instance/object ",(0,r.kt)("inlineCode",{parentName:"li"},"my_car"),".")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Di bahasa pemrograman lain, ",(0,r.kt)("em",{parentName:"p"},"associated function")," disebut dengan ",(0,r.kt)("strong",{parentName:"p"},"class method"),", sedangkan method disebut dengan ",(0,r.kt)("strong",{parentName:"p"},"instance method"))),(0,r.kt)("p",null,"Pengaksesan ",(0,r.kt)("em",{parentName:"p"},"associated function")," dilakukan menggunakan notasi path dengan separator ",(0,r.kt)("inlineCode",{parentName:"p"},"::"),", contohnya seperti ",(0,r.kt)("inlineCode",{parentName:"p"},"Car::new()"),". Sedangkan pengaksesan method menggunakan separator ",(0,r.kt)("inlineCode",{parentName:"p"},"."),", contoh: ",(0,r.kt)("inlineCode",{parentName:"p"},"my_car.info()"),"."),(0,r.kt)("p",null,"Agar lebih jelas, mari lanjut ke bagian praktik. Siapkan package dengan struktur seperti berikut:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 main.rs\n \u2514\u2500\u2500\u2500 models.rs\n")),(0,r.kt)("p",null,"Buka file ",(0,r.kt)("inlineCode",{parentName:"p"},"models.rs"),", isi dengan deklarasi struct ",(0,r.kt)("inlineCode",{parentName:"p"},"Car")," berikut diikuti dengan blok kode ",(0,r.kt)("inlineCode",{parentName:"p"},"impl")," untuk associated items-nya."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/models.rs"',title:'"src/models.rs"'},"#[derive(Debug)]\npub struct Car {\n brand: String,\n model: String,\n manufacture_year: i32\n}\n\nimpl Car {\n // ...\n}\n")),(0,r.kt)("h2",{id:"a252-deklarasi-method"},"A.25.2. Deklarasi method"),(0,r.kt)("p",null,"Cara deklarasi method mirip dengan ",(0,r.kt)("em",{parentName:"p"},"associated function"),", perbedaannya adalah parameter pertama harus diisi dengan ",(0,r.kt)("inlineCode",{parentName:"p"},"&self")," pada deklarasi method. Parameter tersebut menjadi identifier apakah fungsi merupakan ",(0,r.kt)("em",{parentName:"p"},"associated function")," atau ",(0,r.kt)("em",{parentName:"p"},"method"),"."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Object ",(0,r.kt)("inlineCode",{parentName:"p"},"self")," merupakan representasi dari ",(0,r.kt)("em",{parentName:"p"},"current instance")," atau ",(0,r.kt)("em",{parentName:"p"},"current object"),"."),(0,r.kt)("p",{parentName:"blockquote"},"Statement ",(0,r.kt)("inlineCode",{parentName:"p"},"&self")," artinya kita melakukan operasi ",(0,r.kt)("em",{parentName:"p"},"borrowing")," terhadap object ",(0,r.kt)("inlineCode",{parentName:"p"},"self"),"."),(0,r.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai borrowing dibahas pada chapter terpisah.")),(0,r.kt)("p",null,"Silakan tambahkan ",(0,r.kt)("em",{parentName:"p"},"associated function")," bernama ",(0,r.kt)("inlineCode",{parentName:"p"},"new")," dan method bernama ",(0,r.kt)("inlineCode",{parentName:"p"},"info")," berikut. Tulis keduanya dalam blok kode ",(0,r.kt)("inlineCode",{parentName:"p"},"impl"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/models.rs"',title:'"src/models.rs"'},'// ...\n\nimpl Car {\n \n pub fn new(brand: String, model: String) -> Self {\n Self { brand, model, manufacture_year: 0 }\n }\n\n pub fn info(&self) -> String {\n if self.manufacture_year == 0 {\n format!("{} model {}", self.brand, self.model)\n } else {\n format!(\n "{} model {}, manufactured at {}",\n self.brand,\n self.model,\n self.manufacture_year\n )\n }\n }\n}\n')),(0,r.kt)("p",null,"Bisa dilihat, deklarasi method adalah mirip dengan fungsi biasa, perbedaannya ada pada deklarasi parameter pertama fungsi yang diisi dengan ",(0,r.kt)("inlineCode",{parentName:"p"},"&self"),"."),(0,r.kt)("p",null,"Cara mengakses property milik ",(0,r.kt)("em",{parentName:"p"},"current object")," dari dalam method adalah menggunakan keyword ",(0,r.kt)("inlineCode",{parentName:"p"},"self"),", contohnya seperti ",(0,r.kt)("inlineCode",{parentName:"p"},"self.brand"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"self.model"),", dan ",(0,r.kt)("inlineCode",{parentName:"p"},"self.manufacture_year"),", pemanggilan ketiganya adalah mengarah ke value property milik ",(0,r.kt)("em",{parentName:"p"},"current object")," (",(0,r.kt)("inlineCode",{parentName:"p"},"self"),")."),(0,r.kt)("p",null,"Selanjutnya panggil keduanya di fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod models;\n\nfn main() {\n let car = models::Car::new(\n String::from("Mercedes-Benz"),\n String::from("Vision Gran Turismo")\n );\n println!("car: {:?}", car);\n\n let info = car.info();\n println!("info: {:?}", info);\n}\n')),(0,r.kt)("p",null,"Bisa dilihat, variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"car")," adalah instance dari struct ",(0,r.kt)("inlineCode",{parentName:"p"},"models::Car"),", dibuat menggunakan ",(0,r.kt)("em",{parentName:"p"},"associated function")," ",(0,r.kt)("inlineCode",{parentName:"p"},"models::Car::new"),". Dari variabel tersebut kemudian diakses method ",(0,r.kt)("inlineCode",{parentName:"p"},"info"),"."),(0,r.kt)("p",null,"Jalankan program untuk melihat hasilnya."),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Method",src:t(2693).Z,width:"626",height:"110"})),(0,r.kt)("h3",{id:"-naming-convention-method"},"\u25c9 ",(0,r.kt)("em",{parentName:"h3"},"Naming convention")," method"),(0,r.kt)("p",null,"Sesuai anjuran di ",(0,r.kt)("a",{parentName:"p",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"halaman dokumentasi Rust"),", snake case digunakan dalam penamaan method. Contoh:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"impl NamaStruct {\n\n fn nama_method(&self) {\n // ...\n }\n}\n")),(0,r.kt)("h2",{id:"a253-method-parameter"},"A.25.3. Method parameter"),(0,r.kt)("p",null,"Ok, penulis rasa sudah cukup jelas perihal perbedaan ",(0,r.kt)("em",{parentName:"p"},"associated function")," dengan method. Sekarang, bagaimana dengan method yang ada parameternya? Cara deklarasinya adalah cukup dengan menuliskan parameter yang diinginkan setelah ",(0,r.kt)("inlineCode",{parentName:"p"},"&self"),"."),(0,r.kt)("p",null,"Lanjut ke praktik berikutnya. Silakan buat method baru bernama ",(0,r.kt)("inlineCode",{parentName:"p"},"congratulate")," yang memiliki 1 buah parameter bertipe ",(0,r.kt)("inlineCode",{parentName:"p"},"String"),", dengan tugas adalah menampilkan pesan selamat."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/models.rs"',title:'"src/models.rs"'},'// ...\n\nimpl Car {\n \n // ...\n \n pub fn congratulate(&self, name: String) {\n println!("hello {}", name);\n println!("congrats with your new car {}", self.info());\n println!("vroooom vroooooooommmmm!");\n }\n}\n')),(0,r.kt)("p",null,"Dalam method ",(0,r.kt)("inlineCode",{parentName:"p"},"congratulate")," ada statement pemanggilan method ",(0,r.kt)("inlineCode",{parentName:"p"},"info"),", yang return value-nya ikut di-print. Notasi ",(0,r.kt)("inlineCode",{parentName:"p"},"self.nama_method()")," digunakan untuk pemanggilan method dari dalam method. Mirip seperti pemanggilan property yaitu ",(0,r.kt)("inlineCode",{parentName:"p"},"self.nama_property"),"."),(0,r.kt)("p",null,"Selanjutnya, panggil method ",(0,r.kt)("inlineCode",{parentName:"p"},"congratulate")," di fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main"),". Isi argumen pemanggilan method dengan sebuah ",(0,r.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'// ...\n\nfn main() {\n let car = models::Car::new(\n String::from("Mercedes-Benz"),\n String::from("Vision Gran Turismo")\n );\n\n car.congratulate(String::from("Sylvanas Windrunner"));\n}\n')),(0,r.kt)("p",null,"Meskipun pada definisi method parameter pertama adalah ",(0,r.kt)("inlineCode",{parentName:"p"},"&self"),", pada saat pemanggilan method yang menjadi parameter pertama adalah parameter setelah ",(0,r.kt)("inlineCode",{parentName:"p"},"&self")," yaitu ",(0,r.kt)("inlineCode",{parentName:"p"},"name"),"."),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"lazy",alt:"Method",src:t(1460).Z,width:"487",height:"128"})),(0,r.kt)("h2",{id:"a254-struct-property-mutability-via-method"},"A.25.4. Struct property mutability via method"),(0,r.kt)("p",null,"Nilai property struct bisa diubah dari dalam method. Pada bagian ini kita akan buat method baru untuk struct ",(0,r.kt)("inlineCode",{parentName:"p"},"Car")," dengan nama ",(0,r.kt)("inlineCode",{parentName:"p"},"set_manufacture_year"),". Method ini bertugas untuk melakukan perubahan nilai property ",(0,r.kt)("inlineCode",{parentName:"p"},"manufacture_year"),"."),(0,r.kt)("p",null,"Silakan tulis kode berikut:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/models.rs"',title:'"src/models.rs"'},"// ...\n\nimpl Car {\n \n // ...\n \n pub fn set_manufacture_year(&self, year: i32) {\n self.manufacture_year = year\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"lazy",alt:"Method",src:t(2653).Z,width:"678",height:"195"})),(0,r.kt)("p",null,"Hmm, tapi kenapa terdeteksi error? Penyebabnya error tersebut adalah karena ",(0,r.kt)("strong",{parentName:"p"},"mutable reference")," tidak digunakan dalam pengaksesan current object yang padahal ada operasi ",(0,r.kt)("em",{parentName:"p"},"mutable")," atau perubahan nilai terhadap property di situ. Syntax ",(0,r.kt)("inlineCode",{parentName:"p"},"&self")," artinya operasi peminjaman object ",(0,r.kt)("inlineCode",{parentName:"p"},"self")," adalah ",(0,r.kt)("em",{parentName:"p"},"read only"),"."),(0,r.kt)("p",null,"Cara mengambil mutable reference dari object ",(0,r.kt)("inlineCode",{parentName:"p"},"self")," adalah dengan menggunakan ",(0,r.kt)("inlineCode",{parentName:"p"},"&mut self"),". Cara tersebut kurang lebih sama seperti pengambilan mutable reference dari variabel biasa."),(0,r.kt)("p",null,"Ok, sekarang kita coba modifikasi deklarasi method ",(0,r.kt)("inlineCode",{parentName:"p"},"set_manufacture_year")," menjadi seperti berikut:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/models.rs"',title:'"src/models.rs"'},"// ...\n\nimpl Car {\n \n // ...\n \n pub fn set_manufacture_year(&mut self, year: i32) {\n self.manufacture_year = year\n }\n}\n")),(0,r.kt)("p",null,"Lalu panggil method ",(0,r.kt)("inlineCode",{parentName:"p"},"set_manufacture_year")," di fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'// ...\n\nfn main() {\n let mut car = models::Car::new(\n String::from("Mercedes-Benz"),\n String::from("Vision Gran Turismo")\n );\n\n let info = car.info();\n println!("info: {:?}", info);\n\n car.set_manufacture_year(2013);\n let detailed_info = car.info();\n println!("detailed info: {:?}", detailed_info);\n}\n')),(0,r.kt)("p",null,"Jalankan program, lihat hasilnya."),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"lazy",alt:"Method",src:t(7797).Z,width:"570",height:"109"})),(0,r.kt)("p",null,"Setelah ",(0,r.kt)("inlineCode",{parentName:"p"},"manufacture_year")," di-set, method ",(0,r.kt)("inlineCode",{parentName:"p"},"info")," mengembalikan pesan yang berbeda. Dari sini bisa disimpulkan bahwa method ",(0,r.kt)("inlineCode",{parentName:"p"},"set_manufacture_year")," sukses menjalankan tugasnya untuk mengubah property ",(0,r.kt)("inlineCode",{parentName:"p"},"manufacture_year"),"."),(0,r.kt)("h2",{id:"a255-generic-pada-method"},"A.25.5. Generic pada method"),(0,r.kt)("p",null,"Pembahasan mengenai generic pada method ada pada chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/generics#a366-generics-method"},"Generics"),"."),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,r.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,r.kt)("pre",null,(0,r.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/method"},"github.com/novalagung/dasarpemrogramanrust-example/../method")),(0,r.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch05-03-method-syntax.html"},"https://doc.rust-lang.org/book/ch05-03-method-syntax.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.impl.html"},"https://doc.rust-lang.org/std/keyword.impl.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.SelfTy.html"},"https://doc.rust-lang.org/std/keyword.SelfTy.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.self.html"},"https://doc.rust-lang.org/std/keyword.self.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/fn/methods.html"},"https://doc.rust-lang.org/rust-by-example/fn/methods.html"))))}u.isMDXComponent=!0},2693:(e,a,t)=>{t.d(a,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAnIAAABuCAIAAAAsx2kLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMD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kHhMNKHAS9SgjlKUwWAateXn11Tfjac4Ph2TqJ2TfkEqqnUzzh0x6Auxv6XwfabJO4mfuM6eWdS/pOVpk93NjHc/hxU+8VuNlPdLtxTNZEjMxMi4M+OiALWzrs3hUco4xaXXkLjPIsIaEmfw0rZ2OuK+lIJAXCBhzkvgToL+x0T+BKGinEkQW3BS8gchg8FEal+oSSrCvmecYvF0GNupP7VkpF+QZp20jkLKHTGctcO4nmZgsYp+E7UsIpEuafcFrbwUK6ubgyspwsxEhtwm0pRLJjzJu47itwpmXEyktv3aNI9S1ikuS+3xEtz1J/wdFYkaEEJzaSlq+y6bjEUu22Q23+QghDZO7fV/HVywj9jZCKEToDZCCCGojRBCUBshhBDURgghBLVRcZ34qkyEoDaC2gghqI2gNkJoErWVQCdKnHIx1PeEjWpM8ZW1c6m+z7FRj1yLENqkre3hMBEpPBEQffxGKaa4BdtLt3Opvs+x0b1vQG2ETsFD4ocociL2BJHsxYDo0zfKsVfW185F+j7HRqiN0KlR2w9t7+UPDI3dOCB6oY0Waq+hnXP3HWojBLUzsO0GTZZpGAdEn77RTu3jtnORvs9KbYTQyVC75uBTk3Jbo6EezX38xkzKHK2dS/V9Tmq3vm6E0AlQO76kFXyKob4nbMy2DY/UzqX6DrURgtoIIYSgNkIIIaiNEEJQGyGEENRGCCEEtRFCCGojhBCC2gghhKA2QghBbYQQQlAbIYQQ1EYIIaiNEEIIaiOEECqq/wFIh6r0VqkeMQAAAABJRU5ErkJggg=="},2653:(e,a,t)=>{t.d(a,{Z:()=>n});const n=t.p+"assets/images/method-3-2b2f604aaaa2cd04220b106aec22800d.png"},7797:(e,a,t)=>{t.d(a,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjoAAABtCAIAAAAnPlzxAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSH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Qd3pKplHO9JS2Xup6mrUHkamozQzytacNOXCKztefCCVCdfo3BTqhV4WfSmFe3Wiy62TfvDLR690XBZ7hj0HO6mzCgU5z6kq6Jk5Ew3pIXeEviLXmc3pLR3a552GQ0iFRNcWaQ0tSuTWFWNLfnwglQLWdi66x6vUs7LcXLzX0iUOpbmryECQCOhvQ6NZw2yBUAHItSoVXIFQAAAHIFAACAXAEAAHIFAACAXAEAACBXAACAXAEAACBXAAAAyBUAACBXAAAAyBUAAJwb/wPjXPAdfiGIFQAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/68ec37cc.eb57c627.js b/assets/js/68ec37cc.692a6380.js similarity index 55% rename from assets/js/68ec37cc.eb57c627.js rename to assets/js/68ec37cc.692a6380.js index fb2af8fd..1dbdb071 100644 --- a/assets/js/68ec37cc.eb57c627.js +++ b/assets/js/68ec37cc.692a6380.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[2959],{3905:(a,e,t)=>{t.d(e,{Zo:()=>m,kt:()=>d});var n=t(7294);function i(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function r(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),t.push.apply(t,n)}return t}function l(a){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?r(Object(t),!0).forEach((function(e){i(a,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(t,e))}))}return a}function s(a,e){if(null==a)return{};var t,n,i=function(a,e){if(null==a)return{};var t,n,i={},r=Object.keys(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||(i[t]=a[t]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(a,t)&&(i[t]=a[t])}return i}var p=n.createContext({}),o=function(a){var e=n.useContext(p),t=e;return a&&(t="function"==typeof a?a(e):l(l({},e),a)),t},m=function(a){var e=o(a.components);return n.createElement(p.Provider,{value:e},a.children)},k={inlineCode:"code",wrapper:function(a){var e=a.children;return n.createElement(n.Fragment,{},e)}},u=n.forwardRef((function(a,e){var t=a.components,i=a.mdxType,r=a.originalType,p=a.parentName,m=s(a,["components","mdxType","originalType","parentName"]),u=o(t),d=i,c=u["".concat(p,".").concat(d)]||u[d]||k[d]||r;return t?n.createElement(c,l(l({ref:e},m),{},{components:t})):n.createElement(c,l({ref:e},m))}));function d(a,e){var t=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=t.length,l=new Array(r);l[0]=u;var s={};for(var p in e)hasOwnProperty.call(e,p)&&(s[p]=e[p]);s.originalType=a,s.mdxType="string"==typeof a?a:i,l[1]=s;for(var o=2;o<r;o++)l[o]=t[o];return n.createElement.apply(null,l)}return n.createElement.apply(null,t)}u.displayName="MDXCreateElement"},3275:(a,e,t)=>{t.r(e),t.d(e,{assets:()=>p,contentTitle:()=>l,default:()=>k,frontMatter:()=>r,metadata:()=>s,toc:()=>o});var n=t(7462),i=(t(7294),t(3905));const r={sidebar_position:43,title:"A.43. Static Item",sidebar_label:"A.43. Static Item"},l=void 0,s={unversionedId:"basic/static",id:"basic/static",title:"A.43. Static Item",description:"Pada chapter ini kita akan bahas tentang apa itu static item, dan perbedaanya dibanding konstanta.",source:"@site/docs/basic/static.md",sourceDirName:"basic",slug:"/basic/static",permalink:"/basic/static",draft:!1,tags:[],version:"current",sidebarPosition:43,frontMatter:{sidebar_position:43,title:"A.43. Static Item",sidebar_label:"A.43. Static Item"},sidebar:"tutorialSidebar",previous:{title:"A.42. Pattern Matching",permalink:"/basic/pattern-matching"},next:{title:"A.44. Lifetime",permalink:"/basic/lifetime"}},p={},o=[{value:"A.43.1. Sekilas tentang <em>lifetime</em>",id:"a431-sekilas-tentang-lifetime",level:2},{value:"A.43.2. Static item",id:"a432-static-item",level:2},{value:"A.43.3. Keyword <code>static</code>",id:"a433-keyword-static",level:2},{value:"A.43.4. Lifetime <code>'static</code>",id:"a434-lifetime-static",level:2},{value:"A.43.5. Static item data literal",id:"a435-static-item-data-literal",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:o};function k(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,n.Z)({},m,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan bahas tentang apa itu static item, dan perbedaanya dibanding konstanta."),(0,i.kt)("p",null,"Namun sebelum masuk ke inti pembahasan, mari kita sedikit belajar tentang apa itu ",(0,i.kt)("em",{parentName:"p"},"lifetime")," dalam Rust programming."),(0,i.kt)("h2",{id:"a431-sekilas-tentang-lifetime"},"A.43.1. Sekilas tentang ",(0,i.kt)("em",{parentName:"h2"},"lifetime")),(0,i.kt)("p",null,"Di Rust ada yang disebut dengan ",(0,i.kt)("strong",{parentName:"p"},"lifetime"),". Lifetime merupakan sebuah identifier yang digunakan compiler untuk memantau berapa lama reference valid."),(0,i.kt)("p",null,"Di balik layar, Rust compiler (lebih tepatnya Rust borrow checker) menggunakan sebuah anotasi dalam penerapan lifetime. Penulisan anotasinya diawali tanda petik satu ",(0,i.kt)("inlineCode",{parentName:"p"},"'"),", contohnya ",(0,i.kt)("inlineCode",{parentName:"p"},"'a"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"'b"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"'c"),"."),(0,i.kt)("p",null,"Untuk sekarang, silakan dipahami bahwa sebuah syntax yang diawali dengan tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"'")," (contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"'a"),") adalah lifetime."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pembahasan detail mengenai lifetime dibahas pada chapter selanjutnya, yaitu ",(0,i.kt)("a",{parentName:"p",href:"/basic/lifetime"},"Lifetime"),".")),(0,i.kt)("h2",{id:"a432-static-item"},"A.43.2. Static item"),(0,i.kt)("p",null,"Ok, sekarang kembali ke topik utama, yaitu static. Static adalah item yang mirip dengan ",(0,i.kt)("a",{parentName:"p",href:"/basic/konstanta"},"Konstanta"),", tapi memiliki perbedaan yaitu alamat memory yang dialokasikan untuk menampung data static item adalah fix/jelas. Semua reference terhadap static item mengarah ke alamat memory yang sama."),(0,i.kt)("p",null,"Dengan karakteristik yang seperti itu, static tepat diterapkan pada data yang sifatnya shared atau bisa diakses secara global."),(0,i.kt)("p",null,"Ada dua cara membuat static item:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"li"},"static")," pada pendefinisian konstanta"),(0,i.kt)("li",{parentName:"ul"},"Menggunakan lifetime ",(0,i.kt)("inlineCode",{parentName:"li"},"'static")," pada tipe data string literal (",(0,i.kt)("inlineCode",{parentName:"li"},"&str"),")")),(0,i.kt)("h2",{id:"a433-keyword-static"},"A.43.3. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"static")),(0,i.kt)("p",null,"Ok, kita terapkan cara pertama, penerapan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"static")," untuk pembuatan konstanta."),(0,i.kt)("p",null,"Pada deklarasi konstanta static, harus ditulis juga tipe datanya secara eksplisit."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'static PI: f64 = 3.14;\n\nfn main() {\n println!("PI: {:?}", PI);\n}\n')),(0,i.kt)("p",null,"Cukup mudah bukan?"),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Konstanta static bisa saja didefinisikan mutable, tetapi dengan konsekuensi item tersebut akan menjadi ",(0,i.kt)("em",{parentName:"p"},"unsafe"),"."),(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai topik ini akan dibahas nantinya pada chapter terpisah, yaitu ",(0,i.kt)("a",{parentName:"p",href:"#/wip/safe-unsafe"},"Safe & Unsafe"),".")),(0,i.kt)("p",null,"Ok, sekarang kita coba terapkan keyword static pada tipe lainnya, contohnya ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Static string",src:t(5207).Z,width:"765",height:"259"})),(0,i.kt)("p",null,"Hmm, malah error."),(0,i.kt)("p",null,"Perlu diketahui bahwa keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"static")," bisa digunakan pada semua tipe data primitif. Selain itu bisa juga diterapkan dalam ",(0,i.kt)("em",{parentName:"p"},"constants function")," (yang nantinya dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/constant-evaluation"},"Constant Evaluation"),"), ",(0,i.kt)("a",{parentName:"p",href:"/basic/struct#a247-tuple-struct"},"Tuple Struct"),", dan juga variant ",(0,i.kt)("a",{parentName:"p",href:"/basic/tuple"},"Tuple")," lainnya, tetapi tidak bisa digunakan untuk custom type seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,i.kt)("p",null,"Lalu bagaimana jika ada kebutuhan membuat konstanta bertipe string? Solusinya dengan menggunakan tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"&'static str")," yang sebentar lagi akan kita bahas."),(0,i.kt)("h2",{id:"a434-lifetime-static"},"A.43.4. Lifetime ",(0,i.kt)("inlineCode",{parentName:"h2"},"'static")),(0,i.kt)("p",null,"Lifetime ",(0,i.kt)("inlineCode",{parentName:"p"},"'static")," digunakan untuk deklarasi reference sebagai static item. Data yang memiliki lifetime ini tidak akan pernah di-dealokasi kecuali eksekusi program selesai."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Karena alasan di atas, ada baiknya data dengan lifetime static dideklarasikan secara global."),(0,i.kt)("p",{parentName:"blockquote"},"Dimisalkan ada variabel dengan lifetime ini dideklarasikan dalam suatu block, variabel tersebut tidak akan di-dealokasi meskipun eksekusi block selesai nantinya.")),(0,i.kt)("p",null,"Lifetime ini biasa dikombinasikan dengan tipe data pointer, contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," jika dikombinasikan dengan lifetime ",(0,i.kt)("inlineCode",{parentName:"p"},"'static")," jadinya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"&'static str"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'const VERSION: &\'static str = "v1.2.3";\n')),(0,i.kt)("p",null,"Sebelumnya telah dijelaskan bahwa custom type ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," tidak bisa digunakan untuk menyimpan data string sebagai static item, dan cara di atas ini adalah solusinya."),(0,i.kt)("p",null,"Penulisannya agak kurang friendly memang (",(0,i.kt)("inlineCode",{parentName:"p"},"&'static str"),"), namun kabar baiknya semenjak Rust versi 1.17 rilis di tahun 2017, by default semua item yang dideklarasikan menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"static")," ataupun ",(0,i.kt)("inlineCode",{parentName:"p"},"const")," otomatis memiliki ",(0,i.kt)("inlineCode",{parentName:"p"},"'static lifetime"),". Jadi sekarang cukup tulis saja:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'const VERSION: &str = "v1.2.3";\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'const VERSION: &\'static str = "v1.2.3";\n')),(0,i.kt)("h2",{id:"a435-static-item-data-literal"},"A.43.5. Static item data literal"),(0,i.kt)("p",null,"Pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/borrowing#a347-owner-dan-borrower-data-literal"},"Borrowing")," sempat kita bahas sedikit tentang siapa owner dan borrower data literal."),(0,i.kt)("p",null,"Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," adalah salah satu tipe data yang tidak memiliki owner (atau boleh disimpulkan owner-nya adalah program). Pada variabel yang bertipe ini, yang ia tampung adalah data pinjaman, jadi variabel tersebut bukan owner. Contohnya pada kode berikut konstanta ",(0,i.kt)("inlineCode",{parentName:"p"},"VERSION")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"BUILD_COUNTER")," di atas adalah borrower."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'const VERSION: &str = "v1.2.3";\nconst BUILD_COUNTER: &i32 = &15;\n')),(0,i.kt)("p",null,"Yang penting untuk diperhatikan bukan siapa owner-nya, tapi bagaimana kita memastikan data pinjaman tersebut tidak di-dealokasi. Inilah kenapa lifetime ",(0,i.kt)("inlineCode",{parentName:"p"},"'static")," dan/atau keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"static")," & ",(0,i.kt)("inlineCode",{parentName:"p"},"const")," dipergunakan. Dengan adanya lifetime tersebut, data borrow tidak akan pernah di-dealokasi."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/static_example"},"github.com/novalagung/dasarpemrogramanrust-example/../static_example")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/items/static-items.html"},"https://doc.rust-lang.org/reference/items/static-items.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/beta/rust-by-example/custom_types/constants.html"},"https://doc.rust-lang.org/beta/rust-by-example/custom_types/constants.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/scope/lifetime/static_lifetime.html"},"https://doc.rust-lang.org/rust-by-example/scope/lifetime/static_lifetime.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/49684657/what-is-the-difference-between-str-and-static-str-in-a-static-or-const"},"https://stackoverflow.com/questions/49684657/what-is-the-difference-between-str-and-static-str-in-a-static-or-const"))))}k.isMDXComponent=!0},5207:(a,e,t)=>{t.d(e,{Z:()=>n});const n=t.p+"assets/images/static-1-095ee9ad8503b55f94f1fb79ef51dbca.png"}}]); \ No newline at end of file +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[2959],{3905:(a,e,t)=>{t.d(e,{Zo:()=>m,kt:()=>d});var n=t(7294);function i(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function r(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),t.push.apply(t,n)}return t}function l(a){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?r(Object(t),!0).forEach((function(e){i(a,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(t,e))}))}return a}function s(a,e){if(null==a)return{};var t,n,i=function(a,e){if(null==a)return{};var t,n,i={},r=Object.keys(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||(i[t]=a[t]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(a,t)&&(i[t]=a[t])}return i}var p=n.createContext({}),o=function(a){var e=n.useContext(p),t=e;return a&&(t="function"==typeof a?a(e):l(l({},e),a)),t},m=function(a){var e=o(a.components);return n.createElement(p.Provider,{value:e},a.children)},k={inlineCode:"code",wrapper:function(a){var e=a.children;return n.createElement(n.Fragment,{},e)}},u=n.forwardRef((function(a,e){var t=a.components,i=a.mdxType,r=a.originalType,p=a.parentName,m=s(a,["components","mdxType","originalType","parentName"]),u=o(t),d=i,c=u["".concat(p,".").concat(d)]||u[d]||k[d]||r;return t?n.createElement(c,l(l({ref:e},m),{},{components:t})):n.createElement(c,l({ref:e},m))}));function d(a,e){var t=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=t.length,l=new Array(r);l[0]=u;var s={};for(var p in e)hasOwnProperty.call(e,p)&&(s[p]=e[p]);s.originalType=a,s.mdxType="string"==typeof a?a:i,l[1]=s;for(var o=2;o<r;o++)l[o]=t[o];return n.createElement.apply(null,l)}return n.createElement.apply(null,t)}u.displayName="MDXCreateElement"},3275:(a,e,t)=>{t.r(e),t.d(e,{assets:()=>p,contentTitle:()=>l,default:()=>k,frontMatter:()=>r,metadata:()=>s,toc:()=>o});var n=t(7462),i=(t(7294),t(3905));const r={sidebar_position:43,title:"A.43. Static Item",sidebar_label:"A.43. Static Item"},l=void 0,s={unversionedId:"basic/static",id:"basic/static",title:"A.43. Static Item",description:"Pada chapter ini kita akan bahas tentang apa itu static item, dan perbedaanya dibanding konstanta.",source:"@site/docs/basic/static.md",sourceDirName:"basic",slug:"/basic/static",permalink:"/basic/static",draft:!1,tags:[],version:"current",sidebarPosition:43,frontMatter:{sidebar_position:43,title:"A.43. Static Item",sidebar_label:"A.43. Static Item"},sidebar:"tutorialSidebar",previous:{title:"A.42. Pattern Matching",permalink:"/basic/pattern-matching"},next:{title:"A.44. Lifetime",permalink:"/basic/lifetime"}},p={},o=[{value:"A.43.1. Sekilas tentang <em>lifetime</em>",id:"a431-sekilas-tentang-lifetime",level:2},{value:"A.43.2. Static item",id:"a432-static-item",level:2},{value:"A.43.3. Keyword <code>static</code>",id:"a433-keyword-static",level:2},{value:"A.43.4. Lifetime <code>'static</code>",id:"a434-lifetime-static",level:2},{value:"A.43.5. Static item data literal",id:"a435-static-item-data-literal",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:o};function k(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,n.Z)({},m,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan bahas tentang apa itu static item, dan perbedaanya dibanding konstanta."),(0,i.kt)("p",null,"Namun sebelum masuk ke inti pembahasan, mari kita sedikit belajar tentang apa itu ",(0,i.kt)("em",{parentName:"p"},"lifetime")," dalam Rust programming."),(0,i.kt)("h2",{id:"a431-sekilas-tentang-lifetime"},"A.43.1. Sekilas tentang ",(0,i.kt)("em",{parentName:"h2"},"lifetime")),(0,i.kt)("p",null,"Di Rust ada yang disebut dengan ",(0,i.kt)("strong",{parentName:"p"},"lifetime"),". Lifetime merupakan sebuah identifier yang digunakan compiler untuk memantau berapa lama reference valid."),(0,i.kt)("p",null,"Di balik layar, Rust compiler (lebih tepatnya Rust borrow checker) menggunakan sebuah anotasi dalam penerapan lifetime. Penulisan anotasinya diawali tanda petik satu ",(0,i.kt)("inlineCode",{parentName:"p"},"'"),", contohnya ",(0,i.kt)("inlineCode",{parentName:"p"},"'a"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"'b"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"'c"),"."),(0,i.kt)("p",null,"Untuk sekarang, silakan dipahami bahwa sebuah syntax yang diawali dengan tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"'")," (contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"'a"),") adalah lifetime."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pembahasan detail mengenai lifetime dibahas pada chapter selanjutnya, yaitu ",(0,i.kt)("a",{parentName:"p",href:"/basic/lifetime"},"Lifetime"),".")),(0,i.kt)("h2",{id:"a432-static-item"},"A.43.2. Static item"),(0,i.kt)("p",null,"Ok, sekarang kembali ke topik utama, yaitu static. Static adalah item yang mirip dengan ",(0,i.kt)("a",{parentName:"p",href:"/basic/konstanta"},"Konstanta"),", tapi memiliki perbedaan yaitu alamat memory yang dialokasikan untuk menampung data static item adalah fix/jelas. Semua reference terhadap static item mengarah ke alamat memory yang sama."),(0,i.kt)("p",null,"Dengan karakteristik yang seperti itu, static tepat diterapkan pada data yang sifatnya shared atau bisa diakses secara global."),(0,i.kt)("p",null,"Ada dua cara membuat static item:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"li"},"static")," pada pendefinisian konstanta"),(0,i.kt)("li",{parentName:"ul"},"Menggunakan lifetime ",(0,i.kt)("inlineCode",{parentName:"li"},"'static")," pada tipe data string literal (",(0,i.kt)("inlineCode",{parentName:"li"},"&str"),")")),(0,i.kt)("h2",{id:"a433-keyword-static"},"A.43.3. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"static")),(0,i.kt)("p",null,"Ok, kita terapkan cara pertama, penerapan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"static")," untuk pembuatan konstanta."),(0,i.kt)("p",null,"Pada deklarasi konstanta static, harus ditulis juga tipe datanya secara eksplisit."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'static PI: f64 = 3.14;\n\nfn main() {\n println!("PI: {:?}", PI);\n}\n')),(0,i.kt)("p",null,"Cukup mudah bukan?"),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Konstanta static bisa saja didefinisikan mutable, tetapi dengan konsekuensi item tersebut akan menjadi ",(0,i.kt)("em",{parentName:"p"},"unsafe"),"."),(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai topik ini akan dibahas nantinya pada chapter terpisah, yaitu ",(0,i.kt)("a",{parentName:"p",href:"#/wip/safe-unsafe"},"Safe & Unsafe"),".")),(0,i.kt)("p",null,"Ok, sekarang kita coba terapkan keyword static pada tipe lainnya, contohnya ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Static string",src:t(5207).Z,width:"765",height:"259"})),(0,i.kt)("p",null,"Hmm, malah error."),(0,i.kt)("p",null,"Perlu diketahui bahwa keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"static")," bisa digunakan pada semua tipe data primitif. Selain itu bisa juga diterapkan dalam ",(0,i.kt)("em",{parentName:"p"},"constants function")," (yang nantinya dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/constant-evaluation"},"Constant Evaluation"),"), ",(0,i.kt)("a",{parentName:"p",href:"/basic/struct#a247-tuple-struct"},"Tuple Struct"),", dan juga variant ",(0,i.kt)("a",{parentName:"p",href:"/basic/tuple"},"Tuple")," lainnya, tetapi tidak bisa digunakan untuk custom type seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,i.kt)("p",null,"Lalu bagaimana jika ada kebutuhan membuat konstanta bertipe string? Solusinya dengan menggunakan tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"&'static str")," yang sebentar lagi akan kita bahas."),(0,i.kt)("h2",{id:"a434-lifetime-static"},"A.43.4. Lifetime ",(0,i.kt)("inlineCode",{parentName:"h2"},"'static")),(0,i.kt)("p",null,"Lifetime ",(0,i.kt)("inlineCode",{parentName:"p"},"'static")," digunakan untuk deklarasi reference sebagai static item. Data yang memiliki lifetime ini tidak akan pernah di-dealokasi kecuali eksekusi program selesai."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Karena alasan di atas, ada baiknya data dengan lifetime static dideklarasikan secara global."),(0,i.kt)("p",{parentName:"blockquote"},"Dimisalkan ada variabel dengan lifetime ini dideklarasikan dalam suatu block, variabel tersebut tidak akan di-dealokasi meskipun eksekusi block selesai nantinya.")),(0,i.kt)("p",null,"Lifetime ini biasa dikombinasikan dengan tipe data pointer, contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," jika dikombinasikan dengan lifetime ",(0,i.kt)("inlineCode",{parentName:"p"},"'static")," jadinya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"&'static str"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'const VERSION: &\'static str = "v1.2.3";\n')),(0,i.kt)("p",null,"Sebelumnya telah dijelaskan bahwa custom type ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," tidak bisa digunakan untuk menyimpan data string sebagai static item, dan cara di atas ini adalah solusinya."),(0,i.kt)("p",null,"Penulisannya agak kurang friendly memang (",(0,i.kt)("inlineCode",{parentName:"p"},"&'static str"),"), namun kabar baiknya semenjak Rust versi 1.17 rilis di tahun 2017, by default semua item yang dideklarasikan menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"static")," ataupun ",(0,i.kt)("inlineCode",{parentName:"p"},"const")," otomatis memiliki ",(0,i.kt)("inlineCode",{parentName:"p"},"'static lifetime"),". Jadi sekarang cukup tulis saja:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'const VERSION: &str = "v1.2.3";\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'const VERSION: &\'static str = "v1.2.3";\n')),(0,i.kt)("h2",{id:"a435-static-item-data-literal"},"A.43.5. Static item data literal"),(0,i.kt)("p",null,"Pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/borrowing#a347-owner-dan-borrower-data-literal"},"Borrowing")," sempat kita bahas sedikit tentang siapa owner dan borrower data literal."),(0,i.kt)("p",null,"Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," adalah salah satu tipe data yang tidak memiliki owner (atau boleh disimpulkan owner-nya adalah program). Pada variabel yang bertipe ini, yang ia tampung adalah data pinjaman, jadi variabel tersebut bukan owner. Contohnya pada kode berikut konstanta ",(0,i.kt)("inlineCode",{parentName:"p"},"VERSION")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"BUILD_COUNTER")," di atas adalah borrower."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'const VERSION: &str = "v1.2.3";\nconst BUILD_COUNTER: &i32 = &15;\n')),(0,i.kt)("p",null,"Yang penting untuk diperhatikan bukan siapa owner-nya, tapi bagaimana kita memastikan data pinjaman tersebut tidak di-dealokasi. Inilah kenapa lifetime ",(0,i.kt)("inlineCode",{parentName:"p"},"'static")," dan/atau keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"static")," & ",(0,i.kt)("inlineCode",{parentName:"p"},"const")," dipergunakan. Dengan adanya lifetime tersebut, data borrow tidak akan pernah di-dealokasi."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/static_example"},"github.com/novalagung/dasarpemrogramanrust-example/../static_example")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/items/static-items.html"},"https://doc.rust-lang.org/reference/items/static-items.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/beta/rust-by-example/custom_types/constants.html"},"https://doc.rust-lang.org/beta/rust-by-example/custom_types/constants.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/scope/lifetime/static_lifetime.html"},"https://doc.rust-lang.org/rust-by-example/scope/lifetime/static_lifetime.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/49684657/what-is-the-difference-between-str-and-static-str-in-a-static-or-const"},"https://stackoverflow.com/questions/49684657/what-is-the-difference-between-str-and-static-str-in-a-static-or-const"))))}k.isMDXComponent=!0},5207:(a,e,t)=>{t.d(e,{Z:()=>n});const n=t.p+"assets/images/static-1-095ee9ad8503b55f94f1fb79ef51dbca.png"}}]); \ No newline at end of file diff --git a/assets/js/71880105.38008cd0.js b/assets/js/71880105.38008cd0.js new file mode 100644 index 00000000..f642d06a --- /dev/null +++ b/assets/js/71880105.38008cd0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[5758],{3905:(A,a,n)=>{n.d(a,{Zo:()=>p,kt:()=>m});var e=n(7294);function t(A,a,n){return a in A?Object.defineProperty(A,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):A[a]=n,A}function i(A,a){var n=Object.keys(A);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(A);a&&(e=e.filter((function(a){return Object.getOwnPropertyDescriptor(A,a).enumerable}))),n.push.apply(n,e)}return n}function l(A){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?i(Object(n),!0).forEach((function(a){t(A,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(a){Object.defineProperty(A,a,Object.getOwnPropertyDescriptor(n,a))}))}return A}function r(A,a){if(null==A)return{};var n,e,t=function(A,a){if(null==A)return{};var n,e,t={},i=Object.keys(A);for(e=0;e<i.length;e++)n=i[e],a.indexOf(n)>=0||(t[n]=A[n]);return t}(A,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(A);for(e=0;e<i.length;e++)n=i[e],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(A,n)&&(t[n]=A[n])}return t}var d=e.createContext({}),b=function(A){var a=e.useContext(d),n=a;return A&&(n="function"==typeof A?A(a):l(l({},a),A)),n},p=function(A){var a=b(A.components);return e.createElement(d.Provider,{value:a},A.children)},c={inlineCode:"code",wrapper:function(A){var a=A.children;return e.createElement(e.Fragment,{},a)}},u=e.forwardRef((function(A,a){var n=A.components,t=A.mdxType,i=A.originalType,d=A.parentName,p=r(A,["components","mdxType","originalType","parentName"]),u=b(n),m=t,o=u["".concat(d,".").concat(m)]||u[m]||c[m]||i;return n?e.createElement(o,l(l({ref:a},p),{},{components:n})):e.createElement(o,l({ref:a},p))}));function m(A,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof A||t){var i=n.length,l=new Array(i);l[0]=u;var r={};for(var d in a)hasOwnProperty.call(a,d)&&(r[d]=a[d]);r.originalType=A,r.mdxType="string"==typeof A?A:t,l[1]=r;for(var b=2;b<i;b++)l[b]=n[b];return e.createElement.apply(null,l)}return e.createElement.apply(null,n)}u.displayName="MDXCreateElement"},3548:(A,a,n)=>{n.r(a),n.d(a,{assets:()=>d,contentTitle:()=>l,default:()=>c,frontMatter:()=>i,metadata:()=>r,toc:()=>b});var e=n(7462),t=(n(7294),n(3905));const i={sidebar_position:12,title:"A.12. Perulangan \u279c for in",sidebar_label:"A.12. Perulangan \u279c for in"},l=void 0,r={unversionedId:"basic/perulangan-for-in",id:"basic/perulangan-for-in",title:"A.12. Perulangan \u279c for in",description:"for in adalah salah satu keyword untuk operasi perulangan yang ada di Rust selain loop dan while. Pada chapter ini kita akan mempelajarinya.",source:"@site/docs/basic/perulangan-for-in.md",sourceDirName:"basic",slug:"/basic/perulangan-for-in",permalink:"/basic/perulangan-for-in",draft:!1,tags:[],version:"current",sidebarPosition:12,frontMatter:{sidebar_position:12,title:"A.12. Perulangan \u279c for in",sidebar_label:"A.12. Perulangan \u279c for in"},sidebar:"tutorialSidebar",previous:{title:"A.11. Perulangan \u279c loop, break, continue, label",permalink:"/basic/perulangan-loop-break-continue-label"},next:{title:"A.13. Array",permalink:"/basic/array"}},d={},b=[{value:"A.12.1. Keyword <code>for in</code>",id:"a121-keyword-for-in",level:2},{value:"A.12.2. Label perulangan",id:"a122-label-perulangan",level:2},{value:"A.12.3. Perulangan <code>for in</code> pada array",id:"a123-perulangan-for-in-pada-array",level:2},{value:"A.12.4. Perulangan <code>for in</code> pada tipe iterator lainnya",id:"a124-perulangan-for-in-pada-tipe-iterator-lainnya",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],p={toc:b};function c(A){let{components:a,...i}=A;return(0,t.kt)("wrapper",(0,e.Z)({},p,i,{components:a,mdxType:"MDXLayout"}),(0,t.kt)("p",null,(0,t.kt)("inlineCode",{parentName:"p"},"for in")," adalah salah satu keyword untuk operasi perulangan yang ada di Rust selain ",(0,t.kt)("inlineCode",{parentName:"p"},"loop")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"while"),". Pada chapter ini kita akan mempelajarinya."),(0,t.kt)("h2",{id:"a121-keyword-for-in"},"A.12.1. Keyword ",(0,t.kt)("inlineCode",{parentName:"h2"},"for in")),(0,t.kt)("p",null,(0,t.kt)("inlineCode",{parentName:"p"},"for in")," adalah keyword perulangan yang paling sering dipakai untuk meng-iterasi data yang tipe data-nya mengimplementasikan trait ",(0,t.kt)("inlineCode",{parentName:"p"},"Iterator"),". Ada banyak jenis tipe data dengan trait ini, salah satunya adalah tipe data ",(0,t.kt)("strong",{parentName:"p"},"range")," yang akan kita bahas pada chapter ini."),(0,t.kt)("blockquote",null,(0,t.kt)("ul",{parentName:"blockquote"},(0,t.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai traits dibahas pada chapter ",(0,t.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits")),(0,t.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai trait ",(0,t.kt)("inlineCode",{parentName:"li"},"Iterator")," dibahas pada chapter ",(0,t.kt)("a",{parentName:"li",href:"/basic/trait-iterator"},"Trait \u279c Iterator")))),(0,t.kt)("p",null,"Tipe data range dibuat dengan notasi penulisan ",(0,t.kt)("inlineCode",{parentName:"p"},"a..b"),". Mari lanjut dengan praktik agar lebih jelas. Silakan coba kode sederhana berikut lalu jalankan."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'for i in 0..5 {\n println!("{i}");\n}\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"eager",fetchpriority:"high",alt:"perulangan for in",src:n(2472).Z,width:"446",height:"169"})),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"for in")," jika digunakan pada notasi iterator ",(0,t.kt)("inlineCode",{parentName:"p"},"a..b")," maka akan menghasilkan sebuah perulangan dari angka ",(0,t.kt)("inlineCode",{parentName:"p"},"a")," hingga angka di bawah ",(0,t.kt)("inlineCode",{parentName:"p"},"b"),"."),(0,t.kt)("p",null,"Pada contoh di atas, ",(0,t.kt)("inlineCode",{parentName:"p"},"0..5")," artinya adalah objek iterator yang dimulai dari angka ",(0,t.kt)("inlineCode",{parentName:"p"},"0")," hingga di bawah ",(0,t.kt)("inlineCode",{parentName:"p"},"5")," (yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"4"),"). Object iterator tersebut kemudian diiterasi, dan ditiap perulangan di-print menggunakan ",(0,t.kt)("inlineCode",{parentName:"p"},'println!("{i}")'),". Dengan ini, nilai ",(0,t.kt)("inlineCode",{parentName:"p"},"i")," muncul di layar console dimulai angka ",(0,t.kt)("inlineCode",{parentName:"p"},"0")," hingga ",(0,t.kt)("inlineCode",{parentName:"p"},"4"),"."),(0,t.kt)("p",null,"Jika ingin melakukan perulangan dari ",(0,t.kt)("inlineCode",{parentName:"p"},"a")," ke ",(0,t.kt)("inlineCode",{parentName:"p"},"b")," (bukan dari ",(0,t.kt)("inlineCode",{parentName:"p"},"a")," ke angka di bawah ",(0,t.kt)("inlineCode",{parentName:"p"},"b"),") gunakan notasi iterator ",(0,t.kt)("inlineCode",{parentName:"p"},"a..=b"),". Contoh:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'for i in 0..=5 {\n println!("{i}");\n}\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"perulangan for in",src:n(1154).Z,width:"445",height:"192"})),(0,t.kt)("h2",{id:"a122-label-perulangan"},"A.12.2. Label perulangan"),(0,t.kt)("p",null,"Penambahan label pada perulangan ",(0,t.kt)("inlineCode",{parentName:"p"},"for in")," juga bisa dilakukan. Caranya dengan cukup menambahkan sintaks ",(0,t.kt)("inlineCode",{parentName:"p"},"'namaLabel: ")," sebelum statement ",(0,t.kt)("inlineCode",{parentName:"p"},"for in"),". Contohnya seperti berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'\'perulangan: for i in 0..=5 {\n if i > 3 {\n println!("perulangan dihentikan paksa pada iterasi {i}");\n break \'perulangan;\n }\n\n println!("{i}");\n}\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"label perulangan for in",src:n(8267).Z,width:"448",height:"180"})),(0,t.kt)("p",null,"Selain ",(0,t.kt)("inlineCode",{parentName:"p"},"break"),", keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"continue")," juga bisa digunakan pada perulangan ",(0,t.kt)("inlineCode",{parentName:"p"},"for in"),"."),(0,t.kt)("h2",{id:"a123-perulangan-for-in-pada-array"},"A.12.3. Perulangan ",(0,t.kt)("inlineCode",{parentName:"h2"},"for in")," pada array"),(0,t.kt)("p",null,"Perulangan menggunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"for in")," adalah yang paling praktis digunakan untuk mengiterasi elemen array. Contoh:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let array = ["jason", "grayon", "drake", "damian"];\nfor name in array {\n println!("{name}");\n}\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"label perulangan for in",src:n(2977).Z,width:"445",height:"149"})),(0,t.kt)("p",null,"Perihal apa itu ",(0,t.kt)("inlineCode",{parentName:"p"},"array")," akan dibahas pada chapter selanjutnya, yaitu ",(0,t.kt)("a",{parentName:"p",href:"/basic/array"},"Array"),"."),(0,t.kt)("h2",{id:"a124-perulangan-for-in-pada-tipe-iterator-lainnya"},"A.12.4. Perulangan ",(0,t.kt)("inlineCode",{parentName:"h2"},"for in")," pada tipe iterator lainnya"),(0,t.kt)("p",null,"Di Rust ada banyak cara membuat object iterator. Mengenai topik satu ini kita akan bahas seiring berjalannya proses pembelajaran. Akan berpotesi makin membingungkan jika dibahas terlalu detail pada chapter ini."),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/perulangan_for_in"},"github.com/novalagung/dasarpemrogramanrust-example/../perulangan_for_in")),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/expressions/loop-expr.html"},"https://doc.rust-lang.org/reference/expressions/loop-expr.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.in.html"},"https://doc.rust-lang.org/std/keyword.in.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.for.html"},"https://doc.rust-lang.org/std/keyword.for.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/flow_control/for.html"},"https://doc.rust-lang.org/rust-by-example/flow_control/for.html"))))}c.isMDXComponent=!0},2472:(A,a,n)=>{n.d(a,{Z:()=>e});const e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb4AAACpCAIAAADbS88pAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMDktMjZUMjE6NTE6NDkrMDc6MDAiIHh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3wQAADHgNwEAQAz4TQAAEAN+EwAAxBiobnEnXhHyxQCAKwPGmwAAIEa/nk/3YTuXwcPoAICrQze6xQyJ4o18camhzilKpKnulhNrSqSp5u9vUSecTcrDrXC8srnzgB7uR3PaQ/AQ/gAAjC/d6BazJYplJbqf2a1ElDXt/8TqCh1s3de0ja1peigcR5TcaiNvlUIGAIBxpBvdYrZEcVMtblv/98RL4biyq+l7OGSPAQBgvOhqfdNDonhI0QEAYKR0sZ9uSBTrM+1mcIx+RgcAgBHTpW6xl0QxJz1GBwCAEdKFbnGARHGHrQPrhHytWFzT9sk5owMAwHgC3WIAABADzwsBAIAY8JsAACAG/CYAAIgBvwkAAGLAbwIAgBjwmwAAIAb8JgAAiAG/CQAAYsBvAgCAGPCbAAAgBvwmAACIAb8JAABiwG8CAIAY8JsAACAG/CYAAIgBvwkAAGL8P8WW/mrC7FDtAAAAAElFTkSuQmCC"}}]); \ No newline at end of file diff --git a/assets/js/71880105.761a2054.js b/assets/js/71880105.761a2054.js deleted file mode 100644 index de4b45e3..00000000 --- a/assets/js/71880105.761a2054.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[5758],{3905:(A,a,n)=>{n.d(a,{Zo:()=>p,kt:()=>m});var e=n(7294);function t(A,a,n){return a in A?Object.defineProperty(A,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):A[a]=n,A}function i(A,a){var n=Object.keys(A);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(A);a&&(e=e.filter((function(a){return Object.getOwnPropertyDescriptor(A,a).enumerable}))),n.push.apply(n,e)}return n}function l(A){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?i(Object(n),!0).forEach((function(a){t(A,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(a){Object.defineProperty(A,a,Object.getOwnPropertyDescriptor(n,a))}))}return A}function r(A,a){if(null==A)return{};var n,e,t=function(A,a){if(null==A)return{};var n,e,t={},i=Object.keys(A);for(e=0;e<i.length;e++)n=i[e],a.indexOf(n)>=0||(t[n]=A[n]);return t}(A,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(A);for(e=0;e<i.length;e++)n=i[e],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(A,n)&&(t[n]=A[n])}return t}var d=e.createContext({}),b=function(A){var a=e.useContext(d),n=a;return A&&(n="function"==typeof A?A(a):l(l({},a),A)),n},p=function(A){var a=b(A.components);return e.createElement(d.Provider,{value:a},A.children)},c={inlineCode:"code",wrapper:function(A){var a=A.children;return e.createElement(e.Fragment,{},a)}},u=e.forwardRef((function(A,a){var n=A.components,t=A.mdxType,i=A.originalType,d=A.parentName,p=r(A,["components","mdxType","originalType","parentName"]),u=b(n),m=t,o=u["".concat(d,".").concat(m)]||u[m]||c[m]||i;return n?e.createElement(o,l(l({ref:a},p),{},{components:n})):e.createElement(o,l({ref:a},p))}));function m(A,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof A||t){var i=n.length,l=new Array(i);l[0]=u;var r={};for(var d in a)hasOwnProperty.call(a,d)&&(r[d]=a[d]);r.originalType=A,r.mdxType="string"==typeof A?A:t,l[1]=r;for(var b=2;b<i;b++)l[b]=n[b];return e.createElement.apply(null,l)}return e.createElement.apply(null,n)}u.displayName="MDXCreateElement"},3548:(A,a,n)=>{n.r(a),n.d(a,{assets:()=>d,contentTitle:()=>l,default:()=>c,frontMatter:()=>i,metadata:()=>r,toc:()=>b});var e=n(7462),t=(n(7294),n(3905));const i={sidebar_position:12,title:"A.12. Perulangan \u279c for in",sidebar_label:"A.12. Perulangan \u279c for in"},l=void 0,r={unversionedId:"basic/perulangan-for-in",id:"basic/perulangan-for-in",title:"A.12. Perulangan \u279c for in",description:"for in adalah salah satu keyword untuk operasi perulangan yang ada di Rust selain loop dan while. Pada chapter ini kita akan mempelajarinya.",source:"@site/docs/basic/perulangan-for-in.md",sourceDirName:"basic",slug:"/basic/perulangan-for-in",permalink:"/basic/perulangan-for-in",draft:!1,tags:[],version:"current",sidebarPosition:12,frontMatter:{sidebar_position:12,title:"A.12. Perulangan \u279c for in",sidebar_label:"A.12. Perulangan \u279c for in"},sidebar:"tutorialSidebar",previous:{title:"A.11. Perulangan \u279c loop, break, continue, label",permalink:"/basic/perulangan-loop-break-continue-label"},next:{title:"A.13. Array",permalink:"/basic/array"}},d={},b=[{value:"A.12.1. Keyword <code>for in</code>",id:"a121-keyword-for-in",level:2},{value:"A.12.2. Label perulangan",id:"a122-label-perulangan",level:2},{value:"A.12.3. Perulangan <code>for in</code> pada array",id:"a123-perulangan-for-in-pada-array",level:2},{value:"A.12.4. Perulangan <code>for in</code> pada tipe iterator lainnya",id:"a124-perulangan-for-in-pada-tipe-iterator-lainnya",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],p={toc:b};function c(A){let{components:a,...i}=A;return(0,t.kt)("wrapper",(0,e.Z)({},p,i,{components:a,mdxType:"MDXLayout"}),(0,t.kt)("p",null,(0,t.kt)("inlineCode",{parentName:"p"},"for in")," adalah salah satu keyword untuk operasi perulangan yang ada di Rust selain ",(0,t.kt)("inlineCode",{parentName:"p"},"loop")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"while"),". Pada chapter ini kita akan mempelajarinya."),(0,t.kt)("h2",{id:"a121-keyword-for-in"},"A.12.1. Keyword ",(0,t.kt)("inlineCode",{parentName:"h2"},"for in")),(0,t.kt)("p",null,(0,t.kt)("inlineCode",{parentName:"p"},"for in")," adalah keyword perulangan yang paling sering dipakai untuk meng-iterasi data yang tipe data-nya mengimplementasikan trait ",(0,t.kt)("inlineCode",{parentName:"p"},"Iterator"),". Ada banyak jenis tipe data dengan trait ini, salah satunya adalah tipe data ",(0,t.kt)("strong",{parentName:"p"},"range")," yang akan kita bahas pada chapter ini."),(0,t.kt)("blockquote",null,(0,t.kt)("ul",{parentName:"blockquote"},(0,t.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai traits dibahas pada chapter ",(0,t.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits")),(0,t.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai trait ",(0,t.kt)("inlineCode",{parentName:"li"},"Iterator")," dibahas pada chapter ",(0,t.kt)("a",{parentName:"li",href:"/basic/trait-iterator"},"Trait \u279c Iterator")))),(0,t.kt)("p",null,"Tipe data range dibuat dengan notasi penulisan ",(0,t.kt)("inlineCode",{parentName:"p"},"a..b"),". Mari lanjut dengan praktik agar lebih jelas. Silakan coba kode sederhana berikut lalu jalankan."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'for i in 0..5 {\n println!("{i}");\n}\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"perulangan for in",src:n(2472).Z,width:"446",height:"169"})),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"for in")," jika digunakan pada notasi iterator ",(0,t.kt)("inlineCode",{parentName:"p"},"a..b")," maka akan menghasilkan sebuah perulangan dari angka ",(0,t.kt)("inlineCode",{parentName:"p"},"a")," hingga angka di bawah ",(0,t.kt)("inlineCode",{parentName:"p"},"b"),"."),(0,t.kt)("p",null,"Pada contoh di atas, ",(0,t.kt)("inlineCode",{parentName:"p"},"0..5")," artinya adalah objek iterator yang dimulai dari angka ",(0,t.kt)("inlineCode",{parentName:"p"},"0")," hingga di bawah ",(0,t.kt)("inlineCode",{parentName:"p"},"5")," (yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"4"),"). Object iterator tersebut kemudian diiterasi, dan ditiap perulangan di-print menggunakan ",(0,t.kt)("inlineCode",{parentName:"p"},'println!("{i}")'),". Dengan ini, nilai ",(0,t.kt)("inlineCode",{parentName:"p"},"i")," muncul di layar console dimulai angka ",(0,t.kt)("inlineCode",{parentName:"p"},"0")," hingga ",(0,t.kt)("inlineCode",{parentName:"p"},"4"),"."),(0,t.kt)("p",null,"Jika ingin melakukan perulangan dari ",(0,t.kt)("inlineCode",{parentName:"p"},"a")," ke ",(0,t.kt)("inlineCode",{parentName:"p"},"b")," (bukan dari ",(0,t.kt)("inlineCode",{parentName:"p"},"a")," ke angka di bawah ",(0,t.kt)("inlineCode",{parentName:"p"},"b"),") gunakan notasi iterator ",(0,t.kt)("inlineCode",{parentName:"p"},"a..=b"),". Contoh:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'for i in 0..=5 {\n println!("{i}");\n}\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"perulangan for in",src:n(1154).Z,width:"445",height:"192"})),(0,t.kt)("h2",{id:"a122-label-perulangan"},"A.12.2. Label perulangan"),(0,t.kt)("p",null,"Penambahan label pada perulangan ",(0,t.kt)("inlineCode",{parentName:"p"},"for in")," juga bisa dilakukan. Caranya dengan cukup menambahkan sintaks ",(0,t.kt)("inlineCode",{parentName:"p"},"'namaLabel: ")," sebelum statement ",(0,t.kt)("inlineCode",{parentName:"p"},"for in"),". Contohnya seperti berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'\'perulangan: for i in 0..=5 {\n if i > 3 {\n println!("perulangan dihentikan paksa pada iterasi {i}");\n break \'perulangan;\n }\n\n println!("{i}");\n}\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"label perulangan for in",src:n(8267).Z,width:"448",height:"180"})),(0,t.kt)("p",null,"Selain ",(0,t.kt)("inlineCode",{parentName:"p"},"break"),", keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"continue")," juga bisa digunakan pada perulangan ",(0,t.kt)("inlineCode",{parentName:"p"},"for in"),"."),(0,t.kt)("h2",{id:"a123-perulangan-for-in-pada-array"},"A.12.3. Perulangan ",(0,t.kt)("inlineCode",{parentName:"h2"},"for in")," pada array"),(0,t.kt)("p",null,"Perulangan menggunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"for in")," adalah yang paling praktis digunakan untuk mengiterasi elemen array. Contoh:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let array = ["jason", "grayon", "drake", "damian"];\nfor name in array {\n println!("{name}");\n}\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"label perulangan for in",src:n(2977).Z,width:"445",height:"149"})),(0,t.kt)("p",null,"Perihal apa itu ",(0,t.kt)("inlineCode",{parentName:"p"},"array")," akan dibahas pada chapter selanjutnya, yaitu ",(0,t.kt)("a",{parentName:"p",href:"/basic/array"},"Array"),"."),(0,t.kt)("h2",{id:"a124-perulangan-for-in-pada-tipe-iterator-lainnya"},"A.12.4. Perulangan ",(0,t.kt)("inlineCode",{parentName:"h2"},"for in")," pada tipe iterator lainnya"),(0,t.kt)("p",null,"Di Rust ada banyak cara membuat object iterator. Mengenai topik satu ini kita akan bahas seiring berjalannya proses pembelajaran. Akan berpotesi makin membingungkan jika dibahas terlalu detail pada chapter ini."),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/perulangan_for_in"},"github.com/novalagung/dasarpemrogramanrust-example/../perulangan_for_in")),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/expressions/loop-expr.html"},"https://doc.rust-lang.org/reference/expressions/loop-expr.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.in.html"},"https://doc.rust-lang.org/std/keyword.in.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.for.html"},"https://doc.rust-lang.org/std/keyword.for.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/flow_control/for.html"},"https://doc.rust-lang.org/rust-by-example/flow_control/for.html"))))}c.isMDXComponent=!0},2472:(A,a,n)=>{n.d(a,{Z:()=>e});const e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb4AAACpCAIAAADbS88pAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb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uxVZX8g82C835bX8BjMFAAAYf/zHm9u53SVduLiym1dXH3iH9NQt1hPKz+/kcsWd1fz9rfu0uZPrzNShlwQAuFxADwkAAMTAuXcAABADfhMAAMSA3wQAADHgNwEAQAz4TQAAEAN+EwAAxBiobnEnXhHyxQCAKwPGmwAAIEa/nk/3YTuXwcPoAICrQze6xQyJ4o18camhzilKpKnulhNrSqSp5u9vUSecTcrDrXC8srnzgB7uR3PaQ/AQ/gAAjC/d6BazJYplJbqf2a1ElDXt/8TqCh1s3de0ja1peigcR5TcaiNvlUIGAIBxpBvdYrZEcVMtblv/98RL4biyq+l7OGSPAQBgvOhqfdNDonhI0QEAYKR0sZ9uSBTrM+1mcIx+RgcAgBHTpW6xl0QxJz1GBwCAEdKFbnGARHGHrQPrhHytWFzT9sk5owMAwHgC3WIAABADzwsBAIAY8JsAACAG/CYAAIgBvwkAAGLAbwIAgBjwmwAAIAb8JgAAiAG/CQAAYsBvAgCAGPCbAAAgBvwmAACIAb8JAABiwG8CAIAY8JsAACAG/CYAAIgBvwkAAGL8P8WW/mrC7FDtAAAAAElFTkSuQmCC"}}]); \ No newline at end of file diff --git a/assets/js/7390b81e.1668d251.js b/assets/js/7390b81e.1668d251.js new file mode 100644 index 00000000..0f688d5e --- /dev/null +++ b/assets/js/7390b81e.1668d251.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4274],{3905:(a,e,n)=>{n.d(e,{Zo:()=>u,kt:()=>g});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function d(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},r=Object.keys(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var m=t.createContext({}),p=function(a){var e=t.useContext(m),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},u=function(a){var e=p(a.components);return t.createElement(m.Provider,{value:e},a.children)},k={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},o=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,r=a.originalType,m=a.parentName,u=d(a,["components","mdxType","originalType","parentName"]),o=p(n),g=i,c=o["".concat(m,".").concat(g)]||o[g]||k[g]||r;return n?t.createElement(c,l(l({ref:e},u),{},{components:n})):t.createElement(c,l({ref:e},u))}));function g(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=n.length,l=new Array(r);l[0]=o;var d={};for(var m in e)hasOwnProperty.call(e,m)&&(d[m]=e[m]);d.originalType=a,d.mdxType="string"==typeof a?a:i,l[1]=d;for(var p=2;p<r;p++)l[p]=n[p];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}o.displayName="MDXCreateElement"},6981:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>m,contentTitle:()=>l,default:()=>k,frontMatter:()=>r,metadata:()=>d,toc:()=>p});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:19,title:"A.19. Module System \u279c Package & Crate",sidebar_label:"A.19. Module System \u279c Package & Crate"},l=void 0,d={unversionedId:"basic/package-crate",id:"basic/package-crate",title:"A.19. Module System \u279c Package & Crate",description:"Chapter ini membahas mengenai konsep package dan path dalam Rust programming. Pembelajaran dimulai dari pembahasan mengenai konsep crate terlebih dahulu, kemudian masuk ke package.",source:"@site/docs/basic/package-crate.md",sourceDirName:"basic",slug:"/basic/package-crate",permalink:"/basic/package-crate",draft:!1,tags:[],version:"current",sidebarPosition:19,frontMatter:{sidebar_position:19,title:"A.19. Module System \u279c Package & Crate",sidebar_label:"A.19. Module System \u279c Package & Crate"},sidebar:"tutorialSidebar",previous:{title:"A.18. Module System \u279c Path & Item",permalink:"/basic/path-item"},next:{title:"A.20. Module System \u279c Module",permalink:"/basic/module-basic"}},m={},p=[{value:"A.19.1. Rust Crate",id:"a191-rust-crate",level:2},{value:"\u25c9 Binary crate",id:"-binary-crate",level:3},{value:"\u25c9 Library crate",id:"-library-crate",level:3},{value:"A.19.2. Rust Package",id:"a192-rust-package",level:2},{value:"\u25c9 <em>Naming convention</em> package",id:"-naming-convention-package",level:3},{value:"\u25c9 File <code>Cargo.toml</code>",id:"-file-cargotoml",level:3},{value:"\u25c9 Website crates.io",id:"-website-cratesio",level:3},{value:"\u25c9 Menambahkan dependency atau external crate",id:"-menambahkan-dependency-atau-external-crate",level:3},{value:"\u25c9 Command <code>cargo add</code>",id:"-command-cargo-add",level:3},{value:"A.19.3. Praktik membuat program menampilkan angka random",id:"a193-praktik-membuat-program-menampilkan-angka-random",level:2},{value:"\u25c9 Fungsi <code>generate_random_number</code>",id:"-fungsi-generate_random_number",level:3},{value:"\u25c9 Statement <code>rand::thread_rng().gen_range(0..100)</code>",id:"-statement-randthread_rnggen_range0100",level:3},{value:"\u25c9 Fungsi <code>main</code>",id:"-fungsi-main",level:3},{value:"A.19.4. Pembahasan lanjutan",id:"a194-pembahasan-lanjutan",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],u={toc:p};function k(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,t.Z)({},u,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Chapter ini membahas mengenai konsep package dan path dalam Rust programming. Pembelajaran dimulai dari pembahasan mengenai konsep crate terlebih dahulu, kemudian masuk ke package."),(0,i.kt)("h2",{id:"a191-rust-crate"},"A.19.1. Rust Crate"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Crate")," adalah satu unit kompilasi di Rust. Eksekusi command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo build"),", atau ",(0,i.kt)("inlineCode",{parentName:"p"},"rustc")," men-",(0,i.kt)("em",{parentName:"p"},"trigger")," proses kompilasi, dan unit (yang di sini disebut dengan crate) akan di-compile."),(0,i.kt)("p",null,"Crate bisa berisi banyak ",(0,i.kt)("em",{parentName:"p"},"module"),". Sebuah module definisinya bisa berada di banyak file. Agar lebih jelas silakan perhatikan contoh berikut:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"XYZ")," adalah sebuah crate, isinya ada dua module, yaitu module ",(0,i.kt)("inlineCode",{parentName:"li"},"Mod_ABC")," dan module ",(0,i.kt)("inlineCode",{parentName:"li"},"Mod_DEF"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"Mod_ABC")," adalah module yang didefinisikan dalam crate ",(0,i.kt)("inlineCode",{parentName:"li"},"XYZ"),", source code-nya berada di file bernama ",(0,i.kt)("inlineCode",{parentName:"li"},"modul_a.rs"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"Mod_DEF")," adalah module yang didefinisikan dalam crate ",(0,i.kt)("inlineCode",{parentName:"li"},"XYZ"),", source code-nya berada di beberapa file ",(0,i.kt)("inlineCode",{parentName:"li"},"module_b_one.rs")," dan ",(0,i.kt)("inlineCode",{parentName:"li"},"module_b_two.rs"),".")),(0,i.kt)("p",null,"Dari contoh di atas, crate ",(0,i.kt)("inlineCode",{parentName:"p"},"XYZ")," adalah 1 unit kompilasi, yang mana di dalam crate tersebut ada dua modules yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"Mod_ABC")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Mod_DEF")),(0,i.kt)("p",null,"Rust mengkategorikan crate menjadi 2 jenis, ",(0,i.kt)("em",{parentName:"p"},"binary crate")," dan ",(0,i.kt)("em",{parentName:"p"},"library crate")),(0,i.kt)("h3",{id:"-binary-crate"},"\u25c9 Binary crate"),(0,i.kt)("p",null,"Binary crate adalah program yang dikompilasi ke bentuk ",(0,i.kt)("em",{parentName:"p"},"executable"),", untuk kemudian dijalankan, seperti program-program yang sudah kita buat menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo create")," dan run menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run")," itu adalah contoh dari binary crate."),(0,i.kt)("p",null,"Binary crate berada dalam sebuah package yang dibuat menggunakan command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo create <nama_package>")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo create --bin <nama_package>"),", kedua command ini menjalankan perintah yang sama."),(0,i.kt)("p",null,"Ciri khas dari binary crate adalah memiliki fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),", sebuah fungsi yang merupakan ",(0,i.kt)("em",{parentName:"p"},"entrypoint")," program."),(0,i.kt)("h3",{id:"-library-crate"},"\u25c9 Library crate"),(0,i.kt)("p",null,"Library crate berbeda dengan binary crate. Library crate tidak di-compile ke bentuk ",(0,i.kt)("em",{parentName:"p"},"executable")," dan tidak memiliki fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),". Library crate digunakan untuk mendefinisikan set ",(0,i.kt)("em",{parentName:"p"},"functionality")," yang ",(0,i.kt)("em",{parentName:"p"},"reusable")," atau bisa digunakan di banyak project/package."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Library crate di-import/digunakan dalam binary crate. Dalam proses kompilasinya, yang di-compile adalah binary crate. Library crate juga akan ikut dalam kompilasi tersebut.")),(0,i.kt)("p",null,"Sebagai contoh item ",(0,i.kt)("inlineCode",{parentName:"p"},"Duration")," (yang sudah dipraktikkan pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/perulangan-while"},"Perulangan \u279c while"),") dan ",(0,i.kt)("inlineCode",{parentName:"p"},"stdin")," (pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/path-item"},"Module System \u279c Path & Item"),") adalah dua buah item milik crate ",(0,i.kt)("em",{parentName:"p"},"Rust Standard Library")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"std"),". Crate ",(0,i.kt)("inlineCode",{parentName:"p"},"std")," ini akan sangat sering kita gunakan dalam package/project, isinya banyak sekali functionality untuk keperluan standar dalam Rust programming."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Di komunitas Rust, ketika ada kata ",(0,i.kt)("em",{parentName:"p"},"library")," atau ",(0,i.kt)("em",{parentName:"p"},"crate")," maka yang dimaksud biasanya adalah ",(0,i.kt)("em",{parentName:"p"},"library crate"))),(0,i.kt)("p",null,"Kita bisa membuat library crate kemudian di-publish ke ",(0,i.kt)("a",{parentName:"p",href:"https://crates.io/"},"crates.io")," agar bisa digunakan banyak orang. Command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo new --lib <nama_package>")," digunakan untuk membuat library crate."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai library crate dibahas terpisah pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/library-crate"},"Library Crate"))),(0,i.kt)("h2",{id:"a192-rust-package"},"A.19.2. Rust Package"),(0,i.kt)("p",null,"Istilah package dalam Rust programming masih sama dengan package dalam pemrograman lain. Package adalah sebuah set yang berisi banyak ",(0,i.kt)("em",{parentName:"p"},"functionality"),". Satu buah package bisa berisi satu atau banyak crates."),(0,i.kt)("p",null,"Package di-manage oleh Cargo, yang merupakan package manager Rust. Command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo new <nama_package>")," digunakan untuk membuat package. Command tersebut menghasilkan beberapa file yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"src/main.rs")," yang isinya adalah kode program, dan juga file ",(0,i.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," yang isinya adalah informasi mengenai package tersebut."),(0,i.kt)("p",null,"Ok, sekalian praktik mungkin lebih pas. Silakan jalankan command berikut, kemudian ikuti penjelasan selanjutnya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"cargo new belajar_package_crate\n")),(0,i.kt)("h3",{id:"-naming-convention-package"},"\u25c9 ",(0,i.kt)("em",{parentName:"h3"},"Naming convention")," package"),(0,i.kt)("p",null,"Khusus untuk penamaan package dan juga crate, tidak ada rekomendasi dari dokumentasi official Rust. Pada ebook ini penulis menggunakan ",(0,i.kt)("em",{parentName:"p"},"snake case")," sebagai naming convention dalam pembuatan package."),(0,i.kt)("p",null,"Referensi: ",(0,i.kt)("a",{parentName:"p",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"https://rust-lang.github.io/api-guidelines/naming.html")),(0,i.kt)("h3",{id:"-file-cargotoml"},"\u25c9 File ",(0,i.kt)("inlineCode",{parentName:"h3"},"Cargo.toml")),(0,i.kt)("p",null,"File ",(0,i.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," menampung beberapa informasi penting milik package, di antaranya adalah nama package, versi package dan juga versi rust, serta ",(0,i.kt)("em",{parentName:"p"},"dependencies")," atau ",(0,i.kt)("em",{parentName:"p"},"3rd-party")," yang digunakan dalam package (dalam konteks Rust adalah ",(0,i.kt)("em",{parentName:"p"},"crate"),")."),(0,i.kt)("p",null,"Command yang sebelumnya di-run menghasilkan file ",(0,i.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-toml",metastring:'title="Cargo.toml"',title:'"Cargo.toml"'},'[package]\nname = "belajar_package_crate"\nversion = "0.1.0"\nedition = "2021"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\n')),(0,i.kt)("p",null,"Blok ",(0,i.kt)("inlineCode",{parentName:"p"},"package")," berisi berisi 3 buah field:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"name")," isinya adalah nama package, sesuai dengan argument command ",(0,i.kt)("inlineCode",{parentName:"li"},"cargo new <nama_package>"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"version")," default-nya selalu ",(0,i.kt)("inlineCode",{parentName:"li"},"0.1.0"),", namun kita bisa ubah nilainya seiring berjalannya proses pengembangan aplikasi."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"edition")," di sini me-refer ke edisi rust yang dipakai. Di ebook ini, rust versi ",(0,i.kt)("strong",{parentName:"li"},"1.65.0")," digunakan, dan edisi untuk versi tersebut adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"2021"),".")),(0,i.kt)("p",null,"Blok ",(0,i.kt)("inlineCode",{parentName:"p"},"dependencies")," default-nya berisi kosong. Jika kita menambahkan external dependencies atau crates, maka detailnya tercatat pada blok ",(0,i.kt)("inlineCode",{parentName:"p"},"dependencies")," ini."),(0,i.kt)("h3",{id:"-website-cratesio"},"\u25c9 Website ",(0,i.kt)("a",{parentName:"h3",href:"https://crates.io/"},"crates.io")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"crates.io")," merupakan official website dari Rust untuk pencarian dan juga ",(0,i.kt)("em",{parentName:"p"},"managing")," dependency. Silakan manfaatkan website tersebut untuk mencari crates sesuai kebutuhan."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},(0,i.kt)("a",{parentName:"p",href:"https://crates.io/"},"https://crates.io/"))),(0,i.kt)("h3",{id:"-menambahkan-dependency-atau-external-crate"},"\u25c9 Menambahkan dependency atau external crate"),(0,i.kt)("p",null,"proses pembelajaran akan dilanjutkan sambil praktik. Pada bagian ini kita akan buat program sederhana yang di dalamnya memanfaatkan sebuah dependency atau external crate."),(0,i.kt)("p",null,"Pertama-tama buka ",(0,i.kt)("a",{parentName:"p",href:"https://crates.io/"},"crates.io"),", lalu gunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"rand")," dalam pencarian, hasilnya adalah dependency bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"rand"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"package crate",src:n(6637).Z,width:"814",height:"429"})),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"rand")," merupakan crate yang isinya banyak fungsi untuk keperluan ",(0,i.kt)("em",{parentName:"p"},"generate")," data random."),(0,i.kt)("p",null,"Sekarang buka file ",(0,i.kt)("inlineCode",{parentName:"p"},"Cargo.toml"),", dan tambahkan dependency ",(0,i.kt)("inlineCode",{parentName:"p"},"rand"),". Sesuaikan dengan versi yang muncul di layar masing-masing."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-toml",metastring:'title="Cargo.toml"',title:'"Cargo.toml"'},'[package]\nname = "package_crate"\nversion = "0.1.0"\nedition = "2021"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\nrand = "0.8.5"\n')),(0,i.kt)("p",null,"Jalankan command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo build")," untuk memaksa Cargo agar mendownload depdency yang sudah ditambahkan ke file ",(0,i.kt)("inlineCode",{parentName:"p"},"Cargo.toml"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"cargo download dependency",src:n(2002).Z,width:"440",height:"172"})),(0,i.kt)("p",null,"Sukses! Sekarang dependency ",(0,i.kt)("inlineCode",{parentName:"p"},"rand")," sudah bisa digunakan dalam package yang sudah dibuat."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Jika pembaca menemui error ",(0,i.kt)("inlineCode",{parentName:"p"},"failed to authenticate when downloading repository"),", jalankan beberapa command berikut secara berurutan:"),(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"ssh-agent -s")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"ssh-add")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"cargo build")))),(0,i.kt)("p",null,"Jadi kurang lebih seperti itu cara menambahkan dependency di Rust. Seiring berjalannya proses pembelajaran penulis yakin pembaca akan terbiasa dengan flow dan juga command di atas."),(0,i.kt)("h3",{id:"-command-cargo-add"},"\u25c9 Command ",(0,i.kt)("inlineCode",{parentName:"h3"},"cargo add")),(0,i.kt)("p",null,"Selain cara di atas, ada cara lain yang lebih ringkas untuk penambahan package, yaitu menggunakan command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo add <nama_crate>"),". Command ini secara otomatis menambahkan package yang diinginkan ke file ",(0,i.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," kemudian mengunduhnya."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Menambahkan package ",(0,i.kt)("inlineCode",{parentName:"p"},"rand")," versi terbaru"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"cargo add rand\n"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Menambahkan package ",(0,i.kt)("inlineCode",{parentName:"p"},"rand")," versi ",(0,i.kt)("inlineCode",{parentName:"p"},"0.8.5")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"cargo add rand@0.8.5\n")))),(0,i.kt)("h2",{id:"a193-praktik-membuat-program-menampilkan-angka-random"},"A.19.3. Praktik membuat program menampilkan angka random"),(0,i.kt)("p",null,"Ok, sekarang kita lanjutkan praktik pembuatan program sederhana untuk menampilkan angka random."),(0,i.kt)("p",null,"Angka random di sini akan di-generate menggunakan fungsi yang ada dalam dependency ",(0,i.kt)("inlineCode",{parentName:"p"},"rand")," yang sudah ditambahkan ke package."),(0,i.kt)("p",null,"Silakan tulis kode berikut ke file ",(0,i.kt)("inlineCode",{parentName:"p"},"src/main.rs"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'use rand::Rng;\n\nfn generate_random_number() -> i32 {\n rand::thread_rng().gen_range(0..100)\n}\n\nfn main() {\n for i in 0..5 {\n println!("random number {}: {}", i, generate_random_number());\n }\n}\n')),(0,i.kt)("p",null,"Jalankan program, lalu lihat hasilnya. Sejumlah data angka random muncul di layar output."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"rand crate",src:n(8240).Z,width:"455",height:"158"})),(0,i.kt)("p",null,"Silakan coba untuk run beberapa kali, angka random berbeda setiap kali run."),(0,i.kt)("h3",{id:"-fungsi-generate_random_number"},"\u25c9 Fungsi ",(0,i.kt)("inlineCode",{parentName:"h3"},"generate_random_number")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"generate_random_number")," adalah fungsi yang kita buat, yang tugasnya mengembalikan sebuah nilai numerik bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),". Angka tersebut berasal dari proses ",(0,i.kt)("em",{parentName:"p"},"generate random")," hasil eksekusi statement ",(0,i.kt)("inlineCode",{parentName:"p"},"rand::thread_rng().gen_range(0..100)"),"."),(0,i.kt)("h3",{id:"-statement-randthread_rnggen_range0100"},"\u25c9 Statement ",(0,i.kt)("inlineCode",{parentName:"h3"},"rand::thread_rng().gen_range(0..100)")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"rand::thread_rng().gen_range")," digunakan untuk generate data random. Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"gen_range")," menerima argument bertipe range, dan angka random akan di-generate sesuai range tersebut. Sebagai contoh, range ",(0,i.kt)("inlineCode",{parentName:"p"},"0..100")," menghasilkan angka random antara ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," hingga ",(0,i.kt)("inlineCode",{parentName:"p"},"99"),"."),(0,i.kt)("p",null,"O iya, penggunaan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"gen_range")," mewajibkan kita untuk import path ",(0,i.kt)("inlineCode",{parentName:"p"},"rand::Rng"),". Itulah kenapa ada statement ",(0,i.kt)("inlineCode",{parentName:"p"},"use rand::Rng"),"."),(0,i.kt)("h3",{id:"-fungsi-main"},"\u25c9 Fungsi ",(0,i.kt)("inlineCode",{parentName:"h3"},"main")),(0,i.kt)("p",null,"Dalam blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),", isinya sebuah perulangan sederhana yang menampilkan angka random hasil eksekusi fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"generate_random_number")," di setiap iterasinya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'for i in 0..5 {\n println!("random number {}: {}", i, generate_random_number());\n}\n')),(0,i.kt)("h2",{id:"a194-pembahasan-lanjutan"},"A.19.4. Pembahasan lanjutan"),(0,i.kt)("p",null,"Sekian pembahasan mengenai package dan crate. Semoga membantu, silakan diulang-ulang jika perlu agar tidak bingung, ",(0,i.kt)("strong",{parentName:"p"},"module system")," merupakan salah satu hal yang sangat penting di Rust."),(0,i.kt)("p",null,"Masih dalam topik ",(0,i.kt)("em",{parentName:"p"},"module system"),", penulis anjurkan untuk lanjut ke chapter berikutnya karena berkaitan."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/package_crate"},"github.com/novalagung/dasarpemrogramanrust-example/../package_crate")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html"},"https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/crates.html"},"https://doc.rust-lang.org/rust-by-example/crates.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"https://rust-lang.github.io/api-guidelines/naming.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://aloso.github.io/2021/03/28/module-system.html"},"https://aloso.github.io/2021/03/28/module-system.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://github.com/rust-lang/cargo/issues/3381"},"https://github.com/rust-lang/cargo/issues/3381"))))}k.isMDXComponent=!0},6637:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/package-crate-1-bc29d1ca7bd36fcd767c54466152bf67.png"},2002:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbgAAACsCAIAAACGmC7dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF5WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRh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U9SlUtcr7uUMngobPQJREAFqWquFYbXavLB/n7+au6NgK+OyEALEhVca1eZd1P6q8HU9UioysmAAAWqaq4VudmDpri9pvmaI7YmIFFvQAAC5gBkONFXKvjNuqhqt48aiDi3LkAsGhVxbVamiTxaSuBhaQGrxEMfApRVYBFqyqu1bb2Ms2rRpIatDLvCQBY+gwArtWDqmoU7Da3VbBYBbA4VQUAAFQVAABVBQBAVQEAAFUFAEBVAQBQVQAAVBUAAFBVAABUFQAAVQUAAFQVAGAq/g8/e2sVyxh7AgAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/7390b81e.18c2ce22.js b/assets/js/7390b81e.18c2ce22.js deleted file mode 100644 index f122c95e..00000000 --- a/assets/js/7390b81e.18c2ce22.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4274],{3905:(a,e,n)=>{n.d(e,{Zo:()=>u,kt:()=>g});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function m(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},r=Object.keys(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var d=t.createContext({}),p=function(a){var e=t.useContext(d),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},u=function(a){var e=p(a.components);return t.createElement(d.Provider,{value:e},a.children)},k={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},o=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,r=a.originalType,d=a.parentName,u=m(a,["components","mdxType","originalType","parentName"]),o=p(n),g=i,c=o["".concat(d,".").concat(g)]||o[g]||k[g]||r;return n?t.createElement(c,l(l({ref:e},u),{},{components:n})):t.createElement(c,l({ref:e},u))}));function g(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=n.length,l=new Array(r);l[0]=o;var m={};for(var d in e)hasOwnProperty.call(e,d)&&(m[d]=e[d]);m.originalType=a,m.mdxType="string"==typeof a?a:i,l[1]=m;for(var p=2;p<r;p++)l[p]=n[p];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}o.displayName="MDXCreateElement"},6981:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>d,contentTitle:()=>l,default:()=>k,frontMatter:()=>r,metadata:()=>m,toc:()=>p});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:19,title:"A.19. Module System \u279c Package & Crate",sidebar_label:"A.19. Module System \u279c Package & Crate"},l=void 0,m={unversionedId:"basic/package-crate",id:"basic/package-crate",title:"A.19. Module System \u279c Package & Crate",description:"Chapter ini membahas mengenai konsep package dan path dalam Rust programming. Pembelajaran dimulai dari pembahasan mengenai konsep crate terlebih dahulu, kemudian masuk ke package.",source:"@site/docs/basic/package-crate.md",sourceDirName:"basic",slug:"/basic/package-crate",permalink:"/basic/package-crate",draft:!1,tags:[],version:"current",sidebarPosition:19,frontMatter:{sidebar_position:19,title:"A.19. Module System \u279c Package & Crate",sidebar_label:"A.19. Module System \u279c Package & Crate"},sidebar:"tutorialSidebar",previous:{title:"A.18. Module System \u279c Path & Item",permalink:"/basic/path-item"},next:{title:"A.20. Module System \u279c Module",permalink:"/basic/module-basic"}},d={},p=[{value:"A.19.1. Rust Crate",id:"a191-rust-crate",level:2},{value:"\u25c9 Binary crate",id:"-binary-crate",level:3},{value:"\u25c9 Library crate",id:"-library-crate",level:3},{value:"A.19.2. Rust Package",id:"a192-rust-package",level:2},{value:"\u25c9 <em>Naming convention</em> package",id:"-naming-convention-package",level:3},{value:"\u25c9 File <code>Cargo.toml</code>",id:"-file-cargotoml",level:3},{value:"\u25c9 Website crates.io",id:"-website-cratesio",level:3},{value:"\u25c9 Menambahkan dependency atau external crate",id:"-menambahkan-dependency-atau-external-crate",level:3},{value:"\u25c9 Command <code>cargo add</code>",id:"-command-cargo-add",level:3},{value:"A.19.3. Praktik membuat program menampilkan angka random",id:"a193-praktik-membuat-program-menampilkan-angka-random",level:2},{value:"\u25c9 Fungsi <code>generate_random_number</code>",id:"-fungsi-generate_random_number",level:3},{value:"\u25c9 Statement <code>rand::thread_rng().gen_range(0..100)</code>",id:"-statement-randthread_rnggen_range0100",level:3},{value:"\u25c9 Fungsi <code>main</code>",id:"-fungsi-main",level:3},{value:"A.19.4. Pembahasan lanjutan",id:"a194-pembahasan-lanjutan",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],u={toc:p};function k(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,t.Z)({},u,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Chapter ini membahas mengenai konsep package dan path dalam Rust programming. Pembelajaran dimulai dari pembahasan mengenai konsep crate terlebih dahulu, kemudian masuk ke package."),(0,i.kt)("h2",{id:"a191-rust-crate"},"A.19.1. Rust Crate"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Crate")," adalah satu unit kompilasi di Rust. Eksekusi command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo build"),", atau ",(0,i.kt)("inlineCode",{parentName:"p"},"rustc")," men-",(0,i.kt)("em",{parentName:"p"},"trigger")," proses kompilasi, dan unit (yang di sini disebut dengan crate) akan di-compile."),(0,i.kt)("p",null,"Crate bisa berisi banyak ",(0,i.kt)("em",{parentName:"p"},"module"),". Sebuah module definisinya bisa berada di banyak file. Agar lebih jelas silakan perhatikan contoh berikut:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"XYZ")," adalah sebuah crate, isinya ada dua module, yaitu module ",(0,i.kt)("inlineCode",{parentName:"li"},"Mod_ABC")," dan module ",(0,i.kt)("inlineCode",{parentName:"li"},"Mod_DEF"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"Mod_ABC")," adalah module yang didefinisikan dalam crate ",(0,i.kt)("inlineCode",{parentName:"li"},"XYZ"),", source code-nya berada di file bernama ",(0,i.kt)("inlineCode",{parentName:"li"},"modul_a.rs"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"Mod_DEF")," adalah module yang didefinisikan dalam crate ",(0,i.kt)("inlineCode",{parentName:"li"},"XYZ"),", source code-nya berada di beberapa file ",(0,i.kt)("inlineCode",{parentName:"li"},"module_b_one.rs")," dan ",(0,i.kt)("inlineCode",{parentName:"li"},"module_b_two.rs"),".")),(0,i.kt)("p",null,"Dari contoh di atas, crate ",(0,i.kt)("inlineCode",{parentName:"p"},"XYZ")," adalah 1 unit kompilasi, yang mana di dalam crate tersebut ada dua modules yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"Mod_ABC")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Mod_DEF")),(0,i.kt)("p",null,"Rust mengkategorikan crate menjadi 2 jenis, ",(0,i.kt)("em",{parentName:"p"},"binary crate")," dan ",(0,i.kt)("em",{parentName:"p"},"library crate")),(0,i.kt)("h3",{id:"-binary-crate"},"\u25c9 Binary crate"),(0,i.kt)("p",null,"Binary crate adalah program yang dikompilasi ke bentuk ",(0,i.kt)("em",{parentName:"p"},"executable"),", untuk kemudian dijalankan, seperti program-program yang sudah kita buat menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo create")," dan run menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run")," itu adalah contoh dari binary crate."),(0,i.kt)("p",null,"Binary crate berada dalam sebuah package yang dibuat menggunakan command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo create <nama_package>")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo create --bin <nama_package>"),", kedua command ini menjalankan perintah yang sama."),(0,i.kt)("p",null,"Ciri khas dari binary crate adalah memiliki fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),", sebuah fungsi yang merupakan ",(0,i.kt)("em",{parentName:"p"},"entrypoint")," program."),(0,i.kt)("h3",{id:"-library-crate"},"\u25c9 Library crate"),(0,i.kt)("p",null,"Library crate berbeda dengan binary crate. Library crate tidak di-compile ke bentuk ",(0,i.kt)("em",{parentName:"p"},"executable")," dan tidak memiliki fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),". Library crate digunakan untuk mendefinisikan set ",(0,i.kt)("em",{parentName:"p"},"functionality")," yang ",(0,i.kt)("em",{parentName:"p"},"reusable")," atau bisa digunakan di banyak project/package."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Library crate di-import/digunakan dalam binary crate. Dalam proses kompilasinya, yang di-compile adalah binary crate. Library crate juga akan ikut dalam kompilasi tersebut.")),(0,i.kt)("p",null,"Sebagai contoh item ",(0,i.kt)("inlineCode",{parentName:"p"},"Duration")," (yang sudah dipraktikkan pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/perulangan-while"},"Perulangan \u279c while"),") dan ",(0,i.kt)("inlineCode",{parentName:"p"},"stdin")," (pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/path-item"},"Module System \u279c Path & Item"),") adalah dua buah item milik crate ",(0,i.kt)("em",{parentName:"p"},"Rust Standard Library")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"std"),". Crate ",(0,i.kt)("inlineCode",{parentName:"p"},"std")," ini akan sangat sering kita gunakan dalam package/project, isinya banyak sekali functionality untuk keperluan standar dalam Rust programming."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Di komunitas Rust, ketika ada kata ",(0,i.kt)("em",{parentName:"p"},"library")," atau ",(0,i.kt)("em",{parentName:"p"},"crate")," maka yang dimaksud biasanya adalah ",(0,i.kt)("em",{parentName:"p"},"library crate"))),(0,i.kt)("p",null,"Kita bisa membuat library crate kemudian di-publish ke ",(0,i.kt)("a",{parentName:"p",href:"https://crates.io/"},"crates.io")," agar bisa digunakan banyak orang. Command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo new --lib <nama_package>")," digunakan untuk membuat library crate."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai library crate dibahas terpisah pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/library-crate"},"Library Crate"))),(0,i.kt)("h2",{id:"a192-rust-package"},"A.19.2. Rust Package"),(0,i.kt)("p",null,"Istilah package dalam Rust programming masih sama dengan package dalam pemrograman lain. Package adalah sebuah set yang berisi banyak ",(0,i.kt)("em",{parentName:"p"},"functionality"),". Satu buah package bisa berisi satu atau banyak crates."),(0,i.kt)("p",null,"Package di-manage oleh Cargo, yang merupakan package manager Rust. Command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo new <nama_package>")," digunakan untuk membuat package. Command tersebut menghasilkan beberapa file yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"src/main.rs")," yang isinya adalah kode program, dan juga file ",(0,i.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," yang isinya adalah informasi mengenai package tersebut."),(0,i.kt)("p",null,"Ok, sekalian praktik mungkin lebih pas. Silakan jalankan command berikut, kemudian ikuti penjelasan selanjutnya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"cargo new belajar_package_crate\n")),(0,i.kt)("h3",{id:"-naming-convention-package"},"\u25c9 ",(0,i.kt)("em",{parentName:"h3"},"Naming convention")," package"),(0,i.kt)("p",null,"Khusus untuk penamaan package dan juga crate, tidak ada rekomendasi dari dokumentasi official Rust. Pada ebook ini penulis menggunakan ",(0,i.kt)("em",{parentName:"p"},"snake case")," sebagai naming convention dalam pembuatan package."),(0,i.kt)("p",null,"Referensi: ",(0,i.kt)("a",{parentName:"p",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"https://rust-lang.github.io/api-guidelines/naming.html")),(0,i.kt)("h3",{id:"-file-cargotoml"},"\u25c9 File ",(0,i.kt)("inlineCode",{parentName:"h3"},"Cargo.toml")),(0,i.kt)("p",null,"File ",(0,i.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," menampung beberapa informasi penting milik package, di antaranya adalah nama package, versi package dan juga versi rust, serta ",(0,i.kt)("em",{parentName:"p"},"dependencies")," atau ",(0,i.kt)("em",{parentName:"p"},"3rd-party")," yang digunakan dalam package (dalam konteks Rust adalah ",(0,i.kt)("em",{parentName:"p"},"crate"),")."),(0,i.kt)("p",null,"Command yang sebelumnya di-run menghasilkan file ",(0,i.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-toml",metastring:'title="Cargo.toml"',title:'"Cargo.toml"'},'[package]\nname = "belajar_package_crate"\nversion = "0.1.0"\nedition = "2021"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\n')),(0,i.kt)("p",null,"Blok ",(0,i.kt)("inlineCode",{parentName:"p"},"package")," berisi berisi 3 buah field:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"name")," isinya adalah nama package, sesuai dengan argument command ",(0,i.kt)("inlineCode",{parentName:"li"},"cargo new <nama_package>"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"version")," default-nya selalu ",(0,i.kt)("inlineCode",{parentName:"li"},"0.1.0"),", namun kita bisa ubah nilainya seiring berjalannya proses pengembangan aplikasi."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"edition")," di sini me-refer ke edisi rust yang dipakai. Di ebook ini, rust versi ",(0,i.kt)("strong",{parentName:"li"},"1.65.0")," digunakan, dan edisi untuk versi tersebut adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"2021"),".")),(0,i.kt)("p",null,"Blok ",(0,i.kt)("inlineCode",{parentName:"p"},"dependencies")," default-nya berisi kosong. Jika kita menambahkan external dependencies atau crates, maka detailnya tercatat pada blok ",(0,i.kt)("inlineCode",{parentName:"p"},"dependencies")," ini."),(0,i.kt)("h3",{id:"-website-cratesio"},"\u25c9 Website ",(0,i.kt)("a",{parentName:"h3",href:"https://crates.io/"},"crates.io")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"crates.io")," merupakan official website dari Rust untuk pencarian dan juga ",(0,i.kt)("em",{parentName:"p"},"managing")," dependency. Silakan manfaatkan website tersebut untuk mencari crates sesuai kebutuhan."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},(0,i.kt)("a",{parentName:"p",href:"https://crates.io/"},"https://crates.io/"))),(0,i.kt)("h3",{id:"-menambahkan-dependency-atau-external-crate"},"\u25c9 Menambahkan dependency atau external crate"),(0,i.kt)("p",null,"proses pembelajaran akan dilanjutkan sambil praktik. Pada bagian ini kita akan buat program sederhana yang di dalamnya memanfaatkan sebuah dependency atau external crate."),(0,i.kt)("p",null,"Pertama-tama buka ",(0,i.kt)("a",{parentName:"p",href:"https://crates.io/"},"crates.io"),", lalu gunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"rand")," dalam pencarian, hasilnya adalah dependency bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"rand"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"package crate",src:n(6637).Z,width:"814",height:"429"})),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"rand")," merupakan crate yang isinya banyak fungsi untuk keperluan ",(0,i.kt)("em",{parentName:"p"},"generate")," data random."),(0,i.kt)("p",null,"Sekarang buka file ",(0,i.kt)("inlineCode",{parentName:"p"},"Cargo.toml"),", dan tambahkan dependency ",(0,i.kt)("inlineCode",{parentName:"p"},"rand"),". Sesuaikan dengan versi yang muncul di layar masing-masing."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-toml",metastring:'title="Cargo.toml"',title:'"Cargo.toml"'},'[package]\nname = "package_crate"\nversion = "0.1.0"\nedition = "2021"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\nrand = "0.8.5"\n')),(0,i.kt)("p",null,"Jalankan command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo build")," untuk memaksa Cargo agar mendownload depdency yang sudah ditambahkan ke file ",(0,i.kt)("inlineCode",{parentName:"p"},"Cargo.toml"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"cargo download dependency",src:n(2002).Z,width:"440",height:"172"})),(0,i.kt)("p",null,"Sukses! Sekarang dependency ",(0,i.kt)("inlineCode",{parentName:"p"},"rand")," sudah bisa digunakan dalam package yang sudah dibuat."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Jika pembaca menemui error ",(0,i.kt)("inlineCode",{parentName:"p"},"failed to authenticate when downloading repository"),", jalankan beberapa command berikut secara berurutan:"),(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"ssh-agent -s")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"ssh-add")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"cargo build")))),(0,i.kt)("p",null,"Jadi kurang lebih seperti itu cara menambahkan dependency di Rust. Seiring berjalannya proses pembelajaran penulis yakin pembaca akan terbiasa dengan flow dan juga command di atas."),(0,i.kt)("h3",{id:"-command-cargo-add"},"\u25c9 Command ",(0,i.kt)("inlineCode",{parentName:"h3"},"cargo add")),(0,i.kt)("p",null,"Selain cara di atas, ada cara lain yang lebih ringkas untuk penambahan package, yaitu menggunakan command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo add <nama_crate>"),". Command ini secara otomatis menambahkan package yang diinginkan ke file ",(0,i.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," kemudian mengunduhnya."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Menambahkan package ",(0,i.kt)("inlineCode",{parentName:"p"},"rand")," versi terbaru"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"cargo add rand\n"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Menambahkan package ",(0,i.kt)("inlineCode",{parentName:"p"},"rand")," versi ",(0,i.kt)("inlineCode",{parentName:"p"},"0.8.5")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"cargo add rand@0.8.5\n")))),(0,i.kt)("h2",{id:"a193-praktik-membuat-program-menampilkan-angka-random"},"A.19.3. Praktik membuat program menampilkan angka random"),(0,i.kt)("p",null,"Ok, sekarang kita lanjutkan praktik pembuatan program sederhana untuk menampilkan angka random."),(0,i.kt)("p",null,"Angka random di sini akan di-generate menggunakan fungsi yang ada dalam dependency ",(0,i.kt)("inlineCode",{parentName:"p"},"rand")," yang sudah ditambahkan ke package."),(0,i.kt)("p",null,"Silakan tulis kode berikut ke file ",(0,i.kt)("inlineCode",{parentName:"p"},"src/main.rs"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'use rand::Rng;\n\nfn generate_random_number() -> i32 {\n rand::thread_rng().gen_range(0..100)\n}\n\nfn main() {\n for i in 0..5 {\n println!("random number {}: {}", i, generate_random_number());\n }\n}\n')),(0,i.kt)("p",null,"Jalankan program, lalu lihat hasilnya. Sejumlah data angka random muncul di layar output."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"rand crate",src:n(8240).Z,width:"455",height:"158"})),(0,i.kt)("p",null,"Silakan coba untuk run beberapa kali, angka random berbeda setiap kali run."),(0,i.kt)("h3",{id:"-fungsi-generate_random_number"},"\u25c9 Fungsi ",(0,i.kt)("inlineCode",{parentName:"h3"},"generate_random_number")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"generate_random_number")," adalah fungsi yang kita buat, yang tugasnya mengembalikan sebuah nilai numerik bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),". Angka tersebut berasal dari proses ",(0,i.kt)("em",{parentName:"p"},"generate random")," hasil eksekusi statement ",(0,i.kt)("inlineCode",{parentName:"p"},"rand::thread_rng().gen_range(0..100)"),"."),(0,i.kt)("h3",{id:"-statement-randthread_rnggen_range0100"},"\u25c9 Statement ",(0,i.kt)("inlineCode",{parentName:"h3"},"rand::thread_rng().gen_range(0..100)")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"rand::thread_rng().gen_range")," digunakan untuk generate data random. Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"gen_range")," menerima argument bertipe range, dan angka random akan di-generate sesuai range tersebut. Sebagai contoh, range ",(0,i.kt)("inlineCode",{parentName:"p"},"0..100")," menghasilkan angka random antara ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," hingga ",(0,i.kt)("inlineCode",{parentName:"p"},"99"),"."),(0,i.kt)("p",null,"O iya, penggunaan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"gen_range")," mewajibkan kita untuk import path ",(0,i.kt)("inlineCode",{parentName:"p"},"rand::Rng"),". Itulah kenapa ada statement ",(0,i.kt)("inlineCode",{parentName:"p"},"use rand::Rng"),"."),(0,i.kt)("h3",{id:"-fungsi-main"},"\u25c9 Fungsi ",(0,i.kt)("inlineCode",{parentName:"h3"},"main")),(0,i.kt)("p",null,"Dalam blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),", isinya sebuah perulangan sederhana yang menampilkan angka random hasil eksekusi fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"generate_random_number")," di setiap iterasinya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'for i in 0..5 {\n println!("random number {}: {}", i, generate_random_number());\n}\n')),(0,i.kt)("h2",{id:"a194-pembahasan-lanjutan"},"A.19.4. Pembahasan lanjutan"),(0,i.kt)("p",null,"Sekian pembahasan mengenai package dan crate. Semoga membantu, silakan diulang-ulang jika perlu agar tidak bingung, ",(0,i.kt)("strong",{parentName:"p"},"module system")," merupakan salah satu hal yang sangat penting di Rust."),(0,i.kt)("p",null,"Masih dalam topik ",(0,i.kt)("em",{parentName:"p"},"module system"),", penulis anjurkan untuk lanjut ke chapter berikutnya karena berkaitan."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/package_crate"},"github.com/novalagung/dasarpemrogramanrust-example/../package_crate")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html"},"https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/crates.html"},"https://doc.rust-lang.org/rust-by-example/crates.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"https://rust-lang.github.io/api-guidelines/naming.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://aloso.github.io/2021/03/28/module-system.html"},"https://aloso.github.io/2021/03/28/module-system.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://github.com/rust-lang/cargo/issues/3381"},"https://github.com/rust-lang/cargo/issues/3381"))))}k.isMDXComponent=!0},6637:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/package-crate-1-bc29d1ca7bd36fcd767c54466152bf67.png"},2002:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbgAAACsCAIAAACGmC7dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF5WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm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a/assets/js/742a9bdc.3d1914e6.js b/assets/js/742a9bdc.3d1914e6.js new file mode 100644 index 00000000..5a05b2b4 --- /dev/null +++ b/assets/js/742a9bdc.3d1914e6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[7988],{3905:(a,e,n)=>{n.d(e,{Zo:()=>d,kt:()=>k});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function p(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},r=Object.keys(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var s=t.createContext({}),u=function(a){var e=t.useContext(s),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},d=function(a){var e=u(a.components);return t.createElement(s.Provider,{value:e},a.children)},m={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},o=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,r=a.originalType,s=a.parentName,d=p(a,["components","mdxType","originalType","parentName"]),o=u(n),k=i,c=o["".concat(s,".").concat(k)]||o[k]||m[k]||r;return n?t.createElement(c,l(l({ref:e},d),{},{components:n})):t.createElement(c,l({ref:e},d))}));function k(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=n.length,l=new Array(r);l[0]=o;var p={};for(var s in e)hasOwnProperty.call(e,s)&&(p[s]=e[s]);p.originalType=a,p.mdxType="string"==typeof a?a:i,l[1]=p;for(var u=2;u<r;u++)l[u]=n[u];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}o.displayName="MDXCreateElement"},8046:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>s,contentTitle:()=>l,default:()=>m,frontMatter:()=>r,metadata:()=>p,toc:()=>u});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:37,title:"A.37. Traits \u279c Advanced",sidebar_label:"A.37. Traits \u279c Advanced"},l=void 0,p={unversionedId:"basic/advanced-traits",id:"basic/advanced-traits",title:"A.37. Traits \u279c Advanced",description:"Chapter ini merupakan kelanjutan dari chapter sebelumnya. Di sini kita fokus ke pembuatan local trait, macam-macam implementasi traits, traits bound syntax, associated types, dan topik yang masih relevan dengan traits lainnya.",source:"@site/docs/basic/advanced-traits.md",sourceDirName:"basic",slug:"/basic/advanced-traits",permalink:"/basic/advanced-traits",draft:!1,tags:[],version:"current",sidebarPosition:37,frontMatter:{sidebar_position:37,title:"A.37. Traits \u279c Advanced",sidebar_label:"A.37. Traits \u279c Advanced"},sidebar:"tutorialSidebar",previous:{title:"A.36. Traits",permalink:"/basic/traits"},next:{title:"A.38. Generics",permalink:"/basic/generics"}},s={},u=[{value:"A.37.1. Membuat custom trait (local trait)",id:"a371-membuat-custom-trait-local-trait",level:2},{value:"\u25c9 Method <code>pow</code> untuk operasi pangkat",id:"-method-pow-untuk-operasi-pangkat",level:3},{value:"\u25c9 Keyword <code>as</code> untuk casting tipe data",id:"-keyword-as-untuk-casting-tipe-data",level:3},{value:"A.37.2. Trait sebagai tipe parameter",id:"a372-trait-sebagai-tipe-parameter",level:2},{value:"A.37.3. Parameter bertipe lebih dari 1 trait",id:"a373-parameter-bertipe-lebih-dari-1-trait",level:2},{value:"A.37.4. Trait bound syntax",id:"a374-trait-bound-syntax",level:2},{value:"A.37.5. Trait <code>where</code> clause",id:"a375-trait-where-clause",level:2},{value:"A.37.6. Trait sebagai return type",id:"a376-trait-sebagai-return-type",level:2},{value:"A.37.7. <em>Associated types</em> pada trait",id:"a377-associated-types-pada-trait",level:2},{value:"A.37.8. Attribute <code>derive</code>",id:"a378-attribute-derive",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Work in progress",id:"-work-in-progress",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:u};function m(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,t.Z)({},d,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Chapter ini merupakan kelanjutan dari chapter sebelumnya. Di sini kita fokus ke pembuatan local trait, macam-macam implementasi traits, traits bound syntax, associated types, dan topik yang masih relevan dengan traits lainnya."),(0,i.kt)("p",null,"Pembahasan lanjutan mengenai traits ini cukup panjang. Makin mendekati akhir pembahasan, makin berat topik yang dibahas. Penulis anjurkan jika diperlukan, silakan mengulang-ulang chapter ini, atau bisa lanjut ke chapter berikutnya dan nanti kembali lagi ke sini ketika sudah siap."),(0,i.kt)("h2",{id:"a371-membuat-custom-trait-local-trait"},"A.37.1. Membuat custom trait (local trait)"),(0,i.kt)("p",null,"Pada bagian ini kita akan belajar tentang cara membuat definisi trait di local crate dalam project yang sedang dikerjakan."),(0,i.kt)("p",null,"Masih sama dengan sebelum-sebelumnya, pembelajaran dilakukan dengan praktik. Kita gunakan skenario praktik berikut pada program selanjutnya:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Buat struct bernama ",(0,i.kt)("inlineCode",{parentName:"li"},"Circle"),"."),(0,i.kt)("li",{parentName:"ol"},"Buat struct bernama ",(0,i.kt)("inlineCode",{parentName:"li"},"Square"),"."),(0,i.kt)("li",{parentName:"ol"},"Buat trait bernama ",(0,i.kt)("inlineCode",{parentName:"li"},"Area")," dengan isi satu buah method untuk menghitung luas bangun datar (method ",(0,i.kt)("inlineCode",{parentName:"li"},"calculate_area()"),")."),(0,i.kt)("li",{parentName:"ol"},"Implementasikan trait ",(0,i.kt)("inlineCode",{parentName:"li"},"Area")," ke dua struct tersebut.")),(0,i.kt)("p",null,"Ok, mari mulai praktikkan skenario di atas. Pertama siapkan project dengan struktur berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 calculation_spec.rs\n \u2502\u2500\u2500\u2500 two_dimensional.rs\n \u2514\u2500\u2500\u2500 main.rs\n")),(0,i.kt)("p",null,"Module ",(0,i.kt)("inlineCode",{parentName:"p"},"calculation_spec")," berisi definisi trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Area"),". Trait ini punya visibility akses publik, isinya hanya satu buah definisi method header bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_area()"),". Trait ini nantinya diimplementasikan ke struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," dan juga ",(0,i.kt)("inlineCode",{parentName:"p"},"Square"),", agar nantinya kedua struct tersebut memiliki method ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_area()")," yang berguna untuk kalkulasi luas bangun datar 2d."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/calculation_spec.rs"',title:'"src/calculation_spec.rs"'},"pub trait Area {\n fn calculate_area(&self) -> f64;\n}\n")),(0,i.kt)("p",null,"Kemudian siapkan file ",(0,i.kt)("inlineCode",{parentName:"p"},"two_dimensional"),", isinya dua buah struct: ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Square"),". Pada file yang sama, siapkan juga block kode implementasi trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Area"),". Dengan ini maka kedua struct tersebut wajib untuk memiliki method bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_area()")," dengan isi adalah operasi perhitungan aritmatika untuk mencari luas bangun datar."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/two_dimensional.rs"',title:'"src/two_dimensional.rs"'},"pub struct Circle {\n pub radius: i32,\n}\n\nimpl crate::calculation_spec::Area for Circle {\n fn calculate_area(&self) -> f64 {\n // PI * (r ^ 2)\n // ada operasi casting ke tipe f64 karena self.radius bertipe i32\n 3.14 * (self.radius.pow(2) as f64)\n }\n}\n\npub struct Square {\n pub length: i32,\n}\n\nimpl crate::calculation_spec::Area for Square {\n fn calculate_area(&self) -> f64 {\n // (s ^ 2)\n // ada operasi casting ke tipe f64 karena self.length bertipe i32\n self.length.pow(2) as f64\n }\n}\n")),(0,i.kt)("p",null,"Bisa dilihat pada kode di atas, deklarasi struct beserta property memiliki visibility publik. Idealnya, saat sturct tersebut digunakan di fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," nantinya tidak akan ada error terkait visibility akses."),(0,i.kt)("p",null,"Selanjutnya, pada file ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs")," siapkan kode yang isinya registrasi module ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_spec")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"two_dimensional"),", juga definisi fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," dengan isi statement pembuatan 2 variabel object untuk masing-masing tipe data struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Square"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod calculation_spec;\nmod two_dimensional;\n\nfn main() {\n let circle_one = two_dimensional::Circle{ radius: 10 };\n println!("circle area: {}", circle_one.calculate_area());\n\n let square_one = two_dimensional::Square{ length: 5 };\n println!("square area: {}", square_one.calculate_area());\n}\n')),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_area()")," milik object bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Square")," diakses untuk kemudian di-print."),(0,i.kt)("p",null,"Coba jalankan program."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Trait",src:n(4176).Z,width:"655",height:"756"})),(0,i.kt)("p",null,"Hmm, error. Padahal trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Area")," sudah publik, dan struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," & ",(0,i.kt)("inlineCode",{parentName:"p"},"Square")," beserta property-nya juga sudah publik. Tapi masih error."),(0,i.kt)("p",null,"Error ini disebabkan oleh trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Area")," yang belum di-import di crate root (main). Meskipun kita tidak mengakses trait tersebut secara langsung (melainkan via method ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_area()")," milik struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Square"),"), diharuskan untuk meng-import-nya juga."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Detail error beserta solusi dari error ini sebenarnya bisa dilihat di error message. Bagaimana Rust menginformasikan error sangat luar biasa informatif.")),(0,i.kt)("p",null,"Ok, sekarang ubah isi file ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs")," menjadi seperti ini, kemudian jalankan ulang program. Hasilnya tidak ada error."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod calculation_spec;\nmod two_dimensional;\n\nuse crate::calculation_spec::Area; // <------- tambahkan statement import module\n\nfn main() {\n let circle_one = two_dimensional::Circle{ radius: 10 };\n println!("circle area: {}", circle_one.calculate_area());\n\n let square_one = two_dimensional::Square{ length: 5 };\n println!("square area: {}", square_one.calculate_area());\n}\n')),(0,i.kt)("p",null,"O iya, ada beberapa hal baru pada penerapan kode di atas, berikut adalah pembahasannya:"),(0,i.kt)("h3",{id:"-method-pow-untuk-operasi-pangkat"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"pow")," untuk operasi pangkat"),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"pow")," adalah item milik tipe data numerik (",(0,i.kt)("inlineCode",{parentName:"p"},"i8"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"i16"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),", ...) yang fungsinya untuk operasi pangkat."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"3.pow(2); // ===> 3 pangkat 2\n8.pow(5); // ===> 8 pangkat 5\n")),(0,i.kt)("h3",{id:"-keyword-as-untuk-casting-tipe-data"},"\u25c9 Keyword ",(0,i.kt)("inlineCode",{parentName:"h3"},"as")," untuk casting tipe data"),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"as")," digunakan untuk casting tipe data. Keyword ini bisa diterapkan pada beberapa jenis tipe data, salah satunya adalah semua tipe data numerik."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"1024 as f32; // ===> 1024 dikonversi ke tipe f32, hasinya adalah 1024.0\n3.14 as i32; // ===> 3.14 dikonversi ke tipe i32, hasinya 3 karena ada pembulatan\n")),(0,i.kt)("h2",{id:"a372-trait-sebagai-tipe-parameter"},"A.37.2. Trait sebagai tipe parameter"),(0,i.kt)("p",null,"Trait bisa digunakan sebagai tipe data parameter sebuah fungsi, contoh notasi penulisannya bisa dilihat pada kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn calculate_and_print_result(name: String, item: &impl Area) {\n println!("{} area: {}", name, item.calculate_area());\n}\n')),(0,i.kt)("p",null,"Manfaat penerapan trait sebagai tipe data parameter fungsi adalah saat pemanggilan fungsi, parameter tersebut bisa diisi dengan argument data bertipe apapun dengan catatan tipe dari data tersebut mengimplementasikan trait yang sama dengan yang digunakan pada parameter."),(0,i.kt)("p",null,"Contohnya seperti pada fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_and_print_result")," di atas yang parameter ke-2 bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&impl Area"),", nantinya saat fungsi tersebut dipanggil, kita bisa sisipi parameter ke-2 dengan object ",(0,i.kt)("inlineCode",{parentName:"p"},"circle_one")," ataupun ",(0,i.kt)("inlineCode",{parentName:"p"},"circle_two"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let circle_one = two_dimensional::Circle{ radius: 10 };\ncalculate_and_print_result("circle".to_string(), &circle_one);\n\nlet square_one = two_dimensional::Square{ length: 5 };\ncalculate_and_print_result("square".to_string(), &square_one);\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},(0,i.kt)("inlineCode",{parentName:"p"},"&impl Area")," ini tipe data pointer ya, tipe non-pointer-nya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"impl Area"),". Di sini digunakan tipe data pointer untuk antisipasi ",(0,i.kt)("em",{parentName:"p"},"move semantics")," pada tipe data custom type (borrowing).")),(0,i.kt)("h2",{id:"a373-parameter-bertipe-lebih-dari-1-trait"},"A.37.3. Parameter bertipe lebih dari 1 trait"),(0,i.kt)("p",null,"Bagaimana jika, parameter fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"item")," di atas tipenya bisa lebih dari 1 trait, misalnya trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Area")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Circumference"),", apakah bisa? Jawabannya bisa."),(0,i.kt)("p",null,"Mari praktekan. Lakukan modifikasi berikut pada beberapa kode yang telah di tulis."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"File ",(0,i.kt)("inlineCode",{parentName:"p"},"src/calculation_spec.rs")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"// ...\n\n// tambahkan \u2b07\ufe0f\n\npub trait Circumference {\n fn calculate_circumference(&self) -> f64;\n}\n"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"File ",(0,i.kt)("inlineCode",{parentName:"p"},"src/two_dimensional.rs")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"// ...\n\n// tambahkan \u2b07\ufe0f\n\nimpl crate::calculation_spec::Circumference for Circle {\n fn calculate_circumference(&self) -> f64 {\n 2.0 * 3.14 * (self.radius) as f64\n }\n}\n\nimpl crate::calculation_spec::Circumference for Square {\n fn calculate_circumference(&self) -> f64 {\n 4.0 * (self.length) as f64\n }\n}\n"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"File ",(0,i.kt)("inlineCode",{parentName:"p"},"src/main.rs")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'// ...\n\n// tambahkan \u2b07\ufe0f\n\nuse crate::calculation_spec::Circumference;\n\n// ...\n\nfn calculate_and_print_result(name: String, item: &(impl Area + Circumference)) {\n println!("{} area: {}", name, item.calculate_area());\n println!("{} circumference: {}", name, item.calculate_circumference());\n}\n')))),(0,i.kt)("p",null,"Dengan perubahan kode yang telah dilakukan di atas, parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"item")," milik fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_and_print_result()")," bisa diisi dengan nilai argument apapun asalkan memenuhi kriteria tipe yang ditentukan, yaitu: haruse meng-implement trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Area")," dan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Circumference"),"."),(0,i.kt)("p",null,"Notasi penulisan tipe-datanya ",(0,i.kt)("inlineCode",{parentName:"p"},"&(impl Trait1 + Trait2 + Trait3 + ...)"),"."),(0,i.kt)("h2",{id:"a374-trait-bound-syntax"},"A.37.4. Trait bound syntax"),(0,i.kt)("p",null,"Penerapan trait sebagai parameter fungsi juga bisa dituliskan dalam notasi yang memanfaatkan generic. Teknik penulisan ini disebut dengan ",(0,i.kt)("em",{parentName:"p"},"trait bound syntax"),"."),(0,i.kt)("p",null,"Contohnya bisa dilihat pada kode berikut. Ada generic bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," yang merepresentasikan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Area"),", kemudian pada definisi parameter ke-2 fungsi (yaitu parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"item"),") tipenya menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"&T"),". Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&T")," di sini adalah ekuivalen dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"&impl Area"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn calculate_and_print_result2<T: Area>(name: String, item: &T) {\n println!("{} area: {}", name, item.calculate_area());\n}\n')),(0,i.kt)("p",null,"Jika ada lebih dari satu trait yang digunakan sebagai tipe data paramater, maka penulisannya seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn calculate_and_print_result3<T: Area + Circumference>(name: String, item: &T) {\n println!("{} area: {}", name, item.calculate_area());\n println!("{} circumference: {}", name, item.calculate_circumference());\n}\n')),(0,i.kt)("p",null,"Satu tambahan contoh lagi untuk ilustrasi yang lebih kompleks:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn some_function<T: Display + Clone, U: Clone + Debug>(t: &T, u: &U) -> i32 {\n // ...\n}\n")),(0,i.kt)("p",null,"Pada contoh di atas fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"some_function()")," memiliki 2 generics param, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"U"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"T")," merepresentasikan trait ",(0,i.kt)("inlineCode",{parentName:"li"},"Display")," dan ",(0,i.kt)("inlineCode",{parentName:"li"},"Clone")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"U")," merepresentasikan trait ",(0,i.kt)("inlineCode",{parentName:"li"},"Clone")," dan ",(0,i.kt)("inlineCode",{parentName:"li"},"Debug"))),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai generics dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/generics"},"Generics"))),(0,i.kt)("h2",{id:"a375-trait-where-clause"},"A.37.5. Trait ",(0,i.kt)("inlineCode",{parentName:"h2"},"where")," clause"),(0,i.kt)("p",null,"Ada lagi alternatif penulisan trait bound syntax, yaitu menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"where"),". Contoh pengaplikasiannya bisa dilihat pada kode berikut. Semua definisi fungsi di bawah ini adalah ekuivalen."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn calculate_and_print_result4<T>(name: String, item: &T) where T: Area + Circumference {\n println!("{} area: {}", name, item.calculate_area());\n}\n\nfn calculate_and_print_result5<T>(name: String, item: &T)\nwhere\n T: Area + Circumference,\n // ... other generic params if exists\n{\n println!("{} area: {}", name, item.calculate_area());\n}\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai generics dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/generics"},"Generics"))),(0,i.kt)("h2",{id:"a376-trait-sebagai-return-type"},"A.37.6. Trait sebagai return type"),(0,i.kt)("p",null,"Trait bisa juga digunakan sebagai tipe data return value. Caranya gunakan notasi penulisan ",(0,i.kt)("inlineCode",{parentName:"p"},"impl NamaTrait")," sebagai tipe data."),(0,i.kt)("p",null,"Contohnya bisa dilihat pada kode berikut. Ada dua fungsi baru dideklarasikan:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Fungsi ",(0,i.kt)("inlineCode",{parentName:"li"},"new_circle")," dengan return type adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"impl Area"),", dan data yang dikembalikan adalah bertipe ",(0,i.kt)("inlineCode",{parentName:"li"},"two_dimensional::Circle"),"."),(0,i.kt)("li",{parentName:"ol"},"Fungsi ",(0,i.kt)("inlineCode",{parentName:"li"},"new_square")," dengan return type adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"impl Area + Circumference"),", dan data yang dikembalikan adalah bertipe ",(0,i.kt)("inlineCode",{parentName:"li"},"two_dimensional::Square"),".")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let circle_one = new_circle(5);\n calculate_and_print_result6("circle".to_string(), &circle_one);\n\n let square_one = new_square(10);\n calculate_and_print_result7("square".to_string(), &square_one);\n}\n\nfn new_circle(radius: i32) -> impl Area {\n let data = two_dimensional::Circle{\n radius\n };\n data\n}\n\nfn new_square(length: i32) -> impl Area + Circumference {\n two_dimensional::Square{\n length\n }\n}\n\nfn calculate_and_print_result6<T>(name: String, item: &T)\nwhere\n T: Area,\n{\n println!("{} area: {}", name, item.calculate_area());\n}\n\nfn calculate_and_print_result7<T>(name: String, item: &T)\nwhere\n T: Area + Circumference,\n{\n println!("{} area: {}", name, item.calculate_area());\n println!("{} circumference: {}", name, item.calculate_circumference());\n}\n')),(0,i.kt)("p",null,"Salah satu konsekuensi dalam penerapan trait sebagai return type adalah: tipe data milik nilai yang dikembalikan terdeteksi sebagai tipe trait. Contohnya variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"circle_one")," di atas, tipe data-nya bukan ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle"),", melainkan ",(0,i.kt)("inlineCode",{parentName:"p"},"impl Area"),"."),(0,i.kt)("p",null,"Tipe data aslinya tetap bisa diakses, tapi butuh tambahan effort. Lebih jelasnya dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/trait-conversion-from-into"},"Trait \u279c Conversion (From & Into)"),"."),(0,i.kt)("h2",{id:"a377-associated-types-pada-trait"},"A.37.7. ",(0,i.kt)("em",{parentName:"h2"},"Associated types")," pada trait"),(0,i.kt)("p",null,"Associated types adalah tipe data yang didefinisikan di dalam suatu trait. Associated types tidak tidak memiliki tipe data konkret saat didefinisikan, namun ketika trait di-implementasikan maka tipe tersebut harus ditentukan tipe data konkritnya."),(0,i.kt)("p",null,"Lebih jelas silakan perhatikan kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"trait Shape {\n type Area;\n\n fn area(&self) -> Self::Area;\n}\n")),(0,i.kt)("p",null,"Pada definisi trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Shape")," di atas, yang disebut dengan associated types adalah tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Area")," yang definisinya berada dalam block trait. Tipe didefinisikan tanpa assignment operator, jadi tidak ada tipe data konkretnya."),(0,i.kt)("p",null,"Associated types ini sering digunakan pada Rust programming."),(0,i.kt)("p",null,"Lanjut skenario praktek berikutnya. Silakan siapkan package/project baru dengan struktur seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 shape.rs\n \u2502\u2500\u2500\u2500 circle.rs\n \u2502\u2500\u2500\u2500 square.rs\n \u2514\u2500\u2500\u2500 main.rs\n")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Disiapkan suatu trait bernama ",(0,i.kt)("inlineCode",{parentName:"li"},"shape::Shape"),".",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"Trait ini memiliki satu associated types bernama ",(0,i.kt)("inlineCode",{parentName:"li"},"Area"),"."),(0,i.kt)("li",{parentName:"ul"},"Dan memiliki sebuah definisi method header ",(0,i.kt)("inlineCode",{parentName:"li"},"area")," yang gunanya untuk menghitung luas bangun datar (",(0,i.kt)("em",{parentName:"li"},"shape"),")."))),(0,i.kt)("li",{parentName:"ul"},"Disiapkan struct ",(0,i.kt)("inlineCode",{parentName:"li"},"circle::Circle")," yang mengadopsi trait ",(0,i.kt)("inlineCode",{parentName:"li"},"shape::Shape"),"."),(0,i.kt)("li",{parentName:"ul"},"Disiapkan struct ",(0,i.kt)("inlineCode",{parentName:"li"},"square::Square")," yang mengadopsi trait ",(0,i.kt)("inlineCode",{parentName:"li"},"shape::Shape"),".")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/shape.rs"',title:'"src/shape.rs"'},"pub trait Shape {\n type Area;\n\n fn area(&self) -> Self::Area;\n}\n")),(0,i.kt)("p",null,"Trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Shape")," di atas spesifikasinya mirip seperti pada contoh sebelumnya, hanya saja kali ini trait-nya di set public agar bisa diakses dari ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs")," nantinya."),(0,i.kt)("p",null,"Trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Shape")," kemudian di-implementasikan ke struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Square"),", kode-nya bisa dilihat berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/circle.rs"',title:'"src/circle.rs"'},"pub struct Circle {\n pub radius: f64,\n}\n\nimpl crate::shape::Shape for Circle {\n type Area = f64;\n\n fn area(&self) -> Self::Area {\n std::f64::consts::PI * self.radius * self.radius\n }\n}\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/square.rs"',title:'"src/square.rs"'},"pub struct Square {\n pub side: i64,\n}\n\nimpl crate::shape::Shape for Square {\n type Area = i64;\n\n fn area(&self) -> Self::Area {\n self.side * self.side\n }\n}\n")),(0,i.kt)("p",null,"Bisa dilihat pada kedua implementasi di atas, associated type ",(0,i.kt)("inlineCode",{parentName:"p"},"Area")," diisi dengan tipe concrete, yaitu:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Tipe data ",(0,i.kt)("inlineCode",{parentName:"li"},"f64")," sebagai tipe concrete ",(0,i.kt)("inlineCode",{parentName:"li"},"circle:Circle:Area")),(0,i.kt)("li",{parentName:"ul"},"Tipe data ",(0,i.kt)("inlineCode",{parentName:"li"},"i64")," sebagai tipe concrete ",(0,i.kt)("inlineCode",{parentName:"li"},"square:Square:Area"))),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Contoh di atas adalah cara pengaplikasian associated types.")),(0,i.kt)("p",null,"Lalu pada ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs"),", tipe data struct ",(0,i.kt)("inlineCode",{parentName:"p"},"circle::Circle")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"square::Square")," digunakan untuk membuat variabel baru, yang kemudian dari variabel tersebut, method ",(0,i.kt)("inlineCode",{parentName:"p"},".area()")," milik diakses."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod shape;\nmod circle;\nmod square;\n\nuse crate::shape::Shape;\n\nfn main() {\n let obj1 = circle::Circle{ radius: 10.0 };\n println!("area of circle: {:.2}", obj1.area());\n\n let obj2 = square::Square{ side: 10 };\n println!("area of square: {:}", obj2.area());\n}\n')),(0,i.kt)("p",null,"Silakan jalankan program dan lihat hasilnya."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Trait",src:n(6254).Z,width:"469",height:"130"})),(0,i.kt)("p",null,"O iya, pada ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs"),", module item ",(0,i.kt)("inlineCode",{parentName:"p"},"shape::Shape")," perlu di-import meskipun kita tidak menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"trait")," tersebut secara langsung. Jika tidak di-import, maka method ",(0,i.kt)("inlineCode",{parentName:"p"},".area()")," milik ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Square")," tidak bisa diakses."),(0,i.kt)("h2",{id:"a378-attribute-derive"},"A.37.8. Attribute ",(0,i.kt)("inlineCode",{parentName:"h2"},"derive")),(0,i.kt)("p",null,"Ada cara lain untuk mengimplementasikan suatu trait ke dalam tipe data selain dengan menuliskan implementasinya secara eksplist, caranya menggunakan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"derive"),"."),(0,i.kt)("p",null,"Lebih detailnya dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/attributes"},"Attributes"),"."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/advanced_traits"},"github.com/novalagung/dasarpemrogramanrust-example/../advanced_traits")),(0,i.kt)("h3",{id:"-work-in-progress"},"\u25c9 Work in progress"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Pembahasan tentang trait bounds untuk implementasi method kondisional"),(0,i.kt)("li",{parentName:"ul"},"Pembahasan tentang trait overloading"),(0,i.kt)("li",{parentName:"ul"},"orphan rules")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch10-02-traits.html"},"https://doc.rust-lang.org/book/ch10-02-traits.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/primitive.i32.html"},"https://doc.rust-lang.org/std/primitive.i32.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/fmt/trait.Debug.html"},"https://doc.rust-lang.org/std/fmt/trait.Debug.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/fmt/trait.Display.html"},"https://doc.rust-lang.org/std/fmt/trait.Display.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/string/struct.String.html"},"https://doc.rust-lang.org/std/string/struct.String.html"))))}m.isMDXComponent=!0},4176:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/traits-5-29be804051729f23db8dd64e978e2398.png"},6254:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/traits-6-8165525fc9f8604bf115634eeb974230.png"}}]); \ No newline at end of file diff --git a/assets/js/742a9bdc.7a41a927.js b/assets/js/742a9bdc.7a41a927.js deleted file mode 100644 index ae3011df..00000000 --- a/assets/js/742a9bdc.7a41a927.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[7988],{3905:(a,e,n)=>{n.d(e,{Zo:()=>d,kt:()=>k});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function p(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},r=Object.keys(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var s=t.createContext({}),u=function(a){var e=t.useContext(s),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},d=function(a){var e=u(a.components);return t.createElement(s.Provider,{value:e},a.children)},m={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},o=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,r=a.originalType,s=a.parentName,d=p(a,["components","mdxType","originalType","parentName"]),o=u(n),k=i,c=o["".concat(s,".").concat(k)]||o[k]||m[k]||r;return n?t.createElement(c,l(l({ref:e},d),{},{components:n})):t.createElement(c,l({ref:e},d))}));function k(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=n.length,l=new Array(r);l[0]=o;var p={};for(var s in e)hasOwnProperty.call(e,s)&&(p[s]=e[s]);p.originalType=a,p.mdxType="string"==typeof a?a:i,l[1]=p;for(var u=2;u<r;u++)l[u]=n[u];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}o.displayName="MDXCreateElement"},8046:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>s,contentTitle:()=>l,default:()=>m,frontMatter:()=>r,metadata:()=>p,toc:()=>u});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:37,title:"A.37. Traits \u279c Advanced",sidebar_label:"A.37. Traits \u279c Advanced"},l=void 0,p={unversionedId:"basic/advanced-traits",id:"basic/advanced-traits",title:"A.37. Traits \u279c Advanced",description:"Chapter ini merupakan kelanjutan dari chapter sebelumnya. Di sini kita fokus ke pembuatan local trait, macam-macam implementasi traits, traits bound syntax, associated types, dan topik yang masih relevan dengan traits lainnya.",source:"@site/docs/basic/advanced-traits.md",sourceDirName:"basic",slug:"/basic/advanced-traits",permalink:"/basic/advanced-traits",draft:!1,tags:[],version:"current",sidebarPosition:37,frontMatter:{sidebar_position:37,title:"A.37. Traits \u279c Advanced",sidebar_label:"A.37. Traits \u279c Advanced"},sidebar:"tutorialSidebar",previous:{title:"A.36. Traits",permalink:"/basic/traits"},next:{title:"A.38. Generics",permalink:"/basic/generics"}},s={},u=[{value:"A.37.1. Membuat custom trait (local trait)",id:"a371-membuat-custom-trait-local-trait",level:2},{value:"\u25c9 Method <code>pow</code> untuk operasi pangkat",id:"-method-pow-untuk-operasi-pangkat",level:3},{value:"\u25c9 Keyword <code>as</code> untuk casting tipe data",id:"-keyword-as-untuk-casting-tipe-data",level:3},{value:"A.37.2. Trait sebagai tipe parameter",id:"a372-trait-sebagai-tipe-parameter",level:2},{value:"A.37.3. Parameter bertipe lebih dari 1 trait",id:"a373-parameter-bertipe-lebih-dari-1-trait",level:2},{value:"A.37.4. Trait bound syntax",id:"a374-trait-bound-syntax",level:2},{value:"A.37.5. Trait <code>where</code> clause",id:"a375-trait-where-clause",level:2},{value:"A.37.6. Trait sebagai return type",id:"a376-trait-sebagai-return-type",level:2},{value:"A.37.7. <em>Associated types</em> pada trait",id:"a377-associated-types-pada-trait",level:2},{value:"A.37.8. Attribute <code>derive</code>",id:"a378-attribute-derive",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Work in progress",id:"-work-in-progress",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:u};function m(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,t.Z)({},d,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Chapter ini merupakan kelanjutan dari chapter sebelumnya. Di sini kita fokus ke pembuatan local trait, macam-macam implementasi traits, traits bound syntax, associated types, dan topik yang masih relevan dengan traits lainnya."),(0,i.kt)("p",null,"Pembahasan lanjutan mengenai traits ini cukup panjang. Makin mendekati akhir pembahasan, makin berat topik yang dibahas. Penulis anjurkan jika diperlukan, silakan mengulang-ulang chapter ini, atau bisa lanjut ke chapter berikutnya dan nanti kembali lagi ke sini ketika sudah siap."),(0,i.kt)("h2",{id:"a371-membuat-custom-trait-local-trait"},"A.37.1. Membuat custom trait (local trait)"),(0,i.kt)("p",null,"Pada bagian ini kita akan belajar tentang cara membuat definisi trait di local crate dalam project yang sedang dikerjakan."),(0,i.kt)("p",null,"Masih sama dengan sebelum-sebelumnya, pembelajaran dilakukan dengan praktik. Kita gunakan skenario praktik berikut pada program selanjutnya:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Buat struct bernama ",(0,i.kt)("inlineCode",{parentName:"li"},"Circle"),"."),(0,i.kt)("li",{parentName:"ol"},"Buat struct bernama ",(0,i.kt)("inlineCode",{parentName:"li"},"Square"),"."),(0,i.kt)("li",{parentName:"ol"},"Buat trait bernama ",(0,i.kt)("inlineCode",{parentName:"li"},"Area")," dengan isi satu buah method untuk menghitung luas bangun datar (method ",(0,i.kt)("inlineCode",{parentName:"li"},"calculate_area()"),")."),(0,i.kt)("li",{parentName:"ol"},"Implementasikan trait ",(0,i.kt)("inlineCode",{parentName:"li"},"Area")," ke dua struct tersebut.")),(0,i.kt)("p",null,"Ok, mari mulai praktikkan skenario di atas. Pertama siapkan project dengan struktur berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 calculation_spec.rs\n \u2502\u2500\u2500\u2500 two_dimensional.rs\n \u2514\u2500\u2500\u2500 main.rs\n")),(0,i.kt)("p",null,"Module ",(0,i.kt)("inlineCode",{parentName:"p"},"calculation_spec")," berisi definisi trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Area"),". Trait ini punya visibility akses publik, isinya hanya satu buah definisi method header bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_area()"),". Trait ini nantinya diimplementasikan ke struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," dan juga ",(0,i.kt)("inlineCode",{parentName:"p"},"Square"),", agar nantinya kedua struct tersebut memiliki method ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_area()")," yang berguna untuk kalkulasi luas bangun datar 2d."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/calculation_spec.rs"',title:'"src/calculation_spec.rs"'},"pub trait Area {\n fn calculate_area(&self) -> f64;\n}\n")),(0,i.kt)("p",null,"Kemudian siapkan file ",(0,i.kt)("inlineCode",{parentName:"p"},"two_dimensional"),", isinya dua buah struct: ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Square"),". Pada file yang sama, siapkan juga block kode implementasi trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Area"),". Dengan ini maka kedua struct tersebut wajib untuk memiliki method bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_area()")," dengan isi adalah operasi perhitungan aritmatika untuk mencari luas bangun datar."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/two_dimensional.rs"',title:'"src/two_dimensional.rs"'},"pub struct Circle {\n pub radius: i32,\n}\n\nimpl crate::calculation_spec::Area for Circle {\n fn calculate_area(&self) -> f64 {\n // PI * (r ^ 2)\n // ada operasi casting ke tipe f64 karena self.radius bertipe i32\n 3.14 * (self.radius.pow(2) as f64)\n }\n}\n\npub struct Square {\n pub length: i32,\n}\n\nimpl crate::calculation_spec::Area for Square {\n fn calculate_area(&self) -> f64 {\n // (s ^ 2)\n // ada operasi casting ke tipe f64 karena self.length bertipe i32\n self.length.pow(2) as f64\n }\n}\n")),(0,i.kt)("p",null,"Bisa dilihat pada kode di atas, deklarasi struct beserta property memiliki visibility publik. Idealnya, saat sturct tersebut digunakan di fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," nantinya tidak akan ada error terkait visibility akses."),(0,i.kt)("p",null,"Selanjutnya, pada file ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs")," siapkan kode yang isinya registrasi module ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_spec")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"two_dimensional"),", juga definisi fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," dengan isi statement pembuatan 2 variabel object untuk masing-masing tipe data struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Square"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod calculation_spec;\nmod two_dimensional;\n\nfn main() {\n let circle_one = two_dimensional::Circle{ radius: 10 };\n println!("circle area: {}", circle_one.calculate_area());\n\n let square_one = two_dimensional::Square{ length: 5 };\n println!("square area: {}", square_one.calculate_area());\n}\n')),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_area()")," milik object bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Square")," diakses untuk kemudian di-print."),(0,i.kt)("p",null,"Coba jalankan program."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Trait",src:n(4176).Z,width:"655",height:"756"})),(0,i.kt)("p",null,"Hmm, error. Padahal trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Area")," sudah publik, dan struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," & ",(0,i.kt)("inlineCode",{parentName:"p"},"Square")," beserta property-nya juga sudah publik. Tapi masih error."),(0,i.kt)("p",null,"Error ini disebabkan oleh trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Area")," yang belum di-import di crate root (main). Meskipun kita tidak mengakses trait tersebut secara langsung (melainkan via method ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_area()")," milik struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Square"),"), diharuskan untuk meng-import-nya juga."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Detail error beserta solusi dari error ini sebenarnya bisa dilihat di error message. Bagaimana Rust menginformasikan error sangat luar biasa informatif.")),(0,i.kt)("p",null,"Ok, sekarang ubah isi file ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs")," menjadi seperti ini, kemudian jalankan ulang program. Hasilnya tidak ada error."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod calculation_spec;\nmod two_dimensional;\n\nuse crate::calculation_spec::Area; // <------- tambahkan statement import module\n\nfn main() {\n let circle_one = two_dimensional::Circle{ radius: 10 };\n println!("circle area: {}", circle_one.calculate_area());\n\n let square_one = two_dimensional::Square{ length: 5 };\n println!("square area: {}", square_one.calculate_area());\n}\n')),(0,i.kt)("p",null,"O iya, ada beberapa hal baru pada penerapan kode di atas, berikut adalah pembahasannya:"),(0,i.kt)("h3",{id:"-method-pow-untuk-operasi-pangkat"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"pow")," untuk operasi pangkat"),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"pow")," adalah item milik tipe data numerik (",(0,i.kt)("inlineCode",{parentName:"p"},"i8"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"i16"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),", ...) yang fungsinya untuk operasi pangkat."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"3.pow(2); // ===> 3 pangkat 2\n8.pow(5); // ===> 8 pangkat 5\n")),(0,i.kt)("h3",{id:"-keyword-as-untuk-casting-tipe-data"},"\u25c9 Keyword ",(0,i.kt)("inlineCode",{parentName:"h3"},"as")," untuk casting tipe data"),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"as")," digunakan untuk casting tipe data. Keyword ini bisa diterapkan pada beberapa jenis tipe data, salah satunya adalah semua tipe data numerik."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"1024 as f32; // ===> 1024 dikonversi ke tipe f32, hasinya adalah 1024.0\n3.14 as i32; // ===> 3.14 dikonversi ke tipe i32, hasinya 3 karena ada pembulatan\n")),(0,i.kt)("h2",{id:"a372-trait-sebagai-tipe-parameter"},"A.37.2. Trait sebagai tipe parameter"),(0,i.kt)("p",null,"Trait bisa digunakan sebagai tipe data parameter sebuah fungsi, contoh notasi penulisannya bisa dilihat pada kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn calculate_and_print_result(name: String, item: &impl Area) {\n println!("{} area: {}", name, item.calculate_area());\n}\n')),(0,i.kt)("p",null,"Manfaat penerapan trait sebagai tipe data parameter fungsi adalah saat pemanggilan fungsi, parameter tersebut bisa diisi dengan argument data bertipe apapun dengan catatan tipe dari data tersebut mengimplementasikan trait yang sama dengan yang digunakan pada parameter."),(0,i.kt)("p",null,"Contohnya seperti pada fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_and_print_result")," di atas yang parameter ke-2 bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&impl Area"),", nantinya saat fungsi tersebut dipanggil, kita bisa sisipi parameter ke-2 dengan object ",(0,i.kt)("inlineCode",{parentName:"p"},"circle_one")," ataupun ",(0,i.kt)("inlineCode",{parentName:"p"},"circle_two"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let circle_one = two_dimensional::Circle{ radius: 10 };\ncalculate_and_print_result("circle".to_string(), &circle_one);\n\nlet square_one = two_dimensional::Square{ length: 5 };\ncalculate_and_print_result("square".to_string(), &square_one);\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},(0,i.kt)("inlineCode",{parentName:"p"},"&impl Area")," ini tipe data pointer ya, tipe non-pointer-nya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"impl Area"),". Di sini digunakan tipe data pointer untuk antisipasi ",(0,i.kt)("em",{parentName:"p"},"move semantics")," pada tipe data custom type (borrowing).")),(0,i.kt)("h2",{id:"a373-parameter-bertipe-lebih-dari-1-trait"},"A.37.3. Parameter bertipe lebih dari 1 trait"),(0,i.kt)("p",null,"Bagaimana jika, parameter fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"item")," di atas tipenya bisa lebih dari 1 trait, misalnya trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Area")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Circumference"),", apakah bisa? Jawabannya bisa."),(0,i.kt)("p",null,"Mari praktekan. Lakukan modifikasi berikut pada beberapa kode yang telah di tulis."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"File ",(0,i.kt)("inlineCode",{parentName:"p"},"src/calculation_spec.rs")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"// ...\n\n// tambahkan \u2b07\ufe0f\n\npub trait Circumference {\n fn calculate_circumference(&self) -> f64;\n}\n"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"File ",(0,i.kt)("inlineCode",{parentName:"p"},"src/two_dimensional.rs")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"// ...\n\n// tambahkan \u2b07\ufe0f\n\nimpl crate::calculation_spec::Circumference for Circle {\n fn calculate_circumference(&self) -> f64 {\n 2.0 * 3.14 * (self.radius) as f64\n }\n}\n\nimpl crate::calculation_spec::Circumference for Square {\n fn calculate_circumference(&self) -> f64 {\n 4.0 * (self.length) as f64\n }\n}\n"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"File ",(0,i.kt)("inlineCode",{parentName:"p"},"src/main.rs")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'// ...\n\n// tambahkan \u2b07\ufe0f\n\nuse crate::calculation_spec::Circumference;\n\n// ...\n\nfn calculate_and_print_result(name: String, item: &(impl Area + Circumference)) {\n println!("{} area: {}", name, item.calculate_area());\n println!("{} circumference: {}", name, item.calculate_circumference());\n}\n')))),(0,i.kt)("p",null,"Dengan perubahan kode yang telah dilakukan di atas, parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"item")," milik fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_and_print_result()")," bisa diisi dengan nilai argument apapun asalkan memenuhi kriteria tipe yang ditentukan, yaitu: haruse meng-implement trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Area")," dan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Circumference"),"."),(0,i.kt)("p",null,"Notasi penulisan tipe-datanya ",(0,i.kt)("inlineCode",{parentName:"p"},"&(impl Trait1 + Trait2 + Trait3 + ...)"),"."),(0,i.kt)("h2",{id:"a374-trait-bound-syntax"},"A.37.4. Trait bound syntax"),(0,i.kt)("p",null,"Penerapan trait sebagai parameter fungsi juga bisa dituliskan dalam notasi yang memanfaatkan generic. Teknik penulisan ini disebut dengan ",(0,i.kt)("em",{parentName:"p"},"trait bound syntax"),"."),(0,i.kt)("p",null,"Contohnya bisa dilihat pada kode berikut. Ada generic bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," yang merepresentasikan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Area"),", kemudian pada definisi parameter ke-2 fungsi (yaitu parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"item"),") tipenya menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"&T"),". Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&T")," di sini adalah ekuivalen dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"&impl Area"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn calculate_and_print_result2<T: Area>(name: String, item: &T) {\n println!("{} area: {}", name, item.calculate_area());\n}\n')),(0,i.kt)("p",null,"Jika ada lebih dari satu trait yang digunakan sebagai tipe data paramater, maka penulisannya seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn calculate_and_print_result3<T: Area + Circumference>(name: String, item: &T) {\n println!("{} area: {}", name, item.calculate_area());\n println!("{} circumference: {}", name, item.calculate_circumference());\n}\n')),(0,i.kt)("p",null,"Satu tambahan contoh lagi untuk ilustrasi yang lebih kompleks:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn some_function<T: Display + Clone, U: Clone + Debug>(t: &T, u: &U) -> i32 {\n // ...\n}\n")),(0,i.kt)("p",null,"Pada contoh di atas fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"some_function()")," memiliki 2 generics param, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"U"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"T")," merepresentasikan trait ",(0,i.kt)("inlineCode",{parentName:"li"},"Display")," dan ",(0,i.kt)("inlineCode",{parentName:"li"},"Clone")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"U")," merepresentasikan trait ",(0,i.kt)("inlineCode",{parentName:"li"},"Clone")," dan ",(0,i.kt)("inlineCode",{parentName:"li"},"Debug"))),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai generics dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/generics"},"Generics"))),(0,i.kt)("h2",{id:"a375-trait-where-clause"},"A.37.5. Trait ",(0,i.kt)("inlineCode",{parentName:"h2"},"where")," clause"),(0,i.kt)("p",null,"Ada lagi alternatif penulisan trait bound syntax, yaitu menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"where"),". Contoh pengaplikasiannya bisa dilihat pada kode berikut. Semua definisi fungsi di bawah ini adalah ekuivalen."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn calculate_and_print_result4<T>(name: String, item: &T) where T: Area + Circumference {\n println!("{} area: {}", name, item.calculate_area());\n}\n\nfn calculate_and_print_result5<T>(name: String, item: &T)\nwhere\n T: Area + Circumference,\n // ... other generic params if exists\n{\n println!("{} area: {}", name, item.calculate_area());\n}\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai generics dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/generics"},"Generics"))),(0,i.kt)("h2",{id:"a376-trait-sebagai-return-type"},"A.37.6. Trait sebagai return type"),(0,i.kt)("p",null,"Trait bisa juga digunakan sebagai tipe data return value. Caranya gunakan notasi penulisan ",(0,i.kt)("inlineCode",{parentName:"p"},"impl NamaTrait")," sebagai tipe data."),(0,i.kt)("p",null,"Contohnya bisa dilihat pada kode berikut. Ada dua fungsi baru dideklarasikan:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Fungsi ",(0,i.kt)("inlineCode",{parentName:"li"},"new_circle")," dengan return type adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"impl Area"),", dan data yang dikembalikan adalah bertipe ",(0,i.kt)("inlineCode",{parentName:"li"},"two_dimensional::Circle"),"."),(0,i.kt)("li",{parentName:"ol"},"Fungsi ",(0,i.kt)("inlineCode",{parentName:"li"},"new_square")," dengan return type adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"impl Area + Circumference"),", dan data yang dikembalikan adalah bertipe ",(0,i.kt)("inlineCode",{parentName:"li"},"two_dimensional::Square"),".")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let circle_one = new_circle(5);\n calculate_and_print_result6("circle".to_string(), &circle_one);\n\n let square_one = new_square(10);\n calculate_and_print_result7("square".to_string(), &square_one);\n}\n\nfn new_circle(radius: i32) -> impl Area {\n let data = two_dimensional::Circle{\n radius\n };\n data\n}\n\nfn new_square(length: i32) -> impl Area + Circumference {\n two_dimensional::Square{\n length\n }\n}\n\nfn calculate_and_print_result6<T>(name: String, item: &T)\nwhere\n T: Area,\n{\n println!("{} area: {}", name, item.calculate_area());\n}\n\nfn calculate_and_print_result7<T>(name: String, item: &T)\nwhere\n T: Area + Circumference,\n{\n println!("{} area: {}", name, item.calculate_area());\n println!("{} circumference: {}", name, item.calculate_circumference());\n}\n')),(0,i.kt)("p",null,"Salah satu konsekuensi dalam penerapan trait sebagai return type adalah: tipe data milik nilai yang dikembalikan terdeteksi sebagai tipe trait. Contohnya variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"circle_one")," di atas, tipe data-nya bukan ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle"),", melainkan ",(0,i.kt)("inlineCode",{parentName:"p"},"impl Area"),"."),(0,i.kt)("p",null,"Tipe data aslinya tetap bisa diakses, tapi butuh tambahan effort. Lebih jelasnya dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/trait-conversion-from-into"},"Trait \u279c Conversion (From & Into)"),"."),(0,i.kt)("h2",{id:"a377-associated-types-pada-trait"},"A.37.7. ",(0,i.kt)("em",{parentName:"h2"},"Associated types")," pada trait"),(0,i.kt)("p",null,"Associated types adalah tipe data yang didefinisikan di dalam suatu trait. Associated types tidak tidak memiliki tipe data konkret saat didefinisikan, namun ketika trait di-implementasikan maka tipe tersebut harus ditentukan tipe data konkritnya."),(0,i.kt)("p",null,"Lebih jelas silakan perhatikan kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"trait Shape {\n type Area;\n\n fn area(&self) -> Self::Area;\n}\n")),(0,i.kt)("p",null,"Pada definisi trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Shape")," di atas, yang disebut dengan associated types adalah tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Area")," yang definisinya berada dalam block trait. Tipe didefinisikan tanpa assignment operator, jadi tidak ada tipe data konkretnya."),(0,i.kt)("p",null,"Associated types ini sering digunakan pada Rust programming."),(0,i.kt)("p",null,"Lanjut skenario praktek berikutnya. Silakan siapkan package/project baru dengan struktur seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 shape.rs\n \u2502\u2500\u2500\u2500 circle.rs\n \u2502\u2500\u2500\u2500 square.rs\n \u2514\u2500\u2500\u2500 main.rs\n")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Disiapkan suatu trait bernama ",(0,i.kt)("inlineCode",{parentName:"li"},"shape::Shape"),".",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"Trait ini memiliki satu associated types bernama ",(0,i.kt)("inlineCode",{parentName:"li"},"Area"),"."),(0,i.kt)("li",{parentName:"ul"},"Dan memiliki sebuah definisi method header ",(0,i.kt)("inlineCode",{parentName:"li"},"area")," yang gunanya untuk menghitung luas bangun datar (",(0,i.kt)("em",{parentName:"li"},"shape"),")."))),(0,i.kt)("li",{parentName:"ul"},"Disiapkan struct ",(0,i.kt)("inlineCode",{parentName:"li"},"circle::Circle")," yang mengadopsi trait ",(0,i.kt)("inlineCode",{parentName:"li"},"shape::Shape"),"."),(0,i.kt)("li",{parentName:"ul"},"Disiapkan struct ",(0,i.kt)("inlineCode",{parentName:"li"},"square::Square")," yang mengadopsi trait ",(0,i.kt)("inlineCode",{parentName:"li"},"shape::Shape"),".")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/shape.rs"',title:'"src/shape.rs"'},"pub trait Shape {\n type Area;\n\n fn area(&self) -> Self::Area;\n}\n")),(0,i.kt)("p",null,"Trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Shape")," di atas spesifikasinya mirip seperti pada contoh sebelumnya, hanya saja kali ini trait-nya di set public agar bisa diakses dari ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs")," nantinya."),(0,i.kt)("p",null,"Trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Shape")," kemudian di-implementasikan ke struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Square"),", kode-nya bisa dilihat berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/circle.rs"',title:'"src/circle.rs"'},"pub struct Circle {\n pub radius: f64,\n}\n\nimpl crate::shape::Shape for Circle {\n type Area = f64;\n\n fn area(&self) -> Self::Area {\n std::f64::consts::PI * self.radius * self.radius\n }\n}\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/square.rs"',title:'"src/square.rs"'},"pub struct Square {\n pub side: i64,\n}\n\nimpl crate::shape::Shape for Square {\n type Area = i64;\n\n fn area(&self) -> Self::Area {\n self.side * self.side\n }\n}\n")),(0,i.kt)("p",null,"Bisa dilihat pada kedua implementasi di atas, associated type ",(0,i.kt)("inlineCode",{parentName:"p"},"Area")," diisi dengan tipe concrete, yaitu:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Tipe data ",(0,i.kt)("inlineCode",{parentName:"li"},"f64")," sebagai tipe concrete ",(0,i.kt)("inlineCode",{parentName:"li"},"circle:Circle:Area")),(0,i.kt)("li",{parentName:"ul"},"Tipe data ",(0,i.kt)("inlineCode",{parentName:"li"},"i64")," sebagai tipe concrete ",(0,i.kt)("inlineCode",{parentName:"li"},"square:Square:Area"))),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Contoh di atas adalah cara pengaplikasian associated types.")),(0,i.kt)("p",null,"Lalu pada ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs"),", tipe data struct ",(0,i.kt)("inlineCode",{parentName:"p"},"circle::Circle")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"square::Square")," digunakan untuk membuat variabel baru, yang kemudian dari variabel tersebut, method ",(0,i.kt)("inlineCode",{parentName:"p"},".area()")," milik diakses."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod shape;\nmod circle;\nmod square;\n\nuse crate::shape::Shape;\n\nfn main() {\n let obj1 = circle::Circle{ radius: 10.0 };\n println!("area of circle: {:.2}", obj1.area());\n\n let obj2 = square::Square{ side: 10 };\n println!("area of square: {:}", obj2.area());\n}\n')),(0,i.kt)("p",null,"Silakan jalankan program dan lihat hasilnya."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Trait",src:n(6254).Z,width:"469",height:"130"})),(0,i.kt)("p",null,"O iya, pada ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs"),", module item ",(0,i.kt)("inlineCode",{parentName:"p"},"shape::Shape")," perlu di-import meskipun kita tidak menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"trait")," tersebut secara langsung. Jika tidak di-import, maka method ",(0,i.kt)("inlineCode",{parentName:"p"},".area()")," milik ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Square")," tidak bisa diakses."),(0,i.kt)("h2",{id:"a378-attribute-derive"},"A.37.8. Attribute ",(0,i.kt)("inlineCode",{parentName:"h2"},"derive")),(0,i.kt)("p",null,"Ada cara lain untuk mengimplementasikan suatu trait ke dalam tipe data selain dengan menuliskan implementasinya secara eksplist, caranya menggunakan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"derive"),"."),(0,i.kt)("p",null,"Lebih detailnya dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/attributes"},"Attributes"),"."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/advanced_traits"},"github.com/novalagung/dasarpemrogramanrust-example/../advanced_traits")),(0,i.kt)("h3",{id:"-work-in-progress"},"\u25c9 Work in progress"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Pembahasan tentang trait bounds untuk implementasi method kondisional"),(0,i.kt)("li",{parentName:"ul"},"Pembahasan tentang trait overloading"),(0,i.kt)("li",{parentName:"ul"},"orphan rules")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch10-02-traits.html"},"https://doc.rust-lang.org/book/ch10-02-traits.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/primitive.i32.html"},"https://doc.rust-lang.org/std/primitive.i32.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/fmt/trait.Debug.html"},"https://doc.rust-lang.org/std/fmt/trait.Debug.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/fmt/trait.Display.html"},"https://doc.rust-lang.org/std/fmt/trait.Display.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/string/struct.String.html"},"https://doc.rust-lang.org/std/string/struct.String.html"))))}m.isMDXComponent=!0},4176:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/traits-5-29be804051729f23db8dd64e978e2398.png"},6254:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/traits-6-8165525fc9f8604bf115634eeb974230.png"}}]); \ No newline at end of file diff --git a/assets/js/7794a932.1399478f.js b/assets/js/7794a932.1399478f.js deleted file mode 100644 index 214365a8..00000000 --- a/assets/js/7794a932.1399478f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[8358],{3905:(e,a,n)=>{n.d(a,{Zo:()=>o,kt:()=>s});var t=n(7294);function i(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function r(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function l(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?r(Object(n),!0).forEach((function(a){i(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function p(e,a){if(null==e)return{};var n,t,i=function(e,a){if(null==e)return{};var n,t,i={},r=Object.keys(e);for(t=0;t<r.length;t++)n=r[t],a.indexOf(n)>=0||(i[n]=e[n]);return i}(e,a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t<r.length;t++)n=r[t],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var d=t.createContext({}),u=function(e){var a=t.useContext(d),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},o=function(e){var a=u(e.components);return t.createElement(d.Provider,{value:a},e.children)},k={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},m=t.forwardRef((function(e,a){var n=e.components,i=e.mdxType,r=e.originalType,d=e.parentName,o=p(e,["components","mdxType","originalType","parentName"]),m=u(n),s=i,c=m["".concat(d,".").concat(s)]||m[s]||k[s]||r;return n?t.createElement(c,l(l({ref:a},o),{},{components:n})):t.createElement(c,l({ref:a},o))}));function s(e,a){var n=arguments,i=a&&a.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=m;var p={};for(var d in a)hasOwnProperty.call(a,d)&&(p[d]=a[d]);p.originalType=e,p.mdxType="string"==typeof e?e:i,l[1]=p;for(var u=2;u<r;u++)l[u]=n[u];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}m.displayName="MDXCreateElement"},6682:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>d,contentTitle:()=>l,default:()=>k,frontMatter:()=>r,metadata:()=>p,toc:()=>u});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:40,title:"A.40. Tipe Data \u279c Result",sidebar_label:"A.40. Tipe Data \u279c Result"},l=void 0,p={unversionedId:"basic/result-type",id:"basic/result-type",title:"A.40. Tipe Data \u279c Result",description:"Chapter ini membahas tentang tipe data Result, yaitu tipe data yang digunakan untuk menampung nilai yang isinya bisa berupa penanda operasi sukses (Ok) dan data, atau error (Err) beserta keterangan errornya.",source:"@site/docs/basic/result-type.md",sourceDirName:"basic",slug:"/basic/result-type",permalink:"/basic/result-type",draft:!1,tags:[],version:"current",sidebarPosition:40,frontMatter:{sidebar_position:40,title:"A.40. Tipe Data \u279c Result",sidebar_label:"A.40. Tipe Data \u279c Result"},sidebar:"tutorialSidebar",previous:{title:"A.39. Tipe Data \u279c Option",permalink:"/basic/option-type"},next:{title:"A.41. Operator ?",permalink:"/basic/operator-tanda-tanya"}},d={},u=[{value:"A.40.1. Konsep <code>Result</code>",id:"a401-konsep-result",level:2},{value:"A.40.2. Pattern matching pada tipe <code>Result</code>",id:"a402-pattern-matching-pada-tipe-result",level:2},{value:"\u25c9 Tips pattern matching",id:"-tips-pattern-matching",level:3},{value:"A.40.3. Method tipe data <code>Result</code>",id:"a403-method-tipe-data-result",level:2},{value:"\u25c9 Method <code>is_ok</code> & <code>unwrap</code>",id:"-method-is_ok--unwrap",level:3},{value:"\u25c9 Method <code>as_ref</code>",id:"-method-as_ref",level:3},{value:"\u25c9 Method <code>is_err</code> & <code>err</code>",id:"-method-is_err--err",level:3},{value:"\u25c9 Method <code>ok</code>",id:"-method-ok",level:3},{value:"\u25c9 Method <code>unwrap_or_default</code>",id:"-method-unwrap_or_default",level:3},{value:"\u25c9 Method <code>unwrap_or</code>",id:"-method-unwrap_or",level:3},{value:"\u25c9 Method <code>unwrap_or_else</code>",id:"-method-unwrap_or_else",level:3},{value:"A.40.4. Operator <code>?</code> pada tipe <code>Result</code>",id:"a404-operator--pada-tipe-result",level:2},{value:"A.40.5. Error handling",id:"a405-error-handling",level:2},{value:"A.40.6. Tipe <code>Result<(), E></code>",id:"a406-tipe-result-e",level:2},{value:"A.40.7. Tipe <code>Result<T></code>",id:"a407-tipe-resultt",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],o={toc:u};function k(e){let{components:a,...r}=e;return(0,i.kt)("wrapper",(0,t.Z)({},o,r,{components:a,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Chapter ini membahas tentang tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result"),", yaitu tipe data yang digunakan untuk menampung nilai yang isinya bisa berupa penanda operasi sukses (",(0,i.kt)("inlineCode",{parentName:"p"},"Ok"),") dan data, atau error (",(0,i.kt)("inlineCode",{parentName:"p"},"Err"),") beserta keterangan errornya."),(0,i.kt)("p",null,"Rust menyediakan panic-level error, tapi penggunaannya untuk menandai operasi error sangat tidak dianjurkan. Selain itu, Rust tidak mengenal konsep ",(0,i.kt)("em",{parentName:"p"},"exception"),"."),(0,i.kt)("p",null,"Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," ini adalah tipe yang paling umum dan direkomendasikan untuk digunakan dalam penanganan error."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih detailnya mengenai penanganan error dibahas di chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/recoverable-error-handling"},"Error \u279c Recoverable Error & Error Handling"))),(0,i.kt)("h2",{id:"a401-konsep-result"},"A.40.1. Konsep ",(0,i.kt)("inlineCode",{parentName:"h2"},"Result")),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," adalah enum dengan isi 2 buah enum value:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"Result::Ok<T>")," (atau ",(0,i.kt)("inlineCode",{parentName:"li"},"Ok<T>"),"), digunakan untuk menandai bahwa data isinya adalah kabar baik (oke / mantab / jos / sukses)."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"Result::Err<E>")," (atau ",(0,i.kt)("inlineCode",{parentName:"li"},"Err<E>"),"), digunakan untuk menandai bawah data berisi kabar buruk (error).")),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"T")," dan ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," merupakan parameter generic. Lebih jelasnya mengenai generic dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/generics"},"Generics"),"."))),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," memiliki notasi penulisan ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," digunakan pada enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok<T>")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"E")," digunakan enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Err<E>"),"."),(0,i.kt)("p",null,"Cara penerapan tipe data ini bisa dilihat pada kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[derive(Debug)]\nenum MathError {\n DivisionByZero,\n InfinityNumber,\n OtherError,\n}\n\nfn main() {\n let result1 = divider(10.0, 5.0);\n println!("result: {:?}", result1);\n\n let result2: Result<f64, MathError> = divider(10.0, 0.0);\n println!("result: {:?}", result2);\n}\n\nfn divider(a: f64, b: f64) -> Result<f64, MathError> {\n if b == 0.0 {\n return Err(MathError::DivisionByZero);\n }\n\n let result = a / b;\n return Ok(result);\n}\n')),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider")," di atas tugasnya adalah melakukan operasi aritmatika pembagian angka numerik ",(0,i.kt)("inlineCode",{parentName:"p"},"f64"),", parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"a")," dibagi ",(0,i.kt)("inlineCode",{parentName:"p"},"b"),"."),(0,i.kt)("p",null,"Pada fungsi tersebut terdapat pengecekan apabila nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"b")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"0"),", maka yang dikembalikan adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Err<E>")," dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"E")," berisi pesan error, selainnya maka hasil operasi pembagian dikembalikan dibungkus dalam enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok<f64>"),"."),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider")," nilai baliknya bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<f64, MathError>"),". Dari tipe data yang digunakan nantinya bisa diprediksi pasti akan ada 2 potensi value:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Return value adalah enum value ",(0,i.kt)("inlineCode",{parentName:"li"},"Err<MathError>"),", muncul ketika nilai ",(0,i.kt)("inlineCode",{parentName:"li"},"b")," adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"0")),(0,i.kt)("li",{parentName:"ul"},"Return value adalah nilai hasil numerik yang dibungkus oleh enum value ",(0,i.kt)("inlineCode",{parentName:"li"},"Ok<f64>"))),(0,i.kt)("p",null,"Output program di atas saat di-run:"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Result type",src:n(1463).Z,width:"454",height:"112"})),(0,i.kt)("h2",{id:"a402-pattern-matching-pada-tipe-result"},"A.40.2. Pattern matching pada tipe ",(0,i.kt)("inlineCode",{parentName:"h2"},"Result")),(0,i.kt)("p",null,"Dalam penerapannya, ketika ada data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," artinya data tersebut berpotensi untuk berisi nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"Err<E>")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok<T>"),", pasti antara 2 nilai tersebut."),(0,i.kt)("p",null,"Umumnya penggunaan tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," selalu diikuti dengan pattern matching menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),". Selain itu keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," sebenarnya juga bisa diterapkan pada pattern matching tipe data ini, namun kurang dianjurkan."),(0,i.kt)("p",null,"Mari kita praktikkan. Ubah isi fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," dengan kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10.0, 5.0);\nmatch result {\n Err(m) => println!("ERROR! {:?}", m),\n Ok(r) => println!("result: {r:.2}"),\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Option type",src:n(2565).Z,width:"450",height:"89"})),(0,i.kt)("p",null,"Bisa dilihat pada kode di atas mudahnya pengambilan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"m")," dari ",(0,i.kt)("inlineCode",{parentName:"p"},"Err(m)")," dan juga ",(0,i.kt)("inlineCode",{parentName:"p"},"r")," dari ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok(r)"),". Penerapan ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," untuk seleksi kondisi biasa disebut dengan ",(0,i.kt)("strong",{parentName:"p"},"pattern matching")," dan teknik ini sangat fleksibel dan advance."),(0,i.kt)("p",null,"Sebagai contoh, dengan penerapan match yang seperti ini kita bisa meng-handle 5 skenario seleksi kondisi:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10.0, 5.0);\nmatch result {\n Err(MathError::DivisionByZero) => println!("ERROR! unable to divide number by 0"),\n Err(MathError::InfinityNumber) => println!("ERROR! result is infinity number (\u221e)"),\n Err(_) => println!("ERROR! unknown error"),\n Ok(2.0) => println!("the result is 2"),\n Ok(x) => println!("result: {x:.2}"),\n}\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Kondisi ke-1: jika nilai adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"Err(MathError::DivisionByZero)"),", maka munculkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"ERROR! unable to divide number by 0"),"."),(0,i.kt)("li",{parentName:"ul"},"Kondisi ke-2: jika nilai adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"Err(MathError::InfinityNumber)"),", maka munculkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"ERROR! result is infinity number (\u221e)"),"."),(0,i.kt)("li",{parentName:"ul"},"Kondisi ke-3: jika nilai adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"Err")," selain dari ",(0,i.kt)("inlineCode",{parentName:"li"},"Err(MathError::DivisionByZero)")," dan ",(0,i.kt)("inlineCode",{parentName:"li"},"Err(MathError::InfinityNumber)"),", maka munculkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"ERROR! unknown error"),"."),(0,i.kt)("li",{parentName:"ul"},"Kondisi ke-4: jika nilai adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"Ok(2.0)"),", maka munculkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"the result is 2"),"."),(0,i.kt)("li",{parentName:"ul"},"Kondisi ke-5: jika nilai adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"Ok")," selain dari ",(0,i.kt)("inlineCode",{parentName:"li"},"Ok(2.0)"),", maka munculkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"result: {x:.2}"),".")),(0,i.kt)("h3",{id:"-tips-pattern-matching"},"\u25c9 Tips pattern matching"),(0,i.kt)("p",null,"Silakan perhatikan kode yang sudah kita praktikkan berikut ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10.0, 5.0);\nmatch result {\n Err(m) => println!("ERROR! {:?}", m),\n Ok(r) => println!("result: {r:.2}"),\n}\n')),(0,i.kt)("p",null,"Penerapan pattern matching seperti contoh di atas memiliki konsekuensi, yaitu variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"r")," hanya bisa diakses pada block ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok(r)")," saja."),(0,i.kt)("p",null,"Adakalanya kita butuh untuk mengeluarkan variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"r")," ke luar block. Hal seperti ini mudah untuk dilakukan, dan ada beberapa cara yang bisa dipilih, namun menurut penulis yang paling elegan adalah cara berikut ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let result: f64 = match divider(10.0, 5.0) {\n Err(m) => {\n println!("ERROR! {:?}", m);\n 0.0\n },\n Ok(r) => r,\n };\n\n println!("result: {:?}", result);\n}\n')),(0,i.kt)("p",null,"Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"divider(10.0, 5.0)")," mengembalikan data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<f64, MathError>"),". Data tersebut digunakan pada keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," seperti biasa. Namun pada contoh di atas ada yang berbeda, yaitu return value dari statement ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," ditampung ke variabel (",(0,i.kt)("inlineCode",{parentName:"p"},"result"),")."),(0,i.kt)("p",null,"Isi dari pattern matching ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," sendiri ada dua:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Ketika block ",(0,i.kt)("inlineCode",{parentName:"li"},"Err(m)")," match, error di-print kemudian nilai ",(0,i.kt)("inlineCode",{parentName:"li"},"0.0")," dijadikan return statement ",(0,i.kt)("inlineCode",{parentName:"li"},"match"),"."),(0,i.kt)("li",{parentName:"ul"},"Ketika block ",(0,i.kt)("inlineCode",{parentName:"li"},"Ok")," match, data ",(0,i.kt)("inlineCode",{parentName:"li"},"r")," dijadikan return value statement ",(0,i.kt)("inlineCode",{parentName:"li"},"match"),".")),(0,i.kt)("p",null,"Dengan penerapan pattern matching seperti di atas, maka variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"result")," akan selalu berisi data hasil operasi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider(10.0, 5.0)"),". Dengan pengecualian ketika ada error, pesan errornya dimunculkan kemudian hasil operasi pembagian di-set sebagai ",(0,i.kt)("inlineCode",{parentName:"p"},"0.0"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai pattern matching dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pattern-matching"},"Pattern Matching"))),(0,i.kt)("h2",{id:"a403-method-tipe-data-result"},"A.40.3. Method tipe data ",(0,i.kt)("inlineCode",{parentName:"h2"},"Result")),(0,i.kt)("h3",{id:"-method-is_ok--unwrap"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"is_ok")," & ",(0,i.kt)("inlineCode",{parentName:"h3"},"unwrap")),(0,i.kt)("p",null,"Isi dari enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok<T>")," bisa diakses tanpa menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," dengan cara memanfaatkan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap")," milik ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>"),". Sebelum mengakses method tersebut sangat dianjurkan untuk mengecek apakah data berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok<T> atau tidak"),", karena jika data adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Err<E>")," pengaksesan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap")," menghasilkan error."),(0,i.kt)("p",null,"Pengecekan nilai ok atau tidak bisa dilakukan menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"is_ok"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10.0, 5.0);\nif result.is_ok() {\n let number = result.unwrap();\n println!("result: {}", number);\n // result: 2\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Result type",src:n(5086).Z,width:"447",height:"88"})),(0,i.kt)("h3",{id:"-method-as_ref"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"as_ref")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_ref")," digunakan untuk mengakses reference ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"E")," pada ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>"),". Method ini sering kali dibutuhkan untuk menghindari terjadinya ",(0,i.kt)("em",{parentName:"p"},"move semantics")," pada owner data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>"),"."),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_ref")," mengembalikan data dalam tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<&T, &E>"),". Jadi reference yang dipinjam bukan milik ",(0,i.kt)("inlineCode",{parentName:"p"},"Result"),"-nya melainkan milik ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"E"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let result: Result<f64, MathError> = divider(10.0, 0.0);\nlet result_borrow: Result<&f64, &MathError> = result.as_ref();\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai ",(0,i.kt)("em",{parentName:"p"},"move semantics")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/ownership#a334-copy-semantics-vs-move-semantics"},"Ownership"))),(0,i.kt)("h3",{id:"-method-is_err--err"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"is_err")," & ",(0,i.kt)("inlineCode",{parentName:"h3"},"err")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"err")," mengembalikan data dalam tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Err<E>"),". Pada pengaksesan method ini, pastikan untuk mengecek apakah ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," berisi data error atau ok dengan via method ",(0,i.kt)("inlineCode",{parentName:"p"},"is_err"),". Selain itu, wajib untuk menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_ref")," sebelum method ",(0,i.kt)("inlineCode",{parentName:"p"},"err")," agar ownership data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," tidak berpindah (",(0,i.kt)("em",{parentName:"p"},"move semantics"),")."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10.0, 0.0);\nif result.is_err() {\n let err = result.as_ref().err();\n let message = err.unwrap();\n println!("error: {:?}", message);\n // error: DivisionByZero\n}\n')),(0,i.kt)("h3",{id:"-method-ok"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"ok")),(0,i.kt)("p",null,"Aturan yang sama juga berlaku pada pengaksesan method ",(0,i.kt)("inlineCode",{parentName:"p"},"ok")," yang mengembalikan data ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok<T>"),". Method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_ref")," harus diakses terlebih dahulu sebelum memanggil method ",(0,i.kt)("inlineCode",{parentName:"p"},"ok")," agar tidak terjadi ",(0,i.kt)("em",{parentName:"p"},"move semantics"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10.0, 5.0);\nif result.is_ok() {\n let data = result.as_ref().ok();\n let number = data.unwrap();\n println!("result: {:?}", number);\n // result: 2\n}\n')),(0,i.kt)("h3",{id:"-method-unwrap_or_default"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"unwrap_or_default")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap_or_default")," milik ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," mengembalikan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," ketika data berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok<T>"),", namun jika data berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Err<E>")," maka yang dikembalikan adalah ",(0,i.kt)("em",{parentName:"p"},"default value")," dari tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"T"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10.0, 0.0);\nlet number = result.unwrap_or_default();\nprintln!("result: {}", number);\n// result: 0\n')),(0,i.kt)("h3",{id:"-method-unwrap_or"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"unwrap_or")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap_or")," milik ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," mengembalikan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," ketika data berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok<T>"),", namun jika data ternyata isinya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Err<E>")," maka yang dikembalikan adalah argument pemanggilan method tersebut."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10.0, 0.0);\nlet number = result.unwrap_or(0.0);\nprintln!("result: {}", number);\n// result: 0\n')),(0,i.kt)("h3",{id:"-method-unwrap_or_else"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"unwrap_or_else")),(0,i.kt)("p",null,"Method ini mengembalikan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," ketika data berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok<T>"),", namun jika data isinya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Err<E>")," maka yang dikembalikan adalah hasil eksekusi closure yang disisipkan saat memanggil method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap_or_else"),". Contoh pengaplikasiannya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10.0, 0.0);\nlet number = result.unwrap_or_else(|_| 0.0);\nprintln!("result: {}", number);\n// result: 0\n')),(0,i.kt)("p",null,"Closure harus dalam notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"FnOnce(E) -> T")," yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," pada konteks ini adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"f64"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai closure dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/closures"},"Closures"),".")),(0,i.kt)("h2",{id:"a404-operator--pada-tipe-result"},"A.40.4. Operator ",(0,i.kt)("inlineCode",{parentName:"h2"},"?")," pada tipe ",(0,i.kt)("inlineCode",{parentName:"h2"},"Result")),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," bisa digunakan pada operator ",(0,i.kt)("inlineCode",{parentName:"p"},"?"),". Penjelasannya ada di chapter terpisah di ",(0,i.kt)("a",{parentName:"p",href:"/basic/operator-tanda-tanya"},"Operator ?"),"."),(0,i.kt)("h2",{id:"a405-error-handling"},"A.40.5. Error handling"),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," banyak digunakan pada fungsi-fungsi yang disediakan Rust standard library, selain itu tipe tersebut juga akan sering kita gunakan dalam ",(0,i.kt)("em",{parentName:"p"},"real life")," project."),(0,i.kt)("p",null,"Tipe ini dimanfaatkan untuk error handling di Rust. Lebih jelasnya mengenai topik tersebut dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/recoverable-error-handling"},"Error \u279c Recoverable Error & Error Handling"),"."),(0,i.kt)("h2",{id:"a406-tipe-result-e"},"A.40.6. Tipe ",(0,i.kt)("inlineCode",{parentName:"h2"},"Result<(), E>")),(0,i.kt)("p",null,"Di atas kita telah mempelajari dan mempraktekan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider()")," yang fungsi tersebut mengembalikan 2 informasi, yaitu:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"T")," berisi nilai hasil pembagian"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"E")," berisi error saat operasi pembagian")),(0,i.kt)("p",null,"Bentuk lain penerapan tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," adalah dengan menggunakan notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," diisi tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"()"),". Tipe ini cukup sering digunakan pada fungsi yang memiliki potensi error tapi kita hanya butuh informasi errornya saja tanpa nilai balik lainnya."),(0,i.kt)("p",null,"Sebagai contoh, pada kode berikut dibuat fungsi baru bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"divide_and_print()"),". Dalam fungsi tersebut, operasi pembagian dilakukan. Jika sukses, nilainya langsung di-print; jika error, nilai errornya dikembalikan. Dari sini terlihat bahwa kita tidak membutuhkan fungsi tersebut untuk mengembalikan informasi selain error."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn divide_and_print(a: f64, b: f64) -> Result<(), MathError> {\n let res = divider(a, b);\n match res {\n Err(m) => {\n println!("ERROR! {:?}", m);\n Err(m)\n },\n Ok(n) => {\n println!("result: {}", n);\n Ok(())\n },\n }\n}\n\nfn main() {\n let result = divide_and_print(10.0, 1.0);\n}\n')),(0,i.kt)("p",null,"Pada pemanggilan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok()")," gunakan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"()")," untuk memenuhi kriteria tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<(), MathError>"),"."),(0,i.kt)("h2",{id:"a407-tipe-resultt"},"A.40.7. Tipe ",(0,i.kt)("inlineCode",{parentName:"h2"},"Result<T>")),(0,i.kt)("p",null,"Notasi tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," bawaan Rust Standard Library adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>"),". Namun, pada pengembangan software yang melibatkan banyak sekali library/dependency, adakalanya pembaca akan menemui notasi tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T>"),". Notasi tersebut dibuat oleh pengembang library/dependency untuk memperingkas tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, SomeErrorType>"),". Jadi tidak usah bingung."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/result_type"},"github.com/novalagung/dasarpemrogramanrust-example/../result_type")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/generics"},"Generics")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/pattern-matching"},"Pattern Matching")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/closures"},"Closures")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/operator-tanda-tanya"},"Operator ?")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/recoverable-error-handling"},"Error \u279c Recoverable Error & Error Handling"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html"},"https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/result/index.html"},"https://doc.rust-lang.org/std/result/index.html"))))}k.isMDXComponent=!0},1463:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcYAAABwCAIAAAAL5EeiAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6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eFEVtlJ4d0gzwzDGLTi3zTPzoUasIPfPEiTtFUSuauQdIdGUvOToH5qYnIjhFUdSK6BknVBf/zUpPg06GnRRFrZae6QivWwztV0WbuDRKTyu1z+JkQEl0UhS1fnr6s/d+2TPcMe8O//zxvcFlMPOHu/Z5e+7dmoG/mEBRFLUMPSmKoijSk6IoivSkKIoiPSmKokhPiqIo0pOiKIoiPSmKokhPiqIo0pOiKIr0pCiKuhL9DzCR83RW6DQ7AAAAAElFTkSuQmCC"}}]); \ No newline at end of file diff --git a/assets/js/7794a932.84b8d000.js b/assets/js/7794a932.84b8d000.js new file mode 100644 index 00000000..0006d7d8 --- /dev/null +++ b/assets/js/7794a932.84b8d000.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[8358],{3905:(e,a,n)=>{n.d(a,{Zo:()=>u,kt:()=>s});var t=n(7294);function i(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function r(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function l(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?r(Object(n),!0).forEach((function(a){i(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function p(e,a){if(null==e)return{};var n,t,i=function(e,a){if(null==e)return{};var n,t,i={},r=Object.keys(e);for(t=0;t<r.length;t++)n=r[t],a.indexOf(n)>=0||(i[n]=e[n]);return i}(e,a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t<r.length;t++)n=r[t],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var d=t.createContext({}),o=function(e){var a=t.useContext(d),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},u=function(e){var a=o(e.components);return t.createElement(d.Provider,{value:a},e.children)},k={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},m=t.forwardRef((function(e,a){var n=e.components,i=e.mdxType,r=e.originalType,d=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),m=o(n),s=i,c=m["".concat(d,".").concat(s)]||m[s]||k[s]||r;return n?t.createElement(c,l(l({ref:a},u),{},{components:n})):t.createElement(c,l({ref:a},u))}));function s(e,a){var n=arguments,i=a&&a.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=m;var p={};for(var d in a)hasOwnProperty.call(a,d)&&(p[d]=a[d]);p.originalType=e,p.mdxType="string"==typeof e?e:i,l[1]=p;for(var o=2;o<r;o++)l[o]=n[o];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}m.displayName="MDXCreateElement"},6682:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>d,contentTitle:()=>l,default:()=>k,frontMatter:()=>r,metadata:()=>p,toc:()=>o});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:40,title:"A.40. Tipe Data \u279c Result",sidebar_label:"A.40. Tipe Data \u279c Result"},l=void 0,p={unversionedId:"basic/result-type",id:"basic/result-type",title:"A.40. Tipe Data \u279c Result",description:"Chapter ini membahas tentang tipe data Result, yaitu tipe data yang digunakan untuk menampung nilai yang isinya bisa berupa penanda operasi sukses (Ok) dan data, atau error (Err) beserta keterangan errornya.",source:"@site/docs/basic/result-type.md",sourceDirName:"basic",slug:"/basic/result-type",permalink:"/basic/result-type",draft:!1,tags:[],version:"current",sidebarPosition:40,frontMatter:{sidebar_position:40,title:"A.40. Tipe Data \u279c Result",sidebar_label:"A.40. Tipe Data \u279c Result"},sidebar:"tutorialSidebar",previous:{title:"A.39. Tipe Data \u279c Option",permalink:"/basic/option-type"},next:{title:"A.41. Operator ?",permalink:"/basic/operator-tanda-tanya"}},d={},o=[{value:"A.40.1. Konsep <code>Result</code>",id:"a401-konsep-result",level:2},{value:"A.40.2. Pattern matching pada tipe <code>Result</code>",id:"a402-pattern-matching-pada-tipe-result",level:2},{value:"\u25c9 Tips pattern matching",id:"-tips-pattern-matching",level:3},{value:"A.40.3. Method tipe data <code>Result</code>",id:"a403-method-tipe-data-result",level:2},{value:"\u25c9 Method <code>is_ok</code> & <code>unwrap</code>",id:"-method-is_ok--unwrap",level:3},{value:"\u25c9 Method <code>as_ref</code>",id:"-method-as_ref",level:3},{value:"\u25c9 Method <code>is_err</code> & <code>err</code>",id:"-method-is_err--err",level:3},{value:"\u25c9 Method <code>ok</code>",id:"-method-ok",level:3},{value:"\u25c9 Method <code>unwrap_or_default</code>",id:"-method-unwrap_or_default",level:3},{value:"\u25c9 Method <code>unwrap_or</code>",id:"-method-unwrap_or",level:3},{value:"\u25c9 Method <code>unwrap_or_else</code>",id:"-method-unwrap_or_else",level:3},{value:"A.40.4. Operator <code>?</code> pada tipe <code>Result</code>",id:"a404-operator--pada-tipe-result",level:2},{value:"A.40.5. Error handling",id:"a405-error-handling",level:2},{value:"A.40.6. Tipe <code>Result<(), E></code>",id:"a406-tipe-result-e",level:2},{value:"A.40.7. Tipe <code>Result<T></code>",id:"a407-tipe-resultt",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],u={toc:o};function k(e){let{components:a,...r}=e;return(0,i.kt)("wrapper",(0,t.Z)({},u,r,{components:a,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Chapter ini membahas tentang tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result"),", yaitu tipe data yang digunakan untuk menampung nilai yang isinya bisa berupa penanda operasi sukses (",(0,i.kt)("inlineCode",{parentName:"p"},"Ok"),") dan data, atau error (",(0,i.kt)("inlineCode",{parentName:"p"},"Err"),") beserta keterangan errornya."),(0,i.kt)("p",null,"Rust menyediakan panic-level error, tapi penggunaannya untuk menandai operasi error sangat tidak dianjurkan. Selain itu, Rust tidak mengenal konsep ",(0,i.kt)("em",{parentName:"p"},"exception"),"."),(0,i.kt)("p",null,"Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," ini adalah tipe yang paling umum dan direkomendasikan untuk digunakan dalam penanganan error."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih detailnya mengenai penanganan error dibahas di chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/recoverable-error-handling"},"Error \u279c Recoverable Error & Error Handling"))),(0,i.kt)("h2",{id:"a401-konsep-result"},"A.40.1. Konsep ",(0,i.kt)("inlineCode",{parentName:"h2"},"Result")),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," adalah enum dengan isi 2 buah enum value:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"Result::Ok<T>")," (atau ",(0,i.kt)("inlineCode",{parentName:"li"},"Ok<T>"),"), digunakan untuk menandai bahwa data isinya adalah kabar baik (oke / mantab / jos / sukses)."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"Result::Err<E>")," (atau ",(0,i.kt)("inlineCode",{parentName:"li"},"Err<E>"),"), digunakan untuk menandai bawah data berisi kabar buruk (error).")),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"T")," dan ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," merupakan parameter generic. Lebih jelasnya mengenai generic dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/generics"},"Generics"),"."))),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," memiliki notasi penulisan ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," digunakan pada enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok<T>")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"E")," digunakan enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Err<E>"),"."),(0,i.kt)("p",null,"Cara penerapan tipe data ini bisa dilihat pada kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[derive(Debug)]\nenum MathError {\n DivisionByZero,\n InfinityNumber,\n OtherError,\n}\n\nfn main() {\n let result1 = divider(10.0, 5.0);\n println!("result: {:?}", result1);\n\n let result2: Result<f64, MathError> = divider(10.0, 0.0);\n println!("result: {:?}", result2);\n}\n\nfn divider(a: f64, b: f64) -> Result<f64, MathError> {\n if b == 0.0 {\n return Err(MathError::DivisionByZero);\n }\n\n let result = a / b;\n return Ok(result);\n}\n')),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider")," di atas tugasnya adalah melakukan operasi aritmatika pembagian angka numerik ",(0,i.kt)("inlineCode",{parentName:"p"},"f64"),", parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"a")," dibagi ",(0,i.kt)("inlineCode",{parentName:"p"},"b"),"."),(0,i.kt)("p",null,"Pada fungsi tersebut terdapat pengecekan apabila nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"b")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"0"),", maka yang dikembalikan adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Err<E>")," dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"E")," berisi pesan error, selainnya maka hasil operasi pembagian dikembalikan dibungkus dalam enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok<f64>"),"."),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider")," nilai baliknya bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<f64, MathError>"),". Dari tipe data yang digunakan nantinya bisa diprediksi pasti akan ada 2 potensi value:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Return value adalah enum value ",(0,i.kt)("inlineCode",{parentName:"li"},"Err<MathError>"),", muncul ketika nilai ",(0,i.kt)("inlineCode",{parentName:"li"},"b")," adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"0")),(0,i.kt)("li",{parentName:"ul"},"Return value adalah nilai hasil numerik yang dibungkus oleh enum value ",(0,i.kt)("inlineCode",{parentName:"li"},"Ok<f64>"))),(0,i.kt)("p",null,"Output program di atas saat di-run:"),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Result type",src:n(1463).Z,width:"454",height:"112"})),(0,i.kt)("h2",{id:"a402-pattern-matching-pada-tipe-result"},"A.40.2. Pattern matching pada tipe ",(0,i.kt)("inlineCode",{parentName:"h2"},"Result")),(0,i.kt)("p",null,"Dalam penerapannya, ketika ada data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," artinya data tersebut berpotensi untuk berisi nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"Err<E>")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok<T>"),", pasti antara 2 nilai tersebut."),(0,i.kt)("p",null,"Umumnya penggunaan tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," selalu diikuti dengan pattern matching menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),". Selain itu keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," sebenarnya juga bisa diterapkan pada pattern matching tipe data ini, namun kurang dianjurkan."),(0,i.kt)("p",null,"Mari kita praktikkan. Ubah isi fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," dengan kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10.0, 5.0);\nmatch result {\n Err(m) => println!("ERROR! {:?}", m),\n Ok(r) => println!("result: {r:.2}"),\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Option type",src:n(2565).Z,width:"450",height:"89"})),(0,i.kt)("p",null,"Bisa dilihat pada kode di atas mudahnya pengambilan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"m")," dari ",(0,i.kt)("inlineCode",{parentName:"p"},"Err(m)")," dan juga ",(0,i.kt)("inlineCode",{parentName:"p"},"r")," dari ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok(r)"),". Penerapan ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," untuk seleksi kondisi biasa disebut dengan ",(0,i.kt)("strong",{parentName:"p"},"pattern matching")," dan teknik ini sangat fleksibel dan advance."),(0,i.kt)("p",null,"Sebagai contoh, dengan penerapan match yang seperti ini kita bisa meng-handle 5 skenario seleksi kondisi:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10.0, 5.0);\nmatch result {\n Err(MathError::DivisionByZero) => println!("ERROR! unable to divide number by 0"),\n Err(MathError::InfinityNumber) => println!("ERROR! result is infinity number (\u221e)"),\n Err(_) => println!("ERROR! unknown error"),\n Ok(2.0) => println!("the result is 2"),\n Ok(x) => println!("result: {x:.2}"),\n}\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Kondisi ke-1: jika nilai adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"Err(MathError::DivisionByZero)"),", maka munculkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"ERROR! unable to divide number by 0"),"."),(0,i.kt)("li",{parentName:"ul"},"Kondisi ke-2: jika nilai adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"Err(MathError::InfinityNumber)"),", maka munculkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"ERROR! result is infinity number (\u221e)"),"."),(0,i.kt)("li",{parentName:"ul"},"Kondisi ke-3: jika nilai adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"Err")," selain dari ",(0,i.kt)("inlineCode",{parentName:"li"},"Err(MathError::DivisionByZero)")," dan ",(0,i.kt)("inlineCode",{parentName:"li"},"Err(MathError::InfinityNumber)"),", maka munculkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"ERROR! unknown error"),"."),(0,i.kt)("li",{parentName:"ul"},"Kondisi ke-4: jika nilai adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"Ok(2.0)"),", maka munculkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"the result is 2"),"."),(0,i.kt)("li",{parentName:"ul"},"Kondisi ke-5: jika nilai adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"Ok")," selain dari ",(0,i.kt)("inlineCode",{parentName:"li"},"Ok(2.0)"),", maka munculkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"result: {x:.2}"),".")),(0,i.kt)("h3",{id:"-tips-pattern-matching"},"\u25c9 Tips pattern matching"),(0,i.kt)("p",null,"Silakan perhatikan kode yang sudah kita praktikkan berikut ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10.0, 5.0);\nmatch result {\n Err(m) => println!("ERROR! {:?}", m),\n Ok(r) => println!("result: {r:.2}"),\n}\n')),(0,i.kt)("p",null,"Penerapan pattern matching seperti contoh di atas memiliki konsekuensi, yaitu variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"r")," hanya bisa diakses pada block ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok(r)")," saja."),(0,i.kt)("p",null,"Adakalanya kita butuh untuk mengeluarkan variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"r")," ke luar block. Hal seperti ini mudah untuk dilakukan, dan ada beberapa cara yang bisa dipilih, namun menurut penulis yang paling elegan adalah cara berikut ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let result: f64 = match divider(10.0, 5.0) {\n Err(m) => {\n println!("ERROR! {:?}", m);\n 0.0\n },\n Ok(r) => r,\n };\n\n println!("result: {:?}", result);\n}\n')),(0,i.kt)("p",null,"Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"divider(10.0, 5.0)")," mengembalikan data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<f64, MathError>"),". Data tersebut digunakan pada keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," seperti biasa. Namun pada contoh di atas ada yang berbeda, yaitu return value dari statement ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," ditampung ke variabel (",(0,i.kt)("inlineCode",{parentName:"p"},"result"),")."),(0,i.kt)("p",null,"Isi dari pattern matching ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," sendiri ada dua:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Ketika block ",(0,i.kt)("inlineCode",{parentName:"li"},"Err(m)")," match, error di-print kemudian nilai ",(0,i.kt)("inlineCode",{parentName:"li"},"0.0")," dijadikan return statement ",(0,i.kt)("inlineCode",{parentName:"li"},"match"),"."),(0,i.kt)("li",{parentName:"ul"},"Ketika block ",(0,i.kt)("inlineCode",{parentName:"li"},"Ok")," match, data ",(0,i.kt)("inlineCode",{parentName:"li"},"r")," dijadikan return value statement ",(0,i.kt)("inlineCode",{parentName:"li"},"match"),".")),(0,i.kt)("p",null,"Dengan penerapan pattern matching seperti di atas, maka variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"result")," akan selalu berisi data hasil operasi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider(10.0, 5.0)"),". Dengan pengecualian ketika ada error, pesan errornya dimunculkan kemudian hasil operasi pembagian di-set sebagai ",(0,i.kt)("inlineCode",{parentName:"p"},"0.0"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai pattern matching dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pattern-matching"},"Pattern Matching"))),(0,i.kt)("h2",{id:"a403-method-tipe-data-result"},"A.40.3. Method tipe data ",(0,i.kt)("inlineCode",{parentName:"h2"},"Result")),(0,i.kt)("h3",{id:"-method-is_ok--unwrap"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"is_ok")," & ",(0,i.kt)("inlineCode",{parentName:"h3"},"unwrap")),(0,i.kt)("p",null,"Isi dari enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok<T>")," bisa diakses tanpa menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," dengan cara memanfaatkan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap")," milik ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>"),". Sebelum mengakses method tersebut sangat dianjurkan untuk mengecek apakah data berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok<T> atau tidak"),", karena jika data adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Err<E>")," pengaksesan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap")," menghasilkan error."),(0,i.kt)("p",null,"Pengecekan nilai ok atau tidak bisa dilakukan menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"is_ok"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10.0, 5.0);\nif result.is_ok() {\n let number = result.unwrap();\n println!("result: {}", number);\n // result: 2\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Result type",src:n(5086).Z,width:"447",height:"88"})),(0,i.kt)("h3",{id:"-method-as_ref"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"as_ref")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_ref")," digunakan untuk mengakses reference ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"E")," pada ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>"),". Method ini sering kali dibutuhkan untuk menghindari terjadinya ",(0,i.kt)("em",{parentName:"p"},"move semantics")," pada owner data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>"),"."),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_ref")," mengembalikan data dalam tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<&T, &E>"),". Jadi reference yang dipinjam bukan milik ",(0,i.kt)("inlineCode",{parentName:"p"},"Result"),"-nya melainkan milik ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"E"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let result: Result<f64, MathError> = divider(10.0, 0.0);\nlet result_borrow: Result<&f64, &MathError> = result.as_ref();\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai ",(0,i.kt)("em",{parentName:"p"},"move semantics")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/ownership#a334-copy-semantics-vs-move-semantics"},"Ownership"))),(0,i.kt)("h3",{id:"-method-is_err--err"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"is_err")," & ",(0,i.kt)("inlineCode",{parentName:"h3"},"err")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"err")," mengembalikan data dalam tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Err<E>"),". Pada pengaksesan method ini, pastikan untuk mengecek apakah ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," berisi data error atau ok dengan via method ",(0,i.kt)("inlineCode",{parentName:"p"},"is_err"),". Selain itu, wajib untuk menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_ref")," sebelum method ",(0,i.kt)("inlineCode",{parentName:"p"},"err")," agar ownership data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," tidak berpindah (",(0,i.kt)("em",{parentName:"p"},"move semantics"),")."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10.0, 0.0);\nif result.is_err() {\n let err = result.as_ref().err();\n let message = err.unwrap();\n println!("error: {:?}", message);\n // error: DivisionByZero\n}\n')),(0,i.kt)("h3",{id:"-method-ok"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"ok")),(0,i.kt)("p",null,"Aturan yang sama juga berlaku pada pengaksesan method ",(0,i.kt)("inlineCode",{parentName:"p"},"ok")," yang mengembalikan data ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok<T>"),". Method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_ref")," harus diakses terlebih dahulu sebelum memanggil method ",(0,i.kt)("inlineCode",{parentName:"p"},"ok")," agar tidak terjadi ",(0,i.kt)("em",{parentName:"p"},"move semantics"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10.0, 5.0);\nif result.is_ok() {\n let data = result.as_ref().ok();\n let number = data.unwrap();\n println!("result: {:?}", number);\n // result: 2\n}\n')),(0,i.kt)("h3",{id:"-method-unwrap_or_default"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"unwrap_or_default")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap_or_default")," milik ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," mengembalikan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," ketika data berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok<T>"),", namun jika data berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Err<E>")," maka yang dikembalikan adalah ",(0,i.kt)("em",{parentName:"p"},"default value")," dari tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"T"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10.0, 0.0);\nlet number = result.unwrap_or_default();\nprintln!("result: {}", number);\n// result: 0\n')),(0,i.kt)("h3",{id:"-method-unwrap_or"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"unwrap_or")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap_or")," milik ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," mengembalikan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," ketika data berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok<T>"),", namun jika data ternyata isinya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Err<E>")," maka yang dikembalikan adalah argument pemanggilan method tersebut."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10.0, 0.0);\nlet number = result.unwrap_or(0.0);\nprintln!("result: {}", number);\n// result: 0\n')),(0,i.kt)("h3",{id:"-method-unwrap_or_else"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"unwrap_or_else")),(0,i.kt)("p",null,"Method ini mengembalikan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," ketika data berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok<T>"),", namun jika data isinya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Err<E>")," maka yang dikembalikan adalah hasil eksekusi closure yang disisipkan saat memanggil method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap_or_else"),". Contoh pengaplikasiannya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10.0, 0.0);\nlet number = result.unwrap_or_else(|_| 0.0);\nprintln!("result: {}", number);\n// result: 0\n')),(0,i.kt)("p",null,"Closure harus dalam notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"FnOnce(E) -> T")," yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," pada konteks ini adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"f64"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai closure dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/closures"},"Closures"),".")),(0,i.kt)("h2",{id:"a404-operator--pada-tipe-result"},"A.40.4. Operator ",(0,i.kt)("inlineCode",{parentName:"h2"},"?")," pada tipe ",(0,i.kt)("inlineCode",{parentName:"h2"},"Result")),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," bisa digunakan pada operator ",(0,i.kt)("inlineCode",{parentName:"p"},"?"),". Penjelasannya ada di chapter terpisah di ",(0,i.kt)("a",{parentName:"p",href:"/basic/operator-tanda-tanya"},"Operator ?"),"."),(0,i.kt)("h2",{id:"a405-error-handling"},"A.40.5. Error handling"),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," banyak digunakan pada fungsi-fungsi yang disediakan Rust standard library, selain itu tipe tersebut juga akan sering kita gunakan dalam ",(0,i.kt)("em",{parentName:"p"},"real life")," project."),(0,i.kt)("p",null,"Tipe ini dimanfaatkan untuk error handling di Rust. Lebih jelasnya mengenai topik tersebut dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/recoverable-error-handling"},"Error \u279c Recoverable Error & Error Handling"),"."),(0,i.kt)("h2",{id:"a406-tipe-result-e"},"A.40.6. Tipe ",(0,i.kt)("inlineCode",{parentName:"h2"},"Result<(), E>")),(0,i.kt)("p",null,"Di atas kita telah mempelajari dan mempraktekan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider()")," yang fungsi tersebut mengembalikan 2 informasi, yaitu:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"T")," berisi nilai hasil pembagian"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"E")," berisi error saat operasi pembagian")),(0,i.kt)("p",null,"Bentuk lain penerapan tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," adalah dengan menggunakan notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," diisi tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"()"),". Tipe ini cukup sering digunakan pada fungsi yang memiliki potensi error tapi kita hanya butuh informasi errornya saja tanpa nilai balik lainnya."),(0,i.kt)("p",null,"Sebagai contoh, pada kode berikut dibuat fungsi baru bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"divide_and_print()"),". Dalam fungsi tersebut, operasi pembagian dilakukan. Jika sukses, nilainya langsung di-print; jika error, nilai errornya dikembalikan. Dari sini terlihat bahwa kita tidak membutuhkan fungsi tersebut untuk mengembalikan informasi selain error."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn divide_and_print(a: f64, b: f64) -> Result<(), MathError> {\n let res = divider(a, b);\n match res {\n Err(m) => {\n println!("ERROR! {:?}", m);\n Err(m)\n },\n Ok(n) => {\n println!("result: {}", n);\n Ok(())\n },\n }\n}\n\nfn main() {\n let result = divide_and_print(10.0, 1.0);\n}\n')),(0,i.kt)("p",null,"Pada pemanggilan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"Ok()")," gunakan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"()")," untuk memenuhi kriteria tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<(), MathError>"),"."),(0,i.kt)("h2",{id:"a407-tipe-resultt"},"A.40.7. Tipe ",(0,i.kt)("inlineCode",{parentName:"h2"},"Result<T>")),(0,i.kt)("p",null,"Notasi tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," bawaan Rust Standard Library adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, E>"),". Namun, pada pengembangan software yang melibatkan banyak sekali library/dependency, adakalanya pembaca akan menemui notasi tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T>"),". Notasi tersebut dibuat oleh pengembang library/dependency untuk memperingkas tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<T, SomeErrorType>"),". Jadi tidak usah bingung."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/result_type"},"github.com/novalagung/dasarpemrogramanrust-example/../result_type")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/generics"},"Generics")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/pattern-matching"},"Pattern Matching")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/closures"},"Closures")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/operator-tanda-tanya"},"Operator ?")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/recoverable-error-handling"},"Error \u279c Recoverable Error & Error Handling"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html"},"https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/result/index.html"},"https://doc.rust-lang.org/std/result/index.html"))))}k.isMDXComponent=!0},1463:(e,a,n)=>{n.d(a,{Z:()=>t});const t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mCC"}}]); \ No newline at end of file diff --git a/assets/js/7a2568c4.9b5d7c19.js b/assets/js/7a2568c4.9b5d7c19.js new file mode 100644 index 00000000..45eb6a9f --- /dev/null +++ b/assets/js/7a2568c4.9b5d7c19.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4197],{3905:(a,e,n)=>{n.d(e,{Zo:()=>m,kt:()=>p});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function u(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},r=Object.keys(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var d=t.createContext({}),o=function(a){var e=t.useContext(d),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},m=function(a){var e=o(a.components);return t.createElement(d.Provider,{value:e},a.children)},c={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},g=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,r=a.originalType,d=a.parentName,m=u(a,["components","mdxType","originalType","parentName"]),g=o(n),p=i,b=g["".concat(d,".").concat(p)]||g[p]||c[p]||r;return n?t.createElement(b,l(l({ref:e},m),{},{components:n})):t.createElement(b,l({ref:e},m))}));function p(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=n.length,l=new Array(r);l[0]=g;var u={};for(var d in e)hasOwnProperty.call(e,d)&&(u[d]=e[d]);u.originalType=a,u.mdxType="string"==typeof a?a:i,l[1]=u;for(var o=2;o<r;o++)l[o]=n[o];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}g.displayName="MDXCreateElement"},6425:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>d,contentTitle:()=>l,default:()=>c,frontMatter:()=>r,metadata:()=>u,toc:()=>o});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:2,title:"A.2. Build dan Run Program Rust",sidebar_label:"A.2. Build dan Run Program Rust",description:"Cara run program Rust menggunakan cargo. Pada chapter ini kita akan belajar lebih lanjut tentang command untuk proses build dan run dalam program Rust. Sebelumnya kita sudah belajar tentang cargo new dan cargo run, selain command tersebut ada juga command lain yaitu cargo build untuk proses kompilasi build kode program.",keywords:["rust","belajar rust","hello world","hello rust","run program rust","cargo"]},l=void 0,u={unversionedId:"basic/build-dan-run-program-rust",id:"basic/build-dan-run-program-rust",title:"A.2. Build dan Run Program Rust",description:"Cara run program Rust menggunakan cargo. Pada chapter ini kita akan belajar lebih lanjut tentang command untuk proses build dan run dalam program Rust. Sebelumnya kita sudah belajar tentang cargo new dan cargo run, selain command tersebut ada juga command lain yaitu cargo build untuk proses kompilasi build kode program.",source:"@site/docs/basic/build-dan-run-program-rust.md",sourceDirName:"basic",slug:"/basic/build-dan-run-program-rust",permalink:"/basic/build-dan-run-program-rust",draft:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,title:"A.2. Build dan Run Program Rust",sidebar_label:"A.2. Build dan Run Program Rust",description:"Cara run program Rust menggunakan cargo. Pada chapter ini kita akan belajar lebih lanjut tentang command untuk proses build dan run dalam program Rust. Sebelumnya kita sudah belajar tentang cargo new dan cargo run, selain command tersebut ada juga command lain yaitu cargo build untuk proses kompilasi build kode program.",keywords:["rust","belajar rust","hello world","hello rust","run program rust","cargo"]},sidebar:"tutorialSidebar",previous:{title:"A.1. Program Pertama \u279c Hello Rust",permalink:"/basic/hello-rust"},next:{title:"A.3. Komentar",permalink:"/basic/komentar"}},d={},o=[{value:"A.2.1. Command <code>cargo build</code>",id:"a21-command-cargo-build",level:2},{value:"A.2.2. Optimized build",id:"a22-optimized-build",level:2},{value:"A.2.3. Command <code>rustc</code>",id:"a23-command-rustc",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:o};function c(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,t.Z)({},m,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan belajar lebih lanjut tentang command untuk proses build dan run dalam program Rust. Sebelumnya kita sudah belajar tentang ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo new")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run"),", selain command tersebut ada juga command lain yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo build")," untuk proses kompilasi build kode program."),(0,i.kt)("h2",{id:"a21-command-cargo-build"},"A.2.1. Command ",(0,i.kt)("inlineCode",{parentName:"h2"},"cargo build")),(0,i.kt)("p",null,"Di atas sedikit disinggung bahwa command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo build")," berguna untuk mem-build kode program, dan command ini menghasilkan file binary. ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo build")," lebih sering digunakan saat proses build untuk distribution/deployment, yang umumnya binary hasil build kemudian distribusikan pengguna program."),(0,i.kt)("p",null,"Command tersebut juga bisa digunakan di lokal environment, silakan dicoba."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Untuk pengguna Windows:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"cargo build\ncd target/debug\nhello_rust.exe\n"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Untuk pengguna non-Windows:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"cargo build\ncd target/debug\n./hello_rust\n")))),(0,i.kt)("p",null,"Hasilnya:"),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Unoptimized build",src:n(1170).Z,width:"471",height:"118"})),(0,i.kt)("h2",{id:"a22-optimized-build"},"A.2.2. Optimized build"),(0,i.kt)("p",null,"Catatan tambahan saja, command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo build")," dan juga ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run")," menghasilkan file binary yang ",(0,i.kt)("em",{parentName:"p"},"unoptimized")," dan berisi beberapa informasi tambahan untuk proses debugging. Untuk distribution/production dianjurkan untuk generate ",(0,i.kt)("em",{parentName:"p"},"optimized")," binary. Caranya dengan cukup menambahkan flag ",(0,i.kt)("inlineCode",{parentName:"p"},"--release")," pada saat eksekusi command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo build"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"cargo build --release\n")),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Optimized build",src:n(1429).Z,width:"488",height:"121"})),(0,i.kt)("p",null,"Untuk release, file binary berada dalam path ",(0,i.kt)("inlineCode",{parentName:"p"},"target/release"),". File binary nya adalah optimized, size nya lebih kecil. Mungkin untuk program ",(0,i.kt)("inlineCode",{parentName:"p"},"hello world")," tidak akan signifikan bedanya, tapi untuk project real sangat dianjurkan untuk menggunakan optimized build."),(0,i.kt)("h2",{id:"a23-command-rustc"},"A.2.3. Command ",(0,i.kt)("inlineCode",{parentName:"h2"},"rustc")),(0,i.kt)("p",null,"Bagian ini merupakan tambahan informasi saja, bahwa selain command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo")," ada juga command ",(0,i.kt)("inlineCode",{parentName:"p"},"rustc")," yang bisa digunakan untuk kompilasi program."),(0,i.kt)("p",null,"Sebagai contoh, silakan buat file ",(0,i.kt)("inlineCode",{parentName:"p"},"hello.rs"),", lalu tulis kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="hello.rs"',title:'"hello.rs"'},'fn main() {\n println!("Hello, world!");\n}\n')),(0,i.kt)("p",null,"Kemudian ",(0,i.kt)("em",{parentName:"p"},"compile")," lalu jalankan file ",(0,i.kt)("em",{parentName:"p"},"executable"),"-nya, hasilnya adalah sama seperti eksekusi program menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"MacOS, Linux, Unix, WSL"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"rustc hello.rs\n./hello\n"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Windows"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"rustc hello.rs\n.\\hello.exe\n")))),(0,i.kt)("p",null,"Pada ebook ini kita akan menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo")," untuk manajemen dan juga eksekusi kode program Rust. Jadi tidak menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"rustc")," ya."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo build")," dalam proses kompilasinya meng-",(0,i.kt)("em",{parentName:"p"},"invoke")," command ",(0,i.kt)("inlineCode",{parentName:"p"},"rustc"))),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch01-03-hello-cargo.html"},"https://doc.rust-lang.org/book/ch01-03-hello-cargo.html"))))}c.isMDXComponent=!0},1170:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdcAAAB2CAIAAAAV0U5pAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeX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gcewoELOOBGCG0L3KE9SYiyOLOQBndwMyiNaLsv7762+q+2Tc+aOr57KAa9gBshdGoRd+wuXQzubIieDrmr1a/vKjVwvtO2mfBfBdwIoXMDt4qy4ojb8MJTCLmv7/Zs3cP7uuZ4IqVzPLgRQmj74E4mpg05bjeB4Weem1g+Q80K3Dc3d/tG++b7qDtKigzbtII7euvqrFVniwi5EUKbBnc4q6TFXJRAqRqKC3de7lyY2pHGZN2mIavzv+I2JXAru9Sv3QbxgBshtFFwzy7vdSJCCKFVg7uJeaE2QghtK+JGCCEEuBFCCHAjhBAC3AghhAA3QggBboQQQoAbIYQQ4EYIIcCNEEIIcCOEEALcCCEEuBFCCAFuhBBCgBshhAA3QgihVer/B9nCcnLs5PIAAAAASUVORK5CYII="}}]); \ No newline at end of file diff --git a/assets/js/7a2568c4.cb80d87b.js b/assets/js/7a2568c4.cb80d87b.js deleted file mode 100644 index 8a5ee45c..00000000 --- a/assets/js/7a2568c4.cb80d87b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4197],{3905:(a,e,n)=>{n.d(e,{Zo:()=>o,kt:()=>b});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function u(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},r=Object.keys(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var d=t.createContext({}),m=function(a){var e=t.useContext(d),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},o=function(a){var e=m(a.components);return t.createElement(d.Provider,{value:e},a.children)},c={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},p=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,r=a.originalType,d=a.parentName,o=u(a,["components","mdxType","originalType","parentName"]),p=m(n),b=i,g=p["".concat(d,".").concat(b)]||p[b]||c[b]||r;return n?t.createElement(g,l(l({ref:e},o),{},{components:n})):t.createElement(g,l({ref:e},o))}));function b(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=n.length,l=new Array(r);l[0]=p;var u={};for(var d in e)hasOwnProperty.call(e,d)&&(u[d]=e[d]);u.originalType=a,u.mdxType="string"==typeof a?a:i,l[1]=u;for(var m=2;m<r;m++)l[m]=n[m];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}p.displayName="MDXCreateElement"},6425:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>d,contentTitle:()=>l,default:()=>c,frontMatter:()=>r,metadata:()=>u,toc:()=>m});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:2,title:"A.2. Build dan Run Program Rust",sidebar_label:"A.2. Build dan Run Program Rust",description:"Cara run program Rust menggunakan cargo. Pada chapter ini kita akan belajar lebih lanjut tentang command untuk proses build dan run dalam program Rust. Sebelumnya kita sudah belajar tentang cargo new dan cargo run, selain command tersebut ada juga command lain yaitu cargo build untuk proses kompilasi build kode program.",keywords:["rust","belajar rust","hello world","hello rust","run program rust","cargo"]},l=void 0,u={unversionedId:"basic/build-dan-run-program-rust",id:"basic/build-dan-run-program-rust",title:"A.2. Build dan Run Program Rust",description:"Cara run program Rust menggunakan cargo. Pada chapter ini kita akan belajar lebih lanjut tentang command untuk proses build dan run dalam program Rust. Sebelumnya kita sudah belajar tentang cargo new dan cargo run, selain command tersebut ada juga command lain yaitu cargo build untuk proses kompilasi build kode program.",source:"@site/docs/basic/build-dan-run-program-rust.md",sourceDirName:"basic",slug:"/basic/build-dan-run-program-rust",permalink:"/basic/build-dan-run-program-rust",draft:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,title:"A.2. Build dan Run Program Rust",sidebar_label:"A.2. Build dan Run Program Rust",description:"Cara run program Rust menggunakan cargo. Pada chapter ini kita akan belajar lebih lanjut tentang command untuk proses build dan run dalam program Rust. Sebelumnya kita sudah belajar tentang cargo new dan cargo run, selain command tersebut ada juga command lain yaitu cargo build untuk proses kompilasi build kode program.",keywords:["rust","belajar rust","hello world","hello rust","run program rust","cargo"]},sidebar:"tutorialSidebar",previous:{title:"A.1. Program Pertama \u279c Hello Rust",permalink:"/basic/hello-rust"},next:{title:"A.3. Komentar",permalink:"/basic/komentar"}},d={},m=[{value:"A.2.1. Command <code>cargo build</code>",id:"a21-command-cargo-build",level:2},{value:"A.2.2. Optimized build",id:"a22-optimized-build",level:2},{value:"A.2.3. Command <code>rustc</code>",id:"a23-command-rustc",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Referensi",id:"-referensi",level:3}],o={toc:m};function c(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,t.Z)({},o,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan belajar lebih lanjut tentang command untuk proses build dan run dalam program Rust. Sebelumnya kita sudah belajar tentang ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo new")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run"),", selain command tersebut ada juga command lain yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo build")," untuk proses kompilasi build kode program."),(0,i.kt)("h2",{id:"a21-command-cargo-build"},"A.2.1. Command ",(0,i.kt)("inlineCode",{parentName:"h2"},"cargo build")),(0,i.kt)("p",null,"Di atas sedikit disinggung bahwa command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo build")," berguna untuk mem-build kode program, dan command ini menghasilkan file binary. ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo build")," lebih sering digunakan saat proses build untuk distribution/deployment, yang umumnya binary hasil build kemudian distribusikan pengguna program."),(0,i.kt)("p",null,"Command tersebut juga bisa digunakan di lokal environment, silakan dicoba."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Untuk pengguna Windows:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"cargo build\ncd target/debug\nhello_rust.exe\n"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Untuk pengguna non-Windows:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"cargo build\ncd target/debug\n./hello_rust\n")))),(0,i.kt)("p",null,"Hasilnya:"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Unoptimized build",src:n(1170).Z,width:"471",height:"118"})),(0,i.kt)("h2",{id:"a22-optimized-build"},"A.2.2. Optimized build"),(0,i.kt)("p",null,"Catatan tambahan saja, command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo build")," dan juga ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run")," menghasilkan file binary yang ",(0,i.kt)("em",{parentName:"p"},"unoptimized")," dan berisi beberapa informasi tambahan untuk proses debugging. Untuk distribution/production dianjurkan untuk generate ",(0,i.kt)("em",{parentName:"p"},"optimized")," binary. Caranya dengan cukup menambahkan flag ",(0,i.kt)("inlineCode",{parentName:"p"},"--release")," pada saat eksekusi command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo build"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"cargo build --release\n")),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Optimized build",src:n(1429).Z,width:"488",height:"121"})),(0,i.kt)("p",null,"Untuk release, file binary berada dalam path ",(0,i.kt)("inlineCode",{parentName:"p"},"target/release"),". File binary nya adalah optimized, size nya lebih kecil. Mungkin untuk program ",(0,i.kt)("inlineCode",{parentName:"p"},"hello world")," tidak akan signifikan bedanya, tapi untuk project real sangat dianjurkan untuk menggunakan optimized build."),(0,i.kt)("h2",{id:"a23-command-rustc"},"A.2.3. Command ",(0,i.kt)("inlineCode",{parentName:"h2"},"rustc")),(0,i.kt)("p",null,"Bagian ini merupakan tambahan informasi saja, bahwa selain command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo")," ada juga command ",(0,i.kt)("inlineCode",{parentName:"p"},"rustc")," yang bisa digunakan untuk kompilasi program."),(0,i.kt)("p",null,"Sebagai contoh, silakan buat file ",(0,i.kt)("inlineCode",{parentName:"p"},"hello.rs"),", lalu tulis kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="hello.rs"',title:'"hello.rs"'},'fn main() {\n println!("Hello, world!");\n}\n')),(0,i.kt)("p",null,"Kemudian ",(0,i.kt)("em",{parentName:"p"},"compile")," lalu jalankan file ",(0,i.kt)("em",{parentName:"p"},"executable"),"-nya, hasilnya adalah sama seperti eksekusi program menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"MacOS, Linux, Unix, WSL"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"rustc hello.rs\n./hello\n"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Windows"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"rustc hello.rs\n.\\hello.exe\n")))),(0,i.kt)("p",null,"Pada ebook ini kita akan menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo")," untuk manajemen dan juga eksekusi kode program Rust. Jadi tidak menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"rustc")," ya."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Command ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo build")," dalam proses kompilasinya meng-",(0,i.kt)("em",{parentName:"p"},"invoke")," command ",(0,i.kt)("inlineCode",{parentName:"p"},"rustc"))),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch01-03-hello-cargo.html"},"https://doc.rust-lang.org/book/ch01-03-hello-cargo.html"))))}c.isMDXComponent=!0},1170:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdcAAAB2CAIAAAAV0U5pAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5O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0VDSW9LxVFy482aVJCEox8t9vuLp4ta9l8jblCaBhOCWelTfFfq+13kYh93PQlpmenBjpLDDSIFu5p4yjrxKsEBAY4N7t/vu5z/+/uOX76bdLYwU0Mboj+kBWjW49/rwy//++59/T7hXH3/7+7ePHJwzI9+mjRQwPVhCTubE+nuZcwY3QgghwI0QQghwI4QQ4EYIIQS4EUIIAW6EEALcCCGEAHdOL766/OpfHByEECLiRgghwI0QQghwI4QQAtwIIQS4Mxrq+IqljldTgSe7S5k6+wghtGpwl9hNDZzLOKGsBt+AGyEEuAE3QgitFtyqCZMN3E4d40Io6u6Pwjabxv2+hvZrmtNV3r4cIYS2Bu7AfNQlqQHc7irFtiEicLVttizvjQR1HgcewoELOOBGCG0L3KE9SYiyOLOQBndwMyiNaLsv7762+q+2Tc+aOr57KAa9gBshdGoRd+wuXQzubIieDrmr1a/vKjVwvtO2mfBfBdwIoXMDt4qy4ojb8MJTCLmv7/Zs3cP7uuZ4IqVzPLgRQmj74E4mpg05bjeB4Weem1g+Q80K3Dc3d/tG++b7qDtKigzbtII7euvqrFVniwi5EUKbBnc4q6TFXJRAqRqKC3de7lyY2pHGZN2mIavzv+I2JXAru9Sv3QbxgBshtFFwzy7vdSJCCKFVg7uJeaE2QghtK+JGCCEEuBFCCHAjhBAC3AghhAA3QggBboQQQoAbIYQQ4EYIIcCNEEIIcCOEEALcCCEEuBFCCAFuhBBCgBshhAA3QgihVer/B9nCcnLs5PIAAAAASUVORK5CYII="}}]); \ No newline at end of file diff --git a/assets/js/82a9b669.9b40e2f4.js b/assets/js/82a9b669.9b40e2f4.js new file mode 100644 index 00000000..88c43bec --- /dev/null +++ b/assets/js/82a9b669.9b40e2f4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[3257],{3905:(e,a,t)=>{t.d(a,{Zo:()=>m,kt:()=>c});var n=t(7294);function i(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function r(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function l(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?r(Object(t),!0).forEach((function(a){i(e,a,t[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}))}return e}function d(e,a){if(null==e)return{};var t,n,i=function(e,a){if(null==e)return{};var t,n,i={},r=Object.keys(e);for(n=0;n<r.length;n++)t=r[n],a.indexOf(t)>=0||(i[t]=e[t]);return i}(e,a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)t=r[n],a.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var p=n.createContext({}),o=function(e){var a=n.useContext(p),t=a;return e&&(t="function"==typeof e?e(a):l(l({},a),e)),t},m=function(e){var a=o(e.components);return n.createElement(p.Provider,{value:a},e.children)},A={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},k=n.forwardRef((function(e,a){var t=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),k=o(t),c=i,u=k["".concat(p,".").concat(c)]||k[c]||A[c]||r;return t?n.createElement(u,l(l({ref:a},m),{},{components:t})):n.createElement(u,l({ref:a},m))}));function c(e,a){var t=arguments,i=a&&a.mdxType;if("string"==typeof e||i){var r=t.length,l=new Array(r);l[0]=k;var d={};for(var p in a)hasOwnProperty.call(a,p)&&(d[p]=a[p]);d.originalType=e,d.mdxType="string"==typeof e?e:i,l[1]=d;for(var o=2;o<r;o++)l[o]=t[o];return n.createElement.apply(null,l)}return n.createElement.apply(null,t)}k.displayName="MDXCreateElement"},1958:(e,a,t)=>{t.r(a),t.d(a,{assets:()=>p,contentTitle:()=>l,default:()=>A,frontMatter:()=>r,metadata:()=>d,toc:()=>o});var n=t(7462),i=(t(7294),t(3905));const r={sidebar_position:50,title:"A.50. Trait \u279c Iterator",sidebar_label:"A.50. Trait \u279c Iterator"},l=void 0,d={unversionedId:"basic/trait-iterator",id:"basic/trait-iterator",title:"A.50. Trait \u279c Iterator",description:"Iterator adalah salah satu trait dan tipe data custom penting pada Rust programming, gunanya untuk iterasi data. Di chapter ini kita akan mempelajarinya beserta beberapa module item lainnya yang masih relevan dengan topik Iterator.",source:"@site/docs/basic/trait-iterator.md",sourceDirName:"basic",slug:"/basic/trait-iterator",permalink:"/basic/trait-iterator",draft:!1,tags:[],version:"current",sidebarPosition:50,frontMatter:{sidebar_position:50,title:"A.50. Trait \u279c Iterator",sidebar_label:"A.50. Trait \u279c Iterator"},sidebar:"tutorialSidebar",previous:{title:"A.49. Trait \u279c Function (Fn, FnMut, FnOnce)",permalink:"/basic/trait-function"},next:{title:"A.51. Attributes",permalink:"/basic/attributes"}},p={},o=[{value:"A.50.1. <code>Iterator</code> & <code>IntoIterator</code>",id:"a501-iterator--intoiterator",level:2},{value:"\u25c9 Trait <code>Iterator</code> & <code>IntoIterator</code>",id:"-trait-iterator--intoiterator",level:3},{value:"\u25c9 Struct <code>Iterator</code>",id:"-struct-iterator",level:3},{value:"A.50.2. Pemanfaatan tipe data <code>Iterator</code>",id:"a502-pemanfaatan-tipe-data-iterator",level:2},{value:"\u25c9 Praktik ke-1",id:"-praktik-ke-1",level:3},{value:"\u25c9 Praktik ke-2",id:"-praktik-ke-2",level:3},{value:"A.50.3. Method tipe data <code>Iterator</code>",id:"a503-method-tipe-data-iterator",level:2},{value:"\u25c9 Method <code>iter</code>, <code>iter_mut</code>, <code>into_iter</code>",id:"-method-iter-iter_mut-into_iter",level:3},{value:"\u25c9 Method <code>collect</code>",id:"-method-collect",level:3},{value:"\u25c9 Method <code>map</code>",id:"-method-map",level:3},{value:"\u25c9 Method <code>rev</code>",id:"-method-rev",level:3},{value:"\u25c9 Method <code>filter</code>",id:"-method-filter",level:3},{value:"\u25c9 Method <code>cloned</code>",id:"-method-cloned",level:3},{value:"\u25c9 Method <code>copied</code>",id:"-method-copied",level:3},{value:"\u25c9 Method <code>cmp</code>",id:"-method-cmp",level:3},{value:"\u25c9 Method <code>count</code>",id:"-method-count",level:3},{value:"\u25c9 Method <code>eq</code>, <code>ne</code>, <code>gt</code>, <code>ge</code>, <code>lt</code>, <code>le</code>",id:"-method-eq-ne-gt-ge-lt-le",level:3},{value:"\u25c9 Method <code>find</code>",id:"-method-find",level:3},{value:"\u25c9 Method <code>last</code>",id:"-method-last",level:3},{value:"\u25c9 Method <code>fold</code>",id:"-method-fold",level:3},{value:"\u25c9 Method <code>inspect</code>",id:"-method-inspect",level:3},{value:"\u25c9 Method <code>sum</code>",id:"-method-sum",level:3},{value:"\u25c9 Method <code>reduce</code>",id:"-method-reduce",level:3},{value:"\u25c9 Method <code>min</code>, <code>max</code>",id:"-method-min-max",level:3},{value:"A.50.4. Method lainnya",id:"a504-method-lainnya",level:2},{value:"\u25c9 Method <code>sort</code> milik <code>Vec<T></code>",id:"-method-sort-milik-vect",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Work in progress",id:"-work-in-progress",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:o};function A(e){let{components:a,...r}=e;return(0,i.kt)("wrapper",(0,n.Z)({},m,r,{components:a,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Iterator adalah salah satu trait dan tipe data custom penting pada Rust programming, gunanya untuk iterasi data. Di chapter ini kita akan mempelajarinya beserta beberapa module item lainnya yang masih relevan dengan topik Iterator."),(0,i.kt)("h2",{id:"a501-iterator--intoiterator"},"A.50.1. ",(0,i.kt)("inlineCode",{parentName:"h2"},"Iterator")," & ",(0,i.kt)("inlineCode",{parentName:"h2"},"IntoIterator")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," adalah sebuah nama yang dipakai sebagai nama module item dalam ",(0,i.kt)("strong",{parentName:"p"},"Rust Standard Library")," maupun ",(0,i.kt)("strong",{parentName:"p"},"Rust Core Library"),", digunakan untuk iterasi data dan operasi lain yang berhubungan dengannya."),(0,i.kt)("p",null,"Iterator sendiri merupakan istilah untuk object atau trait yang bisa diiterasi, baik menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," ataupun menggunakan method iterator seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"for_each")," (yang juga akan kita bahas di sini)."),(0,i.kt)("h3",{id:"-trait-iterator--intoiterator"},"\u25c9 Trait ",(0,i.kt)("inlineCode",{parentName:"h3"},"Iterator")," & ",(0,i.kt)("inlineCode",{parentName:"h3"},"IntoIterator")),(0,i.kt)("p",null,"Dalam perulangan menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"for in"),", tipe data variabel yang digunakan harus memiliki trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator"),". Jika tidak, pasti error muncul."),(0,i.kt)("p",null,"Tipe data slice di Rust by default mengadopsi trait bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"IntoIterator"),", yang trait ini digunakan untuk konversi data bertipe slice ke bentuk iterator."),(0,i.kt)("p",null,"Dalam praktiknya, tidak perlu mengakses method tertentu untuk mendapatkan object iterator suatu data. Cukup gunakan variabel tipe data slice pada keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"for in"),", maka proses konversi ke bentuk iterator akan dilakukan oleh Rust secara otomatis dibalik layar."),(0,i.kt)("p",null,"Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'// array\nlet data_arr = ["a", "b", "c", "d"];\nfor e in &data_arr {\n print!("{e:?} ")\n}\n\nprintln!();\n\n// vector\nlet data_vec = vec!["a", "b", "c", "d"];\nfor e in &data_vec {\n print!("{e:?} ")\n}\n\nprintln!();\n\n// slice\nlet data_vec = vec!["a", "b", "c", "d"];\nlet data_slice_vec = &data_vec[..];\nfor e in data_slice_vec {\n print!("{e:?} ")\n}\n')),(0,i.kt)("p",null,"Dianjurkan untuk selalu menggunakan teknik ",(0,i.kt)("a",{parentName:"p",href:"/basic/borrowing"},"Borrowing")," dalam penggunaan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," pada tipe data yang karakteristiknya adalah ",(0,i.kt)("a",{parentName:"p",href:"/basic/ownership#a344-copy-semantics-vs-move-semantics"},"Move Semantics"),", hal ini karena dalam penerapan keyword tersebut, terjadi proses konversi tipe data dengan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"IntoIterator")," ke bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator"),"."),(0,i.kt)("p",null,"Jika data yang digunakan bukan data borrow, maka pasti owner berpindah."),(0,i.kt)("h3",{id:"-struct-iterator"},"\u25c9 Struct ",(0,i.kt)("inlineCode",{parentName:"h3"},"Iterator")),(0,i.kt)("p",null,"Selain trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator"),", ada juga tipe data struct bernama sama, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator"),". Perbedaan antara trait vs struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," adalah tipe struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," memiliki beberapa method untuk keperluan iterasi object. Jadi dengan memanfaatkan method-method tersebut, kita bisa melakukan iterasi data dan operasi sejenisnya tanpa menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"for in"),"."),(0,i.kt)("p",null,"Semua tipe data slice bisa dikonversi ke tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator"),", caranya dengan mengakses method ",(0,i.kt)("inlineCode",{parentName:"p"},"iter")," (atau method ",(0,i.kt)("inlineCode",{parentName:"p"},"chars")," khusus untuk tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),")."),(0,i.kt)("p",null,"Dari object iterator tersebut, perulangan bisa dilakukan via keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"for in"),", atau dengan memanfaatkan method bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"for_each"),". Perbedaannya pada iterasi menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"for_each"),", block perulangan dituliskan dalam bentuk closure."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'// array\nlet data_arr = ["a", "b", "c", "d"];\nlet iterator_arr = data_arr.iter();\niterator_arr.for_each(|e| {\n print!("{e:?} ")\n});\n\nprintln!();\n\n// vector\nlet data_vec = vec!["a", "b", "c", "d"];\ndata_vec.iter().for_each(|e| {\n print!("{e:?} ")\n});\n\nprintln!();\n\n// slice from vector\nlet data_vec = vec!["a", "b", "c", "d"];\nlet data_slice_vec = &data_vec[..];\ndata_slice_vec.iter().for_each(|e| {\n print!("{e:?} ")\n});\n\nprintln!();\n\n// slice from String\nlet data_str = "abcd".to_string();\nlet data_borrow_str = &data_str;\ndata_borrow_str.chars().for_each(|e| {\n print!("{e:?} ")\n});\n\nprintln!();\n')),(0,i.kt)("p",null,"Bisa dilihat pada contoh di atas, data slice diambil objek Iterator-nya menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"iter")," (atau ",(0,i.kt)("inlineCode",{parentName:"p"},"chars")," khusus untuk tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"), kemudian di-iterasi menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"for_each"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Trait iterator",src:t(3753).Z,width:"456",height:"149"})),(0,i.kt)("h2",{id:"a502-pemanfaatan-tipe-data-iterator"},"A.50.2. Pemanfaatan tipe data ",(0,i.kt)("inlineCode",{parentName:"h2"},"Iterator")),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," memiliki cukup banyak method untuk keperluan operasi data iterator, contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"for_each"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"map"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"filter"),", dan lainnya."),(0,i.kt)("h3",{id:"-praktik-ke-1"},"\u25c9 Praktik ke-1"),(0,i.kt)("p",null,"Sebagai contoh, kita akan buat sebuah program sederhana yang melakukan operasi kuadrat pada elemen tiap-tiap array."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_arr = [1, 3, 5];\n\nlet doubles: Vec<i32> = data_arr\n .iter()\n .map(|e| e * e)\n .collect();\n\nprintln!("{doubles:?}");\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Trait iterator",src:t(9339).Z,width:"447",height:"121"})),(0,i.kt)("p",null,"Penjelasan:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"data_arr")," yang bertipe data ",(0,i.kt)("inlineCode",{parentName:"li"},"[i32; 3]")," dikonversi ke tipe data ",(0,i.kt)("inlineCode",{parentName:"li"},"Iterator")," menggunakan method ",(0,i.kt)("inlineCode",{parentName:"li"},"iter"),"."),(0,i.kt)("li",{parentName:"ol"},"Object ",(0,i.kt)("inlineCode",{parentName:"li"},"Iterator")," kemudian di-iterasi menggunakan method ",(0,i.kt)("inlineCode",{parentName:"li"},"map")," dan nilai baliknya dijadikan ",(0,i.kt)("em",{parentName:"li"},"replacement")," data elemen tersebut."),(0,i.kt)("li",{parentName:"ol"},"Object ",(0,i.kt)("inlineCode",{parentName:"li"},"Iterator")," kemudian di-collect data-nya ke bentuk ",(0,i.kt)("inlineCode",{parentName:"li"},"Vec<i32>")," menggunakan method ",(0,i.kt)("inlineCode",{parentName:"li"},"collect"),".")),(0,i.kt)("h3",{id:"-praktik-ke-2"},"\u25c9 Praktik ke-2"),(0,i.kt)("p",null,"Contoh lain penerapan method iterator bisa dilihat pada kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec!["1", "2", "3", "4", "a"];\n\nlet numbers: Vec<i32> = data_vec\n .iter()\n .map(|e| -> i32 {\n match e.parse::<i32>() {\n Ok(n) => n,\n Err(_) => 0,\n }\n })\n .filter(|e| *e > 0 && *e % 2 == 0)\n .rev()\n .collect::<Vec<i32>>();\n\nprintln!("{numbers:?}");\n')),(0,i.kt)("p",null,"Program di atas melakukan beberapa hal:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Data ",(0,i.kt)("inlineCode",{parentName:"p"},"data_vec")," yang merupakan koleksi string di-konversi menjadi object ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"iter"),".")),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Kemudian method ",(0,i.kt)("inlineCode",{parentName:"p"},"map")," diakses. Setiap elemen ",(0,i.kt)("inlineCode",{parentName:"p"},"data_vec")," di-iterasi, kemudian dikonversi dari ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," ke ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),", lalu dijadikan ",(0,i.kt)("em",{parentName:"p"},"replacement")," data elemen tersebut. Jika proses konversi gagal, maka angka ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," digunakan sebagai data element tersebut."),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"Sampai sini, data yang sebelumnya ",(0,i.kt)("inlineCode",{parentName:"li"},'["1", "2", "3", "4", "a"]')," sekarang menjadi ",(0,i.kt)("inlineCode",{parentName:"li"},"[1, 2, 3, 4, 0]"),"."))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Selanjutnya, dilakukan proses filtering menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"filter")," dengan kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"*e > 0 && *e % 2 == 0")," yang kurang lebih artinya, jika nilai ",(0,i.kt)("em",{parentName:"p"},"dereference")," ",(0,i.kt)("inlineCode",{parentName:"p"},"e")," lebih besar dari ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," dan nilai tersebut adalah genap, maka filter bernilai ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),"."),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"Sampai sini, data yang sebelumnya ",(0,i.kt)("inlineCode",{parentName:"li"},"[1, 2, 3, 4, 0]")," sekarang menjadi ",(0,i.kt)("inlineCode",{parentName:"li"},"[2, 4]"),"."))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Kemudian, data kolektif tersebut dibalik urutan elemennya menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"rev"),"."),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"Sampai sini, data yang sebelumnya ",(0,i.kt)("inlineCode",{parentName:"li"},"[2, 4]")," sekarang menjadi ",(0,i.kt)("inlineCode",{parentName:"li"},"[4, 2]"),"."))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Terakhir data di-collect menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"collect")," dengan ditentukan tipe data masing-masing elemen adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<i32>"),"."))),(0,i.kt)("p",null,"Hasilnya ketika di run:"),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Trait iterator",src:t(6644).Z,width:"447",height:"118"})),(0,i.kt)("h2",{id:"a503-method-tipe-data-iterator"},"A.50.3. Method tipe data ",(0,i.kt)("inlineCode",{parentName:"h2"},"Iterator")),(0,i.kt)("h3",{id:"-method-iter-iter_mut-into_iter"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"iter"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"iter_mut"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"into_iter")),(0,i.kt)("p",null,"Ketiga method ini berguna untuk konversi data slice ke bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator"),", perbedannya:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"iter")," mengembalikan data ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," yang isinya adalah reference (",(0,i.kt)("inlineCode",{parentName:"p"},"&T"),") setiap element. Contoh penerapan:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\n\ndata_vec.iter().for_each(|d| {\n println!("{}", *d * 2)\n});\n\nfor d in &data_vec {\n println!("{}", *d * 2)\n}\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"iter_mut")," mengembalikan data ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," yang isinya adalah mutable reference (",(0,i.kt)("inlineCode",{parentName:"p"},"&mut T"),") setiap element. Contoh penerapan:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut data_vec = vec![1, 2, 3, 4];\n\ndata_vec.iter_mut().for_each(|d| {\n *d = *d * 2;\n});\nprintln!("{:?}", data_vec);\n\nfor d in &mut data_vec {\n *d = *d * 2;\n}\nprintln!("{:?}", data_vec);\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"into_iter")," mengkonversi data slice ke bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," (",(0,i.kt)("em",{parentName:"p"},"move semantics"),")."),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\n\ndata_vec.into_iter().for_each(|d| {\n println!("{}", d * 2)\n});\n\n// statement di bawah ini menghasilkan error,\n// karena ownership `data_vec` telah berpindah setelah method `into_iter` dipanggil\n\n// println!("{}", data_vec)\n')))),(0,i.kt)("h3",{id:"-method-collect"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"collect")),(0,i.kt)("p",null,"Method ini digunakan untuk ",(0,i.kt)("em",{parentName:"p"},"collecting")," data Iterator ke bentuk tertentu. Contoh penerapannya bisa dilihat pada kode berikut ini."),(0,i.kt)("p",null,"Data ",(0,i.kt)("inlineCode",{parentName:"p"},"data_vec")," yang merupakan vektor bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<i32>")," dikonversi ke bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," kemudian di-collect datanya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec: Vec<i32> = vec![1, 2, 3, 4];\n\nlet result: Vec<&i32> = data_vec.iter().collect();\nprintln!("{:?}", result);\n// [1, 2, 3, 4]\n')),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"iter")," menghasilkan object ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," yang menampung reference ",(0,i.kt)("inlineCode",{parentName:"p"},"&T")," setiap element slice. Hal ini membuat penerapan method ",(0,i.kt)("inlineCode",{parentName:"p"},"collect")," menghasilkan data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<&i32>")," (bukan ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<i32>"),")."),(0,i.kt)("h3",{id:"-method-map"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"map")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"map")," digunakan untuk mapping element setiap data iterator ke nilai baru."),(0,i.kt)("p",null,"Sebelumnya kita telah mempelajari method ",(0,i.kt)("inlineCode",{parentName:"p"},"iter")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"collect")," yang keduanya jika dikombinasikan dan digunakan pada tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<i32>")," hasilnya adalah data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<&i32>"),". Dengan memanfaatkan method ",(0,i.kt)("inlineCode",{parentName:"p"},"map"),", tipe data setiap element bisa di-mapping ke nilai baru dengan tipe data berbeda, misalnya menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<i32>"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec: Vec<i32> = vec![1, 2, 3, 4];\n\nlet result1: Vec<&i32> = data_vec.iter().collect();\nprintln!("{:?}", result1);\n// [1, 2, 3, 4]\n\nlet result2: Vec<i32> = data_vec\n .iter()\n .map(|d: &i32| -> i32 { *d })\n .collect();\nprintln!("{:?}", result2);\n// [1, 2, 3, 4]\n')),(0,i.kt)("p",null,"Contoh lainnya bisa dilihat pada ",(0,i.kt)("em",{parentName:"p"},"section")," ",(0,i.kt)("a",{parentName:"p",href:"/basic/trait-iterator#a482-pemanfaatan-tipe-data-iterator"},"A.50.2. Pemanfaatan tipe data ",(0,i.kt)("inlineCode",{parentName:"a"},"Iterator")),", di situ terdapat operasi mapping data slice numerik ke bentuk yang sama tapi nilai setiap element adalah kuadrat, dan ke bentuk lain dengan tipe data berbeda."),(0,i.kt)("h3",{id:"-method-rev"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"rev")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"rev")," kependekan dari ",(0,i.kt)("em",{parentName:"p"},"reverse"),", digunakan untuk membalikan urutan data slice."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\nprintln!("{:?}", data_vec);\n// [1, 2, 3, 4]\n\nlet result: Vec<&i32> = data_vec.iter().rev().collect();\nprintln!("{:?}", result);\n// [4, 3, 2, 1]\n')),(0,i.kt)("h3",{id:"-method-filter"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"filter")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"filter")," digunakan untuk memfilter element data slice. Data kolektif diiterasi kemudian dicek menggunakan closure, jika nilai balik bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," maka elemen tersebut masuk dalam dalam hasil filter, selebihnya maka dianggap tidak memenuhi kondisi filter dan elemen di-",(0,i.kt)("em",{parentName:"p"},"exclude"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\n\nlet odd: Vec<&i32> = data_vec.iter().filter(|d| *d % 2 != 0).collect();\nprintln!("odd numbers: {:?}", odd);\n// odd numbers: [1, 3]\n\nlet even: Vec<&i32> = data_vec.iter().filter(|d| *d % 2 == 0).collect();\nprintln!("even numbers: {:?}", even);\n// odd numbers: [2, 4]\n')),(0,i.kt)("h3",{id:"-method-cloned"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"cloned")),(0,i.kt)("p",null,"Digunakan untuk ",(0,i.kt)("em",{parentName:"p"},"cloning")," data slice secara keseluruhan tanpa mengubah tipe data. Hasilnya adalah data dengan skema sama persis (dalam bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator"),") tapi berbeda owner."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\nlet result: Vec<i32> = data_vec.iter().cloned().collect();\nprintln!("{:?}", result);\n// [1, 2, 3, 4]\n')),(0,i.kt)("h3",{id:"-method-copied"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"copied")),(0,i.kt)("p",null,"Secara ",(0,i.kt)("em",{parentName:"p"},"high-level")," ",(0,i.kt)("inlineCode",{parentName:"p"},"copied")," menghasilkan output yang sama dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"cloned"),". Namun jika dibahas dari sisi management memory-nya, ada perbedaan yang cukup besar."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\nlet result: Vec<i32> = data_vec.iter().copied().collect();\nprintln!("{:?}", result);\n// [1, 2, 3, 4]\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih detailnya mengenai clone vs copy akan dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/copy-clone-move-drop"},"Copy, Clone, Move, Drop"))),(0,i.kt)("h3",{id:"-method-cmp"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"cmp")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"cmp")," kependekan dari ",(0,i.kt)("em",{parentName:"p"},"compare"),", digunakan untuk membandingkan 2 buah data iterasi dengan nilai balik bertipe enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Ordering"),". Dari tipe data enum tersebut nantinya bisa dicek apakah 2 buah data slice tersebut sama (secara ",(0,i.kt)("em",{parentName:"p"},"Lexicographical"),")."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec1 = vec![1, 2, 3, 4];\nlet data_vec2 = vec![1, 2, 3, 4];\nlet result = data_vec1.iter().cmp(data_vec2.iter());\nprintln!("{:?}", result.is_eq());\n// true\n')),(0,i.kt)("p",null,"Enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Ordering")," memiliki beberapa method, salah satunya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"is_eq")," yang mengembalikan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," jika dua buah data slice tersebut adalah sama."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih detailnya mengenai ",(0,i.kt)("inlineCode",{parentName:"p"},"Ordering")," akan dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/enum-ordering"},"Enum Ordering"))),(0,i.kt)("h3",{id:"-method-count"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"count")),(0,i.kt)("p",null,"Digunakan untuk melihat size dari elemen Iterator."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\nlet length = data_vec.iter().count();\nprintln!("{:?}", length);\n// 4\n')),(0,i.kt)("h3",{id:"-method-eq-ne-gt-ge-lt-le"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"eq"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"ne"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"gt"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"ge"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"lt"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"le")),(0,i.kt)("p",null,"6 Method ini digunakan untuk komparasi dua buah slice. Penggunakan 6 method ini merupakan alternatif selain menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"cmp"),"."),(0,i.kt)("p",null,"Sebagai contoh, penerapan method ",(0,i.kt)("inlineCode",{parentName:"p"},"eq")," berikut untuk untuk mengecek apakah 2 buah data slice adalah sama (secara ",(0,i.kt)("em",{parentName:"p"},"Lexicographical"),")."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec1 = vec![1, 2, 3, 4];\nlet data_vec2 = vec![1, 2, 3, 4];\nlet result = data_vec1.iter().eq(data_vec2.iter());\nprintln!("{:?}", result);\n// true\n')),(0,i.kt)("p",null,"Kode di atas adalah ekuivalen dengan kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec1 = vec![1, 2, 3, 4];\nlet data_vec2 = vec![1, 2, 3, 4];\nlet result = data_vec1.iter().cmp(data_vec2.iter());\nprintln!("{:?}", result.is_eq());\n// true\n')),(0,i.kt)("p",null,"Berikut merupakan kegunaan tiap-tiap method di atas:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Method ",(0,i.kt)("inlineCode",{parentName:"li"},"eq")," digunakan untuk ",(0,i.kt)("em",{parentName:"li"},"equal lexicographical comparison")),(0,i.kt)("li",{parentName:"ul"},"Method ",(0,i.kt)("inlineCode",{parentName:"li"},"ne")," digunakan untuk ",(0,i.kt)("em",{parentName:"li"},"not equal lexicographical comparison")),(0,i.kt)("li",{parentName:"ul"},"Method ",(0,i.kt)("inlineCode",{parentName:"li"},"gt")," digunakan untuk ",(0,i.kt)("em",{parentName:"li"},"greater than lexicographical comparison")),(0,i.kt)("li",{parentName:"ul"},"Method ",(0,i.kt)("inlineCode",{parentName:"li"},"ge")," digunakan untuk ",(0,i.kt)("em",{parentName:"li"},"greater than or equal lexicographical comparison")),(0,i.kt)("li",{parentName:"ul"},"Method ",(0,i.kt)("inlineCode",{parentName:"li"},"lt")," digunakan untuk ",(0,i.kt)("em",{parentName:"li"},"lower than lexicographical comparison")),(0,i.kt)("li",{parentName:"ul"},"Method ",(0,i.kt)("inlineCode",{parentName:"li"},"le")," digunakan untuk ",(0,i.kt)("em",{parentName:"li"},"lower than or equal lexicographical comparison"))),(0,i.kt)("h3",{id:"-method-find"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"find")),(0,i.kt)("p",null,"Digunakan untuk mencari apakah suatu elemen ada atau tidak dengan kondisi pencarian dituliskan dalam bentuk closure. Nilai balik method ini bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Option"),"."),(0,i.kt)("p",null,"Sebagai contoh, perhatikan kode berikut. Method ",(0,i.kt)("inlineCode",{parentName:"p"},"find")," digunakan untuk mencari elemen yang nilainya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"4"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\nlet result = match data_vec.iter().find(|d: &&i32| **d == 4) {\n Some(d) => *d,\n None => 0\n};\nprintln!("{:?}", result);\n// 4\n')),(0,i.kt)("h3",{id:"-method-last"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"last")),(0,i.kt)("p",null,"Digunakan untuk mengambil elemen terakhir data Iterator. Method ",(0,i.kt)("inlineCode",{parentName:"p"},"last")," ini mengembalikan nilai balik bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Option"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\nlet result: &i32 = data_vec.iter().last().unwrap();\nprintln!("{:?}", result);\n// 4\n')),(0,i.kt)("p",null,"Satu hal yang unik perihal notasi closure method ",(0,i.kt)("inlineCode",{parentName:"p"},"find"),", parameter closure adalah bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&&T"),". Dari tipe tersebut, untuk mengambil ",(0,i.kt)("em",{parentName:"p"},"underlying value")," gunakan operator ",(0,i.kt)("em",{parentName:"p"},"dereference")," dua kali. Contohnya pada kode di atas, ",(0,i.kt)("inlineCode",{parentName:"p"},"d")," bertipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"&&i32"),", untuk mengambil nilai sebenarnya digunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"**d"),"."),(0,i.kt)("h3",{id:"-method-fold"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"fold")),(0,i.kt)("p",null,"Method ini digunakan untuk mengkonversi setiap element ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," menjadi sebuah akumulator yang direpresentasikan oleh 1 buah variabel."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"konsep ",(0,i.kt)("inlineCode",{parentName:"p"},"fold")," milik Rust mirip seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"reduce")," pada bahasa pemrograman lain")),(0,i.kt)("p",null,"Pada contoh berikut, kita coba terapkan method ",(0,i.kt)("inlineCode",{parentName:"p"},"fold")," untuk grouping data vector ",(0,i.kt)("inlineCode",{parentName:"p"},"data_vec")," menjadi 1 buah data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"NumberCategory"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Data numerik genap elemen ",(0,i.kt)("inlineCode",{parentName:"li"},"data_vec")," masuk ke property ",(0,i.kt)("inlineCode",{parentName:"li"},"even")," milik ",(0,i.kt)("inlineCode",{parentName:"li"},"NumberCategory"),"."),(0,i.kt)("li",{parentName:"ul"},"Data numerik ganjil elemen ",(0,i.kt)("inlineCode",{parentName:"li"},"data_vec")," masuk ke property ",(0,i.kt)("inlineCode",{parentName:"li"},"odd")," milik ",(0,i.kt)("inlineCode",{parentName:"li"},"NumberCategory"),".")),(0,i.kt)("p",null,"Dalam penerapannnya, parameter pertama method ",(0,i.kt)("inlineCode",{parentName:"p"},"fold")," diisi dengan ",(0,i.kt)("em",{parentName:"p"},"initial value"),", dan parameter ke-2 isinya closure untuk akumulasi data."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[derive(Debug)]\nstruct NumberCategory {\n even: Vec<i32>,\n odd: Vec<i32>,\n}\n\nlet data_vec = vec![1, 2, 3, 4];\n\nlet data_grouped = data_vec.iter().fold(\n NumberCategory{ even: Vec::new(), odd: Vec::new() }, \n |mut group, each| {\n if *each % 2 == 0 {\n group.even.push(*each)\n } else {\n group.odd.push(*each)\n }\n group\n }\n);\n\nprintln!("{:?}", data_grouped);\n')),(0,i.kt)("p",null,"Pada kode di atas, data ",(0,i.kt)("inlineCode",{parentName:"p"},"each")," di-cek nilainya, jika genap maka dimasukan dalam ",(0,i.kt)("inlineCode",{parentName:"p"},"group.even"),", dan sisanya masuk ",(0,i.kt)("inlineCode",{parentName:"p"},"group.odd"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Trait iterator",src:t(2986).Z,width:"454",height:"122"})),(0,i.kt)("h3",{id:"-method-inspect"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"inspect")),(0,i.kt)("p",null,"Biasanya digunakan sewaktu debugging, untuk inspeksi flow pemanggilan method-method milik Iterator. Contoh penerapannya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\n\nlet result = data_vec.iter()\n .cloned()\n .inspect(|x| println!("about to filter: {x}"))\n .filter(|x| x % 2 == 0)\n .inspect(|x| println!("made it through filter: {x}"))\n .fold(0, |sum, i| sum + i);\n\nprintln!("sum: {:?}", result);\n// sum: 10\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Trait iterator",src:t(4695).Z,width:"449",height:"222"})),(0,i.kt)("h3",{id:"-method-sum"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"sum")),(0,i.kt)("p",null,"Digunakan untuk mencari total/summary data slice numerik."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1.1, 2.2, 3.3, 4.5];\nlet result: f64 = data_vec.iter().sum();\nprintln!("sum: {:?}", result);\n// sum: 11.1\n')),(0,i.kt)("h3",{id:"-method-reduce"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"reduce")),(0,i.kt)("p",null,"Method ini digunakan untuk mengiterasi setiap element array dengan setiap iterasi menampilkan data element ke-",(0,i.kt)("inlineCode",{parentName:"p"},"n")," dan element ke-",(0,i.kt)("inlineCode",{parentName:"p"},"n+1"),"."),(0,i.kt)("p",null,"Contoh penerapan sederhananya pada pencarian angka numerik terbesar, yang kode-nya bisa dilihat berikut ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\n\nlet max_number = data_vec.iter().reduce(|left, right| {\n print!("left ({left}) vs right ({right})");\n\n if *left >= *right { \n println!(" -> left ({left}) is greater");\n left\n } else {\n println!(" -> right ({right}) is greater");\n right\n }\n});\n\nmatch max_number {\n Some(n) => println!("max_number: {:?}", n),\n None => println!("no data found"),\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Trait iterator",src:t(1611).Z,width:"449",height:"170"})),(0,i.kt)("h3",{id:"-method-min-max"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"min"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"max")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"min")," digunakan untuk mencari elemen terkecil pada Iterator, dan ",(0,i.kt)("inlineCode",{parentName:"p"},"max")," untuk mencari elemen terbesar. Keduanya mengembalikan nilai balik bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Option"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\n\nlet min = data_vec.iter().min().unwrap();\nprintln!("min: {min}");\n// min: 1\n\nlet max = data_vec.iter().max().unwrap();\nprintln!("max: {max}");\n// max: 4\n')),(0,i.kt)("h2",{id:"a504-method-lainnya"},"A.50.4. Method lainnya"),(0,i.kt)("h3",{id:"-method-sort-milik-vect"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"sort")," milik ",(0,i.kt)("inlineCode",{parentName:"h3"},"Vec<T>")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"sort")," bukanlah property Iterator, melainkan milik tipe data vector. Kegunaan method ini adalah untuk sorting urutan elemen vector."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut data_vec = vec![2, 3, 1, 4];\nprintln!("before: {data_vec:?}");\n// before: [2, 3, 1, 4]\n\ndata_vec.sort();\nprintln!("after: {data_vec:?}");\n// after: [1, 2, 3, 4]\n')),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/trait_iterator"},"github.com/novalagung/dasarpemrogramanrust-example/../trait_iterator")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/vector"},"Vector"))),(0,i.kt)("h3",{id:"-work-in-progress"},"\u25c9 Work in progress"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Desugar iterator")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/iter/index.html"},"https://doc.rust-lang.org/std/iter/index.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/iter/trait.Iterator.html"},"https://doc.rust-lang.org/std/iter/trait.Iterator.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://becomebetterprogrammer.com/rust-iter-vs-iter_mut-vs-into_iter/"},"https://becomebetterprogrammer.com/rust-iter-vs-iter_mut-vs-into_iter/")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://blog.thoughtram.io/iterators-in-rust/"},"https://blog.thoughtram.io/iterators-in-rust/")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://blog.logrocket.com/rust-iterators-closures-deep-dive/"},"https://blog.logrocket.com/rust-iterators-closures-deep-dive/"))))}A.isMDXComponent=!0},3753:(e,a,t)=>{t.d(a,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcgAAACVCAYAAADcxmp3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAByhSURBVHhe7Z3LrSS5sYZlyYwG8kBGyIeGgHFhLBAa0FYmHGAc6IVs6IV2vbkWnZt8B4MRwUcxs7Kq/8WH7kqSwWAwyL8yT2XmX3755ZdPAAAAANRAIAEAAAABCCQAAAAgAIEEAAAABCCQAAAAgAAEEgAAABCAQAIAAAACEEgAAABAAAIJAAAACEAgAQAAAAEIJAAAACAAgQQAAAAEIJAAAACAAAQSAAAAEIBAAgAAAAKPCeTXb58/vn98fvGfv3x+fP/x+e0rq3MqXz+//fj2+VUsew2+fvvx+f3ji1i2xvo87PJl/5iupx2Dy7UfJN/7rMXhjHUUbGq+zPj5DnMLzuPdcmldIL98fH7/8f3z40s69gyB/OXzy8f3qU0rb3SUb1/N8u6Y3BcF1mZ44l0cNf+rLyCjPDAPli8OP+fH+Do+nZ/49hzt6L+1MS+QVjydfeq/I/R3vUB2553wCpsaOB81D94slxYFUlpwzxFIx1ygw0ZX/Ax+B5HsbCQaXiDJmWwUkjE7RtyuFshOW/dl5PvH16MO/WLUcm7i9+doR/97xqDHU7f/yPxp9GI23ue5cwtehR35+wq5tCaQ4sadAkO/3dPLn6E8f2Ou2rMyq111thfxgjR6qZUL5EEUuGDH3vxFuECKx2JcJP81IdSOe7R4Ts6D5LfYZ7KbhJImNrdJE1/x0/Xz7SOWHTH/Gr5U6OONGHPkryakfijkyw+dd18/z4c+hspuM380zgfcfyWe/Q1Gmz+rP60s2Cz9pXrEbmfes82D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O2Mni3HszLA6LshgcztNbQfh7M6xx2T+jBnB75d+jBvD4geDBD57l8Pw/m9Q67J/NgXrdAbJukr9fQowUED2Zop6HbejBXsRw+kwdzdip+bx7MKwOCBzP0ykN7geUwATlOQPBgRkOPq6JYDhOQ7QOCBzMaulOwHCYgBwkIHsxoKAAAoKEAAGgoAAAaCgCAht7Ag1ltJB7MJwkIHszQPg/dyoMZy2G5qa4FEgFZGxA8mGE/GlrZgzn1yR17MA8l/xC8fe7Vg7l2QNBQaK+hm3gwFzrsntSD+aoisrnAPXowrwkIHsywjYZu4MG8xGH3jB7MrqkvHsyVAoIHM3TW0J4ezKscds/nwTwfK5Vyhx7MVQKCBzP01dDuHszaQtjdeTAHX1fJcZibu57Cg3l9QJTd8GCG1hraz4M53dHvyoM5sgIUlqPvyoO5VkDwYIbOc/l+HszJou/bg7nqeugZPJjrrYdaewgezGiodYlsMw/mKpbDZ/JgTlbuHj2YVwYED2bolYf2AsthAnKcgODBjIYeV0WxHCYg2wcED2Y0dKdgOUxADhIQPJjRUAAAQEMBANBQAAA0FAAADd0vvBgMAGjogTQ08vcFADQUDS053Q/eCAGABRp6eczu5ZqGfXfTsdA7NvBNSxpYjAYgnhev/CKgdHbRyvchqFLepNbisHErVPT3BQA01KShv65qdvv/RUtk79jJuCJtYid78SoaGp09mFpPpyo0qbVpaMrfFwDQUIuGehqS8cYZ/v2Sm2uL3hOKhkZnF91+G5nUpv19AQANXaqhines7aXhqho6+oS3MKnN+fsCABq6RENz3rHfc24PtfPQny8tTGqz/r4AgIYu11DBO3banPHMUTXUWeP8ZdNQbzm1xKTWek+pghgDABoa/F/wjvVFafir0PJ8KnRMZZMaKtg/l5nUoqEA0EFDAQAADQUAOJyGindluC8DAGgoAAAaCgAAaCgAABoKAICGAgCgoQAAgIYCAKChAABoKAAAGgoAgIYCAAAaCgCAhgIAoKEAAKfnf8MuIu6Tpsk4AAAAAElFTkSuQmCC"}}]); \ No newline at end of file diff --git a/assets/js/82a9b669.fc893c5a.js b/assets/js/82a9b669.fc893c5a.js deleted file mode 100644 index 73111f35..00000000 --- a/assets/js/82a9b669.fc893c5a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[3257],{3905:(e,a,t)=>{t.d(a,{Zo:()=>m,kt:()=>c});var n=t(7294);function i(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function r(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function l(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?r(Object(t),!0).forEach((function(a){i(e,a,t[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}))}return e}function d(e,a){if(null==e)return{};var t,n,i=function(e,a){if(null==e)return{};var t,n,i={},r=Object.keys(e);for(n=0;n<r.length;n++)t=r[n],a.indexOf(t)>=0||(i[t]=e[t]);return i}(e,a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)t=r[n],a.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var p=n.createContext({}),o=function(e){var a=n.useContext(p),t=a;return e&&(t="function"==typeof e?e(a):l(l({},a),e)),t},m=function(e){var a=o(e.components);return n.createElement(p.Provider,{value:a},e.children)},A={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},k=n.forwardRef((function(e,a){var t=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),k=o(t),c=i,u=k["".concat(p,".").concat(c)]||k[c]||A[c]||r;return t?n.createElement(u,l(l({ref:a},m),{},{components:t})):n.createElement(u,l({ref:a},m))}));function c(e,a){var t=arguments,i=a&&a.mdxType;if("string"==typeof e||i){var r=t.length,l=new Array(r);l[0]=k;var d={};for(var p in a)hasOwnProperty.call(a,p)&&(d[p]=a[p]);d.originalType=e,d.mdxType="string"==typeof e?e:i,l[1]=d;for(var o=2;o<r;o++)l[o]=t[o];return n.createElement.apply(null,l)}return n.createElement.apply(null,t)}k.displayName="MDXCreateElement"},1958:(e,a,t)=>{t.r(a),t.d(a,{assets:()=>p,contentTitle:()=>l,default:()=>A,frontMatter:()=>r,metadata:()=>d,toc:()=>o});var n=t(7462),i=(t(7294),t(3905));const r={sidebar_position:50,title:"A.50. Trait \u279c Iterator",sidebar_label:"A.50. Trait \u279c Iterator"},l=void 0,d={unversionedId:"basic/trait-iterator",id:"basic/trait-iterator",title:"A.50. Trait \u279c Iterator",description:"Iterator adalah salah satu trait dan tipe data custom penting pada Rust programming, gunanya untuk iterasi data. Di chapter ini kita akan mempelajarinya beserta beberapa module item lainnya yang masih relevan dengan topik Iterator.",source:"@site/docs/basic/trait-iterator.md",sourceDirName:"basic",slug:"/basic/trait-iterator",permalink:"/basic/trait-iterator",draft:!1,tags:[],version:"current",sidebarPosition:50,frontMatter:{sidebar_position:50,title:"A.50. Trait \u279c Iterator",sidebar_label:"A.50. Trait \u279c Iterator"},sidebar:"tutorialSidebar",previous:{title:"A.49. Trait \u279c Function (Fn, FnMut, FnOnce)",permalink:"/basic/trait-function"},next:{title:"A.51. Attributes",permalink:"/basic/attributes"}},p={},o=[{value:"A.50.1. <code>Iterator</code> & <code>IntoIterator</code>",id:"a501-iterator--intoiterator",level:2},{value:"\u25c9 Trait <code>Iterator</code> & <code>IntoIterator</code>",id:"-trait-iterator--intoiterator",level:3},{value:"\u25c9 Struct <code>Iterator</code>",id:"-struct-iterator",level:3},{value:"A.50.2. Pemanfaatan tipe data <code>Iterator</code>",id:"a502-pemanfaatan-tipe-data-iterator",level:2},{value:"\u25c9 Praktik ke-1",id:"-praktik-ke-1",level:3},{value:"\u25c9 Praktik ke-2",id:"-praktik-ke-2",level:3},{value:"A.50.3. Method tipe data <code>Iterator</code>",id:"a503-method-tipe-data-iterator",level:2},{value:"\u25c9 Method <code>iter</code>, <code>iter_mut</code>, <code>into_iter</code>",id:"-method-iter-iter_mut-into_iter",level:3},{value:"\u25c9 Method <code>collect</code>",id:"-method-collect",level:3},{value:"\u25c9 Method <code>map</code>",id:"-method-map",level:3},{value:"\u25c9 Method <code>rev</code>",id:"-method-rev",level:3},{value:"\u25c9 Method <code>filter</code>",id:"-method-filter",level:3},{value:"\u25c9 Method <code>cloned</code>",id:"-method-cloned",level:3},{value:"\u25c9 Method <code>copied</code>",id:"-method-copied",level:3},{value:"\u25c9 Method <code>cmp</code>",id:"-method-cmp",level:3},{value:"\u25c9 Method <code>count</code>",id:"-method-count",level:3},{value:"\u25c9 Method <code>eq</code>, <code>ne</code>, <code>gt</code>, <code>ge</code>, <code>lt</code>, <code>le</code>",id:"-method-eq-ne-gt-ge-lt-le",level:3},{value:"\u25c9 Method <code>find</code>",id:"-method-find",level:3},{value:"\u25c9 Method <code>last</code>",id:"-method-last",level:3},{value:"\u25c9 Method <code>fold</code>",id:"-method-fold",level:3},{value:"\u25c9 Method <code>inspect</code>",id:"-method-inspect",level:3},{value:"\u25c9 Method <code>sum</code>",id:"-method-sum",level:3},{value:"\u25c9 Method <code>reduce</code>",id:"-method-reduce",level:3},{value:"\u25c9 Method <code>min</code>, <code>max</code>",id:"-method-min-max",level:3},{value:"A.50.4. Method lainnya",id:"a504-method-lainnya",level:2},{value:"\u25c9 Method <code>sort</code> milik <code>Vec<T></code>",id:"-method-sort-milik-vect",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Work in progress",id:"-work-in-progress",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:o};function A(e){let{components:a,...r}=e;return(0,i.kt)("wrapper",(0,n.Z)({},m,r,{components:a,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Iterator adalah salah satu trait dan tipe data custom penting pada Rust programming, gunanya untuk iterasi data. Di chapter ini kita akan mempelajarinya beserta beberapa module item lainnya yang masih relevan dengan topik Iterator."),(0,i.kt)("h2",{id:"a501-iterator--intoiterator"},"A.50.1. ",(0,i.kt)("inlineCode",{parentName:"h2"},"Iterator")," & ",(0,i.kt)("inlineCode",{parentName:"h2"},"IntoIterator")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," adalah sebuah nama yang dipakai sebagai nama module item dalam ",(0,i.kt)("strong",{parentName:"p"},"Rust Standard Library")," maupun ",(0,i.kt)("strong",{parentName:"p"},"Rust Core Library"),", digunakan untuk iterasi data dan operasi lain yang berhubungan dengannya."),(0,i.kt)("p",null,"Iterator sendiri merupakan istilah untuk object atau trait yang bisa diiterasi, baik menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," ataupun menggunakan method iterator seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"for_each")," (yang juga akan kita bahas di sini)."),(0,i.kt)("h3",{id:"-trait-iterator--intoiterator"},"\u25c9 Trait ",(0,i.kt)("inlineCode",{parentName:"h3"},"Iterator")," & ",(0,i.kt)("inlineCode",{parentName:"h3"},"IntoIterator")),(0,i.kt)("p",null,"Dalam perulangan menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"for in"),", tipe data variabel yang digunakan harus memiliki trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator"),". Jika tidak, pasti error muncul."),(0,i.kt)("p",null,"Tipe data slice di Rust by default mengadopsi trait bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"IntoIterator"),", yang trait ini digunakan untuk konversi data bertipe slice ke bentuk iterator."),(0,i.kt)("p",null,"Dalam praktiknya, tidak perlu mengakses method tertentu untuk mendapatkan object iterator suatu data. Cukup gunakan variabel tipe data slice pada keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"for in"),", maka proses konversi ke bentuk iterator akan dilakukan oleh Rust secara otomatis dibalik layar."),(0,i.kt)("p",null,"Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'// array\nlet data_arr = ["a", "b", "c", "d"];\nfor e in &data_arr {\n print!("{e:?} ")\n}\n\nprintln!();\n\n// vector\nlet data_vec = vec!["a", "b", "c", "d"];\nfor e in &data_vec {\n print!("{e:?} ")\n}\n\nprintln!();\n\n// slice\nlet data_vec = vec!["a", "b", "c", "d"];\nlet data_slice_vec = &data_vec[..];\nfor e in data_slice_vec {\n print!("{e:?} ")\n}\n')),(0,i.kt)("p",null,"Dianjurkan untuk selalu menggunakan teknik ",(0,i.kt)("a",{parentName:"p",href:"/basic/borrowing"},"Borrowing")," dalam penggunaan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," pada tipe data yang karakteristiknya adalah ",(0,i.kt)("a",{parentName:"p",href:"/basic/ownership#a344-copy-semantics-vs-move-semantics"},"Move Semantics"),", hal ini karena dalam penerapan keyword tersebut, terjadi proses konversi tipe data dengan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"IntoIterator")," ke bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator"),"."),(0,i.kt)("p",null,"Jika data yang digunakan bukan data borrow, maka pasti owner berpindah."),(0,i.kt)("h3",{id:"-struct-iterator"},"\u25c9 Struct ",(0,i.kt)("inlineCode",{parentName:"h3"},"Iterator")),(0,i.kt)("p",null,"Selain trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator"),", ada juga tipe data struct bernama sama, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator"),". Perbedaan antara trait vs struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," adalah tipe struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," memiliki beberapa method untuk keperluan iterasi object. Jadi dengan memanfaatkan method-method tersebut, kita bisa melakukan iterasi data dan operasi sejenisnya tanpa menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"for in"),"."),(0,i.kt)("p",null,"Semua tipe data slice bisa dikonversi ke tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator"),", caranya dengan mengakses method ",(0,i.kt)("inlineCode",{parentName:"p"},"iter")," (atau method ",(0,i.kt)("inlineCode",{parentName:"p"},"chars")," khusus untuk tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),")."),(0,i.kt)("p",null,"Dari object iterator tersebut, perulangan bisa dilakukan via keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"for in"),", atau dengan memanfaatkan method bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"for_each"),". Perbedaannya pada iterasi menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"for_each"),", block perulangan dituliskan dalam bentuk closure."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'// array\nlet data_arr = ["a", "b", "c", "d"];\nlet iterator_arr = data_arr.iter();\niterator_arr.for_each(|e| {\n print!("{e:?} ")\n});\n\nprintln!();\n\n// vector\nlet data_vec = vec!["a", "b", "c", "d"];\ndata_vec.iter().for_each(|e| {\n print!("{e:?} ")\n});\n\nprintln!();\n\n// slice from vector\nlet data_vec = vec!["a", "b", "c", "d"];\nlet data_slice_vec = &data_vec[..];\ndata_slice_vec.iter().for_each(|e| {\n print!("{e:?} ")\n});\n\nprintln!();\n\n// slice from String\nlet data_str = "abcd".to_string();\nlet data_borrow_str = &data_str;\ndata_borrow_str.chars().for_each(|e| {\n print!("{e:?} ")\n});\n\nprintln!();\n')),(0,i.kt)("p",null,"Bisa dilihat pada contoh di atas, data slice diambil objek Iterator-nya menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"iter")," (atau ",(0,i.kt)("inlineCode",{parentName:"p"},"chars")," khusus untuk tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"), kemudian di-iterasi menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"for_each"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Trait iterator",src:t(3753).Z,width:"456",height:"149"})),(0,i.kt)("h2",{id:"a502-pemanfaatan-tipe-data-iterator"},"A.50.2. Pemanfaatan tipe data ",(0,i.kt)("inlineCode",{parentName:"h2"},"Iterator")),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," memiliki cukup banyak method untuk keperluan operasi data iterator, contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"for_each"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"map"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"filter"),", dan lainnya."),(0,i.kt)("h3",{id:"-praktik-ke-1"},"\u25c9 Praktik ke-1"),(0,i.kt)("p",null,"Sebagai contoh, kita akan buat sebuah program sederhana yang melakukan operasi kuadrat pada elemen tiap-tiap array."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_arr = [1, 3, 5];\n\nlet doubles: Vec<i32> = data_arr\n .iter()\n .map(|e| e * e)\n .collect();\n\nprintln!("{doubles:?}");\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Trait iterator",src:t(9339).Z,width:"447",height:"121"})),(0,i.kt)("p",null,"Penjelasan:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"data_arr")," yang bertipe data ",(0,i.kt)("inlineCode",{parentName:"li"},"[i32; 3]")," dikonversi ke tipe data ",(0,i.kt)("inlineCode",{parentName:"li"},"Iterator")," menggunakan method ",(0,i.kt)("inlineCode",{parentName:"li"},"iter"),"."),(0,i.kt)("li",{parentName:"ol"},"Object ",(0,i.kt)("inlineCode",{parentName:"li"},"Iterator")," kemudian di-iterasi menggunakan method ",(0,i.kt)("inlineCode",{parentName:"li"},"map")," dan nilai baliknya dijadikan ",(0,i.kt)("em",{parentName:"li"},"replacement")," data elemen tersebut."),(0,i.kt)("li",{parentName:"ol"},"Object ",(0,i.kt)("inlineCode",{parentName:"li"},"Iterator")," kemudian di-collect data-nya ke bentuk ",(0,i.kt)("inlineCode",{parentName:"li"},"Vec<i32>")," menggunakan method ",(0,i.kt)("inlineCode",{parentName:"li"},"collect"),".")),(0,i.kt)("h3",{id:"-praktik-ke-2"},"\u25c9 Praktik ke-2"),(0,i.kt)("p",null,"Contoh lain penerapan method iterator bisa dilihat pada kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec!["1", "2", "3", "4", "a"];\n\nlet numbers: Vec<i32> = data_vec\n .iter()\n .map(|e| -> i32 {\n match e.parse::<i32>() {\n Ok(n) => n,\n Err(_) => 0,\n }\n })\n .filter(|e| *e > 0 && *e % 2 == 0)\n .rev()\n .collect::<Vec<i32>>();\n\nprintln!("{numbers:?}");\n')),(0,i.kt)("p",null,"Program di atas melakukan beberapa hal:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Data ",(0,i.kt)("inlineCode",{parentName:"p"},"data_vec")," yang merupakan koleksi string di-konversi menjadi object ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"iter"),".")),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Kemudian method ",(0,i.kt)("inlineCode",{parentName:"p"},"map")," diakses. Setiap elemen ",(0,i.kt)("inlineCode",{parentName:"p"},"data_vec")," di-iterasi, kemudian dikonversi dari ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," ke ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),", lalu dijadikan ",(0,i.kt)("em",{parentName:"p"},"replacement")," data elemen tersebut. Jika proses konversi gagal, maka angka ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," digunakan sebagai data element tersebut."),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"Sampai sini, data yang sebelumnya ",(0,i.kt)("inlineCode",{parentName:"li"},'["1", "2", "3", "4", "a"]')," sekarang menjadi ",(0,i.kt)("inlineCode",{parentName:"li"},"[1, 2, 3, 4, 0]"),"."))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Selanjutnya, dilakukan proses filtering menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"filter")," dengan kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"*e > 0 && *e % 2 == 0")," yang kurang lebih artinya, jika nilai ",(0,i.kt)("em",{parentName:"p"},"dereference")," ",(0,i.kt)("inlineCode",{parentName:"p"},"e")," lebih besar dari ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," dan nilai tersebut adalah genap, maka filter bernilai ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),"."),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"Sampai sini, data yang sebelumnya ",(0,i.kt)("inlineCode",{parentName:"li"},"[1, 2, 3, 4, 0]")," sekarang menjadi ",(0,i.kt)("inlineCode",{parentName:"li"},"[2, 4]"),"."))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Kemudian, data kolektif tersebut dibalik urutan elemennya menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"rev"),"."),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"Sampai sini, data yang sebelumnya ",(0,i.kt)("inlineCode",{parentName:"li"},"[2, 4]")," sekarang menjadi ",(0,i.kt)("inlineCode",{parentName:"li"},"[4, 2]"),"."))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Terakhir data di-collect menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"collect")," dengan ditentukan tipe data masing-masing elemen adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<i32>"),"."))),(0,i.kt)("p",null,"Hasilnya ketika di run:"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Trait iterator",src:t(6644).Z,width:"447",height:"118"})),(0,i.kt)("h2",{id:"a503-method-tipe-data-iterator"},"A.50.3. Method tipe data ",(0,i.kt)("inlineCode",{parentName:"h2"},"Iterator")),(0,i.kt)("h3",{id:"-method-iter-iter_mut-into_iter"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"iter"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"iter_mut"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"into_iter")),(0,i.kt)("p",null,"Ketiga method ini berguna untuk konversi data slice ke bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator"),", perbedannya:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"iter")," mengembalikan data ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," yang isinya adalah reference (",(0,i.kt)("inlineCode",{parentName:"p"},"&T"),") setiap element. Contoh penerapan:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\n\ndata_vec.iter().for_each(|d| {\n println!("{}", *d * 2)\n});\n\nfor d in &data_vec {\n println!("{}", *d * 2)\n}\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"iter_mut")," mengembalikan data ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," yang isinya adalah mutable reference (",(0,i.kt)("inlineCode",{parentName:"p"},"&mut T"),") setiap element. Contoh penerapan:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut data_vec = vec![1, 2, 3, 4];\n\ndata_vec.iter_mut().for_each(|d| {\n *d = *d * 2;\n});\nprintln!("{:?}", data_vec);\n\nfor d in &mut data_vec {\n *d = *d * 2;\n}\nprintln!("{:?}", data_vec);\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"into_iter")," mengkonversi data slice ke bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," (",(0,i.kt)("em",{parentName:"p"},"move semantics"),")."),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\n\ndata_vec.into_iter().for_each(|d| {\n println!("{}", d * 2)\n});\n\n// statement di bawah ini menghasilkan error,\n// karena ownership `data_vec` telah berpindah setelah method `into_iter` dipanggil\n\n// println!("{}", data_vec)\n')))),(0,i.kt)("h3",{id:"-method-collect"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"collect")),(0,i.kt)("p",null,"Method ini digunakan untuk ",(0,i.kt)("em",{parentName:"p"},"collecting")," data Iterator ke bentuk tertentu. Contoh penerapannya bisa dilihat pada kode berikut ini."),(0,i.kt)("p",null,"Data ",(0,i.kt)("inlineCode",{parentName:"p"},"data_vec")," yang merupakan vektor bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<i32>")," dikonversi ke bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," kemudian di-collect datanya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec: Vec<i32> = vec![1, 2, 3, 4];\n\nlet result: Vec<&i32> = data_vec.iter().collect();\nprintln!("{:?}", result);\n// [1, 2, 3, 4]\n')),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"iter")," menghasilkan object ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," yang menampung reference ",(0,i.kt)("inlineCode",{parentName:"p"},"&T")," setiap element slice. Hal ini membuat penerapan method ",(0,i.kt)("inlineCode",{parentName:"p"},"collect")," menghasilkan data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<&i32>")," (bukan ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<i32>"),")."),(0,i.kt)("h3",{id:"-method-map"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"map")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"map")," digunakan untuk mapping element setiap data iterator ke nilai baru."),(0,i.kt)("p",null,"Sebelumnya kita telah mempelajari method ",(0,i.kt)("inlineCode",{parentName:"p"},"iter")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"collect")," yang keduanya jika dikombinasikan dan digunakan pada tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<i32>")," hasilnya adalah data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<&i32>"),". Dengan memanfaatkan method ",(0,i.kt)("inlineCode",{parentName:"p"},"map"),", tipe data setiap element bisa di-mapping ke nilai baru dengan tipe data berbeda, misalnya menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<i32>"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec: Vec<i32> = vec![1, 2, 3, 4];\n\nlet result1: Vec<&i32> = data_vec.iter().collect();\nprintln!("{:?}", result1);\n// [1, 2, 3, 4]\n\nlet result2: Vec<i32> = data_vec\n .iter()\n .map(|d: &i32| -> i32 { *d })\n .collect();\nprintln!("{:?}", result2);\n// [1, 2, 3, 4]\n')),(0,i.kt)("p",null,"Contoh lainnya bisa dilihat pada ",(0,i.kt)("em",{parentName:"p"},"section")," ",(0,i.kt)("a",{parentName:"p",href:"/basic/trait-iterator#a482-pemanfaatan-tipe-data-iterator"},"A.50.2. Pemanfaatan tipe data ",(0,i.kt)("inlineCode",{parentName:"a"},"Iterator")),", di situ terdapat operasi mapping data slice numerik ke bentuk yang sama tapi nilai setiap element adalah kuadrat, dan ke bentuk lain dengan tipe data berbeda."),(0,i.kt)("h3",{id:"-method-rev"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"rev")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"rev")," kependekan dari ",(0,i.kt)("em",{parentName:"p"},"reverse"),", digunakan untuk membalikan urutan data slice."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\nprintln!("{:?}", data_vec);\n// [1, 2, 3, 4]\n\nlet result: Vec<&i32> = data_vec.iter().rev().collect();\nprintln!("{:?}", result);\n// [4, 3, 2, 1]\n')),(0,i.kt)("h3",{id:"-method-filter"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"filter")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"filter")," digunakan untuk memfilter element data slice. Data kolektif diiterasi kemudian dicek menggunakan closure, jika nilai balik bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," maka elemen tersebut masuk dalam dalam hasil filter, selebihnya maka dianggap tidak memenuhi kondisi filter dan elemen di-",(0,i.kt)("em",{parentName:"p"},"exclude"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\n\nlet odd: Vec<&i32> = data_vec.iter().filter(|d| *d % 2 != 0).collect();\nprintln!("odd numbers: {:?}", odd);\n// odd numbers: [1, 3]\n\nlet even: Vec<&i32> = data_vec.iter().filter(|d| *d % 2 == 0).collect();\nprintln!("even numbers: {:?}", even);\n// odd numbers: [2, 4]\n')),(0,i.kt)("h3",{id:"-method-cloned"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"cloned")),(0,i.kt)("p",null,"Digunakan untuk ",(0,i.kt)("em",{parentName:"p"},"cloning")," data slice secara keseluruhan tanpa mengubah tipe data. Hasilnya adalah data dengan skema sama persis (dalam bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator"),") tapi berbeda owner."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\nlet result: Vec<i32> = data_vec.iter().cloned().collect();\nprintln!("{:?}", result);\n// [1, 2, 3, 4]\n')),(0,i.kt)("h3",{id:"-method-copied"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"copied")),(0,i.kt)("p",null,"Secara ",(0,i.kt)("em",{parentName:"p"},"high-level")," ",(0,i.kt)("inlineCode",{parentName:"p"},"copied")," menghasilkan output yang sama dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"cloned"),". Namun jika dibahas dari sisi management memory-nya, ada perbedaan yang cukup besar."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\nlet result: Vec<i32> = data_vec.iter().copied().collect();\nprintln!("{:?}", result);\n// [1, 2, 3, 4]\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih detailnya mengenai clone vs copy akan dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/copy-clone-move-drop"},"Copy, Clone, Move, Drop"))),(0,i.kt)("h3",{id:"-method-cmp"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"cmp")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"cmp")," kependekan dari ",(0,i.kt)("em",{parentName:"p"},"compare"),", digunakan untuk membandingkan 2 buah data iterasi dengan nilai balik bertipe enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Ordering"),". Dari tipe data enum tersebut nantinya bisa dicek apakah 2 buah data slice tersebut sama (secara ",(0,i.kt)("em",{parentName:"p"},"Lexicographical"),")."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec1 = vec![1, 2, 3, 4];\nlet data_vec2 = vec![1, 2, 3, 4];\nlet result = data_vec1.iter().cmp(data_vec2.iter());\nprintln!("{:?}", result.is_eq());\n// true\n')),(0,i.kt)("p",null,"Enum ",(0,i.kt)("inlineCode",{parentName:"p"},"Ordering")," memiliki beberapa method, salah satunya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"is_eq")," yang mengembalikan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," jika dua buah data slice tersebut adalah sama."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih detailnya mengenai ",(0,i.kt)("inlineCode",{parentName:"p"},"Ordering")," akan dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/enum-ordering"},"Enum Ordering"))),(0,i.kt)("h3",{id:"-method-count"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"count")),(0,i.kt)("p",null,"Digunakan untuk melihat size dari elemen Iterator."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\nlet length = data_vec.iter().count();\nprintln!("{:?}", length);\n// 4\n')),(0,i.kt)("h3",{id:"-method-eq-ne-gt-ge-lt-le"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"eq"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"ne"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"gt"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"ge"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"lt"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"le")),(0,i.kt)("p",null,"6 Method ini digunakan untuk komparasi dua buah slice. Penggunakan 6 method ini merupakan alternatif selain menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"cmp"),"."),(0,i.kt)("p",null,"Sebagai contoh, penerapan method ",(0,i.kt)("inlineCode",{parentName:"p"},"eq")," berikut untuk untuk mengecek apakah 2 buah data slice adalah sama (secara ",(0,i.kt)("em",{parentName:"p"},"Lexicographical"),")."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec1 = vec![1, 2, 3, 4];\nlet data_vec2 = vec![1, 2, 3, 4];\nlet result = data_vec1.iter().eq(data_vec2.iter());\nprintln!("{:?}", result);\n// true\n')),(0,i.kt)("p",null,"Kode di atas adalah ekuivalen dengan kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec1 = vec![1, 2, 3, 4];\nlet data_vec2 = vec![1, 2, 3, 4];\nlet result = data_vec1.iter().cmp(data_vec2.iter());\nprintln!("{:?}", result.is_eq());\n// true\n')),(0,i.kt)("p",null,"Berikut merupakan kegunaan tiap-tiap method di atas:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Method ",(0,i.kt)("inlineCode",{parentName:"li"},"eq")," digunakan untuk ",(0,i.kt)("em",{parentName:"li"},"equal lexicographical comparison")),(0,i.kt)("li",{parentName:"ul"},"Method ",(0,i.kt)("inlineCode",{parentName:"li"},"ne")," digunakan untuk ",(0,i.kt)("em",{parentName:"li"},"not equal lexicographical comparison")),(0,i.kt)("li",{parentName:"ul"},"Method ",(0,i.kt)("inlineCode",{parentName:"li"},"gt")," digunakan untuk ",(0,i.kt)("em",{parentName:"li"},"greater than lexicographical comparison")),(0,i.kt)("li",{parentName:"ul"},"Method ",(0,i.kt)("inlineCode",{parentName:"li"},"ge")," digunakan untuk ",(0,i.kt)("em",{parentName:"li"},"greater than or equal lexicographical comparison")),(0,i.kt)("li",{parentName:"ul"},"Method ",(0,i.kt)("inlineCode",{parentName:"li"},"lt")," digunakan untuk ",(0,i.kt)("em",{parentName:"li"},"lower than lexicographical comparison")),(0,i.kt)("li",{parentName:"ul"},"Method ",(0,i.kt)("inlineCode",{parentName:"li"},"le")," digunakan untuk ",(0,i.kt)("em",{parentName:"li"},"lower than or equal lexicographical comparison"))),(0,i.kt)("h3",{id:"-method-find"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"find")),(0,i.kt)("p",null,"Digunakan untuk mencari apakah suatu elemen ada atau tidak dengan kondisi pencarian dituliskan dalam bentuk closure. Nilai balik method ini bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Option"),"."),(0,i.kt)("p",null,"Sebagai contoh, perhatikan kode berikut. Method ",(0,i.kt)("inlineCode",{parentName:"p"},"find")," digunakan untuk mencari elemen yang nilainya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"4"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\nlet result = match data_vec.iter().find(|d: &&i32| **d == 4) {\n Some(d) => *d,\n None => 0\n};\nprintln!("{:?}", result);\n// 4\n')),(0,i.kt)("h3",{id:"-method-last"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"last")),(0,i.kt)("p",null,"Digunakan untuk mengambil elemen terakhir data Iterator. Method ",(0,i.kt)("inlineCode",{parentName:"p"},"last")," ini mengembalikan nilai balik bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Option"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\nlet result: &i32 = data_vec.iter().last().unwrap();\nprintln!("{:?}", result);\n// 4\n')),(0,i.kt)("p",null,"Satu hal yang unik perihal notasi closure method ",(0,i.kt)("inlineCode",{parentName:"p"},"find"),", parameter closure adalah bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&&T"),". Dari tipe tersebut, untuk mengambil ",(0,i.kt)("em",{parentName:"p"},"underlying value")," gunakan operator ",(0,i.kt)("em",{parentName:"p"},"dereference")," dua kali. Contohnya pada kode di atas, ",(0,i.kt)("inlineCode",{parentName:"p"},"d")," bertipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"&&i32"),", untuk mengambil nilai sebenarnya digunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"**d"),"."),(0,i.kt)("h3",{id:"-method-fold"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"fold")),(0,i.kt)("p",null,"Method ini digunakan untuk mengkonversi setiap element ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," menjadi sebuah akumulator yang direpresentasikan oleh 1 buah variabel."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"konsep ",(0,i.kt)("inlineCode",{parentName:"p"},"fold")," milik Rust mirip seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"reduce")," pada bahasa pemrograman lain")),(0,i.kt)("p",null,"Pada contoh berikut, kita coba terapkan method ",(0,i.kt)("inlineCode",{parentName:"p"},"fold")," untuk grouping data vector ",(0,i.kt)("inlineCode",{parentName:"p"},"data_vec")," menjadi 1 buah data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"NumberCategory"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Data numerik genap elemen ",(0,i.kt)("inlineCode",{parentName:"li"},"data_vec")," masuk ke property ",(0,i.kt)("inlineCode",{parentName:"li"},"even")," milik ",(0,i.kt)("inlineCode",{parentName:"li"},"NumberCategory"),"."),(0,i.kt)("li",{parentName:"ul"},"Data numerik ganjil elemen ",(0,i.kt)("inlineCode",{parentName:"li"},"data_vec")," masuk ke property ",(0,i.kt)("inlineCode",{parentName:"li"},"odd")," milik ",(0,i.kt)("inlineCode",{parentName:"li"},"NumberCategory"),".")),(0,i.kt)("p",null,"Dalam penerapannnya, parameter pertama method ",(0,i.kt)("inlineCode",{parentName:"p"},"fold")," diisi dengan ",(0,i.kt)("em",{parentName:"p"},"initial value"),", dan parameter ke-2 isinya closure untuk akumulasi data."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[derive(Debug)]\nstruct NumberCategory {\n even: Vec<i32>,\n odd: Vec<i32>,\n}\n\nlet data_vec = vec![1, 2, 3, 4];\n\nlet data_grouped = data_vec.iter().fold(\n NumberCategory{ even: Vec::new(), odd: Vec::new() }, \n |mut group, each| {\n if *each % 2 == 0 {\n group.even.push(*each)\n } else {\n group.odd.push(*each)\n }\n group\n }\n);\n\nprintln!("{:?}", data_grouped);\n')),(0,i.kt)("p",null,"Pada kode di atas, data ",(0,i.kt)("inlineCode",{parentName:"p"},"each")," di-cek nilainya, jika genap maka dimasukan dalam ",(0,i.kt)("inlineCode",{parentName:"p"},"group.even"),", dan sisanya masuk ",(0,i.kt)("inlineCode",{parentName:"p"},"group.odd"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Trait iterator",src:t(2986).Z,width:"454",height:"122"})),(0,i.kt)("h3",{id:"-method-inspect"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"inspect")),(0,i.kt)("p",null,"Biasanya digunakan sewaktu debugging, untuk inspeksi flow pemanggilan method-method milik Iterator. Contoh penerapannya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\n\nlet result = data_vec.iter()\n .cloned()\n .inspect(|x| println!("about to filter: {x}"))\n .filter(|x| x % 2 == 0)\n .inspect(|x| println!("made it through filter: {x}"))\n .fold(0, |sum, i| sum + i);\n\nprintln!("sum: {:?}", result);\n// sum: 10\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Trait iterator",src:t(4695).Z,width:"449",height:"222"})),(0,i.kt)("h3",{id:"-method-sum"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"sum")),(0,i.kt)("p",null,"Digunakan untuk mencari total/summary data slice numerik."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1.1, 2.2, 3.3, 4.5];\nlet result: f64 = data_vec.iter().sum();\nprintln!("sum: {:?}", result);\n// sum: 11.1\n')),(0,i.kt)("h3",{id:"-method-reduce"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"reduce")),(0,i.kt)("p",null,"Method ini digunakan untuk mengiterasi setiap element array dengan setiap iterasi menampilkan data element ke-",(0,i.kt)("inlineCode",{parentName:"p"},"n")," dan element ke-",(0,i.kt)("inlineCode",{parentName:"p"},"n+1"),"."),(0,i.kt)("p",null,"Contoh penerapan sederhananya pada pencarian angka numerik terbesar, yang kode-nya bisa dilihat berikut ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\n\nlet max_number = data_vec.iter().reduce(|left, right| {\n print!("left ({left}) vs right ({right})");\n\n if *left >= *right { \n println!(" -> left ({left}) is greater");\n left\n } else {\n println!(" -> right ({right}) is greater");\n right\n }\n});\n\nmatch max_number {\n Some(n) => println!("max_number: {:?}", n),\n None => println!("no data found"),\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Trait iterator",src:t(1611).Z,width:"449",height:"170"})),(0,i.kt)("h3",{id:"-method-min-max"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"min"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"max")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"min")," digunakan untuk mencari elemen terkecil pada Iterator, dan ",(0,i.kt)("inlineCode",{parentName:"p"},"max")," untuk mencari elemen terbesar. Keduanya mengembalikan nilai balik bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Option"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_vec = vec![1, 2, 3, 4];\n\nlet min = data_vec.iter().min().unwrap();\nprintln!("min: {min}");\n// min: 1\n\nlet max = data_vec.iter().max().unwrap();\nprintln!("max: {max}");\n// max: 4\n')),(0,i.kt)("h2",{id:"a504-method-lainnya"},"A.50.4. Method lainnya"),(0,i.kt)("h3",{id:"-method-sort-milik-vect"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"sort")," milik ",(0,i.kt)("inlineCode",{parentName:"h3"},"Vec<T>")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"sort")," bukanlah property Iterator, melainkan milik tipe data vector. Kegunaan method ini adalah untuk sorting urutan elemen vector."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut data_vec = vec![2, 3, 1, 4];\nprintln!("before: {data_vec:?}");\n// before: [2, 3, 1, 4]\n\ndata_vec.sort();\nprintln!("after: {data_vec:?}");\n// after: [1, 2, 3, 4]\n')),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/trait_iterator"},"github.com/novalagung/dasarpemrogramanrust-example/../trait_iterator")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/vector"},"Vector"))),(0,i.kt)("h3",{id:"-work-in-progress"},"\u25c9 Work in progress"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Desugar iterator")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/iter/index.html"},"https://doc.rust-lang.org/std/iter/index.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/iter/trait.Iterator.html"},"https://doc.rust-lang.org/std/iter/trait.Iterator.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://becomebetterprogrammer.com/rust-iter-vs-iter_mut-vs-into_iter/"},"https://becomebetterprogrammer.com/rust-iter-vs-iter_mut-vs-into_iter/")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://blog.thoughtram.io/iterators-in-rust/"},"https://blog.thoughtram.io/iterators-in-rust/")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://blog.logrocket.com/rust-iterators-closures-deep-dive/"},"https://blog.logrocket.com/rust-iterators-closures-deep-dive/"))))}A.isMDXComponent=!0},3753:(e,a,t)=>{t.d(a,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcgAAACVCAYAAADcxmp3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAByhSURBVHhe7Z3LrSS5sYZlyYwG8kBGyIeGgHFhLBAa0FYmHGAc6IVs6IV2vbkWnZt8B4MRwUcxs7Kq/8WH7kqSwWAwyL8yT2XmX3755ZdPAAAAANRAIAEAAAABCCQAAAAgAIEEAAAABCCQAAAAgAAEEgAAABCAQAIAAAACEEgAAABAAAIJAAAACEAgAQAAAAEIJAAAACAAgQQAAAAEIJAAAACAAAQSAAAAEIBAAgAAAAKPCeTXb58/vn98fvGfv3x+fP/x+e0rq3MqXz+//fj2+VUsew2+fvvx+f3ji1i2xvo87PJl/5iupx2Dy7UfJN/7rMXhjHUUbGq+zPj5DnMLzuPdcmldIL98fH7/8f3z40s69gyB/OXzy8f3qU0rb3SUb1/N8u6Y3BcF1mZ44l0cNf+rLyCjPDAPli8OP+fH+Do+nZ/49hzt6L+1MS+QVjydfeq/I/R3vUB2553wCpsaOB81D94slxYFUlpwzxFIx1ygw0ZX/Ax+B5HsbCQaXiDJmWwUkjE7RtyuFshOW/dl5PvH16MO/WLUcm7i9+doR/97xqDHU7f/yPxp9GI23ue5cwtehR35+wq5tCaQ4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ZZMaKtg/l5nUoqEA0EFDAQAADQUAOJyGindluC8DAGgoAAAaCgAAaCgAABoKAICGAgCgoQAAgIYCAKChAABoKAAAGgoAgIYCAAAaCgCAhgIAoKEAAKfnf8MuIu6Tpsk4AAAAAElFTkSuQmCC"}}]); \ No newline at end of file diff --git a/assets/js/8333c691.c1d9f65e.js b/assets/js/8333c691.c1d9f65e.js new file mode 100644 index 00000000..142a8eb8 --- /dev/null +++ b/assets/js/8333c691.c1d9f65e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4248],{3905:(a,e,n)=>{n.d(e,{Zo:()=>m,kt:()=>u});var i=n(7294);function t(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,i)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){t(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function p(a,e){if(null==a)return{};var n,i,t=function(a,e){if(null==a)return{};var n,i,t={},r=Object.keys(a);for(i=0;i<r.length;i++)n=r[i],e.indexOf(n)>=0||(t[n]=a[n]);return t}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(i=0;i<r.length;i++)n=r[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(t[n]=a[n])}return t}var s=i.createContext({}),d=function(a){var e=i.useContext(s),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},m=function(a){var e=d(a.components);return i.createElement(s.Provider,{value:e},a.children)},o={inlineCode:"code",wrapper:function(a){var e=a.children;return i.createElement(i.Fragment,{},e)}},k=i.forwardRef((function(a,e){var n=a.components,t=a.mdxType,r=a.originalType,s=a.parentName,m=p(a,["components","mdxType","originalType","parentName"]),k=d(n),u=t,g=k["".concat(s,".").concat(u)]||k[u]||o[u]||r;return n?i.createElement(g,l(l({ref:e},m),{},{components:n})):i.createElement(g,l({ref:e},m))}));function u(a,e){var n=arguments,t=e&&e.mdxType;if("string"==typeof a||t){var r=n.length,l=new Array(r);l[0]=k;var p={};for(var s in e)hasOwnProperty.call(e,s)&&(p[s]=e[s]);p.originalType=a,p.mdxType="string"==typeof a?a:t,l[1]=p;for(var d=2;d<r;d++)l[d]=n[d];return i.createElement.apply(null,l)}return i.createElement.apply(null,n)}k.displayName="MDXCreateElement"},9739:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>s,contentTitle:()=>l,default:()=>o,frontMatter:()=>r,metadata:()=>p,toc:()=>d});var i=n(7462),t=(n(7294),n(3905));const r={sidebar_position:34,title:"A.34. Ownership",sidebar_label:"A.34. Ownership"},l=void 0,p={unversionedId:"basic/ownership",id:"basic/ownership",title:"A.34. Ownership",description:"Chapter ini berisi pembahasan tentang ownership, bagaimana Rust melakukan manajemen memory dengan menerapkan approach ownership ini.",source:"@site/docs/basic/ownership.md",sourceDirName:"basic",slug:"/basic/ownership",permalink:"/basic/ownership",draft:!1,tags:[],version:"current",sidebarPosition:34,frontMatter:{sidebar_position:34,title:"A.34. Ownership",sidebar_label:"A.34. Ownership"},sidebar:"tutorialSidebar",previous:{title:"A.33. Pointer & References",permalink:"/basic/pointer-references"},next:{title:"A.35. Borrowing",permalink:"/basic/borrowing"}},s={},d=[{value:"A.34.1. Konsep ownership",id:"a341-konsep-ownership",level:2},{value:"A.34.2. Aturan ownership",id:"a342-aturan-ownership",level:2},{value:"A.34.3. Variable scope",id:"a343-variable-scope",level:2},{value:"A.34.4. Copy semantics vs. move semantics",id:"a344-copy-semantics-vs-move-semantics",level:2},{value:"A.34.5. Alokasi & dealokasi",id:"a345-alokasi--dealokasi",level:2},{value:"A.34.6. Transfer ownership",id:"a346-transfer-ownership",level:2},{value:"\u25c9 Transfer ownership via return value",id:"-transfer-ownership-via-return-value",level:3},{value:"\u25c9 Transfer ownership via parameter/argument",id:"-transfer-ownership-via-parameterargument",level:3},{value:"A.34.7. Clone data",id:"a347-clone-data",level:2},{value:"A.34.8. Ownership pada data literal",id:"a348-ownership-pada-data-literal",level:2},{value:"A.34.9. <em>Move semantics</em> pada macro <code>println</code>",id:"a349-move-semantics-pada-macro-println",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:d};function o(a){let{components:e,...r}=a;return(0,t.kt)("wrapper",(0,i.Z)({},m,r,{components:e,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Chapter ini berisi pembahasan tentang ownership, bagaimana Rust melakukan manajemen memory dengan menerapkan approach ownership ini."),(0,t.kt)("p",null,"O iya, diwajibkan untuk mempelajari terlebih dahulu tentang dasar ",(0,t.kt)("a",{parentName:"p",href:"/basic/basic-memory-management"},"Memory Management")," dan juga ",(0,t.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"),", yang keduanya adalah dibahas pada chapter sebelumnya. Jika pembaca mempelajari ebook ini secara urut maka tidak usah khawatir."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Pembahasan pada chapter ini adalah salah satu hal yang paling penting untuk dipahami dalam Rust programming, karena topik yang berhubungan dengan memory management adalah hal yang krusial pada system programming."),(0,t.kt)("p",{parentName:"blockquote"},"Silakan ulang-ulang chapter ini jika diperlukan.")),(0,t.kt)("h2",{id:"a341-konsep-ownership"},"A.34.1. Konsep ownership"),(0,t.kt)("p",null,"Ownership merupakan kumpulan aturan yang ada di Rust yang dijadikan acuan oleh compiler dalam pengelolahan memory."),(0,t.kt)("p",null,"Sudah disinggung pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/basic-memory-management"},"Memory Management")," bahwa Rust tidak menerapkan GC ataupun ARC dalam manajemen memory-nya. Rust membebankan manajemen memory pada penulis kode program, yaitu kita/programmer."),(0,t.kt)("p",null,"Aturan ownership ada banyak, dan programmer harus mengikutinya, karena jika tidak, maka proses kompilasi program dan eksekusi program akan gagal dan hasilnya error."),(0,t.kt)("h2",{id:"a342-aturan-ownership"},"A.34.2. Aturan ownership"),(0,t.kt)("p",null,"Ada 3 aturan penting yang wajib diketahui:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},(0,t.kt)("strong",{parentName:"p"},"Semua nilai/data/value di Rust memiliki owner"),". Misal kita berbicara tentang deklarasi variabel dengan predefined value, maka value variabel adalah yang dimaksud dengan nilai/data/value, dan variabel itu sendiri adalah owner dari nilai/data/value tersebut.")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Pada waktu yang sama, ",(0,t.kt)("strong",{parentName:"p"},"hanya boleh ada 1 owner"),". Satu data, ownernya hanya satu.")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},(0,t.kt)("strong",{parentName:"p"},"Ketika eksekusi sebuah block scope selesai, maka owner dari data-data yang ada dalam scope tersebut akan di-drop atau di-dealokasi")," (dengan pengecualian yaitu owner berpindah ke luar scope)."))),(0,t.kt)("h2",{id:"a343-variable-scope"},"A.34.3. Variable scope"),(0,t.kt)("p",null,"Sebelum kita masuk ke pembahasan yang lebih detail mengenai ownership, mari pelajari terlebih dahulu tentang apa itu variable scope."),(0,t.kt)("p",null,"Variable scope maksudnya adalah di block scope mana suatu variabel dideklarasikan, dan dalam block scope tersebut variabel menjadi valid (bisa digunakan). Di luar scope-nya variabel menjadi tidak valid, tidak bisa digunakan."),(0,t.kt)("p",null,"Agar lebih jelas, silakan perhatikan kode berikut, tidak perlu dipraktikkan."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn do_something() {\n let data_one = "one";\n // ...\n}\n\nfn main() {\n let data_two = "two";\n // ...\n\n {\n let data_three = "three";\n // ...\n }\n\n do_something();\n\n if true {\n let data_four = "four";\n // ...\n }\n}\n')),(0,t.kt)("p",null,"Program di atas memiliki 4 buah block kode:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Block fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),", yang isinya adalah variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"data_two")," dan beberapa sub-block dan 1 buah pemanggilan fungsi. Di dalam block fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),", variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"data_two")," adalah valid, dan bisa digunakan dalam fungsi scope tersebut beserta sub-block lainnya (block expression dan block kode ",(0,t.kt)("inlineCode",{parentName:"p"},"if"),").")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Block expression yang berisi variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"data_three"),". Pada block scope ini, variabel tersebut dan juga variable ",(0,t.kt)("inlineCode",{parentName:"p"},"data_two")," adalah valid.")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Block fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something"),", yang isinya variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"data_one"),". Variabel tersebut hanya akan valid dalam block fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something"),".")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Block seleksi kondisi ",(0,t.kt)("inlineCode",{parentName:"p"},"if"),". Variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"data_four")," berada dalam block ini, maka variabel tersebut adalah valid dalam block tersebut. Selain itu ",(0,t.kt)("inlineCode",{parentName:"p"},"data_two")," juga valid dalam block seleksi kondisi ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," ini."))),(0,t.kt)("p",null,"Intinya, variabel adalah valid ketika berada di dalam scope-nya (istilahnya ",(0,t.kt)("em",{parentName:"p"},"into scope"),"), dan variabel menjadi tidak valid atau invalid ketika keluar dari scope (istilahnya ",(0,t.kt)("em",{parentName:"p"},"out of scope"),")."),(0,t.kt)("h2",{id:"a344-copy-semantics-vs-move-semantics"},"A.34.4. Copy semantics vs. move semantics"),(0,t.kt)("p",null,"Di atas sudah dijelaskan mengenai aturan ownership, yang salah satunya adalah setiap data yang ada di Rust memiliki owner, dan 1 data owner pasti 1 (tidak lebih)."),(0,t.kt)("p",null,"Agar lebih jelas mari kita perhatikan contoh berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let x = 24;\nlet y = x;\nprintln!("x: {:?}, y: {:?}", x, y);\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Ownership",src:n(1146).Z,width:"333",height:"110"})),(0,t.kt)("p",null,"Variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," dideklarasikan dengan nilai ",(0,t.kt)("inlineCode",{parentName:"p"},"24"),", artinya variabel tersebut adalah owner dari data ",(0,t.kt)("inlineCode",{parentName:"p"},"24"),". Kemudian variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," dijadikan sebagai nilai variabel baru bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"y"),", dari sini apakah berarti owner data ",(0,t.kt)("inlineCode",{parentName:"p"},"24")," adalah berpindah dari variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," ke ",(0,t.kt)("inlineCode",{parentName:"p"},"y"),"? jawabannya adalah ",(0,t.kt)("strong",{parentName:"p"},"tidak"),"."),(0,t.kt)("p",null,"Yang terjadi adalah data ",(0,t.kt)("inlineCode",{parentName:"p"},"24")," milik owner ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," di-copy atau diduplikasi sebagai data baru yang owner-nya juga baru, yang pada contoh ini adalah variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"y"),"."),(0,t.kt)("p",null,"Hasilnya, kedua variabel tersebut masing-masing adalah owner dari data yang berbeda, meskipun sumbernya adalah dari data yang sama. Perilaku ini disebut dengan ",(0,t.kt)("strong",{parentName:"p"},"copy semantics"),"."),(0,t.kt)("p",null,"Semua tipe data primitif di Rust ",(0,t.kt)("em",{parentName:"p"},"by default")," mengadopsi ",(0,t.kt)("em",{parentName:"p"},"copy semantics"),". Ketika terjadi operasi assignment seperti pada contoh di atas, maka yang terjadi adalah data di-copy sebagai data baru, dengan owner baru, dan di sisi memory juga terjadi alokasi alamat baru untuk menampung data hasil copy tersebut."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Copy semantics ",(0,t.kt)("em",{parentName:"p"},"by default")," berlaku pada tipe primitif."),(0,t.kt)("p",{parentName:"blockquote"},"Sudah dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/basic-memory-management#a323-stack-memory"},"Memory Management \u279c Stack")," bahwa data primitif disimpan di stack dan pengaksesannya sangat cepat."),(0,t.kt)("p",{parentName:"blockquote"},"Dengan ini, copy data pada tipe primitif meskipun menghasilkan alokasi memory baru, konsekuensinya tidak terlalu besar karena pengaksesannya sangat cepat.")),(0,t.kt)("p",null,"Ok, lalu bagaimana dengan contoh ke-2 berikut? Apakah yang terjadi juga sama?"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let a = String::from("hello rust");\nlet b = a;\nprintln!("a: {:?}, b: {:?}", a, b);\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Ownership",src:n(5572).Z,width:"804",height:"394"})),(0,t.kt)("p",null,"Wow, malah muncul error. Kok bisa, padahal kode program sangat straightforward."),(0,t.kt)("p",null,"Jadi begini, sebelumnya sudah dibahas bahwa semua tipe data primitif mengadopsi ",(0,t.kt)("em",{parentName:"p"},"copy semantics"),". Namun untuk tipe data non-primitif (yang salah satunya adalah custom type ",(0,t.kt)("inlineCode",{parentName:"p"},"String"),") yang diadopsi adalah ",(0,t.kt)("strong",{parentName:"p"},"move semantics"),"."),(0,t.kt)("p",null,"Pada ",(0,t.kt)("em",{parentName:"p"},"move semantics"),", ketika ada operasi assignment seperti ",(0,t.kt)("inlineCode",{parentName:"p"},"let a = b;"),", maka yang terjadi adalah owner dari data string ",(0,t.kt)("inlineCode",{parentName:"p"},"hello rust")," berpindah dari variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"a")," ke ",(0,t.kt)("inlineCode",{parentName:"p"},"b"),". Jadinya, mulai dari statement ",(0,t.kt)("inlineCode",{parentName:"p"},"let a = b;")," dan statement seterusnya, owner dari data string ",(0,t.kt)("inlineCode",{parentName:"p"},"hello rust")," bukan lagi variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"a"),", tetapi variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"b"),"."),(0,t.kt)("p",null,"Ok, sampai sini cukup jelas. Tapi kenapa bisa error? Error muncul karena variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"a")," sudah tidak bisa digunakan lagi, data-nya (string ",(0,t.kt)("inlineCode",{parentName:"p"},"hello rust"),") sudah berpindah ke variabel lain. Variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"a")," menjadi tidak valid setelah owner-nya berpindah, dan ini adalah penyebab kenapa pemanggilan variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"a")," via macro ",(0,t.kt)("inlineCode",{parentName:"p"},"println")," menghasilkan error."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Ingat, setiap data pasti punya owner, dan satu data ownernya hanya satu."),(0,t.kt)("p",{parentName:"blockquote"},"Pada contoh di atas, owner data ",(0,t.kt)("inlineCode",{parentName:"p"},"hello rust")," sudah berpindah dari variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"a")," ke ",(0,t.kt)("inlineCode",{parentName:"p"},"b"),".")),(0,t.kt)("p",null,"Intinya, variabel yang mengadopsi ",(0,t.kt)("em",{parentName:"p"},"move semantics"),", setiap kali ada operasi assignment maka owner akan berpindah ke variabel baru."),(0,t.kt)("p",null,"Jika perlu, silakan coba praktikkan dengan tipe data non-primitif lainnya, seperti struct atau lainnya. Dengan pseudocode yang sama seperti contoh di atas, hasilnya adalah sama, yaitu error."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'#[derive(Debug)]\nstruct MyStruct;\n\nlet g = MyStruct{};\nlet h = g;\n\nprintln!("g: {:?}, h: {:?}", g, h);\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Ownership",src:n(5914).Z,width:"821",height:"449"})),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Copy semantics di Rust merupakan sifat yang dimiliki oleh trait ",(0,t.kt)("inlineCode",{parentName:"p"},"std::marker::Copy"),"."),(0,t.kt)("ul",{parentName:"blockquote"},(0,t.kt)("li",{parentName:"ul"},"Semua data primitif meng-implement trait ",(0,t.kt)("inlineCode",{parentName:"li"},"std::marker::Copy")," yang berarti mengadopsi ",(0,t.kt)("em",{parentName:"li"},"copy semantics"),"."),(0,t.kt)("li",{parentName:"ul"},"Data non-primitif mengadopsi ",(0,t.kt)("em",{parentName:"li"},"move semantics"),".")),(0,t.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai traits dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/traits"},"Traits"),".")),(0,t.kt)("h2",{id:"a345-alokasi--dealokasi"},"A.34.5. Alokasi & dealokasi"),(0,t.kt)("p",null,"Ok, masuk ke pembahasan selanjutnya, yaitu tentang alokasi dan dealokasi sebuah variabel dalam scope-nya."),(0,t.kt)("p",null,"Di sini kita akan gunakan custom type ",(0,t.kt)("inlineCode",{parentName:"p"},"String")," sebagai contoh untuk mempelajari ownership. Untuk tipe non-primitif lainnya yang juga mengadopsi ",(0,t.kt)("strong",{parentName:"p"},"move semantics")," sebenarnya bisa dijadikan contoh. Tapi penulis memilih tipe ",(0,t.kt)("inlineCode",{parentName:"p"},"String")," karena sering digunakan."),(0,t.kt)("p",null,"Sekarang perhatikan kode berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n do_something();\n}\n\nfn do_something() {\n let mut k = String::from("hello");\n\n {\n let m = String::from("hello world");\n let n = String::from("from rust");\n k = n;\n \n println!("{:?}", m);\n }\n\n println!("{:?}", k);\n}\n')),(0,t.kt)("p",null,"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main")," dideklarasikan, isinya adalah pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something"),"."),(0,t.kt)("p",null,"Di dalam fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something"),", variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"k")," dideklarasikan. Statement deklarasi tersebut adalah kapan proses alokasi memory berlangsung untuk data variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"k"),"."),(0,t.kt)("p",null,"Kemudian ada block expression, dan di dalamnya terjadi lagi proses alokasi memory untuk data variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"m")," dengan nilai adalah string ",(0,t.kt)("inlineCode",{parentName:"p"},"hello world"),", dan variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"n")," berisi string ",(0,t.kt)("inlineCode",{parentName:"p"},"from rust"),"."),(0,t.kt)("p",null,"Masih di dalam block expression, terjadi assignment operation, data variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"n")," berpindah ke variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"k"),". Lalu bagaimana nasib data string ",(0,t.kt)("inlineCode",{parentName:"p"},"hello")," yang sebelumnya dimiliki oleh ",(0,t.kt)("inlineCode",{parentName:"p"},"n"),"? Yang terjadi adalah data tersebut tidak memiliki reference, dan nantinya di akhir fungsi akan di-dealokasi. Proses dealokasi terjadi setelah fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something")," selesai dieksekusi karena variable scope data tersebut adalah di block kode fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something"),"."),(0,t.kt)("p",null,"Ok, masih dalam block expression. Ada statement print untuk data variable ",(0,t.kt)("inlineCode",{parentName:"p"},"m")," yang merupakan statement terakhir di block expression tersebut. Setelah eksekusi block expression selesai, yang terjadi kemudian adalah:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"data variabel ",(0,t.kt)("inlineCode",{parentName:"li"},"m")," di-dealokasi, karena sudah ",(0,t.kt)("em",{parentName:"li"},"out of scope"),"."),(0,t.kt)("li",{parentName:"ul"},"data variabel ",(0,t.kt)("inlineCode",{parentName:"li"},"n")," tidak di-dealokasi, karena sudah berpindah scope-nya ke fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"do_something"),". Data tersebut sekarang ownernya adalah variabel ",(0,t.kt)("inlineCode",{parentName:"li"},"k")," yang scope-nya ada di block fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"do_something"),".")),(0,t.kt)("p",null,"Kemudian variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"k")," di-print, dan fungsi selesai dieksekusi. Pada moment inilah semua data dalam scope block fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something")," di-dealokasi, karena kesemua data tersebut adalah ",(0,t.kt)("em",{parentName:"p"},"out of scope")," dan tidak ada yang berpindah ke block fungsi lainnya."),(0,t.kt)("p",null,"Secara garis besar seperti itu proses manajemen memory pada Rust yang menerapkan konsep ",(0,t.kt)("em",{parentName:"p"},"ownership"),"."),(0,t.kt)("h2",{id:"a346-transfer-ownership"},"A.34.6. Transfer ownership"),(0,t.kt)("p",null,"Di atas sudah dibahas bagaimana cara untuk transfer ownership data yang mengadopsi ",(0,t.kt)("em",{parentName:"p"},"move semantics"),", yaitu cukup dengan statement assignment."),(0,t.kt)("p",null,"Berikut adalah contoh lain perihal transfer ownership. Data string yang owner awalnya adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"msg1"),", berpindah ke ",(0,t.kt)("inlineCode",{parentName:"p"},"msg2"),", kemudian berpindah lagi ke ",(0,t.kt)("inlineCode",{parentName:"p"},"msg3"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let msg1 = String::from("hello");\nlet msg2 = msg1;\nlet msg3 = msg2;\nprintln!("{:?}", msg3);\n')),(0,t.kt)("p",null,"Coba modifikasi sedikit kode tersebut, dengan menambahkan deklarasi variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"msg4")," yang nilai-nya didapat dari ",(0,t.kt)("inlineCode",{parentName:"p"},"msg2"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let msg1 = String::from("hello");\nlet msg2 = msg1;\nlet msg3 = msg2;\n\nlet msg4 = msg2;\nprintln!("{:?}", msg4);\n')),(0,t.kt)("p",null,"Hasilnya adalah error, karena ",(0,t.kt)("inlineCode",{parentName:"p"},"msg2")," sudah invalid."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Ownership",src:n(3760).Z,width:"792",height:"394"})),(0,t.kt)("p",null,"Jika ingin memindah datanya ke ",(0,t.kt)("inlineCode",{parentName:"p"},"msg4"),", maka gunakan statement ",(0,t.kt)("inlineCode",{parentName:"p"},"let msg4 = msg3"),"."),(0,t.kt)("h3",{id:"-transfer-ownership-via-return-value"},"\u25c9 Transfer ownership via return value"),(0,t.kt)("p",null,"Transfer ownership data yang mengadopsi ",(0,t.kt)("em",{parentName:"p"},"move semantics")," juga bisa dilakukan antar fungsi via return value. Sebagai contoh pada kode berikut, variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"m")," yang berada di dalam block expression berpindah ke luar scope yaitu ke block fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something")," via operasi assignment ",(0,t.kt)("inlineCode",{parentName:"p"},"k = m"),". Kemudian berpindah lagi ke fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main")," via return value pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let msg = do_something();\n println!("{:?}", msg);\n}\n \nfn do_something() -> String {\n let mut k = String::from("hello");\n\n {\n let m = String::from("hello world");\n k = m;\n }\n\n return k;\n}\n')),(0,t.kt)("h3",{id:"-transfer-ownership-via-parameterargument"},"\u25c9 Transfer ownership via parameter/argument"),(0,t.kt)("p",null,"Pemanggilan fungsi dengan menyisipkan argument juga menghasilkan proses transfer ownership untuk data yang mengadopsi ",(0,t.kt)("em",{parentName:"p"},"move semantics"),". Contoh:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let msg = String::from("hello rust");\n say_hello(msg);\n}\n \nfn say_hello(param: String) {\n println!("{:?}", param);\n}\n')),(0,t.kt)("p",null,"Pada kode di atas, data variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"msg")," owner-nya berpindah ke parameter bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"param")," milik fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello"),"."),(0,t.kt)("p",null,"Ok, sampai di sini semoga cukup jelas ya tentang bagaimana proses transfer ownership terjadi pada data yang mengadopsi ",(0,t.kt)("em",{parentName:"p"},"move semantics"),"."),(0,t.kt)("p",null,"Untuk data bertipe primitif (yang mengadopsi ",(0,t.kt)("em",{parentName:"p"},"copy semantics"),") kita tidak perlu repot memikirkan di mana letak owner datanya, karena setiap operasi assignment, data akan di-copy dan hasilnya ada data baru dengan owner baru."),(0,t.kt)("p",null,"Tapi kalau dipikir-pikir justru lebih repot mengurus data yang ownernya berpindah saat assignment. Sebagai contoh, misal variabel digunakan di fungsi lain, kemudian digunakan lagi di scope asalnya. Repot juga kalau setiap saat harus dikembalikan lagi via return value."),(0,t.kt)("p",null,"Misalnya pada kasus berikut ini. Hasilnya pasti error, karena variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"msg")," di print setelah owner-nya berpindah ke fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let msg = String::from("hello rust");\n say_hello(msg);\n println!("{:?}", msg);\n}\n \nfn say_hello(param: String) {\n println!("{:?}", param);\n}\n')),(0,t.kt)("p",null,"Lalu apa solusinya? apakah harus mengembalikannya via return value? Contohnya seperti kode berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let mut msg = String::from("hello rust"); // 1. awalnya data di sini\n msg = say_hello(msg); // 3. lalu dikembalikan lagi ke sini\n println!("{:?}", msg);\n}\n \nfn say_hello(param: String) -> String { // 2. kemudian berpindah ke sini\n println!("{:?}", param);\n param\n}\n')),(0,t.kt)("p",null,"Boleh-boleh saja sebenarnya pakai approach tersebut, tapi malah makin repot bukan?"),(0,t.kt)("p",null,"Ada lagi solusi lainnya yang bisa digunakan, yaitu dengan memanfaatkan method ",(0,t.kt)("inlineCode",{parentName:"p"},"clone")," untuk cloning data."),(0,t.kt)("h2",{id:"a347-clone-data"},"A.34.7. Clone data"),(0,t.kt)("p",null,"Semua tipe data yang mengadopsi ",(0,t.kt)("em",{parentName:"p"},"move semantics")," meng-implement trait ",(0,t.kt)("inlineCode",{parentName:"p"},"std::clone::Clone"),". Trait ini memiliki method bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"clone")," yang gunanya adalah menduplikasi atau clonging data. Cukup panggil saja method tersebut, maka data akan ter-cloning."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai traits dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/traits"},"Traits"),".")),(0,t.kt)("p",null,"Kita akan terapkan pada kode sebelumnya, hasilnya kurang lebih seperti ini. Pada argument pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello")," disisipkan data cloning via statement ",(0,t.kt)("inlineCode",{parentName:"p"},"msg.clone()"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let msg = String::from("hello rust");\n say_hello(msg.clone());\n println!("{:?}", msg);\n}\n \nfn say_hello(param: String) {\n println!("{:?}", param);\n}\n')),(0,t.kt)("p",null,"Ok, dengan ini masalah untuk me-reuse data yang bisa berpindah ownernya dianggap beres. Memang beres, tapi apakah cara ini baik kalau dilihat dari sudut pandang memory management?"),(0,t.kt)("p",null,"Konsekuensi dari cloning data adalah terjadi proses alokasi lagi di memory. Data akan di-duplikasi dan dialokasikan ke alamat memory baru, jadinya kurang efisien. Ditambah lagi, jika kita mengacu ke penjelasan pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/basic-memory-management#a324-heap-memory"},"Memory Management \u279c Heap Memory"),", data ",(0,t.kt)("inlineCode",{parentName:"p"},"String")," isinya disimpan di heap memory yang pengaksesannya lebih lambat dibanding pengaksesan data stack. Dari sini bisa disimpulkan bahwa cloning bukan solusi yang paling baik (kecuali terpaksa)."),(0,t.kt)("p",null,(0,t.kt)("strong",{parentName:"p"},"Solusi yang lebih baik adalah dengan melakukan operasi pinjam data dari owner aslinya tanpa perlu melakukan operasi perpindahan owner"),", yang pada Rust programming disebut dengan ",(0,t.kt)("strong",{parentName:"p"},"borrowing"),"."),(0,t.kt)("p",null,"Kita sebenarnya sudah menerapkannya beberapa kali pada chapter yang lalu, tapi kita akan bahas lagi lebih detail (dari sudut pandang ownership) pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/borrowing"},"Borrowing"),"."),(0,t.kt)("h2",{id:"a348-ownership-pada-data-literal"},"A.34.8. Ownership pada data literal"),(0,t.kt)("p",null,"Kita akan bahas topik ini pada chapter berikutnya, yaitu chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/borrowing#a347-owner-dan-borrower-pada-literal"},"Borrowing"),"."),(0,t.kt)("h2",{id:"a349-move-semantics-pada-macro-println"},"A.34.9. ",(0,t.kt)("em",{parentName:"h2"},"Move semantics")," pada macro ",(0,t.kt)("inlineCode",{parentName:"h2"},"println")),(0,t.kt)("p",null,"Ada yang unik dengan macro ",(0,t.kt)("inlineCode",{parentName:"p"},"println"),". Silakan coba kode berikut agar terlihat keunikannya."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let str1 = String::from("luwe");\n println!("{str1}");\n do_something(str1);\n \n let str2 = String::from("ngelak");\n do_something(str2);\n println!("{str2}");\n}\n\nfn do_something(str: String) {\n println!("{}", str);\n}\n')),(0,t.kt)("p",null,"Jika dijalankan ada error di statement terakhir fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Ownership",src:n(8255).Z,width:"883",height:"682"})),(0,t.kt)("p",null,"Seperti yang sudah dibahas, bahwa tipe ",(0,t.kt)("inlineCode",{parentName:"p"},"String")," mengadopsi move semantics. Ketika data bertipe ini digunakan pada operasi assignment seperti contohnya sebagai argument pemanggilan fungsi, maka owner berpindah."),(0,t.kt)("p",null,"Tapi entah kenapa, khusus dalam pemanggilan macro ",(0,t.kt)("inlineCode",{parentName:"p"},"println"),", owner-nya tidak berpindah. Ajaib."),(0,t.kt)("p",null,"Silakan lihat sendiri di gambar di atas, ketika ",(0,t.kt)("inlineCode",{parentName:"p"},"str1")," digunakan pada macro ",(0,t.kt)("inlineCode",{parentName:"p"},"println"),", kemudian digunakan lagi pada argument pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something"),", hasilnya tidak error."),(0,t.kt)("p",null,"Akan tetapi ketika digunakan pada pemanggilan fungsi terlebih dahulu, jika digunakan lagi di statement di bawahnya hasilnya error."),(0,t.kt)("p",null,"Ini adalah keistimewaan dari macro ",(0,t.kt)("inlineCode",{parentName:"p"},"println")," dan beberapa macro untuk keperluan printing lainnya."),(0,t.kt)("p",null,"Lebih jelasnya mengenai macro dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"#/wip/macro"},"Macro"),"."),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/ownership"},"github.com/novalagung/dasarpemrogramanrust-example/../ownership")),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html"},"https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/marker/trait.Copy.html"},"https://doc.rust-lang.org/std/marker/trait.Copy.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/nomicon/ownership.html"},"https://doc.rust-lang.org/nomicon/ownership.html"))))}o.isMDXComponent=!0},1146:(a,e,n)=>{n.d(e,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAU0AAABuCAIAAAAs3da/AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsI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CcIgjwnCPKcIAjy3I4ff/7+1+P9Df3098+PlYu+wSwRxJ55fuHNQJq395BADaXe399XJ9UGs0QQ1+V5a99ct294MZrA8K88mvAueBPxJd63clIF0Yg/r5Qlgti9PXdGTxBsDql6SrXPikkVMXvMw7WyRBD7n7e309k/zf+9TU/PnyOPVJpEqh9jVmaRcsEsEcQB1uft9H0Gy4P3fSJNI5Uj+uX1qblaOEsEsXeetz3/bZjXTmPU+Go7t5YoZGtP9Mk0r5Algtj9+rzt8z8E002LYcEoOISEG962z1rNi3//ypAVskQQx+c52GFXdt8T7/sQFJKk6ohuMaXym1i1LBHErazP1wOkL80uQRyF552htZFXfuMjCGJH9tw4GtCWE8SReU4QBHlOEAR5ThDkOUEQ5DlBEOQ5QRDkOUEQ5DlBEOQ5QRDkOUEQ5DlBkOcEQRwL/wO9aeJQompbygAAAABJRU5ErkJggg=="},5572:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/ownership-2-b8db9994157f3e86c2a74d048ca45363.png"},5914:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/ownership-3-f9834609466195e2d46433bbc089153c.png"},3760:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/ownership-4-90c3dccbd5f0429a8760c9a445f446af.png"},8255:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/ownership-5-42080e6ebdac72f8d756dcf0dacb2061.png"}}]); \ No newline at end of file diff --git a/assets/js/8333c691.d59a9952.js b/assets/js/8333c691.d59a9952.js deleted file mode 100644 index b608163d..00000000 --- a/assets/js/8333c691.d59a9952.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4248],{3905:(a,e,n)=>{n.d(e,{Zo:()=>d,kt:()=>u});var i=n(7294);function t(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,i)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){t(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function p(a,e){if(null==a)return{};var n,i,t=function(a,e){if(null==a)return{};var n,i,t={},r=Object.keys(a);for(i=0;i<r.length;i++)n=r[i],e.indexOf(n)>=0||(t[n]=a[n]);return t}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(i=0;i<r.length;i++)n=r[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(t[n]=a[n])}return t}var s=i.createContext({}),m=function(a){var e=i.useContext(s),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},d=function(a){var e=m(a.components);return i.createElement(s.Provider,{value:e},a.children)},o={inlineCode:"code",wrapper:function(a){var e=a.children;return i.createElement(i.Fragment,{},e)}},k=i.forwardRef((function(a,e){var n=a.components,t=a.mdxType,r=a.originalType,s=a.parentName,d=p(a,["components","mdxType","originalType","parentName"]),k=m(n),u=t,g=k["".concat(s,".").concat(u)]||k[u]||o[u]||r;return n?i.createElement(g,l(l({ref:e},d),{},{components:n})):i.createElement(g,l({ref:e},d))}));function u(a,e){var n=arguments,t=e&&e.mdxType;if("string"==typeof a||t){var r=n.length,l=new Array(r);l[0]=k;var p={};for(var s in e)hasOwnProperty.call(e,s)&&(p[s]=e[s]);p.originalType=a,p.mdxType="string"==typeof a?a:t,l[1]=p;for(var m=2;m<r;m++)l[m]=n[m];return i.createElement.apply(null,l)}return i.createElement.apply(null,n)}k.displayName="MDXCreateElement"},9739:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>s,contentTitle:()=>l,default:()=>o,frontMatter:()=>r,metadata:()=>p,toc:()=>m});var i=n(7462),t=(n(7294),n(3905));const r={sidebar_position:34,title:"A.34. Ownership",sidebar_label:"A.34. Ownership"},l=void 0,p={unversionedId:"basic/ownership",id:"basic/ownership",title:"A.34. Ownership",description:"Chapter ini berisi pembahasan tentang ownership, bagaimana Rust melakukan manajemen memory dengan menerapkan approach ownership ini.",source:"@site/docs/basic/ownership.md",sourceDirName:"basic",slug:"/basic/ownership",permalink:"/basic/ownership",draft:!1,tags:[],version:"current",sidebarPosition:34,frontMatter:{sidebar_position:34,title:"A.34. Ownership",sidebar_label:"A.34. Ownership"},sidebar:"tutorialSidebar",previous:{title:"A.33. Pointer & References",permalink:"/basic/pointer-references"},next:{title:"A.35. Borrowing",permalink:"/basic/borrowing"}},s={},m=[{value:"A.34.1. Konsep ownership",id:"a341-konsep-ownership",level:2},{value:"A.34.2. Aturan ownership",id:"a342-aturan-ownership",level:2},{value:"A.34.3. Variable scope",id:"a343-variable-scope",level:2},{value:"A.34.4. Copy semantics vs. move semantics",id:"a344-copy-semantics-vs-move-semantics",level:2},{value:"A.34.5. Alokasi & dealokasi",id:"a345-alokasi--dealokasi",level:2},{value:"A.34.6. Transfer ownership",id:"a346-transfer-ownership",level:2},{value:"\u25c9 Transfer ownership via return value",id:"-transfer-ownership-via-return-value",level:3},{value:"\u25c9 Transfer ownership via parameter/argument",id:"-transfer-ownership-via-parameterargument",level:3},{value:"A.34.7. Clone data",id:"a347-clone-data",level:2},{value:"A.34.8. Ownership pada data literal",id:"a348-ownership-pada-data-literal",level:2},{value:"A.34.9. <em>Move semantics</em> pada macro <code>println</code>",id:"a349-move-semantics-pada-macro-println",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:m};function o(a){let{components:e,...r}=a;return(0,t.kt)("wrapper",(0,i.Z)({},d,r,{components:e,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Chapter ini berisi pembahasan tentang ownership, bagaimana Rust melakukan manajemen memory dengan menerapkan approach ownership ini."),(0,t.kt)("p",null,"O iya, diwajibkan untuk mempelajari terlebih dahulu tentang dasar ",(0,t.kt)("a",{parentName:"p",href:"/basic/basic-memory-management"},"Memory Management")," dan juga ",(0,t.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"),", yang keduanya adalah dibahas pada chapter sebelumnya. Jika pembaca mempelajari ebook ini secara urut maka tidak usah khawatir."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Pembahasan pada chapter ini adalah salah satu hal yang paling penting untuk dipahami dalam Rust programming, karena topik yang berhubungan dengan memory management adalah hal yang krusial pada system programming."),(0,t.kt)("p",{parentName:"blockquote"},"Silakan ulang-ulang chapter ini jika diperlukan.")),(0,t.kt)("h2",{id:"a341-konsep-ownership"},"A.34.1. Konsep ownership"),(0,t.kt)("p",null,"Ownership merupakan kumpulan aturan yang ada di Rust yang dijadikan acuan oleh compiler dalam pengelolahan memory."),(0,t.kt)("p",null,"Sudah disinggung pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/basic-memory-management"},"Memory Management")," bahwa Rust tidak menerapkan GC ataupun ARC dalam manajemen memory-nya. Rust membebankan manajemen memory pada penulis kode program, yaitu kita/programmer."),(0,t.kt)("p",null,"Aturan ownership ada banyak, dan programmer harus mengikutinya, karena jika tidak, maka proses kompilasi program dan eksekusi program akan gagal dan hasilnya error."),(0,t.kt)("h2",{id:"a342-aturan-ownership"},"A.34.2. Aturan ownership"),(0,t.kt)("p",null,"Ada 3 aturan penting yang wajib diketahui:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},(0,t.kt)("strong",{parentName:"p"},"Semua nilai/data/value di Rust memiliki owner"),". Misal kita berbicara tentang deklarasi variabel dengan predefined value, maka value variabel adalah yang dimaksud dengan nilai/data/value, dan variabel itu sendiri adalah owner dari nilai/data/value tersebut.")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Pada waktu yang sama, ",(0,t.kt)("strong",{parentName:"p"},"hanya boleh ada 1 owner"),". Satu data, ownernya hanya satu.")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},(0,t.kt)("strong",{parentName:"p"},"Ketika eksekusi sebuah block scope selesai, maka owner dari data-data yang ada dalam scope tersebut akan di-drop atau di-dealokasi")," (dengan pengecualian yaitu owner berpindah ke luar scope)."))),(0,t.kt)("h2",{id:"a343-variable-scope"},"A.34.3. Variable scope"),(0,t.kt)("p",null,"Sebelum kita masuk ke pembahasan yang lebih detail mengenai ownership, mari pelajari terlebih dahulu tentang apa itu variable scope."),(0,t.kt)("p",null,"Variable scope maksudnya adalah di block scope mana suatu variabel dideklarasikan, dan dalam block scope tersebut variabel menjadi valid (bisa digunakan). Di luar scope-nya variabel menjadi tidak valid, tidak bisa digunakan."),(0,t.kt)("p",null,"Agar lebih jelas, silakan perhatikan kode berikut, tidak perlu dipraktikkan."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn do_something() {\n let data_one = "one";\n // ...\n}\n\nfn main() {\n let data_two = "two";\n // ...\n\n {\n let data_three = "three";\n // ...\n }\n\n do_something();\n\n if true {\n let data_four = "four";\n // ...\n }\n}\n')),(0,t.kt)("p",null,"Program di atas memiliki 4 buah block kode:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Block fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),", yang isinya adalah variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"data_two")," dan beberapa sub-block dan 1 buah pemanggilan fungsi. Di dalam block fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),", variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"data_two")," adalah valid, dan bisa digunakan dalam fungsi scope tersebut beserta sub-block lainnya (block expression dan block kode ",(0,t.kt)("inlineCode",{parentName:"p"},"if"),").")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Block expression yang berisi variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"data_three"),". Pada block scope ini, variabel tersebut dan juga variable ",(0,t.kt)("inlineCode",{parentName:"p"},"data_two")," adalah valid.")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Block fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something"),", yang isinya variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"data_one"),". Variabel tersebut hanya akan valid dalam block fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something"),".")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Block seleksi kondisi ",(0,t.kt)("inlineCode",{parentName:"p"},"if"),". Variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"data_four")," berada dalam block ini, maka variabel tersebut adalah valid dalam block tersebut. Selain itu ",(0,t.kt)("inlineCode",{parentName:"p"},"data_two")," juga valid dalam block seleksi kondisi ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," ini."))),(0,t.kt)("p",null,"Intinya, variabel adalah valid ketika berada di dalam scope-nya (istilahnya ",(0,t.kt)("em",{parentName:"p"},"into scope"),"), dan variabel menjadi tidak valid atau invalid ketika keluar dari scope (istilahnya ",(0,t.kt)("em",{parentName:"p"},"out of scope"),")."),(0,t.kt)("h2",{id:"a344-copy-semantics-vs-move-semantics"},"A.34.4. Copy semantics vs. move semantics"),(0,t.kt)("p",null,"Di atas sudah dijelaskan mengenai aturan ownership, yang salah satunya adalah setiap data yang ada di Rust memiliki owner, dan 1 data owner pasti 1 (tidak lebih)."),(0,t.kt)("p",null,"Agar lebih jelas mari kita perhatikan contoh berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let x = 24;\nlet y = x;\nprintln!("x: {:?}, y: {:?}", x, y);\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Ownership",src:n(1146).Z,width:"333",height:"110"})),(0,t.kt)("p",null,"Variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," dideklarasikan dengan nilai ",(0,t.kt)("inlineCode",{parentName:"p"},"24"),", artinya variabel tersebut adalah owner dari data ",(0,t.kt)("inlineCode",{parentName:"p"},"24"),". Kemudian variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," dijadikan sebagai nilai variabel baru bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"y"),", dari sini apakah berarti owner data ",(0,t.kt)("inlineCode",{parentName:"p"},"24")," adalah berpindah dari variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," ke ",(0,t.kt)("inlineCode",{parentName:"p"},"y"),"? jawabannya adalah ",(0,t.kt)("strong",{parentName:"p"},"tidak"),"."),(0,t.kt)("p",null,"Yang terjadi adalah data ",(0,t.kt)("inlineCode",{parentName:"p"},"24")," milik owner ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," di-copy atau diduplikasi sebagai data baru yang owner-nya juga baru, yang pada contoh ini adalah variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"y"),"."),(0,t.kt)("p",null,"Hasilnya, kedua variabel tersebut masing-masing adalah owner dari data yang berbeda, meskipun sumbernya adalah dari data yang sama. Perilaku ini disebut dengan ",(0,t.kt)("strong",{parentName:"p"},"copy semantics"),"."),(0,t.kt)("p",null,"Semua tipe data primitif di Rust ",(0,t.kt)("em",{parentName:"p"},"by default")," mengadopsi ",(0,t.kt)("em",{parentName:"p"},"copy semantics"),". Ketika terjadi operasi assignment seperti pada contoh di atas, maka yang terjadi adalah data di-copy sebagai data baru, dengan owner baru, dan di sisi memory juga terjadi alokasi alamat baru untuk menampung data hasil copy tersebut."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Copy semantics ",(0,t.kt)("em",{parentName:"p"},"by default")," berlaku pada tipe primitif."),(0,t.kt)("p",{parentName:"blockquote"},"Sudah dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/basic-memory-management#a323-stack-memory"},"Memory Management \u279c Stack")," bahwa data primitif disimpan di stack dan pengaksesannya sangat cepat."),(0,t.kt)("p",{parentName:"blockquote"},"Dengan ini, copy data pada tipe primitif meskipun menghasilkan alokasi memory baru, konsekuensinya tidak terlalu besar karena pengaksesannya sangat cepat.")),(0,t.kt)("p",null,"Ok, lalu bagaimana dengan contoh ke-2 berikut? Apakah yang terjadi juga sama?"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let a = String::from("hello rust");\nlet b = a;\nprintln!("a: {:?}, b: {:?}", a, b);\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Ownership",src:n(5572).Z,width:"804",height:"394"})),(0,t.kt)("p",null,"Wow, malah muncul error. Kok bisa, padahal kode program sangat straightforward."),(0,t.kt)("p",null,"Jadi begini, sebelumnya sudah dibahas bahwa semua tipe data primitif mengadopsi ",(0,t.kt)("em",{parentName:"p"},"copy semantics"),". Namun untuk tipe data non-primitif (yang salah satunya adalah custom type ",(0,t.kt)("inlineCode",{parentName:"p"},"String"),") yang diadopsi adalah ",(0,t.kt)("strong",{parentName:"p"},"move semantics"),"."),(0,t.kt)("p",null,"Pada ",(0,t.kt)("em",{parentName:"p"},"move semantics"),", ketika ada operasi assignment seperti ",(0,t.kt)("inlineCode",{parentName:"p"},"let a = b;"),", maka yang terjadi adalah owner dari data string ",(0,t.kt)("inlineCode",{parentName:"p"},"hello rust")," berpindah dari variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"a")," ke ",(0,t.kt)("inlineCode",{parentName:"p"},"b"),". Jadinya, mulai dari statement ",(0,t.kt)("inlineCode",{parentName:"p"},"let a = b;")," dan statement seterusnya, owner dari data string ",(0,t.kt)("inlineCode",{parentName:"p"},"hello rust")," bukan lagi variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"a"),", tetapi variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"b"),"."),(0,t.kt)("p",null,"Ok, sampai sini cukup jelas. Tapi kenapa bisa error? Error muncul karena variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"a")," sudah tidak bisa digunakan lagi, data-nya (string ",(0,t.kt)("inlineCode",{parentName:"p"},"hello rust"),") sudah berpindah ke variabel lain. Variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"a")," menjadi tidak valid setelah owner-nya berpindah, dan ini adalah penyebab kenapa pemanggilan variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"a")," via macro ",(0,t.kt)("inlineCode",{parentName:"p"},"println")," menghasilkan error."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Ingat, setiap data pasti punya owner, dan satu data ownernya hanya satu."),(0,t.kt)("p",{parentName:"blockquote"},"Pada contoh di atas, owner data ",(0,t.kt)("inlineCode",{parentName:"p"},"hello rust")," sudah berpindah dari variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"a")," ke ",(0,t.kt)("inlineCode",{parentName:"p"},"b"),".")),(0,t.kt)("p",null,"Intinya, variabel yang mengadopsi ",(0,t.kt)("em",{parentName:"p"},"move semantics"),", setiap kali ada operasi assignment maka owner akan berpindah ke variabel baru."),(0,t.kt)("p",null,"Jika perlu, silakan coba praktikkan dengan tipe data non-primitif lainnya, seperti struct atau lainnya. Dengan pseudocode yang sama seperti contoh di atas, hasilnya adalah sama, yaitu error."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'#[derive(Debug)]\nstruct MyStruct;\n\nlet g = MyStruct{};\nlet h = g;\n\nprintln!("g: {:?}, h: {:?}", g, h);\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Ownership",src:n(5914).Z,width:"821",height:"449"})),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Copy semantics di Rust merupakan sifat yang dimiliki oleh trait ",(0,t.kt)("inlineCode",{parentName:"p"},"std::marker::Copy"),"."),(0,t.kt)("ul",{parentName:"blockquote"},(0,t.kt)("li",{parentName:"ul"},"Semua data primitif meng-implement trait ",(0,t.kt)("inlineCode",{parentName:"li"},"std::marker::Copy")," yang berarti mengadopsi ",(0,t.kt)("em",{parentName:"li"},"copy semantics"),"."),(0,t.kt)("li",{parentName:"ul"},"Data non-primitif mengadopsi ",(0,t.kt)("em",{parentName:"li"},"move semantics"),".")),(0,t.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai traits dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/traits"},"Traits"),".")),(0,t.kt)("h2",{id:"a345-alokasi--dealokasi"},"A.34.5. Alokasi & dealokasi"),(0,t.kt)("p",null,"Ok, masuk ke pembahasan selanjutnya, yaitu tentang alokasi dan dealokasi sebuah variabel dalam scope-nya."),(0,t.kt)("p",null,"Di sini kita akan gunakan custom type ",(0,t.kt)("inlineCode",{parentName:"p"},"String")," sebagai contoh untuk mempelajari ownership. Untuk tipe non-primitif lainnya yang juga mengadopsi ",(0,t.kt)("strong",{parentName:"p"},"move semantics")," sebenarnya bisa dijadikan contoh. Tapi penulis memilih tipe ",(0,t.kt)("inlineCode",{parentName:"p"},"String")," karena sering digunakan."),(0,t.kt)("p",null,"Sekarang perhatikan kode berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n do_something();\n}\n\nfn do_something() {\n let mut k = String::from("hello");\n\n {\n let m = String::from("hello world");\n let n = String::from("from rust");\n k = n;\n \n println!("{:?}", m);\n }\n\n println!("{:?}", k);\n}\n')),(0,t.kt)("p",null,"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main")," dideklarasikan, isinya adalah pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something"),"."),(0,t.kt)("p",null,"Di dalam fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something"),", variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"k")," dideklarasikan. Statement deklarasi tersebut adalah kapan proses alokasi memory berlangsung untuk data variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"k"),"."),(0,t.kt)("p",null,"Kemudian ada block expression, dan di dalamnya terjadi lagi proses alokasi memory untuk data variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"m")," dengan nilai adalah string ",(0,t.kt)("inlineCode",{parentName:"p"},"hello world"),", dan variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"n")," berisi string ",(0,t.kt)("inlineCode",{parentName:"p"},"from rust"),"."),(0,t.kt)("p",null,"Masih di dalam block expression, terjadi assignment operation, data variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"n")," berpindah ke variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"k"),". Lalu bagaimana nasib data string ",(0,t.kt)("inlineCode",{parentName:"p"},"hello")," yang sebelumnya dimiliki oleh ",(0,t.kt)("inlineCode",{parentName:"p"},"n"),"? Yang terjadi adalah data tersebut tidak memiliki reference, dan nantinya di akhir fungsi akan di-dealokasi. Proses dealokasi terjadi setelah fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something")," selesai dieksekusi karena variable scope data tersebut adalah di block kode fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something"),"."),(0,t.kt)("p",null,"Ok, masih dalam block expression. Ada statement print untuk data variable ",(0,t.kt)("inlineCode",{parentName:"p"},"m")," yang merupakan statement terakhir di block expression tersebut. Setelah eksekusi block expression selesai, yang terjadi kemudian adalah:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"data variabel ",(0,t.kt)("inlineCode",{parentName:"li"},"m")," di-dealokasi, karena sudah ",(0,t.kt)("em",{parentName:"li"},"out of scope"),"."),(0,t.kt)("li",{parentName:"ul"},"data variabel ",(0,t.kt)("inlineCode",{parentName:"li"},"n")," tidak di-dealokasi, karena sudah berpindah scope-nya ke fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"do_something"),". Data tersebut sekarang ownernya adalah variabel ",(0,t.kt)("inlineCode",{parentName:"li"},"k")," yang scope-nya ada di block fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"do_something"),".")),(0,t.kt)("p",null,"Kemudian variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"k")," di-print, dan fungsi selesai dieksekusi. Pada moment inilah semua data dalam scope block fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something")," di-dealokasi, karena kesemua data tersebut adalah ",(0,t.kt)("em",{parentName:"p"},"out of scope")," dan tidak ada yang berpindah ke block fungsi lainnya."),(0,t.kt)("p",null,"Secara garis besar seperti itu proses manajemen memory pada Rust yang menerapkan konsep ",(0,t.kt)("em",{parentName:"p"},"ownership"),"."),(0,t.kt)("h2",{id:"a346-transfer-ownership"},"A.34.6. Transfer ownership"),(0,t.kt)("p",null,"Di atas sudah dibahas bagaimana cara untuk transfer ownership data yang mengadopsi ",(0,t.kt)("em",{parentName:"p"},"move semantics"),", yaitu cukup dengan statement assignment."),(0,t.kt)("p",null,"Berikut adalah contoh lain perihal transfer ownership. Data string yang owner awalnya adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"msg1"),", berpindah ke ",(0,t.kt)("inlineCode",{parentName:"p"},"msg2"),", kemudian berpindah lagi ke ",(0,t.kt)("inlineCode",{parentName:"p"},"msg3"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let msg1 = String::from("hello");\nlet msg2 = msg1;\nlet msg3 = msg2;\nprintln!("{:?}", msg3);\n')),(0,t.kt)("p",null,"Coba modifikasi sedikit kode tersebut, dengan menambahkan deklarasi variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"msg4")," yang nilai-nya didapat dari ",(0,t.kt)("inlineCode",{parentName:"p"},"msg2"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let msg1 = String::from("hello");\nlet msg2 = msg1;\nlet msg3 = msg2;\n\nlet msg4 = msg2;\nprintln!("{:?}", msg4);\n')),(0,t.kt)("p",null,"Hasilnya adalah error, karena ",(0,t.kt)("inlineCode",{parentName:"p"},"msg2")," sudah invalid."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Ownership",src:n(3760).Z,width:"792",height:"394"})),(0,t.kt)("p",null,"Jika ingin memindah datanya ke ",(0,t.kt)("inlineCode",{parentName:"p"},"msg4"),", maka gunakan statement ",(0,t.kt)("inlineCode",{parentName:"p"},"let msg4 = msg3"),"."),(0,t.kt)("h3",{id:"-transfer-ownership-via-return-value"},"\u25c9 Transfer ownership via return value"),(0,t.kt)("p",null,"Transfer ownership data yang mengadopsi ",(0,t.kt)("em",{parentName:"p"},"move semantics")," juga bisa dilakukan antar fungsi via return value. Sebagai contoh pada kode berikut, variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"m")," yang berada di dalam block expression berpindah ke luar scope yaitu ke block fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something")," via operasi assignment ",(0,t.kt)("inlineCode",{parentName:"p"},"k = m"),". Kemudian berpindah lagi ke fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main")," via return value pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let msg = do_something();\n println!("{:?}", msg);\n}\n \nfn do_something() -> String {\n let mut k = String::from("hello");\n\n {\n let m = String::from("hello world");\n k = m;\n }\n\n return k;\n}\n')),(0,t.kt)("h3",{id:"-transfer-ownership-via-parameterargument"},"\u25c9 Transfer ownership via parameter/argument"),(0,t.kt)("p",null,"Pemanggilan fungsi dengan menyisipkan argument juga menghasilkan proses transfer ownership untuk data yang mengadopsi ",(0,t.kt)("em",{parentName:"p"},"move semantics"),". Contoh:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let msg = String::from("hello rust");\n say_hello(msg);\n}\n \nfn say_hello(param: String) {\n println!("{:?}", param);\n}\n')),(0,t.kt)("p",null,"Pada kode di atas, data variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"msg")," owner-nya berpindah ke parameter bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"param")," milik fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello"),"."),(0,t.kt)("p",null,"Ok, sampai di sini semoga cukup jelas ya tentang bagaimana proses transfer ownership terjadi pada data yang mengadopsi ",(0,t.kt)("em",{parentName:"p"},"move semantics"),"."),(0,t.kt)("p",null,"Untuk data bertipe primitif (yang mengadopsi ",(0,t.kt)("em",{parentName:"p"},"copy semantics"),") kita tidak perlu repot memikirkan di mana letak owner datanya, karena setiap operasi assignment, data akan di-copy dan hasilnya ada data baru dengan owner baru."),(0,t.kt)("p",null,"Tapi kalau dipikir-pikir justru lebih repot mengurus data yang ownernya berpindah saat assignment. Sebagai contoh, misal variabel digunakan di fungsi lain, kemudian digunakan lagi di scope asalnya. Repot juga kalau setiap saat harus dikembalikan lagi via return value."),(0,t.kt)("p",null,"Misalnya pada kasus berikut ini. Hasilnya pasti error, karena variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"msg")," di print setelah owner-nya berpindah ke fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let msg = String::from("hello rust");\n say_hello(msg);\n println!("{:?}", msg);\n}\n \nfn say_hello(param: String) {\n println!("{:?}", param);\n}\n')),(0,t.kt)("p",null,"Lalu apa solusinya? apakah harus mengembalikannya via return value? Contohnya seperti kode berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let mut msg = String::from("hello rust"); // 1. awalnya data di sini\n msg = say_hello(msg); // 3. lalu dikembalikan lagi ke sini\n println!("{:?}", msg);\n}\n \nfn say_hello(param: String) -> String { // 2. kemudian berpindah ke sini\n println!("{:?}", param);\n param\n}\n')),(0,t.kt)("p",null,"Boleh-boleh saja sebenarnya pakai approach tersebut, tapi malah makin repot bukan?"),(0,t.kt)("p",null,"Ada lagi solusi lainnya yang bisa digunakan, yaitu dengan memanfaatkan method ",(0,t.kt)("inlineCode",{parentName:"p"},"clone")," untuk cloning data."),(0,t.kt)("h2",{id:"a347-clone-data"},"A.34.7. Clone data"),(0,t.kt)("p",null,"Semua tipe data yang mengadopsi ",(0,t.kt)("em",{parentName:"p"},"move semantics")," meng-implement trait ",(0,t.kt)("inlineCode",{parentName:"p"},"std::clone::Clone"),". Trait ini memiliki method bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"clone")," yang gunanya adalah menduplikasi atau clonging data. Cukup panggil saja method tersebut, maka data akan ter-cloning."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai traits dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/traits"},"Traits"),".")),(0,t.kt)("p",null,"Kita akan terapkan pada kode sebelumnya, hasilnya kurang lebih seperti ini. Pada argument pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"say_hello")," disisipkan data cloning via statement ",(0,t.kt)("inlineCode",{parentName:"p"},"msg.clone()"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let msg = String::from("hello rust");\n say_hello(msg.clone());\n println!("{:?}", msg);\n}\n \nfn say_hello(param: String) {\n println!("{:?}", param);\n}\n')),(0,t.kt)("p",null,"Ok, dengan ini masalah untuk me-reuse data yang bisa berpindah ownernya dianggap beres. Memang beres, tapi apakah cara ini baik kalau dilihat dari sudut pandang memory management?"),(0,t.kt)("p",null,"Konsekuensi dari cloning data adalah terjadi proses alokasi lagi di memory. Data akan di-duplikasi dan dialokasikan ke alamat memory baru, jadinya kurang efisien. Ditambah lagi, jika kita mengacu ke penjelasan pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/basic-memory-management#a324-heap-memory"},"Memory Management \u279c Heap Memory"),", data ",(0,t.kt)("inlineCode",{parentName:"p"},"String")," isinya disimpan di heap memory yang pengaksesannya lebih lambat dibanding pengaksesan data stack. Dari sini bisa disimpulkan bahwa cloning bukan solusi yang paling baik (kecuali terpaksa)."),(0,t.kt)("p",null,(0,t.kt)("strong",{parentName:"p"},"Solusi yang lebih baik adalah dengan melakukan operasi pinjam data dari owner aslinya tanpa perlu melakukan operasi perpindahan owner"),", yang pada Rust programming disebut dengan ",(0,t.kt)("strong",{parentName:"p"},"borrowing"),"."),(0,t.kt)("p",null,"Kita sebenarnya sudah menerapkannya beberapa kali pada chapter yang lalu, tapi kita akan bahas lagi lebih detail (dari sudut pandang ownership) pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/borrowing"},"Borrowing"),"."),(0,t.kt)("h2",{id:"a348-ownership-pada-data-literal"},"A.34.8. Ownership pada data literal"),(0,t.kt)("p",null,"Kita akan bahas topik ini pada chapter berikutnya, yaitu chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/borrowing#a347-owner-dan-borrower-pada-literal"},"Borrowing"),"."),(0,t.kt)("h2",{id:"a349-move-semantics-pada-macro-println"},"A.34.9. ",(0,t.kt)("em",{parentName:"h2"},"Move semantics")," pada macro ",(0,t.kt)("inlineCode",{parentName:"h2"},"println")),(0,t.kt)("p",null,"Ada yang unik dengan macro ",(0,t.kt)("inlineCode",{parentName:"p"},"println"),". Silakan coba kode berikut agar terlihat keunikannya."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let str1 = String::from("luwe");\n println!("{str1}");\n do_something(str1);\n \n let str2 = String::from("ngelak");\n do_something(str2);\n println!("{str2}");\n}\n\nfn do_something(str: String) {\n println!("{}", str);\n}\n')),(0,t.kt)("p",null,"Jika dijalankan ada error di statement terakhir fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Ownership",src:n(8255).Z,width:"883",height:"682"})),(0,t.kt)("p",null,"Seperti yang sudah dibahas, bahwa tipe ",(0,t.kt)("inlineCode",{parentName:"p"},"String")," mengadopsi move semantics. Ketika data bertipe ini digunakan pada operasi assignment seperti contohnya sebagai argument pemanggilan fungsi, maka owner berpindah."),(0,t.kt)("p",null,"Tapi entah kenapa, khusus dalam pemanggilan macro ",(0,t.kt)("inlineCode",{parentName:"p"},"println"),", owner-nya tidak berpindah. Ajaib."),(0,t.kt)("p",null,"Silakan lihat sendiri di gambar di atas, ketika ",(0,t.kt)("inlineCode",{parentName:"p"},"str1")," digunakan pada macro ",(0,t.kt)("inlineCode",{parentName:"p"},"println"),", kemudian digunakan lagi pada argument pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something"),", hasilnya tidak error."),(0,t.kt)("p",null,"Akan tetapi ketika digunakan pada pemanggilan fungsi terlebih dahulu, jika digunakan lagi di statement di bawahnya hasilnya error."),(0,t.kt)("p",null,"Ini adalah keistimewaan dari macro ",(0,t.kt)("inlineCode",{parentName:"p"},"println")," dan beberapa macro untuk keperluan printing lainnya."),(0,t.kt)("p",null,"Lebih jelasnya mengenai macro dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"#/wip/macro"},"Macro"),"."),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/ownership"},"github.com/novalagung/dasarpemrogramanrust-example/../ownership")),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html"},"https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/marker/trait.Copy.html"},"https://doc.rust-lang.org/std/marker/trait.Copy.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/nomicon/ownership.html"},"https://doc.rust-lang.org/nomicon/ownership.html"))))}o.isMDXComponent=!0},1146:(a,e,n)=>{n.d(e,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAU0AAABuCAIAAAAs3da/AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA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=n.p+"assets/images/ownership-2-b8db9994157f3e86c2a74d048ca45363.png"},5914:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/ownership-3-f9834609466195e2d46433bbc089153c.png"},3760:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/ownership-4-90c3dccbd5f0429a8760c9a445f446af.png"},8255:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/ownership-5-42080e6ebdac72f8d756dcf0dacb2061.png"}}]); \ No newline at end of file diff --git a/assets/js/8333ea4d.79e6ada8.js b/assets/js/8333ea4d.79e6ada8.js deleted file mode 100644 index 3f9e8750..00000000 --- a/assets/js/8333ea4d.79e6ada8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[9323],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>s});var n=a(7294);function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function r(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?l(Object(a),!0).forEach((function(t){i(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):l(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function p(e,t){if(null==e)return{};var a,n,i=function(e,t){if(null==e)return{};var a,n,i={},l=Object.keys(e);for(n=0;n<l.length;n++)a=l[n],t.indexOf(a)>=0||(i[a]=e[a]);return i}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)a=l[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}var u=n.createContext({}),A=function(e){var t=n.useContext(u),a=t;return e&&(a="function"==typeof e?e(t):r(r({},t),e)),a},d=function(e){var t=A(e.components);return n.createElement(u.Provider,{value:t},e.children)},k={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},b=n.forwardRef((function(e,t){var a=e.components,i=e.mdxType,l=e.originalType,u=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),b=A(a),s=i,c=b["".concat(u,".").concat(s)]||b[s]||k[s]||l;return a?n.createElement(c,r(r({ref:t},d),{},{components:a})):n.createElement(c,r({ref:t},d))}));function s(e,t){var a=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var l=a.length,r=new Array(l);r[0]=b;var p={};for(var u in t)hasOwnProperty.call(t,u)&&(p[u]=t[u]);p.originalType=e,p.mdxType="string"==typeof e?e:i,r[1]=p;for(var A=2;A<l;A++)r[A]=a[A];return n.createElement.apply(null,r)}return n.createElement.apply(null,a)}b.displayName="MDXCreateElement"},7485:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>r,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>A});var n=a(7462),i=(a(7294),a(3905));const l={sidebar_position:15,title:"A.15. Tipe Data \u279c Tuple",sidebar_label:"A.15. Tuple"},r=void 0,p={unversionedId:"basic/tuple",id:"basic/tuple",title:"A.15. Tipe Data \u279c Tuple",description:"Pada chapter ini kita akan membahas tentang tipe data kolektif bernama Tuple.",source:"@site/docs/basic/tuple.md",sourceDirName:"basic",slug:"/basic/tuple",permalink:"/basic/tuple",draft:!1,tags:[],version:"current",sidebarPosition:15,frontMatter:{sidebar_position:15,title:"A.15. Tipe Data \u279c Tuple",sidebar_label:"A.15. Tuple"},sidebar:"tutorialSidebar",previous:{title:"A.14. Slice (Basic)",permalink:"/basic/slice"},next:{title:"A.16. Vector",permalink:"/basic/vector"}},u={},A=[{value:"A.15.1. Tipe data tuple",id:"a151-tipe-data-tuple",level:2},{value:"A.15.2. Mutable tuple",id:"a152-mutable-tuple",level:2},{value:"A.15.3. Notasi deklarasi tuple",id:"a153-notasi-deklarasi-tuple",level:2},{value:"\u25c9 Type inference",id:"-type-inference",level:3},{value:"\u25c9 Manifest typing",id:"-manifest-typing",level:3},{value:"\u25c9 Packing tuple",id:"-packing-tuple",level:3},{value:"\u25c9 Unpacking tuple",id:"-unpacking-tuple",level:3},{value:"A.15.4. Tuple <code>()</code>",id:"a154-tuple-",level:2},{value:"A.15.5. Tuple Structs",id:"a155-tuple-structs",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:A};function k(e){let{components:t,...l}=e;return(0,i.kt)("wrapper",(0,n.Z)({},d,l,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan membahas tentang tipe data kolektif bernama Tuple."),(0,i.kt)("h2",{id:"a151-tipe-data-tuple"},"A.15.1. Tipe data tuple"),(0,i.kt)("p",null,"Tuple merupakan tipe data yang isinya koleksi dari banyak data atau value, yang bisa jadi tiap value tersebut tipe datanya berbeda satu sama lain. Tuple biasa digunakan untuk menampung data yang ",(0,i.kt)("em",{parentName:"p"},"heterogeneous")," atau campuran."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Tipe ini tidak diciptakan sebagai pengganti array."),(0,i.kt)("p",{parentName:"blockquote"},"Cukup mudah untuk mengidentifikasi kapan harus menggunakan tuple, contohnya: jika ada kebutuhan data harus bisa di-iterate, atau data memiliki pattern yg pasti seperti size-nya fixed, atau tipe datanya ",(0,i.kt)("em",{parentName:"p"},"homogeneous")," atau sejenis, ... maka baiknya gunakan tipe data array atau slice.")),(0,i.kt)("p",null,"Tuple dibuat dengan notasi penulisan diapit tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"(")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},")"),". Contoh deklarasi tuple:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let tuple_a = ("jason", 27, ["racing", "working out"], true);\nprintln!("tuple_a: {:?}", tuple_a);\n')),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"tuple_a")," di atas bertipe data tuple, dengan tipe data spesifik per-elemennya bervariasi, ada string, numerik, array ",(0,i.kt)("inlineCode",{parentName:"p"},"[&str; 2]"),", dan boolean."),(0,i.kt)("p",null,"Untuk menampilkan nilai per-elemen, gunakan notasi ",(0,i.kt)("inlineCode",{parentName:"p"},".N")," yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"N")," merupakan indeks elemen. Contohnya seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'println!("index 0: {:?}", tuple_a.0);\nprintln!("index 1: {:?}", tuple_a.1);\nprintln!("index 2: {:?} {:?}", tuple_a.2[0], tuple_a.2[1]);\nprintln!("index 3: {:?}", tuple_a.3);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"tuple",src:a(5607).Z,width:"811",height:"433"})),(0,i.kt)("p",null,"Data pada ",(0,i.kt)("inlineCode",{parentName:"p"},"tuple_a")," indeks ke-2 bertipe slice, untuk mengakses tiap elemennya bisa menggunakan notasi pengaksesan indeks array/slice seperti biasa."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Tuple ",(0,i.kt)("inlineCode",{parentName:"li"},"tuple_a.2")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},'["racing", "working out"]')),(0,i.kt)("li",{parentName:"ul"},"Tuple ",(0,i.kt)("inlineCode",{parentName:"li"},"tuple_a.2[0]")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},'"racing"')),(0,i.kt)("li",{parentName:"ul"},"Tuple ",(0,i.kt)("inlineCode",{parentName:"li"},"tuple_a.2[1]")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},'"working out"'))),(0,i.kt)("h2",{id:"a152-mutable-tuple"},"A.15.2. Mutable tuple"),(0,i.kt)("p",null,"Cara untuk membuat tuple menjadi data yang mutable adalah dengan menambahkan ",(0,i.kt)("inlineCode",{parentName:"p"},"mut")," pada saat deklarasi. Pada contoh berikut variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"tuple_b")," dideklarasikan sebagai mutable dengan teknik ",(0,i.kt)("em",{parentName:"p"},"manifest typing"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut tuple_b: (&str, i32, [&str; 2], bool) = ("default", 0, [""; 2], false);\ntuple_b.0 = "damian";\ntuple_b.1 = 18;\ntuple_b.2 = ["gaming", "adventuring"];\ntuple_b.3 = true;\n\nprintln!("tuple_b: {:?}", tuple_b);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"tuple",src:a(8923).Z,width:"460",height:"123"})),(0,i.kt)("h2",{id:"a153-notasi-deklarasi-tuple"},"A.15.3. Notasi deklarasi tuple"),(0,i.kt)("p",null,"Ada beberapa cara yang bisa digunakan dalam deklarasi tuple."),(0,i.kt)("h3",{id:"-type-inference"},"\u25c9 Type inference"),(0,i.kt)("p",null,"Cara pertama menggunakan teknik ",(0,i.kt)("em",{parentName:"p"},"type inference")," seperti yang sudah dipraktikkan pada contoh pertama."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let tuple_a = ("jason", 27, ["racing", "working out"], true);\n')),(0,i.kt)("h3",{id:"-manifest-typing"},"\u25c9 Manifest typing"),(0,i.kt)("p",null,"Bisa juga menggunakan teknik deklarasi ",(0,i.kt)("em",{parentName:"p"},"manifest typing"),", biasanya diterapkan pada pembuatan mutable tuple dengan ",(0,i.kt)("em",{parentName:"p"},"predefined value")," adalah nilai kosong seperti empty string, 0, dan lainnya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let tuple_b: (&str, i32, [&str; 2], bool) = ("damian", 18, ["gaming", "adventuring"], true);\n')),(0,i.kt)("p",null,"Contoh lain:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut tuple_b: (&str, i32, [&str; 2], bool) = ("default", 0, [""; 2], false);\ntuple_b.0 = "damian";\ntuple_b.1 = 18;\ntuple_b.2 = ["gaming", "adventuring"];\ntuple_b.3 = true;\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"tuple",src:a(6333).Z,width:"464",height:"166"})),(0,i.kt)("h3",{id:"-packing-tuple"},"\u25c9 Packing tuple"),(0,i.kt)("p",null,"Adalah cara pembuatan tuple yang mana nilai elemenya bersumber dari variabel lain."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let name = "grayson";\nlet age = 29;\nlet hobbies = ["sleeping", "parkour"];\n\nlet tuple_c = (name, age, hobbies);\n\nprintln!("name : {:?}", tuple_c.0);\nprintln!("age : {:?}", tuple_c.1);\nprintln!("hobbies : {:?}", tuple_c.2);\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Istilah packing tuple bukan resmi dari official Rust. Istilah ini penulis buat sendiri.")),(0,i.kt)("h3",{id:"-unpacking-tuple"},"\u25c9 Unpacking tuple"),(0,i.kt)("p",null,"Unpacking tuple adalah kebalikan dari packing tuple. Data tuple didistribusikan ke banyak variabel dalam 1 baris deklarasi."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let tuple_d = ("stephanie", 28, ["software engineering"], false);\nlet (name, age, hobbies, is_male) = tuple_d;\n\nprintln!("name : {:?}", name);\nprintln!("age : {:?}", age);\nprintln!("hobbies : {:?}", hobbies);\nprintln!("is_male : {:?}", is_male);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"tuple",src:a(3437).Z,width:"463",height:"166"})),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pada bahasa lain teknik ini biasa disebut dengan destructuring assignment")),(0,i.kt)("h2",{id:"a154-tuple-"},"A.15.4. Tuple ",(0,i.kt)("inlineCode",{parentName:"h2"},"()")),(0,i.kt)("p",null,"Tuple bisa didefinisikan dengan tanpa isi dengan menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"()"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let tuple_d = ();\nprintln!("{:?}", tuple_d);\n')),(0,i.kt)("h2",{id:"a155-tuple-structs"},"A.15.5. Tuple Structs"),(0,i.kt)("p",null,"Pembahasan mengenai tuple structs dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/struct#a247-tuple-struct"},"Struct"),"."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/tuple"},"github.com/novalagung/dasarpemrogramanrust-example/../tuple")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/primitive.tuple.html"},"https://doc.rust-lang.org/std/primitive.tuple.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/primitives/tuples.html"},"https://doc.rust-lang.org/rust-by-example/primitives/tuples.html"))))}k.isMDXComponent=!0},5607:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/tuple-1-3234f50043ed15a37da7ad04884b7f8d.png"},8923:(e,t,a)=>{a.d(t,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcwAAAB7CAIAAAB2ASeoAAAACXBIWXMAAA7EAA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49jD40vN2tf04MD8BALPHqJ5ukBH5ZhixeLbBUGriUi7ZMNs+DvFsAMC7guTYlhd7Hkbkeyezx4lny0uMj+Puk7xLfNuD8hMAMHtAAwwAAIIAOgkAABAEo31y1y703AW3jgAA1x6sJAAAQBBgJQEAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAILgfwCoSF56a7OxngAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/8333ea4d.a3dd6a75.js b/assets/js/8333ea4d.a3dd6a75.js new file mode 100644 index 00000000..48e75102 --- /dev/null +++ b/assets/js/8333ea4d.a3dd6a75.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[9323],{3905:(e,a,t)=>{t.d(a,{Zo:()=>d,kt:()=>s});var n=t(7294);function i(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function l(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function r(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?l(Object(t),!0).forEach((function(a){i(e,a,t[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}))}return e}function p(e,a){if(null==e)return{};var t,n,i=function(e,a){if(null==e)return{};var t,n,i={},l=Object.keys(e);for(n=0;n<l.length;n++)t=l[n],a.indexOf(t)>=0||(i[t]=e[t]);return i}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)t=l[n],a.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var u=n.createContext({}),A=function(e){var a=n.useContext(u),t=a;return e&&(t="function"==typeof e?e(a):r(r({},a),e)),t},d=function(e){var a=A(e.components);return n.createElement(u.Provider,{value:a},e.children)},k={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},b=n.forwardRef((function(e,a){var t=e.components,i=e.mdxType,l=e.originalType,u=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),b=A(t),s=i,c=b["".concat(u,".").concat(s)]||b[s]||k[s]||l;return t?n.createElement(c,r(r({ref:a},d),{},{components:t})):n.createElement(c,r({ref:a},d))}));function s(e,a){var t=arguments,i=a&&a.mdxType;if("string"==typeof e||i){var l=t.length,r=new Array(l);r[0]=b;var p={};for(var u in a)hasOwnProperty.call(a,u)&&(p[u]=a[u]);p.originalType=e,p.mdxType="string"==typeof e?e:i,r[1]=p;for(var A=2;A<l;A++)r[A]=t[A];return n.createElement.apply(null,r)}return n.createElement.apply(null,t)}b.displayName="MDXCreateElement"},7485:(e,a,t)=>{t.r(a),t.d(a,{assets:()=>u,contentTitle:()=>r,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>A});var n=t(7462),i=(t(7294),t(3905));const l={sidebar_position:15,title:"A.15. Tipe Data \u279c Tuple",sidebar_label:"A.15. Tuple"},r=void 0,p={unversionedId:"basic/tuple",id:"basic/tuple",title:"A.15. Tipe Data \u279c Tuple",description:"Pada chapter ini kita akan membahas tentang tipe data kolektif bernama Tuple.",source:"@site/docs/basic/tuple.md",sourceDirName:"basic",slug:"/basic/tuple",permalink:"/basic/tuple",draft:!1,tags:[],version:"current",sidebarPosition:15,frontMatter:{sidebar_position:15,title:"A.15. Tipe Data \u279c Tuple",sidebar_label:"A.15. Tuple"},sidebar:"tutorialSidebar",previous:{title:"A.14. Slice (Basic)",permalink:"/basic/slice"},next:{title:"A.16. Vector",permalink:"/basic/vector"}},u={},A=[{value:"A.15.1. Tipe data tuple",id:"a151-tipe-data-tuple",level:2},{value:"A.15.2. Mutable tuple",id:"a152-mutable-tuple",level:2},{value:"A.15.3. Notasi deklarasi tuple",id:"a153-notasi-deklarasi-tuple",level:2},{value:"\u25c9 Type inference",id:"-type-inference",level:3},{value:"\u25c9 Manifest typing",id:"-manifest-typing",level:3},{value:"\u25c9 Packing tuple",id:"-packing-tuple",level:3},{value:"\u25c9 Unpacking tuple",id:"-unpacking-tuple",level:3},{value:"A.15.4. Tuple <code>()</code>",id:"a154-tuple-",level:2},{value:"A.15.5. Tuple Structs",id:"a155-tuple-structs",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:A};function k(e){let{components:a,...l}=e;return(0,i.kt)("wrapper",(0,n.Z)({},d,l,{components:a,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan membahas tentang tipe data kolektif bernama Tuple."),(0,i.kt)("h2",{id:"a151-tipe-data-tuple"},"A.15.1. Tipe data tuple"),(0,i.kt)("p",null,"Tuple merupakan tipe data yang isinya koleksi dari banyak data atau value, yang bisa jadi tiap value tersebut tipe datanya berbeda satu sama lain. Tuple biasa digunakan untuk menampung data yang ",(0,i.kt)("em",{parentName:"p"},"heterogeneous")," atau campuran."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Tipe ini tidak diciptakan sebagai pengganti array."),(0,i.kt)("p",{parentName:"blockquote"},"Cukup mudah untuk mengidentifikasi kapan harus menggunakan tuple, contohnya: jika ada kebutuhan data harus bisa di-iterate, atau data memiliki pattern yg pasti seperti size-nya fixed, atau tipe datanya ",(0,i.kt)("em",{parentName:"p"},"homogeneous")," atau sejenis, ... maka baiknya gunakan tipe data array atau slice.")),(0,i.kt)("p",null,"Tuple dibuat dengan notasi penulisan diapit tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"(")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},")"),". Contoh deklarasi tuple:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let tuple_a = ("jason", 27, ["racing", "working out"], true);\nprintln!("tuple_a: {:?}", tuple_a);\n')),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"tuple_a")," di atas bertipe data tuple, dengan tipe data spesifik per-elemennya bervariasi, ada string, numerik, array ",(0,i.kt)("inlineCode",{parentName:"p"},"[&str; 2]"),", dan boolean."),(0,i.kt)("p",null,"Untuk menampilkan nilai per-elemen, gunakan notasi ",(0,i.kt)("inlineCode",{parentName:"p"},".N")," yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"N")," merupakan indeks elemen. Contohnya seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'println!("index 0: {:?}", tuple_a.0);\nprintln!("index 1: {:?}", tuple_a.1);\nprintln!("index 2: {:?} {:?}", tuple_a.2[0], tuple_a.2[1]);\nprintln!("index 3: {:?}", tuple_a.3);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"tuple",src:t(5607).Z,width:"811",height:"433"})),(0,i.kt)("p",null,"Data pada ",(0,i.kt)("inlineCode",{parentName:"p"},"tuple_a")," indeks ke-2 bertipe slice, untuk mengakses tiap elemennya bisa menggunakan notasi pengaksesan indeks array/slice seperti biasa."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Tuple ",(0,i.kt)("inlineCode",{parentName:"li"},"tuple_a.2")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},'["racing", "working out"]')),(0,i.kt)("li",{parentName:"ul"},"Tuple ",(0,i.kt)("inlineCode",{parentName:"li"},"tuple_a.2[0]")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},'"racing"')),(0,i.kt)("li",{parentName:"ul"},"Tuple ",(0,i.kt)("inlineCode",{parentName:"li"},"tuple_a.2[1]")," nilainya ",(0,i.kt)("inlineCode",{parentName:"li"},'"working out"'))),(0,i.kt)("h2",{id:"a152-mutable-tuple"},"A.15.2. Mutable tuple"),(0,i.kt)("p",null,"Cara untuk membuat tuple menjadi data yang mutable adalah dengan menambahkan ",(0,i.kt)("inlineCode",{parentName:"p"},"mut")," pada saat deklarasi. Pada contoh berikut variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"tuple_b")," dideklarasikan sebagai mutable dengan teknik ",(0,i.kt)("em",{parentName:"p"},"manifest typing"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut tuple_b: (&str, i32, [&str; 2], bool) = ("default", 0, [""; 2], false);\ntuple_b.0 = "damian";\ntuple_b.1 = 18;\ntuple_b.2 = ["gaming", "adventuring"];\ntuple_b.3 = true;\n\nprintln!("tuple_b: {:?}", tuple_b);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"tuple",src:t(8923).Z,width:"460",height:"123"})),(0,i.kt)("h2",{id:"a153-notasi-deklarasi-tuple"},"A.15.3. Notasi deklarasi tuple"),(0,i.kt)("p",null,"Ada beberapa cara yang bisa digunakan dalam deklarasi tuple."),(0,i.kt)("h3",{id:"-type-inference"},"\u25c9 Type inference"),(0,i.kt)("p",null,"Cara pertama menggunakan teknik ",(0,i.kt)("em",{parentName:"p"},"type inference")," seperti yang sudah dipraktikkan pada contoh pertama."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let tuple_a = ("jason", 27, ["racing", "working out"], true);\n')),(0,i.kt)("h3",{id:"-manifest-typing"},"\u25c9 Manifest typing"),(0,i.kt)("p",null,"Bisa juga menggunakan teknik deklarasi ",(0,i.kt)("em",{parentName:"p"},"manifest typing"),", biasanya diterapkan pada pembuatan mutable tuple dengan ",(0,i.kt)("em",{parentName:"p"},"predefined value")," adalah nilai kosong seperti empty string, 0, dan lainnya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let tuple_b: (&str, i32, [&str; 2], bool) = ("damian", 18, ["gaming", "adventuring"], true);\n')),(0,i.kt)("p",null,"Contoh lain:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut tuple_b: (&str, i32, [&str; 2], bool) = ("default", 0, [""; 2], false);\ntuple_b.0 = "damian";\ntuple_b.1 = 18;\ntuple_b.2 = ["gaming", "adventuring"];\ntuple_b.3 = true;\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"tuple",src:t(6333).Z,width:"464",height:"166"})),(0,i.kt)("h3",{id:"-packing-tuple"},"\u25c9 Packing tuple"),(0,i.kt)("p",null,"Adalah cara pembuatan tuple yang mana nilai elemenya bersumber dari variabel lain."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let name = "grayson";\nlet age = 29;\nlet hobbies = ["sleeping", "parkour"];\n\nlet tuple_c = (name, age, hobbies);\n\nprintln!("name : {:?}", tuple_c.0);\nprintln!("age : {:?}", tuple_c.1);\nprintln!("hobbies : {:?}", tuple_c.2);\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Istilah packing tuple bukan resmi dari official Rust. Istilah ini penulis buat sendiri.")),(0,i.kt)("h3",{id:"-unpacking-tuple"},"\u25c9 Unpacking tuple"),(0,i.kt)("p",null,"Unpacking tuple adalah kebalikan dari packing tuple. Data tuple didistribusikan ke banyak variabel dalam 1 baris deklarasi."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let tuple_d = ("stephanie", 28, ["software engineering"], false);\nlet (name, age, hobbies, is_male) = tuple_d;\n\nprintln!("name : {:?}", name);\nprintln!("age : {:?}", age);\nprintln!("hobbies : {:?}", hobbies);\nprintln!("is_male : {:?}", is_male);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"tuple",src:t(3437).Z,width:"463",height:"166"})),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pada bahasa lain teknik ini biasa disebut dengan destructuring assignment")),(0,i.kt)("h2",{id:"a154-tuple-"},"A.15.4. Tuple ",(0,i.kt)("inlineCode",{parentName:"h2"},"()")),(0,i.kt)("p",null,"Tuple bisa didefinisikan dengan tanpa isi dengan menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"()"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let tuple_d = ();\nprintln!("{:?}", tuple_d);\n')),(0,i.kt)("h2",{id:"a155-tuple-structs"},"A.15.5. Tuple Structs"),(0,i.kt)("p",null,"Pembahasan mengenai tuple structs dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/struct#a247-tuple-struct"},"Struct"),"."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/tuple"},"github.com/novalagung/dasarpemrogramanrust-example/../tuple")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/primitive.tuple.html"},"https://doc.rust-lang.org/std/primitive.tuple.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/primitives/tuples.html"},"https://doc.rust-lang.org/rust-by-example/primitives/tuples.html"))))}k.isMDXComponent=!0},5607:(e,a,t)=>{t.d(a,{Z:()=>n});const n=t.p+"assets/images/tuple-1-3234f50043ed15a37da7ad04884b7f8d.png"},8923:(e,a,t)=>{t.d(a,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA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LNdxeQlsYdG0iW27UH6CQCYNYbdkzCwyPduebtYGod49jD40vN2tf04MD8BALPHqJ5ukBH5ZhixeLbBUGriUi7ZMNs+DvFsAMC7guTYlhd7Hkbkeyezx4lny0uMj+Puk7xLfNuD8hMAMHtAAwwAAIIAOgkAABAEo31y1y703AW3jgAA1x6sJAAAQBBgJQEAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAILgfwCoSF56a7OxngAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/87499f15.8912c8b7.js b/assets/js/87499f15.8912c8b7.js new file mode 100644 index 00000000..825b6ce6 --- /dev/null +++ b/assets/js/87499f15.8912c8b7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[7742],{3905:(a,e,n)=>{n.d(e,{Zo:()=>u,kt:()=>k});var i=n(7294);function t(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function l(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,i)}return n}function r(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){t(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function m(a,e){if(null==a)return{};var n,i,t=function(a,e){if(null==a)return{};var n,i,t={},l=Object.keys(a);for(i=0;i<l.length;i++)n=l[i],e.indexOf(n)>=0||(t[n]=a[n]);return t}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(i=0;i<l.length;i++)n=l[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(t[n]=a[n])}return t}var p=i.createContext({}),d=function(a){var e=i.useContext(p),n=e;return a&&(n="function"==typeof a?a(e):r(r({},e),a)),n},u=function(a){var e=d(a.components);return i.createElement(p.Provider,{value:e},a.children)},s={inlineCode:"code",wrapper:function(a){var e=a.children;return i.createElement(i.Fragment,{},e)}},A=i.forwardRef((function(a,e){var n=a.components,t=a.mdxType,l=a.originalType,p=a.parentName,u=m(a,["components","mdxType","originalType","parentName"]),A=d(n),k=t,g=A["".concat(p,".").concat(k)]||A[k]||s[k]||l;return n?i.createElement(g,r(r({ref:e},u),{},{components:n})):i.createElement(g,r({ref:e},u))}));function k(a,e){var n=arguments,t=e&&e.mdxType;if("string"==typeof a||t){var l=n.length,r=new Array(l);r[0]=A;var m={};for(var p in e)hasOwnProperty.call(e,p)&&(m[p]=e[p]);m.originalType=a,m.mdxType="string"==typeof a?a:t,r[1]=m;for(var d=2;d<l;d++)r[d]=n[d];return i.createElement.apply(null,r)}return i.createElement.apply(null,n)}A.displayName="MDXCreateElement"},67:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>p,contentTitle:()=>r,default:()=>s,frontMatter:()=>l,metadata:()=>m,toc:()=>d});var i=n(7462),t=(n(7294),n(3905));const l={sidebar_position:4,title:"A.4. Variabel",sidebar_label:"A.4. Variabel"},r=void 0,m={unversionedId:"basic/variabel",id:"basic/variabel",title:"A.4. Variabel",description:"Rust merupakan bahasa yang kalau dikategorikan berdasarkan type system-nya adalah statically typed, yang artinya semua tipe data harus diketahui saat kompilasi (compile time).",source:"@site/docs/basic/variabel.md",sourceDirName:"basic",slug:"/basic/variabel",permalink:"/basic/variabel",draft:!1,tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4,title:"A.4. Variabel",sidebar_label:"A.4. Variabel"},sidebar:"tutorialSidebar",previous:{title:"A.3. Komentar",permalink:"/basic/komentar"},next:{title:"A.5. Tipe Data \u279c Primitive Scalar",permalink:"/basic/tipe-data-primitive-scalar"}},p={},d=[{value:"A.4.1. Deklarasi variabel menggunakan <code>let</code>",id:"a41-deklarasi-variabel-menggunakan-let",level:2},{value:"\u25c9 Aturan penamaan variabel (naming convention)",id:"-aturan-penamaan-variabel-naming-convention",level:3},{value:"\u25c9 Macro <code>println</code> untuk print string",id:"-macro-println-untuk-print-string",level:3},{value:"A.4.2. <em>Immutability</em> pada variabel",id:"a42-immutability-pada-variabel",level:2},{value:"A.4.3. Keyword <code>mut</code>",id:"a43-keyword-mut",level:2},{value:"\u25c9 Argument parameter macro <code>println</code>",id:"-argument-parameter-macro-println",level:3},{value:"A.4.4. <em>Type Inference</em> vs <em>Manifest Typing</em>",id:"a44-type-inference-vs-manifest-typing",level:2},{value:"\u25c9 Metode <em>Type Inference</em>",id:"-metode-type-inference",level:3},{value:"\u25c9 Metode <em>Manifest Typing</em>",id:"-metode-manifest-typing",level:3},{value:"A.4.5. Deklarasi variabel tanpa <em>predefined value</em>",id:"a45-deklarasi-variabel-tanpa-predefined-value",level:2},{value:"A.4.6. Deklarasi banyak variabel dalam satu statement",id:"a46-deklarasi-banyak-variabel-dalam-satu-statement",level:2},{value:"A.4.7. Deklarasi variabel dengan tipe data ditentukan dari value",id:"a47-deklarasi-variabel-dengan-tipe-data-ditentukan-dari-value",level:2},{value:"A.4.8. Variable <em>Shadowing</em>",id:"a48-variable-shadowing",level:2},{value:"A.4.9. Variabel <code>_</code>",id:"a49-variabel-_",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Work in progress",id:"-work-in-progress",level:3},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],u={toc:d};function s(a){let{components:e,...l}=a;return(0,t.kt)("wrapper",(0,i.Z)({},u,l,{components:e,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Rust merupakan bahasa yang kalau dikategorikan berdasarkan ",(0,t.kt)("em",{parentName:"p"},"type system"),"-nya adalah ",(0,t.kt)("em",{parentName:"p"},"statically typed"),", yang artinya semua tipe data harus diketahui saat kompilasi (compile time)."),(0,t.kt)("p",null,"Pada chapter ini kita akan belajar mengenai variabel pada Rust, cara deklarasinya, dan juga mengenai ",(0,t.kt)("em",{parentName:"p"},"immutability")," variabel."),(0,t.kt)("h2",{id:"a41-deklarasi-variabel-menggunakan-let"},"A.4.1. Deklarasi variabel menggunakan ",(0,t.kt)("inlineCode",{parentName:"h2"},"let")),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"let")," digunakan untuk deklarasi variabel. Notasinya kurang lebih seperti berikut. Di contoh ini sebuah variabel bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_variabel")," didefinisikan dan diisi nilainya dengan sebuah string ",(0,t.kt)("inlineCode",{parentName:"p"},'"predefined value"'),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let nama_variabel = "predefined value";\n println!(nama_variabel);\n}\n')),(0,t.kt)("p",null,"Ok, sekarang coba jalankan, dan lanjut ke pembahasan di bawah."),(0,t.kt)("h3",{id:"-aturan-penamaan-variabel-naming-convention"},"\u25c9 Aturan penamaan variabel (naming convention)"),(0,t.kt)("p",null,(0,t.kt)("a",{parentName:"p",href:"https://rust-lang.github.io/api-guidelines/naming.html"},(0,t.kt)("em",{parentName:"a"},"Naming convention"))," variabel di Rust adalah ",(0,t.kt)("strong",{parentName:"p"},"snake case"),". Nama variabel dituliskan dalam huruf kecil dengan separator tanda garis bawah atau underscore (",(0,t.kt)("inlineCode",{parentName:"p"},"_"),"). Contohnya seperti: ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_variabel"),", ",(0,t.kt)("inlineCode",{parentName:"p"},"hasil_operasi_pembagian"),", ",(0,t.kt)("inlineCode",{parentName:"p"},"kota_kelahiran"),", dll."),(0,t.kt)("h3",{id:"-macro-println-untuk-print-string"},"\u25c9 Macro ",(0,t.kt)("inlineCode",{parentName:"h3"},"println")," untuk print string"),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"eager",fetchpriority:"high",alt:"variabel rust",src:n(7281).Z,width:"455",height:"228"})),(0,t.kt)("p",null,"Error? kok bisa?"),(0,t.kt)("p",null,"Perlu diketahui bahwa pada penggunaan macro ",(0,t.kt)("inlineCode",{parentName:"p"},"println"),", parameter pertama wajib diisi dengan sebuah ",(0,t.kt)("strong",{parentName:"p"},"string literal"),". Contohnya seperti ",(0,t.kt)("inlineCode",{parentName:"p"},'"Hello, world!"'),". String literal yang ditampung terlebih dahulu dalam variabel, kemudian variabel-nya di print, akan menghasilkan error, contohnya seperti di atas."),(0,t.kt)("p",null,"Solusinya bagaimana? ya tetap menggunakan string literal, tapi dengan menerapkan teknik ",(0,t.kt)("strong",{parentName:"p"},"formatted print"),"."),(0,t.kt)("p",null,"Sekarang ubah kode menjadi seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let nama_variabel = "predefined value";\nprintln!("{}", nama_variabel);\n')),(0,t.kt)("p",null,"Bisa dilihat argument pertama statement macro ",(0,t.kt)("inlineCode",{parentName:"p"},"println")," adalah string literal ",(0,t.kt)("inlineCode",{parentName:"p"},'"{}"'),". String ",(0,t.kt)("inlineCode",{parentName:"p"},"{}")," pada macro tersebut akan di-replace dengan isi argument setelahnya, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_variabel"),"."),(0,t.kt)("p",null,"Jika dijalankan, maka hasilnya tidak ada error dan menampilkan output sesuai harapan."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"string literal println",src:n(3283).Z,width:"473",height:"137"})),(0,t.kt)("p",null,"Ok sekarang kembali ke topik, yaitu perihal variabel."),(0,t.kt)("h2",{id:"a42-immutability-pada-variabel"},"A.4.2. ",(0,t.kt)("em",{parentName:"h2"},"Immutability")," pada variabel"),(0,t.kt)("p",null,"Tulis kode berikut. Ada 2 variabel yang dideklarasikan, ",(0,t.kt)("inlineCode",{parentName:"p"},"message_number")," yang isinya numerik, dan ",(0,t.kt)("inlineCode",{parentName:"p"},"message1")," yang isinya string."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let message_number = 1;\nlet message1 = "hello";\nprintln!("message number {}: {}", message_number, message1);\n')),(0,t.kt)("p",null,"Jalankan, hasilnya tidak ada error, aman."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"var immutability",src:n(5394).Z,width:"467",height:"119"})),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"O iya, jika ingin menampilkan banyak variabel via macro ",(0,t.kt)("inlineCode",{parentName:"p"},"println"),", manfaatkan string ",(0,t.kt)("inlineCode",{parentName:"p"},"{}"),"."),(0,t.kt)("p",{parentName:"blockquote"},"Tulis ",(0,t.kt)("inlineCode",{parentName:"p"},"{}")," sejumlah variabel yang ingin ditampilkan, pada output string ",(0,t.kt)("inlineCode",{parentName:"p"},"{}")," akan di-replace oleh variabel yang disisipkan pada argument saat pemanggilan macro ",(0,t.kt)("inlineCode",{parentName:"p"},"println")," secara berurutan."),(0,t.kt)("p",{parentName:"blockquote"},"Pada contoh di atas, string ",(0,t.kt)("inlineCode",{parentName:"p"},'"message number {}: {}"'),(0,t.kt)("br",null)," ... akan menjadi ",(0,t.kt)("inlineCode",{parentName:"p"},'"message number {message_number}: {message1}"'),(0,t.kt)("br",null)," ... kemudian menghasilkan ",(0,t.kt)("inlineCode",{parentName:"p"},'"message number 1: hello"'))),(0,t.kt)("p",null,"Sekarang ubah isi ",(0,t.kt)("inlineCode",{parentName:"p"},"message_number")," menjadi ",(0,t.kt)("inlineCode",{parentName:"p"},"2")," lalu siapkan juga variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"message2"),", kurang lebih kodenya menjadi seperti berikut, kemudian jalankan."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let message_number = 1;\nlet message1 = "hello";\nprintln!("message number {}: {}", message_number, message1);\n\nmessage_number = 2;\nlet message2 = "world";\nprintln!("message number {}: {}", message_number, message2);\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"var immutability",src:n(6204).Z,width:"585",height:"308"})),(0,t.kt)("p",null,"Error? kok bisa?"),(0,t.kt)("p",null,"Perlu diketahui, bahwa ",(0,t.kt)("em",{parentName:"p"},"by default")," semua variabel adalah ",(0,t.kt)("em",{parentName:"p"},"immutable"),". Immutable itu artinya gak bisa diubah nilai/value-nya. Jadi mirip seperti konstanta."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Variabel immutable mirip seperti konstanta, tapi sebenarnya berbeda. Akan kita bahas lebih detail di beberapa chapter berbeda perihal perbedaannya.")),(0,t.kt)("p",null,"Lalu bagaimana cara agar nilai variabel bisa diubah? Caranya dengan menambahkan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"mut")," (yang merupakan kependekan dari ",(0,t.kt)("em",{parentName:"p"},"mutable"),") saat pendefinisian variabel tersebut."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Catatan tambahan:"),(0,t.kt)("ul",{parentName:"blockquote"},(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Operasi assignment pada variabel immutable hanya boleh dilakukan sekali. Dan pada kode di atas telah dicontohkan caranya bagaimana. Variabel dideklarasikan sekaligus diisi nilainya.")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Perlu diketahui bahwa sebenarnya diperbolehkan untuk memecah statement deklarasi variable dan assignment nilai sebagai 2 statement terpisah. Lebih jelasnya dibahas setelah ini pada section ",(0,t.kt)("a",{parentName:"p",href:"/basic/variabel#a45-deklarasi-variabel-tanpa-predefined-value"},"section A.4.5"),".")))),(0,t.kt)("h2",{id:"a43-keyword-mut"},"A.4.3. Keyword ",(0,t.kt)("inlineCode",{parentName:"h2"},"mut")),(0,t.kt)("p",null,"Ok, mari kita coba, ubah statement deklarasi variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"message_number"),", tambahkan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"mut"),". Lalu jalankan ulang program."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let mut message_number = 1;\nlet message1 = "hello";\nprintln!("message number {}: {}", message_number, message1);\n\nmessage_number = 2;\nlet message2 = "world";\nprintln!("message number {}: {}", message_number, message2);\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"mut keyword",src:n(3264).Z,width:"470",height:"132"})),(0,t.kt)("p",null,"Ok, sekarang tidak muncul error."),(0,t.kt)("p",null,"Dengan menggunakan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"let mut")," pada pendefinisian ",(0,t.kt)("inlineCode",{parentName:"p"},"message_number"),", membuat variabel tersebut menjadi mutable atau bisa diubah nilainya."),(0,t.kt)("h3",{id:"-argument-parameter-macro-println"},"\u25c9 Argument parameter macro ",(0,t.kt)("inlineCode",{parentName:"h3"},"println")),(0,t.kt)("p",null,"Selanjutnya, coba tambahkan lagi 1 message baru pada program yang sudah dibuat, lalu run."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let mut message_number = 1;\nlet message1 = "hello";\nprintln!("message number {}: {}", message_number, message1);\n\nmessage_number = 2;\nlet message2 = "world";\nprintln!("message number {}: {}", message_number, message2);\n\nmessage_number = 3;\nlet message3: i8 = 24;\nprintln!("message number {1}: {0}", message3, message_number);\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"formatted print macro `println`",src:n(4247).Z,width:"470",height:"154"})),(0,t.kt)("p",null,"Jika dilihat ada yg berbeda pada cara deklarasi variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"message3")," dan juga pada statement ",(0,t.kt)("inlineCode",{parentName:"p"},"println")," untuk ",(0,t.kt)("inlineCode",{parentName:"p"},"message3")," yang di situ digunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"{1}")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"{0}"),", tidak seperti sebelumnya yg menggunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"{}"),". Kita akan bahas yg ke-2 terlebih dahulu."),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Jika menggunakan ",(0,t.kt)("inlineCode",{parentName:"li"},"{}"),", maka string akan di-replace sesuai urutan argument pada pemanggilan ",(0,t.kt)("inlineCode",{parentName:"li"},"println"),"."),(0,t.kt)("li",{parentName:"ul"},"Jika menggunakan ",(0,t.kt)("inlineCode",{parentName:"li"},"{0}"),", maka string akan di-replace dengan data pada argument ke ",(0,t.kt)("inlineCode",{parentName:"li"},"1")," pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"println"),", yang pada contoh di atas adalah ",(0,t.kt)("inlineCode",{parentName:"li"},"message3"),"."),(0,t.kt)("li",{parentName:"ul"},"Jika menggunakan ",(0,t.kt)("inlineCode",{parentName:"li"},"{1}"),", maka string akan di-replace dengan data pada argument ke ",(0,t.kt)("inlineCode",{parentName:"li"},"2")," pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"println"),", yang pada contoh di atas adalah ",(0,t.kt)("inlineCode",{parentName:"li"},"message_number"),"."),(0,t.kt)("li",{parentName:"ul"},"Jika menggunakan ",(0,t.kt)("inlineCode",{parentName:"li"},"{n}"),", maka string akan di-replace dengan data pada argument ke ",(0,t.kt)("inlineCode",{parentName:"li"},"n+1")," pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"println"),".")),(0,t.kt)("p",null,"Dengan ini maka 3 statement berbeda berikut akan menghasilkan output yang sama:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'println!("message number {}: {}", message_number, message3);\nprintln!("message number {0}: {1}", message_number, message3);\nprintln!("message number {1}: {0}", message3, message_number);\n')),(0,t.kt)("p",null,"Sekarang perihal perbedaan cara deklarasi ",(0,t.kt)("inlineCode",{parentName:"p"},"message3")," akan kita bahas di bawah ini."),(0,t.kt)("h2",{id:"a44-type-inference-vs-manifest-typing"},"A.4.4. ",(0,t.kt)("em",{parentName:"h2"},"Type Inference")," vs ",(0,t.kt)("em",{parentName:"h2"},"Manifest Typing")),(0,t.kt)("p",null,"Rust mendukung dua metode deklarasi variabel, yaitu ",(0,t.kt)("em",{parentName:"p"},"type inference")," dan ",(0,t.kt)("em",{parentName:"p"},"manifest typing"),"."),(0,t.kt)("h3",{id:"-metode-type-inference"},"\u25c9 Metode ",(0,t.kt)("em",{parentName:"h3"},"Type Inference")),(0,t.kt)("p",null,"Penulisan variabel dengan metode ini ditandai dengan tidak menuliskan tipe data secara jelas/eksplisit. Contoh:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let var1 = "hello" // compiler akan secara cerdas mendeteksi var1 tipe data nya string\nlet var2 = 12 // compiler akan secara cerdas mendeteksi var2 tipe data nya numerik\n')),(0,t.kt)("p",null,"Metode deklarasi yang selama ini sudah kita terapkan adalah ",(0,t.kt)("em",{parentName:"p"},"type inference"),"."),(0,t.kt)("h3",{id:"-metode-manifest-typing"},"\u25c9 Metode ",(0,t.kt)("em",{parentName:"h3"},"Manifest Typing")),(0,t.kt)("p",null,"Metode ini mewajibkan programmer untuk menuliskan secara jelas/eksplisit tipe data variabel. Contoh penerapannya bisa dilihat di praktik sebelumnya, pada definisi variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"message3"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"let message3: i8 = 24;\n")),(0,t.kt)("p",null,"Notasi penulisan tipe data adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"namavariabel: tipedata"),". Contoh seperti di atas, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"let message3: i8 = 24")," artinya variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"message3")," didefinisikan memiliki tipe data ",(0,t.kt)("inlineCode",{parentName:"p"},"i8"),"."),(0,t.kt)("p",null,(0,t.kt)("inlineCode",{parentName:"p"},"i8")," merupakan salah satu tipe data dari sekian banyak tipe data yang ada di Rust. Lebih jelasnya kita akan bahas pada chapter selanjutnya."),(0,t.kt)("h2",{id:"a45-deklarasi-variabel-tanpa-predefined-value"},"A.4.5. Deklarasi variabel tanpa ",(0,t.kt)("em",{parentName:"h2"},"predefined value")),(0,t.kt)("p",null,"Sesuai dengan penjelasan di ",(0,t.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/error-index.html#E0381"},"dokumentasi spesifikasi Rust"),", variable yang tidak ada value-nya akan memunculkan error saat program di-run."),(0,t.kt)("p",null,"Meski demikian, diperbolehkan untuk memisahkan variable statement untuk deklarasi variable dan pengisian value. Sebagai contoh, statement ",(0,t.kt)("inlineCode",{parentName:"p"},"message_number")," pada kode berikut ..."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let message_number = 1;\nprintln!("message number {}", message_number);\n')),(0,t.kt)("p",null,"... boleh dituliskan dalam 2 statement terpisah seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let message_number: i32;\nmessage_number = 1;\nprintln!("message number {}", message_number);\n')),(0,t.kt)("p",null,"Intinya, operasi assignment hanya diperbolehkan 1x saja pada variabel ",(0,t.kt)("em",{parentName:"p"},"immutable"),", baik itu saat deklarasi variable atau setelahnya."),(0,t.kt)("h2",{id:"a46-deklarasi-banyak-variabel-dalam-satu-statement"},"A.4.6. Deklarasi banyak variabel dalam satu statement"),(0,t.kt)("p",null,"Di Rust memungkinkan untuk mendefinisikan banyak variabel dalam 1 baris statement. Notasi penulisannya seperti berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let (var1, var2) = (24, "hello");\nprintln!("var1: {0}", var1); // hasilnya => var1: 24\nprintln!("var2: {0}", var2); // hasilnya => var2: hello\n')),(0,t.kt)("p",null,"Pendefinisian banyak variabel dalam 1 statement dilakukan dengan menuliskan semua variabelnya dengan separator tanda ",(0,t.kt)("inlineCode",{parentName:"p"},",")," dan diapit tanda kurung ",(0,t.kt)("inlineCode",{parentName:"p"},"()"),"."),(0,t.kt)("p",null,"Sebagai contoh di atas 2 variabel didefinisikan, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"var1")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"var2"),", dan keduanya memiliki value yang berbeda tipe-datanya."),(0,t.kt)("p",null,"Bisa juga saat definisi variabel sekaligus ditentukan tipe data variabel, notasi penulisan bisa dilihat pada contoh kode berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let (var3, var4): (i8, i8) = (32, 12);\nprintln!("var3: {0}", var3); // hasilnya => var3: 32\nprintln!("var4: {0}", var4); // hasilnya => var4: 12\n')),(0,t.kt)("p",null,"Dengan notasi ini bisa juga untuk definisi variabel ",(0,t.kt)("em",{parentName:"p"},"mutable"),". Cukup tambahkan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"mut")," pada variabel yang ingin bisa diubah nilainya."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let (var5, mut var6, var7): (i8, i8, i8) = (64, 12, 4);\nprintln!("var5: {0}", var5); // hasilnya => var5: 64\nprintln!("var6: {0}", var6); // hasilnya => var6: 12\nvar6 = 24;\nprintln!("var6: {0}", var6); // hasilnya => var6: 24\nprintln!("var7: {0}", var7); // hasilnya => var7: 4\n')),(0,t.kt)("h2",{id:"a47-deklarasi-variabel-dengan-tipe-data-ditentukan-dari-value"},"A.4.7. Deklarasi variabel dengan tipe data ditentukan dari value"),(0,t.kt)("p",null,"Ini merupakan salah satu alternatif cara penulisan untuk men-specify tipe data variabel, caranya dengan menuliskan tipe data tepat setelah value, contohnya seperti berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let data1 = 24i8;\nprintln!("data1: {0}", data1); // hasilnya => data1: 24\n')),(0,t.kt)("p",null,"Variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"data")," didefinisikan dengan predefined value adalah numerik ",(0,t.kt)("inlineCode",{parentName:"p"},"24")," dengan tipe data ",(0,t.kt)("inlineCode",{parentName:"p"},"i8"),", penulisan value nya menjadi ",(0,t.kt)("inlineCode",{parentName:"p"},"24i8"),"."),(0,t.kt)("p",null,"Boleh juga menggunakan separator ",(0,t.kt)("inlineCode",{parentName:"p"},"_")," dalam penulisan value-nya sebagai pembatas antara nilai dan tipe data, contoh:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let data1 = 24_i8;\nprintln!("data1: {0}", data1); // hasilnya => data1: 24\n')),(0,t.kt)("h2",{id:"a48-variable-shadowing"},"A.4.8. Variable ",(0,t.kt)("em",{parentName:"h2"},"Shadowing")),(0,t.kt)("p",null,"Di Rust ada konsep bernama ",(0,t.kt)("strong",{parentName:"p"},"variable shadowing"),". Shadowing sendiri adalah pendefinisan ulang variabel yang sebelumnya sudah didefinisikan. Biasanya teknik ini dipakai untuk isolasi variabel dalam sebuah blok kode."),(0,t.kt)("p",null,"Contoh shadowing bisa dilihat pada kode berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let x = 5;\nprintln!("x: {}", x); // hasilnya => x: 5\n\nlet x = x + 1;\nprintln!("x: {}", x); // hasilnya => x: 6\n')),(0,t.kt)("p",null,"Lebih jelasnya akan kita bahas pada chapter terpisah, yaitu ",(0,t.kt)("a",{parentName:"p",href:"/basic/shadowing"},"Shadowing"),"."),(0,t.kt)("h2",{id:"a49-variabel-_"},"A.4.9. Variabel ",(0,t.kt)("inlineCode",{parentName:"h2"},"_")),(0,t.kt)("p",null,"Di Rust, jika ada variabel yang dideklarasikan tapi tidak digunakan, maka muncul warning saat ekesekusi program."),(0,t.kt)("p",null,"Pada praktiknya, tidak semua variabel memang perlu untuk digunakan. Pada kasus tertentu suatu variabel harus tetap dideklarasikan untuk menampung suatu nilai meski tidak digunakan. Misalnya pada case dimana ada pemanggilan fungsi yang nilai baliknya tidak digunakan."),(0,t.kt)("p",null,"Untuk case seperti yang dijelaskan di atas, gunakan variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"_"),". Variabel ini berguna untuk menampung nilai yang tidak digunakan, untuk menghindari warning. Contoh:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn main() {\n let _ = run_something();\n}\n")),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-work-in-progress"},"\u25c9 Work in progress"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Variabel ",(0,t.kt)("inlineCode",{parentName:"li"},"_"))),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/variabel"},"github.com/novalagung/dasarpemrogramanrust-example/../variabel")),(0,t.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/shadowing"},"Shadowing")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"#/wip/macro"},"Macro")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"#/wip/formatted-print"},"Formatted Print"))),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html"},"https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/hello/print.html"},"https://doc.rust-lang.org/rust-by-example/hello/print.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/variable_bindings/scope.html"},"https://doc.rust-lang.org/rust-by-example/variable_bindings/scope.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/variables.html"},"https://doc.rust-lang.org/reference/variables.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"https://rust-lang.github.io/api-guidelines/naming.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/38045700/how-do-i-declare-multiple-mutable-variables-at-the-same-time"},"https://stackoverflow.com/questions/38045700/how-do-i-declare-multiple-mutable-variables-at-the-same-time"))))}s.isMDXComponent=!0},7281:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/variabel-1-c9d8201d5914e2a0da75b23e92fa5bb9.png"},3283:(a,e,n)=>{n.d(e,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdkAAACJCAIAAADv3NUWAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGI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XDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApvH/zux74reEzOEAAAAASUVORK5CYII="}}]); \ No newline at end of file diff --git a/assets/js/87499f15.91f9bc09.js b/assets/js/87499f15.91f9bc09.js deleted file mode 100644 index 6242b8a9..00000000 --- a/assets/js/87499f15.91f9bc09.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[7742],{3905:(a,e,n)=>{n.d(e,{Zo:()=>u,kt:()=>k});var i=n(7294);function t(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function l(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,i)}return n}function r(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){t(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function m(a,e){if(null==a)return{};var n,i,t=function(a,e){if(null==a)return{};var n,i,t={},l=Object.keys(a);for(i=0;i<l.length;i++)n=l[i],e.indexOf(n)>=0||(t[n]=a[n]);return t}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(i=0;i<l.length;i++)n=l[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(t[n]=a[n])}return t}var p=i.createContext({}),d=function(a){var e=i.useContext(p),n=e;return a&&(n="function"==typeof a?a(e):r(r({},e),a)),n},u=function(a){var e=d(a.components);return i.createElement(p.Provider,{value:e},a.children)},s={inlineCode:"code",wrapper:function(a){var e=a.children;return i.createElement(i.Fragment,{},e)}},A=i.forwardRef((function(a,e){var n=a.components,t=a.mdxType,l=a.originalType,p=a.parentName,u=m(a,["components","mdxType","originalType","parentName"]),A=d(n),k=t,g=A["".concat(p,".").concat(k)]||A[k]||s[k]||l;return n?i.createElement(g,r(r({ref:e},u),{},{components:n})):i.createElement(g,r({ref:e},u))}));function k(a,e){var n=arguments,t=e&&e.mdxType;if("string"==typeof a||t){var l=n.length,r=new Array(l);r[0]=A;var m={};for(var p in e)hasOwnProperty.call(e,p)&&(m[p]=e[p]);m.originalType=a,m.mdxType="string"==typeof a?a:t,r[1]=m;for(var d=2;d<l;d++)r[d]=n[d];return i.createElement.apply(null,r)}return i.createElement.apply(null,n)}A.displayName="MDXCreateElement"},67:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>p,contentTitle:()=>r,default:()=>s,frontMatter:()=>l,metadata:()=>m,toc:()=>d});var i=n(7462),t=(n(7294),n(3905));const l={sidebar_position:4,title:"A.4. Variabel",sidebar_label:"A.4. Variabel"},r=void 0,m={unversionedId:"basic/variabel",id:"basic/variabel",title:"A.4. Variabel",description:"Rust merupakan bahasa yang kalau dikategorikan berdasarkan type system-nya adalah statically typed, yang artinya semua tipe data harus diketahui saat kompilasi (compile time).",source:"@site/docs/basic/variabel.md",sourceDirName:"basic",slug:"/basic/variabel",permalink:"/basic/variabel",draft:!1,tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4,title:"A.4. Variabel",sidebar_label:"A.4. Variabel"},sidebar:"tutorialSidebar",previous:{title:"A.3. Komentar",permalink:"/basic/komentar"},next:{title:"A.5. Tipe Data \u279c Primitive Scalar",permalink:"/basic/tipe-data-primitive-scalar"}},p={},d=[{value:"A.4.1. Deklarasi variabel menggunakan <code>let</code>",id:"a41-deklarasi-variabel-menggunakan-let",level:2},{value:"\u25c9 Aturan penamaan variabel (naming convention)",id:"-aturan-penamaan-variabel-naming-convention",level:3},{value:"\u25c9 Macro <code>println</code> untuk print string",id:"-macro-println-untuk-print-string",level:3},{value:"A.4.2. <em>Immutability</em> pada variabel",id:"a42-immutability-pada-variabel",level:2},{value:"A.4.3. Keyword <code>mut</code>",id:"a43-keyword-mut",level:2},{value:"\u25c9 Argument parameter macro <code>println</code>",id:"-argument-parameter-macro-println",level:3},{value:"A.4.4. <em>Type Inference</em> vs <em>Manifest Typing</em>",id:"a44-type-inference-vs-manifest-typing",level:2},{value:"\u25c9 Metode <em>Type Inference</em>",id:"-metode-type-inference",level:3},{value:"\u25c9 Metode <em>Manifest Typing</em>",id:"-metode-manifest-typing",level:3},{value:"A.4.5. Deklarasi variabel tanpa <em>predefined value</em>",id:"a45-deklarasi-variabel-tanpa-predefined-value",level:2},{value:"A.4.6. Deklarasi banyak variabel dalam satu statement",id:"a46-deklarasi-banyak-variabel-dalam-satu-statement",level:2},{value:"A.4.7. Deklarasi variabel dengan tipe data ditentukan dari value",id:"a47-deklarasi-variabel-dengan-tipe-data-ditentukan-dari-value",level:2},{value:"A.4.8. Variable <em>Shadowing</em>",id:"a48-variable-shadowing",level:2},{value:"A.4.9. Variabel <code>_</code>",id:"a49-variabel-_",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Work in progress",id:"-work-in-progress",level:3},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],u={toc:d};function s(a){let{components:e,...l}=a;return(0,t.kt)("wrapper",(0,i.Z)({},u,l,{components:e,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Rust merupakan bahasa yang kalau dikategorikan berdasarkan ",(0,t.kt)("em",{parentName:"p"},"type system"),"-nya adalah ",(0,t.kt)("em",{parentName:"p"},"statically typed"),", yang artinya semua tipe data harus diketahui saat kompilasi (compile time)."),(0,t.kt)("p",null,"Pada chapter ini kita akan belajar mengenai variabel pada Rust, cara deklarasinya, dan juga mengenai ",(0,t.kt)("em",{parentName:"p"},"immutability")," variabel."),(0,t.kt)("h2",{id:"a41-deklarasi-variabel-menggunakan-let"},"A.4.1. Deklarasi variabel menggunakan ",(0,t.kt)("inlineCode",{parentName:"h2"},"let")),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"let")," digunakan untuk deklarasi variabel. Notasinya kurang lebih seperti berikut. Di contoh ini sebuah variabel bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_variabel")," didefinisikan dan diisi nilainya dengan sebuah string ",(0,t.kt)("inlineCode",{parentName:"p"},'"predefined value"'),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let nama_variabel = "predefined value";\n println!(nama_variabel);\n}\n')),(0,t.kt)("p",null,"Ok, sekarang coba jalankan, dan lanjut ke pembahasan di bawah."),(0,t.kt)("h3",{id:"-aturan-penamaan-variabel-naming-convention"},"\u25c9 Aturan penamaan variabel (naming convention)"),(0,t.kt)("p",null,(0,t.kt)("a",{parentName:"p",href:"https://rust-lang.github.io/api-guidelines/naming.html"},(0,t.kt)("em",{parentName:"a"},"Naming convention"))," variabel di Rust adalah ",(0,t.kt)("strong",{parentName:"p"},"snake case"),". Nama variabel dituliskan dalam huruf kecil dengan separator tanda garis bawah atau underscore (",(0,t.kt)("inlineCode",{parentName:"p"},"_"),"). Contohnya seperti: ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_variabel"),", ",(0,t.kt)("inlineCode",{parentName:"p"},"hasil_operasi_pembagian"),", ",(0,t.kt)("inlineCode",{parentName:"p"},"kota_kelahiran"),", dll."),(0,t.kt)("h3",{id:"-macro-println-untuk-print-string"},"\u25c9 Macro ",(0,t.kt)("inlineCode",{parentName:"h3"},"println")," untuk print string"),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"variabel rust",src:n(7281).Z,width:"455",height:"228"})),(0,t.kt)("p",null,"Error? kok bisa?"),(0,t.kt)("p",null,"Perlu diketahui bahwa pada penggunaan macro ",(0,t.kt)("inlineCode",{parentName:"p"},"println"),", parameter pertama wajib diisi dengan sebuah ",(0,t.kt)("strong",{parentName:"p"},"string literal"),". Contohnya seperti ",(0,t.kt)("inlineCode",{parentName:"p"},'"Hello, world!"'),". String literal yang ditampung terlebih dahulu dalam variabel, kemudian variabel-nya di print, akan menghasilkan error, contohnya seperti di atas."),(0,t.kt)("p",null,"Solusinya bagaimana? ya tetap menggunakan string literal, tapi dengan menerapkan teknik ",(0,t.kt)("strong",{parentName:"p"},"formatted print"),"."),(0,t.kt)("p",null,"Sekarang ubah kode menjadi seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let nama_variabel = "predefined value";\nprintln!("{}", nama_variabel);\n')),(0,t.kt)("p",null,"Bisa dilihat argument pertama statement macro ",(0,t.kt)("inlineCode",{parentName:"p"},"println")," adalah string literal ",(0,t.kt)("inlineCode",{parentName:"p"},'"{}"'),". String ",(0,t.kt)("inlineCode",{parentName:"p"},"{}")," pada macro tersebut akan di-replace dengan isi argument setelahnya, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"nama_variabel"),"."),(0,t.kt)("p",null,"Jika dijalankan, maka hasilnya tidak ada error dan menampilkan output sesuai harapan."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"string literal println",src:n(3283).Z,width:"473",height:"137"})),(0,t.kt)("p",null,"Ok sekarang kembali ke topik, yaitu perihal variabel."),(0,t.kt)("h2",{id:"a42-immutability-pada-variabel"},"A.4.2. ",(0,t.kt)("em",{parentName:"h2"},"Immutability")," pada variabel"),(0,t.kt)("p",null,"Tulis kode berikut. Ada 2 variabel yang dideklarasikan, ",(0,t.kt)("inlineCode",{parentName:"p"},"message_number")," yang isinya numerik, dan ",(0,t.kt)("inlineCode",{parentName:"p"},"message1")," yang isinya string."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let message_number = 1;\nlet message1 = "hello";\nprintln!("message number {}: {}", message_number, message1);\n')),(0,t.kt)("p",null,"Jalankan, hasilnya tidak ada error, aman."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"var immutability",src:n(5394).Z,width:"467",height:"119"})),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"O iya, jika ingin menampilkan banyak variabel via macro ",(0,t.kt)("inlineCode",{parentName:"p"},"println"),", manfaatkan string ",(0,t.kt)("inlineCode",{parentName:"p"},"{}"),"."),(0,t.kt)("p",{parentName:"blockquote"},"Tulis ",(0,t.kt)("inlineCode",{parentName:"p"},"{}")," sejumlah variabel yang ingin ditampilkan, pada output string ",(0,t.kt)("inlineCode",{parentName:"p"},"{}")," akan di-replace oleh variabel yang disisipkan pada argument saat pemanggilan macro ",(0,t.kt)("inlineCode",{parentName:"p"},"println")," secara berurutan."),(0,t.kt)("p",{parentName:"blockquote"},"Pada contoh di atas, string ",(0,t.kt)("inlineCode",{parentName:"p"},'"message number {}: {}"'),(0,t.kt)("br",null)," ... akan menjadi ",(0,t.kt)("inlineCode",{parentName:"p"},'"message number {message_number}: {message1}"'),(0,t.kt)("br",null)," ... kemudian menghasilkan ",(0,t.kt)("inlineCode",{parentName:"p"},'"message number 1: hello"'))),(0,t.kt)("p",null,"Sekarang ubah isi ",(0,t.kt)("inlineCode",{parentName:"p"},"message_number")," menjadi ",(0,t.kt)("inlineCode",{parentName:"p"},"2")," lalu siapkan juga variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"message2"),", kurang lebih kodenya menjadi seperti berikut, kemudian jalankan."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let message_number = 1;\nlet message1 = "hello";\nprintln!("message number {}: {}", message_number, message1);\n\nmessage_number = 2;\nlet message2 = "world";\nprintln!("message number {}: {}", message_number, message2);\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"var immutability",src:n(6204).Z,width:"585",height:"308"})),(0,t.kt)("p",null,"Error? kok bisa?"),(0,t.kt)("p",null,"Perlu diketahui, bahwa ",(0,t.kt)("em",{parentName:"p"},"by default")," semua variabel adalah ",(0,t.kt)("em",{parentName:"p"},"immutable"),". Immutable itu artinya gak bisa diubah nilai/value-nya. Jadi mirip seperti konstanta."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Variabel immutable mirip seperti konstanta, tapi sebenarnya berbeda. Akan kita bahas lebih detail di beberapa chapter berbeda perihal perbedaannya.")),(0,t.kt)("p",null,"Lalu bagaimana cara agar nilai variabel bisa diubah? Caranya dengan menambahkan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"mut")," (yang merupakan kependekan dari ",(0,t.kt)("em",{parentName:"p"},"mutable"),") saat pendefinisian variabel tersebut."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Catatan tambahan:"),(0,t.kt)("ul",{parentName:"blockquote"},(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Operasi assignment pada variabel immutable hanya boleh dilakukan sekali. Dan pada kode di atas telah dicontohkan caranya bagaimana. Variabel dideklarasikan sekaligus diisi nilainya.")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Perlu diketahui bahwa sebenarnya diperbolehkan untuk memecah statement deklarasi variable dan assignment nilai sebagai 2 statement terpisah. Lebih jelasnya dibahas setelah ini pada section ",(0,t.kt)("a",{parentName:"p",href:"/basic/variabel#a45-deklarasi-variabel-tanpa-predefined-value"},"section A.4.5"),".")))),(0,t.kt)("h2",{id:"a43-keyword-mut"},"A.4.3. Keyword ",(0,t.kt)("inlineCode",{parentName:"h2"},"mut")),(0,t.kt)("p",null,"Ok, mari kita coba, ubah statement deklarasi variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"message_number"),", tambahkan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"mut"),". Lalu jalankan ulang program."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let mut message_number = 1;\nlet message1 = "hello";\nprintln!("message number {}: {}", message_number, message1);\n\nmessage_number = 2;\nlet message2 = "world";\nprintln!("message number {}: {}", message_number, message2);\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"mut keyword",src:n(3264).Z,width:"470",height:"132"})),(0,t.kt)("p",null,"Ok, sekarang tidak muncul error."),(0,t.kt)("p",null,"Dengan menggunakan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"let mut")," pada pendefinisian ",(0,t.kt)("inlineCode",{parentName:"p"},"message_number"),", membuat variabel tersebut menjadi mutable atau bisa diubah nilainya."),(0,t.kt)("h3",{id:"-argument-parameter-macro-println"},"\u25c9 Argument parameter macro ",(0,t.kt)("inlineCode",{parentName:"h3"},"println")),(0,t.kt)("p",null,"Selanjutnya, coba tambahkan lagi 1 message baru pada program yang sudah dibuat, lalu run."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let mut message_number = 1;\nlet message1 = "hello";\nprintln!("message number {}: {}", message_number, message1);\n\nmessage_number = 2;\nlet message2 = "world";\nprintln!("message number {}: {}", message_number, message2);\n\nmessage_number = 3;\nlet message3: i8 = 24;\nprintln!("message number {1}: {0}", message3, message_number);\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"formatted print macro `println`",src:n(4247).Z,width:"470",height:"154"})),(0,t.kt)("p",null,"Jika dilihat ada yg berbeda pada cara deklarasi variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"message3")," dan juga pada statement ",(0,t.kt)("inlineCode",{parentName:"p"},"println")," untuk ",(0,t.kt)("inlineCode",{parentName:"p"},"message3")," yang di situ digunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"{1}")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"{0}"),", tidak seperti sebelumnya yg menggunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"{}"),". Kita akan bahas yg ke-2 terlebih dahulu."),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Jika menggunakan ",(0,t.kt)("inlineCode",{parentName:"li"},"{}"),", maka string akan di-replace sesuai urutan argument pada pemanggilan ",(0,t.kt)("inlineCode",{parentName:"li"},"println"),"."),(0,t.kt)("li",{parentName:"ul"},"Jika menggunakan ",(0,t.kt)("inlineCode",{parentName:"li"},"{0}"),", maka string akan di-replace dengan data pada argument ke ",(0,t.kt)("inlineCode",{parentName:"li"},"1")," pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"println"),", yang pada contoh di atas adalah ",(0,t.kt)("inlineCode",{parentName:"li"},"message3"),"."),(0,t.kt)("li",{parentName:"ul"},"Jika menggunakan ",(0,t.kt)("inlineCode",{parentName:"li"},"{1}"),", maka string akan di-replace dengan data pada argument ke ",(0,t.kt)("inlineCode",{parentName:"li"},"2")," pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"println"),", yang pada contoh di atas adalah ",(0,t.kt)("inlineCode",{parentName:"li"},"message_number"),"."),(0,t.kt)("li",{parentName:"ul"},"Jika menggunakan ",(0,t.kt)("inlineCode",{parentName:"li"},"{n}"),", maka string akan di-replace dengan data pada argument ke ",(0,t.kt)("inlineCode",{parentName:"li"},"n+1")," pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"println"),".")),(0,t.kt)("p",null,"Dengan ini maka 3 statement berbeda berikut akan menghasilkan output yang sama:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'println!("message number {}: {}", message_number, message3);\nprintln!("message number {0}: {1}", message_number, message3);\nprintln!("message number {1}: {0}", message3, message_number);\n')),(0,t.kt)("p",null,"Sekarang perihal perbedaan cara deklarasi ",(0,t.kt)("inlineCode",{parentName:"p"},"message3")," akan kita bahas di bawah ini."),(0,t.kt)("h2",{id:"a44-type-inference-vs-manifest-typing"},"A.4.4. ",(0,t.kt)("em",{parentName:"h2"},"Type Inference")," vs ",(0,t.kt)("em",{parentName:"h2"},"Manifest Typing")),(0,t.kt)("p",null,"Rust mendukung dua metode deklarasi variabel, yaitu ",(0,t.kt)("em",{parentName:"p"},"type inference")," dan ",(0,t.kt)("em",{parentName:"p"},"manifest typing"),"."),(0,t.kt)("h3",{id:"-metode-type-inference"},"\u25c9 Metode ",(0,t.kt)("em",{parentName:"h3"},"Type Inference")),(0,t.kt)("p",null,"Penulisan variabel dengan metode ini ditandai dengan tidak menuliskan tipe data secara jelas/eksplisit. Contoh:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let var1 = "hello" // compiler akan secara cerdas mendeteksi var1 tipe data nya string\nlet var2 = 12 // compiler akan secara cerdas mendeteksi var2 tipe data nya numerik\n')),(0,t.kt)("p",null,"Metode deklarasi yang selama ini sudah kita terapkan adalah ",(0,t.kt)("em",{parentName:"p"},"type inference"),"."),(0,t.kt)("h3",{id:"-metode-manifest-typing"},"\u25c9 Metode ",(0,t.kt)("em",{parentName:"h3"},"Manifest Typing")),(0,t.kt)("p",null,"Metode ini mewajibkan programmer untuk menuliskan secara jelas/eksplisit tipe data variabel. Contoh penerapannya bisa dilihat di praktik sebelumnya, pada definisi variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"message3"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"let message3: i8 = 24;\n")),(0,t.kt)("p",null,"Notasi penulisan tipe data adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"namavariabel: tipedata"),". Contoh seperti di atas, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"let message3: i8 = 24")," artinya variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"message3")," didefinisikan memiliki tipe data ",(0,t.kt)("inlineCode",{parentName:"p"},"i8"),"."),(0,t.kt)("p",null,(0,t.kt)("inlineCode",{parentName:"p"},"i8")," merupakan salah satu tipe data dari sekian banyak tipe data yang ada di Rust. Lebih jelasnya kita akan bahas pada chapter selanjutnya."),(0,t.kt)("h2",{id:"a45-deklarasi-variabel-tanpa-predefined-value"},"A.4.5. Deklarasi variabel tanpa ",(0,t.kt)("em",{parentName:"h2"},"predefined value")),(0,t.kt)("p",null,"Sesuai dengan penjelasan di ",(0,t.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/error-index.html#E0381"},"dokumentasi spesifikasi Rust"),", variable yang tidak ada value-nya akan memunculkan error saat program di-run."),(0,t.kt)("p",null,"Meski demikian, diperbolehkan untuk memisahkan variable statement untuk deklarasi variable dan pengisian value. Sebagai contoh, statement ",(0,t.kt)("inlineCode",{parentName:"p"},"message_number")," pada kode berikut ..."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let message_number = 1;\nprintln!("message number {}", message_number);\n')),(0,t.kt)("p",null,"... boleh dituliskan dalam 2 statement terpisah seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let message_number: i32;\nmessage_number = 1;\nprintln!("message number {}", message_number);\n')),(0,t.kt)("p",null,"Intinya, operasi assignment hanya diperbolehkan 1x saja pada variabel ",(0,t.kt)("em",{parentName:"p"},"immutable"),", baik itu saat deklarasi variable atau setelahnya."),(0,t.kt)("h2",{id:"a46-deklarasi-banyak-variabel-dalam-satu-statement"},"A.4.6. Deklarasi banyak variabel dalam satu statement"),(0,t.kt)("p",null,"Di Rust memungkinkan untuk mendefinisikan banyak variabel dalam 1 baris statement. Notasi penulisannya seperti berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let (var1, var2) = (24, "hello");\nprintln!("var1: {0}", var1); // hasilnya => var1: 24\nprintln!("var2: {0}", var2); // hasilnya => var2: hello\n')),(0,t.kt)("p",null,"Pendefinisian banyak variabel dalam 1 statement dilakukan dengan menuliskan semua variabelnya dengan separator tanda ",(0,t.kt)("inlineCode",{parentName:"p"},",")," dan diapit tanda kurung ",(0,t.kt)("inlineCode",{parentName:"p"},"()"),"."),(0,t.kt)("p",null,"Sebagai contoh di atas 2 variabel didefinisikan, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"var1")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"var2"),", dan keduanya memiliki value yang berbeda tipe-datanya."),(0,t.kt)("p",null,"Bisa juga saat definisi variabel sekaligus ditentukan tipe data variabel, notasi penulisan bisa dilihat pada contoh kode berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let (var3, var4): (i8, i8) = (32, 12);\nprintln!("var3: {0}", var3); // hasilnya => var3: 32\nprintln!("var4: {0}", var4); // hasilnya => var4: 12\n')),(0,t.kt)("p",null,"Dengan notasi ini bisa juga untuk definisi variabel ",(0,t.kt)("em",{parentName:"p"},"mutable"),". Cukup tambahkan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"mut")," pada variabel yang ingin bisa diubah nilainya."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let (var5, mut var6, var7): (i8, i8, i8) = (64, 12, 4);\nprintln!("var5: {0}", var5); // hasilnya => var5: 64\nprintln!("var6: {0}", var6); // hasilnya => var6: 12\nvar6 = 24;\nprintln!("var6: {0}", var6); // hasilnya => var6: 24\nprintln!("var7: {0}", var7); // hasilnya => var7: 4\n')),(0,t.kt)("h2",{id:"a47-deklarasi-variabel-dengan-tipe-data-ditentukan-dari-value"},"A.4.7. Deklarasi variabel dengan tipe data ditentukan dari value"),(0,t.kt)("p",null,"Ini merupakan salah satu alternatif cara penulisan untuk men-specify tipe data variabel, caranya dengan menuliskan tipe data tepat setelah value, contohnya seperti berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let data1 = 24i8;\nprintln!("data1: {0}", data1); // hasilnya => data1: 24\n')),(0,t.kt)("p",null,"Variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"data")," didefinisikan dengan predefined value adalah numerik ",(0,t.kt)("inlineCode",{parentName:"p"},"24")," dengan tipe data ",(0,t.kt)("inlineCode",{parentName:"p"},"i8"),", penulisan value nya menjadi ",(0,t.kt)("inlineCode",{parentName:"p"},"24i8"),"."),(0,t.kt)("p",null,"Boleh juga menggunakan separator ",(0,t.kt)("inlineCode",{parentName:"p"},"_")," dalam penulisan value-nya sebagai pembatas antara nilai dan tipe data, contoh:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let data1 = 24_i8;\nprintln!("data1: {0}", data1); // hasilnya => data1: 24\n')),(0,t.kt)("h2",{id:"a48-variable-shadowing"},"A.4.8. Variable ",(0,t.kt)("em",{parentName:"h2"},"Shadowing")),(0,t.kt)("p",null,"Di Rust ada konsep bernama ",(0,t.kt)("strong",{parentName:"p"},"variable shadowing"),". Shadowing sendiri adalah pendefinisan ulang variabel yang sebelumnya sudah didefinisikan. Biasanya teknik ini dipakai untuk isolasi variabel dalam sebuah blok kode."),(0,t.kt)("p",null,"Contoh shadowing bisa dilihat pada kode berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let x = 5;\nprintln!("x: {}", x); // hasilnya => x: 5\n\nlet x = x + 1;\nprintln!("x: {}", x); // hasilnya => x: 6\n')),(0,t.kt)("p",null,"Lebih jelasnya akan kita bahas pada chapter terpisah, yaitu ",(0,t.kt)("a",{parentName:"p",href:"/basic/shadowing"},"Shadowing"),"."),(0,t.kt)("h2",{id:"a49-variabel-_"},"A.4.9. Variabel ",(0,t.kt)("inlineCode",{parentName:"h2"},"_")),(0,t.kt)("p",null,"Di Rust, jika ada variabel yang dideklarasikan tapi tidak digunakan, maka muncul warning saat ekesekusi program."),(0,t.kt)("p",null,"Pada praktiknya, tidak semua variabel memang perlu untuk digunakan. Pada kasus tertentu suatu variabel harus tetap dideklarasikan untuk menampung suatu nilai meski tidak digunakan. Misalnya pada case dimana ada pemanggilan fungsi yang nilai baliknya tidak digunakan."),(0,t.kt)("p",null,"Untuk case seperti yang dijelaskan di atas, gunakan variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"_"),". Variabel ini berguna untuk menampung nilai yang tidak digunakan, untuk menghindari warning. Contoh:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn main() {\n let _ = run_something();\n}\n")),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-work-in-progress"},"\u25c9 Work in progress"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Variabel ",(0,t.kt)("inlineCode",{parentName:"li"},"_"))),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/variabel"},"github.com/novalagung/dasarpemrogramanrust-example/../variabel")),(0,t.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/shadowing"},"Shadowing")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"#/wip/macro"},"Macro")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"#/wip/formatted-print"},"Formatted Print"))),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html"},"https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/hello/print.html"},"https://doc.rust-lang.org/rust-by-example/hello/print.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/variable_bindings/scope.html"},"https://doc.rust-lang.org/rust-by-example/variable_bindings/scope.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/variables.html"},"https://doc.rust-lang.org/reference/variables.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"https://rust-lang.github.io/api-guidelines/naming.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/38045700/how-do-i-declare-multiple-mutable-variables-at-the-same-time"},"https://stackoverflow.com/questions/38045700/how-do-i-declare-multiple-mutable-variables-at-the-same-time"))))}s.isMDXComponent=!0},7281:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/variabel-1-c9d8201d5914e2a0da75b23e92fa5bb9.png"},3283:(a,e,n)=>{n.d(e,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdkAAACJCAIAAADv3NUWAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5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TXtLTXOdpkihHh7cOATADSLZz01XJ9uDy6oLXuChZpli6OhOkpTnK7kgedYdIU3PdNBV5AAAfkGznpnuS7cHl1ZhA0gLVEKnHO7E535LTVUzedUaWgkVXqUjkhOY6AEMKJNv7Ldku+99myU1eyfaZGcrcTWWKrrmI077zuFPN9dTjHTkqFFxeVT76BAD0Gki291myfSki2ElSa28jf6ZYWhB86fgKpShzLSaU0kmiFLfmepAt2X5nTrJy9k48ffUad2cAAB0y2EppkGwHAJxoBvvVDEi2AwBONIO9CoZkOwDgRDPoLhgAAE4wgx2IAACAEw1cMAAAmAZcMAAAmAZcsA4nULIdADBQQLK93yj3eLSzw0NHp1P8k8F3RQAAJoJVcL+5GZNfuG4ptMlAR/E9uHxN2MlCaxKAYQKS7X2WbFeQerwTU8r7tJZs11F8Dy5fEygd/8YZu9qqXgDAwADJds0eScm9k2xfmvPW1SQ7Q3TAnyD+AMCQAcl2zR6ps3dRsl0+xXjBWxNaJyIeyXYlSsX3pQgcMABDCSTbuemaZHvtz8Hl1eTqTDsPz1SK70vxBVc6HoMDBmD4gGQ7N92TbJdJ3c1cExRi65w0KL4vzXnJTjXxSyKKJZMRqGkAMAxAsr3fku0KliKCXQqziK3hkGxvVnyvb7EQT98speMG4hkAADOBZHufJdtVfTe+mO9Q8R0AMFgMtlIaJNsBACeawX41A5LtAIATzWCvgiHZDgA40Qy6CwYAgBPMYAciAADgRAMXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApvH/zux74reEzOEAAAAASUVORK5CYII="}}]); \ No newline at end of file diff --git a/assets/js/8ad68633.70fea1d8.js b/assets/js/8ad68633.e365f7fa.js similarity index 93% rename from assets/js/8ad68633.70fea1d8.js rename to assets/js/8ad68633.e365f7fa.js index 0332f4b2..56d0dfd8 100644 --- a/assets/js/8ad68633.70fea1d8.js +++ b/assets/js/8ad68633.e365f7fa.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[2399],{3905:(e,a,t)=>{t.d(a,{Zo:()=>p,kt:()=>b});var n=t(7294);function r(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function i(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?i(Object(t),!0).forEach((function(a){r(e,a,t[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}))}return e}function o(e,a){if(null==e)return{};var t,n,r=function(e,a){if(null==e)return{};var t,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],a.indexOf(t)>=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],a.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=n.createContext({}),u=function(e){var a=n.useContext(l),t=a;return e&&(t="function"==typeof e?e(a):s(s({},a),e)),t},p=function(e){var a=u(e.components);return n.createElement(l.Provider,{value:a},e.children)},c={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},m=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),m=u(t),b=r,d=m["".concat(l,".").concat(b)]||m[b]||c[b]||i;return t?n.createElement(d,s(s({ref:a},p),{},{components:t})):n.createElement(d,s({ref:a},p))}));function b(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var i=t.length,s=new Array(i);s[0]=m;var o={};for(var l in a)hasOwnProperty.call(a,l)&&(o[l]=a[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,s[1]=o;for(var u=2;u<i;u++)s[u]=t[u];return n.createElement.apply(null,s)}return n.createElement.apply(null,t)}m.displayName="MDXCreateElement"},1606:(e,a,t)=>{t.r(a),t.d(a,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>i,metadata:()=>o,toc:()=>u});var n=t(7462),r=(t(7294),t(3905));const i={sidebar_position:6,title:"Lisensi & Distribusi Konten",sidebar_label:"Lisensi & Distribusi Konten"},s=void 0,o={unversionedId:"LICENSE",id:"LICENSE",title:"Lisensi & Distribusi Konten",description:"Ebook Dasar Pemrograman Rust gratis untuk disebarluaskan secara bebas, dengan catatan sesuai dengan aturan lisensi CC BY-SA 4.0 yang kurang lebih sebagai berikut:",source:"@site/docs/LICENSE.md",sourceDirName:".",slug:"/LICENSE",permalink:"/LICENSE",draft:!1,tags:[],version:"current",sidebarPosition:6,frontMatter:{sidebar_position:6,title:"Lisensi & Distribusi Konten",sidebar_label:"Lisensi & Distribusi Konten"},sidebar:"tutorialSidebar",previous:{title:"Download versi PDF",permalink:"/download-pdf"},next:{title:"Instalasi Rust",permalink:"/installation/instalasi-rust"}},l={},u=[],p={toc:u};function c(e){let{components:a,...t}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,t,{components:a,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Ebook Dasar Pemrograman Rust gratis untuk disebarluaskan secara bebas, dengan catatan sesuai dengan aturan lisensi CC BY-SA 4.0 yang kurang lebih sebagai berikut:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Diperbolehkan menyebar, mencetak, dan menduplikasi material dalam konten ini ke siapapun."),(0,r.kt)("li",{parentName:"ul"},"Diperbolehkan memodifikasi, mengubah, atau membuat konten baru menggunakan material yang ada dalam ebook ini untuk keperluan komersil maupun tidak.")),(0,r.kt)("p",null,"Dengan catatan:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Harus ada credit sumber aslinya, yaitu Dasar Pemrograman Rust atau novalagung"),(0,r.kt)("li",{parentName:"ul"},"Tidak mengubah lisensi aslinya, yaitu CC BY-SA 4.0"),(0,r.kt)("li",{parentName:"ul"},"Tidak ditambahi restrictions baru"),(0,r.kt)("li",{parentName:"ul"},"Lebih jelasnya silakan cek ",(0,r.kt)("a",{parentName:"li",href:"https://creativecommons.org/licenses/by-sa/4.0/"},"https://creativecommons.org/licenses/by-sa/4.0/"),".")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://app.fossa.io/projects/git%2Bgithub.com%2Fnovalagung%2Fdasarpemrogramanrust?ref=badge_large"},(0,r.kt)("img",{parentName:"a",src:"https://app.fossa.io/api/projects/git%2Bgithub.com%2Fnovalagung%2Fdasarpemrogramanrust.svg?type=large",alt:"FOSSA Status"}))))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[2399],{3905:(e,a,t)=>{t.d(a,{Zo:()=>p,kt:()=>b});var n=t(7294);function r(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function i(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?i(Object(t),!0).forEach((function(a){r(e,a,t[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}))}return e}function o(e,a){if(null==e)return{};var t,n,r=function(e,a){if(null==e)return{};var t,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],a.indexOf(t)>=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],a.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=n.createContext({}),u=function(e){var a=n.useContext(l),t=a;return e&&(t="function"==typeof e?e(a):s(s({},a),e)),t},p=function(e){var a=u(e.components);return n.createElement(l.Provider,{value:a},e.children)},c={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},m=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),m=u(t),b=r,g=m["".concat(l,".").concat(b)]||m[b]||c[b]||i;return t?n.createElement(g,s(s({ref:a},p),{},{components:t})):n.createElement(g,s({ref:a},p))}));function b(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var i=t.length,s=new Array(i);s[0]=m;var o={};for(var l in a)hasOwnProperty.call(a,l)&&(o[l]=a[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,s[1]=o;for(var u=2;u<i;u++)s[u]=t[u];return n.createElement.apply(null,s)}return n.createElement.apply(null,t)}m.displayName="MDXCreateElement"},1606:(e,a,t)=>{t.r(a),t.d(a,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>i,metadata:()=>o,toc:()=>u});var n=t(7462),r=(t(7294),t(3905));const i={sidebar_position:6,title:"Lisensi & Distribusi Konten",sidebar_label:"Lisensi & Distribusi Konten"},s=void 0,o={unversionedId:"LICENSE",id:"LICENSE",title:"Lisensi & Distribusi Konten",description:"Ebook Dasar Pemrograman Rust gratis untuk disebarluaskan secara bebas, dengan catatan sesuai dengan aturan lisensi CC BY-SA 4.0 yang kurang lebih sebagai berikut:",source:"@site/docs/LICENSE.md",sourceDirName:".",slug:"/LICENSE",permalink:"/LICENSE",draft:!1,tags:[],version:"current",sidebarPosition:6,frontMatter:{sidebar_position:6,title:"Lisensi & Distribusi Konten",sidebar_label:"Lisensi & Distribusi Konten"},sidebar:"tutorialSidebar",previous:{title:"Download versi PDF",permalink:"/download-pdf"},next:{title:"Instalasi Rust",permalink:"/installation/instalasi-rust"}},l={},u=[],p={toc:u};function c(e){let{components:a,...t}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,t,{components:a,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Ebook Dasar Pemrograman Rust gratis untuk disebarluaskan secara bebas, dengan catatan sesuai dengan aturan lisensi CC BY-SA 4.0 yang kurang lebih sebagai berikut:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Diperbolehkan menyebar, mencetak, dan menduplikasi material dalam konten ini ke siapapun."),(0,r.kt)("li",{parentName:"ul"},"Diperbolehkan memodifikasi, mengubah, atau membuat konten baru menggunakan material yang ada dalam ebook ini untuk keperluan komersil maupun tidak.")),(0,r.kt)("p",null,"Dengan catatan:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Harus ada credit sumber aslinya, yaitu Dasar Pemrograman Rust atau novalagung"),(0,r.kt)("li",{parentName:"ul"},"Tidak mengubah lisensi aslinya, yaitu CC BY-SA 4.0"),(0,r.kt)("li",{parentName:"ul"},"Tidak ditambahi restrictions baru"),(0,r.kt)("li",{parentName:"ul"},"Lebih jelasnya silakan cek ",(0,r.kt)("a",{parentName:"li",href:"https://creativecommons.org/licenses/by-sa/4.0/"},"https://creativecommons.org/licenses/by-sa/4.0/"),".")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://app.fossa.io/projects/git%2Bgithub.com%2Fnovalagung%2Fdasarpemrogramanrust?ref=badge_large"},(0,r.kt)("img",{parentName:"a",src:"https://app.fossa.io/api/projects/git%2Bgithub.com%2Fnovalagung%2Fdasarpemrogramanrust.svg?type=large",alt:"FOSSA Status",fetchpriority:"high",loading:"eager"}))))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8d193b98.19f369fd.js b/assets/js/8d193b98.5fd9290f.js similarity index 98% rename from assets/js/8d193b98.19f369fd.js rename to assets/js/8d193b98.5fd9290f.js index 127c65fb..7ac3e4f3 100644 --- a/assets/js/8d193b98.19f369fd.js +++ b/assets/js/8d193b98.5fd9290f.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[7505],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>k});var r=a(7294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function o(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?i(Object(a),!0).forEach((function(t){n(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function u(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a,r,n={},i=Object.keys(e);for(r=0;r<i.length;r++)a=i[r],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)a=i[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var l=r.createContext({}),p=function(e){var t=r.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},s=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,i=e.originalType,l=e.parentName,s=u(e,["components","mdxType","originalType","parentName"]),m=p(a),k=n,h=m["".concat(l,".").concat(k)]||m[k]||c[k]||i;return a?r.createElement(h,o(o({ref:t},s),{},{components:a})):r.createElement(h,o({ref:t},s))}));function k(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=a.length,o=new Array(i);o[0]=m;var u={};for(var l in t)hasOwnProperty.call(t,l)&&(u[l]=t[l]);u.originalType=e,u.mdxType="string"==typeof e?e:n,o[1]=u;for(var p=2;p<i;p++)o[p]=a[p];return r.createElement.apply(null,o)}return r.createElement.apply(null,a)}m.displayName="MDXCreateElement"},676:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>c,frontMatter:()=>i,metadata:()=>u,toc:()=>p});var r=a(7462),n=(a(7294),a(3905));const i={sidebar_position:4,title:"Contribution & Tech Stack",sidebar_label:"Contribution & Tech Stack"},o=void 0,u={unversionedId:"CONTRIBUTING",id:"CONTRIBUTING",title:"Contribution & Tech Stack",description:"Ebook Dasar Pemrograman Rust adalah project open source. Siapapun bebas untuk berkontribusi di sini, bisa dalam bentuk perbaikan typo, update kalimat, maupun submit tulisan baru.",source:"@site/docs/CONTRIBUTING.md",sourceDirName:".",slug:"/CONTRIBUTING",permalink:"/CONTRIBUTING",draft:!1,tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4,title:"Contribution & Tech Stack",sidebar_label:"Contribution & Tech Stack"},sidebar:"tutorialSidebar",previous:{title:"Version Changelogs & Updates",permalink:"/CHANGELOG"},next:{title:"Download versi PDF",permalink:"/download-pdf"}},l={},p=[{value:"Checkout project",id:"checkout-project",level:2},{value:"Maintainer",id:"maintainer",level:2},{value:"Contributors",id:"contributors",level:2},{value:"Ebook/webhook techstack & architecture",id:"ebookwebhook-techstack--architecture",level:2}],s={toc:p};function c(e){let{components:t,...a}=e;return(0,n.kt)("wrapper",(0,r.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("p",null,"Ebook Dasar Pemrograman Rust adalah project open source. Siapapun bebas untuk berkontribusi di sini, bisa dalam bentuk perbaikan typo, update kalimat, maupun submit tulisan baru."),(0,n.kt)("p",null,"Bagi kawan-kawan yang berminat untuk berkontribusi, silakan fork ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/novalagung/dasarpemrogramanrust"},"github.com/novalagung/dasarpemrogramanrust"),", kemudian langsung saja cek/buat issue kemudian submit relevan pull request untuk issue tersebut \ud83d\ude0a"),(0,n.kt)("h2",{id:"checkout-project"},"Checkout project"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre"},"git clone https://github.com/novalagung/dasarpemrogramanrust.git\ngit submodule update --init --recursive --remote\n")),(0,n.kt)("h2",{id:"maintainer"},"Maintainer"),(0,n.kt)("p",null,"E-book ini di-inisialisasi dan di-maintain oleh Noval Agung Prayogo."),(0,n.kt)("h2",{id:"contributors"},"Contributors"),(0,n.kt)("p",null,"Berikut merupakan hall of fame kontributor yang sudah berbaik hati menyisihkan waktunya untuk membantu pengembangan e-book ini."),(0,n.kt)("ol",null,(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/acepsaepudin"},"Acep Saepudin")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/afifurrohman-id"},"Afifurrohman")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/ardiantovn"},"ardiantovn")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/d0tf"},"Fal")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/nferdazel"},"Fredianto")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/iyansr"},"I Putu Saputrayana")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/indra87g"},"Indra Sah Noeldy")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/khisby"},"Khisby Al Ghofari")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/chud-lori"},"Lori")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/zakiego"},"M. Zakiyuddin Munziri")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/opakholis"},"Opa Kholis Majid")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/rian256"},"Rian")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/shandysiswandi"},"Shandy Siswandi")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/antheiz"},"Theis Andatu")),(0,n.kt)("li",{parentName:"ol"},"... anda :-)")),(0,n.kt)("h2",{id:"ebookwebhook-techstack--architecture"},"Ebook/webhook techstack & architecture"),(0,n.kt)("p",null,"Jika pembaca tertarik untuk membuat konten ebook berbasis web sekaligus versi PDF file-nya, bisa menggunakan link berikut sebagai referensi:"),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},(0,n.kt)("a",{parentName:"p",href:"https://medium.com/geekculture/serverless-e-book-web-book-using-docusaurus-v2-github-pages-actions-and-pdf-tools-4fef54847b85"},"https://medium.com/geekculture/serverless-e-book-web-book-using-docusaurus-v2-github-pages-actions-and-pdf-tools-4fef54847b85"))),(0,n.kt)("p",null,"Tools yang digunakan:"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Web-book engine \u279c ",(0,n.kt)("a",{parentName:"li",href:"https://docusaurus.io/"},"Docusaurus v2")),(0,n.kt)("li",{parentName:"ul"},"PDF generator \u279c ",(0,n.kt)("a",{parentName:"li",href:"https://www.princexml.com/"},"Prince XML")," + ",(0,n.kt)("a",{parentName:"li",href:"https://github.com/signcl/docusaurus-prince-pdf"},"docusaurus-prince-pdf")," + ",(0,n.kt)("a",{parentName:"li",href:"https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/"},"PDFtk")),(0,n.kt)("li",{parentName:"ul"},"Source code repository \u279c ",(0,n.kt)("a",{parentName:"li",href:"https://github.com/"},"GitHub")),(0,n.kt)("li",{parentName:"ul"},"Hosting \u279c ",(0,n.kt)("a",{parentName:"li",href:"https://pages.github.com/"},"GitHub Pages")),(0,n.kt)("li",{parentName:"ul"},"CI/CD pipeline \u279c ",(0,n.kt)("a",{parentName:"li",href:"https://github.com/features/actions"},"GitHub Actions")),(0,n.kt)("li",{parentName:"ul"},"Content Search \u279c ",(0,n.kt)("a",{parentName:"li",href:"https://docsearch.algolia.com/"},"Algolia DocSearch"))),(0,n.kt)("p",null,"Desain arsitektur:"),(0,n.kt)("p",null,(0,n.kt)("img",{parentName:"p",src:"https://raw.githubusercontent.com/novalagung/dasarpemrogramanrust/master/etc/base%20architecture.jpg",alt:"Dasar pemrograman python"})))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[7505],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>k});var r=a(7294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function o(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?i(Object(a),!0).forEach((function(t){n(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function u(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a,r,n={},i=Object.keys(e);for(r=0;r<i.length;r++)a=i[r],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)a=i[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var l=r.createContext({}),p=function(e){var t=r.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},s=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,i=e.originalType,l=e.parentName,s=u(e,["components","mdxType","originalType","parentName"]),m=p(a),k=n,h=m["".concat(l,".").concat(k)]||m[k]||c[k]||i;return a?r.createElement(h,o(o({ref:t},s),{},{components:a})):r.createElement(h,o({ref:t},s))}));function k(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=a.length,o=new Array(i);o[0]=m;var u={};for(var l in t)hasOwnProperty.call(t,l)&&(u[l]=t[l]);u.originalType=e,u.mdxType="string"==typeof e?e:n,o[1]=u;for(var p=2;p<i;p++)o[p]=a[p];return r.createElement.apply(null,o)}return r.createElement.apply(null,a)}m.displayName="MDXCreateElement"},676:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>c,frontMatter:()=>i,metadata:()=>u,toc:()=>p});var r=a(7462),n=(a(7294),a(3905));const i={sidebar_position:4,title:"Contribution & Tech Stack",sidebar_label:"Contribution & Tech Stack"},o=void 0,u={unversionedId:"CONTRIBUTING",id:"CONTRIBUTING",title:"Contribution & Tech Stack",description:"Ebook Dasar Pemrograman Rust adalah project open source. Siapapun bebas untuk berkontribusi di sini, bisa dalam bentuk perbaikan typo, update kalimat, maupun submit tulisan baru.",source:"@site/docs/CONTRIBUTING.md",sourceDirName:".",slug:"/CONTRIBUTING",permalink:"/CONTRIBUTING",draft:!1,tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4,title:"Contribution & Tech Stack",sidebar_label:"Contribution & Tech Stack"},sidebar:"tutorialSidebar",previous:{title:"Version Changelogs & Updates",permalink:"/CHANGELOG"},next:{title:"Download versi PDF",permalink:"/download-pdf"}},l={},p=[{value:"Checkout project",id:"checkout-project",level:2},{value:"Maintainer",id:"maintainer",level:2},{value:"Contributors",id:"contributors",level:2},{value:"Ebook/webhook techstack & architecture",id:"ebookwebhook-techstack--architecture",level:2}],s={toc:p};function c(e){let{components:t,...a}=e;return(0,n.kt)("wrapper",(0,r.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("p",null,"Ebook Dasar Pemrograman Rust adalah project open source. Siapapun bebas untuk berkontribusi di sini, bisa dalam bentuk perbaikan typo, update kalimat, maupun submit tulisan baru."),(0,n.kt)("p",null,"Bagi kawan-kawan yang berminat untuk berkontribusi, silakan fork ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/novalagung/dasarpemrogramanrust"},"github.com/novalagung/dasarpemrogramanrust"),", kemudian langsung saja cek/buat issue kemudian submit relevan pull request untuk issue tersebut \ud83d\ude0a"),(0,n.kt)("h2",{id:"checkout-project"},"Checkout project"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre"},"git clone https://github.com/novalagung/dasarpemrogramanrust.git\ngit submodule update --init --recursive --remote\n")),(0,n.kt)("h2",{id:"maintainer"},"Maintainer"),(0,n.kt)("p",null,"E-book ini di-inisialisasi dan di-maintain oleh Noval Agung Prayogo."),(0,n.kt)("h2",{id:"contributors"},"Contributors"),(0,n.kt)("p",null,"Berikut merupakan hall of fame kontributor yang sudah berbaik hati menyisihkan waktunya untuk membantu pengembangan e-book ini."),(0,n.kt)("ol",null,(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/acepsaepudin"},"Acep Saepudin")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/afifurrohman-id"},"Afifurrohman")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/ardiantovn"},"ardiantovn")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/d0tf"},"Fal")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/nferdazel"},"Fredianto")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/iyansr"},"I Putu Saputrayana")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/indra87g"},"Indra Sah Noeldy")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/khisby"},"Khisby Al Ghofari")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/chud-lori"},"Lori")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/zakiego"},"M. Zakiyuddin Munziri")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/opakholis"},"Opa Kholis Majid")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/rian256"},"Rian")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/shandysiswandi"},"Shandy Siswandi")),(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/antheiz"},"Theis Andatu")),(0,n.kt)("li",{parentName:"ol"},"... anda :-)")),(0,n.kt)("h2",{id:"ebookwebhook-techstack--architecture"},"Ebook/webhook techstack & architecture"),(0,n.kt)("p",null,"Jika pembaca tertarik untuk membuat konten ebook berbasis web sekaligus versi PDF file-nya, bisa menggunakan link berikut sebagai referensi:"),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},(0,n.kt)("a",{parentName:"p",href:"https://medium.com/geekculture/serverless-e-book-web-book-using-docusaurus-v2-github-pages-actions-and-pdf-tools-4fef54847b85"},"https://medium.com/geekculture/serverless-e-book-web-book-using-docusaurus-v2-github-pages-actions-and-pdf-tools-4fef54847b85"))),(0,n.kt)("p",null,"Tools yang digunakan:"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Web-book engine \u279c ",(0,n.kt)("a",{parentName:"li",href:"https://docusaurus.io/"},"Docusaurus v2")),(0,n.kt)("li",{parentName:"ul"},"PDF generator \u279c ",(0,n.kt)("a",{parentName:"li",href:"https://www.princexml.com/"},"Prince XML")," + ",(0,n.kt)("a",{parentName:"li",href:"https://github.com/signcl/docusaurus-prince-pdf"},"docusaurus-prince-pdf")," + ",(0,n.kt)("a",{parentName:"li",href:"https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/"},"PDFtk")),(0,n.kt)("li",{parentName:"ul"},"Source code repository \u279c ",(0,n.kt)("a",{parentName:"li",href:"https://github.com/"},"GitHub")),(0,n.kt)("li",{parentName:"ul"},"Hosting \u279c ",(0,n.kt)("a",{parentName:"li",href:"https://pages.github.com/"},"GitHub Pages")),(0,n.kt)("li",{parentName:"ul"},"CI/CD pipeline \u279c ",(0,n.kt)("a",{parentName:"li",href:"https://github.com/features/actions"},"GitHub Actions")),(0,n.kt)("li",{parentName:"ul"},"Content Search \u279c ",(0,n.kt)("a",{parentName:"li",href:"https://docsearch.algolia.com/"},"Algolia DocSearch"))),(0,n.kt)("p",null,"Desain arsitektur:"),(0,n.kt)("p",null,(0,n.kt)("img",{parentName:"p",src:"https://raw.githubusercontent.com/novalagung/dasarpemrogramanrust/master/etc/base%20architecture.jpg",alt:"Dasar pemrograman python",fetchpriority:"high",loading:"eager"})))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/93422b31.2fa67f2b.js b/assets/js/93422b31.2fa67f2b.js deleted file mode 100644 index 071632ee..00000000 --- a/assets/js/93422b31.2fa67f2b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[8469],{3905:(a,e,t)=>{t.d(e,{Zo:()=>d,kt:()=>c});var n=t(7294);function i(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function r(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),t.push.apply(t,n)}return t}function l(a){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?r(Object(t),!0).forEach((function(e){i(a,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(t,e))}))}return a}function u(a,e){if(null==a)return{};var t,n,i=function(a,e){if(null==a)return{};var t,n,i={},r=Object.keys(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||(i[t]=a[t]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(a,t)&&(i[t]=a[t])}return i}var p=n.createContext({}),s=function(a){var e=n.useContext(p),t=e;return a&&(t="function"==typeof a?a(e):l(l({},e),a)),t},d=function(a){var e=s(a.components);return n.createElement(p.Provider,{value:e},a.children)},o={inlineCode:"code",wrapper:function(a){var e=a.children;return n.createElement(n.Fragment,{},e)}},m=n.forwardRef((function(a,e){var t=a.components,i=a.mdxType,r=a.originalType,p=a.parentName,d=u(a,["components","mdxType","originalType","parentName"]),m=s(t),c=i,k=m["".concat(p,".").concat(c)]||m[c]||o[c]||r;return t?n.createElement(k,l(l({ref:e},d),{},{components:t})):n.createElement(k,l({ref:e},d))}));function c(a,e){var t=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=t.length,l=new Array(r);l[0]=m;var u={};for(var p in e)hasOwnProperty.call(e,p)&&(u[p]=e[p]);u.originalType=a,u.mdxType="string"==typeof a?a:i,l[1]=u;for(var s=2;s<r;s++)l[s]=t[s];return n.createElement.apply(null,l)}return n.createElement.apply(null,t)}m.displayName="MDXCreateElement"},1704:(a,e,t)=>{t.r(e),t.d(e,{assets:()=>p,contentTitle:()=>l,default:()=>o,frontMatter:()=>r,metadata:()=>u,toc:()=>s});var n=t(7462),i=(t(7294),t(3905));const r={sidebar_position:23,title:"A.23. Struct",sidebar_label:"A.23. Struct"},l=void 0,u={unversionedId:"basic/struct",id:"basic/struct",title:"A.23. Struct",description:"Pada chapter ini kita akan belajar tentang struct.",source:"@site/docs/basic/struct.md",sourceDirName:"basic",slug:"/basic/struct",permalink:"/basic/struct",draft:!1,tags:[],version:"current",sidebarPosition:23,frontMatter:{sidebar_position:23,title:"A.23. Struct",sidebar_label:"A.23. Struct"},sidebar:"tutorialSidebar",previous:{title:"A.22. Module System \u279c Scope & Akses Item",permalink:"/basic/module-scope-item-access"},next:{title:"A.24. Associated Function",permalink:"/basic/associated-function"}},p={},s=[{value:"A.23.1. Konsep Struct",id:"a231-konsep-struct",level:2},{value:"A.23.2. Pembuatan struct",id:"a232-pembuatan-struct",level:2},{value:"\u25c9 Fungsi <code>String::from()</code>",id:"-fungsi-stringfrom",level:3},{value:"\u25c9 <em>Naming convention</em> struct",id:"-naming-convention-struct",level:3},{value:"A.23.3. Mutable struct",id:"a233-mutable-struct",level:2},{value:"A.23.4. Macam-macam notasi deklarasi variabel struct",id:"a234-macam-macam-notasi-deklarasi-variabel-struct",level:2},{value:"\u25c9 <em>type inference</em> / <em>manifest typing</em>",id:"-type-inference--manifest-typing",level:3},{value:"\u25c9 Variabel struct tanpa <em>predefined value</em>",id:"-variabel-struct-tanpa-predefined-value",level:3},{value:"\u25c9 Variabel struct dengan nilai berasal dari struct lain",id:"-variabel-struct-dengan-nilai-berasal-dari-struct-lain",level:3},{value:"\u25c9 <em>Field init shorthand</em>",id:"-field-init-shorthand",level:3},{value:"\u25c9 Deklarasi nilai struct secara horizontal",id:"-deklarasi-nilai-struct-secara-horizontal",level:3},{value:"\u25c9 <em>Destructuring assignment</em>",id:"-destructuring-assignment",level:3},{value:"A.23.5. <em>Unit-like structs</em>",id:"a235-unit-like-structs",level:2},{value:"A.23.6. Debugging value struct menggunakan <code>#[derive(Debug)]</code>",id:"a236-debugging-value-struct-menggunakan-derivedebug",level:2},{value:"A.23.7. Tuple struct",id:"a237-tuple-struct",level:2},{value:"A.23.8. Struct property visibility",id:"a238-struct-property-visibility",level:2},{value:"A.23.9. Tuple struct property visibility",id:"a239-tuple-struct-property-visibility",level:2},{value:"A.23.10. Generic pada struct",id:"a2310-generic-pada-struct",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:s};function o(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,n.Z)({},d,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan belajar tentang struct."),(0,i.kt)("h2",{id:"a231-konsep-struct"},"A.23.1. Konsep Struct"),(0,i.kt)("p",null,"Struct (kependekan dari ",(0,i.kt)("em",{parentName:"p"},"structure"),") adalah tipe data custom yang dengannya kita bisa mengumpulkan beberapa definisi tipe data lalu menjadikannya sebagai satu buah tipe data dalam struktur tertentu."),(0,i.kt)("p",null,"Contoh analogi seperti sebuah mobil. Mobil memiliki roda, mesin, tempat kemudi, dan banyak lainnya. Mobil pada contoh ini adalah struct, sedang isi dari mobil tersebut biasa disebut dengan ",(0,i.kt)("em",{parentName:"p"},"attribute")," atau ",(0,i.kt)("em",{parentName:"p"},"property")," atau ",(0,i.kt)("em",{parentName:"p"},"field"),"."),(0,i.kt)("p",null,"Selain property, mobil juga bisa melakukan aksi, contohnya seperti jalan, belok kanan, berhenti. Aksi tersebut pada contoh ini adalah yang disebut dengan ",(0,i.kt)("em",{parentName:"p"},"method"),". Method sendiri adalah fungsi yang merupakan property sebuah struct."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Chapter ini fokus pada pembahasan struct beserta property-nya. Topik tentang method dibahas pada chapter selanjutnya, yaitu ",(0,i.kt)("a",{parentName:"p",href:"/basic/method"},"Method"),".")),(0,i.kt)("h2",{id:"a232-pembuatan-struct"},"A.23.2. Pembuatan struct"),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"struct")," digunakan untuk membuat custom type struct. Notasi penulisannya seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"struct NamaStruct {\n property_satu: String,\n property_dua: u64,\n // ...\n}\n")),(0,i.kt)("p",null,"Contoh, sebuah struct bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"User")," yang memiliki 4 buah property:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"name")," bertipe ",(0,i.kt)("inlineCode",{parentName:"li"},"String")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"sign_in_count")," bertipe numerik ",(0,i.kt)("inlineCode",{parentName:"li"},"u64")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"affliation")," bertipe vektor ",(0,i.kt)("inlineCode",{parentName:"li"},"Vec<String>")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"active")," bertipe boolean")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"struct User {\n name: String,\n sign_in_count: u64,\n affliation: Vec<String>,\n active: bool,\n}\n")),(0,i.kt)("p",null,"Struct adalah ",(0,i.kt)("em",{parentName:"p"},"hanya definisi structure"),"-nya saja, struct tidak menampung nilai atau value. Contoh pada struct ",(0,i.kt)("inlineCode",{parentName:"p"},"User")," di atas bisa dilihat bahwa yang didefinisikan hanya nama struct dan property (beserta tipe datanya). Tidak ada pengisian nilai sama sekali."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<String>")," merupakan salah satu contoh penerapan generics. Topik ini nantinya dibahas lebih detail pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/generics"},"Generics"),".")),(0,i.kt)("p",null,"Struct merupakan tipe data data custom, yang berarti tipe data tersebut bisa digunakan dalam pembuatan variabel. Sebagai contoh di bawah ini, sebuah variabel bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"user_one")," didefinisikan dengan tipe adalah struct ",(0,i.kt)("inlineCode",{parentName:"p"},"User")," yang telah dibuat."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'struct User {\n name: String,\n sign_in_count: u64,\n affliation: Vec<String>,\n active: bool,\n}\n\nfn main() {\n let user_one = User{\n name: String::from("Orgrim Doomhammer"),\n sign_in_count: 12,\n affliation: vec![\n String::from("Warchief of the Horde"),\n String::from("Blackrock Chieftain"),\n String::from("The Doomhammer"),\n ],\n active: false,\n };\n\n println!("name: {}", user_one.name);\n println!("sign-in count: {}", user_one.sign_in_count);\n println!("affliation: {:?}", user_one.affliation);\n println!("is active? {}", user_one.active);\n}\n')),(0,i.kt)("p",null,"Jalankan program di atas, lihat hasilnya."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Struct",src:t(1226).Z,width:"572",height:"123"})),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"user_one")," didefinisikan tipe datanya adalah struct ",(0,i.kt)("inlineCode",{parentName:"p"},"User"),". Notasinya penulisannya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let user_one = User{\n // property_satu: value,\n // property_dua: value,\n // ...\n};\n")),(0,i.kt)("p",null,"Deklarasi variabel bertipe data struct mewajibkan isi masing-masing property harus dituliskan beserta nilainya. Sebagai contoh variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"user_one")," yang bertipe struct ",(0,i.kt)("inlineCode",{parentName:"p"},"User")," di atas, dalam statement bisa dilihat ke-empat property milik struct ",(0,i.kt)("inlineCode",{parentName:"p"},"User")," dituliskan beserta nilainya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let user_one = User{\n name: String::from("Orgrim Doomhammer"),\n sign_in_count: 12,\n affliation: vec![\n String::from("Warchief of the Horde"),\n String::from("Blackrock Chieftain"),\n String::from("The Doomhammer"),\n ],\n active: false,\n};\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Variabel yang tipe data-nya adalah struct biasa disebut dengan ",(0,i.kt)("em",{parentName:"p"},"object")," atau ",(0,i.kt)("em",{parentName:"p"},"instance"),".")),(0,i.kt)("h3",{id:"-fungsi-stringfrom"},"\u25c9 Fungsi ",(0,i.kt)("inlineCode",{parentName:"h3"},"String::from()")),(0,i.kt)("p",null,"Pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/path-item#-stdstringstringnew"},"Module System \u279c Path & Item")," kita telah sedikit mengenal fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"String::new()")," yang kegunaannya adalah untuk membuat data string kosong bertipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,i.kt)("p",null,"Selain fungsi tersebut, ada juga fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"String::from()")," yang kegunaannya juga untuk pembuatan data string bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),", tapi dengan isi ditentukan lewat argumen pemanggilan fungsi."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let a = "";\n// variabel `a` bertipe data `&str`, isi value-nya ""\n\nlet b = String::new();\n// variabel `b` bertipe data `String`, isi value-nya ""\n\nlet c = "hello";\n// variabel `c` bertipe data `&str`, isi value-nya "hello"\n\nlet d = String::from("world");\n// variabel `d` bertipe data `String`, isi value-nya "world"\n')),(0,i.kt)("p",null,"Untuk sekarang, boleh menggunakan kesimpulan berikut:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Hasil dari ",(0,i.kt)("inlineCode",{parentName:"li"},"String::new()")," adalah sama dengan literal string ",(0,i.kt)("inlineCode",{parentName:"li"},'""')," tapi bertipe data ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," (bukan ",(0,i.kt)("inlineCode",{parentName:"li"},"&str"),")"),(0,i.kt)("li",{parentName:"ul"},"Hasil dari ",(0,i.kt)("inlineCode",{parentName:"li"},'String::from("hello")')," adalah sama dengan literal string ",(0,i.kt)("inlineCode",{parentName:"li"},'"hello"')," tapi bertipe data ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," (bukan ",(0,i.kt)("inlineCode",{parentName:"li"},"&str"),")")),(0,i.kt)("p",null,"Sebenarnya perbedaannya tidak hanya itu saja, nantinya kita pelajari lebih detail pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/string-slice-vs-string-literal"},"String Literal (&str) vs. String Custom Type"),"."),(0,i.kt)("h3",{id:"-naming-convention-struct"},"\u25c9 ",(0,i.kt)("em",{parentName:"h3"},"Naming convention")," struct"),(0,i.kt)("p",null,"Sesuai anjuran di ",(0,i.kt)("a",{parentName:"p",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"halaman dokumentasi Rust"),", upper camel case digunakan dalam penamaan struct dan camel case untuk penamaan property-nya. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"struct User {\n name: String,\n sign_in_count: u64,\n affliation: Vec<String>,\n active: bool,\n}\n")),(0,i.kt)("h2",{id:"a233-mutable-struct"},"A.23.3. Mutable struct"),(0,i.kt)("p",null,"Penentuan ",(0,i.kt)("em",{parentName:"p"},"mutability")," sebuah struct dilakukan dengan cara menambahkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"mut")," seperti pada umumnya variabel. Contohnya bisa dilihat pada variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"user_two")," berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut user_two: User = User{\n name: String::from("Varian Wrynn"),\n sign_in_count: 12,\n affliation: vec![\n String::from("High King of the Alliance"),\n String::from("King of Stormwind"),\n String::from("Champion of the Crimson Ring"),\n ],\n active: false,\n};\n\nuser_two.name = String::from("Anduin Wrynn");\nuser_two.affliation.pop();\nuser_two.active = true;\n\nprintln!("name: {}", user_two.name);\nprintln!("sign-in count: {}", user_two.sign_in_count);\nprintln!("affliation: {:?}", user_two.affliation);\nprintln!("is active? {}", user_two.active);\n')),(0,i.kt)("p",null,"Pada contoh di atas, ",(0,i.kt)("inlineCode",{parentName:"p"},"user_two")," adalah object struct yang bisa diubah nilainya (mutable). Perubahan nilai struct bisa dilakukan pada property, contohnya seperti property ",(0,i.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"affliation"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"active")," yang dicontohkan diubah nilainya."),(0,i.kt)("p",null,"Atau bisa juga perubahannya pada value struct itu sendiri, diganti dengan value baru."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut user_two = User{\n name: String::from("Varian Wrynn"),\n sign_in_count: 12,\n affliation: vec![\n String::from("High King of the Alliance"),\n String::from("King of Stormwind"),\n String::from("Champion of the Crimson Ring"),\n ],\n active: false,\n};\n\nuser_two = User{\n name: String::from("Anduin Wrynn"),\n sign_in_count: 12,\n affliation: vec![\n String::from("High King of the Alliance"),\n String::from("King of Stormwind"),\n ],\n active: true,\n};\n')),(0,i.kt)("h2",{id:"a234-macam-macam-notasi-deklarasi-variabel-struct"},"A.23.4. Macam-macam notasi deklarasi variabel struct"),(0,i.kt)("h3",{id:"-type-inference--manifest-typing"},"\u25c9 ",(0,i.kt)("em",{parentName:"h3"},"type inference")," / ",(0,i.kt)("em",{parentName:"h3"},"manifest typing")),(0,i.kt)("p",null,"Metode deklarasi ",(0,i.kt)("em",{parentName:"p"},"type inference")," ataupun ",(0,i.kt)("em",{parentName:"p"},"manifest typing")," bisa digunakan dalam variabel struct."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'struct Car {\n brand: String,\n model: String,\n}\n\nlet car_one = Car{\n brand: String::from("Toyota"),\n model: String::from("Sprinter Trueno AE86"),\n};\n\nlet car_two: Car = Car{\n brand: String::from("BMW"),\n model: String::from("M3 GTR"),\n};\n')),(0,i.kt)("h3",{id:"-variabel-struct-tanpa-predefined-value"},"\u25c9 Variabel struct tanpa ",(0,i.kt)("em",{parentName:"h3"},"predefined value")),(0,i.kt)("p",null,"Variabel struct boleh didefinisikan tanpa ",(0,i.kt)("em",{parentName:"p"},"predefined value"),", jadi cukup tipe datanya saja yang ditentukan saat deklarasi variabel. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut car_three: Car;\ncar_three = Car{\n brand: String::from("Audi"),\n model: String::from("Le Mans Quattro"),\n};\n')),(0,i.kt)("h3",{id:"-variabel-struct-dengan-nilai-berasal-dari-struct-lain"},"\u25c9 Variabel struct dengan nilai berasal dari struct lain"),(0,i.kt)("p",null,"Jika ada kebutuhan untuk membuat variabel object struct yang nilai property-nya sebagian adalah berasal dari variabel struct lain, bisa manfaatkan syntax ",(0,i.kt)("inlineCode",{parentName:"p"},".."),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut car_three: Car;\ncar_three = Car{\n brand: String::from("Audi"),\n model: String::from("Le Mans Quattro"),\n};\nprintln!("{} {}", car_three.brand, car_three.model);\n\nlet mut car_four: Car;\ncar_four = Car{\n brand: String::from("Audi Brand"),\n ..car_three\n};\nprintln!("{} {}", car_four.brand, car_four.model);\n')),(0,i.kt)("p",null,"Pada contoh di atas, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"car_four")," property ",(0,i.kt)("inlineCode",{parentName:"p"},"brand"),"-nya diisi dengan ",(0,i.kt)("inlineCode",{parentName:"p"},'"Audi Brand"'),". Sedangkan property-property lainnya nilai didapat dari nilai propery milik ",(0,i.kt)("inlineCode",{parentName:"p"},"car_three"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Struct",src:t(341).Z,width:"511",height:"108"})),(0,i.kt)("p",null,"Coba jalankan program, akan terlihat nilai dari variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"car_four")," untuk property selain ",(0,i.kt)("inlineCode",{parentName:"p"},"brand")," adalah sama dengan nilai property-property ",(0,i.kt)("inlineCode",{parentName:"p"},"car_three"),"."),(0,i.kt)("h3",{id:"-field-init-shorthand"},"\u25c9 ",(0,i.kt)("em",{parentName:"h3"},"Field init shorthand")),(0,i.kt)("p",null,"Jika ada variabel yang namanya sama persis dengan nama property sebuah struct, maka dalam deklarasi variabel struct bisa menggunakan teknik penulisan seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let model = String::from("Corvette C1");\n\nlet car_five = Car{\n brand: String::from("Chevrolet"),\n model,\n};\n')),(0,i.kt)("p",null,"Cukup tulis nama variabelnya saja tanpa value."),(0,i.kt)("p",null,"Teknik ",(0,i.kt)("em",{parentName:"p"},"shorthand")," ini bisa juga digunakan dalam fungsi. Contoh di bawah ini ada fungsi bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"new_car")," yang memiliki nama parameter adalah sama persis dengan nama property struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Car"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn new_car(brand: String, model: String) -> Car {\n Car{\n brand,\n model,\n }\n}\n\nfn main() {\n let car_six = new_car(\n String::from("Chevrolet"),\n String::from("Corvette C6")\n );\n // ...\n}\n')),(0,i.kt)("h3",{id:"-deklarasi-nilai-struct-secara-horizontal"},"\u25c9 Deklarasi nilai struct secara horizontal"),(0,i.kt)("p",null,"Umumnya, operasi ",(0,i.kt)("em",{parentName:"p"},"assignment")," nilai struct dituliskan secara vertikal. Untuk struct yang property-nya sedikit biasanya dituliskan secara horizontal contohnya seperti di bawah ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"struct Point {\n x: f32,\n y: f32,\n}\n\nlet point_one = Point { x: 3.14, y: 8.0 };\n")),(0,i.kt)("h3",{id:"-destructuring-assignment"},"\u25c9 ",(0,i.kt)("em",{parentName:"h3"},"Destructuring assignment")),(0,i.kt)("p",null,"Teknik penulisan ini bisa dipakai dalam case di mana nilai property struct perlu ditampung ke variabel baru. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let point_one = Point { x: 3.14, y: 8.0 };\n\nlet Point { x: x_one, y: y_one } = point_one;\nprintln!("x_one: {}", x_one);\nprintln!("y_one: {}", y_one);\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"x_one")," di atas akan menampung nilai dari ",(0,i.kt)("inlineCode",{parentName:"li"},"point_one.x")),(0,i.kt)("li",{parentName:"ul"},"Variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"y_one")," di atas akan menampung nilai dari ",(0,i.kt)("inlineCode",{parentName:"li"},"point_one.y"))),(0,i.kt)("p",null,"Jika tidak semua property struct perlu untuk ditampung ke variabel baru, maka gunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"_")," untuk property yang nilainya tidak ditampung. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let point_one = Point { x: 3.14, y: 8.0 };\n\nlet Point { x: _, y: y_one } = point_one;\nprintln!("y_one: {}", y_one);\n')),(0,i.kt)("h2",{id:"a235-unit-like-structs"},"A.23.5. ",(0,i.kt)("em",{parentName:"h2"},"Unit-like structs")),(0,i.kt)("p",null,(0,i.kt)("em",{parentName:"p"},"Unit-like structs")," adalah struct yang didefinisikan tanpa property. Cara deklrasinya bisa dilihat pada contoh berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"struct StructOne;\n\nlet data_one = StructOne;\n")),(0,i.kt)("p",null,"Teknik pembuatan struct ini berguna ketika ada case di mana ada kebutuhan untuk mengimplementasikan sebuah trait ke suatu tipe data. Lebih jelasnya akan dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/traits"},"Traits"),"."),(0,i.kt)("h2",{id:"a236-debugging-value-struct-menggunakan-derivedebug"},"A.23.6. Debugging value struct menggunakan ",(0,i.kt)("inlineCode",{parentName:"h2"},"#[derive(Debug)]")),(0,i.kt)("p",null,(0,i.kt)("em",{parentName:"p"},"By default"),", error akan muncul saat berusaha menampilkan nilai variabel struct (bukan nilai property-nya, tapi nilai variabel struct-nya) menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),". Ini disebabkan karena data yang bisa ditampilkan menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"println")," harus memiliki trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," (atau ",(0,i.kt)("inlineCode",{parentName:"p"},"Display"),")."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Struct",src:t(6091).Z,width:"743",height:"308"})),(0,i.kt)("p",null,"Lalu jika ingin melihat nilai property struct bagaimana solusinya? Bisa dengan menampilkan nilai property satu per satu, tapi pastinya butuh effort."),(0,i.kt)("p",null,"Cara yang lebih elegan adalah dengan menggunakan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"#[derive(Debug)]"),". Penerapannya cukup dengan menuliskan atribut tersebut tepat di atas deklarasi struct. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[derive(Debug)]\nstruct GamingConsole {\n name: String\n}\n\nlet console_one = GamingConsole{\n name: String::from("PlayStation 5"),\n};\n\nprintln!("data_struct_one: {:#?}", console_one);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Struct",src:t(7542).Z,width:"510",height:"330"})),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih detailnya mengenai traits dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits")),(0,i.kt)("li",{parentName:"ul"},"Lebih detailnya mengenai attribute dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/attributes"},"Attributes")))),(0,i.kt)("h2",{id:"a237-tuple-struct"},"A.23.7. Tuple struct"),(0,i.kt)("p",null,"Tuple struct adalah struct yang didefinisikan dengan gaya tuple. Property pada tuple struct diakses menggunakan notasi pengaksesan tuple item."),(0,i.kt)("p",null,"Pada contoh berikut tuple struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Color")," didefinisikan dengan isi 3 buah item yang kesemuanya bertipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),". Lalu tipe data tuple struct tersebut digunakan untuk membuat variabel baru bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"red"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'struct Color(i32, i32, i32);\n\nlet red = Color(255, 0, 0);\n\nprintln!("{:?} {:?} {:?}", red.0, red.1, red.2);\n')),(0,i.kt)("p",null,"Bisa dilihat di contoh, property diakses menggunakan nomor indeks dengan notasi penulisan ",(0,i.kt)("inlineCode",{parentName:"p"},"variable.index"),"."),(0,i.kt)("p",null,"Contoh lainnya, tuple struct ",(0,i.kt)("inlineCode",{parentName:"p"},"SomeTupleStruct")," berikut dideklarasikan memiliki item ke-1 bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"i32")," dan item ke-2 bertipe boolean."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'struct SomeTupleStruct(i32, bool);\n\nlet some_data = SomeTupleStruct(0, false);\n\nprintln!("{:?} {:?}", some_data.0, some_data.1);\n')),(0,i.kt)("h2",{id:"a238-struct-property-visibility"},"A.23.8. Struct property visibility"),(0,i.kt)("p",null,"Sekarang mari kita coba praktikkan satu program lagi, namun kali ini sedikit berbeda, struct kita definisikan sebagai module item."),(0,i.kt)("p",null,"Silakan siapkan program dengan struktur seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 main.rs\n \u251c\u2500\u2500\u2500 models.rs\n \u2514\u2500\u2500\u2500 models\n \u2514\u2500\u2500\u2500 game.rs\n")),(0,i.kt)("p",null,"Lalu isi file program dengan kode di bawah ini. Sebuah struct dengan path ",(0,i.kt)("inlineCode",{parentName:"p"},"models::game::GamingConsole"),", dan satu buah object di fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," yang dibuat dari struct tersebut. Pastikan definisi semua module item adalah publik (ada keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub"),")."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod models;\n\nfn main() {\n let ps5 = models::game::GamingConsole{\n name: String::from("PS 5")\n };\n println!("{:#?}", ps5);\n}\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/models.rs"',title:'"src/models.rs"'},"pub mod game;\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/models/game.rs"',title:'"src/models/game.rs"'},"#[derive(Debug)]\npub struct GamingConsole {\n name: String\n}\n")),(0,i.kt)("p",null,"Ada yang aneh, baris kode pembuatan variabel object ",(0,i.kt)("inlineCode",{parentName:"p"},"ps5")," terdeteksi sebagai error. Padahal definisi submodule dan item-nya sudah publik semua."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Struct",src:t(7728).Z,width:"419",height:"185"})),(0,i.kt)("p",null,"Jika dilihat dari keterangan error, sebenarnya cukup jelas bagian mana yang menjadi sumber masalah, yaitu field ",(0,i.kt)("inlineCode",{parentName:"p"},"name")," yang terdeteksi sebagai private property."),(0,i.kt)("p",null,"Struct jika didefinisikan di file yang sama dengan statement pemanggilan struct tersebut tidak akan menghasilkan error. Tetapi jika definisi struct-nya terpisah dari statement pemanggilan struct (seperti contoh di atas), maka field dari struct tersebut harus publik."),(0,i.kt)("p",null,"Caranya membuat field sebagai publik adalah dengan menambahkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," pada property struct. Silakan ubah definisi struct ",(0,i.kt)("inlineCode",{parentName:"p"},"GamingConsole")," menjadi seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"// before\npub struct GamingConsole {\n name: String\n}\n\n// after\npub struct GamingConsole {\n pub name: String\n}\n")),(0,i.kt)("p",null,"Bisa dilihat keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," ditambahkan pada deklarasi property struct. yang sebelumnya ",(0,i.kt)("inlineCode",{parentName:"p"},"name: String")," sekarang ada keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," didepannya."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai visibility property dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/visibility-privacy"},"Module System \u279c Visibility & Privacy"))),(0,i.kt)("h2",{id:"a239-tuple-struct-property-visibility"},"A.23.9. Tuple struct property visibility"),(0,i.kt)("p",null,"Lalu bagaimana dengan tuple struct? apakah property-nya juga harus didefinisikan publik agar bisa diakses dari tempat lain? Jawabannya ada di praktik berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 main.rs\n \u251c\u2500\u2500\u2500 models.rs\n \u2514\u2500\u2500\u2500 models\n \u2514\u2500\u2500\u2500 color.rs\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod models;\n\nfn main() {\n let red = models::color::Color(255, 255, 0);\n println!("{:#?}", red);\n}\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/models.rs"',title:'"src/models.rs"'},"pub mod color;\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/models/color.rs"',title:'"src/models/color.rs"'},"#[derive(Debug)]\npub struct Color(i32, i32, i32);\n")),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Struct",src:t(6610).Z,width:"626",height:"255"})),(0,i.kt)("p",null,"Yap, error yang mirip juga muncul. Jadi jawaban dari pertanyaan sebelumnya adalah iya, property tuple struct juga harus publik agar bisa diakses dari tempat lain."),(0,i.kt)("p",null,"Cara deklarasi tuple struct dengan property publik adalah dengan menambahkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," di masing-masing deklarasi parameter tuple struct. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"// before\npub struct Color(i32, i32, i32);\n\n// after\npub struct Color(pub i32, pub i32, pub i32);\n")),(0,i.kt)("p",null,"Jalankan program untuk melihat hasilnya, error tidak muncul."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai visibility property dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/visibility-privacy"},"Module System \u279c Visibility & Privacy"))),(0,i.kt)("h2",{id:"a2310-generic-pada-struct"},"A.23.10. Generic pada struct"),(0,i.kt)("p",null,"Pembahasan mengenai generic pada struct ada pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/generics#a365-generics-struct"},"Generics"),"."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/struct"},"github.com/novalagung/dasarpemrogramanrust-example/../struct")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch05-00-structs.html"},"https://doc.rust-lang.org/book/ch05-00-structs.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch05-01-defining-structs.html"},"https://doc.rust-lang.org/book/ch05-01-defining-structs.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.struct.html"},"https://doc.rust-lang.org/std/keyword.struct.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/custom_types/structs.html"},"https://doc.rust-lang.org/rust-by-example/custom_types/structs.html"))))}o.isMDXComponent=!0},1226:(a,e,t)=>{t.d(e,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjwAAAB7CAIAAAD/r80wAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFG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x/a437J2B9vGbxlAM5X/ddzd4ljf3/WV0054NmSK5Jh5AdvGbxlAM5V/Vd0d5HX+4uBqtmzRSySKX+8ZfCWATjv2B8OEgZdAAD1P1/9JwYHANQfAABQfwAAQP0BAAD1BwBA/QEAAPUHAADUHwAAUH8AAED9AQDgSPkf6Emv3lPCWuwAAAAASUVORK5CYII="},6091:(a,e,t)=>{t.d(e,{Z:()=>n});const n=t.p+"assets/images/struct-4-86fb5f564d330bc2d1cc10e13ea2d649.png"},7542:(a,e,t)=>{t.d(e,{Z:()=>n});const n=t.p+"assets/images/struct-5-5e013d5895bef6a938e2c1333ff52205.png"},7728:(a,e,t)=>{t.d(e,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAaMAAAC5CAIAAAAKzcfqAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY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EsjLyOaSXzq4tSBO9+YlIpuGQQ/VPgrAKeRd+pie9LlUIv5blGfTpOxSK8TiGjX8MsnnaWhRGq5fHDqrhfwNiTd8T9abOW6dv1YTjrLMhHb6vQFxfSy4aPp41MJDARzPtrOvhf/6jt07UiXR7XNYdcL6Ux8/Z0XIR02tKRz/LLCfZM6ptw3Q8AisSKd4VqRXiUod2LImKGzvayH5YSxSdJZumlOyU0ipFMOYInUfEN9uIJu2uMr0/QyHBH6dGXPnUbYpQthd97FS+ZfvbnGn0xWkE6HrqcXn25JOn+kwnSu6X63BmGs7KdrzkcZwNL2sFEh3YcmSrWqJF3mGEr1SjrpgpWoSpEuDaaGpDPxbOnTOZt0Qbqw585x1pqRThGkBenKkYTogKx29NqM1RajEA07E4t80vaw0SCdjk/t+lqfztlJN5Le1uBIV4TARr07dC1JJ3y64t/ufbqktHPnjydU+3cNSYdPh40m6XK/LHPuKkln+ua8gYj2/XR+n51AVWxYtgPS+TGvq25GJIKuAN0TJ/vpzHIV6Xrtp6vw+xr7dGIAl346bByj12NmaNXo1I06n84de53vaUTCDoxGRk4d58sde60bq83308Sn8926wZDOHXstElSSTo+9lhBpTzodgdZFtan0jZnI2Cs21KRb1y8teT5dn111A1Tkebphe/2L5+kwSDescoNi82heOphdWwXvSAw3iGl72HCRbtuW6axqvr7rR49+9rP7e3+yvta40euec8Oc58//9dr/bXp+CHOo33t92U1D28OGi3SqdqqqqSru//7kpz+a3PnOsz9mDWv6X0Pbw4aLdFnVVFLVNLtds4Y1/a+h7WHDRToMwzBIh2EYBukwDMMgHYZhGKTDMAyDdBiGYZAOwzAM0mEYBukwDMNG3/4fXrze1tJWD6UAAAAASUVORK5CYII="},6610:(a,e,t)=>{t.d(e,{Z:()=>n});const n=t.p+"assets/images/struct-7-517c0402e96dfd5898464887fa79ec98.png"}}]); \ No newline at end of file diff --git a/assets/js/93422b31.e6d20241.js b/assets/js/93422b31.e6d20241.js new file mode 100644 index 00000000..8e753b49 --- /dev/null +++ b/assets/js/93422b31.e6d20241.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[8469],{3905:(a,e,t)=>{t.d(e,{Zo:()=>d,kt:()=>c});var n=t(7294);function i(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function r(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),t.push.apply(t,n)}return t}function l(a){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?r(Object(t),!0).forEach((function(e){i(a,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(t,e))}))}return a}function u(a,e){if(null==a)return{};var t,n,i=function(a,e){if(null==a)return{};var t,n,i={},r=Object.keys(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||(i[t]=a[t]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(a,t)&&(i[t]=a[t])}return i}var p=n.createContext({}),s=function(a){var e=n.useContext(p),t=e;return a&&(t="function"==typeof a?a(e):l(l({},e),a)),t},d=function(a){var e=s(a.components);return n.createElement(p.Provider,{value:e},a.children)},o={inlineCode:"code",wrapper:function(a){var e=a.children;return n.createElement(n.Fragment,{},e)}},m=n.forwardRef((function(a,e){var t=a.components,i=a.mdxType,r=a.originalType,p=a.parentName,d=u(a,["components","mdxType","originalType","parentName"]),m=s(t),c=i,k=m["".concat(p,".").concat(c)]||m[c]||o[c]||r;return t?n.createElement(k,l(l({ref:e},d),{},{components:t})):n.createElement(k,l({ref:e},d))}));function c(a,e){var t=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=t.length,l=new Array(r);l[0]=m;var u={};for(var p in e)hasOwnProperty.call(e,p)&&(u[p]=e[p]);u.originalType=a,u.mdxType="string"==typeof a?a:i,l[1]=u;for(var s=2;s<r;s++)l[s]=t[s];return n.createElement.apply(null,l)}return n.createElement.apply(null,t)}m.displayName="MDXCreateElement"},1704:(a,e,t)=>{t.r(e),t.d(e,{assets:()=>p,contentTitle:()=>l,default:()=>o,frontMatter:()=>r,metadata:()=>u,toc:()=>s});var n=t(7462),i=(t(7294),t(3905));const r={sidebar_position:23,title:"A.23. Struct",sidebar_label:"A.23. Struct"},l=void 0,u={unversionedId:"basic/struct",id:"basic/struct",title:"A.23. Struct",description:"Pada chapter ini kita akan belajar tentang struct.",source:"@site/docs/basic/struct.md",sourceDirName:"basic",slug:"/basic/struct",permalink:"/basic/struct",draft:!1,tags:[],version:"current",sidebarPosition:23,frontMatter:{sidebar_position:23,title:"A.23. Struct",sidebar_label:"A.23. Struct"},sidebar:"tutorialSidebar",previous:{title:"A.22. Module System \u279c Scope & Akses Item",permalink:"/basic/module-scope-item-access"},next:{title:"A.24. Associated Function",permalink:"/basic/associated-function"}},p={},s=[{value:"A.23.1. Konsep Struct",id:"a231-konsep-struct",level:2},{value:"A.23.2. Pembuatan struct",id:"a232-pembuatan-struct",level:2},{value:"\u25c9 Fungsi <code>String::from()</code>",id:"-fungsi-stringfrom",level:3},{value:"\u25c9 <em>Naming convention</em> struct",id:"-naming-convention-struct",level:3},{value:"A.23.3. Mutable struct",id:"a233-mutable-struct",level:2},{value:"A.23.4. Macam-macam notasi deklarasi variabel struct",id:"a234-macam-macam-notasi-deklarasi-variabel-struct",level:2},{value:"\u25c9 <em>type inference</em> / <em>manifest typing</em>",id:"-type-inference--manifest-typing",level:3},{value:"\u25c9 Variabel struct tanpa <em>predefined value</em>",id:"-variabel-struct-tanpa-predefined-value",level:3},{value:"\u25c9 Variabel struct dengan nilai berasal dari struct lain",id:"-variabel-struct-dengan-nilai-berasal-dari-struct-lain",level:3},{value:"\u25c9 <em>Field init shorthand</em>",id:"-field-init-shorthand",level:3},{value:"\u25c9 Deklarasi nilai struct secara horizontal",id:"-deklarasi-nilai-struct-secara-horizontal",level:3},{value:"\u25c9 <em>Destructuring assignment</em>",id:"-destructuring-assignment",level:3},{value:"A.23.5. <em>Unit-like structs</em>",id:"a235-unit-like-structs",level:2},{value:"A.23.6. Debugging value struct menggunakan <code>#[derive(Debug)]</code>",id:"a236-debugging-value-struct-menggunakan-derivedebug",level:2},{value:"A.23.7. Tuple struct",id:"a237-tuple-struct",level:2},{value:"A.23.8. Struct property visibility",id:"a238-struct-property-visibility",level:2},{value:"A.23.9. Tuple struct property visibility",id:"a239-tuple-struct-property-visibility",level:2},{value:"A.23.10. Generic pada struct",id:"a2310-generic-pada-struct",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:s};function o(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,n.Z)({},d,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan belajar tentang struct."),(0,i.kt)("h2",{id:"a231-konsep-struct"},"A.23.1. Konsep Struct"),(0,i.kt)("p",null,"Struct (kependekan dari ",(0,i.kt)("em",{parentName:"p"},"structure"),") adalah tipe data custom yang dengannya kita bisa mengumpulkan beberapa definisi tipe data lalu menjadikannya sebagai satu buah tipe data dalam struktur tertentu."),(0,i.kt)("p",null,"Contoh analogi seperti sebuah mobil. Mobil memiliki roda, mesin, tempat kemudi, dan banyak lainnya. Mobil pada contoh ini adalah struct, sedang isi dari mobil tersebut biasa disebut dengan ",(0,i.kt)("em",{parentName:"p"},"attribute")," atau ",(0,i.kt)("em",{parentName:"p"},"property")," atau ",(0,i.kt)("em",{parentName:"p"},"field"),"."),(0,i.kt)("p",null,"Selain property, mobil juga bisa melakukan aksi, contohnya seperti jalan, belok kanan, berhenti. Aksi tersebut pada contoh ini adalah yang disebut dengan ",(0,i.kt)("em",{parentName:"p"},"method"),". Method sendiri adalah fungsi yang merupakan property sebuah struct."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Chapter ini fokus pada pembahasan struct beserta property-nya. Topik tentang method dibahas pada chapter selanjutnya, yaitu ",(0,i.kt)("a",{parentName:"p",href:"/basic/method"},"Method"),".")),(0,i.kt)("h2",{id:"a232-pembuatan-struct"},"A.23.2. Pembuatan struct"),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"struct")," digunakan untuk membuat custom type struct. Notasi penulisannya seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"struct NamaStruct {\n property_satu: String,\n property_dua: u64,\n // ...\n}\n")),(0,i.kt)("p",null,"Contoh, sebuah struct bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"User")," yang memiliki 4 buah property:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"name")," bertipe ",(0,i.kt)("inlineCode",{parentName:"li"},"String")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"sign_in_count")," bertipe numerik ",(0,i.kt)("inlineCode",{parentName:"li"},"u64")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"affliation")," bertipe vektor ",(0,i.kt)("inlineCode",{parentName:"li"},"Vec<String>")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"active")," bertipe boolean")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"struct User {\n name: String,\n sign_in_count: u64,\n affliation: Vec<String>,\n active: bool,\n}\n")),(0,i.kt)("p",null,"Struct adalah ",(0,i.kt)("em",{parentName:"p"},"hanya definisi structure"),"-nya saja, struct tidak menampung nilai atau value. Contoh pada struct ",(0,i.kt)("inlineCode",{parentName:"p"},"User")," di atas bisa dilihat bahwa yang didefinisikan hanya nama struct dan property (beserta tipe datanya). Tidak ada pengisian nilai sama sekali."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<String>")," merupakan salah satu contoh penerapan generics. Topik ini nantinya dibahas lebih detail pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/generics"},"Generics"),".")),(0,i.kt)("p",null,"Struct merupakan tipe data data custom, yang berarti tipe data tersebut bisa digunakan dalam pembuatan variabel. Sebagai contoh di bawah ini, sebuah variabel bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"user_one")," didefinisikan dengan tipe adalah struct ",(0,i.kt)("inlineCode",{parentName:"p"},"User")," yang telah dibuat."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'struct User {\n name: String,\n sign_in_count: u64,\n affliation: Vec<String>,\n active: bool,\n}\n\nfn main() {\n let user_one = User{\n name: String::from("Orgrim Doomhammer"),\n sign_in_count: 12,\n affliation: vec![\n String::from("Warchief of the Horde"),\n String::from("Blackrock Chieftain"),\n String::from("The Doomhammer"),\n ],\n active: false,\n };\n\n println!("name: {}", user_one.name);\n println!("sign-in count: {}", user_one.sign_in_count);\n println!("affliation: {:?}", user_one.affliation);\n println!("is active? {}", user_one.active);\n}\n')),(0,i.kt)("p",null,"Jalankan program di atas, lihat hasilnya."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Struct",src:t(1226).Z,width:"572",height:"123"})),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"user_one")," didefinisikan tipe datanya adalah struct ",(0,i.kt)("inlineCode",{parentName:"p"},"User"),". Notasinya penulisannya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let user_one = User{\n // property_satu: value,\n // property_dua: value,\n // ...\n};\n")),(0,i.kt)("p",null,"Deklarasi variabel bertipe data struct mewajibkan isi masing-masing property harus dituliskan beserta nilainya. Sebagai contoh variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"user_one")," yang bertipe struct ",(0,i.kt)("inlineCode",{parentName:"p"},"User")," di atas, dalam statement bisa dilihat ke-empat property milik struct ",(0,i.kt)("inlineCode",{parentName:"p"},"User")," dituliskan beserta nilainya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let user_one = User{\n name: String::from("Orgrim Doomhammer"),\n sign_in_count: 12,\n affliation: vec![\n String::from("Warchief of the Horde"),\n String::from("Blackrock Chieftain"),\n String::from("The Doomhammer"),\n ],\n active: false,\n};\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Variabel yang tipe data-nya adalah struct biasa disebut dengan ",(0,i.kt)("em",{parentName:"p"},"object")," atau ",(0,i.kt)("em",{parentName:"p"},"instance"),".")),(0,i.kt)("h3",{id:"-fungsi-stringfrom"},"\u25c9 Fungsi ",(0,i.kt)("inlineCode",{parentName:"h3"},"String::from()")),(0,i.kt)("p",null,"Pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/path-item#-stdstringstringnew"},"Module System \u279c Path & Item")," kita telah sedikit mengenal fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"String::new()")," yang kegunaannya adalah untuk membuat data string kosong bertipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,i.kt)("p",null,"Selain fungsi tersebut, ada juga fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"String::from()")," yang kegunaannya juga untuk pembuatan data string bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),", tapi dengan isi ditentukan lewat argumen pemanggilan fungsi."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let a = "";\n// variabel `a` bertipe data `&str`, isi value-nya ""\n\nlet b = String::new();\n// variabel `b` bertipe data `String`, isi value-nya ""\n\nlet c = "hello";\n// variabel `c` bertipe data `&str`, isi value-nya "hello"\n\nlet d = String::from("world");\n// variabel `d` bertipe data `String`, isi value-nya "world"\n')),(0,i.kt)("p",null,"Untuk sekarang, boleh menggunakan kesimpulan berikut:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Hasil dari ",(0,i.kt)("inlineCode",{parentName:"li"},"String::new()")," adalah sama dengan literal string ",(0,i.kt)("inlineCode",{parentName:"li"},'""')," tapi bertipe data ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," (bukan ",(0,i.kt)("inlineCode",{parentName:"li"},"&str"),")"),(0,i.kt)("li",{parentName:"ul"},"Hasil dari ",(0,i.kt)("inlineCode",{parentName:"li"},'String::from("hello")')," adalah sama dengan literal string ",(0,i.kt)("inlineCode",{parentName:"li"},'"hello"')," tapi bertipe data ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," (bukan ",(0,i.kt)("inlineCode",{parentName:"li"},"&str"),")")),(0,i.kt)("p",null,"Sebenarnya perbedaannya tidak hanya itu saja, nantinya kita pelajari lebih detail pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/string-slice-vs-string-literal"},"String Literal (&str) vs. String Custom Type"),"."),(0,i.kt)("h3",{id:"-naming-convention-struct"},"\u25c9 ",(0,i.kt)("em",{parentName:"h3"},"Naming convention")," struct"),(0,i.kt)("p",null,"Sesuai anjuran di ",(0,i.kt)("a",{parentName:"p",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"halaman dokumentasi Rust"),", upper camel case digunakan dalam penamaan struct dan camel case untuk penamaan property-nya. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"struct User {\n name: String,\n sign_in_count: u64,\n affliation: Vec<String>,\n active: bool,\n}\n")),(0,i.kt)("h2",{id:"a233-mutable-struct"},"A.23.3. Mutable struct"),(0,i.kt)("p",null,"Penentuan ",(0,i.kt)("em",{parentName:"p"},"mutability")," sebuah struct dilakukan dengan cara menambahkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"mut")," seperti pada umumnya variabel. Contohnya bisa dilihat pada variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"user_two")," berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut user_two: User = User{\n name: String::from("Varian Wrynn"),\n sign_in_count: 12,\n affliation: vec![\n String::from("High King of the Alliance"),\n String::from("King of Stormwind"),\n String::from("Champion of the Crimson Ring"),\n ],\n active: false,\n};\n\nuser_two.name = String::from("Anduin Wrynn");\nuser_two.affliation.pop();\nuser_two.active = true;\n\nprintln!("name: {}", user_two.name);\nprintln!("sign-in count: {}", user_two.sign_in_count);\nprintln!("affliation: {:?}", user_two.affliation);\nprintln!("is active? {}", user_two.active);\n')),(0,i.kt)("p",null,"Pada contoh di atas, ",(0,i.kt)("inlineCode",{parentName:"p"},"user_two")," adalah object struct yang bisa diubah nilainya (mutable). Perubahan nilai struct bisa dilakukan pada property, contohnya seperti property ",(0,i.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"affliation"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"active")," yang dicontohkan diubah nilainya."),(0,i.kt)("p",null,"Atau bisa juga perubahannya pada value struct itu sendiri, diganti dengan value baru."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut user_two = User{\n name: String::from("Varian Wrynn"),\n sign_in_count: 12,\n affliation: vec![\n String::from("High King of the Alliance"),\n String::from("King of Stormwind"),\n String::from("Champion of the Crimson Ring"),\n ],\n active: false,\n};\n\nuser_two = User{\n name: String::from("Anduin Wrynn"),\n sign_in_count: 12,\n affliation: vec![\n String::from("High King of the Alliance"),\n String::from("King of Stormwind"),\n ],\n active: true,\n};\n')),(0,i.kt)("h2",{id:"a234-macam-macam-notasi-deklarasi-variabel-struct"},"A.23.4. Macam-macam notasi deklarasi variabel struct"),(0,i.kt)("h3",{id:"-type-inference--manifest-typing"},"\u25c9 ",(0,i.kt)("em",{parentName:"h3"},"type inference")," / ",(0,i.kt)("em",{parentName:"h3"},"manifest typing")),(0,i.kt)("p",null,"Metode deklarasi ",(0,i.kt)("em",{parentName:"p"},"type inference")," ataupun ",(0,i.kt)("em",{parentName:"p"},"manifest typing")," bisa digunakan dalam variabel struct."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'struct Car {\n brand: String,\n model: String,\n}\n\nlet car_one = Car{\n brand: String::from("Toyota"),\n model: String::from("Sprinter Trueno AE86"),\n};\n\nlet car_two: Car = Car{\n brand: String::from("BMW"),\n model: String::from("M3 GTR"),\n};\n')),(0,i.kt)("h3",{id:"-variabel-struct-tanpa-predefined-value"},"\u25c9 Variabel struct tanpa ",(0,i.kt)("em",{parentName:"h3"},"predefined value")),(0,i.kt)("p",null,"Variabel struct boleh didefinisikan tanpa ",(0,i.kt)("em",{parentName:"p"},"predefined value"),", jadi cukup tipe datanya saja yang ditentukan saat deklarasi variabel. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut car_three: Car;\ncar_three = Car{\n brand: String::from("Audi"),\n model: String::from("Le Mans Quattro"),\n};\n')),(0,i.kt)("h3",{id:"-variabel-struct-dengan-nilai-berasal-dari-struct-lain"},"\u25c9 Variabel struct dengan nilai berasal dari struct lain"),(0,i.kt)("p",null,"Jika ada kebutuhan untuk membuat variabel object struct yang nilai property-nya sebagian adalah berasal dari variabel struct lain, bisa manfaatkan syntax ",(0,i.kt)("inlineCode",{parentName:"p"},".."),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut car_three: Car;\ncar_three = Car{\n brand: String::from("Audi"),\n model: String::from("Le Mans Quattro"),\n};\nprintln!("{} {}", car_three.brand, car_three.model);\n\nlet mut car_four: Car;\ncar_four = Car{\n brand: String::from("Audi Brand"),\n ..car_three\n};\nprintln!("{} {}", car_four.brand, car_four.model);\n')),(0,i.kt)("p",null,"Pada contoh di atas, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"car_four")," property ",(0,i.kt)("inlineCode",{parentName:"p"},"brand"),"-nya diisi dengan ",(0,i.kt)("inlineCode",{parentName:"p"},'"Audi Brand"'),". Sedangkan property-property lainnya nilai didapat dari nilai propery milik ",(0,i.kt)("inlineCode",{parentName:"p"},"car_three"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Struct",src:t(341).Z,width:"511",height:"108"})),(0,i.kt)("p",null,"Coba jalankan program, akan terlihat nilai dari variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"car_four")," untuk property selain ",(0,i.kt)("inlineCode",{parentName:"p"},"brand")," adalah sama dengan nilai property-property ",(0,i.kt)("inlineCode",{parentName:"p"},"car_three"),"."),(0,i.kt)("h3",{id:"-field-init-shorthand"},"\u25c9 ",(0,i.kt)("em",{parentName:"h3"},"Field init shorthand")),(0,i.kt)("p",null,"Jika ada variabel yang namanya sama persis dengan nama property sebuah struct, maka dalam deklarasi variabel struct bisa menggunakan teknik penulisan seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let model = String::from("Corvette C1");\n\nlet car_five = Car{\n brand: String::from("Chevrolet"),\n model,\n};\n')),(0,i.kt)("p",null,"Cukup tulis nama variabelnya saja tanpa value."),(0,i.kt)("p",null,"Teknik ",(0,i.kt)("em",{parentName:"p"},"shorthand")," ini bisa juga digunakan dalam fungsi. Contoh di bawah ini ada fungsi bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"new_car")," yang memiliki nama parameter adalah sama persis dengan nama property struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Car"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn new_car(brand: String, model: String) -> Car {\n Car{\n brand,\n model,\n }\n}\n\nfn main() {\n let car_six = new_car(\n String::from("Chevrolet"),\n String::from("Corvette C6")\n );\n // ...\n}\n')),(0,i.kt)("h3",{id:"-deklarasi-nilai-struct-secara-horizontal"},"\u25c9 Deklarasi nilai struct secara horizontal"),(0,i.kt)("p",null,"Umumnya, operasi ",(0,i.kt)("em",{parentName:"p"},"assignment")," nilai struct dituliskan secara vertikal. Untuk struct yang property-nya sedikit biasanya dituliskan secara horizontal contohnya seperti di bawah ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"struct Point {\n x: f32,\n y: f32,\n}\n\nlet point_one = Point { x: 3.14, y: 8.0 };\n")),(0,i.kt)("h3",{id:"-destructuring-assignment"},"\u25c9 ",(0,i.kt)("em",{parentName:"h3"},"Destructuring assignment")),(0,i.kt)("p",null,"Teknik penulisan ini bisa dipakai dalam case di mana nilai property struct perlu ditampung ke variabel baru. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let point_one = Point { x: 3.14, y: 8.0 };\n\nlet Point { x: x_one, y: y_one } = point_one;\nprintln!("x_one: {}", x_one);\nprintln!("y_one: {}", y_one);\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"x_one")," di atas akan menampung nilai dari ",(0,i.kt)("inlineCode",{parentName:"li"},"point_one.x")),(0,i.kt)("li",{parentName:"ul"},"Variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"y_one")," di atas akan menampung nilai dari ",(0,i.kt)("inlineCode",{parentName:"li"},"point_one.y"))),(0,i.kt)("p",null,"Jika tidak semua property struct perlu untuk ditampung ke variabel baru, maka gunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"_")," untuk property yang nilainya tidak ditampung. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let point_one = Point { x: 3.14, y: 8.0 };\n\nlet Point { x: _, y: y_one } = point_one;\nprintln!("y_one: {}", y_one);\n')),(0,i.kt)("h2",{id:"a235-unit-like-structs"},"A.23.5. ",(0,i.kt)("em",{parentName:"h2"},"Unit-like structs")),(0,i.kt)("p",null,(0,i.kt)("em",{parentName:"p"},"Unit-like structs")," adalah struct yang didefinisikan tanpa property. Cara deklrasinya bisa dilihat pada contoh berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"struct StructOne;\n\nlet data_one = StructOne;\n")),(0,i.kt)("p",null,"Teknik pembuatan struct ini berguna ketika ada case di mana ada kebutuhan untuk mengimplementasikan sebuah trait ke suatu tipe data. Lebih jelasnya akan dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/traits"},"Traits"),"."),(0,i.kt)("h2",{id:"a236-debugging-value-struct-menggunakan-derivedebug"},"A.23.6. Debugging value struct menggunakan ",(0,i.kt)("inlineCode",{parentName:"h2"},"#[derive(Debug)]")),(0,i.kt)("p",null,(0,i.kt)("em",{parentName:"p"},"By default"),", error akan muncul saat berusaha menampilkan nilai variabel struct (bukan nilai property-nya, tapi nilai variabel struct-nya) menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),". Ini disebabkan karena data yang bisa ditampilkan menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"println")," harus memiliki trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," (atau ",(0,i.kt)("inlineCode",{parentName:"p"},"Display"),")."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Struct",src:t(6091).Z,width:"743",height:"308"})),(0,i.kt)("p",null,"Lalu jika ingin melihat nilai property struct bagaimana solusinya? Bisa dengan menampilkan nilai property satu per satu, tapi pastinya butuh effort."),(0,i.kt)("p",null,"Cara yang lebih elegan adalah dengan menggunakan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"#[derive(Debug)]"),". Penerapannya cukup dengan menuliskan atribut tersebut tepat di atas deklarasi struct. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[derive(Debug)]\nstruct GamingConsole {\n name: String\n}\n\nlet console_one = GamingConsole{\n name: String::from("PlayStation 5"),\n};\n\nprintln!("data_struct_one: {:#?}", console_one);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Struct",src:t(7542).Z,width:"510",height:"330"})),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih detailnya mengenai traits dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits")),(0,i.kt)("li",{parentName:"ul"},"Lebih detailnya mengenai attribute dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/attributes"},"Attributes")))),(0,i.kt)("h2",{id:"a237-tuple-struct"},"A.23.7. Tuple struct"),(0,i.kt)("p",null,"Tuple struct adalah struct yang didefinisikan dengan gaya tuple. Property pada tuple struct diakses menggunakan notasi pengaksesan tuple item."),(0,i.kt)("p",null,"Pada contoh berikut tuple struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Color")," didefinisikan dengan isi 3 buah item yang kesemuanya bertipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),". Lalu tipe data tuple struct tersebut digunakan untuk membuat variabel baru bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"red"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'struct Color(i32, i32, i32);\n\nlet red = Color(255, 0, 0);\n\nprintln!("{:?} {:?} {:?}", red.0, red.1, red.2);\n')),(0,i.kt)("p",null,"Bisa dilihat di contoh, property diakses menggunakan nomor indeks dengan notasi penulisan ",(0,i.kt)("inlineCode",{parentName:"p"},"variable.index"),"."),(0,i.kt)("p",null,"Contoh lainnya, tuple struct ",(0,i.kt)("inlineCode",{parentName:"p"},"SomeTupleStruct")," berikut dideklarasikan memiliki item ke-1 bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"i32")," dan item ke-2 bertipe boolean."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'struct SomeTupleStruct(i32, bool);\n\nlet some_data = SomeTupleStruct(0, false);\n\nprintln!("{:?} {:?}", some_data.0, some_data.1);\n')),(0,i.kt)("h2",{id:"a238-struct-property-visibility"},"A.23.8. Struct property visibility"),(0,i.kt)("p",null,"Sekarang mari kita coba praktikkan satu program lagi, namun kali ini sedikit berbeda, struct kita definisikan sebagai module item."),(0,i.kt)("p",null,"Silakan siapkan program dengan struktur seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 main.rs\n \u251c\u2500\u2500\u2500 models.rs\n \u2514\u2500\u2500\u2500 models\n \u2514\u2500\u2500\u2500 game.rs\n")),(0,i.kt)("p",null,"Lalu isi file program dengan kode di bawah ini. Sebuah struct dengan path ",(0,i.kt)("inlineCode",{parentName:"p"},"models::game::GamingConsole"),", dan satu buah object di fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," yang dibuat dari struct tersebut. Pastikan definisi semua module item adalah publik (ada keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub"),")."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod models;\n\nfn main() {\n let ps5 = models::game::GamingConsole{\n name: String::from("PS 5")\n };\n println!("{:#?}", ps5);\n}\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/models.rs"',title:'"src/models.rs"'},"pub mod game;\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/models/game.rs"',title:'"src/models/game.rs"'},"#[derive(Debug)]\npub struct GamingConsole {\n name: String\n}\n")),(0,i.kt)("p",null,"Ada yang aneh, baris kode pembuatan variabel object ",(0,i.kt)("inlineCode",{parentName:"p"},"ps5")," terdeteksi sebagai error. Padahal definisi submodule dan item-nya sudah publik semua."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Struct",src:t(7728).Z,width:"419",height:"185"})),(0,i.kt)("p",null,"Jika dilihat dari keterangan error, sebenarnya cukup jelas bagian mana yang menjadi sumber masalah, yaitu field ",(0,i.kt)("inlineCode",{parentName:"p"},"name")," yang terdeteksi sebagai private property."),(0,i.kt)("p",null,"Struct jika didefinisikan di file yang sama dengan statement pemanggilan struct tersebut tidak akan menghasilkan error. Tetapi jika definisi struct-nya terpisah dari statement pemanggilan struct (seperti contoh di atas), maka field dari struct tersebut harus publik."),(0,i.kt)("p",null,"Caranya membuat field sebagai publik adalah dengan menambahkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," pada property struct. Silakan ubah definisi struct ",(0,i.kt)("inlineCode",{parentName:"p"},"GamingConsole")," menjadi seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"// before\npub struct GamingConsole {\n name: String\n}\n\n// after\npub struct GamingConsole {\n pub name: String\n}\n")),(0,i.kt)("p",null,"Bisa dilihat keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," ditambahkan pada deklarasi property struct. yang sebelumnya ",(0,i.kt)("inlineCode",{parentName:"p"},"name: String")," sekarang ada keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," didepannya."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai visibility property dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/visibility-privacy"},"Module System \u279c Visibility & Privacy"))),(0,i.kt)("h2",{id:"a239-tuple-struct-property-visibility"},"A.23.9. Tuple struct property visibility"),(0,i.kt)("p",null,"Lalu bagaimana dengan tuple struct? apakah property-nya juga harus didefinisikan publik agar bisa diakses dari tempat lain? Jawabannya ada di praktik berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 main.rs\n \u251c\u2500\u2500\u2500 models.rs\n \u2514\u2500\u2500\u2500 models\n \u2514\u2500\u2500\u2500 color.rs\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod models;\n\nfn main() {\n let red = models::color::Color(255, 255, 0);\n println!("{:#?}", red);\n}\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/models.rs"',title:'"src/models.rs"'},"pub mod color;\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/models/color.rs"',title:'"src/models/color.rs"'},"#[derive(Debug)]\npub struct Color(i32, i32, i32);\n")),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Struct",src:t(6610).Z,width:"626",height:"255"})),(0,i.kt)("p",null,"Yap, error yang mirip juga muncul. Jadi jawaban dari pertanyaan sebelumnya adalah iya, property tuple struct juga harus publik agar bisa diakses dari tempat lain."),(0,i.kt)("p",null,"Cara deklarasi tuple struct dengan property publik adalah dengan menambahkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," di masing-masing deklarasi parameter tuple struct. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"// before\npub struct Color(i32, i32, i32);\n\n// after\npub struct Color(pub i32, pub i32, pub i32);\n")),(0,i.kt)("p",null,"Jalankan program untuk melihat hasilnya, error tidak muncul."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai visibility property dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/visibility-privacy"},"Module System \u279c Visibility & Privacy"))),(0,i.kt)("h2",{id:"a2310-generic-pada-struct"},"A.23.10. Generic pada struct"),(0,i.kt)("p",null,"Pembahasan mengenai generic pada struct ada pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/generics#a365-generics-struct"},"Generics"),"."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/struct"},"github.com/novalagung/dasarpemrogramanrust-example/../struct")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch05-00-structs.html"},"https://doc.rust-lang.org/book/ch05-00-structs.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch05-01-defining-structs.html"},"https://doc.rust-lang.org/book/ch05-01-defining-structs.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.struct.html"},"https://doc.rust-lang.org/std/keyword.struct.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/custom_types/structs.html"},"https://doc.rust-lang.org/rust-by-example/custom_types/structs.html"))))}o.isMDXComponent=!0},1226:(a,e,t)=>{t.d(e,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjwAAAB7CAIAAAD/r80wAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0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bxlAM5V/Vd0d5HX+4uBqtmzRSySKX+8ZfCWATjv2B8OEgZdAAD1P1/9JwYHANQfAABQfwAAQP0BAAD1BwBA/QEAAPUHAADUHwAAUH8AAED9AQDgSPkf6Emv3lPCWuwAAAAASUVORK5CYII="},6091:(a,e,t)=>{t.d(e,{Z:()=>n});const n=t.p+"assets/images/struct-4-86fb5f564d330bc2d1cc10e13ea2d649.png"},7542:(a,e,t)=>{t.d(e,{Z:()=>n});const n=t.p+"assets/images/struct-5-5e013d5895bef6a938e2c1333ff52205.png"},7728:(a,e,t)=>{t.d(e,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAaMAAAC5CAIAAAAKzcfqAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL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v5blGfTpOxSK8TiGjX8MsnnaWhRGq5fHDqrhfwNiTd8T9abOW6dv1YTjrLMhHb6vQFxfSy4aPp41MJDARzPtrOvhf/6jt07UiXR7XNYdcL6Ux8/Z0XIR02tKRz/LLCfZM6ptw3Q8AisSKd4VqRXiUod2LImKGzvayH5YSxSdJZumlOyU0ipFMOYInUfEN9uIJu2uMr0/QyHBH6dGXPnUbYpQthd97FS+ZfvbnGn0xWkE6HrqcXn25JOn+kwnSu6X63BmGs7KdrzkcZwNL2sFEh3YcmSrWqJF3mGEr1SjrpgpWoSpEuDaaGpDPxbOnTOZt0Qbqw585x1pqRThGkBenKkYTogKx29NqM1RajEA07E4t80vaw0SCdjk/t+lqfztlJN5Le1uBIV4TARr07dC1JJ3y64t/ufbqktHPnjydU+3cNSYdPh40m6XK/LHPuKkln+ua8gYj2/XR+n51AVWxYtgPS+TGvq25GJIKuAN0TJ/vpzHIV6Xrtp6vw+xr7dGIAl346bByj12NmaNXo1I06n84de53vaUTCDoxGRk4d58sde60bq83308Sn8926wZDOHXstElSSTo+9lhBpTzodgdZFtan0jZnI2Cs21KRb1y8teT5dn111A1Tkebphe/2L5+kwSDescoNi82heOphdWwXvSAw3iGl72HCRbtuW6axqvr7rR49+9rP7e3+yvta40euec8Oc58//9dr/bXp+CHOo33t92U1D28OGi3SqdqqqqSru//7kpz+a3PnOsz9mDWv6X0Pbw4aLdFnVVFLVNLtds4Y1/a+h7WHDRToMwzBIh2EYBukwDMMgHYZhGKTDMAyDdBiGYZAOwzAM0mEYBukwDMNG3/4fXrze1tJWD6UAAAAASUVORK5CYII="},6610:(a,e,t)=>{t.d(e,{Z:()=>n});const n=t.p+"assets/images/struct-7-517c0402e96dfd5898464887fa79ec98.png"}}]); \ No newline at end of file diff --git a/assets/js/935f2afb.cfcb5351.js b/assets/js/935f2afb.20a4105a.js similarity index 99% rename from assets/js/935f2afb.cfcb5351.js rename to assets/js/935f2afb.20a4105a.js index df4d9146..ebd0833a 100644 --- a/assets/js/935f2afb.cfcb5351.js +++ b/assets/js/935f2afb.20a4105a.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[53],{1109:a=>{a.exports=JSON.parse('{"pluginId":"default","version":"current","label":"Next","banner":null,"badge":false,"noIndex":false,"className":"docs-version-current","isLast":true,"docsSidebars":{"tutorialSidebar":[{"type":"link","label":"Dasar Pemrograman Rust","href":"/","docId":"index"},{"type":"link","label":"Pengenalan Rust Programming","href":"/pengelanan-rust-programming","docId":"pengelanan-rust-programming"},{"type":"link","label":"Version Changelogs & Updates","href":"/CHANGELOG","docId":"CHANGELOG"},{"type":"link","label":"Contribution & Tech Stack","href":"/CONTRIBUTING","docId":"CONTRIBUTING"},{"type":"link","label":"Download versi PDF","href":"/download-pdf","docId":"download-pdf"},{"type":"link","label":"Lisensi & Distribusi Konten","href":"/LICENSE","docId":"LICENSE"},{"type":"category","label":"Persiapan dan Instalasi","collapsible":false,"collapsed":false,"items":[{"type":"link","label":"Instalasi Rust","href":"/installation/instalasi-rust","docId":"installation/instalasi-rust"},{"type":"link","label":"Rust Editor & Plugin","href":"/installation/rust-editor-plugin","docId":"installation/rust-editor-plugin"}]},{"type":"category","label":"Pemrograman Rust Dasar","collapsible":false,"collapsed":false,"items":[{"type":"link","label":"A.1. Program Pertama \u279c Hello Rust","href":"/basic/hello-rust","docId":"basic/hello-rust"},{"type":"link","label":"A.2. Build dan Run Program Rust","href":"/basic/build-dan-run-program-rust","docId":"basic/build-dan-run-program-rust"},{"type":"link","label":"A.3. Komentar","href":"/basic/komentar","docId":"basic/komentar"},{"type":"link","label":"A.4. Variabel","href":"/basic/variabel","docId":"basic/variabel"},{"type":"link","label":"A.5. Tipe Data \u279c Primitive Scalar","href":"/basic/tipe-data-primitive-scalar","docId":"basic/tipe-data-primitive-scalar"},{"type":"link","label":"A.6. Tipe Data \u279c String Literal (&str)","href":"/basic/tipe-data-string-literal","docId":"basic/tipe-data-string-literal"},{"type":"link","label":"A.7. Konstanta","href":"/basic/konstanta","docId":"basic/konstanta"},{"type":"link","label":"A.8. Operator","href":"/basic/operator","docId":"basic/operator"},{"type":"link","label":"A.9. Seleksi Kondisi \u279c if, else if, else","href":"/basic/seleksi-kondisi-if","docId":"basic/seleksi-kondisi-if"},{"type":"link","label":"A.10. Perulangan \u279c while","href":"/basic/perulangan-while","docId":"basic/perulangan-while"},{"type":"link","label":"A.11. Perulangan \u279c loop, break, continue, label","href":"/basic/perulangan-loop-break-continue-label","docId":"basic/perulangan-loop-break-continue-label"},{"type":"link","label":"A.12. Perulangan \u279c for in","href":"/basic/perulangan-for-in","docId":"basic/perulangan-for-in"},{"type":"link","label":"A.13. Array","href":"/basic/array","docId":"basic/array"},{"type":"link","label":"A.14. Slice (Basic)","href":"/basic/slice","docId":"basic/slice"},{"type":"link","label":"A.15. Tuple","href":"/basic/tuple","docId":"basic/tuple"},{"type":"link","label":"A.16. Vector","href":"/basic/vector","docId":"basic/vector"},{"type":"link","label":"A.17. Function","href":"/basic/function","docId":"basic/function"},{"type":"link","label":"A.18. Module System \u279c Path & Item","href":"/basic/path-item","docId":"basic/path-item"},{"type":"link","label":"A.19. Module System \u279c Package & Crate","href":"/basic/package-crate","docId":"basic/package-crate"},{"type":"link","label":"A.20. Module System \u279c Module","href":"/basic/module-basic","docId":"basic/module-basic"},{"type":"link","label":"A.21. Module System \u279c Inline Module","href":"/basic/module-inline","docId":"basic/module-inline"},{"type":"link","label":"A.22. Module System \u279c Scope & Akses Item","href":"/basic/module-scope-item-access","docId":"basic/module-scope-item-access"},{"type":"link","label":"A.23. Struct","href":"/basic/struct","docId":"basic/struct"},{"type":"link","label":"A.24. Associated Function","href":"/basic/associated-function","docId":"basic/associated-function"},{"type":"link","label":"A.25. Method","href":"/basic/method","docId":"basic/method"},{"type":"link","label":"A.26. Enum","href":"/basic/enum","docId":"basic/enum"},{"type":"link","label":"A.27. Type Alias & Casting","href":"/basic/type-alias-casting","docId":"basic/type-alias-casting"},{"type":"link","label":"A.28. Module System \u279c Visibility & Privacy","href":"/basic/visibility-privacy","docId":"basic/visibility-privacy"},{"type":"link","label":"A.29. Module System \u279c Use, Import, Re-export","href":"/basic/use","docId":"basic/use"},{"type":"link","label":"A.30. Block Expression","href":"/basic/block-expression","docId":"basic/block-expression"},{"type":"link","label":"A.31. Shadowing","href":"/basic/shadowing","docId":"basic/shadowing"},{"type":"link","label":"A.32. Basic Memory Management","href":"/basic/basic-memory-management","docId":"basic/basic-memory-management"},{"type":"link","label":"A.33. Pointer & References","href":"/basic/pointer-references","docId":"basic/pointer-references"},{"type":"link","label":"A.34. Ownership","href":"/basic/ownership","docId":"basic/ownership"},{"type":"link","label":"A.35. Borrowing","href":"/basic/borrowing","docId":"basic/borrowing"},{"type":"link","label":"A.36. Traits","href":"/basic/traits","docId":"basic/traits"},{"type":"link","label":"A.37. Traits \u279c Advanced","href":"/basic/advanced-traits","docId":"basic/advanced-traits"},{"type":"link","label":"A.38. Generics","href":"/basic/generics","docId":"basic/generics"},{"type":"link","label":"A.39. Tipe Data \u279c Option","href":"/basic/option-type","docId":"basic/option-type"},{"type":"link","label":"A.40. Tipe Data \u279c Result","href":"/basic/result-type","docId":"basic/result-type"},{"type":"link","label":"A.41. Operator ?","href":"/basic/operator-tanda-tanya","docId":"basic/operator-tanda-tanya"},{"type":"link","label":"A.42. Pattern Matching","href":"/basic/pattern-matching","docId":"basic/pattern-matching"},{"type":"link","label":"A.43. Static Item","href":"/basic/static","docId":"basic/static"},{"type":"link","label":"A.44. Lifetime","href":"/basic/lifetime","docId":"basic/lifetime"},{"type":"link","label":"A.45. Slice Memory Management","href":"/basic/slice-memory-management","docId":"basic/slice-memory-management"},{"type":"link","label":"A.46. String Literal (&str) vs. String Custom Type","href":"/basic/string-slice-vs-string-literal","docId":"basic/string-slice-vs-string-literal"},{"type":"link","label":"A.47. Tipe Data \u279c String Custom Type","href":"/basic/tipe-data-custom-type-string-slice","docId":"basic/tipe-data-custom-type-string-slice"},{"type":"link","label":"A.48. Closures","href":"/basic/closures","docId":"basic/closures"},{"type":"link","label":"A.49. Trait \u279c Function (Fn, FnMut, FnOnce)","href":"/basic/trait-function","docId":"basic/trait-function"},{"type":"link","label":"A.50. Trait \u279c Iterator","href":"/basic/trait-iterator","docId":"basic/trait-iterator"},{"type":"link","label":"A.51. Attributes","href":"/basic/attributes","docId":"basic/attributes"},{"type":"link","label":"A.52. Date Time","href":"/basic/datetime","docId":"basic/datetime"},{"type":"link","label":"A.53. File, Path, Directory","href":"/basic/file-path-directory","docId":"basic/file-path-directory"},{"type":"link","label":"A.54. Error \u279c Unrecoverable Error / Panic","href":"/basic/unrecoverable-panic-error","docId":"basic/unrecoverable-panic-error"},{"type":"link","label":"A.55. Error \u279c Recoverable Error & Error Handling","href":"/basic/recoverable-error-handling","docId":"basic/recoverable-error-handling"}]}]},"docs":{"basic/advanced-traits":{"id":"basic/advanced-traits","title":"A.37. Traits \u279c Advanced","description":"Chapter ini merupakan kelanjutan dari chapter sebelumnya. Di sini kita fokus ke pembuatan local trait, macam-macam implementasi traits, traits bound syntax, associated types, dan topik yang masih relevan dengan traits lainnya.","sidebar":"tutorialSidebar"},"basic/array":{"id":"basic/array","title":"A.13. Tipe Data \u279c Array","description":"Belajar array pada rust. Contoh penerapan array, iterasi array, dan operasi lainnya pada array","sidebar":"tutorialSidebar"},"basic/associated-function":{"id":"basic/associated-function","title":"A.24. Associated Function","description":"Chapter ini membahas tentang associated function. Kita akan belajar apa itu associated function dan apa perbedannya dengan fungsi biasa.","sidebar":"tutorialSidebar"},"basic/attributes":{"id":"basic/attributes","title":"A.51. Attributes","description":"Kita telah beberapa kali menggunakan attributes pada chapter-chapter sebelumnya, contohnya seperti #[derive(Debug)]. Pada chapter ini kita akan bahas tentang apa sebenarnya attributes, macam-macam jenisnya, beserta kegunaannya.","sidebar":"tutorialSidebar"},"basic/basic-memory-management":{"id":"basic/basic-memory-management","title":"A.32. Basic Memory Management","description":"Pada chapter ini kita akan belajar tentang salah satu hal penting dalam topik pemrograman secara general, yaitu memory management yang mencakup pembahasan tentang alamat memori, pointer, heap, stack, dan juga error-error yang terjadi karena kesalahan dalam manajemen memori.","sidebar":"tutorialSidebar"},"basic/block-expression":{"id":"basic/block-expression","title":"A.30. Block Expression","description":"Pada chapter ini kita akan belajar tentang block expression.","sidebar":"tutorialSidebar"},"basic/borrowing":{"id":"basic/borrowing","title":"A.35. Borrowing","description":"Pada chapter ini kita akan belajar tentang apa itu borrowing dalam Rust programming.","sidebar":"tutorialSidebar"},"basic/build-dan-run-program-rust":{"id":"basic/build-dan-run-program-rust","title":"A.2. Build dan Run Program Rust","description":"Cara run program Rust menggunakan cargo. Pada chapter ini kita akan belajar lebih lanjut tentang command untuk proses build dan run dalam program Rust. Sebelumnya kita sudah belajar tentang cargo new dan cargo run, selain command tersebut ada juga command lain yaitu cargo build untuk proses kompilasi build kode program.","sidebar":"tutorialSidebar"},"basic/closures":{"id":"basic/closures","title":"A.48. Closures","description":"Chapter ini membahas tentang closures. Closures sendiri merupakan block fungsi anonimus (anonymous function) yang memiliki kelebihan bisa mengakses item-tem yang posisinya berada di luar block closure tersebut tetapi masih dalam current block scope.","sidebar":"tutorialSidebar"},"basic/datetime":{"id":"basic/datetime","title":"A.52. Date Time","description":"Pada chapter ini kita akan mempelajari tentang tipe data datetime yang ada di Rust programming.","sidebar":"tutorialSidebar"},"basic/enum":{"id":"basic/enum","title":"A.26. Enum","description":"Enum atau enumerated type adalah sebuah tipe data yang digunakan untuk menampung nilai konstan. Pada chapter ini kita akan mempelajarinya.","sidebar":"tutorialSidebar"},"basic/file-path-directory":{"id":"basic/file-path-directory","title":"A.53. File, Path, Directory","description":"Pada chapter ini kita akan belajar tentang beberapa API milik Rust yang disediakan untuk manajemen path dan file system.","sidebar":"tutorialSidebar"},"basic/function":{"id":"basic/function","title":"A.17. Function","description":"Pada chapter ini kita akan belajar tentang function atau fungsi.","sidebar":"tutorialSidebar"},"basic/generics":{"id":"basic/generics","title":"A.38. Generics","description":"Chapter ini membahas tentang generics.","sidebar":"tutorialSidebar"},"basic/hello-rust":{"id":"basic/hello-rust","title":"A.1. Program Pertama \u279c Hello Rust","description":"Belajar membuat program hello world di Rust, dimulai dengan pembuatan program Hello World sederhana.","sidebar":"tutorialSidebar"},"basic/komentar":{"id":"basic/komentar","title":"A.3. Komentar","description":"Pada chapter ini kita akan membahas tentang komentar pada pemrograman Rust. Ada beberapa jenis komentar yang tersedia, namun untuk sekarang yang penting diketahui hanya 2.","sidebar":"tutorialSidebar"},"basic/konstanta":{"id":"basic/konstanta","title":"A.7. Konstanta","description":"Chapter ini membahas tentang konstanta di bahasa Rust.","sidebar":"tutorialSidebar"},"basic/lifetime":{"id":"basic/lifetime","title":"A.44. Lifetime","description":"Pada chapter ini kita akan belajar tentang lifetime. Lifetime adalah yang digunakan oleh Rust compiler untuk memonitor umur dari references agar tetap dianggap valid.","sidebar":"tutorialSidebar"},"basic/method":{"id":"basic/method","title":"A.25. Method","description":"Pada chapter ini kita akan belajar tentang method beserta perbedaannya dengan associated function.","sidebar":"tutorialSidebar"},"basic/module-basic":{"id":"basic/module-basic","title":"A.20. Module System \u279c Module","description":"Module adalah salah satu chapter yang cukup penting dalam pemrograman Rust. Pada bagian ini kita akan mempelajari dasarnya.","sidebar":"tutorialSidebar"},"basic/module-inline":{"id":"basic/module-inline","title":"A.21. Module System \u279c Inline Module","description":"Pada chapter sebelumnya kita telah belajar cara manajemen module. Pembahasan tersebut dilanjut pada chapter ini, yaitu tentang inline module.","sidebar":"tutorialSidebar"},"basic/module-scope-item-access":{"id":"basic/module-scope-item-access","title":"A.22. Module System \u279c Scope & Akses Item","description":"Pembahasan chapter ini masih dalam lingkup module system, yaitu tentang scope dan pengakesan module item.","sidebar":"tutorialSidebar"},"basic/operator":{"id":"basic/operator","title":"A.8. Operator","description":"Chapter ini membahas mengenai operator pada pemrograman rust.","sidebar":"tutorialSidebar"},"basic/operator-tanda-tanya":{"id":"basic/operator-tanda-tanya","title":"A.41. Operator ?","description":"Operator ? (atau question mark operator) adalah operator yang cukup berguna untuk operasi unwrap nilai dari tipe Result atau Option. Pada chapter ini kita akan belajar tentang operator tersebut.","sidebar":"tutorialSidebar"},"basic/option-type":{"id":"basic/option-type","title":"A.39. Tipe Data \u279c Option","description":"Option adalah salah satu tipe data penting pada Rust programming, digunakan untuk menampung data yang isinya bisa berpotensi kosong (None). Chapter ini membahas tentang tipe data tersebut.","sidebar":"tutorialSidebar"},"basic/ownership":{"id":"basic/ownership","title":"A.34. Ownership","description":"Chapter ini berisi pembahasan tentang ownership, bagaimana Rust melakukan manajemen memory dengan menerapkan approach ownership ini.","sidebar":"tutorialSidebar"},"basic/package-crate":{"id":"basic/package-crate","title":"A.19. Module System \u279c Package & Crate","description":"Chapter ini membahas mengenai konsep package dan path dalam Rust programming. Pembelajaran dimulai dari pembahasan mengenai konsep crate terlebih dahulu, kemudian masuk ke package.","sidebar":"tutorialSidebar"},"basic/path-item":{"id":"basic/path-item","title":"A.18. Module System \u279c Path & Item","description":"Chapter ini membahas tentang konsep path dan item dalam Rust programming.","sidebar":"tutorialSidebar"},"basic/pattern-matching":{"id":"basic/pattern-matching","title":"A.42. Pattern Matching","description":"Chapter ini membahas tentang pattern matching, sebuah teknik yang lebih advance dibanding seleksi kondisi biasa.","sidebar":"tutorialSidebar"},"basic/perulangan-for-in":{"id":"basic/perulangan-for-in","title":"A.12. Perulangan \u279c for in","description":"for in adalah salah satu keyword untuk operasi perulangan yang ada di Rust selain loop dan while. Pada chapter ini kita akan mempelajarinya.","sidebar":"tutorialSidebar"},"basic/perulangan-loop-break-continue-label":{"id":"basic/perulangan-loop-break-continue-label","title":"A.11. Perulangan \u279c loop, break, continue, label","description":"Selain keyword while, ada juga keyword loop yang fungsi dasarnya adalah sama, yaitu untuk perulangan.","sidebar":"tutorialSidebar"},"basic/perulangan-while":{"id":"basic/perulangan-while","title":"A.10. Perulangan \u279c while","description":"Di Rust ada beberapa cara untuk melakukan perulangan, salah satunya adalah dengan menggunakan keyword while, dan pada chapter ini kita akan mempelajarinya.","sidebar":"tutorialSidebar"},"basic/pointer-references":{"id":"basic/pointer-references","title":"A.33. Pointer & References","description":"Chapter ini membahas tentang apa itu pointer, references, dan dereferences. Pembelajaran dimulai tentang konsep dan praktik dasar tentang ketiga topik tersebut, kemudian diikuti dengan pembahasan tentang karakteristik pointer & reference.","sidebar":"tutorialSidebar"},"basic/recoverable-error-handling":{"id":"basic/recoverable-error-handling","title":"A.55. Error \u279c Recoverable Error & Error Handling","description":"Chapter ini merupakan kelanjutan dari chapter sebelumnya tentang pembahasan topic error. Kali ini fokus kita lebih ke recoverable error dan penanganannya (error handling / error propagation).","sidebar":"tutorialSidebar"},"basic/result-type":{"id":"basic/result-type","title":"A.40. Tipe Data \u279c Result","description":"Chapter ini membahas tentang tipe data Result, yaitu tipe data yang digunakan untuk menampung nilai yang isinya bisa berupa penanda operasi sukses (Ok) dan data, atau error (Err) beserta keterangan errornya.","sidebar":"tutorialSidebar"},"basic/seleksi-kondisi-if":{"id":"basic/seleksi-kondisi-if","title":"A.9. Seleksi Kondisi \u279c if, else if, else","description":"Pada chapter ini kita akan bahas tentang penerapan if untuk kontrol alur program.","sidebar":"tutorialSidebar"},"basic/shadowing":{"id":"basic/shadowing","title":"A.31. Shadowing","description":"Pada chapter ini kita akan belajar tentang shadowing pada variable dan apa perbedaannya dibanding variable mutable.","sidebar":"tutorialSidebar"},"basic/slice":{"id":"basic/slice","title":"A.14. Slice (Basic)","description":"Pada bab ini kita belajar tentang apa itu slice, apa perbedaan slice dan array, slicing atau borrowing pada slice, dan juga slice mutability.","sidebar":"tutorialSidebar"},"basic/slice-memory-management":{"id":"basic/slice-memory-management","title":"A.45. Slice Memory Management","description":"Kita telah mempelajari tipe data Array dan Vector, serta sudah beberapa kali menggunakan tipe data string slice (String). 3 tipe data itu memiliki kemiripan, yaitu kesemuanya termasuk dalam kategori tipe data slice.","sidebar":"tutorialSidebar"},"basic/static":{"id":"basic/static","title":"A.43. Static Item","description":"Pada chapter ini kita akan bahas tentang apa itu static item, dan perbedaanya dibanding konstanta.","sidebar":"tutorialSidebar"},"basic/string-slice-vs-string-literal":{"id":"basic/string-slice-vs-string-literal","title":"A.46. String Literal (&str) vs. String Custom Type","description":"Pada chapter sebelumnya kita telah membahas tentang bagaimana data slice di-manage di memory. Ada beberapa tipe data yang masuk dalam kategori slice, yang salah satunya adalah string slice atau String.","sidebar":"tutorialSidebar"},"basic/struct":{"id":"basic/struct","title":"A.23. Struct","description":"Pada chapter ini kita akan belajar tentang struct.","sidebar":"tutorialSidebar"},"basic/tipe-data-custom-type-string-slice":{"id":"basic/tipe-data-custom-type-string-slice","title":"A.47. Tipe Data \u279c String Custom Type","description":"Pembahasan kali ini lingkupnya masih dalam topik custom type String.","sidebar":"tutorialSidebar"},"basic/tipe-data-primitive-scalar":{"id":"basic/tipe-data-primitive-scalar","title":"A.5. Tipe Data \u279c Primitive Scalar","description":"Tipe data di Rust dikategorikan menjadi beberapa group, salah satunya adalah group tipe data primitif scalar atau biasa disebut scalar types. Pada chapter ini kita akan mempelajarinya.","sidebar":"tutorialSidebar"},"basic/tipe-data-string-literal":{"id":"basic/tipe-data-string-literal","title":"A.6. Tipe Data \u279c String Literal (&str)","description":"String adalah tipe data penting dalam pemrograman manapun. Biasanya tiap bahasa punya cara berbeda dalam meng-handle tipe ini. Di bahasa Rust, ada dua jenis tipe data string:","sidebar":"tutorialSidebar"},"basic/trait-function":{"id":"basic/trait-function","title":"A.49. Trait \u279c Function (Fn, FnMut, FnOnce)","description":"Chapter ini merupakan topik lanjutan dari chapter sebelumnya, di sini kita akan bahas beberapa jenis trait yang digunakan di closure.","sidebar":"tutorialSidebar"},"basic/trait-iterator":{"id":"basic/trait-iterator","title":"A.50. Trait \u279c Iterator","description":"Iterator adalah salah satu trait dan tipe data custom penting pada Rust programming, gunanya untuk iterasi data. Di chapter ini kita akan mempelajarinya beserta beberapa module item lainnya yang masih relevan dengan topik Iterator.","sidebar":"tutorialSidebar"},"basic/traits":{"id":"basic/traits","title":"A.36. Traits","description":"Trait jika diartikan dalam Bahasa Indonesia artinya adalah sifat. Chapter ini akan membahas tentang apa itu trait, apa kegunaannya, dan bagaimana cara penerapannya di Rust programming.","sidebar":"tutorialSidebar"},"basic/tuple":{"id":"basic/tuple","title":"A.15. Tipe Data \u279c Tuple","description":"Pada chapter ini kita akan membahas tentang tipe data kolektif bernama Tuple.","sidebar":"tutorialSidebar"},"basic/type-alias-casting":{"id":"basic/type-alias-casting","title":"A.27. Type Alias & Casting","description":"Chapter ini membahas tentang type alias dan juga casting (explicit conversion) pada tipe data primitif scalar.","sidebar":"tutorialSidebar"},"basic/unrecoverable-panic-error":{"id":"basic/unrecoverable-panic-error","title":"A.54. Error \u279c Unrecoverable Error / Panic","description":"Error handling atau penanganan error adalah salah satu aspek penting dalam pemrograman selalu umum. Rust mengenal 2 jenis error yaitu unrecoverable error (panic error) dan recoverable error. Pembahasan chapter ini fokus pada unrecoverable error atau panic error.","sidebar":"tutorialSidebar"},"basic/use":{"id":"basic/use","title":"A.29. Module System \u279c Use, Import, Re-export","description":"Keyword use digunakan untuk dua hal, yaitu import path dan re-export path. Sebenarnya kita telah mempelajari kedua penerapan tersebut pada beberapa chapter sebelumnya. Pada chapter ini kita akan ulang lagi pembahasan agar lebih jelas.","sidebar":"tutorialSidebar"},"basic/variabel":{"id":"basic/variabel","title":"A.4. Variabel","description":"Rust merupakan bahasa yang kalau dikategorikan berdasarkan type system-nya adalah statically typed, yang artinya semua tipe data harus diketahui saat kompilasi (compile time).","sidebar":"tutorialSidebar"},"basic/vector":{"id":"basic/vector","title":"A.16. Tipe Data \u279c Vector","description":"Pada chapter ini kita akan belajar tetang tipe data Vector. Vector adalah tipe data seperti array tapi dinamis. Dinamis di sini artinya bisa bertambah dan berkurang kapanpun sesuai kebutuhan.","sidebar":"tutorialSidebar"},"basic/visibility-privacy":{"id":"basic/visibility-privacy","title":"A.28. Module System \u279c Visibility & Privacy","description":"Kita sebenarnya sudah mempelajari banyak hal yang berhubungan dengan visibility & privacy pada beberapa chapter sebelumnya. Jika pembaca mempelajari ebook ini secara urut, maka pastinya sudah familiar dengan keyword pub, self, crate, dan super.","sidebar":"tutorialSidebar"},"CHANGELOG":{"id":"CHANGELOG","title":"Version Changelogs & Updates","description":"\ud83d\udcdd Release v1.0.20240731 (2024-07-31)","sidebar":"tutorialSidebar"},"CONTRIBUTING":{"id":"CONTRIBUTING","title":"Contribution & Tech Stack","description":"Ebook Dasar Pemrograman Rust adalah project open source. Siapapun bebas untuk berkontribusi di sini, bisa dalam bentuk perbaikan typo, update kalimat, maupun submit tulisan baru.","sidebar":"tutorialSidebar"},"download-pdf":{"id":"download-pdf","title":"Download versi PDF","description":"Ebook Dasar Pemrograman Rust bisa di-download dalam bentuk file PDF, silakan gunakan link berikut:","sidebar":"tutorialSidebar"},"index":{"id":"index","title":"Tutorial Belajar Rust (Gratis!)","description":"Rust adalah sebuah bahasa pemrograman general purpose yang fokus pada performance, type safety, dan concurrency. Bahasa ini diciptakan sebagai alternatif bahasa pemrograman yang berfokus pada hal-hal yang cukup low-level tapi tetap men-support fitur yang sifatnya high-level.","sidebar":"tutorialSidebar"},"installation/instalasi-rust":{"id":"installation/instalasi-rust","title":"Instalasi Rust","description":"Pada chapter ini kita akan belajar cara instalasi Rust. Pembaca bisa mengikuti panduan instalasi ini, atau langsung saja navigasi ke https://www.rust-lang.org/tools/install.","sidebar":"tutorialSidebar"},"installation/rust-editor-plugin":{"id":"installation/rust-editor-plugin","title":"Rust Editor & Plugin","description":"Pemilihan editor dan plugin","sidebar":"tutorialSidebar"},"LICENSE":{"id":"LICENSE","title":"Lisensi & Distribusi Konten","description":"Ebook Dasar Pemrograman Rust gratis untuk disebarluaskan secara bebas, dengan catatan sesuai dengan aturan lisensi CC BY-SA 4.0 yang kurang lebih sebagai berikut:","sidebar":"tutorialSidebar"},"pengelanan-rust-programming":{"id":"pengelanan-rust-programming","title":"Pengenalan Rust Programming","description":"Rust adalah sebuah bahasa pemrograman general purpose yang fokus pada performance, type safety, dan concurrency. Bahasa ini diciptakan sebagai alternatif bahasa pemrograman yang berfokus pada hal-hal yang cukup low-level tapi tetap men-support fitur yang sifatnya high-level.","sidebar":"tutorialSidebar"}}}')}}]); \ No newline at end of file +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[53],{1109:a=>{a.exports=JSON.parse('{"pluginId":"default","version":"current","label":"Next","banner":null,"badge":false,"noIndex":false,"className":"docs-version-current","isLast":true,"docsSidebars":{"tutorialSidebar":[{"type":"link","label":"Dasar Pemrograman Rust","href":"/","docId":"index"},{"type":"link","label":"Pengenalan Rust Programming","href":"/pengelanan-rust-programming","docId":"pengelanan-rust-programming"},{"type":"link","label":"Version Changelogs & Updates","href":"/CHANGELOG","docId":"CHANGELOG"},{"type":"link","label":"Contribution & Tech Stack","href":"/CONTRIBUTING","docId":"CONTRIBUTING"},{"type":"link","label":"Download versi PDF","href":"/download-pdf","docId":"download-pdf"},{"type":"link","label":"Lisensi & Distribusi Konten","href":"/LICENSE","docId":"LICENSE"},{"type":"category","label":"Persiapan dan Instalasi","collapsible":false,"collapsed":false,"items":[{"type":"link","label":"Instalasi Rust","href":"/installation/instalasi-rust","docId":"installation/instalasi-rust"},{"type":"link","label":"Rust Editor & Plugin","href":"/installation/rust-editor-plugin","docId":"installation/rust-editor-plugin"}]},{"type":"category","label":"Pemrograman Rust Dasar","collapsible":false,"collapsed":false,"items":[{"type":"link","label":"A.1. Program Pertama \u279c Hello Rust","href":"/basic/hello-rust","docId":"basic/hello-rust"},{"type":"link","label":"A.2. Build dan Run Program Rust","href":"/basic/build-dan-run-program-rust","docId":"basic/build-dan-run-program-rust"},{"type":"link","label":"A.3. Komentar","href":"/basic/komentar","docId":"basic/komentar"},{"type":"link","label":"A.4. Variabel","href":"/basic/variabel","docId":"basic/variabel"},{"type":"link","label":"A.5. Tipe Data \u279c Primitive Scalar","href":"/basic/tipe-data-primitive-scalar","docId":"basic/tipe-data-primitive-scalar"},{"type":"link","label":"A.6. Tipe Data \u279c String Literal (&str)","href":"/basic/tipe-data-string-literal","docId":"basic/tipe-data-string-literal"},{"type":"link","label":"A.7. Konstanta","href":"/basic/konstanta","docId":"basic/konstanta"},{"type":"link","label":"A.8. Operator","href":"/basic/operator","docId":"basic/operator"},{"type":"link","label":"A.9. Seleksi Kondisi \u279c if, else if, else","href":"/basic/seleksi-kondisi-if","docId":"basic/seleksi-kondisi-if"},{"type":"link","label":"A.10. Perulangan \u279c while","href":"/basic/perulangan-while","docId":"basic/perulangan-while"},{"type":"link","label":"A.11. Perulangan \u279c loop, break, continue, label","href":"/basic/perulangan-loop-break-continue-label","docId":"basic/perulangan-loop-break-continue-label"},{"type":"link","label":"A.12. Perulangan \u279c for in","href":"/basic/perulangan-for-in","docId":"basic/perulangan-for-in"},{"type":"link","label":"A.13. Array","href":"/basic/array","docId":"basic/array"},{"type":"link","label":"A.14. Slice (Basic)","href":"/basic/slice","docId":"basic/slice"},{"type":"link","label":"A.15. Tuple","href":"/basic/tuple","docId":"basic/tuple"},{"type":"link","label":"A.16. Vector","href":"/basic/vector","docId":"basic/vector"},{"type":"link","label":"A.17. Function","href":"/basic/function","docId":"basic/function"},{"type":"link","label":"A.18. Module System \u279c Path & Item","href":"/basic/path-item","docId":"basic/path-item"},{"type":"link","label":"A.19. Module System \u279c Package & Crate","href":"/basic/package-crate","docId":"basic/package-crate"},{"type":"link","label":"A.20. Module System \u279c Module","href":"/basic/module-basic","docId":"basic/module-basic"},{"type":"link","label":"A.21. Module System \u279c Inline Module","href":"/basic/module-inline","docId":"basic/module-inline"},{"type":"link","label":"A.22. Module System \u279c Scope & Akses Item","href":"/basic/module-scope-item-access","docId":"basic/module-scope-item-access"},{"type":"link","label":"A.23. Struct","href":"/basic/struct","docId":"basic/struct"},{"type":"link","label":"A.24. Associated Function","href":"/basic/associated-function","docId":"basic/associated-function"},{"type":"link","label":"A.25. Method","href":"/basic/method","docId":"basic/method"},{"type":"link","label":"A.26. Enum","href":"/basic/enum","docId":"basic/enum"},{"type":"link","label":"A.27. Type Alias & Casting","href":"/basic/type-alias-casting","docId":"basic/type-alias-casting"},{"type":"link","label":"A.28. Module System \u279c Visibility & Privacy","href":"/basic/visibility-privacy","docId":"basic/visibility-privacy"},{"type":"link","label":"A.29. Module System \u279c Use, Import, Re-export","href":"/basic/use","docId":"basic/use"},{"type":"link","label":"A.30. Block Expression","href":"/basic/block-expression","docId":"basic/block-expression"},{"type":"link","label":"A.31. Shadowing","href":"/basic/shadowing","docId":"basic/shadowing"},{"type":"link","label":"A.32. Basic Memory Management","href":"/basic/basic-memory-management","docId":"basic/basic-memory-management"},{"type":"link","label":"A.33. Pointer & References","href":"/basic/pointer-references","docId":"basic/pointer-references"},{"type":"link","label":"A.34. Ownership","href":"/basic/ownership","docId":"basic/ownership"},{"type":"link","label":"A.35. Borrowing","href":"/basic/borrowing","docId":"basic/borrowing"},{"type":"link","label":"A.36. Traits","href":"/basic/traits","docId":"basic/traits"},{"type":"link","label":"A.37. Traits \u279c Advanced","href":"/basic/advanced-traits","docId":"basic/advanced-traits"},{"type":"link","label":"A.38. Generics","href":"/basic/generics","docId":"basic/generics"},{"type":"link","label":"A.39. Tipe Data \u279c Option","href":"/basic/option-type","docId":"basic/option-type"},{"type":"link","label":"A.40. Tipe Data \u279c Result","href":"/basic/result-type","docId":"basic/result-type"},{"type":"link","label":"A.41. Operator ?","href":"/basic/operator-tanda-tanya","docId":"basic/operator-tanda-tanya"},{"type":"link","label":"A.42. Pattern Matching","href":"/basic/pattern-matching","docId":"basic/pattern-matching"},{"type":"link","label":"A.43. Static Item","href":"/basic/static","docId":"basic/static"},{"type":"link","label":"A.44. Lifetime","href":"/basic/lifetime","docId":"basic/lifetime"},{"type":"link","label":"A.45. Slice Memory Management","href":"/basic/slice-memory-management","docId":"basic/slice-memory-management"},{"type":"link","label":"A.46. String Literal (&str) vs. String Custom Type","href":"/basic/string-slice-vs-string-literal","docId":"basic/string-slice-vs-string-literal"},{"type":"link","label":"A.47. Tipe Data \u279c String Custom Type","href":"/basic/tipe-data-custom-type-string-slice","docId":"basic/tipe-data-custom-type-string-slice"},{"type":"link","label":"A.48. Closures","href":"/basic/closures","docId":"basic/closures"},{"type":"link","label":"A.49. Trait \u279c Function (Fn, FnMut, FnOnce)","href":"/basic/trait-function","docId":"basic/trait-function"},{"type":"link","label":"A.50. Trait \u279c Iterator","href":"/basic/trait-iterator","docId":"basic/trait-iterator"},{"type":"link","label":"A.51. Attributes","href":"/basic/attributes","docId":"basic/attributes"},{"type":"link","label":"A.52. Date Time","href":"/basic/datetime","docId":"basic/datetime"},{"type":"link","label":"A.53. File, Path, Directory","href":"/basic/file-path-directory","docId":"basic/file-path-directory"},{"type":"link","label":"A.54. Error \u279c Unrecoverable Error / Panic","href":"/basic/unrecoverable-panic-error","docId":"basic/unrecoverable-panic-error"},{"type":"link","label":"A.55. Error \u279c Recoverable Error & Error Handling","href":"/basic/recoverable-error-handling","docId":"basic/recoverable-error-handling"}]}]},"docs":{"basic/advanced-traits":{"id":"basic/advanced-traits","title":"A.37. Traits \u279c Advanced","description":"Chapter ini merupakan kelanjutan dari chapter sebelumnya. Di sini kita fokus ke pembuatan local trait, macam-macam implementasi traits, traits bound syntax, associated types, dan topik yang masih relevan dengan traits lainnya.","sidebar":"tutorialSidebar"},"basic/array":{"id":"basic/array","title":"A.13. Tipe Data \u279c Array","description":"Belajar array pada rust. Contoh penerapan array, iterasi array, dan operasi lainnya pada array","sidebar":"tutorialSidebar"},"basic/associated-function":{"id":"basic/associated-function","title":"A.24. Associated Function","description":"Chapter ini membahas tentang associated function. Kita akan belajar apa itu associated function dan apa perbedannya dengan fungsi biasa.","sidebar":"tutorialSidebar"},"basic/attributes":{"id":"basic/attributes","title":"A.51. Attributes","description":"Kita telah beberapa kali menggunakan attributes pada chapter-chapter sebelumnya, contohnya seperti #[derive(Debug)]. Pada chapter ini kita akan bahas tentang apa sebenarnya attributes, macam-macam jenisnya, beserta kegunaannya.","sidebar":"tutorialSidebar"},"basic/basic-memory-management":{"id":"basic/basic-memory-management","title":"A.32. Basic Memory Management","description":"Pada chapter ini kita akan belajar tentang salah satu hal penting dalam topik pemrograman secara general, yaitu memory management yang mencakup pembahasan tentang alamat memori, pointer, heap, stack, dan juga error-error yang terjadi karena kesalahan dalam manajemen memori.","sidebar":"tutorialSidebar"},"basic/block-expression":{"id":"basic/block-expression","title":"A.30. Block Expression","description":"Pada chapter ini kita akan belajar tentang block expression.","sidebar":"tutorialSidebar"},"basic/borrowing":{"id":"basic/borrowing","title":"A.35. Borrowing","description":"Pada chapter ini kita akan belajar tentang apa itu borrowing dalam Rust programming.","sidebar":"tutorialSidebar"},"basic/build-dan-run-program-rust":{"id":"basic/build-dan-run-program-rust","title":"A.2. Build dan Run Program Rust","description":"Cara run program Rust menggunakan cargo. Pada chapter ini kita akan belajar lebih lanjut tentang command untuk proses build dan run dalam program Rust. Sebelumnya kita sudah belajar tentang cargo new dan cargo run, selain command tersebut ada juga command lain yaitu cargo build untuk proses kompilasi build kode program.","sidebar":"tutorialSidebar"},"basic/closures":{"id":"basic/closures","title":"A.48. Closures","description":"Chapter ini membahas tentang closures. Closures sendiri merupakan block fungsi anonimus (anonymous function) yang memiliki kelebihan bisa mengakses item-tem yang posisinya berada di luar block closure tersebut tetapi masih dalam current block scope.","sidebar":"tutorialSidebar"},"basic/datetime":{"id":"basic/datetime","title":"A.52. Date Time","description":"Pada chapter ini kita akan mempelajari tentang tipe data datetime yang ada di Rust programming.","sidebar":"tutorialSidebar"},"basic/enum":{"id":"basic/enum","title":"A.26. Enum","description":"Enum atau enumerated type adalah sebuah tipe data yang digunakan untuk menampung nilai konstan. Pada chapter ini kita akan mempelajarinya.","sidebar":"tutorialSidebar"},"basic/file-path-directory":{"id":"basic/file-path-directory","title":"A.53. File, Path, Directory","description":"Pada chapter ini kita akan belajar tentang beberapa API milik Rust yang disediakan untuk manajemen path dan file system.","sidebar":"tutorialSidebar"},"basic/function":{"id":"basic/function","title":"A.17. Function","description":"Pada chapter ini kita akan belajar tentang function atau fungsi.","sidebar":"tutorialSidebar"},"basic/generics":{"id":"basic/generics","title":"A.38. Generics","description":"Chapter ini membahas tentang generics.","sidebar":"tutorialSidebar"},"basic/hello-rust":{"id":"basic/hello-rust","title":"A.1. Program Pertama \u279c Hello Rust","description":"Belajar membuat program hello world di Rust, dimulai dengan pembuatan program Hello World sederhana.","sidebar":"tutorialSidebar"},"basic/komentar":{"id":"basic/komentar","title":"A.3. Komentar","description":"Pada chapter ini kita akan membahas tentang komentar pada pemrograman Rust. Ada beberapa jenis komentar yang tersedia, namun untuk sekarang yang penting diketahui hanya 2.","sidebar":"tutorialSidebar"},"basic/konstanta":{"id":"basic/konstanta","title":"A.7. Konstanta","description":"Chapter ini membahas tentang konstanta di bahasa Rust.","sidebar":"tutorialSidebar"},"basic/lifetime":{"id":"basic/lifetime","title":"A.44. Lifetime","description":"Pada chapter ini kita akan belajar tentang lifetime. Lifetime adalah yang digunakan oleh Rust compiler untuk memonitor umur dari references agar tetap dianggap valid.","sidebar":"tutorialSidebar"},"basic/method":{"id":"basic/method","title":"A.25. Method","description":"Pada chapter ini kita akan belajar tentang method beserta perbedaannya dengan associated function.","sidebar":"tutorialSidebar"},"basic/module-basic":{"id":"basic/module-basic","title":"A.20. Module System \u279c Module","description":"Module adalah salah satu chapter yang cukup penting dalam pemrograman Rust. Pada bagian ini kita akan mempelajari dasarnya.","sidebar":"tutorialSidebar"},"basic/module-inline":{"id":"basic/module-inline","title":"A.21. Module System \u279c Inline Module","description":"Pada chapter sebelumnya kita telah belajar cara manajemen module. Pembahasan tersebut dilanjut pada chapter ini, yaitu tentang inline module.","sidebar":"tutorialSidebar"},"basic/module-scope-item-access":{"id":"basic/module-scope-item-access","title":"A.22. Module System \u279c Scope & Akses Item","description":"Pembahasan chapter ini masih dalam lingkup module system, yaitu tentang scope dan pengakesan module item.","sidebar":"tutorialSidebar"},"basic/operator":{"id":"basic/operator","title":"A.8. Operator","description":"Chapter ini membahas mengenai operator pada pemrograman rust.","sidebar":"tutorialSidebar"},"basic/operator-tanda-tanya":{"id":"basic/operator-tanda-tanya","title":"A.41. Operator ?","description":"Operator ? (atau question mark operator) adalah operator yang cukup berguna untuk operasi unwrap nilai dari tipe Result atau Option. Pada chapter ini kita akan belajar tentang operator tersebut.","sidebar":"tutorialSidebar"},"basic/option-type":{"id":"basic/option-type","title":"A.39. Tipe Data \u279c Option","description":"Option adalah salah satu tipe data penting pada Rust programming, digunakan untuk menampung data yang isinya bisa berpotensi kosong (None). Chapter ini membahas tentang tipe data tersebut.","sidebar":"tutorialSidebar"},"basic/ownership":{"id":"basic/ownership","title":"A.34. Ownership","description":"Chapter ini berisi pembahasan tentang ownership, bagaimana Rust melakukan manajemen memory dengan menerapkan approach ownership ini.","sidebar":"tutorialSidebar"},"basic/package-crate":{"id":"basic/package-crate","title":"A.19. Module System \u279c Package & Crate","description":"Chapter ini membahas mengenai konsep package dan path dalam Rust programming. Pembelajaran dimulai dari pembahasan mengenai konsep crate terlebih dahulu, kemudian masuk ke package.","sidebar":"tutorialSidebar"},"basic/path-item":{"id":"basic/path-item","title":"A.18. Module System \u279c Path & Item","description":"Chapter ini membahas tentang konsep path dan item dalam Rust programming.","sidebar":"tutorialSidebar"},"basic/pattern-matching":{"id":"basic/pattern-matching","title":"A.42. Pattern Matching","description":"Chapter ini membahas tentang pattern matching, sebuah teknik yang lebih advance dibanding seleksi kondisi biasa.","sidebar":"tutorialSidebar"},"basic/perulangan-for-in":{"id":"basic/perulangan-for-in","title":"A.12. Perulangan \u279c for in","description":"for in adalah salah satu keyword untuk operasi perulangan yang ada di Rust selain loop dan while. Pada chapter ini kita akan mempelajarinya.","sidebar":"tutorialSidebar"},"basic/perulangan-loop-break-continue-label":{"id":"basic/perulangan-loop-break-continue-label","title":"A.11. Perulangan \u279c loop, break, continue, label","description":"Selain keyword while, ada juga keyword loop yang fungsi dasarnya adalah sama, yaitu untuk perulangan.","sidebar":"tutorialSidebar"},"basic/perulangan-while":{"id":"basic/perulangan-while","title":"A.10. Perulangan \u279c while","description":"Di Rust ada beberapa cara untuk melakukan perulangan, salah satunya adalah dengan menggunakan keyword while, dan pada chapter ini kita akan mempelajarinya.","sidebar":"tutorialSidebar"},"basic/pointer-references":{"id":"basic/pointer-references","title":"A.33. Pointer & References","description":"Chapter ini membahas tentang apa itu pointer, references, dan dereferences. Pembelajaran dimulai tentang konsep dan praktik dasar tentang ketiga topik tersebut, kemudian diikuti dengan pembahasan tentang karakteristik pointer & reference.","sidebar":"tutorialSidebar"},"basic/recoverable-error-handling":{"id":"basic/recoverable-error-handling","title":"A.55. Error \u279c Recoverable Error & Error Handling","description":"Chapter ini merupakan kelanjutan dari chapter sebelumnya tentang pembahasan topic error. Kali ini fokus kita lebih ke recoverable error dan penanganannya (error handling / error propagation).","sidebar":"tutorialSidebar"},"basic/result-type":{"id":"basic/result-type","title":"A.40. Tipe Data \u279c Result","description":"Chapter ini membahas tentang tipe data Result, yaitu tipe data yang digunakan untuk menampung nilai yang isinya bisa berupa penanda operasi sukses (Ok) dan data, atau error (Err) beserta keterangan errornya.","sidebar":"tutorialSidebar"},"basic/seleksi-kondisi-if":{"id":"basic/seleksi-kondisi-if","title":"A.9. Seleksi Kondisi \u279c if, else if, else","description":"Pada chapter ini kita akan bahas tentang penerapan if untuk kontrol alur program.","sidebar":"tutorialSidebar"},"basic/shadowing":{"id":"basic/shadowing","title":"A.31. Shadowing","description":"Pada chapter ini kita akan belajar tentang shadowing pada variable dan apa perbedaannya dibanding variable mutable.","sidebar":"tutorialSidebar"},"basic/slice":{"id":"basic/slice","title":"A.14. Slice (Basic)","description":"Pada bab ini kita belajar tentang apa itu slice, apa perbedaan slice dan array, slicing atau borrowing pada slice, dan juga slice mutability.","sidebar":"tutorialSidebar"},"basic/slice-memory-management":{"id":"basic/slice-memory-management","title":"A.45. Slice Memory Management","description":"Kita telah mempelajari tipe data Array dan Vector, serta sudah beberapa kali menggunakan tipe data string slice (String). 3 tipe data itu memiliki kemiripan, yaitu kesemuanya termasuk dalam kategori tipe data slice.","sidebar":"tutorialSidebar"},"basic/static":{"id":"basic/static","title":"A.43. Static Item","description":"Pada chapter ini kita akan bahas tentang apa itu static item, dan perbedaanya dibanding konstanta.","sidebar":"tutorialSidebar"},"basic/string-slice-vs-string-literal":{"id":"basic/string-slice-vs-string-literal","title":"A.46. String Literal (&str) vs. String Custom Type","description":"Pada chapter sebelumnya kita telah membahas tentang bagaimana data slice di-manage di memory. Ada beberapa tipe data yang masuk dalam kategori slice, yang salah satunya adalah string slice atau String.","sidebar":"tutorialSidebar"},"basic/struct":{"id":"basic/struct","title":"A.23. Struct","description":"Pada chapter ini kita akan belajar tentang struct.","sidebar":"tutorialSidebar"},"basic/tipe-data-custom-type-string-slice":{"id":"basic/tipe-data-custom-type-string-slice","title":"A.47. Tipe Data \u279c String Custom Type","description":"Pembahasan kali ini lingkupnya masih dalam topik custom type String.","sidebar":"tutorialSidebar"},"basic/tipe-data-primitive-scalar":{"id":"basic/tipe-data-primitive-scalar","title":"A.5. Tipe Data \u279c Primitive Scalar","description":"Tipe data di Rust dikategorikan menjadi beberapa group, salah satunya adalah group tipe data primitif scalar atau biasa disebut scalar types. Pada chapter ini kita akan mempelajarinya.","sidebar":"tutorialSidebar"},"basic/tipe-data-string-literal":{"id":"basic/tipe-data-string-literal","title":"A.6. Tipe Data \u279c String Literal (&str)","description":"String adalah tipe data penting dalam pemrograman manapun. Biasanya tiap bahasa punya cara berbeda dalam meng-handle tipe ini. Di bahasa Rust, ada dua jenis tipe data string:","sidebar":"tutorialSidebar"},"basic/trait-function":{"id":"basic/trait-function","title":"A.49. Trait \u279c Function (Fn, FnMut, FnOnce)","description":"Chapter ini merupakan topik lanjutan dari chapter sebelumnya, di sini kita akan bahas beberapa jenis trait yang digunakan di closure.","sidebar":"tutorialSidebar"},"basic/trait-iterator":{"id":"basic/trait-iterator","title":"A.50. Trait \u279c Iterator","description":"Iterator adalah salah satu trait dan tipe data custom penting pada Rust programming, gunanya untuk iterasi data. Di chapter ini kita akan mempelajarinya beserta beberapa module item lainnya yang masih relevan dengan topik Iterator.","sidebar":"tutorialSidebar"},"basic/traits":{"id":"basic/traits","title":"A.36. Traits","description":"Trait jika diartikan dalam Bahasa Indonesia artinya adalah sifat. Chapter ini akan membahas tentang apa itu trait, apa kegunaannya, dan bagaimana cara penerapannya di Rust programming.","sidebar":"tutorialSidebar"},"basic/tuple":{"id":"basic/tuple","title":"A.15. Tipe Data \u279c Tuple","description":"Pada chapter ini kita akan membahas tentang tipe data kolektif bernama Tuple.","sidebar":"tutorialSidebar"},"basic/type-alias-casting":{"id":"basic/type-alias-casting","title":"A.27. Type Alias & Casting","description":"Chapter ini membahas tentang type alias dan juga casting (explicit conversion) pada tipe data primitif scalar.","sidebar":"tutorialSidebar"},"basic/unrecoverable-panic-error":{"id":"basic/unrecoverable-panic-error","title":"A.54. Error \u279c Unrecoverable Error / Panic","description":"Error handling atau penanganan error adalah salah satu aspek penting dalam pemrograman selalu umum. Rust mengenal 2 jenis error yaitu unrecoverable error (panic error) dan recoverable error. Pembahasan chapter ini fokus pada unrecoverable error atau panic error.","sidebar":"tutorialSidebar"},"basic/use":{"id":"basic/use","title":"A.29. Module System \u279c Use, Import, Re-export","description":"Keyword use digunakan untuk dua hal, yaitu import path dan re-export path. Sebenarnya kita telah mempelajari kedua penerapan tersebut pada beberapa chapter sebelumnya. Pada chapter ini kita akan ulang lagi pembahasan agar lebih jelas.","sidebar":"tutorialSidebar"},"basic/variabel":{"id":"basic/variabel","title":"A.4. Variabel","description":"Rust merupakan bahasa yang kalau dikategorikan berdasarkan type system-nya adalah statically typed, yang artinya semua tipe data harus diketahui saat kompilasi (compile time).","sidebar":"tutorialSidebar"},"basic/vector":{"id":"basic/vector","title":"A.16. Tipe Data \u279c Vector","description":"Pada chapter ini kita akan belajar tetang tipe data Vector. Vector adalah tipe data seperti array tapi dinamis. Dinamis di sini artinya bisa bertambah dan berkurang kapanpun sesuai kebutuhan.","sidebar":"tutorialSidebar"},"basic/visibility-privacy":{"id":"basic/visibility-privacy","title":"A.28. Module System \u279c Visibility & Privacy","description":"Kita sebenarnya sudah mempelajari banyak hal yang berhubungan dengan visibility & privacy pada beberapa chapter sebelumnya. Jika pembaca mempelajari ebook ini secara urut, maka pastinya sudah familiar dengan keyword pub, self, crate, dan super.","sidebar":"tutorialSidebar"},"CHANGELOG":{"id":"CHANGELOG","title":"Version Changelogs & Updates","description":"\ud83d\udcdd Release v1.0.20240830 (2024-08-30)","sidebar":"tutorialSidebar"},"CONTRIBUTING":{"id":"CONTRIBUTING","title":"Contribution & Tech Stack","description":"Ebook Dasar Pemrograman Rust adalah project open source. Siapapun bebas untuk berkontribusi di sini, bisa dalam bentuk perbaikan typo, update kalimat, maupun submit tulisan baru.","sidebar":"tutorialSidebar"},"download-pdf":{"id":"download-pdf","title":"Download versi PDF","description":"Ebook Dasar Pemrograman Rust bisa di-download dalam bentuk file PDF, silakan gunakan link berikut:","sidebar":"tutorialSidebar"},"index":{"id":"index","title":"Tutorial Belajar Rust (Gratis!)","description":"Rust adalah sebuah bahasa pemrograman general purpose yang fokus pada performance, type safety, dan concurrency. Bahasa ini diciptakan sebagai alternatif bahasa pemrograman yang berfokus pada hal-hal yang cukup low-level tapi tetap men-support fitur yang sifatnya high-level.","sidebar":"tutorialSidebar"},"installation/instalasi-rust":{"id":"installation/instalasi-rust","title":"Instalasi Rust","description":"Pada chapter ini kita akan belajar cara instalasi Rust. Pembaca bisa mengikuti panduan instalasi ini, atau langsung saja navigasi ke https://www.rust-lang.org/tools/install.","sidebar":"tutorialSidebar"},"installation/rust-editor-plugin":{"id":"installation/rust-editor-plugin","title":"Rust Editor & Plugin","description":"Pemilihan editor dan plugin","sidebar":"tutorialSidebar"},"LICENSE":{"id":"LICENSE","title":"Lisensi & Distribusi Konten","description":"Ebook Dasar Pemrograman Rust gratis untuk disebarluaskan secara bebas, dengan catatan sesuai dengan aturan lisensi CC BY-SA 4.0 yang kurang lebih sebagai berikut:","sidebar":"tutorialSidebar"},"pengelanan-rust-programming":{"id":"pengelanan-rust-programming","title":"Pengenalan Rust Programming","description":"Rust adalah sebuah bahasa pemrograman general purpose yang fokus pada performance, type safety, dan concurrency. Bahasa ini diciptakan sebagai alternatif bahasa pemrograman yang berfokus pada hal-hal yang cukup low-level tapi tetap men-support fitur yang sifatnya high-level.","sidebar":"tutorialSidebar"}}}')}}]); \ No newline at end of file diff --git a/assets/js/9a3629a6.8ffb3acb.js b/assets/js/9a3629a6.7e9aa52d.js similarity index 56% rename from assets/js/9a3629a6.8ffb3acb.js rename to assets/js/9a3629a6.7e9aa52d.js index 318489fc..f3411867 100644 --- a/assets/js/9a3629a6.8ffb3acb.js +++ b/assets/js/9a3629a6.7e9aa52d.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[7865],{3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>k});var n=a(7294);function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?r(Object(a),!0).forEach((function(t){i(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):r(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function p(e,t){if(null==e)return{};var a,n,i=function(e,t){if(null==e)return{};var a,n,i={},r=Object.keys(e);for(n=0;n<r.length;n++)a=r[n],t.indexOf(a)>=0||(i[a]=e[a]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)a=r[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}var s=n.createContext({}),o=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},u=function(e){var t=o(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),m=o(a),k=i,c=m["".concat(s,".").concat(k)]||m[k]||d[k]||r;return a?n.createElement(c,l(l({ref:t},u),{},{components:a})):n.createElement(c,l({ref:t},u))}));function k(e,t){var a=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=a.length,l=new Array(r);l[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:i,l[1]=p;for(var o=2;o<r;o++)l[o]=a[o];return n.createElement.apply(null,l)}return n.createElement.apply(null,a)}m.displayName="MDXCreateElement"},8472:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>r,metadata:()=>p,toc:()=>o});var n=a(7462),i=(a(7294),a(3905));const r={sidebar_position:53,title:"A.53. File, Path, Directory",sidebar_label:"A.53. File, Path, Directory"},l=void 0,p={unversionedId:"basic/file-path-directory",id:"basic/file-path-directory",title:"A.53. File, Path, Directory",description:"Pada chapter ini kita akan belajar tentang beberapa API milik Rust yang disediakan untuk manajemen path dan file system.",source:"@site/docs/basic/file-path-directory.md",sourceDirName:"basic",slug:"/basic/file-path-directory",permalink:"/basic/file-path-directory",draft:!1,tags:[],version:"current",sidebarPosition:53,frontMatter:{sidebar_position:53,title:"A.53. File, Path, Directory",sidebar_label:"A.53. File, Path, Directory"},sidebar:"tutorialSidebar",previous:{title:"A.52. Date Time",permalink:"/basic/datetime"},next:{title:"A.54. Error \u279c Unrecoverable Error / Panic",permalink:"/basic/unrecoverable-panic-error"}},s={},o=[{value:"A.53.1. File path (<code>std::path::Path</code>)",id:"a531-file-path-stdpathpath",level:2},{value:"A.53.2. Method filepath",id:"a532-method-filepath",level:2},{value:"\u25c9 Associated function <code>Path::new()</code>",id:"-associated-function-pathnew",level:3},{value:"\u25c9 Method <code>join()</code>",id:"-method-join",level:3},{value:"\u25c9 Method <code>exists()</code>",id:"-method-exists",level:3},{value:"\u25c9 Method <code>is_file()</code> & <code>is_dir()</code>",id:"-method-is_file--is_dir",level:3},{value:"\u25c9 Method <code>is_absolute()</code> & <code>is_relative()</code>",id:"-method-is_absolute--is_relative",level:3},{value:"A.53.3. Module <code>std::fs</code> (file system)",id:"a533-module-stdfs-file-system",level:2},{value:"A.53.4. Manajemen file system",id:"a534-manajemen-file-system",level:2},{value:"\u25c9 Pembuatan folder (<code>fs::create_dir</code>)",id:"-pembuatan-folder-fscreate_dir",level:3},{value:"\u25c9 Menulis konten file (<code>fs::write</code>)",id:"-menulis-konten-file-fswrite",level:3},{value:"\u25c9 Membaca isi file ke bentuk string (<code>fs::read_to_string</code>)",id:"-membaca-isi-file-ke-bentuk-string-fsread_to_string",level:3},{value:"\u25c9 Membaca isi file ke bentuk vector (<code>fs::read</code>)",id:"-membaca-isi-file-ke-bentuk-vector-fsread",level:3},{value:"\u25c9 Menghapus file (<code>fs::remove_file</code>)",id:"-menghapus-file-fsremove_file",level:3},{value:"\u25c9 Menghapus folder (<code>fs::remove_dir</code>)",id:"-menghapus-folder-fsremove_dir",level:3},{value:"\u25c9 List items dalam folder",id:"-list-items-dalam-folder",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Work in progress",id:"-work-in-progress",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],u={toc:o};function d(e){let{components:t,...r}=e;return(0,i.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan belajar tentang beberapa API milik Rust yang disediakan untuk manajemen path dan file system."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Penulis anjurkan untuk mengikuti pembelajaran chapter per chapter secara berurutan. Nantinya pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/recoverable-error-handling"},"Recoverable Error & Error Handling")," kita akan banyak menerapkan API yang dipelajari di chapter ini.")),(0,i.kt)("h2",{id:"a531-file-path-stdpathpath"},"A.53.1. File path (",(0,i.kt)("inlineCode",{parentName:"h2"},"std::path::Path"),")"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},'"/home/novalagung/Desktop/my text.txt"')," adalah salah satu contoh file path. Di Rust, file path bisa direpresentasikan sebagai string (seperti yang sudah dicontohkan), atau menggunakan tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Path"),"."),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Path")," tersedia dalam module ",(0,i.kt)("inlineCode",{parentName:"p"},"std::path"),". Cara penggunaannya cukup mudah, sebagai contoh, beberapa filepath berikut menghasilkan path yang sama:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'use std::path::Path;\n\nlet filepath_1 = "/home/novalagung/Desktop/my text.txt";\nlet filepath_2 = Path::new("/home/novalagung/Desktop/my text.txt");\nlet filepath_3 = Path::new("/home/novalagung/Desktop").join("my text.txt");\nlet filepath_4 = Path::new("/home/novalagung").join("Desktop").join("my text.txt");\nlet filepath_5 = Path::new("/home").join("novalagung/Desktop/my text.txt");\n\nprintln!("{:?}", filepath_1);\n// output => "/home/novalagung/Desktop/my text.txt"\n\nprintln!("{:?}", filepath_2);\n// output => "/home/novalagung/Desktop/my text.txt"\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Ketika path di-print, yang muncul adalah sesuai dengan string yang ditulis. Dengan pengecualian jika method ",(0,i.kt)("inlineCode",{parentName:"p"},".join()")," digunakan disitu, maka separator file yang digunakan relatif terhadap OS. Jika Windows maka ",(0,i.kt)("inlineCode",{parentName:"p"},"\\"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"/")," untuk non-Windows.")),(0,i.kt)("h2",{id:"a532-method-filepath"},"A.53.2. Method filepath"),(0,i.kt)("h3",{id:"-associated-function-pathnew"},"\u25c9 Associated function ",(0,i.kt)("inlineCode",{parentName:"h3"},"Path::new()")),(0,i.kt)("p",null,"Digunakan untuk membuat object ",(0,i.kt)("inlineCode",{parentName:"p"},"Path")," dari suatu string. Contoh penerapan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'Path::new("/home/novalagung/Desktop/my text.txt");\n')),(0,i.kt)("h3",{id:"-method-join"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"join()")),(0,i.kt)("p",null,"Digunakan untuk menggabungkan segment filepath. Contoh penerapan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'Path::new("/home/novalagung").join("Desktop").join("my text.txt");\n')),(0,i.kt)("p",null,"Hasil dari operasi di atas adalah path:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"/home/novalagung/Desktop/my text.txt\n")),(0,i.kt)("h3",{id:"-method-exists"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"exists()")),(0,i.kt)("p",null,"Digunakan untuk mengecek apakah suatu filepath ada atau tidak."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"if Path::new(&path).exists() {\n // path exists\n}\n")),(0,i.kt)("h3",{id:"-method-is_file--is_dir"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"is_file()")," & ",(0,i.kt)("inlineCode",{parentName:"h3"},"is_dir()")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"is_file()")," digunakan untuk mengecek apakah suatu filepath berisi file."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"if Path::new(&path).is_file() {\n // path is a file\n}\n")),(0,i.kt)("p",null,"Sedangkan method ",(0,i.kt)("inlineCode",{parentName:"p"},"is_dir()")," digunakan untuk mengecek apakah suatu filepath adalah folder/directory."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"if Path::new(&path).is_dir() {\n // path contains directory\n}\n")),(0,i.kt)("h3",{id:"-method-is_absolute--is_relative"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"is_absolute()")," & ",(0,i.kt)("inlineCode",{parentName:"h3"},"is_relative()")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"is_absolute()")," digunakan untuk mengecek apakah suatu filepath adalah ",(0,i.kt)("em",{parentName:"p"},"absolute path"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"if Path::new(&path).is_absolute() {\n // path is an absolute path\n}\n")),(0,i.kt)("p",null,"Sedangkan method ",(0,i.kt)("inlineCode",{parentName:"p"},"is_relative()")," digunakan untuk mengecek apakah suatu filepath adalah ",(0,i.kt)("em",{parentName:"p"},"relative path"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"if Path::new(&path).is_relative() {\n // path is a relative path\n}\n")),(0,i.kt)("h2",{id:"a533-module-stdfs-file-system"},"A.53.3. Module ",(0,i.kt)("inlineCode",{parentName:"h2"},"std::fs")," (file system)"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"std::fs")," merupakan module yang disediakan Rust untuk pengolahan file system. Di dalamnya berisinya banyak sekali fungsi untuk keperluan seperti pembuatan file, modifikasi konten file, dan lainnya."),(0,i.kt)("p",null,"Sebagai contoh, untuk membuat suatu directory bisa menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::create_dir"),". Isi argument pemanggilan fungsi dengan path dalam bentuk string (atau ",(0,i.kt)("inlineCode",{parentName:"p"},"std::path::Path")," juga boleh)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'use std::fs;\n\nfn main() {\n let path = "./files";\n let res = fs::create_dir(&path);\n println!("{:?}", res);\n // output => Ok(())\n}\n')),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::create_dir")," mengembalikan value bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<(), Error>"),". Gunakan pattern matching ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," untuk mengecek hasil operasi apakah sukses atau tidak."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'match fs::create_dir("./files") {\n Err(err) => {\n println!("error on creating directory! {}", err);\n },\n _ => {\n println!("directory created");\n },\n}\n')),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih detailnya mengenai tipe data ",(0,i.kt)("inlineCode",{parentName:"li"},"Result")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/result-type"},"Tipe Data \u279c Result"),"."),(0,i.kt)("li",{parentName:"ul"},"Lebih detailnya mengenai pattern matching dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/pattern-matching"},"Pattern Matching"),"."))),(0,i.kt)("h2",{id:"a534-manajemen-file-system"},"A.53.4. Manajemen file system"),(0,i.kt)("h3",{id:"-pembuatan-folder-fscreate_dir"},"\u25c9 Pembuatan folder (",(0,i.kt)("inlineCode",{parentName:"h3"},"fs::create_dir"),")"),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::create_dir")," digunakan untuk membuat folder. Contoh penerapannya sudah dibahas di sesi ",(0,i.kt)("a",{parentName:"p",href:"/basic/file-path-directory#a523-module-stdfs-file-system"},"A.53.3. Module std::fs (file system)")," di atas."),(0,i.kt)("h3",{id:"-menulis-konten-file-fswrite"},"\u25c9 Menulis konten file (",(0,i.kt)("inlineCode",{parentName:"h3"},"fs::write"),")"),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::write")," digunakan untuk membuat folder. Contoh penerapan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let path = Path::new("./files").join("target.txt");\nlet content = "hello rust!";\nlet res = fs::write(&path, &content);\n\nmatch res {\n Err(err) => {\n println!("error on writing file {}! {}", path.to_str().unwrap_or_default(), err);\n },\n _ => {\n println!("file created");\n },\n}\n')),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::write")," melakukan penulisan konten pada variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"content")," ke path ",(0,i.kt)("inlineCode",{parentName:"p"},"path"),". Mode penulisannya adalah ",(0,i.kt)("em",{parentName:"p"},"overwrite")," (bukan ",(0,i.kt)("em",{parentName:"p"},"append"),"), yang artinya konten lama pada filepath akan di-",(0,i.kt)("em",{parentName:"p"},"replace")," total dengan konten baru."),(0,i.kt)("p",null,"Jika file tidak ada pada ",(0,i.kt)("inlineCode",{parentName:"p"},"path")," tujuan, maka otomatis dibuatkan file baru. Namun jika folder/directory di mana file akan dibuat/ditulis tidak ada, maka muncul error."),(0,i.kt)("h3",{id:"-membaca-isi-file-ke-bentuk-string-fsread_to_string"},"\u25c9 Membaca isi file ke bentuk string (",(0,i.kt)("inlineCode",{parentName:"h3"},"fs::read_to_string"),")"),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::read_to_string()")," digunakan untuk membaca isi file dalam bentuk string. Contoh penerapannya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let path = Path::new("./files").join("target.txt");\nlet res = fs::read_to_string(&path);\n\nmatch res {\n Err(err) => {\n println!("error on reading file {}! {}", path.to_str().unwrap_or_default(), err);\n },\n Ok(content) => {\n println!("file {:?} content is: {:?}", path, content);\n },\n}\n')),(0,i.kt)("h3",{id:"-membaca-isi-file-ke-bentuk-vector-fsread"},"\u25c9 Membaca isi file ke bentuk vector (",(0,i.kt)("inlineCode",{parentName:"h3"},"fs::read"),")"),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::read()")," melakukan operasi baca file dan mengembalikan nilainya dalam bentuk vector ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<u8>"),". Umumnya, fungsi ini dikombinasikan dengan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"std::str::from_utf8()")," agar konten file bisa dimunculkan dalam format encoding tertentu (misalnya UTF-8)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let path = Path::new("./files").join("target.txt");\nlet res = fs::read(&path);\n\nif res.is_err() {\n println!("error on reading file");\n return;\n}\n\nlet content = res.unwrap_or_default();\nmatch std::str::from_utf8(&content) {\n Err(err) => {\n println!("error on reading file! Invalid UTF-8 sequence. {}", err);\n },\n Ok(content) => {\n println!("file {:?} content is: {:?}", path, content);\n },\n};\n')),(0,i.kt)("h3",{id:"-menghapus-file-fsremove_file"},"\u25c9 Menghapus file (",(0,i.kt)("inlineCode",{parentName:"h3"},"fs::remove_file"),")"),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::remove_file")," digunakan untuk menghapus file pada suatu path. Contoh penerapan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let path = Path::new("./files").join("target.txt");\nlet res = fs::remove_file(&path);\n\nmatch res {\n Err(err) => {\n println!("error on deleting file {}! {}", path.to_str().unwrap_or_default(), err);\n },\n _ => {\n println!("file deleted");\n },\n}\n')),(0,i.kt)("h3",{id:"-menghapus-folder-fsremove_dir"},"\u25c9 Menghapus folder (",(0,i.kt)("inlineCode",{parentName:"h3"},"fs::remove_dir"),")"),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::remove_dir")," digunakan untuk menghapus folder/directory. Contoh penerapan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let path = Path::new("./files");\nlet res = fs::remove_dir(&path);\n\nmatch res {\n Err(err) => {\n println!("error on deleting directory {}! {}", path.to_str().unwrap_or_default(), err);\n },\n _ => {\n println!("directory deleted");\n },\n}\n')),(0,i.kt)("h3",{id:"-list-items-dalam-folder"},"\u25c9 List items dalam folder"),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::read_dir")," digunakan untuk menampilkan list items suatu folder (baik subfolder ataupun file). Fungsi ini mengmbalikan nilai bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<ReadDir, Error>"),", untuk mengakses list items bisa menggunakan teknik pattern matching, atau boleh juga langsung di ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap()")," (dengan resiko program bisa panic ketika ada error)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let path = Path::new("D:\\\\Labs\\\\Adam Studio\\\\Ebook\\\\dasarpemrogramanrust\\\\file_path_directory_1");\nlet paths = fs::read_dir(&path).unwrap();\n\nfor path in paths {\n let item = &path.unwrap();\n println!("file name: {:?}, file path: {:?}", item.file_name(), item.path().display())\n}\n')),(0,i.kt)("p",null,"Pada contoh di atas, penulis menggunakan testing path yang isinya 4 buah item:"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"File, Path, Directory",src:a(2944).Z,width:"595",height:"176"})),(0,i.kt)("p",null,"Output program bisa dilihat pada gambar berikut:"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"File, Path, Directory",src:a(214).Z,width:"887",height:"149"})),(0,i.kt)("p",null,"Tipe data variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"paths")," di atas adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"ReadDir")," yang merupakan tipe data iterator. Jika digunakan pada keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"for"),", maka variabel element perulangan ",(0,i.kt)("inlineCode",{parentName:"p"},"path")," akan bertipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<DirEntry, Error>"),". Dari tipe ini kita bisa mengakses file name maupun file path."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/file_path_directory"},"github.com/novalagung/dasarpemrogramanrust-example/../file_path_directory")),(0,i.kt)("h3",{id:"-work-in-progress"},"\u25c9 Work in progress"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Pembahasan tentang append content file (",(0,i.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/30684624/what-is-the-best-variant-for-appending-a-new-line-in-a-text-file"},"https://stackoverflow.com/questions/30684624/what-is-the-best-variant-for-appending-a-new-line-in-a-text-file"),")")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/result-type"},"Tipe Data \u279c Result")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/pattern-matching"},"Pattern Matching"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/path/struct.Path.html"},"https://doc.rust-lang.org/std/path/struct.Path.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/std_misc/path.html"},"https://doc.rust-lang.org/rust-by-example/std_misc/path.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/std_misc/fs.html"},"https://doc.rust-lang.org/rust-by-example/std_misc/fs.html"))))}d.isMDXComponent=!0},2944:(e,t,a)=>{a.d(t,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlMAAACwCAIAAACkbHy6AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFvGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4wLWMwMDAgMTM3LmRhNGE3ZTUsIDIwMjIvMTEvMjctMDk6MzU6MDMgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb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q9/+AMR/e9///vXv/71yy+/3H7DgIheLzNtfzvl2yQjnXLkRiEz7XiKvtTtiqekFD4x/fAVle+mG3xBGujoyDXf29vbTz/99N133/3666+//vrrd99999NPP729vd1n47T3WplpZdspW7tqbtl2rjyqUmOxdW56g+f1yEx7nLIvdbriCSmFnWAV7adl78RwDQWfb+ia749//OOPP/749evXf/zjH7vdjogmk8nf/va3H3/88T//+c9vv/02YvmS/JMw0mtlppVtpyNde3K4pGhcg/anJNocXrBdvnx7MmZLkJlWRdmXul1xKKVwd5nMNhr5PpIl36f7uCQzbePDcw4sitm7H/dnwajAixi65jMM4/vvvy+Kogx7RLTb7Yqi+P777w3DGJhxT5V/Eo57tcy0su0cv3bZlH6Z36+83nCChT0ybWETMtM2KfqStCuOTCncyK/XXuQlmWmbV5wipcFLTgnF7L5oXJuydk3sv0PYexG3fcJFmX8SjtEiM+3Q2ruZaaVThpyxNXlRFHErEyMPS8hMexpJVxxKKTzKRZlpfWYb+w6YLN/TwpydEPpks9ejCtI9zi3DHkasXsnQaGdRFF+/fjUMYzKZ7Ec7DcP4+vVr0b8ncjyLbJ1/Eplpj9IlM+3Q2sdMuT8VT3wR8WjlDm0SMtOeQ94VR6cUVrkkM63FSJXIcSTJ7NZE8UpQw7ZNKtIThzjgwQ1Fvt9+++3f//73X//617///e///e9/iehPf/rTt99++89//lNyk0+SMFaRfxKZaY/RJTOteu1jpgydYGVWyUop5IxE5DGfEtVZATLTnkHdFUelFKbsELmaS70oM63Vbqj2W61HkcyuvE1cpOKdFpwLP3nFk2xdHRnt3Gw2P//88++///7DDz/88MMPv//++88//7zZbMavoJV/EsY5PEXJGFvnVNR3GI7fuKvJppRnpi2M+jZLmZk2HpuZ9vIBQsXay1WI5m+wZFMSETVuDPoz89JLAehRdsVamThIOkpIRJQs45waD906gQjK/406MlSZadv33sKPnMqbgFSPUrbH44efO5bNXvYw1cPByXJ+5MljeDbHf8/3yy+/nPsDvtH5J2GcZ85MK99O2dqlEtmUydwSh7ylJz7jh8y0PeMz/Z6QUri6Gm+MNBPRZZlpy0XWvbM5Hj9UIi+KvLLjSmfvpLvtPNsZcvG24scG1OFpIFfDE0FmWtAMMtPCbSAz7RNBZlrQDDLTwm3gmg8AHhcy08ItIPIBAIBekKsBAAD0gsgHAAB6QeQDAAC9IPI9K2SmBbi1yxLbwuPCrxoe26tlpu07MWmppELUZZethQiZaYe167Pzgk1qt5Oqf8oW2Zv5Ti75cSsS274qXPM9stfKTCst4OgEp9X0nQoZLHsHMtMe16/PZDlvv7+s8YM6Zf9sQmZaeEC3vuZDZtrzvVZmWpmhBKeSa7BehQyXXQWZaVWO1qc/O/SWgf7ZmuUTM9M21tF4VxkPJZlpfRHNdunUto0iXWeWN+JCFp7Zba/5kJn2fK+WmVZhZIJTklbIUNnHQWbapiP12epO6v7Z8qmZacvr1fo924yx+r3v0tlNexKzdW7YXvmv5eJw9bqQmfZBaZGZdijBaTczrbpCToXMtOfxmd0YYr+sOR4vMy1R3c+bewa8quuNdiIz7RXpkpl2dILTgQoZDZlpL1GmhtoPsV/aHA+XmRb0cr3Ih8y016NLZlpqvVt7IMHpQIWMh8y0F2jdkj2hOZ4mMy3o5ebPdiIz7Rl0yUzb2bZWgtNWZtqj+VHhptrpX09pjgfITJvtitY9O3lmWtDLTZ/tRGbaK3vmzLTyAo1PcHpk9iOZVCWQmbZHUZ9OsGhc8J3qUzPTlst4d+sersxM67P+jMtEntj21BqAB4RcDU8EmWlBM8hMC7eBd7g8EWSmBc0gMy3cBq75AOBxITMt3AIiHwAA6AXv7QQAAL0g8gEAgF4Q+QAAQC+IfAAAoBdEPgAA0AsiHwAA6AWRDwAA9ILIBwAAekHkAwAAvSDyAQCAXhD5AABAL4h8AACgF0Q+AADQy/8BMFgxvPoJ+vYAAAAASUVORK5CYII="},214:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/file-path-directory-2-bbe0bb5499225e418b251930c44fb8f6.png"}}]); \ No newline at end of file +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[7865],{3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>k});var n=a(7294);function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?r(Object(a),!0).forEach((function(t){i(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):r(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function p(e,t){if(null==e)return{};var a,n,i=function(e,t){if(null==e)return{};var a,n,i={},r=Object.keys(e);for(n=0;n<r.length;n++)a=r[n],t.indexOf(a)>=0||(i[a]=e[a]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)a=r[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}var s=n.createContext({}),o=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},u=function(e){var t=o(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),m=o(a),k=i,c=m["".concat(s,".").concat(k)]||m[k]||d[k]||r;return a?n.createElement(c,l(l({ref:t},u),{},{components:a})):n.createElement(c,l({ref:t},u))}));function k(e,t){var a=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=a.length,l=new Array(r);l[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:i,l[1]=p;for(var o=2;o<r;o++)l[o]=a[o];return n.createElement.apply(null,l)}return n.createElement.apply(null,a)}m.displayName="MDXCreateElement"},8472:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>r,metadata:()=>p,toc:()=>o});var n=a(7462),i=(a(7294),a(3905));const r={sidebar_position:53,title:"A.53. File, Path, Directory",sidebar_label:"A.53. File, Path, Directory"},l=void 0,p={unversionedId:"basic/file-path-directory",id:"basic/file-path-directory",title:"A.53. File, Path, Directory",description:"Pada chapter ini kita akan belajar tentang beberapa API milik Rust yang disediakan untuk manajemen path dan file system.",source:"@site/docs/basic/file-path-directory.md",sourceDirName:"basic",slug:"/basic/file-path-directory",permalink:"/basic/file-path-directory",draft:!1,tags:[],version:"current",sidebarPosition:53,frontMatter:{sidebar_position:53,title:"A.53. File, Path, Directory",sidebar_label:"A.53. File, Path, Directory"},sidebar:"tutorialSidebar",previous:{title:"A.52. Date Time",permalink:"/basic/datetime"},next:{title:"A.54. Error \u279c Unrecoverable Error / Panic",permalink:"/basic/unrecoverable-panic-error"}},s={},o=[{value:"A.53.1. File path (<code>std::path::Path</code>)",id:"a531-file-path-stdpathpath",level:2},{value:"A.53.2. Method filepath",id:"a532-method-filepath",level:2},{value:"\u25c9 Associated function <code>Path::new()</code>",id:"-associated-function-pathnew",level:3},{value:"\u25c9 Method <code>join()</code>",id:"-method-join",level:3},{value:"\u25c9 Method <code>exists()</code>",id:"-method-exists",level:3},{value:"\u25c9 Method <code>is_file()</code> & <code>is_dir()</code>",id:"-method-is_file--is_dir",level:3},{value:"\u25c9 Method <code>is_absolute()</code> & <code>is_relative()</code>",id:"-method-is_absolute--is_relative",level:3},{value:"A.53.3. Module <code>std::fs</code> (file system)",id:"a533-module-stdfs-file-system",level:2},{value:"A.53.4. Manajemen file system",id:"a534-manajemen-file-system",level:2},{value:"\u25c9 Pembuatan folder (<code>fs::create_dir</code>)",id:"-pembuatan-folder-fscreate_dir",level:3},{value:"\u25c9 Menulis konten file (<code>fs::write</code>)",id:"-menulis-konten-file-fswrite",level:3},{value:"\u25c9 Membaca isi file ke bentuk string (<code>fs::read_to_string</code>)",id:"-membaca-isi-file-ke-bentuk-string-fsread_to_string",level:3},{value:"\u25c9 Membaca isi file ke bentuk vector (<code>fs::read</code>)",id:"-membaca-isi-file-ke-bentuk-vector-fsread",level:3},{value:"\u25c9 Menghapus file (<code>fs::remove_file</code>)",id:"-menghapus-file-fsremove_file",level:3},{value:"\u25c9 Menghapus folder (<code>fs::remove_dir</code>)",id:"-menghapus-folder-fsremove_dir",level:3},{value:"\u25c9 List items dalam folder",id:"-list-items-dalam-folder",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Work in progress",id:"-work-in-progress",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],u={toc:o};function d(e){let{components:t,...r}=e;return(0,i.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan belajar tentang beberapa API milik Rust yang disediakan untuk manajemen path dan file system."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Penulis anjurkan untuk mengikuti pembelajaran chapter per chapter secara berurutan. Nantinya pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/recoverable-error-handling"},"Recoverable Error & Error Handling")," kita akan banyak menerapkan API yang dipelajari di chapter ini.")),(0,i.kt)("h2",{id:"a531-file-path-stdpathpath"},"A.53.1. File path (",(0,i.kt)("inlineCode",{parentName:"h2"},"std::path::Path"),")"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},'"/home/novalagung/Desktop/my text.txt"')," adalah salah satu contoh file path. Di Rust, file path bisa direpresentasikan sebagai string (seperti yang sudah dicontohkan), atau menggunakan tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Path"),"."),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Path")," tersedia dalam module ",(0,i.kt)("inlineCode",{parentName:"p"},"std::path"),". Cara penggunaannya cukup mudah, sebagai contoh, beberapa filepath berikut menghasilkan path yang sama:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'use std::path::Path;\n\nlet filepath_1 = "/home/novalagung/Desktop/my text.txt";\nlet filepath_2 = Path::new("/home/novalagung/Desktop/my text.txt");\nlet filepath_3 = Path::new("/home/novalagung/Desktop").join("my text.txt");\nlet filepath_4 = Path::new("/home/novalagung").join("Desktop").join("my text.txt");\nlet filepath_5 = Path::new("/home").join("novalagung/Desktop/my text.txt");\n\nprintln!("{:?}", filepath_1);\n// output => "/home/novalagung/Desktop/my text.txt"\n\nprintln!("{:?}", filepath_2);\n// output => "/home/novalagung/Desktop/my text.txt"\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Ketika path di-print, yang muncul adalah sesuai dengan string yang ditulis. Dengan pengecualian jika method ",(0,i.kt)("inlineCode",{parentName:"p"},".join()")," digunakan disitu, maka separator file yang digunakan relatif terhadap OS. Jika Windows maka ",(0,i.kt)("inlineCode",{parentName:"p"},"\\"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"/")," untuk non-Windows.")),(0,i.kt)("h2",{id:"a532-method-filepath"},"A.53.2. Method filepath"),(0,i.kt)("h3",{id:"-associated-function-pathnew"},"\u25c9 Associated function ",(0,i.kt)("inlineCode",{parentName:"h3"},"Path::new()")),(0,i.kt)("p",null,"Digunakan untuk membuat object ",(0,i.kt)("inlineCode",{parentName:"p"},"Path")," dari suatu string. Contoh penerapan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'Path::new("/home/novalagung/Desktop/my text.txt");\n')),(0,i.kt)("h3",{id:"-method-join"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"join()")),(0,i.kt)("p",null,"Digunakan untuk menggabungkan segment filepath. Contoh penerapan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'Path::new("/home/novalagung").join("Desktop").join("my text.txt");\n')),(0,i.kt)("p",null,"Hasil dari operasi di atas adalah path:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"/home/novalagung/Desktop/my text.txt\n")),(0,i.kt)("h3",{id:"-method-exists"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"exists()")),(0,i.kt)("p",null,"Digunakan untuk mengecek apakah suatu filepath ada atau tidak."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"if Path::new(&path).exists() {\n // path exists\n}\n")),(0,i.kt)("h3",{id:"-method-is_file--is_dir"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"is_file()")," & ",(0,i.kt)("inlineCode",{parentName:"h3"},"is_dir()")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"is_file()")," digunakan untuk mengecek apakah suatu filepath berisi file."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"if Path::new(&path).is_file() {\n // path is a file\n}\n")),(0,i.kt)("p",null,"Sedangkan method ",(0,i.kt)("inlineCode",{parentName:"p"},"is_dir()")," digunakan untuk mengecek apakah suatu filepath adalah folder/directory."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"if Path::new(&path).is_dir() {\n // path contains directory\n}\n")),(0,i.kt)("h3",{id:"-method-is_absolute--is_relative"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"is_absolute()")," & ",(0,i.kt)("inlineCode",{parentName:"h3"},"is_relative()")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"is_absolute()")," digunakan untuk mengecek apakah suatu filepath adalah ",(0,i.kt)("em",{parentName:"p"},"absolute path"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"if Path::new(&path).is_absolute() {\n // path is an absolute path\n}\n")),(0,i.kt)("p",null,"Sedangkan method ",(0,i.kt)("inlineCode",{parentName:"p"},"is_relative()")," digunakan untuk mengecek apakah suatu filepath adalah ",(0,i.kt)("em",{parentName:"p"},"relative path"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"if Path::new(&path).is_relative() {\n // path is a relative path\n}\n")),(0,i.kt)("h2",{id:"a533-module-stdfs-file-system"},"A.53.3. Module ",(0,i.kt)("inlineCode",{parentName:"h2"},"std::fs")," (file system)"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"std::fs")," merupakan module yang disediakan Rust untuk pengolahan file system. Di dalamnya berisinya banyak sekali fungsi untuk keperluan seperti pembuatan file, modifikasi konten file, dan lainnya."),(0,i.kt)("p",null,"Sebagai contoh, untuk membuat suatu directory bisa menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::create_dir"),". Isi argument pemanggilan fungsi dengan path dalam bentuk string (atau ",(0,i.kt)("inlineCode",{parentName:"p"},"std::path::Path")," juga boleh)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'use std::fs;\n\nfn main() {\n let path = "./files";\n let res = fs::create_dir(&path);\n println!("{:?}", res);\n // output => Ok(())\n}\n')),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::create_dir")," mengembalikan value bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<(), Error>"),". Gunakan pattern matching ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," untuk mengecek hasil operasi apakah sukses atau tidak."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'match fs::create_dir("./files") {\n Err(err) => {\n println!("error on creating directory! {}", err);\n },\n _ => {\n println!("directory created");\n },\n}\n')),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih detailnya mengenai tipe data ",(0,i.kt)("inlineCode",{parentName:"li"},"Result")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/result-type"},"Tipe Data \u279c Result"),"."),(0,i.kt)("li",{parentName:"ul"},"Lebih detailnya mengenai pattern matching dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/pattern-matching"},"Pattern Matching"),"."))),(0,i.kt)("h2",{id:"a534-manajemen-file-system"},"A.53.4. Manajemen file system"),(0,i.kt)("h3",{id:"-pembuatan-folder-fscreate_dir"},"\u25c9 Pembuatan folder (",(0,i.kt)("inlineCode",{parentName:"h3"},"fs::create_dir"),")"),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::create_dir")," digunakan untuk membuat folder. Contoh penerapannya sudah dibahas di sesi ",(0,i.kt)("a",{parentName:"p",href:"/basic/file-path-directory#a523-module-stdfs-file-system"},"A.53.3. Module std::fs (file system)")," di atas."),(0,i.kt)("h3",{id:"-menulis-konten-file-fswrite"},"\u25c9 Menulis konten file (",(0,i.kt)("inlineCode",{parentName:"h3"},"fs::write"),")"),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::write")," digunakan untuk membuat folder. Contoh penerapan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let path = Path::new("./files").join("target.txt");\nlet content = "hello rust!";\nlet res = fs::write(&path, &content);\n\nmatch res {\n Err(err) => {\n println!("error on writing file {}! {}", path.to_str().unwrap_or_default(), err);\n },\n _ => {\n println!("file created");\n },\n}\n')),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::write")," melakukan penulisan konten pada variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"content")," ke path ",(0,i.kt)("inlineCode",{parentName:"p"},"path"),". Mode penulisannya adalah ",(0,i.kt)("em",{parentName:"p"},"overwrite")," (bukan ",(0,i.kt)("em",{parentName:"p"},"append"),"), yang artinya konten lama pada filepath akan di-",(0,i.kt)("em",{parentName:"p"},"replace")," total dengan konten baru."),(0,i.kt)("p",null,"Jika file tidak ada pada ",(0,i.kt)("inlineCode",{parentName:"p"},"path")," tujuan, maka otomatis dibuatkan file baru. Namun jika folder/directory di mana file akan dibuat/ditulis tidak ada, maka muncul error."),(0,i.kt)("h3",{id:"-membaca-isi-file-ke-bentuk-string-fsread_to_string"},"\u25c9 Membaca isi file ke bentuk string (",(0,i.kt)("inlineCode",{parentName:"h3"},"fs::read_to_string"),")"),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::read_to_string()")," digunakan untuk membaca isi file dalam bentuk string. Contoh penerapannya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let path = Path::new("./files").join("target.txt");\nlet res = fs::read_to_string(&path);\n\nmatch res {\n Err(err) => {\n println!("error on reading file {}! {}", path.to_str().unwrap_or_default(), err);\n },\n Ok(content) => {\n println!("file {:?} content is: {:?}", path, content);\n },\n}\n')),(0,i.kt)("h3",{id:"-membaca-isi-file-ke-bentuk-vector-fsread"},"\u25c9 Membaca isi file ke bentuk vector (",(0,i.kt)("inlineCode",{parentName:"h3"},"fs::read"),")"),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::read()")," melakukan operasi baca file dan mengembalikan nilainya dalam bentuk vector ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<u8>"),". Umumnya, fungsi ini dikombinasikan dengan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"std::str::from_utf8()")," agar konten file bisa dimunculkan dalam format encoding tertentu (misalnya UTF-8)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let path = Path::new("./files").join("target.txt");\nlet res = fs::read(&path);\n\nif res.is_err() {\n println!("error on reading file");\n return;\n}\n\nlet content = res.unwrap_or_default();\nmatch std::str::from_utf8(&content) {\n Err(err) => {\n println!("error on reading file! Invalid UTF-8 sequence. {}", err);\n },\n Ok(content) => {\n println!("file {:?} content is: {:?}", path, content);\n },\n};\n')),(0,i.kt)("h3",{id:"-menghapus-file-fsremove_file"},"\u25c9 Menghapus file (",(0,i.kt)("inlineCode",{parentName:"h3"},"fs::remove_file"),")"),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::remove_file")," digunakan untuk menghapus file pada suatu path. Contoh penerapan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let path = Path::new("./files").join("target.txt");\nlet res = fs::remove_file(&path);\n\nmatch res {\n Err(err) => {\n println!("error on deleting file {}! {}", path.to_str().unwrap_or_default(), err);\n },\n _ => {\n println!("file deleted");\n },\n}\n')),(0,i.kt)("h3",{id:"-menghapus-folder-fsremove_dir"},"\u25c9 Menghapus folder (",(0,i.kt)("inlineCode",{parentName:"h3"},"fs::remove_dir"),")"),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::remove_dir")," digunakan untuk menghapus folder/directory. Contoh penerapan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let path = Path::new("./files");\nlet res = fs::remove_dir(&path);\n\nmatch res {\n Err(err) => {\n println!("error on deleting directory {}! {}", path.to_str().unwrap_or_default(), err);\n },\n _ => {\n println!("directory deleted");\n },\n}\n')),(0,i.kt)("h3",{id:"-list-items-dalam-folder"},"\u25c9 List items dalam folder"),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"fs::read_dir")," digunakan untuk menampilkan list items suatu folder (baik subfolder ataupun file). Fungsi ini mengmbalikan nilai bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<ReadDir, Error>"),", untuk mengakses list items bisa menggunakan teknik pattern matching, atau boleh juga langsung di ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap()")," (dengan resiko program bisa panic ketika ada error)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let path = Path::new("D:\\\\Labs\\\\Adam Studio\\\\Ebook\\\\dasarpemrogramanrust\\\\file_path_directory_1");\nlet paths = fs::read_dir(&path).unwrap();\n\nfor path in paths {\n let item = &path.unwrap();\n println!("file name: {:?}, file path: {:?}", item.file_name(), item.path().display())\n}\n')),(0,i.kt)("p",null,"Pada contoh di atas, penulis menggunakan testing path yang isinya 4 buah item:"),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"File, Path, Directory",src:a(2944).Z,width:"595",height:"176"})),(0,i.kt)("p",null,"Output program bisa dilihat pada gambar berikut:"),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"File, Path, Directory",src:a(214).Z,width:"887",height:"149"})),(0,i.kt)("p",null,"Tipe data variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"paths")," di atas adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"ReadDir")," yang merupakan tipe data iterator. Jika digunakan pada keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"for"),", maka variabel element perulangan ",(0,i.kt)("inlineCode",{parentName:"p"},"path")," akan bertipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<DirEntry, Error>"),". Dari tipe ini kita bisa mengakses file name maupun file path."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/file_path_directory"},"github.com/novalagung/dasarpemrogramanrust-example/../file_path_directory")),(0,i.kt)("h3",{id:"-work-in-progress"},"\u25c9 Work in progress"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Pembahasan tentang append content file (",(0,i.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/30684624/what-is-the-best-variant-for-appending-a-new-line-in-a-text-file"},"https://stackoverflow.com/questions/30684624/what-is-the-best-variant-for-appending-a-new-line-in-a-text-file"),")")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/result-type"},"Tipe Data \u279c Result")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/pattern-matching"},"Pattern Matching"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/path/struct.Path.html"},"https://doc.rust-lang.org/std/path/struct.Path.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/std_misc/path.html"},"https://doc.rust-lang.org/rust-by-example/std_misc/path.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/std_misc/fs.html"},"https://doc.rust-lang.org/rust-by-example/std_misc/fs.html"))))}d.isMDXComponent=!0},2944:(e,t,a)=>{a.d(t,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlMAAACwCAIAAACkbHy6AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFvGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiP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v7Z8qmZacvr1fo924yx+r3v0tlNexKzdW7YXvmv5eJw9bqQmfZBaZGZdijBaTczrbpCToXMtOfxmd0YYr+sOR4vMy1R3c+bewa8quuNdiIz7RXpkpl2dILTgQoZDZlpL1GmhtoPsV/aHA+XmRb0cr3Ih8y016NLZlpqvVt7IMHpQIWMh8y0F2jdkj2hOZ4mMy3o5ebPdiIz7Rl0yUzb2bZWgtNWZtqj+VHhptrpX09pjgfITJvtitY9O3lmWtDLTZ/tRGbaK3vmzLTyAo1PcHpk9iOZVCWQmbZHUZ9OsGhc8J3qUzPTlst4d+sersxM67P+jMtEntj21BqAB4RcDU8EmWlBM8hMC7eBd7g8EWSmBc0gMy3cBq75AOBxITMt3AIiHwAA6AXv7QQAAL0g8gEAgF4Q+QAAQC+IfAAAoBdEPgAA0AsiHwAA6AWRDwAA9ILIBwAAekHkAwAAvSDyAQCAXhD5AABAL4h8AACgF0Q+AADQy/8BMFgxvPoJ+vYAAAAASUVORK5CYII="},214:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/file-path-directory-2-bbe0bb5499225e418b251930c44fb8f6.png"}}]); \ No newline at end of file diff --git a/assets/js/9ed3ab78.bfc8ff35.js b/assets/js/9ed3ab78.3b5f30f7.js similarity index 65% rename from assets/js/9ed3ab78.bfc8ff35.js rename to assets/js/9ed3ab78.3b5f30f7.js index f56eb1d7..a0f76420 100644 --- a/assets/js/9ed3ab78.bfc8ff35.js +++ b/assets/js/9ed3ab78.3b5f30f7.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[1591],{3905:(e,a,n)=>{n.d(a,{Zo:()=>d,kt:()=>c});var r=n(7294);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function i(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);a&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?i(Object(n),!0).forEach((function(a){t(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function o(e,a){if(null==e)return{};var n,r,t=function(e,a){if(null==e)return{};var n,r,t={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],a.indexOf(n)>=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var m=r.createContext({}),u=function(e){var a=r.useContext(m),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},d=function(e){var a=u(e.components);return r.createElement(m.Provider,{value:a},e.children)},p={inlineCode:"code",wrapper:function(e){var a=e.children;return r.createElement(r.Fragment,{},a)}},s=r.forwardRef((function(e,a){var n=e.components,t=e.mdxType,i=e.originalType,m=e.parentName,d=o(e,["components","mdxType","originalType","parentName"]),s=u(n),c=t,k=s["".concat(m,".").concat(c)]||s[c]||p[c]||i;return n?r.createElement(k,l(l({ref:a},d),{},{components:n})):r.createElement(k,l({ref:a},d))}));function c(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var i=n.length,l=new Array(i);l[0]=s;var o={};for(var m in a)hasOwnProperty.call(a,m)&&(o[m]=a[m]);o.originalType=e,o.mdxType="string"==typeof e?e:t,l[1]=o;for(var u=2;u<i;u++)l[u]=n[u];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}s.displayName="MDXCreateElement"},7284:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>m,contentTitle:()=>l,default:()=>p,frontMatter:()=>i,metadata:()=>o,toc:()=>u});var r=n(7462),t=(n(7294),n(3905));const i={sidebar_position:55,title:"A.55. Error \u279c Recoverable Error & Error Handling",sidebar_label:"A.55. Error \u279c Recoverable Error & Error Handling"},l=void 0,o={unversionedId:"basic/recoverable-error-handling",id:"basic/recoverable-error-handling",title:"A.55. Error \u279c Recoverable Error & Error Handling",description:"Chapter ini merupakan kelanjutan dari chapter sebelumnya tentang pembahasan topic error. Kali ini fokus kita lebih ke recoverable error dan penanganannya (error handling / error propagation).",source:"@site/docs/basic/recoverable-error-handling.md",sourceDirName:"basic",slug:"/basic/recoverable-error-handling",permalink:"/basic/recoverable-error-handling",draft:!1,tags:[],version:"current",sidebarPosition:55,frontMatter:{sidebar_position:55,title:"A.55. Error \u279c Recoverable Error & Error Handling",sidebar_label:"A.55. Error \u279c Recoverable Error & Error Handling"},sidebar:"tutorialSidebar",previous:{title:"A.54. Error \u279c Unrecoverable Error / Panic",permalink:"/basic/unrecoverable-panic-error"}},m={},u=[{value:"A.55.1. Praktik membuat program <strong>file manager</strong>",id:"a551-praktik-membuat-program-file-manager",level:2},{value:"\u25c9 Deklarasi konstanta, command, dan validasi command",id:"-deklarasi-konstanta-command-dan-validasi-command",level:3},{value:"\u25c9 Fungsi utilitas pembacaan inputan user & flush stdout",id:"-fungsi-utilitas-pembacaan-inputan-user--flush-stdout",level:3},{value:"\u25c9 Kontrol flow program",id:"-kontrol-flow-program",level:3},{value:"\u25c9 Action <code>Command::PrintFiles</code>",id:"-action-commandprintfiles",level:3},{value:"\u25c9 Action <code>Command::CreateFile</code>",id:"-action-commandcreatefile",level:3},{value:"\u25c9 Action <code>Command::ReadFile</code>",id:"-action-commandreadfile",level:3},{value:"\u25c9 Action <code>Command::DeleteFile</code>",id:"-action-commanddeletefile",level:3},{value:"\u25c9 Action <code>Command::ExitProgram</code>",id:"-action-commandexitprogram",level:3},{value:"A.55.2. Test program",id:"a552-test-program",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:u};function p(e){let{components:a,...i}=e;return(0,t.kt)("wrapper",(0,r.Z)({},d,i,{components:a,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Chapter ini merupakan kelanjutan dari chapter sebelumnya tentang pembahasan topic error. Kali ini fokus kita lebih ke ",(0,t.kt)("strong",{parentName:"p"},"recoverable error")," dan penanganannya (",(0,t.kt)("em",{parentName:"p"},"error handling")," / ",(0,t.kt)("em",{parentName:"p"},"error propagation"),")."),(0,t.kt)("p",null,"Best practice penanganan error di Rust adalah dengan mengkombinasikan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"match")," dengan tipe data ",(0,t.kt)("inlineCode",{parentName:"p"},"Result<T, E>"),". Untuk penerapannya sendiri sebenarnya sudah cukup sering dipraktikan di chapter-chapter sebelumnya."),(0,t.kt)("p",null,"Pada chapter ini pembelajaran dilakukan dengan lebih banyak menulis kode (",(0,t.kt)("em",{parentName:"p"},"coding"),"), dengan ini penulis harapkan pembaca bisa terbiasa dan nyaman dengan gaya penanganan error di Rust."),(0,t.kt)("h2",{id:"a551-praktik-membuat-program-file-manager"},"A.55.1. Praktik membuat program ",(0,t.kt)("strong",{parentName:"h2"},"file manager")),(0,t.kt)("p",null,"Program yang akan dibuat skalanya lebih besar dibanding program pada praktik-praktik sebelumnya. Program ",(0,t.kt)("strong",{parentName:"p"},"file manager")," ini kita akan buat dari 0, kegunaannya adalah untuk mempermudah manajemen file seperti pembuatan file, pembacaan file, dan operasi file lainnya."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Pastikan untuk mempelajari beberapa chapter berikut sebelum memulai pembelajaran"),(0,t.kt)("ul",{parentName:"blockquote"},(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/module-basic"},"Module System \u279c Module")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/result-type"},"Tipe Data \u279c Result")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/pattern-matching"},"Pattern Matching")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/file-path-directory"},"File, Path, Directory")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/unrecoverable-panic-error"},"Error \u279c Unrecoverable Error / Panic")))),(0,t.kt)("p",null,"Ok, sekarang siapkan sebuah package atau project terlebih dahulu, dengan struktur seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"file_manager\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 file_action_constant.rs\n \u2502\u2500\u2500\u2500 file_manager.rs\n \u2502\u2500\u2500\u2500 file_utility.rs\n \u2514\u2500\u2500\u2500 main.rs\n")),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"File ",(0,t.kt)("inlineCode",{parentName:"li"},"file_action_constant.rs")," akan diisi dengan deklarasi konstanta base path, enum action/command, dan fungsi validasi command."),(0,t.kt)("li",{parentName:"ul"},"File ",(0,t.kt)("inlineCode",{parentName:"li"},"file_manager.rs")," akan diisi dengan ",(0,t.kt)("em",{parentName:"li"},"business process")," program file manager."),(0,t.kt)("li",{parentName:"ul"},"File ",(0,t.kt)("inlineCode",{parentName:"li"},"file_utility.rs")," akan diisi dengan beberapa fungsi utilitas seperti operasi baca inputan user."),(0,t.kt)("li",{parentName:"ul"},"File ",(0,t.kt)("inlineCode",{parentName:"li"},"main.rs")," berisi kontrol alur eksekusi program.")),(0,t.kt)("h3",{id:"-deklarasi-konstanta-command-dan-validasi-command"},"\u25c9 Deklarasi konstanta, command, dan validasi command"),(0,t.kt)("p",null,"Deklarasikan beberapa hal berikut pada file ",(0,t.kt)("inlineCode",{parentName:"p"},"file_action_constant.rs"),":"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Konstanta ",(0,t.kt)("inlineCode",{parentName:"li"},"FOLDER_BASEPATH"),". Nantinya digunakan sebagai basepath operasi program file manager ini."),(0,t.kt)("li",{parentName:"ul"},"Enum ",(0,t.kt)("inlineCode",{parentName:"li"},"Command"),", berisi action yang tersedia seperti ",(0,t.kt)("inlineCode",{parentName:"li"},"PrintFiles"),", ",(0,t.kt)("inlineCode",{parentName:"li"},"CreateFile"),", dan lainnya."),(0,t.kt)("li",{parentName:"ul"},"Fungsi validasi command.")),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="./src/file_action_constant.rs"',title:'"./src/file_action_constant.rs"'},'pub const FOLDER_BASEPATH: &str = "./files";\n\npub enum Command {\n PrintFiles,\n CreateFile,\n ReadFile,\n DeleteFile,\n ExitProgram,\n}\n\npub fn validate_command(cmd: &str) -> Result<Command, &\'static str> {\n match cmd {\n "1" => Ok(Command::PrintFiles),\n "2" => Ok(Command::CreateFile),\n "3" => Ok(Command::ReadFile),\n "4" => Ok(Command::DeleteFile),\n "9" => Ok(Command::ExitProgram),\n _ => Err("unrecognized command")\n }\n}\n')),(0,t.kt)("p",null,"Dari kode di atas terlihat bahwa program akan berisi setidaknya 5 buah action (termasuk ",(0,t.kt)("inlineCode",{parentName:"p"},"ExitProgram"),")."),(0,t.kt)("h3",{id:"-fungsi-utilitas-pembacaan-inputan-user--flush-stdout"},"\u25c9 Fungsi utilitas pembacaan inputan user & flush stdout"),(0,t.kt)("p",null,"Siapkan 2 fungsi I/O berikut:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"read_entry()")," untuk membaca inputan user, lalu mengembalikannya dalam bentuk ",(0,t.kt)("inlineCode",{parentName:"li"},"Result<T, E>")," dimana ",(0,t.kt)("inlineCode",{parentName:"li"},"T")," berisi inputan user dan ",(0,t.kt)("inlineCode",{parentName:"li"},"E")," berisi informasi error dalam bentuk ",(0,t.kt)("inlineCode",{parentName:"li"},"String")," (jika ada error)."),(0,t.kt)("li",{parentName:"ul"},"Fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"stdout_flush()")," untuk mem-flush output ",(0,t.kt)("strong",{parentName:"li"},"stdout"),". Ini penting karena ",(0,t.kt)("em",{parentName:"li"},"default"),"-nya Rust mem-",(0,t.kt)("em",{parentName:"li"},"buffer")," stdout.")),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="./src/file_utility.rs"',title:'"./src/file_utility.rs"'},"use std::io;\nuse std::io::Write;\n\npub fn read_entry() -> Result<String, String> {\n let mut message = String::new();\n let reader_res = io::stdin().read_line(&mut message);\n\n // error handling using guard method\n let content = match reader_res {\n Ok(_) => message.trim().to_string(),\n Err(err) => {\n return Err(err.to_string())\n }\n };\n\n return Ok(content)\n}\n\npub fn stdout_flush() -> Result<(), String> {\n\n // error handling using basic implementation of keyword match\n match io::stdout().flush() {\n Err(err) => Err(err.to_string()),\n Ok(()) => Ok(())\n }\n}\n")),(0,t.kt)("p",null,"Di kode di atas kita sudah mulai mengimplementasikan operasi ",(0,t.kt)("strong",{parentName:"p"},"error handling")," di Rust, caranya cukup mudah bukan? Tinggal masukan saja data bertipe ",(0,t.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," ke keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"match"),". Untuk penerapan keyword tersebut bisa dilakukan dengan cara konvensional, metode guard, atau lainnya."),(0,t.kt)("h3",{id:"-kontrol-flow-program"},"\u25c9 Kontrol flow program"),(0,t.kt)("p",null,"Lanjut ke bagian kontrol eksekusi alur program. Program didesain berjalan secara kontinyu (non-stop) sampai user memilih command ",(0,t.kt)("inlineCode",{parentName:"p"},"ExitProgram"),". Di setiap perulangan, nantinya user bisa menentukan action apa yang dipilih."),(0,t.kt)("p",null,"Buka file ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),", buat fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"run_program()"),". Fungsi ini mengembalikan tipe data bernotasi ",(0,t.kt)("inlineCode",{parentName:"p"},"Result<(), String>"),". Notasi ini penulis jadikan sebagai notasi utama untuk fungsi-fungsi yang berpotensi mengembalikan error."),(0,t.kt)("p",null,"Di dalam fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"run_program()"),", terdapat perulangan dengan isi beberapa hal berikut secara berurutan."),(0,t.kt)("ol",null,(0,t.kt)("li",{parentName:"ol"},"Memunculkan output pilihan command"),(0,t.kt)("li",{parentName:"ol"},"Flush stdout"),(0,t.kt)("li",{parentName:"ol"},"Baca inputan user"),(0,t.kt)("li",{parentName:"ol"},"Validasi inputan user"),(0,t.kt)("li",{parentName:"ol"},"Eksekusi action/command",(0,t.kt)("ul",{parentName:"li"},(0,t.kt)("li",{parentName:"ul"},"Command ",(0,t.kt)("inlineCode",{parentName:"li"},"PrintFiles"),": munculkan semua file yang sudah dibuat."),(0,t.kt)("li",{parentName:"ul"},"Command ",(0,t.kt)("inlineCode",{parentName:"li"},"CreateFile"),": program meminta inputan nama file dan kontennya, untuk kemudian dibuatkan filenya."),(0,t.kt)("li",{parentName:"ul"},"Command ",(0,t.kt)("inlineCode",{parentName:"li"},"ReadFile"),": baca file sesuai inputan nama file."),(0,t.kt)("li",{parentName:"ul"},"Command ",(0,t.kt)("inlineCode",{parentName:"li"},"DeleteFile"),": operasi hapus file."),(0,t.kt)("li",{parentName:"ul"},"Command ",(0,t.kt)("inlineCode",{parentName:"li"},"ExitProgram"),": keluar program.")))),(0,t.kt)("p",null,"Source code lengkap ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),":"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="./src/main.rs"',title:'"./src/main.rs"'},'mod file_action_constant;\nmod file_manager;\nmod file_utility;\n\nfn run_program() -> Result<(), String> {\n println!("Welcome to file maker app!");\n\n loop {\n println!();\n println!("Available command:");\n println!("1. Print files");\n println!("2. Create file");\n println!("3. Read file");\n println!("4. Delete file");\n println!("9. Exit");\n\n println!();\n print!("Enter your command: ");\n\n // error handling using operator ?\n let _ = file_utility::stdout_flush()?;\n\n // error handling using guard method\n let user_entry = match file_utility::read_entry() {\n Err(err) => {\n println!("ERROR. unable to continue the program. {}", err);\n continue;\n },\n Ok(txt) => txt,\n };\n\n // error handling using basic implementation of keyword match\n let cmd_result = file_action_constant::validate_command(&user_entry);\n match cmd_result {\n Err(err) => {\n println!("ERROR. {}", err);\n continue;\n },\n _ => {}\n };\n let cmd = cmd_result.unwrap();\n\n // check command\n match cmd {\n file_action_constant::Command::PrintFiles => {\n // error handling using operator ?\n file_manager::print_files()?;\n },\n file_action_constant::Command::CreateFile => {\n // error handling using operator ?\n file_manager::create_file()?;\n },\n file_action_constant::Command::ReadFile => {\n // error handling using operator ?\n file_manager::read_file()?;\n },\n file_action_constant::Command::DeleteFile => {\n // error handling using operator ?\n file_manager::delete_file()?;\n },\n file_action_constant::Command::ExitProgram => {\n println!("Exiting program ...");\n return Ok(());\n },\n }\n }\n}\n\nfn main() {\n // error handling using basic implementation of keyword match\n match run_program() {\n Err(err) => panic!("ERRROR {:?}", err),\n Ok(_) => {}\n }\n}\n')),(0,t.kt)("p",null,"Bisa dilihat di kode di atas, ada beberapa metode error handling yang diterapkan."),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Error handling menggunakan metode guard diterapkan saat pembacaan inputan user."),(0,t.kt)("li",{parentName:"ul"},"Error handling menggunakan implementasi standar keyword ",(0,t.kt)("inlineCode",{parentName:"li"},"match")," dan tipe ",(0,t.kt)("inlineCode",{parentName:"li"},"Result")," digunakan saat validasi command."),(0,t.kt)("li",{parentName:"ul"},"Error handling menggunakan operator ",(0,t.kt)("inlineCode",{parentName:"li"},"?")," digunakan saat flush stdout dan eksekusi command.")),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Silakan mengintip kembali chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/operator-tanda-tanya"},"Operator ?")," jika diperlukan untuk mengingat kembali cara kerja operator ",(0,t.kt)("inlineCode",{parentName:"p"},"?"),".")),(0,t.kt)("p",null,"Metode error handling menggunakan operator ",(0,t.kt)("inlineCode",{parentName:"p"},"?")," sengaja diterapkan pada bagian flush stdout dan eksekusi command. Karena di dalam domain tersebut, ketika ada error maka error-nya pasti berhubungan dengan I/O dan permission di level sistim operasi (OS) yang dimana kita tidak bisa menangani error tersebut dari level program yang sedang dibuat. Oleh karena itu operator ",(0,t.kt)("inlineCode",{parentName:"p"},"?")," digunakan. Dengannya, maka error-error tersebut akan membuat eksekusi program terhenti secara total dan error dimunculkan sebelum program terhenti karena oleh panic error."),(0,t.kt)("h3",{id:"-action-commandprintfiles"},"\u25c9 Action ",(0,t.kt)("inlineCode",{parentName:"h3"},"Command::PrintFiles")),(0,t.kt)("p",null,"Action ",(0,t.kt)("inlineCode",{parentName:"p"},"PrintFiles")," melakukan pengecekan pembuatan folder ",(0,t.kt)("inlineCode",{parentName:"p"},"FOLDER_BASEPATH")," (jika belum ada), dan menampilkan list file di dalam folder tersebut. Jika tidak ada file, pesan ",(0,t.kt)("inlineCode",{parentName:"p"},"No files")," dimunculkan ke layar."),(0,t.kt)("p",null,"Tulis kode berikut di file ",(0,t.kt)("inlineCode",{parentName:"p"},"file_manager.rs"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="./src/file_manager.rs"',title:'"./src/file_manager.rs"'},'use crate::file_action_constant;\nuse crate::file_utility;\n\nuse std::path::Path;\nuse std::fs;\n\npub fn print_files() -> Result<(), String> {\n let path = Path::new(file_action_constant::FOLDER_BASEPATH);\n\n // if files folder not exists, create it\n if !path.is_dir() {\n\n // error handling using basic implementation of keyword match\n match fs::create_dir(path) {\n Err(err) => {\n return Err(err.to_string());\n },\n Ok(_) => {},\n }\n }\n\n // error handling using guard method\n let dir = match fs::read_dir(path) {\n Err(err) => {\n return Err(err.to_string());\n },\n Ok(entry) => entry,\n };\n\n let mut count = 0;\n for file in dir {\n count = count + 1;\n\n // error handling using basic implementation of keyword match\n match file {\n Err(err) => {\n return Err(err.to_string());\n },\n Ok(entry) => {\n println!(" -> {:?}", entry.path());\n }\n }\n };\n\n if count == 0 {\n println!("No files");\n }\n\n Ok(())\n}\n\n// ...\n')),(0,t.kt)("p",null,"Dari kode di atas terlihat operasi error propagation dilakukan 3 kali yaitu ketika:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Pembuatan folder ",(0,t.kt)("inlineCode",{parentName:"li"},"FOLDER_BASEPATH")," (ketika folder belum ada)."),(0,t.kt)("li",{parentName:"ul"},"Pembacaan isi folder."),(0,t.kt)("li",{parentName:"ul"},"Menampilkan nama file dalam folder.")),(0,t.kt)("h3",{id:"-action-commandcreatefile"},"\u25c9 Action ",(0,t.kt)("inlineCode",{parentName:"h3"},"Command::CreateFile")),(0,t.kt)("p",null,"Masih di file yang sama (",(0,t.kt)("inlineCode",{parentName:"p"},"file_manager.rs"),") tambahkan kode untuk handle action pembuatan file berikut."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="./src/file_manager.rs"',title:'"./src/file_manager.rs"'},'// ...\n\npub fn create_file() -> Result<(), String> {\n let path = Path::new(file_action_constant::FOLDER_BASEPATH);\n\n print!("Enter filename: ");\n \n // error handling using operator ?\n let _ = file_utility::stdout_flush()?;\n\n // error handling using guard method\n let filename = match file_utility::read_entry() {\n Err(err) => {\n return Err(err.to_string());\n },\n Ok(txt) => txt,\n };\n\n print!("Enter file content: ");\n \n // error handling using operator ?\n let _ = file_utility::stdout_flush()?;\n\n // error handling using guard method\n let content = match file_utility::read_entry() {\n Err(err) => {\n return Err(err.to_string());\n },\n Ok(txt) => txt,\n };\n\n // error handling using basic implementation of keyword match\n match fs::write(path.join(filename), content) {\n Err(err) => {\n return Err(err.to_string());\n },\n Ok(()) => {},\n }\n \n Ok(())\n}\n')),(0,t.kt)("p",null,"Handler ini berisi interaksi I/O dengan user 2 kali:"),(0,t.kt)("ol",null,(0,t.kt)("li",{parentName:"ol"},"Program meminta inputan user untuk dijadikan nama file."),(0,t.kt)("li",{parentName:"ol"},"Program meminta lagi inputan untuk isi konten file.")),(0,t.kt)("p",null,"Perihal error handler-nya sendiri juga ada beberapa:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Karena terdapat operasi I/O, maka flush stdout perlu dipanggil. Dalam pemanggilannya, metode error handler menggunakan operator ",(0,t.kt)("inlineCode",{parentName:"li"},"?")," dipakai.",(0,t.kt)("pre",{parentName:"li"},(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"let _ = file_utility::stdout_flush()?;\n"))),(0,t.kt)("li",{parentName:"ul"},"Ketika baca inputan user untuk nama file dan konten file",(0,t.kt)("pre",{parentName:"li"},(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"let filename = match file_utility::read_entry() { ... };\nlet content = match file_utility::read_entry() { ... };\n"))),(0,t.kt)("li",{parentName:"ul"},"Ketika file dibuat (operasi write file)",(0,t.kt)("pre",{parentName:"li"},(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"match fs::write(path.join(filename), content) { ... }\n")))),(0,t.kt)("h3",{id:"-action-commandreadfile"},"\u25c9 Action ",(0,t.kt)("inlineCode",{parentName:"h3"},"Command::ReadFile")),(0,t.kt)("p",null,"Operasi baca file dilakukan dengan melibatkan I/O dengan user. User dimintai inputan nama file, kemudian file tersebut ditampilkan isinya. Jika ada error saat baca file (yang besar kemungkinan disebabkan oleh file yang dicari tidak ditemukan), pesan errornya kemudian dimunculkan."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="./src/file_manager.rs"',title:'"./src/file_manager.rs"'},'// ...\n\npub fn read_file() -> Result<(), String> {\n let path = Path::new(file_action_constant::FOLDER_BASEPATH);\n\n print!("Enter filename: ");\n \n // error handling using operator ?\n let _ = file_utility::stdout_flush()?;\n\n // error handling using guard method\n let filename = match file_utility::read_entry() {\n Err(err) => {\n return Err(err.to_string());\n },\n Ok(txt) => txt,\n };\n\n // error handling using guard method\n let content = match fs::read_to_string(path.join(filename)) {\n Err(err) => {\n println!("ERROR. {:?}", err.to_string());\n return Ok(());\n },\n Ok(txt) => txt,\n };\n\n println!("File content: {:?}", content);\n\n Ok(())\n}\n')),(0,t.kt)("p",null,"Bisa dilihat pada statement baca file, ketika terjadi error, ",(0,t.kt)("inlineCode",{parentName:"p"},"Err()")," tidak dikembalikan, melainkan menggunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"Ok()"),". Ini penting karena jika ",(0,t.kt)("inlineCode",{parentName:"p"},"Err()")," digunakan di situ, membuat eksekusi fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"run_program()")," terhenti secara paksa karena fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"read_file()")," (dan fungsi handler command lainnya) dipanggil dengan disertai operator ",(0,t.kt)("inlineCode",{parentName:"p"},"?"),"."),(0,t.kt)("p",null,"Yang kita lakukan disini adalah memunculkan pesan errornya ke layar secara ",(0,t.kt)("em",{parentName:"p"},"friendly"),", agar program tetap bisa running sesuai flow."),(0,t.kt)("h3",{id:"-action-commanddeletefile"},"\u25c9 Action ",(0,t.kt)("inlineCode",{parentName:"h3"},"Command::DeleteFile")),(0,t.kt)("p",null,"Operasi baca file juga melibatkan 1 kali interaksi I/O dengan user. File yang namanya di-input oleh user akan dihapus."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="./src/file_manager.rs"',title:'"./src/file_manager.rs"'},'// ...\n\npub fn delete_file() -> Result<(), String> {\n let path = Path::new(file_action_constant::FOLDER_BASEPATH);\n\n print!("Enter filename: ");\n \n // error handling using operator ?\n let _ = file_utility::stdout_flush()?;\n\n // error handling using guard method\n let filename = match file_utility::read_entry() {\n Err(err) => {\n return Err(err.to_string());\n },\n Ok(txt) => txt,\n };\n\n // error handling using basic implementation of keyword match\n match fs::remove_file(path.join(filename)) {\n Err(err) => {\n println!("ERROR. {:?}", err.to_string());\n return Ok(());\n },\n Ok(_) => {\n println!("File deleted");\n },\n };\n\n Ok(())\n}\n')),(0,t.kt)("p",null,"Error yang berpotensi muncul saat penghapusan file dimunculkan ke layar tanpa menandai pemanggilan fungsi sebagai error, agar flow program tetap berjalan."),(0,t.kt)("h3",{id:"-action-commandexitprogram"},"\u25c9 Action ",(0,t.kt)("inlineCode",{parentName:"h3"},"Command::ExitProgram")),(0,t.kt)("p",null,"Handler command exit program sudah ditulis di blok fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"run_program()"),"."),(0,t.kt)("h2",{id:"a552-test-program"},"A.55.2. Test program"),(0,t.kt)("p",null,"Ok, bagian tulis menulis kode sudah selesai. Lanjut ke fase testing. Jalankan program, pilih beberapa command, test keseluruhan fungsinya."),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Testing pertama, munculkan files menggunakan command ",(0,t.kt)("inlineCode",{parentName:"p"},"1 Print files"),"."),(0,t.kt)("p",{parentName:"li"}," ",(0,t.kt)("img",{alt:"Recoverable Error & Error Handling",src:n(7201).Z,width:"637",height:"291"}))),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Testing ke-2, buat file baru, cek keberadaan filenya, lalu munculkan isinya."),(0,t.kt)("p",{parentName:"li"}," ",(0,t.kt)("img",{alt:"Recoverable Error & Error Handling",src:n(6993).Z,width:"637",height:"673"}))),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Testing ke-3, hapus file yang telah dibuat, lalu cek lagi file yang ada."),(0,t.kt)("p",{parentName:"li"}," ",(0,t.kt)("img",{alt:"Recoverable Error & Error Handling",src:n(8669).Z,width:"637",height:"243"}))),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Testing ke-4, exit program."),(0,t.kt)("p",{parentName:"li"}," ",(0,t.kt)("img",{alt:"Recoverable Error & Error Handling",src:n(3610).Z,width:"637",height:"181"})))),(0,t.kt)("p",null,"Hasilnya, mantab."),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/recoverable_error_handling"},"github.com/novalagung/dasarpemrogramanrust-example/../recoverable_error_handling")),(0,t.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/module-basic"},"Module System \u279c Module")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/result-type"},"Tipe Data \u279c Result")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/operator-tanda-tanya"},"Operator ?")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/pattern-matching"},"Pattern Matching")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/file-path-directory"},"File, Path, Directory")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/unrecoverable-panic-error"},"Error \u279c Unrecoverable Error / Panic"))),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-with-panic.html"},"https://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-with-panic.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch09-03-to-panic-or-not-to-panic.html"},"https://doc.rust-lang.org/book/ch09-03-to-panic-or-not-to-panic.html"))))}p.isMDXComponent=!0},7201:(e,a,n)=>{n.d(a,{Z:()=>r});const r=n.p+"assets/images/recoverable-error-handling-1-a60b09beaa6803045688abcf2a1f4762.png"},6993:(e,a,n)=>{n.d(a,{Z:()=>r});const r=n.p+"assets/images/recoverable-error-handling-2-4bb5c6b2c2f3dcc0eb5029fb2ab09519.png"},8669:(e,a,n)=>{n.d(a,{Z:()=>r});const r=n.p+"assets/images/recoverable-error-handling-3-9ac2af92e26692ae7be26b9c2a06ed71.png"},3610:(e,a,n)=>{n.d(a,{Z:()=>r});const r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAn0AAAC1CAIAAAClNd5qAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGlmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS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2+obTgiaSrapFXzJ9uXoHwMSMFy5JM3Z+8Ka5oI1fiUPDmInLhyu9nPrhQe2LLK/feb5p9kI68mifP8p9m7zf3HgAwnUX4/q4WPZTU27Dh1NCkxhWYFoubtGKLSPWD6ZmL4vrbftMcYlstOld8cu9T8it90+yDdOTVXIxKswcARLsIv0e059X987ve604wnzmSEdkru43NaP6/347NXmRWVfWNg6uHOk6FHknkW1zd3CVZxtPs/+6+UDuKGSk4cmD10Piyuc9SOQAALpGsu9pt3fePvl7xWtuc1B1Fa4NNph1/6n9gyTod7+kmppWlJTvO5mo1TgnxmeqYkYIXspLc81QvftPsP3g0vI5CSbMPIjGt7C3V+93l0A8CAKJCxHLvX+7JsmYnXVVzagZFWspauhoy9/3bP39Q5X7KV8Ssqmb3s8raivSLdaqIDDsaNu781PfMjTs/9e33WktZS1fDc+NZ9DLRG03LXSHzwU5zxvpJsxexh9iRM9YWYpo9AGCai748osS0sqqDCXW5u7XnthLTyqoOLm0L+B5RsXyYU6TrZnPoHQEAEKLo259Zu/nqlpaZMle+++qjyNdCwzoCAEwf0fc6aecbe5pWei7/unbDiN6OAADTR/StMwMAEL2ib50ZAIDoRd0FAMA41F0AAIxD3QUAwDjUXQAAjEPdBQDAONRdAACMQ90FAMA41F0AAIxD3QUAwDjUXQAAjEPdBQDAONRdAACMQ90FAMA41F0AAIxD3QUAwDj/Hyq8QZdzlMinAAAAAElFTkSuQmCC"}}]); \ No newline at end of file +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[1591],{3905:(e,a,n)=>{n.d(a,{Zo:()=>d,kt:()=>c});var r=n(7294);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function i(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);a&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?i(Object(n),!0).forEach((function(a){t(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function o(e,a){if(null==e)return{};var n,r,t=function(e,a){if(null==e)return{};var n,r,t={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],a.indexOf(n)>=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var m=r.createContext({}),u=function(e){var a=r.useContext(m),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},d=function(e){var a=u(e.components);return r.createElement(m.Provider,{value:a},e.children)},p={inlineCode:"code",wrapper:function(e){var a=e.children;return r.createElement(r.Fragment,{},a)}},s=r.forwardRef((function(e,a){var n=e.components,t=e.mdxType,i=e.originalType,m=e.parentName,d=o(e,["components","mdxType","originalType","parentName"]),s=u(n),c=t,k=s["".concat(m,".").concat(c)]||s[c]||p[c]||i;return n?r.createElement(k,l(l({ref:a},d),{},{components:n})):r.createElement(k,l({ref:a},d))}));function c(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var i=n.length,l=new Array(i);l[0]=s;var o={};for(var m in a)hasOwnProperty.call(a,m)&&(o[m]=a[m]);o.originalType=e,o.mdxType="string"==typeof e?e:t,l[1]=o;for(var u=2;u<i;u++)l[u]=n[u];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}s.displayName="MDXCreateElement"},7284:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>m,contentTitle:()=>l,default:()=>p,frontMatter:()=>i,metadata:()=>o,toc:()=>u});var r=n(7462),t=(n(7294),n(3905));const i={sidebar_position:55,title:"A.55. Error \u279c Recoverable Error & Error Handling",sidebar_label:"A.55. Error \u279c Recoverable Error & Error Handling"},l=void 0,o={unversionedId:"basic/recoverable-error-handling",id:"basic/recoverable-error-handling",title:"A.55. Error \u279c Recoverable Error & Error Handling",description:"Chapter ini merupakan kelanjutan dari chapter sebelumnya tentang pembahasan topic error. Kali ini fokus kita lebih ke recoverable error dan penanganannya (error handling / error propagation).",source:"@site/docs/basic/recoverable-error-handling.md",sourceDirName:"basic",slug:"/basic/recoverable-error-handling",permalink:"/basic/recoverable-error-handling",draft:!1,tags:[],version:"current",sidebarPosition:55,frontMatter:{sidebar_position:55,title:"A.55. Error \u279c Recoverable Error & Error Handling",sidebar_label:"A.55. Error \u279c Recoverable Error & Error Handling"},sidebar:"tutorialSidebar",previous:{title:"A.54. Error \u279c Unrecoverable Error / Panic",permalink:"/basic/unrecoverable-panic-error"}},m={},u=[{value:"A.55.1. Praktik membuat program <strong>file manager</strong>",id:"a551-praktik-membuat-program-file-manager",level:2},{value:"\u25c9 Deklarasi konstanta, command, dan validasi command",id:"-deklarasi-konstanta-command-dan-validasi-command",level:3},{value:"\u25c9 Fungsi utilitas pembacaan inputan user & flush stdout",id:"-fungsi-utilitas-pembacaan-inputan-user--flush-stdout",level:3},{value:"\u25c9 Kontrol flow program",id:"-kontrol-flow-program",level:3},{value:"\u25c9 Action <code>Command::PrintFiles</code>",id:"-action-commandprintfiles",level:3},{value:"\u25c9 Action <code>Command::CreateFile</code>",id:"-action-commandcreatefile",level:3},{value:"\u25c9 Action <code>Command::ReadFile</code>",id:"-action-commandreadfile",level:3},{value:"\u25c9 Action <code>Command::DeleteFile</code>",id:"-action-commanddeletefile",level:3},{value:"\u25c9 Action <code>Command::ExitProgram</code>",id:"-action-commandexitprogram",level:3},{value:"A.55.2. Test program",id:"a552-test-program",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:u};function p(e){let{components:a,...i}=e;return(0,t.kt)("wrapper",(0,r.Z)({},d,i,{components:a,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Chapter ini merupakan kelanjutan dari chapter sebelumnya tentang pembahasan topic error. Kali ini fokus kita lebih ke ",(0,t.kt)("strong",{parentName:"p"},"recoverable error")," dan penanganannya (",(0,t.kt)("em",{parentName:"p"},"error handling")," / ",(0,t.kt)("em",{parentName:"p"},"error propagation"),")."),(0,t.kt)("p",null,"Best practice penanganan error di Rust adalah dengan mengkombinasikan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"match")," dengan tipe data ",(0,t.kt)("inlineCode",{parentName:"p"},"Result<T, E>"),". Untuk penerapannya sendiri sebenarnya sudah cukup sering dipraktikan di chapter-chapter sebelumnya."),(0,t.kt)("p",null,"Pada chapter ini pembelajaran dilakukan dengan lebih banyak menulis kode (",(0,t.kt)("em",{parentName:"p"},"coding"),"), dengan ini penulis harapkan pembaca bisa terbiasa dan nyaman dengan gaya penanganan error di Rust."),(0,t.kt)("h2",{id:"a551-praktik-membuat-program-file-manager"},"A.55.1. Praktik membuat program ",(0,t.kt)("strong",{parentName:"h2"},"file manager")),(0,t.kt)("p",null,"Program yang akan dibuat skalanya lebih besar dibanding program pada praktik-praktik sebelumnya. Program ",(0,t.kt)("strong",{parentName:"p"},"file manager")," ini kita akan buat dari 0, kegunaannya adalah untuk mempermudah manajemen file seperti pembuatan file, pembacaan file, dan operasi file lainnya."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Pastikan untuk mempelajari beberapa chapter berikut sebelum memulai pembelajaran"),(0,t.kt)("ul",{parentName:"blockquote"},(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/module-basic"},"Module System \u279c Module")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/result-type"},"Tipe Data \u279c Result")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/pattern-matching"},"Pattern Matching")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/file-path-directory"},"File, Path, Directory")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/unrecoverable-panic-error"},"Error \u279c Unrecoverable Error / Panic")))),(0,t.kt)("p",null,"Ok, sekarang siapkan sebuah package atau project terlebih dahulu, dengan struktur seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"file_manager\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 file_action_constant.rs\n \u2502\u2500\u2500\u2500 file_manager.rs\n \u2502\u2500\u2500\u2500 file_utility.rs\n \u2514\u2500\u2500\u2500 main.rs\n")),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"File ",(0,t.kt)("inlineCode",{parentName:"li"},"file_action_constant.rs")," akan diisi dengan deklarasi konstanta base path, enum action/command, dan fungsi validasi command."),(0,t.kt)("li",{parentName:"ul"},"File ",(0,t.kt)("inlineCode",{parentName:"li"},"file_manager.rs")," akan diisi dengan ",(0,t.kt)("em",{parentName:"li"},"business process")," program file manager."),(0,t.kt)("li",{parentName:"ul"},"File ",(0,t.kt)("inlineCode",{parentName:"li"},"file_utility.rs")," akan diisi dengan beberapa fungsi utilitas seperti operasi baca inputan user."),(0,t.kt)("li",{parentName:"ul"},"File ",(0,t.kt)("inlineCode",{parentName:"li"},"main.rs")," berisi kontrol alur eksekusi program.")),(0,t.kt)("h3",{id:"-deklarasi-konstanta-command-dan-validasi-command"},"\u25c9 Deklarasi konstanta, command, dan validasi command"),(0,t.kt)("p",null,"Deklarasikan beberapa hal berikut pada file ",(0,t.kt)("inlineCode",{parentName:"p"},"file_action_constant.rs"),":"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Konstanta ",(0,t.kt)("inlineCode",{parentName:"li"},"FOLDER_BASEPATH"),". Nantinya digunakan sebagai basepath operasi program file manager ini."),(0,t.kt)("li",{parentName:"ul"},"Enum ",(0,t.kt)("inlineCode",{parentName:"li"},"Command"),", berisi action yang tersedia seperti ",(0,t.kt)("inlineCode",{parentName:"li"},"PrintFiles"),", ",(0,t.kt)("inlineCode",{parentName:"li"},"CreateFile"),", dan lainnya."),(0,t.kt)("li",{parentName:"ul"},"Fungsi validasi command.")),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="./src/file_action_constant.rs"',title:'"./src/file_action_constant.rs"'},'pub const FOLDER_BASEPATH: &str = "./files";\n\npub enum Command {\n PrintFiles,\n CreateFile,\n ReadFile,\n DeleteFile,\n ExitProgram,\n}\n\npub fn validate_command(cmd: &str) -> Result<Command, &\'static str> {\n match cmd {\n "1" => Ok(Command::PrintFiles),\n "2" => Ok(Command::CreateFile),\n "3" => Ok(Command::ReadFile),\n "4" => Ok(Command::DeleteFile),\n "9" => Ok(Command::ExitProgram),\n _ => Err("unrecognized command")\n }\n}\n')),(0,t.kt)("p",null,"Dari kode di atas terlihat bahwa program akan berisi setidaknya 5 buah action (termasuk ",(0,t.kt)("inlineCode",{parentName:"p"},"ExitProgram"),")."),(0,t.kt)("h3",{id:"-fungsi-utilitas-pembacaan-inputan-user--flush-stdout"},"\u25c9 Fungsi utilitas pembacaan inputan user & flush stdout"),(0,t.kt)("p",null,"Siapkan 2 fungsi I/O berikut:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"read_entry()")," untuk membaca inputan user, lalu mengembalikannya dalam bentuk ",(0,t.kt)("inlineCode",{parentName:"li"},"Result<T, E>")," dimana ",(0,t.kt)("inlineCode",{parentName:"li"},"T")," berisi inputan user dan ",(0,t.kt)("inlineCode",{parentName:"li"},"E")," berisi informasi error dalam bentuk ",(0,t.kt)("inlineCode",{parentName:"li"},"String")," (jika ada error)."),(0,t.kt)("li",{parentName:"ul"},"Fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"stdout_flush()")," untuk mem-flush output ",(0,t.kt)("strong",{parentName:"li"},"stdout"),". Ini penting karena ",(0,t.kt)("em",{parentName:"li"},"default"),"-nya Rust mem-",(0,t.kt)("em",{parentName:"li"},"buffer")," stdout.")),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="./src/file_utility.rs"',title:'"./src/file_utility.rs"'},"use std::io;\nuse std::io::Write;\n\npub fn read_entry() -> Result<String, String> {\n let mut message = String::new();\n let reader_res = io::stdin().read_line(&mut message);\n\n // error handling using guard method\n let content = match reader_res {\n Ok(_) => message.trim().to_string(),\n Err(err) => {\n return Err(err.to_string())\n }\n };\n\n return Ok(content)\n}\n\npub fn stdout_flush() -> Result<(), String> {\n\n // error handling using basic implementation of keyword match\n match io::stdout().flush() {\n Err(err) => Err(err.to_string()),\n Ok(()) => Ok(())\n }\n}\n")),(0,t.kt)("p",null,"Di kode di atas kita sudah mulai mengimplementasikan operasi ",(0,t.kt)("strong",{parentName:"p"},"error handling")," di Rust, caranya cukup mudah bukan? Tinggal masukan saja data bertipe ",(0,t.kt)("inlineCode",{parentName:"p"},"Result<T, E>")," ke keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"match"),". Untuk penerapan keyword tersebut bisa dilakukan dengan cara konvensional, metode guard, atau lainnya."),(0,t.kt)("h3",{id:"-kontrol-flow-program"},"\u25c9 Kontrol flow program"),(0,t.kt)("p",null,"Lanjut ke bagian kontrol eksekusi alur program. Program didesain berjalan secara kontinyu (non-stop) sampai user memilih command ",(0,t.kt)("inlineCode",{parentName:"p"},"ExitProgram"),". Di setiap perulangan, nantinya user bisa menentukan action apa yang dipilih."),(0,t.kt)("p",null,"Buka file ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),", buat fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"run_program()"),". Fungsi ini mengembalikan tipe data bernotasi ",(0,t.kt)("inlineCode",{parentName:"p"},"Result<(), String>"),". Notasi ini penulis jadikan sebagai notasi utama untuk fungsi-fungsi yang berpotensi mengembalikan error."),(0,t.kt)("p",null,"Di dalam fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"run_program()"),", terdapat perulangan dengan isi beberapa hal berikut secara berurutan."),(0,t.kt)("ol",null,(0,t.kt)("li",{parentName:"ol"},"Memunculkan output pilihan command"),(0,t.kt)("li",{parentName:"ol"},"Flush stdout"),(0,t.kt)("li",{parentName:"ol"},"Baca inputan user"),(0,t.kt)("li",{parentName:"ol"},"Validasi inputan user"),(0,t.kt)("li",{parentName:"ol"},"Eksekusi action/command",(0,t.kt)("ul",{parentName:"li"},(0,t.kt)("li",{parentName:"ul"},"Command ",(0,t.kt)("inlineCode",{parentName:"li"},"PrintFiles"),": munculkan semua file yang sudah dibuat."),(0,t.kt)("li",{parentName:"ul"},"Command ",(0,t.kt)("inlineCode",{parentName:"li"},"CreateFile"),": program meminta inputan nama file dan kontennya, untuk kemudian dibuatkan filenya."),(0,t.kt)("li",{parentName:"ul"},"Command ",(0,t.kt)("inlineCode",{parentName:"li"},"ReadFile"),": baca file sesuai inputan nama file."),(0,t.kt)("li",{parentName:"ul"},"Command ",(0,t.kt)("inlineCode",{parentName:"li"},"DeleteFile"),": operasi hapus file."),(0,t.kt)("li",{parentName:"ul"},"Command ",(0,t.kt)("inlineCode",{parentName:"li"},"ExitProgram"),": keluar program.")))),(0,t.kt)("p",null,"Source code lengkap ",(0,t.kt)("inlineCode",{parentName:"p"},"main.rs"),":"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="./src/main.rs"',title:'"./src/main.rs"'},'mod file_action_constant;\nmod file_manager;\nmod file_utility;\n\nfn run_program() -> Result<(), String> {\n println!("Welcome to file maker app!");\n\n loop {\n println!();\n println!("Available command:");\n println!("1. Print files");\n println!("2. Create file");\n println!("3. Read file");\n println!("4. Delete file");\n println!("9. Exit");\n\n println!();\n print!("Enter your command: ");\n\n // error handling using operator ?\n let _ = file_utility::stdout_flush()?;\n\n // error handling using guard method\n let user_entry = match file_utility::read_entry() {\n Err(err) => {\n println!("ERROR. unable to continue the program. {}", err);\n continue;\n },\n Ok(txt) => txt,\n };\n\n // error handling using basic implementation of keyword match\n let cmd_result = file_action_constant::validate_command(&user_entry);\n match cmd_result {\n Err(err) => {\n println!("ERROR. {}", err);\n continue;\n },\n _ => {}\n };\n let cmd = cmd_result.unwrap();\n\n // check command\n match cmd {\n file_action_constant::Command::PrintFiles => {\n // error handling using operator ?\n file_manager::print_files()?;\n },\n file_action_constant::Command::CreateFile => {\n // error handling using operator ?\n file_manager::create_file()?;\n },\n file_action_constant::Command::ReadFile => {\n // error handling using operator ?\n file_manager::read_file()?;\n },\n file_action_constant::Command::DeleteFile => {\n // error handling using operator ?\n file_manager::delete_file()?;\n },\n file_action_constant::Command::ExitProgram => {\n println!("Exiting program ...");\n return Ok(());\n },\n }\n }\n}\n\nfn main() {\n // error handling using basic implementation of keyword match\n match run_program() {\n Err(err) => panic!("ERRROR {:?}", err),\n Ok(_) => {}\n }\n}\n')),(0,t.kt)("p",null,"Bisa dilihat di kode di atas, ada beberapa metode error handling yang diterapkan."),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Error handling menggunakan metode guard diterapkan saat pembacaan inputan user."),(0,t.kt)("li",{parentName:"ul"},"Error handling menggunakan implementasi standar keyword ",(0,t.kt)("inlineCode",{parentName:"li"},"match")," dan tipe ",(0,t.kt)("inlineCode",{parentName:"li"},"Result")," digunakan saat validasi command."),(0,t.kt)("li",{parentName:"ul"},"Error handling menggunakan operator ",(0,t.kt)("inlineCode",{parentName:"li"},"?")," digunakan saat flush stdout dan eksekusi command.")),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Silakan mengintip kembali chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/operator-tanda-tanya"},"Operator ?")," jika diperlukan untuk mengingat kembali cara kerja operator ",(0,t.kt)("inlineCode",{parentName:"p"},"?"),".")),(0,t.kt)("p",null,"Metode error handling menggunakan operator ",(0,t.kt)("inlineCode",{parentName:"p"},"?")," sengaja diterapkan pada bagian flush stdout dan eksekusi command. Karena di dalam domain tersebut, ketika ada error maka error-nya pasti berhubungan dengan I/O dan permission di level sistim operasi (OS) yang dimana kita tidak bisa menangani error tersebut dari level program yang sedang dibuat. Oleh karena itu operator ",(0,t.kt)("inlineCode",{parentName:"p"},"?")," digunakan. Dengannya, maka error-error tersebut akan membuat eksekusi program terhenti secara total dan error dimunculkan sebelum program terhenti karena oleh panic error."),(0,t.kt)("h3",{id:"-action-commandprintfiles"},"\u25c9 Action ",(0,t.kt)("inlineCode",{parentName:"h3"},"Command::PrintFiles")),(0,t.kt)("p",null,"Action ",(0,t.kt)("inlineCode",{parentName:"p"},"PrintFiles")," melakukan pengecekan pembuatan folder ",(0,t.kt)("inlineCode",{parentName:"p"},"FOLDER_BASEPATH")," (jika belum ada), dan menampilkan list file di dalam folder tersebut. Jika tidak ada file, pesan ",(0,t.kt)("inlineCode",{parentName:"p"},"No files")," dimunculkan ke layar."),(0,t.kt)("p",null,"Tulis kode berikut di file ",(0,t.kt)("inlineCode",{parentName:"p"},"file_manager.rs"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="./src/file_manager.rs"',title:'"./src/file_manager.rs"'},'use crate::file_action_constant;\nuse crate::file_utility;\n\nuse std::path::Path;\nuse std::fs;\n\npub fn print_files() -> Result<(), String> {\n let path = Path::new(file_action_constant::FOLDER_BASEPATH);\n\n // if files folder not exists, create it\n if !path.is_dir() {\n\n // error handling using basic implementation of keyword match\n match fs::create_dir(path) {\n Err(err) => {\n return Err(err.to_string());\n },\n Ok(_) => {},\n }\n }\n\n // error handling using guard method\n let dir = match fs::read_dir(path) {\n Err(err) => {\n return Err(err.to_string());\n },\n Ok(entry) => entry,\n };\n\n let mut count = 0;\n for file in dir {\n count = count + 1;\n\n // error handling using basic implementation of keyword match\n match file {\n Err(err) => {\n return Err(err.to_string());\n },\n Ok(entry) => {\n println!(" -> {:?}", entry.path());\n }\n }\n };\n\n if count == 0 {\n println!("No files");\n }\n\n Ok(())\n}\n\n// ...\n')),(0,t.kt)("p",null,"Dari kode di atas terlihat operasi error propagation dilakukan 3 kali yaitu ketika:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Pembuatan folder ",(0,t.kt)("inlineCode",{parentName:"li"},"FOLDER_BASEPATH")," (ketika folder belum ada)."),(0,t.kt)("li",{parentName:"ul"},"Pembacaan isi folder."),(0,t.kt)("li",{parentName:"ul"},"Menampilkan nama file dalam folder.")),(0,t.kt)("h3",{id:"-action-commandcreatefile"},"\u25c9 Action ",(0,t.kt)("inlineCode",{parentName:"h3"},"Command::CreateFile")),(0,t.kt)("p",null,"Masih di file yang sama (",(0,t.kt)("inlineCode",{parentName:"p"},"file_manager.rs"),") tambahkan kode untuk handle action pembuatan file berikut."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="./src/file_manager.rs"',title:'"./src/file_manager.rs"'},'// ...\n\npub fn create_file() -> Result<(), String> {\n let path = Path::new(file_action_constant::FOLDER_BASEPATH);\n\n print!("Enter filename: ");\n \n // error handling using operator ?\n let _ = file_utility::stdout_flush()?;\n\n // error handling using guard method\n let filename = match file_utility::read_entry() {\n Err(err) => {\n return Err(err.to_string());\n },\n Ok(txt) => txt,\n };\n\n print!("Enter file content: ");\n \n // error handling using operator ?\n let _ = file_utility::stdout_flush()?;\n\n // error handling using guard method\n let content = match file_utility::read_entry() {\n Err(err) => {\n return Err(err.to_string());\n },\n Ok(txt) => txt,\n };\n\n // error handling using basic implementation of keyword match\n match fs::write(path.join(filename), content) {\n Err(err) => {\n return Err(err.to_string());\n },\n Ok(()) => {},\n }\n \n Ok(())\n}\n')),(0,t.kt)("p",null,"Handler ini berisi interaksi I/O dengan user 2 kali:"),(0,t.kt)("ol",null,(0,t.kt)("li",{parentName:"ol"},"Program meminta inputan user untuk dijadikan nama file."),(0,t.kt)("li",{parentName:"ol"},"Program meminta lagi inputan untuk isi konten file.")),(0,t.kt)("p",null,"Perihal error handler-nya sendiri juga ada beberapa:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Karena terdapat operasi I/O, maka flush stdout perlu dipanggil. Dalam pemanggilannya, metode error handler menggunakan operator ",(0,t.kt)("inlineCode",{parentName:"li"},"?")," dipakai.",(0,t.kt)("pre",{parentName:"li"},(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"let _ = file_utility::stdout_flush()?;\n"))),(0,t.kt)("li",{parentName:"ul"},"Ketika baca inputan user untuk nama file dan konten file",(0,t.kt)("pre",{parentName:"li"},(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"let filename = match file_utility::read_entry() { ... };\nlet content = match file_utility::read_entry() { ... };\n"))),(0,t.kt)("li",{parentName:"ul"},"Ketika file dibuat (operasi write file)",(0,t.kt)("pre",{parentName:"li"},(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"match fs::write(path.join(filename), content) { ... }\n")))),(0,t.kt)("h3",{id:"-action-commandreadfile"},"\u25c9 Action ",(0,t.kt)("inlineCode",{parentName:"h3"},"Command::ReadFile")),(0,t.kt)("p",null,"Operasi baca file dilakukan dengan melibatkan I/O dengan user. User dimintai inputan nama file, kemudian file tersebut ditampilkan isinya. Jika ada error saat baca file (yang besar kemungkinan disebabkan oleh file yang dicari tidak ditemukan), pesan errornya kemudian dimunculkan."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="./src/file_manager.rs"',title:'"./src/file_manager.rs"'},'// ...\n\npub fn read_file() -> Result<(), String> {\n let path = Path::new(file_action_constant::FOLDER_BASEPATH);\n\n print!("Enter filename: ");\n \n // error handling using operator ?\n let _ = file_utility::stdout_flush()?;\n\n // error handling using guard method\n let filename = match file_utility::read_entry() {\n Err(err) => {\n return Err(err.to_string());\n },\n Ok(txt) => txt,\n };\n\n // error handling using guard method\n let content = match fs::read_to_string(path.join(filename)) {\n Err(err) => {\n println!("ERROR. {:?}", err.to_string());\n return Ok(());\n },\n Ok(txt) => txt,\n };\n\n println!("File content: {:?}", content);\n\n Ok(())\n}\n')),(0,t.kt)("p",null,"Bisa dilihat pada statement baca file, ketika terjadi error, ",(0,t.kt)("inlineCode",{parentName:"p"},"Err()")," tidak dikembalikan, melainkan menggunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"Ok()"),". Ini penting karena jika ",(0,t.kt)("inlineCode",{parentName:"p"},"Err()")," digunakan di situ, membuat eksekusi fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"run_program()")," terhenti secara paksa karena fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"read_file()")," (dan fungsi handler command lainnya) dipanggil dengan disertai operator ",(0,t.kt)("inlineCode",{parentName:"p"},"?"),"."),(0,t.kt)("p",null,"Yang kita lakukan disini adalah memunculkan pesan errornya ke layar secara ",(0,t.kt)("em",{parentName:"p"},"friendly"),", agar program tetap bisa running sesuai flow."),(0,t.kt)("h3",{id:"-action-commanddeletefile"},"\u25c9 Action ",(0,t.kt)("inlineCode",{parentName:"h3"},"Command::DeleteFile")),(0,t.kt)("p",null,"Operasi baca file juga melibatkan 1 kali interaksi I/O dengan user. File yang namanya di-input oleh user akan dihapus."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="./src/file_manager.rs"',title:'"./src/file_manager.rs"'},'// ...\n\npub fn delete_file() -> Result<(), String> {\n let path = Path::new(file_action_constant::FOLDER_BASEPATH);\n\n print!("Enter filename: ");\n \n // error handling using operator ?\n let _ = file_utility::stdout_flush()?;\n\n // error handling using guard method\n let filename = match file_utility::read_entry() {\n Err(err) => {\n return Err(err.to_string());\n },\n Ok(txt) => txt,\n };\n\n // error handling using basic implementation of keyword match\n match fs::remove_file(path.join(filename)) {\n Err(err) => {\n println!("ERROR. {:?}", err.to_string());\n return Ok(());\n },\n Ok(_) => {\n println!("File deleted");\n },\n };\n\n Ok(())\n}\n')),(0,t.kt)("p",null,"Error yang berpotensi muncul saat penghapusan file dimunculkan ke layar tanpa menandai pemanggilan fungsi sebagai error, agar flow program tetap berjalan."),(0,t.kt)("h3",{id:"-action-commandexitprogram"},"\u25c9 Action ",(0,t.kt)("inlineCode",{parentName:"h3"},"Command::ExitProgram")),(0,t.kt)("p",null,"Handler command exit program sudah ditulis di blok fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"run_program()"),"."),(0,t.kt)("h2",{id:"a552-test-program"},"A.55.2. Test program"),(0,t.kt)("p",null,"Ok, bagian tulis menulis kode sudah selesai. Lanjut ke fase testing. Jalankan program, pilih beberapa command, test keseluruhan fungsinya."),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Testing pertama, munculkan files menggunakan command ",(0,t.kt)("inlineCode",{parentName:"p"},"1 Print files"),"."),(0,t.kt)("p",{parentName:"li"}," ",(0,t.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Recoverable Error & Error Handling",src:n(7201).Z,width:"637",height:"291"}))),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Testing ke-2, buat file baru, cek keberadaan filenya, lalu munculkan isinya."),(0,t.kt)("p",{parentName:"li"}," ",(0,t.kt)("img",{loading:"lazy",alt:"Recoverable Error & Error Handling",src:n(6993).Z,width:"637",height:"673"}))),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Testing ke-3, hapus file yang telah dibuat, lalu cek lagi file yang ada."),(0,t.kt)("p",{parentName:"li"}," ",(0,t.kt)("img",{loading:"lazy",alt:"Recoverable Error & Error Handling",src:n(8669).Z,width:"637",height:"243"}))),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("p",{parentName:"li"},"Testing ke-4, exit program."),(0,t.kt)("p",{parentName:"li"}," ",(0,t.kt)("img",{loading:"lazy",alt:"Recoverable Error & Error Handling",src:n(3610).Z,width:"637",height:"181"})))),(0,t.kt)("p",null,"Hasilnya, mantab."),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/recoverable_error_handling"},"github.com/novalagung/dasarpemrogramanrust-example/../recoverable_error_handling")),(0,t.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/module-basic"},"Module System \u279c Module")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/result-type"},"Tipe Data \u279c Result")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/operator-tanda-tanya"},"Operator ?")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/pattern-matching"},"Pattern Matching")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/file-path-directory"},"File, Path, Directory")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/unrecoverable-panic-error"},"Error \u279c Unrecoverable Error / Panic"))),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-with-panic.html"},"https://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-with-panic.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch09-03-to-panic-or-not-to-panic.html"},"https://doc.rust-lang.org/book/ch09-03-to-panic-or-not-to-panic.html"))))}p.isMDXComponent=!0},7201:(e,a,n)=>{n.d(a,{Z:()=>r});const r=n.p+"assets/images/recoverable-error-handling-1-a60b09beaa6803045688abcf2a1f4762.png"},6993:(e,a,n)=>{n.d(a,{Z:()=>r});const r=n.p+"assets/images/recoverable-error-handling-2-4bb5c6b2c2f3dcc0eb5029fb2ab09519.png"},8669:(e,a,n)=>{n.d(a,{Z:()=>r});const r=n.p+"assets/images/recoverable-error-handling-3-9ac2af92e26692ae7be26b9c2a06ed71.png"},3610:(e,a,n)=>{n.d(a,{Z:()=>r});const r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAn0AAAC1CAIAAAClNd5qAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGlmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvb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z2+obTgiaSrapFXzJ9uXoHwMSMFy5JM3Z+8Ka5oI1fiUPDmInLhyu9nPrhQe2LLK/feb5p9kI68mifP8p9m7zf3HgAwnUX4/q4WPZTU27Dh1NCkxhWYFoubtGKLSPWD6ZmL4vrbftMcYlstOld8cu9T8it90+yDdOTVXIxKswcARLsIv0e059X987ve604wnzmSEdkru43NaP6/347NXmRWVfWNg6uHOk6FHknkW1zd3CVZxtPs/+6+UDuKGSk4cmD10Piyuc9SOQAALpGsu9pt3fePvl7xWtuc1B1Fa4NNph1/6n9gyTod7+kmppWlJTvO5mo1TgnxmeqYkYIXspLc81QvftPsP3g0vI5CSbMPIjGt7C3V+93l0A8CAKJCxHLvX+7JsmYnXVVzagZFWspauhoy9/3bP39Q5X7KV8Ssqmb3s8raivSLdaqIDDsaNu781PfMjTs/9e33WktZS1fDc+NZ9DLRG03LXSHzwU5zxvpJsxexh9iRM9YWYpo9AGCai748osS0sqqDCXW5u7XnthLTyqoOLm0L+B5RsXyYU6TrZnPoHQEAEKLo259Zu/nqlpaZMle+++qjyNdCwzoCAEwf0fc6aecbe5pWei7/unbDiN6OAADTR/StMwMAEL2ib50ZAIDoRd0FAMA41F0AAIxD3QUAwDjUXQAAjEPdBQDAONRdAACMQ90FAMA41F0AAIxD3QUAwDjUXQAAjEPdBQDAONRdAACMQ90FAMA41F0AAIxD3QUAwDj/Hyq8QZdzlMinAAAAAElFTkSuQmCC"}}]); \ No newline at end of file diff --git a/assets/js/a2bea3ed.0e7c2791.js b/assets/js/a2bea3ed.0e7c2791.js deleted file mode 100644 index 7bedd982..00000000 --- a/assets/js/a2bea3ed.0e7c2791.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[6345],{3905:(a,e,t)=>{t.d(e,{Zo:()=>o,kt:()=>u});var n=t(7294);function i(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function r(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),t.push.apply(t,n)}return t}function l(a){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?r(Object(t),!0).forEach((function(e){i(a,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(t,e))}))}return a}function s(a,e){if(null==a)return{};var t,n,i=function(a,e){if(null==a)return{};var t,n,i={},r=Object.keys(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||(i[t]=a[t]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(a,t)&&(i[t]=a[t])}return i}var p=n.createContext({}),d=function(a){var e=n.useContext(p),t=e;return a&&(t="function"==typeof a?a(e):l(l({},e),a)),t},o=function(a){var e=d(a.components);return n.createElement(p.Provider,{value:e},a.children)},m={inlineCode:"code",wrapper:function(a){var e=a.children;return n.createElement(n.Fragment,{},e)}},k=n.forwardRef((function(a,e){var t=a.components,i=a.mdxType,r=a.originalType,p=a.parentName,o=s(a,["components","mdxType","originalType","parentName"]),k=d(t),u=i,g=k["".concat(p,".").concat(u)]||k[u]||m[u]||r;return t?n.createElement(g,l(l({ref:e},o),{},{components:t})):n.createElement(g,l({ref:e},o))}));function u(a,e){var t=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=t.length,l=new Array(r);l[0]=k;var s={};for(var p in e)hasOwnProperty.call(e,p)&&(s[p]=e[p]);s.originalType=a,s.mdxType="string"==typeof a?a:i,l[1]=s;for(var d=2;d<r;d++)l[d]=t[d];return n.createElement.apply(null,l)}return n.createElement.apply(null,t)}k.displayName="MDXCreateElement"},1099:(a,e,t)=>{t.r(e),t.d(e,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>r,metadata:()=>s,toc:()=>d});var n=t(7462),i=(t(7294),t(3905));const r={sidebar_position:46,title:"A.46. String Literal (&str) vs. String Custom Type",sidebar_label:"A.46. String Literal (&str) vs. String Custom Type"},l=void 0,s={unversionedId:"basic/string-slice-vs-string-literal",id:"basic/string-slice-vs-string-literal",title:"A.46. String Literal (&str) vs. String Custom Type",description:"Pada chapter sebelumnya kita telah membahas tentang bagaimana data slice di-manage di memory. Ada beberapa tipe data yang masuk dalam kategori slice, yang salah satunya adalah string slice atau String.",source:"@site/docs/basic/string-slice-vs-string-literal.md",sourceDirName:"basic",slug:"/basic/string-slice-vs-string-literal",permalink:"/basic/string-slice-vs-string-literal",draft:!1,tags:[],version:"current",sidebarPosition:46,frontMatter:{sidebar_position:46,title:"A.46. String Literal (&str) vs. String Custom Type",sidebar_label:"A.46. String Literal (&str) vs. String Custom Type"},sidebar:"tutorialSidebar",previous:{title:"A.45. Slice Memory Management",permalink:"/basic/slice-memory-management"},next:{title:"A.47. Tipe Data \u279c String Custom Type",permalink:"/basic/tipe-data-custom-type-string-slice"}},p={},d=[{value:"A.46.1. String slice (<code>String</code>)",id:"a461-string-slice-string",level:2},{value:"A.46.2. String literal (<code>&str</code>)",id:"a462-string-literal-str",level:2},{value:"A.46.3. Konversi data string",id:"a463-konversi-data-string",level:2},{value:"\u25c9 Konversi <code>String</code> ke <code>&str</code>",id:"-konversi-string-ke-str",level:3},{value:"\u25c9 Konversi <code>&str</code> ke <code>String</code>",id:"-konversi-str-ke-string",level:3},{value:"A.46.4. String literal & string slice",id:"a464-string-literal--string-slice",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],o={toc:d};function m(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,n.Z)({},o,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter sebelumnya kita telah membahas tentang bagaimana data slice di-manage di memory. Ada beberapa tipe data yang masuk dalam kategori slice, yang salah satunya adalah string slice atau ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,i.kt)("p",null,"Di chapter ini kita akan bahas apa perbedaan antara tipe data string slice (",(0,i.kt)("inlineCode",{parentName:"p"},"String"),") dan string literal ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),"."),(0,i.kt)("p",null,"Pembahasan mengenai topik ini sengaja dilakukan tidak di awal-awal ebook, karena ada banyak hal yang perlu dipahami sebelum mempelajarinya, contohnya seperti aspek management memory dan ownership. Dan karena topik tersebut sudah selesai dibahas, berarti ini adalah waktu yang tepat untuk membahas string slice."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Silakan pelajari kembali pembahasan detail tentang tipe slice pada chapter sebelumnya jika diperlukan. Chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/slice-memory-management"},"Slice Memory Management"))),(0,i.kt)("h2",{id:"a461-string-slice-string"},"A.46.1. String slice (",(0,i.kt)("inlineCode",{parentName:"h2"},"String"),")"),(0,i.kt)("p",null,"String slice atau custom type ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," merupakan tipe data bawaan Rust, dibuat via ",(0,i.kt)("inlineCode",{parentName:"p"},"struct"),", kegunaannya untuk menampung data UTF-8 bytes yang dinamis (bisa berkembang isinya)."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"String")," masuk dalam kategori tipe data slice, isinya adalah data kolektif bertipe bytes, datanya disimpan di heap memory, dan metadata-nya di stack memory. Tipe data ini dikategorikan sebagai tipe data ",(0,i.kt)("strong",{parentName:"p"},"owned"),", yang artinya owner data bisa direpresentasikan oleh variabel. Sebagai contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let str1 = String::from("Lisa Blackpink");\nprintln!("str1: {str1}");\n')),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"str1")," di atas merupakan owner dari string ",(0,i.kt)("inlineCode",{parentName:"p"},"Lisa Blackpink"),". Dari string tersebut operasi borrow bisa dilakukan. Contohnya bisa dilihat pada kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let str1 = String::from("Lisa Blackpink");\nlet slice1 = &str1[..]; // "Lisa Blackpink"\nlet slice2 = &str1[4..7]; // " Bl"\n')),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"slice1")," adalah variabel baru yang datanya didapat dari borrowing seluruh elemen string milik ",(0,i.kt)("inlineCode",{parentName:"p"},"str1"),". Sedangkan variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"slice2")," hanya meminjam elemen indeks ke-4 hingga elemen sebelum 7 (yaitu 6)."),(0,i.kt)("p",null,"Karena ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," sebenarnya adalah UTF-8 bytes, maka kita bisa juga membuatnya menggunakan data Bytes. Tipe bytes (atau kadang disebut ",(0,i.kt)("em",{parentName:"p"},"chars"),") di Rust direpresentasikan oleh tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"[u8]"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let bytes = vec![69, 108, 117, 118, 101, 105, 116, 105, 101, 32, 243, 159, 164, 152];\nlet str2 = String::from_utf8(bytes).unwrap();\nprintln!("str2: {}", str2);\n')),(0,i.kt)("p",null,"Pada contoh di atas, data bytes dipersiapkan dalam bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<u8>"),". Data tersebut kemudian digunakan untuk membuat string menggunakan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"String::from_utf8()"),". Nilai balik fungsi tersebut adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<String, FromUtf8Error>"),". Pemanggilan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap")," di situ agar data ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"-nya di-return."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"String slcie vs string literal",src:t(108).Z,width:"458",height:"108"})),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Kita akan bahas tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," pada chapter terpisah, ",(0,i.kt)("a",{parentName:"p",href:"/basic/result-type"},"Tipe Data \u279c Result"))),(0,i.kt)("h2",{id:"a462-string-literal-str"},"A.46.2. String literal (",(0,i.kt)("inlineCode",{parentName:"h2"},"&str"),")"),(0,i.kt)("p",null,"Tipe data string literal atau ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," adalah tipe yang menampung data kolektif UTF-8 bytes (seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),") tetapi ",(0,i.kt)("strong",{parentName:"p"},"immutable")," dan disimpannya tidak di heap dan tidak juga di stack, melainkan di static storage."),(0,i.kt)("p",null,"String literal hanya bisa direpresentasikan dalam bentuk reference ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," (pointer yang mengarah ke suatu bytes)."),(0,i.kt)("p",null,"Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," termasuk kategori tipe data yang ",(0,i.kt)("strong",{parentName:"p"},"unowned")," atau reference tanpa owner (atau boleh juga diartikan sebagai tipe data yang owner-nya adalah program)."),(0,i.kt)("p",null,"Rust menjamin data string literal selalu valid. Kita juga bisa menentukan lifetime-nya secara eksplist jike diperlukan, contohnya pada tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&'static str"),"."),(0,i.kt)("p",null,"Cara termudah membuat ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," adalah menggunakan string literal."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let str3 = "Helena Iren Michaelsen Epica";\nprintln!("str3: {str3}");\n')),(0,i.kt)("h2",{id:"a463-konversi-data-string"},"A.46.3. Konversi data string"),(0,i.kt)("h3",{id:"-konversi-string-ke-str"},"\u25c9 Konversi ",(0,i.kt)("inlineCode",{parentName:"h3"},"String")," ke ",(0,i.kt)("inlineCode",{parentName:"h3"},"&str")),(0,i.kt)("p",null,"Data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," juga didapat melalui operasi borrow dari data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),", caranya dengan menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_str"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let str4: String = String::from("Hiroyuki Sawano");\nlet str4_slice1: &str = str4.as_str();\nprintln!("str4: {str4}"); // str4: Hiroyuki Sawano\nprintln!("str4_slice1: {str4_slice1}"); // str4_slice1: Hiroyuki Sawano\n')),(0,i.kt)("p",null,"Bisa juga menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_mut_str")," untuk mutable borrow. Namun dalam penggunaannya, owner data diwajibkan mutable. Contohnya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut str5: String = String::from("Hans Zimmer");\nlet str5_slice1: &mut str = str5.as_mut_str();\nprintln!("str5: {str5}");\nprintln!("str5_slice1: {str5_slice1}");\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"String slcie vs string literal",src:t(6484).Z,width:"650",height:"237"})),(0,i.kt)("p",null,"Hmm, error. Perlu diingat kembali aturan ",(0,i.kt)("a",{parentName:"p",href:"/basic/borrowing"},"Borrowing")," bahwa tidak boleh ada operasi borrow dan juga mutable borrow dalam satu waktu. Pada contoh di atas, ",(0,i.kt)("inlineCode",{parentName:"p"},"str5")," dipinjam oleh ",(0,i.kt)("inlineCode",{parentName:"p"},"str5_slice1")," menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_mut_str")," (yang di dalamnya menjalankan operasi mutable borrow). Selain itu, operasi mutable borrow maksimal hanya boleh dilakukan 1x dalam satu waktu, inilah kenapa ketika kita berusaha menampilkan data ",(0,i.kt)("inlineCode",{parentName:"p"},"str5")," hasilnya error, karena statement print data ",(0,i.kt)("inlineCode",{parentName:"p"},"str5")," adalah operasi borrow."),(0,i.kt)("p",null,"Solusinya masalah di atas bisa menggunakan block expression:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut str5: String = String::from("Hans Zimmer");\n{\n let str5_slice1: &mut str = str5.as_mut_str();\n println!("str5_slice1: {str5_slice1}"); // str5_slice1: Hans Zimmer\n}\nprintln!("str5: {}", str5); // str5_slice1: Hans Zimmer\n')),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," bisa diakses mutable reference-nya karena memang tipe tersebut size-nya adalah dinamis."),(0,i.kt)("h3",{id:"-konversi-str-ke-string"},"\u25c9 Konversi ",(0,i.kt)("inlineCode",{parentName:"h3"},"&str")," ke ",(0,i.kt)("inlineCode",{parentName:"h3"},"String")),(0,i.kt)("p",null,"Masih dalam topik konversi tipe data string. Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," memiliki method bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"to_string")," yang gunanya adalah untuk konversi data ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," ke ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let str6: &str = "John Towner Williams";\nlet str6_slice1: String = str6.to_string();\nprintln!("str6: {str6}"); // str6: John Towner Williams\nprintln!("str6_slice1: {str6_slice1}"); // str6_slice1: John Towner Williams\n')),(0,i.kt)("p",null,"Konversi pada tipe data ini sedikit berbeda dibandingkan konversi ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," ke ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),". Pada contoh di atas, yang terjadi adalah data ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," di-copy sebagai data baru bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," yang kemudian ditampung variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"str6_slice1")," (yang juga berperan sebagai owner untuk data baru tersebut)."),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"to_string")," melakukan operasi copy, bukan borrow. Artinya setelah dipanggil akan ada 2 data yang reference-nya sudah berbeda."),(0,i.kt)("h2",{id:"a464-string-literal--string-slice"},"A.46.4. String literal & string slice"),(0,i.kt)("p",null,"Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," memiliki hubungan dekat dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),". Data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," reference-nya bisa diakses dalam bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"&String"),", maupun dalam bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," (menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_str")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"as_mut_str"),"). Data text pada string tersebut bisa dimodifikasi, ditambahi, dan juga dikurangi."),(0,i.kt)("p",null,"Berbeda dengan data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," ",(0,i.kt)("strong",{parentName:"p"},"(di paragraph ini dan setelahnya yang kita bahas adalah data yang dari awal tipe-nya sudah ",(0,i.kt)("inlineCode",{parentName:"strong"},"&str"),", bukan data hasil operasi pinjam dari ",(0,i.kt)("inlineCode",{parentName:"strong"},"String"),")"),", data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," adalah fixed dan immutable. Konversi data ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," ke ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," menghasilkan data baru dengan owner baru. Bisa dibilang sangat terbatas apa yang bisa kita lakukan pada tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),"."),(0,i.kt)("p",null,"Meski demikian, tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," lebih cepat performa-nya dibanding ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," karena disimpan di static storage. Selain itu dijamin valid oleh Rust. Kekurangannya hanya pada ownership-nya. Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," adalah ",(0,i.kt)("strong",{parentName:"p"},"unowned"),", operasi mutability tidak bisa dilakukan pada tipe ini."),(0,i.kt)("p",null,"Dalam case normal, sangat dianjurkan untuk menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),", kecuali memang yang dibutuhkan adalah ",(0,i.kt)("strong",{parentName:"p"},"owned")," string."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/string_slice_vs_string_literal"},"github.com/novalagung/dasarpemrogramanrust-example/../string_slice_vs_string_literal")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/tipe-data-string-literal"},"Tipe Data \u279c String Literal (&str)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/slice-memory-management"},"Slice Memory Management")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/tipe-data-custom-type-string-slice"},"Tipe Data \u279c String Custom Type"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch08-02-strings.html"},"https://doc.rust-lang.org/book/ch08-02-strings.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://users.rust-lang.org/t/str-string-literals/29635"},"https://users.rust-lang.org/t/str-string-literals/29635")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://www.quora.com/Why-does-Rust-have-two-different-string-types-static-str-and-String"},"https://www.quora.com/Why-does-Rust-have-two-different-string-types-static-str-and-String")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/24158114/what-are-the-differences-between-rusts-string-and-str"},"https://stackoverflow.com/questions/24158114/what-are-the-differences-between-rusts-string-and-str")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/30154541/how-do-i-concatenate-strings"},"https://stackoverflow.com/questions/30154541/how-do-i-concatenate-strings"))))}m.isMDXComponent=!0},108:(a,e,t)=>{t.d(e,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcoAAABsCAIAAABlzGXMAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS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fq+bN3nz33XU2lXMmTWiRVlp5LsPffeLXj1r/f7f7eObNfvbn7lkOTIPabXv11b3SvHFFhEDt1mdZKr+LXYikeHAco2dQPjOo1j+cJmqmllHmm8ekff+jGW9t/7793h+OSIA7KeyVGxs5F/e9nZwG3vvjoPi1DEKRXYgT8/lev//tvxZGs3X+5o0UQpFeCIAiC9EoQBEF6JQiCIL0SBEEQpFeCIAjSK0EQBOmVIAiCIL0SBEGQXgmCIPYA/wcGv+k9gijq8gAAAABJRU5ErkJggg=="},6484:(a,e,t)=>{t.d(e,{Z:()=>n});const n=t.p+"assets/images/string-slice-vs-string-literal-2-1b0caccba69a37db29f101f921a76df1.png"}}]); \ No newline at end of file diff --git a/assets/js/a2bea3ed.7b70d96c.js b/assets/js/a2bea3ed.7b70d96c.js new file mode 100644 index 00000000..2f815c6c --- /dev/null +++ b/assets/js/a2bea3ed.7b70d96c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[6345],{3905:(a,e,t)=>{t.d(e,{Zo:()=>o,kt:()=>u});var n=t(7294);function i(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function r(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),t.push.apply(t,n)}return t}function l(a){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?r(Object(t),!0).forEach((function(e){i(a,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(t,e))}))}return a}function s(a,e){if(null==a)return{};var t,n,i=function(a,e){if(null==a)return{};var t,n,i={},r=Object.keys(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||(i[t]=a[t]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(a,t)&&(i[t]=a[t])}return i}var p=n.createContext({}),d=function(a){var e=n.useContext(p),t=e;return a&&(t="function"==typeof a?a(e):l(l({},e),a)),t},o=function(a){var e=d(a.components);return n.createElement(p.Provider,{value:e},a.children)},m={inlineCode:"code",wrapper:function(a){var e=a.children;return n.createElement(n.Fragment,{},e)}},k=n.forwardRef((function(a,e){var t=a.components,i=a.mdxType,r=a.originalType,p=a.parentName,o=s(a,["components","mdxType","originalType","parentName"]),k=d(t),u=i,g=k["".concat(p,".").concat(u)]||k[u]||m[u]||r;return t?n.createElement(g,l(l({ref:e},o),{},{components:t})):n.createElement(g,l({ref:e},o))}));function u(a,e){var t=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=t.length,l=new Array(r);l[0]=k;var s={};for(var p in e)hasOwnProperty.call(e,p)&&(s[p]=e[p]);s.originalType=a,s.mdxType="string"==typeof a?a:i,l[1]=s;for(var d=2;d<r;d++)l[d]=t[d];return n.createElement.apply(null,l)}return n.createElement.apply(null,t)}k.displayName="MDXCreateElement"},1099:(a,e,t)=>{t.r(e),t.d(e,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>r,metadata:()=>s,toc:()=>d});var n=t(7462),i=(t(7294),t(3905));const r={sidebar_position:46,title:"A.46. String Literal (&str) vs. String Custom Type",sidebar_label:"A.46. String Literal (&str) vs. String Custom Type"},l=void 0,s={unversionedId:"basic/string-slice-vs-string-literal",id:"basic/string-slice-vs-string-literal",title:"A.46. String Literal (&str) vs. String Custom Type",description:"Pada chapter sebelumnya kita telah membahas tentang bagaimana data slice di-manage di memory. Ada beberapa tipe data yang masuk dalam kategori slice, yang salah satunya adalah string slice atau String.",source:"@site/docs/basic/string-slice-vs-string-literal.md",sourceDirName:"basic",slug:"/basic/string-slice-vs-string-literal",permalink:"/basic/string-slice-vs-string-literal",draft:!1,tags:[],version:"current",sidebarPosition:46,frontMatter:{sidebar_position:46,title:"A.46. String Literal (&str) vs. String Custom Type",sidebar_label:"A.46. String Literal (&str) vs. String Custom Type"},sidebar:"tutorialSidebar",previous:{title:"A.45. Slice Memory Management",permalink:"/basic/slice-memory-management"},next:{title:"A.47. Tipe Data \u279c String Custom Type",permalink:"/basic/tipe-data-custom-type-string-slice"}},p={},d=[{value:"A.46.1. String slice (<code>String</code>)",id:"a461-string-slice-string",level:2},{value:"A.46.2. String literal (<code>&str</code>)",id:"a462-string-literal-str",level:2},{value:"A.46.3. Konversi data string",id:"a463-konversi-data-string",level:2},{value:"\u25c9 Konversi <code>String</code> ke <code>&str</code>",id:"-konversi-string-ke-str",level:3},{value:"\u25c9 Konversi <code>&str</code> ke <code>String</code>",id:"-konversi-str-ke-string",level:3},{value:"A.46.4. String literal & string slice",id:"a464-string-literal--string-slice",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],o={toc:d};function m(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,n.Z)({},o,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter sebelumnya kita telah membahas tentang bagaimana data slice di-manage di memory. Ada beberapa tipe data yang masuk dalam kategori slice, yang salah satunya adalah string slice atau ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,i.kt)("p",null,"Di chapter ini kita akan bahas apa perbedaan antara tipe data string slice (",(0,i.kt)("inlineCode",{parentName:"p"},"String"),") dan string literal ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),"."),(0,i.kt)("p",null,"Pembahasan mengenai topik ini sengaja dilakukan tidak di awal-awal ebook, karena ada banyak hal yang perlu dipahami sebelum mempelajarinya, contohnya seperti aspek management memory dan ownership. Dan karena topik tersebut sudah selesai dibahas, berarti ini adalah waktu yang tepat untuk membahas string slice."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Silakan pelajari kembali pembahasan detail tentang tipe slice pada chapter sebelumnya jika diperlukan. Chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/slice-memory-management"},"Slice Memory Management"))),(0,i.kt)("h2",{id:"a461-string-slice-string"},"A.46.1. String slice (",(0,i.kt)("inlineCode",{parentName:"h2"},"String"),")"),(0,i.kt)("p",null,"String slice atau custom type ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," merupakan tipe data bawaan Rust, dibuat via ",(0,i.kt)("inlineCode",{parentName:"p"},"struct"),", kegunaannya untuk menampung data UTF-8 bytes yang dinamis (bisa berkembang isinya)."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"String")," masuk dalam kategori tipe data slice, isinya adalah data kolektif bertipe bytes, datanya disimpan di heap memory, dan metadata-nya di stack memory. Tipe data ini dikategorikan sebagai tipe data ",(0,i.kt)("strong",{parentName:"p"},"owned"),", yang artinya owner data bisa direpresentasikan oleh variabel. Sebagai contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let str1 = String::from("Lisa Blackpink");\nprintln!("str1: {str1}");\n')),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"str1")," di atas merupakan owner dari string ",(0,i.kt)("inlineCode",{parentName:"p"},"Lisa Blackpink"),". Dari string tersebut operasi borrow bisa dilakukan. Contohnya bisa dilihat pada kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let str1 = String::from("Lisa Blackpink");\nlet slice1 = &str1[..]; // "Lisa Blackpink"\nlet slice2 = &str1[4..7]; // " Bl"\n')),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"slice1")," adalah variabel baru yang datanya didapat dari borrowing seluruh elemen string milik ",(0,i.kt)("inlineCode",{parentName:"p"},"str1"),". Sedangkan variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"slice2")," hanya meminjam elemen indeks ke-4 hingga elemen sebelum 7 (yaitu 6)."),(0,i.kt)("p",null,"Karena ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," sebenarnya adalah UTF-8 bytes, maka kita bisa juga membuatnya menggunakan data Bytes. Tipe bytes (atau kadang disebut ",(0,i.kt)("em",{parentName:"p"},"chars"),") di Rust direpresentasikan oleh tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"[u8]"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let bytes = vec![69, 108, 117, 118, 101, 105, 116, 105, 101, 32, 243, 159, 164, 152];\nlet str2 = String::from_utf8(bytes).unwrap();\nprintln!("str2: {}", str2);\n')),(0,i.kt)("p",null,"Pada contoh di atas, data bytes dipersiapkan dalam bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<u8>"),". Data tersebut kemudian digunakan untuk membuat string menggunakan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"String::from_utf8()"),". Nilai balik fungsi tersebut adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<String, FromUtf8Error>"),". Pemanggilan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap")," di situ agar data ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"-nya di-return."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"String slcie vs string literal",src:t(108).Z,width:"458",height:"108"})),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Kita akan bahas tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," pada chapter terpisah, ",(0,i.kt)("a",{parentName:"p",href:"/basic/result-type"},"Tipe Data \u279c Result"))),(0,i.kt)("h2",{id:"a462-string-literal-str"},"A.46.2. String literal (",(0,i.kt)("inlineCode",{parentName:"h2"},"&str"),")"),(0,i.kt)("p",null,"Tipe data string literal atau ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," adalah tipe yang menampung data kolektif UTF-8 bytes (seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),") tetapi ",(0,i.kt)("strong",{parentName:"p"},"immutable")," dan disimpannya tidak di heap dan tidak juga di stack, melainkan di static storage."),(0,i.kt)("p",null,"String literal hanya bisa direpresentasikan dalam bentuk reference ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," (pointer yang mengarah ke suatu bytes)."),(0,i.kt)("p",null,"Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," termasuk kategori tipe data yang ",(0,i.kt)("strong",{parentName:"p"},"unowned")," atau reference tanpa owner (atau boleh juga diartikan sebagai tipe data yang owner-nya adalah program)."),(0,i.kt)("p",null,"Rust menjamin data string literal selalu valid. Kita juga bisa menentukan lifetime-nya secara eksplist jike diperlukan, contohnya pada tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&'static str"),"."),(0,i.kt)("p",null,"Cara termudah membuat ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," adalah menggunakan string literal."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let str3 = "Helena Iren Michaelsen Epica";\nprintln!("str3: {str3}");\n')),(0,i.kt)("h2",{id:"a463-konversi-data-string"},"A.46.3. Konversi data string"),(0,i.kt)("h3",{id:"-konversi-string-ke-str"},"\u25c9 Konversi ",(0,i.kt)("inlineCode",{parentName:"h3"},"String")," ke ",(0,i.kt)("inlineCode",{parentName:"h3"},"&str")),(0,i.kt)("p",null,"Data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," juga didapat melalui operasi borrow dari data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),", caranya dengan menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_str"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let str4: String = String::from("Hiroyuki Sawano");\nlet str4_slice1: &str = str4.as_str();\nprintln!("str4: {str4}"); // str4: Hiroyuki Sawano\nprintln!("str4_slice1: {str4_slice1}"); // str4_slice1: Hiroyuki Sawano\n')),(0,i.kt)("p",null,"Bisa juga menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_mut_str")," untuk mutable borrow. Namun dalam penggunaannya, owner data diwajibkan mutable. Contohnya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut str5: String = String::from("Hans Zimmer");\nlet str5_slice1: &mut str = str5.as_mut_str();\nprintln!("str5: {str5}");\nprintln!("str5_slice1: {str5_slice1}");\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"String slcie vs string literal",src:t(6484).Z,width:"650",height:"237"})),(0,i.kt)("p",null,"Hmm, error. Perlu diingat kembali aturan ",(0,i.kt)("a",{parentName:"p",href:"/basic/borrowing"},"Borrowing")," bahwa tidak boleh ada operasi borrow dan juga mutable borrow dalam satu waktu. Pada contoh di atas, ",(0,i.kt)("inlineCode",{parentName:"p"},"str5")," dipinjam oleh ",(0,i.kt)("inlineCode",{parentName:"p"},"str5_slice1")," menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_mut_str")," (yang di dalamnya menjalankan operasi mutable borrow). Selain itu, operasi mutable borrow maksimal hanya boleh dilakukan 1x dalam satu waktu, inilah kenapa ketika kita berusaha menampilkan data ",(0,i.kt)("inlineCode",{parentName:"p"},"str5")," hasilnya error, karena statement print data ",(0,i.kt)("inlineCode",{parentName:"p"},"str5")," adalah operasi borrow."),(0,i.kt)("p",null,"Solusinya masalah di atas bisa menggunakan block expression:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut str5: String = String::from("Hans Zimmer");\n{\n let str5_slice1: &mut str = str5.as_mut_str();\n println!("str5_slice1: {str5_slice1}"); // str5_slice1: Hans Zimmer\n}\nprintln!("str5: {}", str5); // str5_slice1: Hans Zimmer\n')),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," bisa diakses mutable reference-nya karena memang tipe tersebut size-nya adalah dinamis."),(0,i.kt)("h3",{id:"-konversi-str-ke-string"},"\u25c9 Konversi ",(0,i.kt)("inlineCode",{parentName:"h3"},"&str")," ke ",(0,i.kt)("inlineCode",{parentName:"h3"},"String")),(0,i.kt)("p",null,"Masih dalam topik konversi tipe data string. Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," memiliki method bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"to_string")," yang gunanya adalah untuk konversi data ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," ke ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let str6: &str = "John Towner Williams";\nlet str6_slice1: String = str6.to_string();\nprintln!("str6: {str6}"); // str6: John Towner Williams\nprintln!("str6_slice1: {str6_slice1}"); // str6_slice1: John Towner Williams\n')),(0,i.kt)("p",null,"Konversi pada tipe data ini sedikit berbeda dibandingkan konversi ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," ke ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),". Pada contoh di atas, yang terjadi adalah data ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," di-copy sebagai data baru bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," yang kemudian ditampung variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"str6_slice1")," (yang juga berperan sebagai owner untuk data baru tersebut)."),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"to_string")," melakukan operasi copy, bukan borrow. Artinya setelah dipanggil akan ada 2 data yang reference-nya sudah berbeda."),(0,i.kt)("h2",{id:"a464-string-literal--string-slice"},"A.46.4. String literal & string slice"),(0,i.kt)("p",null,"Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," memiliki hubungan dekat dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),". Data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," reference-nya bisa diakses dalam bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"&String"),", maupun dalam bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," (menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_str")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"as_mut_str"),"). Data text pada string tersebut bisa dimodifikasi, ditambahi, dan juga dikurangi."),(0,i.kt)("p",null,"Berbeda dengan data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," ",(0,i.kt)("strong",{parentName:"p"},"(di paragraph ini dan setelahnya yang kita bahas adalah data yang dari awal tipe-nya sudah ",(0,i.kt)("inlineCode",{parentName:"strong"},"&str"),", bukan data hasil operasi pinjam dari ",(0,i.kt)("inlineCode",{parentName:"strong"},"String"),")"),", data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," adalah fixed dan immutable. Konversi data ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," ke ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," menghasilkan data baru dengan owner baru. Bisa dibilang sangat terbatas apa yang bisa kita lakukan pada tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),"."),(0,i.kt)("p",null,"Meski demikian, tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," lebih cepat performa-nya dibanding ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," karena disimpan di static storage. Selain itu dijamin valid oleh Rust. Kekurangannya hanya pada ownership-nya. Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," adalah ",(0,i.kt)("strong",{parentName:"p"},"unowned"),", operasi mutability tidak bisa dilakukan pada tipe ini."),(0,i.kt)("p",null,"Dalam case normal, sangat dianjurkan untuk menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),", kecuali memang yang dibutuhkan adalah ",(0,i.kt)("strong",{parentName:"p"},"owned")," string."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/string_slice_vs_string_literal"},"github.com/novalagung/dasarpemrogramanrust-example/../string_slice_vs_string_literal")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/tipe-data-string-literal"},"Tipe Data \u279c String Literal (&str)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/slice-memory-management"},"Slice Memory Management")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/tipe-data-custom-type-string-slice"},"Tipe Data \u279c String Custom Type"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch08-02-strings.html"},"https://doc.rust-lang.org/book/ch08-02-strings.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://users.rust-lang.org/t/str-string-literals/29635"},"https://users.rust-lang.org/t/str-string-literals/29635")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://www.quora.com/Why-does-Rust-have-two-different-string-types-static-str-and-String"},"https://www.quora.com/Why-does-Rust-have-two-different-string-types-static-str-and-String")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/24158114/what-are-the-differences-between-rusts-string-and-str"},"https://stackoverflow.com/questions/24158114/what-are-the-differences-between-rusts-string-and-str")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/30154541/how-do-i-concatenate-strings"},"https://stackoverflow.com/questions/30154541/how-do-i-concatenate-strings"))))}m.isMDXComponent=!0},108:(a,e,t)=>{t.d(e,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcoAAABsCAIAAABlzGXMAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItM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dqT9EoQBEGQXgmCIEivBEEQpFeCIAiC9EoQBEF6JQiCIL0SBEEQpFeCIAjSK0EQBOmVGIx7x0ef/OH42S9fpykIgvRKjIk///q7L1+cvfzqTZqCIEivC+CtZ88/r/DBu6Nm/O4HuzyfP3trzJQq7r/x6n/+efqvD++1V37y42/943ff23Er6ZUgDppedwRjopeOC/uQYUljHdwSi4ynp1elmSPQ645MCyb94uRPv3nt50++/f57d3Yf//fxXdIrQZBeLfSy48AmVcFI2YQUKWUCeh1wF+lLr19/8v2CTz//UfGv/Uh6JYjDoFfH/yz5zP3s+qUVE7XfCuor+NW5WDqAKX4006v3qf4ACqw+Ao9aBhy0ZiqhiWwvnfRKEIdOr5qTKImvXsi3HBTy4uz06pfYpnCuhtWUjdUqEKSM5Jmg17/eqei1+OOLk4pbSa8EcTD0ilgQ02t7SRBVr9hAGHt1czTQq3u1DVPssvR50alVX3qN5Zmg109/8M3Hx18/v9v6rdW/3/7iNQ5Ngtj74EDHcS5pQHqNeZq9AqXDvFefaKuM5Jp/OL1G84zT68sXZzuGffnZvZ33WpPsl6ekV4I4FHqFDqidXkvy6bk/NJRemz+7LbbojtgAes2+edT0Wv378nRHrIUn+5fjbz4qzmb97Kff4dAkiMOhVy+qKEOMkIl0bh0/9lqnrJxtZ4fq+bN3nz33XU2lXMmTWiRVlp5LsPffeLXj1r/f7f7eObNfvbn7lkOTIPabXv11b3SvHFFhEDt1mdZKr+LXYikeHAco2dQPjOo1j+cJmqmllHmm8ekff+jGW9t/7793h+OSIA7KeyVGxs5F/e9nZwG3vvjoPi1DEKRXYgT8/lev//tvxZGs3X+5o0UQpFeCIAiC9EoQBEF6JQiCIL0SBEEQpFeCIAjSK0EQBOmVIAiCIL0SBEGQXgmCIPYA/wcGv+k9gijq8gAAAABJRU5ErkJggg=="},6484:(a,e,t)=>{t.d(e,{Z:()=>n});const n=t.p+"assets/images/string-slice-vs-string-literal-2-1b0caccba69a37db29f101f921a76df1.png"}}]); \ No newline at end of file diff --git a/assets/js/af6aab29.396c2ab9.js b/assets/js/af6aab29.396c2ab9.js deleted file mode 100644 index 85520a00..00000000 --- a/assets/js/af6aab29.396c2ab9.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[8794],{3905:(e,t,a)=>{a.d(t,{Zo:()=>o,kt:()=>c});var n=a(7294);function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?r(Object(a),!0).forEach((function(t){i(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):r(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function m(e,t){if(null==e)return{};var a,n,i=function(e,t){if(null==e)return{};var a,n,i={},r=Object.keys(e);for(n=0;n<r.length;n++)a=r[n],t.indexOf(a)>=0||(i[a]=e[a]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)a=r[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}var d=n.createContext({}),p=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},o=function(e){var t=p(e.components);return n.createElement(d.Provider,{value:t},e.children)},k={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},s=n.forwardRef((function(e,t){var a=e.components,i=e.mdxType,r=e.originalType,d=e.parentName,o=m(e,["components","mdxType","originalType","parentName"]),s=p(a),c=i,u=s["".concat(d,".").concat(c)]||s[c]||k[c]||r;return a?n.createElement(u,l(l({ref:t},o),{},{components:a})):n.createElement(u,l({ref:t},o))}));function c(e,t){var a=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=a.length,l=new Array(r);l[0]=s;var m={};for(var d in t)hasOwnProperty.call(t,d)&&(m[d]=t[d]);m.originalType=e,m.mdxType="string"==typeof e?e:i,l[1]=m;for(var p=2;p<r;p++)l[p]=a[p];return n.createElement.apply(null,l)}return n.createElement.apply(null,a)}s.displayName="MDXCreateElement"},1468:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>k,frontMatter:()=>r,metadata:()=>m,toc:()=>p});var n=a(7462),i=(a(7294),a(3905));const r={sidebar_position:52,title:"A.52. Date Time",sidebar_label:"A.52. Date Time"},l=void 0,m={unversionedId:"basic/datetime",id:"basic/datetime",title:"A.52. Date Time",description:"Pada chapter ini kita akan mempelajari tentang tipe data datetime yang ada di Rust programming.",source:"@site/docs/basic/datetime.md",sourceDirName:"basic",slug:"/basic/datetime",permalink:"/basic/datetime",draft:!1,tags:[],version:"current",sidebarPosition:52,frontMatter:{sidebar_position:52,title:"A.52. Date Time",sidebar_label:"A.52. Date Time"},sidebar:"tutorialSidebar",previous:{title:"A.51. Attributes",permalink:"/basic/attributes"},next:{title:"A.53. File, Path, Directory",permalink:"/basic/file-path-directory"}},d={},p=[{value:"A.52.1. Persiapan",id:"a521-persiapan",level:2},{value:"A.52.2. Tipe data <code>DateTime</code>",id:"a522-tipe-data-datetime",level:2},{value:"\u25c9 Tipe <code>DateTime<Utc></code>",id:"-tipe-datetimeutc",level:3},{value:"\u25c9 Tipe <code>DateTime<Local></code>",id:"-tipe-datetimelocal",level:3},{value:"\u25c9 Tipe <code>NaiveDateTime</code>",id:"-tipe-naivedatetime",level:3},{value:"A.52.3. Pembuatan objek <code>DateTime</code>",id:"a523-pembuatan-objek-datetime",level:2},{value:"\u25c9 Via <code>Utc::now()</code>",id:"-via-utcnow",level:3},{value:"\u25c9 Via <code>Utc.with_ymd_and_hms()</code>",id:"-via-utcwith_ymd_and_hms",level:3},{value:"\u25c9 Via <code>DateTime::<Utc>::from()</code>",id:"-via-datetimeutcfrom",level:3},{value:"\u25c9 Via String method <code>parse()</code>",id:"-via-string-method-parse",level:3},{value:"\u25c9 Cara lainnya",id:"-cara-lainnya",level:3},{value:"A.52.4. <code>Utc</code> vs <code>Local</code>",id:"a524-utc-vs-local",level:2},{value:"A.52.5. Tipe <code>NaiveDateTime</code>",id:"a525-tipe-naivedatetime",level:2},{value:"A.52.6. Konversi datetime UTC ke local timezone, dan sebaliknya",id:"a526-konversi-datetime-utc-ke-local-timezone-dan-sebaliknya",level:2},{value:"A.52.7. UNIX time",id:"a527-unix-time",level:2},{value:"A.52.8. Date formatting & parsing",id:"a528-date-formatting--parsing",level:2},{value:"A.52.9. DateTime formatting syntax",id:"a529-datetime-formatting-syntax",level:2},{value:"\u25c9 Date specifiers",id:"-date-specifiers",level:3},{value:"\u25c9 Time specifiers",id:"-time-specifiers",level:3},{value:"\u25c9 Timezone specifiers",id:"-timezone-specifiers",level:3},{value:"\u25c9 Date & time specifiers",id:"-date--time-specifiers",level:3},{value:"\u25c9 Special specifiers",id:"-special-specifiers",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],o={toc:p};function k(e){let{components:t,...r}=e;return(0,i.kt)("wrapper",(0,n.Z)({},o,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan mempelajari tentang tipe data datetime yang ada di Rust programming."),(0,i.kt)("p",null,"Rust menyediakan cukup banyak API untuk keperluan pengolahan datetime, tersedia dalam Standard Library crate. Namun pada chapter ini kita tidak akan menggunakannya, karena yang akan dipakai adalah ",(0,i.kt)("a",{parentName:"p",href:"https://crates.io/crates/chrono"},(0,i.kt)("inlineCode",{parentName:"a"},"chrono")," crate")," (dianjurkan untuk menggunakan crate ini karena fiturnya lebih banyak)."),(0,i.kt)("h2",{id:"a521-persiapan"},"A.52.1. Persiapan"),(0,i.kt)("p",null,"Sebelum memulai pembelajaran, siapkan satu project baru, kemudian tambahkan care ",(0,i.kt)("inlineCode",{parentName:"p"},"crono")," dalam ",(0,i.kt)("inlineCode",{parentName:"p"},"Cargo.toml"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "time_chrono"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nchrono = "0.4.23"\n')),(0,i.kt)("h2",{id:"a522-tipe-data-datetime"},"A.52.2. Tipe data ",(0,i.kt)("inlineCode",{parentName:"h2"},"DateTime")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"crono")," menyediakan cukup banyak tipe data untuk merepresentasikan informasi tanggal dan waktu, tetapi yang paling penting untuk diketahui dan dipahami ada dua, yaitu:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"DateTime<Utc>")," dan ",(0,i.kt)("inlineCode",{parentName:"li"},"DateTime<Local>")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"NaiveDateTime"))),(0,i.kt)("h3",{id:"-tipe-datetimeutc"},"\u25c9 Tipe ",(0,i.kt)("inlineCode",{parentName:"h3"},"DateTime<Utc>")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"DateTime<Utc>")," (gabungan dari tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"chrono::datetime::DateTime")," dan generic ",(0,i.kt)("inlineCode",{parentName:"p"},"chrono::offset::utc::Utc"),") adalah representasi untuk tipe data datetime dengan timezone offset ",(0,i.kt)("strong",{parentName:"p"},"UTC")," (atau ",(0,i.kt)("strong",{parentName:"p"},"GMT+0"),")."),(0,i.kt)("h3",{id:"-tipe-datetimelocal"},"\u25c9 Tipe ",(0,i.kt)("inlineCode",{parentName:"h3"},"DateTime<Local>")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"DateTime<Local>")," (gabungan dari tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"chrono::datetime::DateTime")," dan generic ",(0,i.kt)("inlineCode",{parentName:"p"},"chrono::offset::local::Local"),") adalah representasi untuk tipe data datetime dengan ",(0,i.kt)("strong",{parentName:"p"},"timezone offset sesuai dengan di mana program dijalankan"),"."),(0,i.kt)("p",null,"Sebagai contoh, penulis berlokasi di Jawa Timur, maka ketika ada suatu data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime<Local>")," artinya timezone offset-nya adalah WIB (atau GMT+7)."),(0,i.kt)("h3",{id:"-tipe-naivedatetime"},"\u25c9 Tipe ",(0,i.kt)("inlineCode",{parentName:"h3"},"NaiveDateTime")),(0,i.kt)("p",null,"Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"chrono::naive::datetime::NaiveDateTime")," merupakan tipe data datetime yang tidak menyimpan informasi timezone. Nanti akan kita bahas apa kegunaan dari tipe ini."),(0,i.kt)("h2",{id:"a523-pembuatan-objek-datetime"},"A.52.3. Pembuatan objek ",(0,i.kt)("inlineCode",{parentName:"h2"},"DateTime")),(0,i.kt)("h3",{id:"-via-utcnow"},"\u25c9 Via ",(0,i.kt)("inlineCode",{parentName:"h3"},"Utc::now()")),(0,i.kt)("p",null,"Ada banyak cara untuk membuat date time, dan kita akan bahas satu-per-satu."),(0,i.kt)("p",null,"Cara yang pertama, mari kita pelajari sambil praktek. Isi file program ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs")," dengan kode berikut, lalu jalankan."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'use chrono::prelude::*;\nuse std::time::{UNIX_EPOCH, Duration};\n\nfn main() {\n let sample_date1_in_utc: DateTime<Utc> = Utc::now();\n println!("sample date 1 (in utc): {sample_date1_in_utc}");\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"DateTime",src:a(6635).Z,width:"571",height:"95"})),(0,i.kt)("p",null,"Contoh sederhana di atas adalah salah satu cara membuat object datetime dengan isi adalah informasi waktu sekarang (waktu ketika baris kode tersebut dieksekusi)."),(0,i.kt)("p",null,"Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"Utc::now()")," mengembalikan informasi waktu sekarang dalam timezone UTC (representasi tipe data-nya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime<Utc>"),")."),(0,i.kt)("p",null,"Module item ",(0,i.kt)("inlineCode",{parentName:"p"},"Utc")," sendiri harus diimport terlebih dahulu agar bisa digunakan. Itulah kenapa ada statement ",(0,i.kt)("inlineCode",{parentName:"p"},"use chrono::prelude::*"),"."),(0,i.kt)("h3",{id:"-via-utcwith_ymd_and_hms"},"\u25c9 Via ",(0,i.kt)("inlineCode",{parentName:"h3"},"Utc.with_ymd_and_hms()")),(0,i.kt)("p",null,"Pembuatan object datetime dengan isi informasi waktu spesifik bisa dilakukan menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"Utc.with_ymd_and_hms()"),". Fungsi ini mewajibkan developer untuk mengisi 6 parameternya dengan segment waktu (tahun, bulan, dan lainnya)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let sample_date2_in_utc = Utc.with_ymd_and_hms(2023, 3, 1, 1, 2, 3).unwrap();\nprintln!("sample date 2 (in utc): {sample_date2_in_utc}");\n// output: sample date 2 (in utc): 2023-03-01 01:02:03 UTC\n')),(0,i.kt)("p",null,"Statement di atas menghasilkan data datetime dengan isi ",(0,i.kt)("inlineCode",{parentName:"p"},"2023-03-01 01:02:03 UTC"),"."),(0,i.kt)("h3",{id:"-via-datetimeutcfrom"},"\u25c9 Via ",(0,i.kt)("inlineCode",{parentName:"h3"},"DateTime::<Utc>::from()")),(0,i.kt)("p",null,"Cara ini pas digunakan pada situasi di mana kita perlu membuat object datetime dari sebuah ",(0,i.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Unix_time"},"UNIX timestamp"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let sample_date3_in_utc = DateTime::<Utc>::from(UNIX_EPOCH + Duration::from_secs(1524885322));\nprintln!("sample date 3 (in utc): {sample_date3_in_utc}");\n// output: sample date 3 (in utc): 2018-04-28 03:15:22 UTC\n')),(0,i.kt)("p",null,"Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime::<Utc>::from()")," di atas menghasilkan data datetime ",(0,i.kt)("inlineCode",{parentName:"p"},"2018-04-28 03:15:22 UTC"),", karena nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"1524885322")," adalah representasi UNIX time untuk waktu tersebut."),(0,i.kt)("h3",{id:"-via-string-method-parse"},"\u25c9 Via String method ",(0,i.kt)("inlineCode",{parentName:"h3"},"parse()")),(0,i.kt)("p",null,"Tipe data string bisa langsung dikonversi ke bentuk datetime menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"parse()")," yang dikombinasikan dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime<Utc>")," sebagai generic parameter."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let sample_date4_in_utc = "2023-03-01 01:02:03 UTC".parse::<DateTime<Utc>>().unwrap();\nprintln!("sample date 4 (in utc): {sample_date4_in_utc}");\n// output: sample date 4 (in utc): 2023-03-01 01:02:03 UTC\n')),(0,i.kt)("p",null,"Statement parsing di atas menghasilkan data datetime ",(0,i.kt)("inlineCode",{parentName:"p"},"2023-03-01 01:02:03 UTC"),", sesuai dengan isi data string."),(0,i.kt)("p",null,"O iya, perlu diketahui bahwa tidak semua string bisa di-parse ke bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime"),". Jika data string memiliki format yang tidak sesuai dengan aturan parsing di Rust, maka proses parsing menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"parse()")," pasti menghasilkan error."),(0,i.kt)("p",null,"Penerapan method ",(0,i.kt)("inlineCode",{parentName:"p"},"parse::<DateTime<Utc>>()")," sebenarnya mengembalikan tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<DateTime<Utc>, ParseError>"),", itulah kenapa pada contoh perlu di chain lagi dengan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih detailnya mengenai tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/result-type"},"Tipe Data \u279c Result"))),(0,i.kt)("h3",{id:"-cara-lainnya"},"\u25c9 Cara lainnya"),(0,i.kt)("p",null,"Ada beberapa cara lain yang bisa digunakan untuk pembuatan object datetime, dan kita akan bahas juga sebentar lagi."),(0,i.kt)("h2",{id:"a524-utc-vs-local"},"A.52.4. ",(0,i.kt)("inlineCode",{parentName:"h2"},"Utc")," vs ",(0,i.kt)("inlineCode",{parentName:"h2"},"Local")),(0,i.kt)("p",null,"Kesemua cara yang sudah dipelajari di atas juga bisa diterapkan dalam pembuatan object date time dengan timezone offset ",(0,i.kt)("inlineCode",{parentName:"p"},"Local"),". Penerapannya kurang lebih sama, cukup ganti ",(0,i.kt)("inlineCode",{parentName:"p"},"Utc")," menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"Local"),"."),(0,i.kt)("p",null,"Jika disandingkan, akan seperti ini kodenya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let date1_in_utc: DateTime<Utc> = Utc::now();\nlet date2_in_utc = Utc.with_ymd_and_hms(2023, 3, 1, 1, 2, 3).unwrap();\nlet date3_in_utc = DateTime::<Utc>::from(UNIX_EPOCH + Duration::from_secs(1524885322));\nlet date4_in_utc = "2023-03-01 01:02:03 UTC".parse::<DateTime<Utc>>().unwrap();\n\nprintln!("sample date 1 (in utc): {date1_in_utc}");\nprintln!("sample date 2 (in utc): {date2_in_utc}");\nprintln!("sample date 3 (in utc): {date3_in_utc}");\nprintln!("sample date 4 (in utc): {date4_in_utc}");\n\n// vs\n\nlet date1_in_local_tz: DateTime<Local> = Local::now();\nlet date2_in_local_tz = Local.with_ymd_and_hms(2023, 3, 1, 1, 2, 3).unwrap();\nlet date3_in_local_tz = DateTime::<Local>::from(UNIX_EPOCH + Duration::from_secs(1524885322));\nlet date4_in_local_tz = "2023-03-01 01:02:03 UTC".parse::<DateTime<Local>>().unwrap();\n\nprintln!("sample date 1 (in local_tz): {date1_in_local_tz}");\nprintln!("sample date 2 (in local_tz): {date2_in_local_tz}");\nprintln!("sample date 3 (in local_tz): {date3_in_local_tz}");\nprintln!("sample date 4 (in local_tz): {date4_in_local_tz}");\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"DateTime",src:a(239).Z,width:"571",height:"231"})),(0,i.kt)("p",null,"Semoga cukup jelas."),(0,i.kt)("p",null,"Dari contoh di atas, sebenarnya ada 2 variabel yang menarik untuk dibahas, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"sample_date1_in_utc")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"sample_date1_in_local_tz"),". Dua variabel tersebut berisi informasi waktu sekarang, perbedaannya hanya pada timezone offset saja. Namun, meski timezone offset-nya berbeda, kedua datetime tersebut sejatinya adalah merepresentasikan waktu yang sama (ekuivalen)."),(0,i.kt)("p",null,"Agar lebih jelas, silakan perhatikan contoh berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"sample date 1 (in utc): 2023-03-02 09:53:44.561519500 UTC\nsample date 1 (in local_tz): 2023-03-02 16:53:44.562389600 +07:00\n")),(0,i.kt)("p",null,"Kedua datetime tersebut terpaku ",(0,i.kt)("strong",{parentName:"p"},"7 jam")," persis. Data ",(0,i.kt)("inlineCode",{parentName:"p"},"2023-03-02 09:53:44")," UTC (atau GMT+0), jika dikonversi ke waktu lokal penulis (WIB atau GMT+7) maka akan menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"2023-03-02 16:53:44"),". Selisihnya sesuai dengan timezone offset, yaitu 7 jam."),(0,i.kt)("h2",{id:"a525-tipe-naivedatetime"},"A.52.5. Tipe ",(0,i.kt)("inlineCode",{parentName:"h2"},"NaiveDateTime")),(0,i.kt)("p",null,"Rust memilik caranya sendiri dalam pengelolaan data datetime (yang menurut penulis cukup unik). Ada satu tipe data bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"NaiveDateTime"),", yang kegunaannya adalah untuk menampung tipe data datetime ",(0,i.kt)("strong",{parentName:"p"},"tanpa spesifik timezone offset"),"."),(0,i.kt)("p",null,"Tipe data ini sangat berguna dibeberapa case yang kebanyakan adalah perihal konversi data ke bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime"),"."),(0,i.kt)("p",null,"Mari kita praktekan dengan contoh agar lebih jelas. Dimisalkan ada keperluan di mana data UNIX time perlu di konversi ke 2 bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime"),", dengan timezone offset ",(0,i.kt)("inlineCode",{parentName:"p"},"Utc")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Local"),". Pada kasus ini, cara ke-3 dari praktek sebelumnya bisa dilakukan untuk penyelesaian case ini."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let timestamp: u64 = 1524885322;\nlet date2_in_utc = DateTime::<Utc>::from(UNIX_EPOCH + Duration::from_secs(timestamp));\nlet date2_in_local_tz = DateTime::<Local>::from(UNIX_EPOCH + Duration::from_secs(timestamp));\n")),(0,i.kt)("p",null,"Cara lain adalah dengan menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"NaiveDateTime"),", yang contoh penerapannnya kurang lebih seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let timestamp_in_ms: i64 = 1524885322000;\nlet naive_date_time: NaiveDateTime = NaiveDateTime::from_timestamp_millis(timestamp_in_ms).unwrap();\n\nlet sample_date_in_utc = Utc.from_utc_datetime(&naive_date_time);\nlet sample_date_in_local_tz = Local.from_local_datetime(&naive_date_time).unwrap();\n\nprintln!("sample date 1 (in utc): {sample_date_in_utc}");\nprintln!("sample date 2 (in local_tz): {sample_date_in_local_tz}");\n\n// output:\n// sample date 1 (in utc): 2018-04-28 03:15:22 UTC\n// sample date 2 (in local_tz): 2018-04-28 03:15:22 +07:00\n')),(0,i.kt)("p",null,"Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"NaiveDateTime::from_timestamp_millis")," berguna untuk mengkonversi data UNIX time (milisecond) ke bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"NaiveDateTime"),". Kemudian, dari data tersebut dapat kita konversi lagi ke bentuk UTC dengan mudah menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"Utc.from_utc_datetime()")," dan local timezone menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"Local.from_local_datetime()"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"DateTime",src:a(2330).Z,width:"571",height:"115"})),(0,i.kt)("p",null,"Bisa dilihat pada output di atas, bahwa hasil data datetime berbeda untuk timezone UTC dan local."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Jangan sampai bingung, 2 data datetime di atas tidak sama dan tidak ekuivalen meskipun informasi jam menit detiknya sama persis. Hal ini dikarenakan timezone offset-nya berbeda.")),(0,i.kt)("h2",{id:"a526-konversi-datetime-utc-ke-local-timezone-dan-sebaliknya"},"A.52.6. Konversi datetime UTC ke local timezone, dan sebaliknya"),(0,i.kt)("p",null,"Dalam bekerja dengan tipe data datetime, selalu memperhatikan timezone adalah hal yang sangat penting. Bisa saja dua buah datetime memiliki informasi tanggal dan waktu sama persis, tapi jika timezone-nya berbeda maka keduanya adalah berbeda!"),(0,i.kt)("p",null,"Agar lebih jelas, silakan perhatikan kode berikut beserta outputnya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let date1_in_local_tz: DateTime<Local> = Local::now();\nprintln!("date (in local): {date1_in_local_tz}");\n\nlet date_in_utc = DateTime::<Utc>::from(date1_in_local_tz);\nprintln!("date (in utc): {date_in_utc}");\n\nlet date2_in_local_tz = DateTime::<Local>::from(date_in_utc);\nprintln!("date (in local): {date2_in_local_tz}");\n\n// output:\n// date (in local): 2023-03-02 17:33:37.750279900 +07:00\n// date (in utc): 2023-03-02 10:33:37.750279900 UTC\n// date (in local): 2023-03-02 17:33:37.750279900 +07:00\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"DateTime",src:a(7934).Z,width:"571",height:"129"})),(0,i.kt)("p",null,"Ketiga data datetime di atas adalah ekuivalen:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"date1_in_local_tz")," berisi informasi datetime waktu sekarang, dengan timezone GMT+7."),(0,i.kt)("li",{parentName:"ul"},"Variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"date_in_utc")," adalah datetime yang ekuivalen dengan ",(0,i.kt)("inlineCode",{parentName:"li"},"date1_in_local_tz"),", hanya saja direpresentasikan dalam timezone UTC."),(0,i.kt)("li",{parentName:"ul"},"Variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"date2_in_local_tz")," juga ekuivalen dengan ",(0,i.kt)("inlineCode",{parentName:"li"},"date_in_utc")," dan juga ",(0,i.kt)("inlineCode",{parentName:"li"},"date1_in_local_tz"),".")),(0,i.kt)("p",null,"Data ",(0,i.kt)("inlineCode",{parentName:"p"},"2023-03-02 10 UTC")," jika ditambah 7 jam offset, maka menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"2023-03-02 17 GMT+7"),"."),(0,i.kt)("h2",{id:"a527-unix-time"},"A.52.7. UNIX time"),(0,i.kt)("p",null,"Cara konversi data ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime")," ke bentuk UNIX time bisa dilakukan lewat 3 cara:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"menggunakan method ",(0,i.kt)("inlineCode",{parentName:"li"},"timestamp"),", nilai baliknya dalam bentuk detik/second"),(0,i.kt)("li",{parentName:"ul"},"menggunakan method ",(0,i.kt)("inlineCode",{parentName:"li"},"timestamp_millis"),", nilai baliknya dalam bentuk miliseconds"),(0,i.kt)("li",{parentName:"ul"},"menggunakan method ",(0,i.kt)("inlineCode",{parentName:"li"},"timestamp_micros"),", nilai baliknya dalam bentuk microseconds")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let date_in_local_tz: DateTime<Local> = Local::now();\nprintln!("date: {date_in_local_tz}");\nprintln!("date (in second timestamp): {}", date_in_local_tz.timestamp());\nprintln!("date (in milisecond timestamp): {}", date_in_local_tz.timestamp_millis());\nprintln!("date (in microsecond timestamp): {}", date_in_local_tz.timestamp_micros());\n')),(0,i.kt)("p",null,"Sedangkan cara untuk mengkonversi data timestamp ke bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime")," bisa dilakukan via ",(0,i.kt)("inlineCode",{parentName:"p"},"NaiveDateTime")," ataupun ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime::from"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'// via NaiveDateTime\nlet naive_date_time = NaiveDateTime::from_timestamp_millis(date_in_local_tz.timestamp_millis()).unwrap();\nlet new_datetime1 = Local.from_local_datetime(&naive_date_time).unwrap();\nprintln!("date1: {new_datetime1}");\n\n// via DateTime::from\nlet new_datetime2 = DateTime::<Local>::from(UNIX_EPOCH + Duration::from_millis(date_in_local_tz.timestamp_millis().unsigned_abs()));\nprintln!("date2: {new_datetime2}");\n')),(0,i.kt)("p",null,"Output program di atas:"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"DateTime",src:a(6451).Z,width:"571",height:"182"})),(0,i.kt)("h2",{id:"a528-date-formatting--parsing"},"A.52.8. Date formatting & parsing"),(0,i.kt)("p",null,"Konversi datetime ke string (atau biasa disebut dengan date formatting) dilakukan menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"format")," yang dalam penerapannya membutuhkan argument ",(0,i.kt)("em",{parentName:"p"},"datetime formatting syntax"),"."),(0,i.kt)("p",null,"Sedangkan konversi dari string ke datetime dilakukan via ",(0,i.kt)("inlineCode",{parentName:"p"},"Local.datetime_from_str")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"Utc.datetime_from_str"),"."),(0,i.kt)("p",null,"Contoh pengaplikasian keduanya bisa dilihat pada kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let date1: DateTime<Local> = Local::now();\nprintln!("date1 (in local): {}", date1);\n// date1 (in local): 2023-03-02 18:13:39.954831600 +07:00\n\nlet str_from_date1 = date1.format("%Y-%m-%d %H:%M:%S %z").to_string();\nprintln!("date1 (in string): {}", str_from_date1);\n// date1 (in string): 2023-03-02 18:13:39 +0700\n\nlet date1_from_str = Local.datetime_from_str(&str_from_date1, "%Y-%m-%d %H:%M:%S %z").unwrap();\nprintln!("date1 (in local): {}", date1_from_str);\n// date1 (in local): 2023-03-02 18:13:39 +07:00\n\nlet date2_from_str = Utc.datetime_from_str("03/01/2023 13:04 +0000", "%m/%d/%Y %H:%M %z").unwrap();\nprintln!("date2 (in utc): {}", date2_from_str);\n// date2 (in utc): 2023-03-01 13:04:00 UTC\n\nlet str_from_date2 = date2_from_str.format("%Y-%m-%d %H:%M:%S %z").to_string();\nprintln!("date2 (in string): {}", str_from_date2);\n// date2 (in string): 2023-03-01 13:04:00 +0000\n')),(0,i.kt)("h2",{id:"a529-datetime-formatting-syntax"},"A.52.9. DateTime formatting syntax"),(0,i.kt)("p",null,"Berikut adalah tabel formatting syntax untuk tipe data datetime."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Selengkapnya silakan cek ",(0,i.kt)("a",{parentName:"p",href:"https://docs.rs/chrono/latest/chrono/format/strftime/index.html"},"https://docs.rs/chrono/latest/chrono/format/strftime/index.html"))),(0,i.kt)("h3",{id:"-date-specifiers"},"\u25c9 Date specifiers"),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:"center"},"Spec"),(0,i.kt)("th",{parentName:"tr",align:"center"},"Example"),(0,i.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%Y"),(0,i.kt)("td",{parentName:"tr",align:"center"},"2001"),(0,i.kt)("td",{parentName:"tr",align:"left"},"The full proleptic Gregorian year, zero-padded to 4 digits. chrono supports years from -262144 to 262143.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%C"),(0,i.kt)("td",{parentName:"tr",align:"center"},"20"),(0,i.kt)("td",{parentName:"tr",align:"left"},"The proleptic Gregorian year divided by 100, zero-padded to 2 digits. 1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%y"),(0,i.kt)("td",{parentName:"tr",align:"center"},"01"),(0,i.kt)("td",{parentName:"tr",align:"left"},"The proleptic Gregorian year modulo 100, zero-padded to 2 digits. 1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%m"),(0,i.kt)("td",{parentName:"tr",align:"center"},"07"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Month number (01\u201312), zero-padded to 2 digits.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%b"),(0,i.kt)("td",{parentName:"tr",align:"center"},"Jul"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Abbreviated month name. Always 3 letters.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%B"),(0,i.kt)("td",{parentName:"tr",align:"center"},"July"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Full month name. Also accepts corresponding abbreviation in parsing.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%h"),(0,i.kt)("td",{parentName:"tr",align:"center"},"Jul"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Same as %b.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%d"),(0,i.kt)("td",{parentName:"tr",align:"center"},"08"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Day number (01\u201331), zero-padded to 2 digits.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%e"),(0,i.kt)("td",{parentName:"tr",align:"center"},"8"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Same as %d but space-padded. Same as %_d.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%a"),(0,i.kt)("td",{parentName:"tr",align:"center"},"Sun"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Abbreviated weekday name. Always 3 letters.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%A"),(0,i.kt)("td",{parentName:"tr",align:"center"},"Sunday"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Full weekday name. Also accepts corresponding abbreviation in parsing.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%w"),(0,i.kt)("td",{parentName:"tr",align:"center"},"0"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Sunday = 0, Monday = 1, \u2026, Saturday = 6.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%u"),(0,i.kt)("td",{parentName:"tr",align:"center"},"7"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Monday = 1, Tuesday = 2, \u2026, Sunday = 7. (ISO 8601)")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%U"),(0,i.kt)("td",{parentName:"tr",align:"center"},"28"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Week number starting with Sunday (00\u201353), zero-padded to 2 digits. 2")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%W"),(0,i.kt)("td",{parentName:"tr",align:"center"},"27"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Same as %U, but week 1 starts with the first Monday in that year instead.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%G"),(0,i.kt)("td",{parentName:"tr",align:"center"},"2001"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Same as %Y but uses the year number in ISO 8601 week date. 3")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%g"),(0,i.kt)("td",{parentName:"tr",align:"center"},"01"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Same as %y but uses the year number in ISO 8601 week date. 3")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%V"),(0,i.kt)("td",{parentName:"tr",align:"center"},"27"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Same as %U but uses the week number in ISO 8601 week date (01\u201353). 3")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%j"),(0,i.kt)("td",{parentName:"tr",align:"center"},"189"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Day of the year (001\u2013366), zero-padded to 3 digits.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%D"),(0,i.kt)("td",{parentName:"tr",align:"center"},"07/08/01"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Month-day-year format. Same as %m/%d/%y.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%x"),(0,i.kt)("td",{parentName:"tr",align:"center"},"07/08/01"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Locale\u2019s date representation (e.g., 12/31/99).")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%F"),(0,i.kt)("td",{parentName:"tr",align:"center"},"2001-07-08"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Year-month-day format (ISO 8601). Same as %Y-%m-%d.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%v"),(0,i.kt)("td",{parentName:"tr",align:"center"},"8-Jul-2001"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Day-month-year format. Same as %e-%b-%Y.")))),(0,i.kt)("h3",{id:"-time-specifiers"},"\u25c9 Time specifiers"),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:"center"},"Spec"),(0,i.kt)("th",{parentName:"tr",align:"center"},"Example"),(0,i.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%H"),(0,i.kt)("td",{parentName:"tr",align:"center"},"00"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Hour number (00\u201323), zero-padded to 2 digits.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%k"),(0,i.kt)("td",{parentName:"tr",align:"center"},"0"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Same as %H but space-padded. Same as %_H.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%I"),(0,i.kt)("td",{parentName:"tr",align:"center"},"12"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Hour number in 12-hour clocks (01\u201312), zero-padded to 2 digits.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%l"),(0,i.kt)("td",{parentName:"tr",align:"center"},"12"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Same as %I but space-padded. Same as %_I.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%P"),(0,i.kt)("td",{parentName:"tr",align:"center"},"am"),(0,i.kt)("td",{parentName:"tr",align:"left"},"am or pm in 12-hour clocks.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%p"),(0,i.kt)("td",{parentName:"tr",align:"center"},"AM"),(0,i.kt)("td",{parentName:"tr",align:"left"},"AM or PM in 12-hour clocks.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%M"),(0,i.kt)("td",{parentName:"tr",align:"center"},"34"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Minute number (00\u201359), zero-padded to 2 digits.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%S"),(0,i.kt)("td",{parentName:"tr",align:"center"},"60"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Second number (00\u201360), zero-padded to 2 digits. 4")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%f"),(0,i.kt)("td",{parentName:"tr",align:"center"},"026490000"),(0,i.kt)("td",{parentName:"tr",align:"left"},"The fractional seconds (in nanoseconds) since last whole second. 5")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%.f"),(0,i.kt)("td",{parentName:"tr",align:"center"},".026490"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Similar to .%f but left-aligned. These all consume the leading dot. 5")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%.3f"),(0,i.kt)("td",{parentName:"tr",align:"center"},".026"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Similar to .%f but left-aligned but fixed to a length of 3. 5")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%.6f"),(0,i.kt)("td",{parentName:"tr",align:"center"},".026490"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Similar to .%f but left-aligned but fixed to a length of 6. 5")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%.9f"),(0,i.kt)("td",{parentName:"tr",align:"center"},".026490000"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Similar to .%f but left-aligned but fixed to a length of 9. 5")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%3f"),(0,i.kt)("td",{parentName:"tr",align:"center"},"026"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Similar to %.3f but without the leading dot. 5")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%6f"),(0,i.kt)("td",{parentName:"tr",align:"center"},"026490"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Similar to %.6f but without the leading dot. 5")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%9f"),(0,i.kt)("td",{parentName:"tr",align:"center"},"026490000"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Similar to %.9f but without the leading dot. 5")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%R"),(0,i.kt)("td",{parentName:"tr",align:"center"},"00:34"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Hour-minute format. Same as %H:%M.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%T"),(0,i.kt)("td",{parentName:"tr",align:"center"},"00:34:60"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Hour-minute-second format. Same as %H:%M:%S.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%X"),(0,i.kt)("td",{parentName:"tr",align:"center"},"00:34:60"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Locale\u2019s time representation (e.g., 23:13:48).")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%r"),(0,i.kt)("td",{parentName:"tr",align:"center"},"12:34:60 AM"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Hour-minute-second format in 12-hour clocks. Same as %I:%M:%S %p.")))),(0,i.kt)("h3",{id:"-timezone-specifiers"},"\u25c9 Timezone specifiers"),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:"center"},"Spec"),(0,i.kt)("th",{parentName:"tr",align:"center"},"Example"),(0,i.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%Z"),(0,i.kt)("td",{parentName:"tr",align:"center"},"ACST"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Local time zone name. Skips all non-whitespace characters during parsing. 6")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%z"),(0,i.kt)("td",{parentName:"tr",align:"center"},"+0930"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Offset from the local time to UTC (with UTC being +0000).")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%:z"),(0,i.kt)("td",{parentName:"tr",align:"center"},"+09:30"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Same as %z but with a colon.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%::z"),(0,i.kt)("td",{parentName:"tr",align:"center"},"+09:30:00"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Offset from the local time to UTC with seconds.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%:::z"),(0,i.kt)("td",{parentName:"tr",align:"center"},"+09"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Offset from the local time to UTC without minutes.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%#z"),(0,i.kt)("td",{parentName:"tr",align:"center"},"+09"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Parsing only: Same as %z but allows minutes to be missing or present.")))),(0,i.kt)("h3",{id:"-date--time-specifiers"},"\u25c9 Date & time specifiers"),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:"center"},"Spec"),(0,i.kt)("th",{parentName:"tr",align:"center"},"Example"),(0,i.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"Sun Jul 8 00:34:60 2001"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Locale\u2019s date and time (e.g., Thu Mar 3 23:05:25 2005).")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%+"),(0,i.kt)("td",{parentName:"tr",align:"center"},"2001-07-08T00:34:60.026490+09:30"),(0,i.kt)("td",{parentName:"tr",align:"left"},"ISO 8601 / RFC 3339 date & time format. 7")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%s"),(0,i.kt)("td",{parentName:"tr",align:"center"},"994518299"),(0,i.kt)("td",{parentName:"tr",align:"left"},"UNIX timestamp, the number of seconds since 1970-01-01 00:00 UTC. 8")))),(0,i.kt)("h3",{id:"-special-specifiers"},"\u25c9 Special specifiers"),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:"center"},"Spec"),(0,i.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%t"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Literal tab (\\t).")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%n"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Literal newline (\\n).")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%%"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Literal percent sign.")))),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/datetime"},"github.com/novalagung/dasarpemrogramanrust-example/../datetime")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/result-type"},"Tipe Data \u279c Result")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/generics"},"Generic"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/time/index.html"},"https://doc.rust-lang.org/std/time/index.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://docs.rs/time/latest/time/"},"https://docs.rs/time/latest/time/")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://github.com/rust-lang/rust-wiki-backup/blob/master/Lib-datetime.md"},"https://github.com/rust-lang/rust-wiki-backup/blob/master/Lib-datetime.md")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://docs.rs/chrono/latest/chrono/"},"https://docs.rs/chrono/latest/chrono/"))))}k.isMDXComponent=!0},6635:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/datetime-1-c0119211ce2f1f5f14eaf24316a52b54.png"},239:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/datetime-2-998514b9bc7ad92870392305578f2a14.png"},2330:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/datetime-3-52a5ccd1fb458c09958eafdba3f6c0d4.png"},7934:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/datetime-4-62b94d0c3e24bea70a3355c814ed8d79.png"},6451:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/datetime-5-eb678ecf97453409d153b4f9727e6347.png"}}]); \ No newline at end of file diff --git a/assets/js/af6aab29.81f5f011.js b/assets/js/af6aab29.81f5f011.js new file mode 100644 index 00000000..6c04e90a --- /dev/null +++ b/assets/js/af6aab29.81f5f011.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[8794],{3905:(e,t,a)=>{a.d(t,{Zo:()=>o,kt:()=>c});var n=a(7294);function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?r(Object(a),!0).forEach((function(t){i(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):r(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function m(e,t){if(null==e)return{};var a,n,i=function(e,t){if(null==e)return{};var a,n,i={},r=Object.keys(e);for(n=0;n<r.length;n++)a=r[n],t.indexOf(a)>=0||(i[a]=e[a]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)a=r[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}var d=n.createContext({}),p=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},o=function(e){var t=p(e.components);return n.createElement(d.Provider,{value:t},e.children)},k={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},s=n.forwardRef((function(e,t){var a=e.components,i=e.mdxType,r=e.originalType,d=e.parentName,o=m(e,["components","mdxType","originalType","parentName"]),s=p(a),c=i,u=s["".concat(d,".").concat(c)]||s[c]||k[c]||r;return a?n.createElement(u,l(l({ref:t},o),{},{components:a})):n.createElement(u,l({ref:t},o))}));function c(e,t){var a=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=a.length,l=new Array(r);l[0]=s;var m={};for(var d in t)hasOwnProperty.call(t,d)&&(m[d]=t[d]);m.originalType=e,m.mdxType="string"==typeof e?e:i,l[1]=m;for(var p=2;p<r;p++)l[p]=a[p];return n.createElement.apply(null,l)}return n.createElement.apply(null,a)}s.displayName="MDXCreateElement"},1468:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>k,frontMatter:()=>r,metadata:()=>m,toc:()=>p});var n=a(7462),i=(a(7294),a(3905));const r={sidebar_position:52,title:"A.52. Date Time",sidebar_label:"A.52. Date Time"},l=void 0,m={unversionedId:"basic/datetime",id:"basic/datetime",title:"A.52. Date Time",description:"Pada chapter ini kita akan mempelajari tentang tipe data datetime yang ada di Rust programming.",source:"@site/docs/basic/datetime.md",sourceDirName:"basic",slug:"/basic/datetime",permalink:"/basic/datetime",draft:!1,tags:[],version:"current",sidebarPosition:52,frontMatter:{sidebar_position:52,title:"A.52. Date Time",sidebar_label:"A.52. Date Time"},sidebar:"tutorialSidebar",previous:{title:"A.51. Attributes",permalink:"/basic/attributes"},next:{title:"A.53. File, Path, Directory",permalink:"/basic/file-path-directory"}},d={},p=[{value:"A.52.1. Persiapan",id:"a521-persiapan",level:2},{value:"A.52.2. Tipe data <code>DateTime</code>",id:"a522-tipe-data-datetime",level:2},{value:"\u25c9 Tipe <code>DateTime<Utc></code>",id:"-tipe-datetimeutc",level:3},{value:"\u25c9 Tipe <code>DateTime<Local></code>",id:"-tipe-datetimelocal",level:3},{value:"\u25c9 Tipe <code>NaiveDateTime</code>",id:"-tipe-naivedatetime",level:3},{value:"A.52.3. Pembuatan objek <code>DateTime</code>",id:"a523-pembuatan-objek-datetime",level:2},{value:"\u25c9 Via <code>Utc::now()</code>",id:"-via-utcnow",level:3},{value:"\u25c9 Via <code>Utc.with_ymd_and_hms()</code>",id:"-via-utcwith_ymd_and_hms",level:3},{value:"\u25c9 Via <code>DateTime::<Utc>::from()</code>",id:"-via-datetimeutcfrom",level:3},{value:"\u25c9 Via String method <code>parse()</code>",id:"-via-string-method-parse",level:3},{value:"\u25c9 Cara lainnya",id:"-cara-lainnya",level:3},{value:"A.52.4. <code>Utc</code> vs <code>Local</code>",id:"a524-utc-vs-local",level:2},{value:"A.52.5. Tipe <code>NaiveDateTime</code>",id:"a525-tipe-naivedatetime",level:2},{value:"A.52.6. Konversi datetime UTC ke local timezone, dan sebaliknya",id:"a526-konversi-datetime-utc-ke-local-timezone-dan-sebaliknya",level:2},{value:"A.52.7. UNIX time",id:"a527-unix-time",level:2},{value:"A.52.8. Date formatting & parsing",id:"a528-date-formatting--parsing",level:2},{value:"A.52.9. DateTime formatting syntax",id:"a529-datetime-formatting-syntax",level:2},{value:"\u25c9 Date specifiers",id:"-date-specifiers",level:3},{value:"\u25c9 Time specifiers",id:"-time-specifiers",level:3},{value:"\u25c9 Timezone specifiers",id:"-timezone-specifiers",level:3},{value:"\u25c9 Date & time specifiers",id:"-date--time-specifiers",level:3},{value:"\u25c9 Special specifiers",id:"-special-specifiers",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],o={toc:p};function k(e){let{components:t,...r}=e;return(0,i.kt)("wrapper",(0,n.Z)({},o,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan mempelajari tentang tipe data datetime yang ada di Rust programming."),(0,i.kt)("p",null,"Rust menyediakan cukup banyak API untuk keperluan pengolahan datetime, tersedia dalam Standard Library crate. Namun pada chapter ini kita tidak akan menggunakannya, karena yang akan dipakai adalah ",(0,i.kt)("a",{parentName:"p",href:"https://crates.io/crates/chrono"},(0,i.kt)("inlineCode",{parentName:"a"},"chrono")," crate")," (dianjurkan untuk menggunakan crate ini karena fiturnya lebih banyak)."),(0,i.kt)("h2",{id:"a521-persiapan"},"A.52.1. Persiapan"),(0,i.kt)("p",null,"Sebelum memulai pembelajaran, siapkan satu project baru, kemudian tambahkan care ",(0,i.kt)("inlineCode",{parentName:"p"},"crono")," dalam ",(0,i.kt)("inlineCode",{parentName:"p"},"Cargo.toml"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "time_chrono"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nchrono = "0.4.23"\n')),(0,i.kt)("h2",{id:"a522-tipe-data-datetime"},"A.52.2. Tipe data ",(0,i.kt)("inlineCode",{parentName:"h2"},"DateTime")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"crono")," menyediakan cukup banyak tipe data untuk merepresentasikan informasi tanggal dan waktu, tetapi yang paling penting untuk diketahui dan dipahami ada dua, yaitu:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"DateTime<Utc>")," dan ",(0,i.kt)("inlineCode",{parentName:"li"},"DateTime<Local>")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"NaiveDateTime"))),(0,i.kt)("h3",{id:"-tipe-datetimeutc"},"\u25c9 Tipe ",(0,i.kt)("inlineCode",{parentName:"h3"},"DateTime<Utc>")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"DateTime<Utc>")," (gabungan dari tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"chrono::datetime::DateTime")," dan generic ",(0,i.kt)("inlineCode",{parentName:"p"},"chrono::offset::utc::Utc"),") adalah representasi untuk tipe data datetime dengan timezone offset ",(0,i.kt)("strong",{parentName:"p"},"UTC")," (atau ",(0,i.kt)("strong",{parentName:"p"},"GMT+0"),")."),(0,i.kt)("h3",{id:"-tipe-datetimelocal"},"\u25c9 Tipe ",(0,i.kt)("inlineCode",{parentName:"h3"},"DateTime<Local>")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"DateTime<Local>")," (gabungan dari tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"chrono::datetime::DateTime")," dan generic ",(0,i.kt)("inlineCode",{parentName:"p"},"chrono::offset::local::Local"),") adalah representasi untuk tipe data datetime dengan ",(0,i.kt)("strong",{parentName:"p"},"timezone offset sesuai dengan di mana program dijalankan"),"."),(0,i.kt)("p",null,"Sebagai contoh, penulis berlokasi di Jawa Timur, maka ketika ada suatu data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime<Local>")," artinya timezone offset-nya adalah WIB (atau GMT+7)."),(0,i.kt)("h3",{id:"-tipe-naivedatetime"},"\u25c9 Tipe ",(0,i.kt)("inlineCode",{parentName:"h3"},"NaiveDateTime")),(0,i.kt)("p",null,"Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"chrono::naive::datetime::NaiveDateTime")," merupakan tipe data datetime yang tidak menyimpan informasi timezone. Nanti akan kita bahas apa kegunaan dari tipe ini."),(0,i.kt)("h2",{id:"a523-pembuatan-objek-datetime"},"A.52.3. Pembuatan objek ",(0,i.kt)("inlineCode",{parentName:"h2"},"DateTime")),(0,i.kt)("h3",{id:"-via-utcnow"},"\u25c9 Via ",(0,i.kt)("inlineCode",{parentName:"h3"},"Utc::now()")),(0,i.kt)("p",null,"Ada banyak cara untuk membuat date time, dan kita akan bahas satu-per-satu."),(0,i.kt)("p",null,"Cara yang pertama, mari kita pelajari sambil praktek. Isi file program ",(0,i.kt)("inlineCode",{parentName:"p"},"main.rs")," dengan kode berikut, lalu jalankan."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'use chrono::prelude::*;\nuse std::time::{UNIX_EPOCH, Duration};\n\nfn main() {\n let sample_date1_in_utc: DateTime<Utc> = Utc::now();\n println!("sample date 1 (in utc): {sample_date1_in_utc}");\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"DateTime",src:a(6635).Z,width:"571",height:"95"})),(0,i.kt)("p",null,"Contoh sederhana di atas adalah salah satu cara membuat object datetime dengan isi adalah informasi waktu sekarang (waktu ketika baris kode tersebut dieksekusi)."),(0,i.kt)("p",null,"Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"Utc::now()")," mengembalikan informasi waktu sekarang dalam timezone UTC (representasi tipe data-nya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime<Utc>"),")."),(0,i.kt)("p",null,"Module item ",(0,i.kt)("inlineCode",{parentName:"p"},"Utc")," sendiri harus diimport terlebih dahulu agar bisa digunakan. Itulah kenapa ada statement ",(0,i.kt)("inlineCode",{parentName:"p"},"use chrono::prelude::*"),"."),(0,i.kt)("h3",{id:"-via-utcwith_ymd_and_hms"},"\u25c9 Via ",(0,i.kt)("inlineCode",{parentName:"h3"},"Utc.with_ymd_and_hms()")),(0,i.kt)("p",null,"Pembuatan object datetime dengan isi informasi waktu spesifik bisa dilakukan menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"Utc.with_ymd_and_hms()"),". Fungsi ini mewajibkan developer untuk mengisi 6 parameternya dengan segment waktu (tahun, bulan, dan lainnya)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let sample_date2_in_utc = Utc.with_ymd_and_hms(2023, 3, 1, 1, 2, 3).unwrap();\nprintln!("sample date 2 (in utc): {sample_date2_in_utc}");\n// output: sample date 2 (in utc): 2023-03-01 01:02:03 UTC\n')),(0,i.kt)("p",null,"Statement di atas menghasilkan data datetime dengan isi ",(0,i.kt)("inlineCode",{parentName:"p"},"2023-03-01 01:02:03 UTC"),"."),(0,i.kt)("h3",{id:"-via-datetimeutcfrom"},"\u25c9 Via ",(0,i.kt)("inlineCode",{parentName:"h3"},"DateTime::<Utc>::from()")),(0,i.kt)("p",null,"Cara ini pas digunakan pada situasi di mana kita perlu membuat object datetime dari sebuah ",(0,i.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Unix_time"},"UNIX timestamp"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let sample_date3_in_utc = DateTime::<Utc>::from(UNIX_EPOCH + Duration::from_secs(1524885322));\nprintln!("sample date 3 (in utc): {sample_date3_in_utc}");\n// output: sample date 3 (in utc): 2018-04-28 03:15:22 UTC\n')),(0,i.kt)("p",null,"Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime::<Utc>::from()")," di atas menghasilkan data datetime ",(0,i.kt)("inlineCode",{parentName:"p"},"2018-04-28 03:15:22 UTC"),", karena nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"1524885322")," adalah representasi UNIX time untuk waktu tersebut."),(0,i.kt)("h3",{id:"-via-string-method-parse"},"\u25c9 Via String method ",(0,i.kt)("inlineCode",{parentName:"h3"},"parse()")),(0,i.kt)("p",null,"Tipe data string bisa langsung dikonversi ke bentuk datetime menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"parse()")," yang dikombinasikan dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime<Utc>")," sebagai generic parameter."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let sample_date4_in_utc = "2023-03-01 01:02:03 UTC".parse::<DateTime<Utc>>().unwrap();\nprintln!("sample date 4 (in utc): {sample_date4_in_utc}");\n// output: sample date 4 (in utc): 2023-03-01 01:02:03 UTC\n')),(0,i.kt)("p",null,"Statement parsing di atas menghasilkan data datetime ",(0,i.kt)("inlineCode",{parentName:"p"},"2023-03-01 01:02:03 UTC"),", sesuai dengan isi data string."),(0,i.kt)("p",null,"O iya, perlu diketahui bahwa tidak semua string bisa di-parse ke bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime"),". Jika data string memiliki format yang tidak sesuai dengan aturan parsing di Rust, maka proses parsing menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"parse()")," pasti menghasilkan error."),(0,i.kt)("p",null,"Penerapan method ",(0,i.kt)("inlineCode",{parentName:"p"},"parse::<DateTime<Utc>>()")," sebenarnya mengembalikan tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result<DateTime<Utc>, ParseError>"),", itulah kenapa pada contoh perlu di chain lagi dengan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih detailnya mengenai tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Result")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/result-type"},"Tipe Data \u279c Result"))),(0,i.kt)("h3",{id:"-cara-lainnya"},"\u25c9 Cara lainnya"),(0,i.kt)("p",null,"Ada beberapa cara lain yang bisa digunakan untuk pembuatan object datetime, dan kita akan bahas juga sebentar lagi."),(0,i.kt)("h2",{id:"a524-utc-vs-local"},"A.52.4. ",(0,i.kt)("inlineCode",{parentName:"h2"},"Utc")," vs ",(0,i.kt)("inlineCode",{parentName:"h2"},"Local")),(0,i.kt)("p",null,"Kesemua cara yang sudah dipelajari di atas juga bisa diterapkan dalam pembuatan object date time dengan timezone offset ",(0,i.kt)("inlineCode",{parentName:"p"},"Local"),". Penerapannya kurang lebih sama, cukup ganti ",(0,i.kt)("inlineCode",{parentName:"p"},"Utc")," menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"Local"),"."),(0,i.kt)("p",null,"Jika disandingkan, akan seperti ini kodenya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let date1_in_utc: DateTime<Utc> = Utc::now();\nlet date2_in_utc = Utc.with_ymd_and_hms(2023, 3, 1, 1, 2, 3).unwrap();\nlet date3_in_utc = DateTime::<Utc>::from(UNIX_EPOCH + Duration::from_secs(1524885322));\nlet date4_in_utc = "2023-03-01 01:02:03 UTC".parse::<DateTime<Utc>>().unwrap();\n\nprintln!("sample date 1 (in utc): {date1_in_utc}");\nprintln!("sample date 2 (in utc): {date2_in_utc}");\nprintln!("sample date 3 (in utc): {date3_in_utc}");\nprintln!("sample date 4 (in utc): {date4_in_utc}");\n\n// vs\n\nlet date1_in_local_tz: DateTime<Local> = Local::now();\nlet date2_in_local_tz = Local.with_ymd_and_hms(2023, 3, 1, 1, 2, 3).unwrap();\nlet date3_in_local_tz = DateTime::<Local>::from(UNIX_EPOCH + Duration::from_secs(1524885322));\nlet date4_in_local_tz = "2023-03-01 01:02:03 UTC".parse::<DateTime<Local>>().unwrap();\n\nprintln!("sample date 1 (in local_tz): {date1_in_local_tz}");\nprintln!("sample date 2 (in local_tz): {date2_in_local_tz}");\nprintln!("sample date 3 (in local_tz): {date3_in_local_tz}");\nprintln!("sample date 4 (in local_tz): {date4_in_local_tz}");\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"DateTime",src:a(239).Z,width:"571",height:"231"})),(0,i.kt)("p",null,"Semoga cukup jelas."),(0,i.kt)("p",null,"Dari contoh di atas, sebenarnya ada 2 variabel yang menarik untuk dibahas, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"sample_date1_in_utc")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"sample_date1_in_local_tz"),". Dua variabel tersebut berisi informasi waktu sekarang, perbedaannya hanya pada timezone offset saja. Namun, meski timezone offset-nya berbeda, kedua datetime tersebut sejatinya adalah merepresentasikan waktu yang sama (ekuivalen)."),(0,i.kt)("p",null,"Agar lebih jelas, silakan perhatikan contoh berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"sample date 1 (in utc): 2023-03-02 09:53:44.561519500 UTC\nsample date 1 (in local_tz): 2023-03-02 16:53:44.562389600 +07:00\n")),(0,i.kt)("p",null,"Kedua datetime tersebut terpaku ",(0,i.kt)("strong",{parentName:"p"},"7 jam")," persis. Data ",(0,i.kt)("inlineCode",{parentName:"p"},"2023-03-02 09:53:44")," UTC (atau GMT+0), jika dikonversi ke waktu lokal penulis (WIB atau GMT+7) maka akan menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"2023-03-02 16:53:44"),". Selisihnya sesuai dengan timezone offset, yaitu 7 jam."),(0,i.kt)("h2",{id:"a525-tipe-naivedatetime"},"A.52.5. Tipe ",(0,i.kt)("inlineCode",{parentName:"h2"},"NaiveDateTime")),(0,i.kt)("p",null,"Rust memilik caranya sendiri dalam pengelolaan data datetime (yang menurut penulis cukup unik). Ada satu tipe data bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"NaiveDateTime"),", yang kegunaannya adalah untuk menampung tipe data datetime ",(0,i.kt)("strong",{parentName:"p"},"tanpa spesifik timezone offset"),"."),(0,i.kt)("p",null,"Tipe data ini sangat berguna dibeberapa case yang kebanyakan adalah perihal konversi data ke bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime"),"."),(0,i.kt)("p",null,"Mari kita praktekan dengan contoh agar lebih jelas. Dimisalkan ada keperluan di mana data UNIX time perlu di konversi ke 2 bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime"),", dengan timezone offset ",(0,i.kt)("inlineCode",{parentName:"p"},"Utc")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Local"),". Pada kasus ini, cara ke-3 dari praktek sebelumnya bisa dilakukan untuk penyelesaian case ini."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let timestamp: u64 = 1524885322;\nlet date2_in_utc = DateTime::<Utc>::from(UNIX_EPOCH + Duration::from_secs(timestamp));\nlet date2_in_local_tz = DateTime::<Local>::from(UNIX_EPOCH + Duration::from_secs(timestamp));\n")),(0,i.kt)("p",null,"Cara lain adalah dengan menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"NaiveDateTime"),", yang contoh penerapannnya kurang lebih seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let timestamp_in_ms: i64 = 1524885322000;\nlet naive_date_time: NaiveDateTime = NaiveDateTime::from_timestamp_millis(timestamp_in_ms).unwrap();\n\nlet sample_date_in_utc = Utc.from_utc_datetime(&naive_date_time);\nlet sample_date_in_local_tz = Local.from_local_datetime(&naive_date_time).unwrap();\n\nprintln!("sample date 1 (in utc): {sample_date_in_utc}");\nprintln!("sample date 2 (in local_tz): {sample_date_in_local_tz}");\n\n// output:\n// sample date 1 (in utc): 2018-04-28 03:15:22 UTC\n// sample date 2 (in local_tz): 2018-04-28 03:15:22 +07:00\n')),(0,i.kt)("p",null,"Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"NaiveDateTime::from_timestamp_millis")," berguna untuk mengkonversi data UNIX time (milisecond) ke bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"NaiveDateTime"),". Kemudian, dari data tersebut dapat kita konversi lagi ke bentuk UTC dengan mudah menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"Utc.from_utc_datetime()")," dan local timezone menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"Local.from_local_datetime()"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"DateTime",src:a(2330).Z,width:"571",height:"115"})),(0,i.kt)("p",null,"Bisa dilihat pada output di atas, bahwa hasil data datetime berbeda untuk timezone UTC dan local."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Jangan sampai bingung, 2 data datetime di atas tidak sama dan tidak ekuivalen meskipun informasi jam menit detiknya sama persis. Hal ini dikarenakan timezone offset-nya berbeda.")),(0,i.kt)("h2",{id:"a526-konversi-datetime-utc-ke-local-timezone-dan-sebaliknya"},"A.52.6. Konversi datetime UTC ke local timezone, dan sebaliknya"),(0,i.kt)("p",null,"Dalam bekerja dengan tipe data datetime, selalu memperhatikan timezone adalah hal yang sangat penting. Bisa saja dua buah datetime memiliki informasi tanggal dan waktu sama persis, tapi jika timezone-nya berbeda maka keduanya adalah berbeda!"),(0,i.kt)("p",null,"Agar lebih jelas, silakan perhatikan kode berikut beserta outputnya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let date1_in_local_tz: DateTime<Local> = Local::now();\nprintln!("date (in local): {date1_in_local_tz}");\n\nlet date_in_utc = DateTime::<Utc>::from(date1_in_local_tz);\nprintln!("date (in utc): {date_in_utc}");\n\nlet date2_in_local_tz = DateTime::<Local>::from(date_in_utc);\nprintln!("date (in local): {date2_in_local_tz}");\n\n// output:\n// date (in local): 2023-03-02 17:33:37.750279900 +07:00\n// date (in utc): 2023-03-02 10:33:37.750279900 UTC\n// date (in local): 2023-03-02 17:33:37.750279900 +07:00\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"DateTime",src:a(7934).Z,width:"571",height:"129"})),(0,i.kt)("p",null,"Ketiga data datetime di atas adalah ekuivalen:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"date1_in_local_tz")," berisi informasi datetime waktu sekarang, dengan timezone GMT+7."),(0,i.kt)("li",{parentName:"ul"},"Variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"date_in_utc")," adalah datetime yang ekuivalen dengan ",(0,i.kt)("inlineCode",{parentName:"li"},"date1_in_local_tz"),", hanya saja direpresentasikan dalam timezone UTC."),(0,i.kt)("li",{parentName:"ul"},"Variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"date2_in_local_tz")," juga ekuivalen dengan ",(0,i.kt)("inlineCode",{parentName:"li"},"date_in_utc")," dan juga ",(0,i.kt)("inlineCode",{parentName:"li"},"date1_in_local_tz"),".")),(0,i.kt)("p",null,"Data ",(0,i.kt)("inlineCode",{parentName:"p"},"2023-03-02 10 UTC")," jika ditambah 7 jam offset, maka menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"2023-03-02 17 GMT+7"),"."),(0,i.kt)("h2",{id:"a527-unix-time"},"A.52.7. UNIX time"),(0,i.kt)("p",null,"Cara konversi data ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime")," ke bentuk UNIX time bisa dilakukan lewat 3 cara:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"menggunakan method ",(0,i.kt)("inlineCode",{parentName:"li"},"timestamp"),", nilai baliknya dalam bentuk detik/second"),(0,i.kt)("li",{parentName:"ul"},"menggunakan method ",(0,i.kt)("inlineCode",{parentName:"li"},"timestamp_millis"),", nilai baliknya dalam bentuk miliseconds"),(0,i.kt)("li",{parentName:"ul"},"menggunakan method ",(0,i.kt)("inlineCode",{parentName:"li"},"timestamp_micros"),", nilai baliknya dalam bentuk microseconds")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let date_in_local_tz: DateTime<Local> = Local::now();\nprintln!("date: {date_in_local_tz}");\nprintln!("date (in second timestamp): {}", date_in_local_tz.timestamp());\nprintln!("date (in milisecond timestamp): {}", date_in_local_tz.timestamp_millis());\nprintln!("date (in microsecond timestamp): {}", date_in_local_tz.timestamp_micros());\n')),(0,i.kt)("p",null,"Sedangkan cara untuk mengkonversi data timestamp ke bentuk ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime")," bisa dilakukan via ",(0,i.kt)("inlineCode",{parentName:"p"},"NaiveDateTime")," ataupun ",(0,i.kt)("inlineCode",{parentName:"p"},"DateTime::from"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'// via NaiveDateTime\nlet naive_date_time = NaiveDateTime::from_timestamp_millis(date_in_local_tz.timestamp_millis()).unwrap();\nlet new_datetime1 = Local.from_local_datetime(&naive_date_time).unwrap();\nprintln!("date1: {new_datetime1}");\n\n// via DateTime::from\nlet new_datetime2 = DateTime::<Local>::from(UNIX_EPOCH + Duration::from_millis(date_in_local_tz.timestamp_millis().unsigned_abs()));\nprintln!("date2: {new_datetime2}");\n')),(0,i.kt)("p",null,"Output program di atas:"),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"DateTime",src:a(6451).Z,width:"571",height:"182"})),(0,i.kt)("h2",{id:"a528-date-formatting--parsing"},"A.52.8. Date formatting & parsing"),(0,i.kt)("p",null,"Konversi datetime ke string (atau biasa disebut dengan date formatting) dilakukan menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"format")," yang dalam penerapannya membutuhkan argument ",(0,i.kt)("em",{parentName:"p"},"datetime formatting syntax"),"."),(0,i.kt)("p",null,"Sedangkan konversi dari string ke datetime dilakukan via ",(0,i.kt)("inlineCode",{parentName:"p"},"Local.datetime_from_str")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"Utc.datetime_from_str"),"."),(0,i.kt)("p",null,"Contoh pengaplikasian keduanya bisa dilihat pada kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let date1: DateTime<Local> = Local::now();\nprintln!("date1 (in local): {}", date1);\n// date1 (in local): 2023-03-02 18:13:39.954831600 +07:00\n\nlet str_from_date1 = date1.format("%Y-%m-%d %H:%M:%S %z").to_string();\nprintln!("date1 (in string): {}", str_from_date1);\n// date1 (in string): 2023-03-02 18:13:39 +0700\n\nlet date1_from_str = Local.datetime_from_str(&str_from_date1, "%Y-%m-%d %H:%M:%S %z").unwrap();\nprintln!("date1 (in local): {}", date1_from_str);\n// date1 (in local): 2023-03-02 18:13:39 +07:00\n\nlet date2_from_str = Utc.datetime_from_str("03/01/2023 13:04 +0000", "%m/%d/%Y %H:%M %z").unwrap();\nprintln!("date2 (in utc): {}", date2_from_str);\n// date2 (in utc): 2023-03-01 13:04:00 UTC\n\nlet str_from_date2 = date2_from_str.format("%Y-%m-%d %H:%M:%S %z").to_string();\nprintln!("date2 (in string): {}", str_from_date2);\n// date2 (in string): 2023-03-01 13:04:00 +0000\n')),(0,i.kt)("h2",{id:"a529-datetime-formatting-syntax"},"A.52.9. DateTime formatting syntax"),(0,i.kt)("p",null,"Berikut adalah tabel formatting syntax untuk tipe data datetime."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Selengkapnya silakan cek ",(0,i.kt)("a",{parentName:"p",href:"https://docs.rs/chrono/latest/chrono/format/strftime/index.html"},"https://docs.rs/chrono/latest/chrono/format/strftime/index.html"))),(0,i.kt)("h3",{id:"-date-specifiers"},"\u25c9 Date specifiers"),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:"center"},"Spec"),(0,i.kt)("th",{parentName:"tr",align:"center"},"Example"),(0,i.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%Y"),(0,i.kt)("td",{parentName:"tr",align:"center"},"2001"),(0,i.kt)("td",{parentName:"tr",align:"left"},"The full proleptic Gregorian year, zero-padded to 4 digits. chrono supports years from -262144 to 262143.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%C"),(0,i.kt)("td",{parentName:"tr",align:"center"},"20"),(0,i.kt)("td",{parentName:"tr",align:"left"},"The proleptic Gregorian year divided by 100, zero-padded to 2 digits. 1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%y"),(0,i.kt)("td",{parentName:"tr",align:"center"},"01"),(0,i.kt)("td",{parentName:"tr",align:"left"},"The proleptic Gregorian year modulo 100, zero-padded to 2 digits. 1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%m"),(0,i.kt)("td",{parentName:"tr",align:"center"},"07"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Month number (01\u201312), zero-padded to 2 digits.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%b"),(0,i.kt)("td",{parentName:"tr",align:"center"},"Jul"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Abbreviated month name. Always 3 letters.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%B"),(0,i.kt)("td",{parentName:"tr",align:"center"},"July"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Full month name. Also accepts corresponding abbreviation in parsing.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%h"),(0,i.kt)("td",{parentName:"tr",align:"center"},"Jul"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Same as %b.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%d"),(0,i.kt)("td",{parentName:"tr",align:"center"},"08"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Day number (01\u201331), zero-padded to 2 digits.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%e"),(0,i.kt)("td",{parentName:"tr",align:"center"},"8"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Same as %d but space-padded. Same as %_d.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%a"),(0,i.kt)("td",{parentName:"tr",align:"center"},"Sun"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Abbreviated weekday name. Always 3 letters.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%A"),(0,i.kt)("td",{parentName:"tr",align:"center"},"Sunday"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Full weekday name. Also accepts corresponding abbreviation in parsing.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%w"),(0,i.kt)("td",{parentName:"tr",align:"center"},"0"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Sunday = 0, Monday = 1, \u2026, Saturday = 6.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%u"),(0,i.kt)("td",{parentName:"tr",align:"center"},"7"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Monday = 1, Tuesday = 2, \u2026, Sunday = 7. (ISO 8601)")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%U"),(0,i.kt)("td",{parentName:"tr",align:"center"},"28"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Week number starting with Sunday (00\u201353), zero-padded to 2 digits. 2")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%W"),(0,i.kt)("td",{parentName:"tr",align:"center"},"27"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Same as %U, but week 1 starts with the first Monday in that year instead.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%G"),(0,i.kt)("td",{parentName:"tr",align:"center"},"2001"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Same as %Y but uses the year number in ISO 8601 week date. 3")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%g"),(0,i.kt)("td",{parentName:"tr",align:"center"},"01"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Same as %y but uses the year number in ISO 8601 week date. 3")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%V"),(0,i.kt)("td",{parentName:"tr",align:"center"},"27"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Same as %U but uses the week number in ISO 8601 week date (01\u201353). 3")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%j"),(0,i.kt)("td",{parentName:"tr",align:"center"},"189"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Day of the year (001\u2013366), zero-padded to 3 digits.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%D"),(0,i.kt)("td",{parentName:"tr",align:"center"},"07/08/01"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Month-day-year format. Same as %m/%d/%y.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%x"),(0,i.kt)("td",{parentName:"tr",align:"center"},"07/08/01"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Locale\u2019s date representation (e.g., 12/31/99).")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%F"),(0,i.kt)("td",{parentName:"tr",align:"center"},"2001-07-08"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Year-month-day format (ISO 8601). Same as %Y-%m-%d.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%v"),(0,i.kt)("td",{parentName:"tr",align:"center"},"8-Jul-2001"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Day-month-year format. Same as %e-%b-%Y.")))),(0,i.kt)("h3",{id:"-time-specifiers"},"\u25c9 Time specifiers"),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:"center"},"Spec"),(0,i.kt)("th",{parentName:"tr",align:"center"},"Example"),(0,i.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%H"),(0,i.kt)("td",{parentName:"tr",align:"center"},"00"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Hour number (00\u201323), zero-padded to 2 digits.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%k"),(0,i.kt)("td",{parentName:"tr",align:"center"},"0"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Same as %H but space-padded. Same as %_H.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%I"),(0,i.kt)("td",{parentName:"tr",align:"center"},"12"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Hour number in 12-hour clocks (01\u201312), zero-padded to 2 digits.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%l"),(0,i.kt)("td",{parentName:"tr",align:"center"},"12"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Same as %I but space-padded. Same as %_I.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%P"),(0,i.kt)("td",{parentName:"tr",align:"center"},"am"),(0,i.kt)("td",{parentName:"tr",align:"left"},"am or pm in 12-hour clocks.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%p"),(0,i.kt)("td",{parentName:"tr",align:"center"},"AM"),(0,i.kt)("td",{parentName:"tr",align:"left"},"AM or PM in 12-hour clocks.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%M"),(0,i.kt)("td",{parentName:"tr",align:"center"},"34"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Minute number (00\u201359), zero-padded to 2 digits.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%S"),(0,i.kt)("td",{parentName:"tr",align:"center"},"60"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Second number (00\u201360), zero-padded to 2 digits. 4")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%f"),(0,i.kt)("td",{parentName:"tr",align:"center"},"026490000"),(0,i.kt)("td",{parentName:"tr",align:"left"},"The fractional seconds (in nanoseconds) since last whole second. 5")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%.f"),(0,i.kt)("td",{parentName:"tr",align:"center"},".026490"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Similar to .%f but left-aligned. These all consume the leading dot. 5")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%.3f"),(0,i.kt)("td",{parentName:"tr",align:"center"},".026"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Similar to .%f but left-aligned but fixed to a length of 3. 5")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%.6f"),(0,i.kt)("td",{parentName:"tr",align:"center"},".026490"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Similar to .%f but left-aligned but fixed to a length of 6. 5")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%.9f"),(0,i.kt)("td",{parentName:"tr",align:"center"},".026490000"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Similar to .%f but left-aligned but fixed to a length of 9. 5")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%3f"),(0,i.kt)("td",{parentName:"tr",align:"center"},"026"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Similar to %.3f but without the leading dot. 5")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%6f"),(0,i.kt)("td",{parentName:"tr",align:"center"},"026490"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Similar to %.6f but without the leading dot. 5")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%9f"),(0,i.kt)("td",{parentName:"tr",align:"center"},"026490000"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Similar to %.9f but without the leading dot. 5")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%R"),(0,i.kt)("td",{parentName:"tr",align:"center"},"00:34"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Hour-minute format. Same as %H:%M.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%T"),(0,i.kt)("td",{parentName:"tr",align:"center"},"00:34:60"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Hour-minute-second format. Same as %H:%M:%S.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%X"),(0,i.kt)("td",{parentName:"tr",align:"center"},"00:34:60"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Locale\u2019s time representation (e.g., 23:13:48).")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%r"),(0,i.kt)("td",{parentName:"tr",align:"center"},"12:34:60 AM"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Hour-minute-second format in 12-hour clocks. Same as %I:%M:%S %p.")))),(0,i.kt)("h3",{id:"-timezone-specifiers"},"\u25c9 Timezone specifiers"),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:"center"},"Spec"),(0,i.kt)("th",{parentName:"tr",align:"center"},"Example"),(0,i.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%Z"),(0,i.kt)("td",{parentName:"tr",align:"center"},"ACST"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Local time zone name. Skips all non-whitespace characters during parsing. 6")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%z"),(0,i.kt)("td",{parentName:"tr",align:"center"},"+0930"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Offset from the local time to UTC (with UTC being +0000).")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%:z"),(0,i.kt)("td",{parentName:"tr",align:"center"},"+09:30"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Same as %z but with a colon.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%::z"),(0,i.kt)("td",{parentName:"tr",align:"center"},"+09:30:00"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Offset from the local time to UTC with seconds.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%:::z"),(0,i.kt)("td",{parentName:"tr",align:"center"},"+09"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Offset from the local time to UTC without minutes.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%#z"),(0,i.kt)("td",{parentName:"tr",align:"center"},"+09"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Parsing only: Same as %z but allows minutes to be missing or present.")))),(0,i.kt)("h3",{id:"-date--time-specifiers"},"\u25c9 Date & time specifiers"),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:"center"},"Spec"),(0,i.kt)("th",{parentName:"tr",align:"center"},"Example"),(0,i.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"Sun Jul 8 00:34:60 2001"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Locale\u2019s date and time (e.g., Thu Mar 3 23:05:25 2005).")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%+"),(0,i.kt)("td",{parentName:"tr",align:"center"},"2001-07-08T00:34:60.026490+09:30"),(0,i.kt)("td",{parentName:"tr",align:"left"},"ISO 8601 / RFC 3339 date & time format. 7")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%s"),(0,i.kt)("td",{parentName:"tr",align:"center"},"994518299"),(0,i.kt)("td",{parentName:"tr",align:"left"},"UNIX timestamp, the number of seconds since 1970-01-01 00:00 UTC. 8")))),(0,i.kt)("h3",{id:"-special-specifiers"},"\u25c9 Special specifiers"),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:"center"},"Spec"),(0,i.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%t"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Literal tab (\\t).")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%n"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Literal newline (\\n).")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:"center"},"%%"),(0,i.kt)("td",{parentName:"tr",align:"left"},"Literal percent sign.")))),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/datetime"},"github.com/novalagung/dasarpemrogramanrust-example/../datetime")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/result-type"},"Tipe Data \u279c Result")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/generics"},"Generic"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/time/index.html"},"https://doc.rust-lang.org/std/time/index.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://docs.rs/time/latest/time/"},"https://docs.rs/time/latest/time/")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://github.com/rust-lang/rust-wiki-backup/blob/master/Lib-datetime.md"},"https://github.com/rust-lang/rust-wiki-backup/blob/master/Lib-datetime.md")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://docs.rs/chrono/latest/chrono/"},"https://docs.rs/chrono/latest/chrono/"))))}k.isMDXComponent=!0},6635:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/datetime-1-c0119211ce2f1f5f14eaf24316a52b54.png"},239:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/datetime-2-998514b9bc7ad92870392305578f2a14.png"},2330:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/datetime-3-52a5ccd1fb458c09958eafdba3f6c0d4.png"},7934:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/datetime-4-62b94d0c3e24bea70a3355c814ed8d79.png"},6451:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/datetime-5-eb678ecf97453409d153b4f9727e6347.png"}}]); \ No newline at end of file diff --git a/assets/js/b28a365a.28a71aca.js b/assets/js/b28a365a.28a71aca.js deleted file mode 100644 index 66f1172c..00000000 --- a/assets/js/b28a365a.28a71aca.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[6794],{3905:(a,e,n)=>{n.d(e,{Zo:()=>s,kt:()=>b});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function l(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function r(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function k(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},l=Object.keys(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var o=t.createContext({}),p=function(a){var e=t.useContext(o),n=e;return a&&(n="function"==typeof a?a(e):r(r({},e),a)),n},s=function(a){var e=p(a.components);return t.createElement(o.Provider,{value:e},a.children)},d={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},u=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,l=a.originalType,o=a.parentName,s=k(a,["components","mdxType","originalType","parentName"]),u=p(n),b=i,c=u["".concat(o,".").concat(b)]||u[b]||d[b]||l;return n?t.createElement(c,r(r({ref:e},s),{},{components:n})):t.createElement(c,r({ref:e},s))}));function b(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var l=n.length,r=new Array(l);r[0]=u;var k={};for(var o in e)hasOwnProperty.call(e,o)&&(k[o]=e[o]);k.originalType=a,k.mdxType="string"==typeof a?a:i,r[1]=k;for(var p=2;p<l;p++)r[p]=n[p];return t.createElement.apply(null,r)}return t.createElement.apply(null,n)}u.displayName="MDXCreateElement"},7356:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>o,contentTitle:()=>r,default:()=>d,frontMatter:()=>l,metadata:()=>k,toc:()=>p});var t=n(7462),i=(n(7294),n(3905));const l={sidebar_position:30,title:"A.30. Block Expression",sidebar_label:"A.30. Block Expression"},r=void 0,k={unversionedId:"basic/block-expression",id:"basic/block-expression",title:"A.30. Block Expression",description:"Pada chapter ini kita akan belajar tentang block expression.",source:"@site/docs/basic/block-expression.md",sourceDirName:"basic",slug:"/basic/block-expression",permalink:"/basic/block-expression",draft:!1,tags:[],version:"current",sidebarPosition:30,frontMatter:{sidebar_position:30,title:"A.30. Block Expression",sidebar_label:"A.30. Block Expression"},sidebar:"tutorialSidebar",previous:{title:"A.29. Module System \u279c Use, Import, Re-export",permalink:"/basic/use"},next:{title:"A.31. Shadowing",permalink:"/basic/shadowing"}},o={},p=[{value:"A.30.1. Konsep dan penerapan block",id:"a301-konsep-dan-penerapan-block",level:2},{value:"A.30.2. Return value block",id:"a302-return-value-block",level:2},{value:"A.30.3. Nested block",id:"a303-nested-block",level:2},{value:"A.30.4. Labeled block",id:"a304-labeled-block",level:2},{value:"A.30.5. Async block",id:"a305-async-block",level:2},{value:"A.30.6. <em>Unsafe</em> block",id:"a306-unsafe-block",level:2},{value:"A.30.7 Manfaat penerapan block",id:"a307-manfaat-penerapan-block",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],s={toc:p};function d(a){let{components:e,...l}=a;return(0,i.kt)("wrapper",(0,t.Z)({},s,l,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan belajar tentang block expression."),(0,i.kt)("h2",{id:"a301-konsep-dan-penerapan-block"},"A.30.1. Konsep dan penerapan block"),(0,i.kt)("p",null,"Block expression (atau cukup block), adalah salah satu control flow yang ada di Rust yang berguna untuk isolasi items, variabel, ataupun proses dalam sebuah scope yang sifatnya ",(0,i.kt)("em",{parentName:"p"},"anonymous"),"."),(0,i.kt)("p",null,"Block expression berbeda jika dibandingkan block kode ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," (yang berarti dia adalah milik ",(0,i.kt)("inlineCode",{parentName:"p"},"if"),") atau block kode fungsi (yang dia adalah milik fungsi), block expression tidak berasosiasi dengan keyword tertentu / ",(0,i.kt)("em",{parentName:"p"},"anonymous"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pada ebook ini, penulis akan menggunakan istilah ",(0,i.kt)("strong",{parentName:"p"},"block fungsi")," untuk block fungsi, ",(0,i.kt)("strong",{parentName:"p"},"block kode if")," untuk block kode seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"if"),", dan ",(0,i.kt)("strong",{parentName:"p"},"block kode X")," untuk X."),(0,i.kt)("p",{parentName:"blockquote"},"Untuk block expression, penulis akan gunakan istilah ",(0,i.kt)("strong",{parentName:"p"},"block expression")," atau cukup ",(0,i.kt)("strong",{parentName:"p"},"block")," saja.")),(0,i.kt)("p",null,"Cara penerapan block cukup dengan menuliskan kode program diapit di antara tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"{")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"}"),". Contoh penerapannya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let x = 24;\n println!("x: {}", x);\n\n {\n println!("(from block) x: {}", x);\n\n let y = 12;\n let z = x + y;\n println!("(from block) y: {}", y);\n println!("(from block) z: {}", z);\n }\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Block",src:n(9379).Z,width:"460",height:"144"})),(0,i.kt)("p",null,"Pada contoh di atas, dalam fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," ada variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," yang dideklarasikan kemudian di-print. Setelahnya diikuti statement block expression. Bisa dilihat seperti itu kurang lebih cara penulisannya."),(0,i.kt)("p",null,"Di dalam block, nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," di-print. Operasi seperti ini bisa dilakukan, karena ",(0,i.kt)("em",{parentName:"p"},"by default")," semua items pada scope di luar block adalah bisa diakses dari dalam block. Contohnya adalah variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," yang deklarasinya berada di luar block, tapi diakses di dalam block."),(0,i.kt)("p",null,"Kemudian ada beberapa variabel baru yang didefinisikan di dalam block, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"y")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"z")," yang variabel tersebut juga di-print. Variabel tersebut akan valid sampai eksekusi block selesai. Intinya semua statement dalam block expression ter-isolasi dalam anonymous scope tersebut. Setelah block kode selesai dieksekusi, jika kita berusaha memanggil items yang ada di dalam block dengan pemanggilan dari luar scope, hasilnya error."),(0,i.kt)("p",null,"Sebagai contoh, kode berikut menghasilkan error:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let x = 24;\n\n{\n let y = 12;\n let z = x + y;\n};\n\nprintln!("z: {}", z); // <------ error\n')),(0,i.kt)("p",null,"O iya, dalam penulisannya, statement block harus diikuti tanda semicolon ",(0,i.kt)("inlineCode",{parentName:"p"},";")," sebagai penanda akhir statement, dengan beberapa pengecualian yang akan ikut dibahas pada section setelah ini."),(0,i.kt)("h2",{id:"a302-return-value-block"},"A.30.2. Return value block"),(0,i.kt)("p",null,"Sebuah block expression bisa memiliki return value, dengannya maka nilainya bisa ditampung dalam sebuah variabel. Cara penerapannya menggunakan notasi berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let varOne = {\n // ...\n returnValue\n};\n\nlet varTwo: tipeData = {\n // ...\n returnValue\n};\n")),(0,i.kt)("p",null,"Dalam block expression, tidak perlu menuliskan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"return")," dan tidak perlu juga menuliskan tanda semicolon di akhir statement return value."),(0,i.kt)("p",null,"Berikut adalah contoh praktik return value block. Ada sebuah block yang nilai baliknya ditampung ke variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"a"),". Isi block sendiri adalah generate data numerik random, yang kemudian dikalikan dengan angka ",(0,i.kt)("inlineCode",{parentName:"p"},"2"),", lalu dijadikan return value."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'use rand::Rng;\n\nfn main() {\n let a: i32 = {\n let n = rand::thread_rng().gen_range(0..100);\n n * 2\n };\n\n println!("a: {}", a);\n}\n')),(0,i.kt)("h2",{id:"a303-nested-block"},"A.30.3. Nested block"),(0,i.kt)("p",null,"Block bisa berada di dalam block. Contohnya seperti kode berikut, nested block dengan kedalaman 3 layer."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'{\n let b = 12;\n let mut total = 0;\n\n {\n let c = 13;\n\n {\n let d = 14;\n total = b + c + d;\n }\n }\n\n println!("{total}")\n}\n')),(0,i.kt)("p",null,"Tidak ada yang istimewa tentang cara penulisan nested block. Langsung tulis saja block expression dalam block sesuai kebutuhan."),(0,i.kt)("h2",{id:"a304-labeled-block"},"A.30.4. Labeled block"),(0,i.kt)("p",null,"Tak hanya perulangan, sebuah block expression juga bisa memiliki label. Cara penerapannya dengan menuliskan nama label (diawaili dengan tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"'"),"), kemudian diikuti tanda ",(0,i.kt)("inlineCode",{parentName:"p"},":")," dan block expression. Silakan lihat notasi penulisan berikut agar lebih jelas:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"'nama_label: {\n // ...\n}\n")),(0,i.kt)("p",null,"Mari coba terapkan. Pada kode berikut, ada block expression dengan nama ",(0,i.kt)("inlineCode",{parentName:"p"},"'append_with_even_number"),"."),(0,i.kt)("p",null,"Di dalam block itu, ada proses generate data numerik secara acak. Angka random tersebut kemudian di cek, jika ganjil maka block expression dihentikan secara paksa. Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"break 'append_with_even_number")," artinya menghentikan eksekusi block ",(0,i.kt)("inlineCode",{parentName:"p"},"'append_with_even_number"),"."),(0,i.kt)("p",null,"Jika angka genap, maka ditambahkan ke ",(0,i.kt)("inlineCode",{parentName:"p"},"total")," kemudian di-print."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn main() {\n {\n let mut total = 24;\n\n 'append_with_even_number: {\n let n = rand::thread_rng().gen_range(0..100);\n\n if n % 2 == 1 {\n break 'append_with_even_number\n }\n\n total = n\n }\n\n println!(\"{total}\");\n }\n}\n")),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Block",src:n(8872).Z,width:"457",height:"108"})),(0,i.kt)("h2",{id:"a305-async-block"},"A.30.5. Async block"),(0,i.kt)("p",null,"Pembahasan mengenai asynchronous block ada pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/async"},"Async"),"."),(0,i.kt)("h2",{id:"a306-unsafe-block"},"A.30.6. ",(0,i.kt)("em",{parentName:"h2"},"Unsafe")," block"),(0,i.kt)("p",null,"Pembahasan mengenai unsafe block expression ada pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/safe-unsafe"},"Safe & Unsafe"),"."),(0,i.kt)("h2",{id:"a307-manfaat-penerapan-block"},"A.30.7 Manfaat penerapan block"),(0,i.kt)("p",null,"Block biasa diterapkan untuk isolasi sebuah proses yang tidak perlu di-reuse. Jika proses adalah di-reuse, dianjurkan untuk menggunakan fungsi dalam penerapannya."),(0,i.kt)("p",null,"Di bahasa pemrograman lain juga ada block yang penerapannya kurang lebih adalah sama. Namun perlu diketahui, di Rust block memiliki berbedaan yang bisa dibilang signifikan, yaitu dalam hal manajemen memory."),(0,i.kt)("p",null,"Rust menerapkan konsep memory management bernama ",(0,i.kt)("strong",{parentName:"p"},"ownership"),". Setiap kali Rust selesai mengeksekusi block kode, baik itu fungsi, block expression, atau jenis block lainnya; akan dilakukan evaluasi pengecekan ownership yang ada dalam block tersebut. Untuk data yang owner-nya tidak berpindah ke luar scope, maka akan dilakukan proses dealokasi memory untuk data tersebut. Dengan approach ini penggunaan memory menjadi efisien."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai memory management dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/basic-memory-management"},"Memory Management")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai ownership dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/ownership"},"Ownership"))),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/block_expression"},"github.com/novalagung/dasarpemrogramanrust-example/../block_expression")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/expressions/block-expr.html"},"https://doc.rust-lang.org/reference/expressions/block-expr.html"))))}d.isMDXComponent=!0},9379:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcwAAACQCAIAAAAKgszpAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4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W0sXip81Fo4HnpOhguxrSxlJ7CIOaIUPHdI/FShz6rZVfC7xVIhXlxdq2z9sTLJtJbQly64nUkA+bSFavwK1diTN8VRgOVKJh60oXCxbbWjRap3Y7eoBFo1FF85i15XkpphtNguOlU67O2iLY/zPbrnNrqUxa10yyK7l1ZMMu6jp+3mqSrK50ZkN62wN3n+W6XlS6WE7GjUSjYeneEYVyWx40J02NP2frxbez23ON8v6gqdZ2ZWXgmA6KguOLVtvj3BptZnnmhCGB6+LWy6KIsR6DEuN+2vpYVox5vZ2KSD1f2T4JV8sEuXVVZN8i7H3YDbn1AmLMu64nuZUgt7aDPCawIbGCmEC7k72xesKPeFbVi9xKkFsJgiDIrQRBEORWgiAIgtxKEARBbiUIgiC3EgRBEORWgiAIcitBEAS5lSAIgiC3EgRBvBpu/evf//53wp/f6Kf//v2LtiQIgqjh1hf6HLjz95+cR4/M+ufPH3IrQRDEOTGBI7mOruuRWV9Y9Te5lSAIYiluPTFrd43cShAEMZtb05DAxKjkVoIgiNnc2u1aDfGAlE/JrQRBEPO4tSPWiUGPDqxAeYSAIAiC3BonVhApoN9KEARRya3CSS2YlNxKEAQxLyZAEARBkFsJgiDIrQRBEORWgiAIgtxKEARBbiUIgiC3EgRBEORWgiAIcitBEAS5lSAIgiC3EgRBkFsJgiDIrQRBENeM/wOwdHL7sTryCQAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/b28a365a.9d9c87da.js b/assets/js/b28a365a.9d9c87da.js new file mode 100644 index 00000000..9512cf00 --- /dev/null +++ b/assets/js/b28a365a.9d9c87da.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[6794],{3905:(a,e,n)=>{n.d(e,{Zo:()=>s,kt:()=>b});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function l(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function r(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function k(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},l=Object.keys(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var o=t.createContext({}),p=function(a){var e=t.useContext(o),n=e;return a&&(n="function"==typeof a?a(e):r(r({},e),a)),n},s=function(a){var e=p(a.components);return t.createElement(o.Provider,{value:e},a.children)},d={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},u=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,l=a.originalType,o=a.parentName,s=k(a,["components","mdxType","originalType","parentName"]),u=p(n),b=i,c=u["".concat(o,".").concat(b)]||u[b]||d[b]||l;return n?t.createElement(c,r(r({ref:e},s),{},{components:n})):t.createElement(c,r({ref:e},s))}));function b(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var l=n.length,r=new Array(l);r[0]=u;var k={};for(var o in e)hasOwnProperty.call(e,o)&&(k[o]=e[o]);k.originalType=a,k.mdxType="string"==typeof a?a:i,r[1]=k;for(var p=2;p<l;p++)r[p]=n[p];return t.createElement.apply(null,r)}return t.createElement.apply(null,n)}u.displayName="MDXCreateElement"},7356:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>o,contentTitle:()=>r,default:()=>d,frontMatter:()=>l,metadata:()=>k,toc:()=>p});var t=n(7462),i=(n(7294),n(3905));const l={sidebar_position:30,title:"A.30. Block Expression",sidebar_label:"A.30. Block Expression"},r=void 0,k={unversionedId:"basic/block-expression",id:"basic/block-expression",title:"A.30. Block Expression",description:"Pada chapter ini kita akan belajar tentang block expression.",source:"@site/docs/basic/block-expression.md",sourceDirName:"basic",slug:"/basic/block-expression",permalink:"/basic/block-expression",draft:!1,tags:[],version:"current",sidebarPosition:30,frontMatter:{sidebar_position:30,title:"A.30. Block Expression",sidebar_label:"A.30. Block Expression"},sidebar:"tutorialSidebar",previous:{title:"A.29. Module System \u279c Use, Import, Re-export",permalink:"/basic/use"},next:{title:"A.31. Shadowing",permalink:"/basic/shadowing"}},o={},p=[{value:"A.30.1. Konsep dan penerapan block",id:"a301-konsep-dan-penerapan-block",level:2},{value:"A.30.2. Return value block",id:"a302-return-value-block",level:2},{value:"A.30.3. Nested block",id:"a303-nested-block",level:2},{value:"A.30.4. Labeled block",id:"a304-labeled-block",level:2},{value:"A.30.5. Async block",id:"a305-async-block",level:2},{value:"A.30.6. <em>Unsafe</em> block",id:"a306-unsafe-block",level:2},{value:"A.30.7 Manfaat penerapan block",id:"a307-manfaat-penerapan-block",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],s={toc:p};function d(a){let{components:e,...l}=a;return(0,i.kt)("wrapper",(0,t.Z)({},s,l,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan belajar tentang block expression."),(0,i.kt)("h2",{id:"a301-konsep-dan-penerapan-block"},"A.30.1. Konsep dan penerapan block"),(0,i.kt)("p",null,"Block expression (atau cukup block), adalah salah satu control flow yang ada di Rust yang berguna untuk isolasi items, variabel, ataupun proses dalam sebuah scope yang sifatnya ",(0,i.kt)("em",{parentName:"p"},"anonymous"),"."),(0,i.kt)("p",null,"Block expression berbeda jika dibandingkan block kode ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," (yang berarti dia adalah milik ",(0,i.kt)("inlineCode",{parentName:"p"},"if"),") atau block kode fungsi (yang dia adalah milik fungsi), block expression tidak berasosiasi dengan keyword tertentu / ",(0,i.kt)("em",{parentName:"p"},"anonymous"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pada ebook ini, penulis akan menggunakan istilah ",(0,i.kt)("strong",{parentName:"p"},"block fungsi")," untuk block fungsi, ",(0,i.kt)("strong",{parentName:"p"},"block kode if")," untuk block kode seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"if"),", dan ",(0,i.kt)("strong",{parentName:"p"},"block kode X")," untuk X."),(0,i.kt)("p",{parentName:"blockquote"},"Untuk block expression, penulis akan gunakan istilah ",(0,i.kt)("strong",{parentName:"p"},"block expression")," atau cukup ",(0,i.kt)("strong",{parentName:"p"},"block")," saja.")),(0,i.kt)("p",null,"Cara penerapan block cukup dengan menuliskan kode program diapit di antara tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"{")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"}"),". Contoh penerapannya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let x = 24;\n println!("x: {}", x);\n\n {\n println!("(from block) x: {}", x);\n\n let y = 12;\n let z = x + y;\n println!("(from block) y: {}", y);\n println!("(from block) z: {}", z);\n }\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Block",src:n(9379).Z,width:"460",height:"144"})),(0,i.kt)("p",null,"Pada contoh di atas, dalam fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," ada variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," yang dideklarasikan kemudian di-print. Setelahnya diikuti statement block expression. Bisa dilihat seperti itu kurang lebih cara penulisannya."),(0,i.kt)("p",null,"Di dalam block, nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," di-print. Operasi seperti ini bisa dilakukan, karena ",(0,i.kt)("em",{parentName:"p"},"by default")," semua items pada scope di luar block adalah bisa diakses dari dalam block. Contohnya adalah variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," yang deklarasinya berada di luar block, tapi diakses di dalam block."),(0,i.kt)("p",null,"Kemudian ada beberapa variabel baru yang didefinisikan di dalam block, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"y")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"z")," yang variabel tersebut juga di-print. Variabel tersebut akan valid sampai eksekusi block selesai. Intinya semua statement dalam block expression ter-isolasi dalam anonymous scope tersebut. Setelah block kode selesai dieksekusi, jika kita berusaha memanggil items yang ada di dalam block dengan pemanggilan dari luar scope, hasilnya error."),(0,i.kt)("p",null,"Sebagai contoh, kode berikut menghasilkan error:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let x = 24;\n\n{\n let y = 12;\n let z = x + y;\n};\n\nprintln!("z: {}", z); // <------ error\n')),(0,i.kt)("p",null,"O iya, dalam penulisannya, statement block harus diikuti tanda semicolon ",(0,i.kt)("inlineCode",{parentName:"p"},";")," sebagai penanda akhir statement, dengan beberapa pengecualian yang akan ikut dibahas pada section setelah ini."),(0,i.kt)("h2",{id:"a302-return-value-block"},"A.30.2. Return value block"),(0,i.kt)("p",null,"Sebuah block expression bisa memiliki return value, dengannya maka nilainya bisa ditampung dalam sebuah variabel. Cara penerapannya menggunakan notasi berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let varOne = {\n // ...\n returnValue\n};\n\nlet varTwo: tipeData = {\n // ...\n returnValue\n};\n")),(0,i.kt)("p",null,"Dalam block expression, tidak perlu menuliskan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"return")," dan tidak perlu juga menuliskan tanda semicolon di akhir statement return value."),(0,i.kt)("p",null,"Berikut adalah contoh praktik return value block. Ada sebuah block yang nilai baliknya ditampung ke variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"a"),". Isi block sendiri adalah generate data numerik random, yang kemudian dikalikan dengan angka ",(0,i.kt)("inlineCode",{parentName:"p"},"2"),", lalu dijadikan return value."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'use rand::Rng;\n\nfn main() {\n let a: i32 = {\n let n = rand::thread_rng().gen_range(0..100);\n n * 2\n };\n\n println!("a: {}", a);\n}\n')),(0,i.kt)("h2",{id:"a303-nested-block"},"A.30.3. Nested block"),(0,i.kt)("p",null,"Block bisa berada di dalam block. Contohnya seperti kode berikut, nested block dengan kedalaman 3 layer."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'{\n let b = 12;\n let mut total = 0;\n\n {\n let c = 13;\n\n {\n let d = 14;\n total = b + c + d;\n }\n }\n\n println!("{total}")\n}\n')),(0,i.kt)("p",null,"Tidak ada yang istimewa tentang cara penulisan nested block. Langsung tulis saja block expression dalam block sesuai kebutuhan."),(0,i.kt)("h2",{id:"a304-labeled-block"},"A.30.4. Labeled block"),(0,i.kt)("p",null,"Tak hanya perulangan, sebuah block expression juga bisa memiliki label. Cara penerapannya dengan menuliskan nama label (diawaili dengan tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"'"),"), kemudian diikuti tanda ",(0,i.kt)("inlineCode",{parentName:"p"},":")," dan block expression. Silakan lihat notasi penulisan berikut agar lebih jelas:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"'nama_label: {\n // ...\n}\n")),(0,i.kt)("p",null,"Mari coba terapkan. Pada kode berikut, ada block expression dengan nama ",(0,i.kt)("inlineCode",{parentName:"p"},"'append_with_even_number"),"."),(0,i.kt)("p",null,"Di dalam block itu, ada proses generate data numerik secara acak. Angka random tersebut kemudian di cek, jika ganjil maka block expression dihentikan secara paksa. Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"break 'append_with_even_number")," artinya menghentikan eksekusi block ",(0,i.kt)("inlineCode",{parentName:"p"},"'append_with_even_number"),"."),(0,i.kt)("p",null,"Jika angka genap, maka ditambahkan ke ",(0,i.kt)("inlineCode",{parentName:"p"},"total")," kemudian di-print."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn main() {\n {\n let mut total = 24;\n\n 'append_with_even_number: {\n let n = rand::thread_rng().gen_range(0..100);\n\n if n % 2 == 1 {\n break 'append_with_even_number\n }\n\n total = n\n }\n\n println!(\"{total}\");\n }\n}\n")),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Block",src:n(8872).Z,width:"457",height:"108"})),(0,i.kt)("h2",{id:"a305-async-block"},"A.30.5. Async block"),(0,i.kt)("p",null,"Pembahasan mengenai asynchronous block ada pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/async"},"Async"),"."),(0,i.kt)("h2",{id:"a306-unsafe-block"},"A.30.6. ",(0,i.kt)("em",{parentName:"h2"},"Unsafe")," block"),(0,i.kt)("p",null,"Pembahasan mengenai unsafe block expression ada pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/safe-unsafe"},"Safe & Unsafe"),"."),(0,i.kt)("h2",{id:"a307-manfaat-penerapan-block"},"A.30.7 Manfaat penerapan block"),(0,i.kt)("p",null,"Block biasa diterapkan untuk isolasi sebuah proses yang tidak perlu di-reuse. Jika proses adalah di-reuse, dianjurkan untuk menggunakan fungsi dalam penerapannya."),(0,i.kt)("p",null,"Di bahasa pemrograman lain juga ada block yang penerapannya kurang lebih adalah sama. Namun perlu diketahui, di Rust block memiliki berbedaan yang bisa dibilang signifikan, yaitu dalam hal manajemen memory."),(0,i.kt)("p",null,"Rust menerapkan konsep memory management bernama ",(0,i.kt)("strong",{parentName:"p"},"ownership"),". Setiap kali Rust selesai mengeksekusi block kode, baik itu fungsi, block expression, atau jenis block lainnya; akan dilakukan evaluasi pengecekan ownership yang ada dalam block tersebut. Untuk data yang owner-nya tidak berpindah ke luar scope, maka akan dilakukan proses dealokasi memory untuk data tersebut. Dengan approach ini penggunaan memory menjadi efisien."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai memory management dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/basic-memory-management"},"Memory Management")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai ownership dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/ownership"},"Ownership"))),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/block_expression"},"github.com/novalagung/dasarpemrogramanrust-example/../block_expression")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/expressions/block-expr.html"},"https://doc.rust-lang.org/reference/expressions/block-expr.html"))))}d.isMDXComponent=!0},9379:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcwAAACQCAIAAAAKgszpAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+ID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NxKEAQxLyZAEARBkFsJgiDIrQRBEORWgiAIgtxKEARBbiUIgiC3EgRBEORWgiAIcitBEAS5lSAIgiC3EgRBkFsJgiDIrQRBENeM/wOwdHL7sTryCQAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/b97d8256.7eff2a81.js b/assets/js/b97d8256.adee9dc9.js similarity index 77% rename from assets/js/b97d8256.7eff2a81.js rename to assets/js/b97d8256.adee9dc9.js index c95e5851..c1e6698a 100644 --- a/assets/js/b97d8256.7eff2a81.js +++ b/assets/js/b97d8256.adee9dc9.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4790],{3905:(e,a,t)=>{t.d(a,{Zo:()=>m,kt:()=>c});var n=t(7294);function r(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function i(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?i(Object(t),!0).forEach((function(a){r(e,a,t[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}))}return e}function l(e,a){if(null==e)return{};var t,n,r=function(e,a){if(null==e)return{};var t,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],a.indexOf(t)>=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],a.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=n.createContext({}),p=function(e){var a=n.useContext(s),t=a;return e&&(t="function"==typeof e?e(a):o(o({},a),e)),t},m=function(e){var a=p(e.components);return n.createElement(s.Provider,{value:a},e.children)},u={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},k=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),k=p(t),c=r,d=k["".concat(s,".").concat(c)]||k[c]||u[c]||i;return t?n.createElement(d,o(o({ref:a},m),{},{components:t})):n.createElement(d,o({ref:a},m))}));function c(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=k;var l={};for(var s in a)hasOwnProperty.call(a,s)&&(l[s]=a[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var p=2;p<i;p++)o[p]=t[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,t)}k.displayName="MDXCreateElement"},232:(e,a,t)=>{t.r(a),t.d(a,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var n=t(7462),r=(t(7294),t(3905));const i={sidebar_position:3,title:"A.3. Komentar",sidebar_label:"A.3. Komentar"},o=void 0,l={unversionedId:"basic/komentar",id:"basic/komentar",title:"A.3. Komentar",description:"Pada chapter ini kita akan membahas tentang komentar pada pemrograman Rust. Ada beberapa jenis komentar yang tersedia, namun untuk sekarang yang penting diketahui hanya 2.",source:"@site/docs/basic/komentar.md",sourceDirName:"basic",slug:"/basic/komentar",permalink:"/basic/komentar",draft:!1,tags:[],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3,title:"A.3. Komentar",sidebar_label:"A.3. Komentar"},sidebar:"tutorialSidebar",previous:{title:"A.2. Build dan Run Program Rust",permalink:"/basic/build-dan-run-program-rust"},next:{title:"A.4. Variabel",permalink:"/basic/variabel"}},s={},p=[{value:"A.3.1. Baris komentar",id:"a31-baris-komentar",level:2},{value:"A.3.2. Blok komentar",id:"a32-blok-komentar",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:p};function u(e){let{components:a,...i}=e;return(0,r.kt)("wrapper",(0,n.Z)({},m,i,{components:a,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Pada chapter ini kita akan membahas tentang komentar pada pemrograman Rust. Ada ",(0,r.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/reference/comments.html"},"beberapa jenis komentar")," yang tersedia, namun untuk sekarang yang penting diketahui hanya 2."),(0,r.kt)("h2",{id:"a31-baris-komentar"},"A.3.1. Baris komentar"),(0,r.kt)("p",null,"Rust menggunakan double slash (",(0,r.kt)("inlineCode",{parentName:"p"},"//"),") sebagai penanda ",(0,r.kt)("em",{parentName:"p"},"line comment")," atau baris komentar. Contoh:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n // ini adalah komentar\n // komentar tidak akan di-eksekusi\n println!("hello");\n}\n')),(0,r.kt)("h2",{id:"a32-blok-komentar"},"A.3.2. Blok komentar"),(0,r.kt)("p",null,"Blok komentar dituliskan dengan cara diawali ",(0,r.kt)("inlineCode",{parentName:"p"},"/*")," dan diakhiri ",(0,r.kt)("inlineCode",{parentName:"p"},"*/"),". Silakan tambahkan kode berikut dalam blok fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'/*\n komentar ini\n tidak akan\n dieksekusi\n*/\nprintln!("world");\n')),(0,r.kt)("p",null,"Lalu run program tersebut. O iya, untuk kawan-kawan yang menggunakan editor VSCode dengan ekstensi ",(0,r.kt)("inlineCode",{parentName:"p"},"rust-analyzer")," ter-install. Ada shortcut untuk run program yaitu dengan klik tombol ",(0,r.kt)("inlineCode",{parentName:"p"},"\u25b6 Run")," di atas definisi fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"komentar rust",src:t(8094).Z,width:"754",height:"475"})),(0,r.kt)("p",null,"Bisa dilihat, komentar tidak menghasilkan efek apa-apa pada program yang dibuat."),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,r.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,r.kt)("pre",null,(0,r.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/komentar"},"github.com/novalagung/dasarpemrogramanrust-example/../komentar")),(0,r.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/comments.html"},"https://doc.rust-lang.org/reference/comments.html"))))}u.isMDXComponent=!0},8094:(e,a,t)=>{t.d(a,{Z:()=>n});const n=t.p+"assets/images/komentar-1-d4efff0ac45f370804d128be10dfc2f0.png"}}]); \ No newline at end of file +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4790],{3905:(e,a,t)=>{t.d(a,{Zo:()=>m,kt:()=>k});var n=t(7294);function r(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function i(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?i(Object(t),!0).forEach((function(a){r(e,a,t[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}))}return e}function l(e,a){if(null==e)return{};var t,n,r=function(e,a){if(null==e)return{};var t,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],a.indexOf(t)>=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],a.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=n.createContext({}),p=function(e){var a=n.useContext(s),t=a;return e&&(t="function"==typeof e?e(a):o(o({},a),e)),t},m=function(e){var a=p(e.components);return n.createElement(s.Provider,{value:a},e.children)},u={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},c=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),c=p(t),k=r,d=c["".concat(s,".").concat(k)]||c[k]||u[k]||i;return t?n.createElement(d,o(o({ref:a},m),{},{components:t})):n.createElement(d,o({ref:a},m))}));function k(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=c;var l={};for(var s in a)hasOwnProperty.call(a,s)&&(l[s]=a[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var p=2;p<i;p++)o[p]=t[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,t)}c.displayName="MDXCreateElement"},232:(e,a,t)=>{t.r(a),t.d(a,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var n=t(7462),r=(t(7294),t(3905));const i={sidebar_position:3,title:"A.3. Komentar",sidebar_label:"A.3. Komentar"},o=void 0,l={unversionedId:"basic/komentar",id:"basic/komentar",title:"A.3. Komentar",description:"Pada chapter ini kita akan membahas tentang komentar pada pemrograman Rust. Ada beberapa jenis komentar yang tersedia, namun untuk sekarang yang penting diketahui hanya 2.",source:"@site/docs/basic/komentar.md",sourceDirName:"basic",slug:"/basic/komentar",permalink:"/basic/komentar",draft:!1,tags:[],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3,title:"A.3. Komentar",sidebar_label:"A.3. Komentar"},sidebar:"tutorialSidebar",previous:{title:"A.2. Build dan Run Program Rust",permalink:"/basic/build-dan-run-program-rust"},next:{title:"A.4. Variabel",permalink:"/basic/variabel"}},s={},p=[{value:"A.3.1. Baris komentar",id:"a31-baris-komentar",level:2},{value:"A.3.2. Blok komentar",id:"a32-blok-komentar",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:p};function u(e){let{components:a,...i}=e;return(0,r.kt)("wrapper",(0,n.Z)({},m,i,{components:a,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Pada chapter ini kita akan membahas tentang komentar pada pemrograman Rust. Ada ",(0,r.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/reference/comments.html"},"beberapa jenis komentar")," yang tersedia, namun untuk sekarang yang penting diketahui hanya 2."),(0,r.kt)("h2",{id:"a31-baris-komentar"},"A.3.1. Baris komentar"),(0,r.kt)("p",null,"Rust menggunakan double slash (",(0,r.kt)("inlineCode",{parentName:"p"},"//"),") sebagai penanda ",(0,r.kt)("em",{parentName:"p"},"line comment")," atau baris komentar. Contoh:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n // ini adalah komentar\n // komentar tidak akan di-eksekusi\n println!("hello");\n}\n')),(0,r.kt)("h2",{id:"a32-blok-komentar"},"A.3.2. Blok komentar"),(0,r.kt)("p",null,"Blok komentar dituliskan dengan cara diawali ",(0,r.kt)("inlineCode",{parentName:"p"},"/*")," dan diakhiri ",(0,r.kt)("inlineCode",{parentName:"p"},"*/"),". Silakan tambahkan kode berikut dalam blok fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'/*\n komentar ini\n tidak akan\n dieksekusi\n*/\nprintln!("world");\n')),(0,r.kt)("p",null,"Lalu run program tersebut. O iya, untuk kawan-kawan yang menggunakan editor VSCode dengan ekstensi ",(0,r.kt)("inlineCode",{parentName:"p"},"rust-analyzer")," ter-install. Ada shortcut untuk run program yaitu dengan klik tombol ",(0,r.kt)("inlineCode",{parentName:"p"},"\u25b6 Run")," di atas definisi fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"eager",fetchpriority:"high",alt:"komentar rust",src:t(8094).Z,width:"754",height:"475"})),(0,r.kt)("p",null,"Bisa dilihat, komentar tidak menghasilkan efek apa-apa pada program yang dibuat."),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,r.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,r.kt)("pre",null,(0,r.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/komentar"},"github.com/novalagung/dasarpemrogramanrust-example/../komentar")),(0,r.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/comments.html"},"https://doc.rust-lang.org/reference/comments.html"))))}u.isMDXComponent=!0},8094:(e,a,t)=>{t.d(a,{Z:()=>n});const n=t.p+"assets/images/komentar-1-d4efff0ac45f370804d128be10dfc2f0.png"}}]); \ No newline at end of file diff --git a/assets/js/bc4edc5c.853a74c1.js b/assets/js/bc4edc5c.853a74c1.js new file mode 100644 index 00000000..d42eb11d --- /dev/null +++ b/assets/js/bc4edc5c.853a74c1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4452],{3905:(a,e,n)=>{n.d(e,{Zo:()=>d,kt:()=>p});var i=n(7294);function t(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function l(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,i)}return n}function r(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){t(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function u(a,e){if(null==a)return{};var n,i,t=function(a,e){if(null==a)return{};var n,i,t={},l=Object.keys(a);for(i=0;i<l.length;i++)n=l[i],e.indexOf(n)>=0||(t[n]=a[n]);return t}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(i=0;i<l.length;i++)n=l[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(t[n]=a[n])}return t}var m=i.createContext({}),s=function(a){var e=i.useContext(m),n=e;return a&&(n="function"==typeof a?a(e):r(r({},e),a)),n},d=function(a){var e=s(a.components);return i.createElement(m.Provider,{value:e},a.children)},k={inlineCode:"code",wrapper:function(a){var e=a.children;return i.createElement(i.Fragment,{},e)}},o=i.forwardRef((function(a,e){var n=a.components,t=a.mdxType,l=a.originalType,m=a.parentName,d=u(a,["components","mdxType","originalType","parentName"]),o=s(n),p=t,c=o["".concat(m,".").concat(p)]||o[p]||k[p]||l;return n?i.createElement(c,r(r({ref:e},d),{},{components:n})):i.createElement(c,r({ref:e},d))}));function p(a,e){var n=arguments,t=e&&e.mdxType;if("string"==typeof a||t){var l=n.length,r=new Array(l);r[0]=o;var u={};for(var m in e)hasOwnProperty.call(e,m)&&(u[m]=e[m]);u.originalType=a,u.mdxType="string"==typeof a?a:t,r[1]=u;for(var s=2;s<l;s++)r[s]=n[s];return i.createElement.apply(null,r)}return i.createElement.apply(null,n)}o.displayName="MDXCreateElement"},129:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>m,contentTitle:()=>r,default:()=>k,frontMatter:()=>l,metadata:()=>u,toc:()=>s});var i=n(7462),t=(n(7294),n(3905));const l={sidebar_position:48,title:"A.48. Closures",sidebar_label:"A.48. Closures"},r=void 0,u={unversionedId:"basic/closures",id:"basic/closures",title:"A.48. Closures",description:"Chapter ini membahas tentang closures. Closures sendiri merupakan block fungsi anonimus (anonymous function) yang memiliki kelebihan bisa mengakses item-tem yang posisinya berada di luar block closure tersebut tetapi masih dalam current block scope.",source:"@site/docs/basic/closures.md",sourceDirName:"basic",slug:"/basic/closures",permalink:"/basic/closures",draft:!1,tags:[],version:"current",sidebarPosition:48,frontMatter:{sidebar_position:48,title:"A.48. Closures",sidebar_label:"A.48. Closures"},sidebar:"tutorialSidebar",previous:{title:"A.47. Tipe Data \u279c String Custom Type",permalink:"/basic/tipe-data-custom-type-string-slice"},next:{title:"A.49. Trait \u279c Function (Fn, FnMut, FnOnce)",permalink:"/basic/trait-function"}},m={},s=[{value:"A.48.1. Konsep Closures",id:"a481-konsep-closures",level:2},{value:"\u25c9 formatted print <code>{:.n}</code>",id:"-formatted-print-n",level:3},{value:"A.48.2. Notasi penulisan closure",id:"a482-notasi-penulisan-closure",level:2},{value:"A.48.3. Mutable closure",id:"a483-mutable-closure",level:2},{value:"A.48.4. Borrowing pada closure",id:"a484-borrowing-pada-closure",level:2},{value:"A.48.5. Keyword <code>move</code>",id:"a485-keyword-move",level:2},{value:"A.48.6. Closure sebagai return type",id:"a486-closure-sebagai-return-type",level:2},{value:"\u25c9 Praktik ke-1",id:"-praktik-ke-1",level:3},{value:"\u25c9 Praktik ke-2",id:"-praktik-ke-2",level:3},{value:"A.48.7. Closure sebagai parameter fungsi",id:"a487-closure-sebagai-parameter-fungsi",level:2},{value:"\u25c9 Praktik ke-1",id:"-praktik-ke-1-1",level:3},{value:"\u25c9 Praktik ke-2",id:"-praktik-ke-2-1",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:s};function k(a){let{components:e,...l}=a;return(0,t.kt)("wrapper",(0,i.Z)({},d,l,{components:e,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Chapter ini membahas tentang closures. Closures sendiri merupakan block fungsi anonimus (anonymous function) yang memiliki kelebihan bisa mengakses item-tem yang posisinya berada di luar block closure tersebut tetapi masih dalam current block scope."),(0,t.kt)("p",null,"Topik closures sangat erat hubungannya dengan ",(0,t.kt)("a",{parentName:"p",href:"/basic/trait-function"},"Trait \u279c Function"),", namun pada chapter ini pembahasan hanya difokuskan pada bagian penerapan closures saja. Penulis anjurkan untuk lanjut ke chapter berikutnya setelah selesai dengan chapter ini."),(0,t.kt)("h2",{id:"a481-konsep-closures"},"A.48.1. Konsep Closures"),(0,t.kt)("p",null,"Cara penerapan closure sangat mirip seperti fungsi, perbedaannya ada pada notasi penulisan-nya. Agar lebih jelas silakan perhatikan program sederhana di bawah ini."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let r = 10.0;\n let volume = calculate_circle_volume_v1(r);\n println!("{volume:.2}");\n}\n\nfn calculate_circle_volume_v1(e: f64) -> f64 {\n const PI: f64 = 3.14;\n let volume = 4.0 / 3.0 * PI * e.powi(3);\n volume\n}\n')),(0,t.kt)("p",null,"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"calculate_circle_volume_v1")," akan kita refactor ke bentuk closure, hasilnya adalah berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let calculate_circle_volume_v2 = |e: f64| -> f64 {\n const PI: f64 = 3.14;\n let volume = 4.0 / 3.0 * PI * e.powi(3);\n volume\n };\n \n let r = 10.0;\n let volume = calculate_circle_volume_v2(r);\n println!("{:.2}", volume);\n}\n')),(0,t.kt)("p",null,"Silakan pelajari perbedaan dan juga kemiripannya."),(0,t.kt)("p",null,"Fungsi dideklarasikan menggunakan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"fn")," dan memiliki nama. Closure tidak memiliki nama, namun bisa disimpan dalam variabel (yang disimpan adalah block closure-nya, bukan return value-nya). Contohnya variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"calculate_circle_volume_v2")," di atas."),(0,t.kt)("p",null,"Perbedaan minor lainnya ada pada notasi penulisan parameter. Pada fungsi tanda ",(0,t.kt)("inlineCode",{parentName:"p"},"()")," digunakan sebagai penanda parameter, sedangkan pada closure tanda ",(0,t.kt)("inlineCode",{parentName:"p"},"||")," digunakan."),(0,t.kt)("h3",{id:"-formatted-print-n"},"\u25c9 formatted print ",(0,t.kt)("inlineCode",{parentName:"h3"},"{:.n}")),(0,t.kt)("p",null,"Notasi penulisan formatted print ",(0,t.kt)("inlineCode",{parentName:"p"},"{:.n}")," digunakan untuk mem-format bilangan desimal di mana ",(0,t.kt)("inlineCode",{parentName:"p"},"n")," adalah jumlah digit setelah tanda ",(0,t.kt)("inlineCode",{parentName:"p"},"."),"."),(0,t.kt)("p",null,"Sebagai contoh, variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"pi")," berikut memiliki 0 digit angka dibelakang koma. Untuk menampilkan hanya 4 angka terdepan, bisa gunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"{:.4}"),". Perlu diketahui bahwa angka dibelakang koma yang muncul otomatis dibulatkan."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let pi = 3.1415926535;\n\nprintln!("{:.4}", pi); // 3.1416\nprintln!("{pi:.4}"); // 3.1416\n')),(0,t.kt)("h2",{id:"a482-notasi-penulisan-closure"},"A.48.2. Notasi penulisan closure"),(0,t.kt)("p",null,"Closure ",(0,t.kt)("inlineCode",{parentName:"p"},"calculate_circle_volume_v2")," pada contoh di atas adalah salah satu contoh penulisan closure. Sebuah closure bisa memiliki parameter, bisa juga tidak, dan aturan tersebut juga berlaku pada return value."),(0,t.kt)("p",null,"Bebebrapa contoh lain penulisan closure bisa dilihat di bawah ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"// closure dengan 2 parameter tanpa return value\nlet do_something_v1 = | a: i32, b: String | {\n // ...\n};\n\n// closure dengan 2 parameter dan return value bertipe tuple\nlet do_something_v2 = | a: i32, b: String | -> (i32, bool) {\n // ...\n};\n\n// closure tanpa parameter dan return value bertipe Vec<String>\nlet do_something_v3 = || -> Vec<String> {\n // ...\n};\n\n// closure tanpa parameter dan tanpa return value\nlet do_something_v4 = || {\n // ...\n};\n")),(0,t.kt)("p",null,"Jika tipe return value tidak dideklarasikan secara eksplist, maka Rust menganggap tipe return value adalah sesuai dengan tipe data pada statement terakhir."),(0,t.kt)("p",null,"Untuk closure yang isinya hanya 1 baris statement, boleh tidak dituliskan block kurung kurawal-nya (",(0,t.kt)("inlineCode",{parentName:"p"},"{}"),")."),(0,t.kt)("p",null,"Tambahan contoh, satu fungsi dan tiga buah closures berikut adalah ekuivalen."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn pow_v1(x: i32) -> i32 {\n x.pow(2)\n}\n\nlet pow_v2 = |x: i32| -> i32 {\n x.pow(2)\n};\n\nlet pow_v3 = |x: i32| {\n x.pow(2)\n};\n\nlet pow_v4 = |x: i32| x.pow(2);\n")),(0,t.kt)("p",null,"Ok, sekarang bagaimana dengan closure yang tidak memiliki parameter dengan isi hanya return value saja? Penulisannya seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let get_pi = || 3.14;\n\nprintln!("{:?}", get_pi());\n')),(0,t.kt)("h2",{id:"a483-mutable-closure"},"A.48.3. Mutable closure"),(0,t.kt)("p",null,"Tidak ada yang spesial mengenai cara mengakses item yang berada di luar block closure. Caranya cukup dengan panggil saja item seperti biasanya."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let num = 5;\nlet display = || println!("{num}");\n\nprintln!("{num}"); // 5\ndisplay(); // 5\n')),(0,t.kt)("p",null,"Beda lagi jika data di luar block closure adalah diubah (di-mutate) nilainya dari dalam closure, jika seperti itu maka ada beberapa hal yang perlu diperhatikan."),(0,t.kt)("p",null,"Sebagai contoh, pelajari kode berikut."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let mut num = 5;\n\nlet increase_by = |x: i32| {\n num += x\n};\n\nincrease_by(10);\nprintln!("{num}"); // 15\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Closure",src:n(6894).Z,width:"765",height:"176"})),(0,t.kt)("p",null,"Solusi untuk menghilangkan error di atas adalah dengan menambahkan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"mut")," pada variabel closure ",(0,t.kt)("inlineCode",{parentName:"p"},"increase_by"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"// before\nlet increase_by = |x: i32| {\n num += x\n};\n\n// after\nlet mut increase_by = |x: i32| {\n num += x\n};\n")),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"mut")," wajib ditambahkan ke variabel penampung closure ketika di dalamnya terdapat operasi perubahan data terhadap variabel yang posisinya di-luar closure. Contohnya bisa dilihat di atas, variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," nilainya di-mutate atau diubah dari dalam closure, karena inilah variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"increase_by")," harus didefinisikan mutable."),(0,t.kt)("h2",{id:"a484-borrowing-pada-closure"},"A.48.4. Borrowing pada closure"),(0,t.kt)("p",null,(0,t.kt)("strong",{parentName:"p"},"Semua variabel di luar block closure ketika digunakan di dalam closure maka terjadi operasi borrowing pada variabel tersebut"),". Variabel di luar block closure dipinjam agar bisa digunakan di dalam closure."),(0,t.kt)("p",null,"Sebagai contoh, kode sederhana berikut menghasilkan error, karena variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," adalah dipinjam oleh closure ",(0,t.kt)("inlineCode",{parentName:"p"},"increase_by")," untuk dipergunakan di dalam block-nya."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let mut num = 5;\nlet mut increase_by = |x: i32| num += x;\n\nnum += 5;\nincrease_by(10);\n\nprintln!("{num}"); // 20\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Closure",src:n(3022).Z,width:"525",height:"222"})),(0,t.kt)("p",null,"Error muncul di statement setelahnya, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"num += 5")," karena ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," statusnya masih dipinjam oleh closure ",(0,t.kt)("inlineCode",{parentName:"p"},"increase_by"),"."),(0,t.kt)("p",null,"Variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," dipinjam dengan mode peminjaman adalah ",(0,t.kt)("em",{parentName:"p"},"mutable borrow")," karena closure didefinisikan mutable. Salah satu aturan pada borrowing: bahwa dalam waktu yang sama, ketika sudah terjadi mutable borrow, maka tidak boleh ada borrowing lainnya. Itulah alasan kenapa statement ",(0,t.kt)("inlineCode",{parentName:"p"},"num += 5")," menghasilkan error."),(0,t.kt)("p",null,"Solusi dari masalah di atas ada beberapa, yang pertama adalah menggunakan block expression untuk meng-isolasi closure, agar peminjaman pada closure tersebut dan statement ",(0,t.kt)("inlineCode",{parentName:"p"},"num += 5")," tidak terjadi dalam waktu yang sama."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let mut num = 5;\nnum += 5;\n\n{\n let mut increase_by = |x: i32| num += x;\n increase_by(10);\n}\n\nprintln!("{num}"); // 20\n')),(0,t.kt)("p",null,"Solusi di atas efektif untuk menghilangkan error borrowing yang sebelumnya muncul, tapi setelah d-refactor kode menjadi tidak sesuai spesifikasi awal. Pada kode yang baru di atas, deklarasi closure ",(0,t.kt)("inlineCode",{parentName:"p"},"increase_by")," terjadi di dalam block expression, artinya closure ini hanya akan bisa digunakan pada block kode tersebut saja, tidak bisa di-reuse di luar block."),(0,t.kt)("p",null,"Solusi yang lebih baik pada kasus di atas adalah dengan tidak menggunakan default borrowing (yang terjadi di dalam block closure ketika mengakses variabel yang posisinya berada di luar closure), melainkan gunakan saja borrowing pada parameter closure. Kita ubah lagi kodenya menjadi seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let mut num = 5;\nlet increase_by = |num: &mut i32, x: i32| *num += x;\n\nnum += 5;\nincrease_by(&mut num, 10);\n\nprintln!("{num}"); // 20\n')),(0,t.kt)("p",null,"Pada contoh di atas, closure ",(0,t.kt)("inlineCode",{parentName:"p"},"increase_by")," ditambahi parameter baru. Sekarang ada 2 parameter, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," yang tipe-nya adalah pointer ",(0,t.kt)("inlineCode",{parentName:"p"},"&mut i32")," dan parameter ",(0,t.kt)("inlineCode",{parentName:"p"},"x"),". Di dalam block closure, ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," di-dereference (menggunakan operator ",(0,t.kt)("inlineCode",{parentName:"p"},"*"),") kemudian diubah nilainya. Setelah eksekusi statement selesai, data pinjaman tersebut langsung dikembalikan ke pemilik. Inilah kenapa kode di atas tidak menghasilkan error."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Pengaksesan variabel yang berada di luar scope closure tanpa via parameter berarti adalah borrowing, maka dalam penerapannya wajib untuk memperhatikan aturan yang berlaku pada ownership dan borrowing.")),(0,t.kt)("h2",{id:"a485-keyword-move"},"A.48.5. Keyword ",(0,t.kt)("inlineCode",{parentName:"h2"},"move")),(0,t.kt)("p",null,"Telah dijelaskan di atas bahwa variabel di luar closure, jika diakses dari dalam closure maka terjadi borrowing. Ada cara agar variabel tersebut ownership-nya berpindah ke dalam closure (",(0,t.kt)("em",{parentName:"p"},"move semantics"),"), yaitu menggunakan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"move"),"."),(0,t.kt)("p",null,"Contohnya bisa dilihat berikut ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let mut num = 5;\nlet mut increase_by = move |x: i32| {\n num += x;\n println!("{num} (from closure)"); // 15\n};\n\nincrease_by(10);\nprintln!("{num}"); // 5\n')),(0,t.kt)("p",null,"Closure ",(0,t.kt)("inlineCode",{parentName:"p"},"increase_by")," di atas memiliki keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"move")," dalam pendefinisiannya. Dengan ini maka semua variabel di luar scope closure jika diakses dari dalam closure, maka variabel tersebut berpindah owner-nya (",(0,t.kt)("em",{parentName:"p"},"move semantics"),")."),(0,t.kt)("p",null,"Lalu bagaimana dengan nasib variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," yang berada di luar closure setelah owner-nya berpindah? Pada kondisi normal jawaban pertanyaan ini adalah tergantung tipe data-nya, jika ",(0,t.kt)("em",{parentName:"p"},"by default")," variabel adalah mengadopsi ",(0,t.kt)("em",{parentName:"p"},"move semantics")," maka variabel tersebut menjadi invalid. Namun pada contoh di atas ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," bertipe data ",(0,t.kt)("inlineCode",{parentName:"p"},"i32")," yang mengadopsi ",(0,t.kt)("em",{parentName:"p"},"copy semantics"),", maka variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," tersebut masih bisa digunakan di luar closure."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Closure",src:n(2682).Z,width:"324",height:"105"})),(0,t.kt)("p",null,"Bisa dilihat dari gambar di atas, statement ",(0,t.kt)("inlineCode",{parentName:"p"},"print")," dari dalam block closure hasilnya adalah benar, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"5 + 10 = 15"),". Dan variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," di luar block closure tidak berubah nilainya."),(0,t.kt)("h2",{id:"a486-closure-sebagai-return-type"},"A.48.6. Closure sebagai return type"),(0,t.kt)("h3",{id:"-praktik-ke-1"},"\u25c9 Praktik ke-1"),(0,t.kt)("p",null,"Fungsi bisa memiliki nilai balik bertipe closure. Caranya dengan menggunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"impl Fn()")," sebagai tipe data nilai balik. Contoh penerapannya:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn do_something() -> impl Fn() {\n println!("hello (from do_something)");\n\n return || {\n println!("hello (from closure)");\n };\n}\n')),(0,t.kt)("p",null,"Tipe ",(0,t.kt)("inlineCode",{parentName:"p"},"impl Fn()")," adalah ekuvalen dengan closure ",(0,t.kt)("inlineCode",{parentName:"p"},"|| { }"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let my_closure = do_something();\n println!("hello (from main)");\n my_closure();\n}\n\nfn main() {\n let my_closure = do_something_v2();\n let message = my_closure(123, "hello rust".to_owned());\n println!("{message} (from main)");\n}\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Closure",src:n(4600).Z,width:"321",height:"124"})),(0,t.kt)("p",null,"Bisa dilihat, fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something")," di atas mengembalikan closure yang menampilkan string ",(0,t.kt)("inlineCode",{parentName:"p"},"hello (from closure)"),". String tersebut hanya muncul ketika closure dipanggil."),(0,t.kt)("p",null,"Sedangkan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something")," sendiri juga menampilkan pesan string lainnya, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"hello (from do_something)"),", yang pesan ini adalah muncul langsung saat pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something"),". Berbeda dengan pesan ",(0,t.kt)("inlineCode",{parentName:"p"},"hello (from closure)")," yang hanya muncul ketika closure dieksekusi."),(0,t.kt)("h3",{id:"-praktik-ke-2"},"\u25c9 Praktik ke-2"),(0,t.kt)("p",null,"Pada contoh di atas, closure yang dikembalikan fungsi memiliki skema sangat sederhana, tanpa parameter dan argument. Mari coba praktik dengan contoh yang lebih kompleks."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn do_something_v2() -> impl Fn(i32, String) -> String {\n println!("hello (from do_something_v2)");\n\n return |a: i32, b: String| -> String {\n let message = format!("{b} {a}");\n message\n };\n}\n')),(0,t.kt)("p",null,"Pada kode di atas fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something_v2")," mengembalikan closure dengan skema ",(0,t.kt)("inlineCode",{parentName:"p"},"Fn(i32, String) -> String"),", yang artinya:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Parameter pertamanya bertipe ",(0,t.kt)("inlineCode",{parentName:"li"},"i32")),(0,t.kt)("li",{parentName:"ul"},"Parameter keduanya bertipe ",(0,t.kt)("inlineCode",{parentName:"li"},"String")),(0,t.kt)("li",{parentName:"ul"},"Mengembalikan nilai bertipe ",(0,t.kt)("inlineCode",{parentName:"li"},"String"))),(0,t.kt)("p",null,"Di dalam closure tersebut, data parameter digabung menjadi sebuah pesan string yang kemudian dijadikan nilai balik."),(0,t.kt)("p",null,"Sekarang jalankan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something_v2")," di atas, kemudian lihat hasilnya."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let my_closure = do_something_v2();\nlet message = my_closure(123, "hello rust".to_owned());\nprintln!("{message} (from main)");\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Closure",src:n(3546).Z,width:"323",height:"106"})),(0,t.kt)("h2",{id:"a487-closure-sebagai-parameter-fungsi"},"A.48.7. Closure sebagai parameter fungsi"),(0,t.kt)("h3",{id:"-praktik-ke-1-1"},"\u25c9 Praktik ke-1"),(0,t.kt)("p",null,"Pengaplikasian closure sebagai parameter fungsi banyak dilakukan di Rust, hal ini bisa dilakukan dengan memanfaatkan generic parameter. Silakan perhatikan kode berikut untuk contoh penerapannya."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn run_x_times<F>(x: i32, my_closure: F)\nwhere\n F: Fn(i32),\n{\n for i in 0..x {\n my_closure(i)\n }\n}\n")),(0,t.kt)("p",null,"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"run_x_times")," dibuat dengan tugas mengeksekusi closure ",(0,t.kt)("inlineCode",{parentName:"p"},"my_closure")," sebanyak ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," kali. Parameter closure harus selalu memiliki tipe data generic, contohnya ",(0,t.kt)("inlineCode",{parentName:"p"},"my_closure")," di atas yang tipe data-nya adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"F"),"."),(0,t.kt)("p",null,"Fungsi yang memiliki parameter closure wajib menggunakan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"where")," yang keyword ini digunakan untuk mendaftarkan skema closure yang nantiya bisa diterima saat pemanggilan fungsi. Tipe generic ",(0,t.kt)("inlineCode",{parentName:"p"},"F")," di daftarkan dengan notasi ",(0,t.kt)("inlineCode",{parentName:"p"},"Fn(i32)"),", artinya dalam pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"run_x_times"),", parameter ",(0,t.kt)("inlineCode",{parentName:"p"},"my_closure")," harus diisi dengan closure yang skema-nya adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"Fn(i32)")," yang jika di ilustrasikan dalam bentuk closure adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"|param1: i32| { }"),"."),(0,t.kt)("p",null,"Sekarang mari kita test fungsi di atas. Panggil fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"run_x_times")," kemudian pada bagian parameter closure isi dengan block closure yang memiliki skema sesuai requirement, contohnya ",(0,t.kt)("inlineCode",{parentName:"p"},'|i: i32| { println!("hello rust {i}") }'),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'run_x_times(4, |i: i32| {\n println!("hello rust {i}");\n});\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Closure",src:n(2376).Z,width:"314",height:"147"})),(0,t.kt)("p",null,"O iya, closure di atas juga bisa dituliskan dalam bentuk seperti ini. Bebas, pilih sesuai preferensi dan/atau kesepakatan team perihal code convention."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'run_x_times(4, |i: i32| println!("hello rust {i}"));\n')),(0,t.kt)("h3",{id:"-praktik-ke-2-1"},"\u25c9 Praktik ke-2"),(0,t.kt)("p",null,"Ok, sekarang mari kita coba praktikkan contoh yang lebih kompleks."),(0,t.kt)("p",null,"Pada praktik ini kita akan buat sebuah fungsi yang tugasnya melakukan pencarian indeks slice dengan kondisi pencarian didapat dari eksekusi closure."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn find_index<T, F>(data: &[T], cond_fn: F) -> i32\nwhere\n F: Fn(&T) -> bool,\n{\n for i in 0..data.len() {\n if cond_fn(&data[i]) {\n return i as i32\n }\n }\n\n return -1\n}\n")),(0,t.kt)("p",null,"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"find_index")," memiliki 2 parameter generic, yaitu:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("inlineCode",{parentName:"li"},"T")," yang digunakan sebagai tipe data element slice ",(0,t.kt)("inlineCode",{parentName:"li"},"data"),"."),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("inlineCode",{parentName:"li"},"F")," yang digunakan sebagai tipe data closure ",(0,t.kt)("inlineCode",{parentName:"li"},"cond_fn")," dengan skema ",(0,t.kt)("inlineCode",{parentName:"li"},"Fn(&T) -> bool"),", yang jika diilustrasikan dalam bentuk closure adalah ",(0,t.kt)("inlineCode",{parentName:"li"},"|param1: &T| -> bool { }"),".")),(0,t.kt)("p",null,"Di dalam fungsi tersebut, data slice di-loop, kemudian tiap elemen-nya digunakan sebagai parameter pemanggilan closure ",(0,t.kt)("inlineCode",{parentName:"p"},"cond_fn"),"."),(0,t.kt)("p",null,"Jika nilai balik pemanggilan closure adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"true")," maka ",(0,t.kt)("inlineCode",{parentName:"p"},"i")," dikembalikan dalam bentuk ",(0,t.kt)("inlineCode",{parentName:"p"},"i32")," (ada proses casting). Dan jika tidak diketemukan, maka indeks ",(0,t.kt)("inlineCode",{parentName:"p"},"-1")," dikembalikan."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"as")," digunakan untuk casting tipe data. Lebih jelasnya dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/type-alias-casting"},"Type Alias & Casting")," dan ",(0,t.kt)("a",{parentName:"p",href:"#/wip/trait-conversion-from-into"},"Trait \u279c Conversion (From & Into)"))),(0,t.kt)("p",null,"Jalankan program tersebut."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let numbers = [24, 13, 2, 53, 3];\nlet number_to_find = 53;\nlet index = find_index(&numbers, |e: &i32| -> bool {\n if *e == number_to_find {\n true \n } else {\n false\n }\n});\n\nprintln!("number_to_find: {number_to_find}");\nprintln!("index: {index}");\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Closure",src:n(3451).Z,width:"324",height:"108"})),(0,t.kt)("p",null,"Bisa dilihat program berjalan sesuai harapan."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"Fn")," merupakan salah satu trait function yang ada di Rust. Lebih jelasnya perihal keyword tersebut dibahas pada chapter selanjutnya, yaitu ",(0,t.kt)("a",{parentName:"p",href:"/basic/trait-function"},"Trait \u279c Function"))),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/closures"},"github.com/novalagung/dasarpemrogramanrust-example/../closures")),(0,t.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/function"},"Function")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/generics"},"Generics")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/borrowing"},"Borrowing")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/trait-function"},"Trait \u279c Function (Fn, FnMut, FnOnce)"))),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch13-01-closures.html"},"https://doc.rust-lang.org/book/ch13-01-closures.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/beta/rust-by-example/fn/closures.html"},"https://doc.rust-lang.org/beta/rust-by-example/fn/closures.html"))))}k.isMDXComponent=!0},6894:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/closures-1-2c7599bfed946d5bd1fb34a57acd9de7.png"},3022:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/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jFxZqyrKJpMK8FXHIDPN02ekwrLsugsiqS1m6RRRg5sydagnzOGJHq2HA/Kr+/klPnwgSKE2WaICmO160T9mQl2d0mRpQ2feC3GDDuif3gbQYa8BMlqmmMGtuLZi7USj/ajo6Dro/YsiLE6ZxXJoG6zGvLG1xFg2XzAhmXc2sQovWzPrGwTUzdS4wd5+AcUxOnLVYVZ93DLPmWpeCi2bqXCzz20LaIG0pzMranwHMuCV2/DSPulCYxTr4NQZzsuSGz4XiYGT2S07SA8ZtNszizGQ/ILxmLhjm8n2IotaEWSzx+q1rF2a08QuOV1q5fD9c7GYXadDIZFN/awIi8/n9nO5mRWCWGSU7BHzOTLWGmaIowkxRFGHW02bjsXDL0ymKMFMURZgpiiLMFEWYKYq6JpjptU9RhLmB6MpPUdtNszeyzPRKoKg4zIu99rP3LrsDadyt8QqVrzdzOk9RtZZ5ttc+jEMwuUXod6QrYSbLFLUc5phvII5DcDrrZa63H135KWpjmI04BBOQS1nkopmitoMZ89oleF6OIl35KWptmLHXvmF+x7Tass7YACPLFGGuXJ3O9drPtrjB/rWxtx0oEkmmKL7OSVGEmaIowkxRFGGmKIowUxRhpiiKMFMURZgpiiLMFEWYKYoizBRFEWaKoggzRVGD/geWHMKpfLG1lAAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/bc4edc5c.d4905b46.js b/assets/js/bc4edc5c.d4905b46.js deleted file mode 100644 index 697da2e3..00000000 --- a/assets/js/bc4edc5c.d4905b46.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4452],{3905:(a,e,n)=>{n.d(e,{Zo:()=>d,kt:()=>o});var i=n(7294);function t(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function l(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,i)}return n}function r(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){t(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function u(a,e){if(null==a)return{};var n,i,t=function(a,e){if(null==a)return{};var n,i,t={},l=Object.keys(a);for(i=0;i<l.length;i++)n=l[i],e.indexOf(n)>=0||(t[n]=a[n]);return t}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(i=0;i<l.length;i++)n=l[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(t[n]=a[n])}return t}var m=i.createContext({}),s=function(a){var e=i.useContext(m),n=e;return a&&(n="function"==typeof a?a(e):r(r({},e),a)),n},d=function(a){var e=s(a.components);return i.createElement(m.Provider,{value:e},a.children)},k={inlineCode:"code",wrapper:function(a){var e=a.children;return i.createElement(i.Fragment,{},e)}},p=i.forwardRef((function(a,e){var n=a.components,t=a.mdxType,l=a.originalType,m=a.parentName,d=u(a,["components","mdxType","originalType","parentName"]),p=s(n),o=t,c=p["".concat(m,".").concat(o)]||p[o]||k[o]||l;return n?i.createElement(c,r(r({ref:e},d),{},{components:n})):i.createElement(c,r({ref:e},d))}));function o(a,e){var n=arguments,t=e&&e.mdxType;if("string"==typeof a||t){var l=n.length,r=new Array(l);r[0]=p;var u={};for(var m in e)hasOwnProperty.call(e,m)&&(u[m]=e[m]);u.originalType=a,u.mdxType="string"==typeof a?a:t,r[1]=u;for(var s=2;s<l;s++)r[s]=n[s];return i.createElement.apply(null,r)}return i.createElement.apply(null,n)}p.displayName="MDXCreateElement"},129:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>m,contentTitle:()=>r,default:()=>k,frontMatter:()=>l,metadata:()=>u,toc:()=>s});var i=n(7462),t=(n(7294),n(3905));const l={sidebar_position:48,title:"A.48. Closures",sidebar_label:"A.48. Closures"},r=void 0,u={unversionedId:"basic/closures",id:"basic/closures",title:"A.48. Closures",description:"Chapter ini membahas tentang closures. Closures sendiri merupakan block fungsi anonimus (anonymous function) yang memiliki kelebihan bisa mengakses item-tem yang posisinya berada di luar block closure tersebut tetapi masih dalam current block scope.",source:"@site/docs/basic/closures.md",sourceDirName:"basic",slug:"/basic/closures",permalink:"/basic/closures",draft:!1,tags:[],version:"current",sidebarPosition:48,frontMatter:{sidebar_position:48,title:"A.48. Closures",sidebar_label:"A.48. Closures"},sidebar:"tutorialSidebar",previous:{title:"A.47. Tipe Data \u279c String Custom Type",permalink:"/basic/tipe-data-custom-type-string-slice"},next:{title:"A.49. Trait \u279c Function (Fn, FnMut, FnOnce)",permalink:"/basic/trait-function"}},m={},s=[{value:"A.48.1. Konsep Closures",id:"a481-konsep-closures",level:2},{value:"\u25c9 formatted print <code>{:.n}</code>",id:"-formatted-print-n",level:3},{value:"A.48.2. Notasi penulisan closure",id:"a482-notasi-penulisan-closure",level:2},{value:"A.48.3. Mutable closure",id:"a483-mutable-closure",level:2},{value:"A.48.4. Borrowing pada closure",id:"a484-borrowing-pada-closure",level:2},{value:"A.48.5. Keyword <code>move</code>",id:"a485-keyword-move",level:2},{value:"A.48.6. Closure sebagai return type",id:"a486-closure-sebagai-return-type",level:2},{value:"\u25c9 Praktik ke-1",id:"-praktik-ke-1",level:3},{value:"\u25c9 Praktik ke-2",id:"-praktik-ke-2",level:3},{value:"A.48.7. Closure sebagai parameter fungsi",id:"a487-closure-sebagai-parameter-fungsi",level:2},{value:"\u25c9 Praktik ke-1",id:"-praktik-ke-1-1",level:3},{value:"\u25c9 Praktik ke-2",id:"-praktik-ke-2-1",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:s};function k(a){let{components:e,...l}=a;return(0,t.kt)("wrapper",(0,i.Z)({},d,l,{components:e,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Chapter ini membahas tentang closures. Closures sendiri merupakan block fungsi anonimus (anonymous function) yang memiliki kelebihan bisa mengakses item-tem yang posisinya berada di luar block closure tersebut tetapi masih dalam current block scope."),(0,t.kt)("p",null,"Topik closures sangat erat hubungannya dengan ",(0,t.kt)("a",{parentName:"p",href:"/basic/trait-function"},"Trait \u279c Function"),", namun pada chapter ini pembahasan hanya difokuskan pada bagian penerapan closures saja. Penulis anjurkan untuk lanjut ke chapter berikutnya setelah selesai dengan chapter ini."),(0,t.kt)("h2",{id:"a481-konsep-closures"},"A.48.1. Konsep Closures"),(0,t.kt)("p",null,"Cara penerapan closure sangat mirip seperti fungsi, perbedaannya ada pada notasi penulisan-nya. Agar lebih jelas silakan perhatikan program sederhana di bawah ini."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let r = 10.0;\n let volume = calculate_circle_volume_v1(r);\n println!("{volume:.2}");\n}\n\nfn calculate_circle_volume_v1(e: f64) -> f64 {\n const PI: f64 = 3.14;\n let volume = 4.0 / 3.0 * PI * e.powi(3);\n volume\n}\n')),(0,t.kt)("p",null,"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"calculate_circle_volume_v1")," akan kita refactor ke bentuk closure, hasilnya adalah berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let calculate_circle_volume_v2 = |e: f64| -> f64 {\n const PI: f64 = 3.14;\n let volume = 4.0 / 3.0 * PI * e.powi(3);\n volume\n };\n \n let r = 10.0;\n let volume = calculate_circle_volume_v2(r);\n println!("{:.2}", volume);\n}\n')),(0,t.kt)("p",null,"Silakan pelajari perbedaan dan juga kemiripannya."),(0,t.kt)("p",null,"Fungsi dideklarasikan menggunakan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"fn")," dan memiliki nama. Closure tidak memiliki nama, namun bisa disimpan dalam variabel (yang disimpan adalah block closure-nya, bukan return value-nya). Contohnya variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"calculate_circle_volume_v2")," di atas."),(0,t.kt)("p",null,"Perbedaan minor lainnya ada pada notasi penulisan parameter. Pada fungsi tanda ",(0,t.kt)("inlineCode",{parentName:"p"},"()")," digunakan sebagai penanda parameter, sedangkan pada closure tanda ",(0,t.kt)("inlineCode",{parentName:"p"},"||")," digunakan."),(0,t.kt)("h3",{id:"-formatted-print-n"},"\u25c9 formatted print ",(0,t.kt)("inlineCode",{parentName:"h3"},"{:.n}")),(0,t.kt)("p",null,"Notasi penulisan formatted print ",(0,t.kt)("inlineCode",{parentName:"p"},"{:.n}")," digunakan untuk mem-format bilangan desimal di mana ",(0,t.kt)("inlineCode",{parentName:"p"},"n")," adalah jumlah digit setelah tanda ",(0,t.kt)("inlineCode",{parentName:"p"},"."),"."),(0,t.kt)("p",null,"Sebagai contoh, variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"pi")," berikut memiliki 0 digit angka dibelakang koma. Untuk menampilkan hanya 4 angka terdepan, bisa gunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"{:.4}"),". Perlu diketahui bahwa angka dibelakang koma yang muncul otomatis dibulatkan."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let pi = 3.1415926535;\n\nprintln!("{:.4}", pi); // 3.1416\nprintln!("{pi:.4}"); // 3.1416\n')),(0,t.kt)("h2",{id:"a482-notasi-penulisan-closure"},"A.48.2. Notasi penulisan closure"),(0,t.kt)("p",null,"Closure ",(0,t.kt)("inlineCode",{parentName:"p"},"calculate_circle_volume_v2")," pada contoh di atas adalah salah satu contoh penulisan closure. Sebuah closure bisa memiliki parameter, bisa juga tidak, dan aturan tersebut juga berlaku pada return value."),(0,t.kt)("p",null,"Bebebrapa contoh lain penulisan closure bisa dilihat di bawah ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"// closure dengan 2 parameter tanpa return value\nlet do_something_v1 = | a: i32, b: String | {\n // ...\n};\n\n// closure dengan 2 parameter dan return value bertipe tuple\nlet do_something_v2 = | a: i32, b: String | -> (i32, bool) {\n // ...\n};\n\n// closure tanpa parameter dan return value bertipe Vec<String>\nlet do_something_v3 = || -> Vec<String> {\n // ...\n};\n\n// closure tanpa parameter dan tanpa return value\nlet do_something_v4 = || {\n // ...\n};\n")),(0,t.kt)("p",null,"Jika tipe return value tidak dideklarasikan secara eksplist, maka Rust menganggap tipe return value adalah sesuai dengan tipe data pada statement terakhir."),(0,t.kt)("p",null,"Untuk closure yang isinya hanya 1 baris statement, boleh tidak dituliskan block kurung kurawal-nya (",(0,t.kt)("inlineCode",{parentName:"p"},"{}"),")."),(0,t.kt)("p",null,"Tambahan contoh, satu fungsi dan tiga buah closures berikut adalah ekuivalen."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn pow_v1(x: i32) -> i32 {\n x.pow(2)\n}\n\nlet pow_v2 = |x: i32| -> i32 {\n x.pow(2)\n};\n\nlet pow_v3 = |x: i32| {\n x.pow(2)\n};\n\nlet pow_v4 = |x: i32| x.pow(2);\n")),(0,t.kt)("p",null,"Ok, sekarang bagaimana dengan closure yang tidak memiliki parameter dengan isi hanya return value saja? Penulisannya seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let get_pi = || 3.14;\n\nprintln!("{:?}", get_pi());\n')),(0,t.kt)("h2",{id:"a483-mutable-closure"},"A.48.3. Mutable closure"),(0,t.kt)("p",null,"Tidak ada yang spesial mengenai cara mengakses item yang berada di luar block closure. Caranya cukup dengan panggil saja item seperti biasanya."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let num = 5;\nlet display = || println!("{num}");\n\nprintln!("{num}"); // 5\ndisplay(); // 5\n')),(0,t.kt)("p",null,"Beda lagi jika data di luar block closure adalah diubah (di-mutate) nilainya dari dalam closure, jika seperti itu maka ada beberapa hal yang perlu diperhatikan."),(0,t.kt)("p",null,"Sebagai contoh, pelajari kode berikut."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let mut num = 5;\n\nlet increase_by = |x: i32| {\n num += x\n};\n\nincrease_by(10);\nprintln!("{num}"); // 15\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Closure",src:n(6894).Z,width:"765",height:"176"})),(0,t.kt)("p",null,"Solusi untuk menghilangkan error di atas adalah dengan menambahkan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"mut")," pada variabel closure ",(0,t.kt)("inlineCode",{parentName:"p"},"increase_by"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"// before\nlet increase_by = |x: i32| {\n num += x\n};\n\n// after\nlet mut increase_by = |x: i32| {\n num += x\n};\n")),(0,t.kt)("p",null,"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"mut")," wajib ditambahkan ke variabel penampung closure ketika di dalamnya terdapat operasi perubahan data terhadap variabel yang posisinya di-luar closure. Contohnya bisa dilihat di atas, variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," nilainya di-mutate atau diubah dari dalam closure, karena inilah variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"increase_by")," harus didefinisikan mutable."),(0,t.kt)("h2",{id:"a484-borrowing-pada-closure"},"A.48.4. Borrowing pada closure"),(0,t.kt)("p",null,(0,t.kt)("strong",{parentName:"p"},"Semua variabel di luar block closure ketika digunakan di dalam closure maka terjadi operasi borrowing pada variabel tersebut"),". Variabel di luar block closure dipinjam agar bisa digunakan di dalam closure."),(0,t.kt)("p",null,"Sebagai contoh, kode sederhana berikut menghasilkan error, karena variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," adalah dipinjam oleh closure ",(0,t.kt)("inlineCode",{parentName:"p"},"increase_by")," untuk dipergunakan di dalam block-nya."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let mut num = 5;\nlet mut increase_by = |x: i32| num += x;\n\nnum += 5;\nincrease_by(10);\n\nprintln!("{num}"); // 20\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Closure",src:n(3022).Z,width:"525",height:"222"})),(0,t.kt)("p",null,"Error muncul di statement setelahnya, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"num += 5")," karena ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," statusnya masih dipinjam oleh closure ",(0,t.kt)("inlineCode",{parentName:"p"},"increase_by"),"."),(0,t.kt)("p",null,"Variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," dipinjam dengan mode peminjaman adalah ",(0,t.kt)("em",{parentName:"p"},"mutable borrow")," karena closure didefinisikan mutable. Salah satu aturan pada borrowing: bahwa dalam waktu yang sama, ketika sudah terjadi mutable borrow, maka tidak boleh ada borrowing lainnya. Itulah alasan kenapa statement ",(0,t.kt)("inlineCode",{parentName:"p"},"num += 5")," menghasilkan error."),(0,t.kt)("p",null,"Solusi dari masalah di atas ada beberapa, yang pertama adalah menggunakan block expression untuk meng-isolasi closure, agar peminjaman pada closure tersebut dan statement ",(0,t.kt)("inlineCode",{parentName:"p"},"num += 5")," tidak terjadi dalam waktu yang sama."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let mut num = 5;\nnum += 5;\n\n{\n let mut increase_by = |x: i32| num += x;\n increase_by(10);\n}\n\nprintln!("{num}"); // 20\n')),(0,t.kt)("p",null,"Solusi di atas efektif untuk menghilangkan error borrowing yang sebelumnya muncul, tapi setelah d-refactor kode menjadi tidak sesuai spesifikasi awal. Pada kode yang baru di atas, deklarasi closure ",(0,t.kt)("inlineCode",{parentName:"p"},"increase_by")," terjadi di dalam block expression, artinya closure ini hanya akan bisa digunakan pada block kode tersebut saja, tidak bisa di-reuse di luar block."),(0,t.kt)("p",null,"Solusi yang lebih baik pada kasus di atas adalah dengan tidak menggunakan default borrowing (yang terjadi di dalam block closure ketika mengakses variabel yang posisinya berada di luar closure), melainkan gunakan saja borrowing pada parameter closure. Kita ubah lagi kodenya menjadi seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let mut num = 5;\nlet increase_by = |num: &mut i32, x: i32| *num += x;\n\nnum += 5;\nincrease_by(&mut num, 10);\n\nprintln!("{num}"); // 20\n')),(0,t.kt)("p",null,"Pada contoh di atas, closure ",(0,t.kt)("inlineCode",{parentName:"p"},"increase_by")," ditambahi parameter baru. Sekarang ada 2 parameter, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," yang tipe-nya adalah pointer ",(0,t.kt)("inlineCode",{parentName:"p"},"&mut i32")," dan parameter ",(0,t.kt)("inlineCode",{parentName:"p"},"x"),". Di dalam block closure, ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," di-dereference (menggunakan operator ",(0,t.kt)("inlineCode",{parentName:"p"},"*"),") kemudian diubah nilainya. Setelah eksekusi statement selesai, data pinjaman tersebut langsung dikembalikan ke pemilik. Inilah kenapa kode di atas tidak menghasilkan error."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Pengaksesan variabel yang berada di luar scope closure tanpa via parameter berarti adalah borrowing, maka dalam penerapannya wajib untuk memperhatikan aturan yang berlaku pada ownership dan borrowing.")),(0,t.kt)("h2",{id:"a485-keyword-move"},"A.48.5. Keyword ",(0,t.kt)("inlineCode",{parentName:"h2"},"move")),(0,t.kt)("p",null,"Telah dijelaskan di atas bahwa variabel di luar closure, jika diakses dari dalam closure maka terjadi borrowing. Ada cara agar variabel tersebut ownership-nya berpindah ke dalam closure (",(0,t.kt)("em",{parentName:"p"},"move semantics"),"), yaitu menggunakan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"move"),"."),(0,t.kt)("p",null,"Contohnya bisa dilihat berikut ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let mut num = 5;\nlet mut increase_by = move |x: i32| {\n num += x;\n println!("{num} (from closure)"); // 15\n};\n\nincrease_by(10);\nprintln!("{num}"); // 5\n')),(0,t.kt)("p",null,"Closure ",(0,t.kt)("inlineCode",{parentName:"p"},"increase_by")," di atas memiliki keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"move")," dalam pendefinisiannya. Dengan ini maka semua variabel di luar scope closure jika diakses dari dalam closure, maka variabel tersebut berpindah owner-nya (",(0,t.kt)("em",{parentName:"p"},"move semantics"),")."),(0,t.kt)("p",null,"Lalu bagaimana dengan nasib variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," yang berada di luar closure setelah owner-nya berpindah? Pada kondisi normal jawaban pertanyaan ini adalah tergantung tipe data-nya, jika ",(0,t.kt)("em",{parentName:"p"},"by default")," variabel adalah mengadopsi ",(0,t.kt)("em",{parentName:"p"},"move semantics")," maka variabel tersebut menjadi invalid. Namun pada contoh di atas ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," bertipe data ",(0,t.kt)("inlineCode",{parentName:"p"},"i32")," yang mengadopsi ",(0,t.kt)("em",{parentName:"p"},"copy semantics"),", maka variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," tersebut masih bisa digunakan di luar closure."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Closure",src:n(2682).Z,width:"324",height:"105"})),(0,t.kt)("p",null,"Bisa dilihat dari gambar di atas, statement ",(0,t.kt)("inlineCode",{parentName:"p"},"print")," dari dalam block closure hasilnya adalah benar, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"5 + 10 = 15"),". Dan variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"num")," di luar block closure tidak berubah nilainya."),(0,t.kt)("h2",{id:"a486-closure-sebagai-return-type"},"A.48.6. Closure sebagai return type"),(0,t.kt)("h3",{id:"-praktik-ke-1"},"\u25c9 Praktik ke-1"),(0,t.kt)("p",null,"Fungsi bisa memiliki nilai balik bertipe closure. Caranya dengan menggunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"impl Fn()")," sebagai tipe data nilai balik. Contoh penerapannya:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn do_something() -> impl Fn() {\n println!("hello (from do_something)");\n\n return || {\n println!("hello (from closure)");\n };\n}\n')),(0,t.kt)("p",null,"Tipe ",(0,t.kt)("inlineCode",{parentName:"p"},"impl Fn()")," adalah ekuvalen dengan closure ",(0,t.kt)("inlineCode",{parentName:"p"},"|| { }"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let my_closure = do_something();\n println!("hello (from main)");\n my_closure();\n}\n\nfn main() {\n let my_closure = do_something_v2();\n let message = my_closure(123, "hello rust".to_owned());\n println!("{message} (from main)");\n}\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Closure",src:n(4600).Z,width:"321",height:"124"})),(0,t.kt)("p",null,"Bisa dilihat, fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something")," di atas mengembalikan closure yang menampilkan string ",(0,t.kt)("inlineCode",{parentName:"p"},"hello (from closure)"),". String tersebut hanya muncul ketika closure dipanggil."),(0,t.kt)("p",null,"Sedangkan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something")," sendiri juga menampilkan pesan string lainnya, yaitu ",(0,t.kt)("inlineCode",{parentName:"p"},"hello (from do_something)"),", yang pesan ini adalah muncul langsung saat pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something"),". Berbeda dengan pesan ",(0,t.kt)("inlineCode",{parentName:"p"},"hello (from closure)")," yang hanya muncul ketika closure dieksekusi."),(0,t.kt)("h3",{id:"-praktik-ke-2"},"\u25c9 Praktik ke-2"),(0,t.kt)("p",null,"Pada contoh di atas, closure yang dikembalikan fungsi memiliki skema sangat sederhana, tanpa parameter dan argument. Mari coba praktik dengan contoh yang lebih kompleks."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn do_something_v2() -> impl Fn(i32, String) -> String {\n println!("hello (from do_something_v2)");\n\n return |a: i32, b: String| -> String {\n let message = format!("{b} {a}");\n message\n };\n}\n')),(0,t.kt)("p",null,"Pada kode di atas fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something_v2")," mengembalikan closure dengan skema ",(0,t.kt)("inlineCode",{parentName:"p"},"Fn(i32, String) -> String"),", yang artinya:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Parameter pertamanya bertipe ",(0,t.kt)("inlineCode",{parentName:"li"},"i32")),(0,t.kt)("li",{parentName:"ul"},"Parameter keduanya bertipe ",(0,t.kt)("inlineCode",{parentName:"li"},"String")),(0,t.kt)("li",{parentName:"ul"},"Mengembalikan nilai bertipe ",(0,t.kt)("inlineCode",{parentName:"li"},"String"))),(0,t.kt)("p",null,"Di dalam closure tersebut, data parameter digabung menjadi sebuah pesan string yang kemudian dijadikan nilai balik."),(0,t.kt)("p",null,"Sekarang jalankan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something_v2")," di atas, kemudian lihat hasilnya."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let my_closure = do_something_v2();\nlet message = my_closure(123, "hello rust".to_owned());\nprintln!("{message} (from main)");\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Closure",src:n(3546).Z,width:"323",height:"106"})),(0,t.kt)("h2",{id:"a487-closure-sebagai-parameter-fungsi"},"A.48.7. Closure sebagai parameter fungsi"),(0,t.kt)("h3",{id:"-praktik-ke-1-1"},"\u25c9 Praktik ke-1"),(0,t.kt)("p",null,"Pengaplikasian closure sebagai parameter fungsi banyak dilakukan di Rust, hal ini bisa dilakukan dengan memanfaatkan generic parameter. Silakan perhatikan kode berikut untuk contoh penerapannya."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn run_x_times<F>(x: i32, my_closure: F)\nwhere\n F: Fn(i32),\n{\n for i in 0..x {\n my_closure(i)\n }\n}\n")),(0,t.kt)("p",null,"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"run_x_times")," dibuat dengan tugas mengeksekusi closure ",(0,t.kt)("inlineCode",{parentName:"p"},"my_closure")," sebanyak ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," kali. Parameter closure harus selalu memiliki tipe data generic, contohnya ",(0,t.kt)("inlineCode",{parentName:"p"},"my_closure")," di atas yang tipe data-nya adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"F"),"."),(0,t.kt)("p",null,"Fungsi yang memiliki parameter closure wajib menggunakan keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"where")," yang keyword ini digunakan untuk mendaftarkan skema closure yang nantiya bisa diterima saat pemanggilan fungsi. Tipe generic ",(0,t.kt)("inlineCode",{parentName:"p"},"F")," di daftarkan dengan notasi ",(0,t.kt)("inlineCode",{parentName:"p"},"Fn(i32)"),", artinya dalam pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"run_x_times"),", parameter ",(0,t.kt)("inlineCode",{parentName:"p"},"my_closure")," harus diisi dengan closure yang skema-nya adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"Fn(i32)")," yang jika di ilustrasikan dalam bentuk closure adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"|param1: i32| { }"),"."),(0,t.kt)("p",null,"Sekarang mari kita test fungsi di atas. Panggil fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"run_x_times")," kemudian pada bagian parameter closure isi dengan block closure yang memiliki skema sesuai requirement, contohnya ",(0,t.kt)("inlineCode",{parentName:"p"},'|i: i32| { println!("hello rust {i}") }'),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'run_x_times(4, |i: i32| {\n println!("hello rust {i}");\n});\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Closure",src:n(2376).Z,width:"314",height:"147"})),(0,t.kt)("p",null,"O iya, closure di atas juga bisa dituliskan dalam bentuk seperti ini. Bebas, pilih sesuai preferensi dan/atau kesepakatan team perihal code convention."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'run_x_times(4, |i: i32| println!("hello rust {i}"));\n')),(0,t.kt)("h3",{id:"-praktik-ke-2-1"},"\u25c9 Praktik ke-2"),(0,t.kt)("p",null,"Ok, sekarang mari kita coba praktikkan contoh yang lebih kompleks."),(0,t.kt)("p",null,"Pada praktik ini kita akan buat sebuah fungsi yang tugasnya melakukan pencarian indeks slice dengan kondisi pencarian didapat dari eksekusi closure."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn find_index<T, F>(data: &[T], cond_fn: F) -> i32\nwhere\n F: Fn(&T) -> bool,\n{\n for i in 0..data.len() {\n if cond_fn(&data[i]) {\n return i as i32\n }\n }\n\n return -1\n}\n")),(0,t.kt)("p",null,"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"find_index")," memiliki 2 parameter generic, yaitu:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("inlineCode",{parentName:"li"},"T")," yang digunakan sebagai tipe data element slice ",(0,t.kt)("inlineCode",{parentName:"li"},"data"),"."),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("inlineCode",{parentName:"li"},"F")," yang digunakan sebagai tipe data closure ",(0,t.kt)("inlineCode",{parentName:"li"},"cond_fn")," dengan skema ",(0,t.kt)("inlineCode",{parentName:"li"},"Fn(&T) -> bool"),", yang jika diilustrasikan dalam bentuk closure adalah ",(0,t.kt)("inlineCode",{parentName:"li"},"|param1: &T| -> bool { }"),".")),(0,t.kt)("p",null,"Di dalam fungsi tersebut, data slice di-loop, kemudian tiap elemen-nya digunakan sebagai parameter pemanggilan closure ",(0,t.kt)("inlineCode",{parentName:"p"},"cond_fn"),"."),(0,t.kt)("p",null,"Jika nilai balik pemanggilan closure adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"true")," maka ",(0,t.kt)("inlineCode",{parentName:"p"},"i")," dikembalikan dalam bentuk ",(0,t.kt)("inlineCode",{parentName:"p"},"i32")," (ada proses casting). Dan jika tidak diketemukan, maka indeks ",(0,t.kt)("inlineCode",{parentName:"p"},"-1")," dikembalikan."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"as")," digunakan untuk casting tipe data. Lebih jelasnya dibahas pada chapter ",(0,t.kt)("a",{parentName:"p",href:"/basic/type-alias-casting"},"Type Alias & Casting")," dan ",(0,t.kt)("a",{parentName:"p",href:"#/wip/trait-conversion-from-into"},"Trait \u279c Conversion (From & Into)"))),(0,t.kt)("p",null,"Jalankan program tersebut."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'let numbers = [24, 13, 2, 53, 3];\nlet number_to_find = 53;\nlet index = find_index(&numbers, |e: &i32| -> bool {\n if *e == number_to_find {\n true \n } else {\n false\n }\n});\n\nprintln!("number_to_find: {number_to_find}");\nprintln!("index: {index}");\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Closure",src:n(3451).Z,width:"324",height:"108"})),(0,t.kt)("p",null,"Bisa dilihat program berjalan sesuai harapan."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Keyword ",(0,t.kt)("inlineCode",{parentName:"p"},"Fn")," merupakan salah satu trait function yang ada di Rust. Lebih jelasnya perihal keyword tersebut dibahas pada chapter selanjutnya, yaitu ",(0,t.kt)("a",{parentName:"p",href:"/basic/trait-function"},"Trait \u279c Function"))),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/closures"},"github.com/novalagung/dasarpemrogramanrust-example/../closures")),(0,t.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/function"},"Function")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/generics"},"Generics")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/borrowing"},"Borrowing")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/basic/trait-function"},"Trait \u279c Function (Fn, FnMut, FnOnce)"))),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch13-01-closures.html"},"https://doc.rust-lang.org/book/ch13-01-closures.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/beta/rust-by-example/fn/closures.html"},"https://doc.rust-lang.org/beta/rust-by-example/fn/closures.html"))))}k.isMDXComponent=!0},6894:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/closures-1-2c7599bfed946d5bd1fb34a57acd9de7.png"},3022:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/closures-2-35b45e21715884c98b155c79b2d8f1c4.png"},2682:(a,e,n)=>{n.d(e,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUQAAABpCAIAAADNzc3NAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiP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SGz4XiYGT2S07SA8ZtNszizGQ/ILxmLhjm8n2IotaEWSzx+q1rF2a08QuOV1q5fD9c7GYXadDIZFN/awIi8/n9nO5mRWCWGSU7BHzOTLWGmaIowkxRFGHW02bjsXDL0ymKMFMURZgpiiLMFEWYKYq6JpjptU9RhLmB6MpPUdtNszeyzPRKoKg4zIu99rP3LrsDadyt8QqVrzdzOk9RtZZ5ttc+jEMwuUXod6QrYSbLFLUc5phvII5DcDrrZa63H135KWpjmI04BBOQS1nkopmitoMZ89oleF6OIl35KWptmLHXvmF+x7Tass7YACPLFGGuXJ3O9drPtrjB/rWxtx0oEkmmKL7OSVGEmaIowkxRFGGmKIowUxRhpiiKMFMURZgpiiLMFEWYKYoizBRFEWaKoggzRVGD/geWHMKpfLG1lAAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/bd9b9d52.1a1bfa13.js b/assets/js/bd9b9d52.1a1bfa13.js new file mode 100644 index 00000000..2b7101bc --- /dev/null +++ b/assets/js/bd9b9d52.1a1bfa13.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[909],{3905:(a,e,t)=>{t.d(e,{Zo:()=>k,kt:()=>o});var n=t(7294);function i(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function r(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),t.push.apply(t,n)}return t}function l(a){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?r(Object(t),!0).forEach((function(e){i(a,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(t,e))}))}return a}function p(a,e){if(null==a)return{};var t,n,i=function(a,e){if(null==a)return{};var t,n,i={},r=Object.keys(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||(i[t]=a[t]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(a,t)&&(i[t]=a[t])}return i}var u=n.createContext({}),d=function(a){var e=n.useContext(u),t=e;return a&&(t="function"==typeof a?a(e):l(l({},e),a)),t},k=function(a){var e=d(a.components);return n.createElement(u.Provider,{value:e},a.children)},m={inlineCode:"code",wrapper:function(a){var e=a.children;return n.createElement(n.Fragment,{},e)}},s=n.forwardRef((function(a,e){var t=a.components,i=a.mdxType,r=a.originalType,u=a.parentName,k=p(a,["components","mdxType","originalType","parentName"]),s=d(t),o=i,g=s["".concat(u,".").concat(o)]||s[o]||m[o]||r;return t?n.createElement(g,l(l({ref:e},k),{},{components:t})):n.createElement(g,l({ref:e},k))}));function o(a,e){var t=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=t.length,l=new Array(r);l[0]=s;var p={};for(var u in e)hasOwnProperty.call(e,u)&&(p[u]=e[u]);p.originalType=a,p.mdxType="string"==typeof a?a:i,l[1]=p;for(var d=2;d<r;d++)l[d]=t[d];return n.createElement.apply(null,l)}return n.createElement.apply(null,t)}s.displayName="MDXCreateElement"},5943:(a,e,t)=>{t.r(e),t.d(e,{assets:()=>u,contentTitle:()=>l,default:()=>m,frontMatter:()=>r,metadata:()=>p,toc:()=>d});var n=t(7462),i=(t(7294),t(3905));const r={sidebar_position:5,title:"A.5. Tipe Data \u279c Primitive Scalar",sidebar_label:"A.5. Tipe Data \u279c Primitive Scalar"},l=void 0,p={unversionedId:"basic/tipe-data-primitive-scalar",id:"basic/tipe-data-primitive-scalar",title:"A.5. Tipe Data \u279c Primitive Scalar",description:"Tipe data di Rust dikategorikan menjadi beberapa group, salah satunya adalah group tipe data primitif scalar atau biasa disebut scalar types. Pada chapter ini kita akan mempelajarinya.",source:"@site/docs/basic/tipe-data-primitive-scalar.md",sourceDirName:"basic",slug:"/basic/tipe-data-primitive-scalar",permalink:"/basic/tipe-data-primitive-scalar",draft:!1,tags:[],version:"current",sidebarPosition:5,frontMatter:{sidebar_position:5,title:"A.5. Tipe Data \u279c Primitive Scalar",sidebar_label:"A.5. Tipe Data \u279c Primitive Scalar"},sidebar:"tutorialSidebar",previous:{title:"A.4. Variabel",permalink:"/basic/variabel"},next:{title:"A.6. Tipe Data \u279c String Literal (&str)",permalink:"/basic/tipe-data-string-literal"}},u={},d=[{value:"A.5.1. Signed integers",id:"a51-signed-integers",level:2},{value:"A.5.2. Unsigned integers",id:"a52-unsigned-integers",level:2},{value:"A.5.3. Floating point",id:"a53-floating-point",level:2},{value:"A.5.4. Bool",id:"a54-bool",level:2},{value:"A.5.5. Char",id:"a55-char",level:2},{value:"A.5.6. Pointer scalar",id:"a56-pointer-scalar",level:2},{value:"A.5.7. Tipe data primitive compound",id:"a57-tipe-data-primitive-compound",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],k={toc:d};function m(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,n.Z)({},k,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Tipe data di Rust dikategorikan menjadi beberapa group, salah satunya adalah group tipe data primitif scalar atau biasa disebut ",(0,i.kt)("strong",{parentName:"p"},"scalar types"),". Pada chapter ini kita akan mempelajarinya."),(0,i.kt)("p",null,"Tipe data scalar sendiri merupakan tipe data primitif yang isinya hanya 1 nilai. Rust memiliki 4 tipe scalar, yaitu integers, floating-point, boolean, dan character."),(0,i.kt)("h2",{id:"a51-signed-integers"},"A.5.1. Signed integers"),(0,i.kt)("p",null,"Signed integer merupakan tipe data numerik/integer yang bisa menampung nilai positif dan juga negatif. Ada beberapa tipe data singed integer tersedia di Rust yang dibedakan sesuai size-nya."),(0,i.kt)("p",null,"Tipe data ini keyword-nya ditandai dengan huruf awalan ",(0,i.kt)("inlineCode",{parentName:"p"},"i"),", contohnya ",(0,i.kt)("inlineCode",{parentName:"p"},"i8"),", yang mana tipe ini adalah tipe data numerik integer dengan range value yang bisa ditampung adalah mulai dari angka ",(0,i.kt)("strong",{parentName:"p"},"\u2212128")," (didapat dari \u2212(2",(0,i.kt)("sup",null,"7"),") hingga ",(0,i.kt)("strong",{parentName:"p"},"127")," (didapat dari 2",(0,i.kt)("sup",null,"7"),"-1)."),(0,i.kt)("p",null,"Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let numerik1 = 24;\nlet numerik2: i8 = 2;\nlet numerik3: i64 = 12;\n\nprintln!("{} | {} | {}", numerik1, numerik2, numerik3);\n// output ==> 24 | 2 | 12\n')),(0,i.kt)("p",null,"Dengan menggunakan teknik deklarasi ",(0,i.kt)("em",{parentName:"p"},"type inference"),", maka default angka numerik tipe datanya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),"."),(0,i.kt)("p",null,"Range value pada tipe data itu cukup penting untuk diperhatikan, jika ada sebuah variabel yang tipe datanya pasti dan diisi dengan nilai di luar kapasitas yang bisa ditampung, maka akan muncul error. Contoh, tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"i8"),", jika diisi nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"128")," maka error."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"data type error",src:t(4362).Z,width:"642",height:"488"})),(0,i.kt)("p",null,"Umumnya, tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"i32")," cukup digunakan untuk kebutuhan menampung nilai, namun sebenarnya ada banyak case lainnya di mana kita perlu tipe dengan size yang lebih besar seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"i64"),"."),(0,i.kt)("p",null,"Berikut merupakan list tipe data signed integers yang ada di Rust. Tidak perlu dihafal."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Tipe data"),(0,i.kt)("th",{parentName:"tr",align:null},"Deskripsi"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"i8")),(0,i.kt)("td",{parentName:"tr",align:null},"\u2212(2",(0,i.kt)("sup",null,"7"),") hingga (2",(0,i.kt)("sup",null,"7"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"i16")),(0,i.kt)("td",{parentName:"tr",align:null},"\u2212(2",(0,i.kt)("sup",null,"15"),") hingga (2",(0,i.kt)("sup",null,"15"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"i32")),(0,i.kt)("td",{parentName:"tr",align:null},"\u2212(2",(0,i.kt)("sup",null,"31"),") hingga (2",(0,i.kt)("sup",null,"31"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"i64")),(0,i.kt)("td",{parentName:"tr",align:null},"\u2212(2",(0,i.kt)("sup",null,"63"),") hingga (2",(0,i.kt)("sup",null,"63"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"i128")),(0,i.kt)("td",{parentName:"tr",align:null},"\u2212(2",(0,i.kt)("sup",null,"127"),") hingga (2",(0,i.kt)("sup",null,"127"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"isize")),(0,i.kt)("td",{parentName:"tr",align:null},"tipe pointer")))),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya tentang tipe data ",(0,i.kt)("strong",{parentName:"p"},"pointer")," dibahas pada chapter terpisah, ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"))),(0,i.kt)("p",null,"Bisa gunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"tipedata::MIN")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"tipedata::MAX")," untuk mengetahui nilai minimal dan juga maksimal tipe data signed integers."),(0,i.kt)("p",null,"Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let min_i8 = i8::MIN;\nlet max_i8 = i8::MAX;\n\nprintln!("{} | {}", min_i8, max_i8);\n// output ==> -128 | 127\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"i8::MIN")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"i8::MAX")," memiliki tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"::")," yang di Rust merupakan path separator. Untuk sekarang penulis anjurkan tidak terlalu pusing memahami apa itu path separator, karena nantinya akan ada pembahasan yang cukup detail khusus untuk mengupas topik tersebut.")),(0,i.kt)("h2",{id:"a52-unsigned-integers"},"A.5.2. Unsigned integers"),(0,i.kt)("p",null,"Perbedaan antara signed dan unsigned adalah pada range value yang ditampung, size-nya sama, hanya angka minimal dan maksimalnya berbeda."),(0,i.kt)("p",null,"Unsigned di sini maksudnya adalah hanya bisa menampung angka mulai dari 0. Tipe data unsigned tidak bisa menampung angka negatif (jika dipaksa akan memunculkan error)."),(0,i.kt)("p",null,"Berikut list tipe data unsigned integer pada Rust:"),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Tipe data"),(0,i.kt)("th",{parentName:"tr",align:null},"Deskripsi"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"u8")),(0,i.kt)("td",{parentName:"tr",align:null},"0 hingga (2",(0,i.kt)("sup",null,"8"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"u16")),(0,i.kt)("td",{parentName:"tr",align:null},"0 hingga (2",(0,i.kt)("sup",null,"16"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"u32")),(0,i.kt)("td",{parentName:"tr",align:null},"0 hingga (2",(0,i.kt)("sup",null,"32"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"u64")),(0,i.kt)("td",{parentName:"tr",align:null},"0 hingga (2",(0,i.kt)("sup",null,"64"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"u128")),(0,i.kt)("td",{parentName:"tr",align:null},"0 hingga (2",(0,i.kt)("sup",null,"128"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"usize")),(0,i.kt)("td",{parentName:"tr",align:null},"tipe pointer")))),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya tentang tipe data ",(0,i.kt)("strong",{parentName:"p"},"pointer")," dibahas pada chapter terpisah, ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"))),(0,i.kt)("p",null,"Contoh penerapan unsigned integer:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let numerik4: u32 = 28;\nlet numerik5: u8 = 16;\nlet numerik6: u64 = 42;\n\nprintln!("{} | {} | {}", numerik4, numerik5, numerik6);\n// output ==> 28 | 16 | 42\n')),(0,i.kt)("p",null,"Bisa gunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"tipedata::MIN")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"tipedata::MAX")," untuk mengetahui nilai minimal dan juga maksimal tipe data unsigned integers."),(0,i.kt)("p",null,"Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let min_u8 = u8::MIN;\nlet max_u8 = u8::MAX;\n\nprintln!("{} | {}", min_u8, max_u8);\n// output ==> 0 | 255\n')),(0,i.kt)("p",null,"Catatan saja, variabel yang dideklarasikan dengan predefined value adalah numerik, by default tipe datanya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"i32")," (signed)."),(0,i.kt)("h2",{id:"a53-floating-point"},"A.5.3. Floating point"),(0,i.kt)("p",null,"Floating point adalah tipe data yang mendukung nilai dibelakang koma, contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"3.14"),". Di Rust ada dua tipe data floating point, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"f32")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"f64"),". Contoh penggunaan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let fp1: f32 = 3.14;\nlet fp2: f64 = 3.1415926535;\n\nprintln!("{} | {:.5}", fp1, fp2);\n// output ==> 3.14 | 3.14159\n')),(0,i.kt)("p",null,"O iya, jumlah digit di belakang koma bisa diatur saat diprint menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),". Caranya dengan menggunakan notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"{:.n}"),". Sebagai contoh ",(0,i.kt)("inlineCode",{parentName:"p"},"{:.5}")," maka akan menampilkan hanya 5 digit dibelakang koma."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Dalam penerapan definisi variabel sekaligus nilai, jika nilai dituliskan dalam desimal seperti contohnya ",(0,i.kt)("inlineCode",{parentName:"p"},"24"),", maka tipe data variabel penampung adalah numerik."),(0,i.kt)("p",{parentName:"blockquote"},"Jika dituliskan dalam notasi floating point, contohnya ",(0,i.kt)("inlineCode",{parentName:"p"},"3.14"),", maka tipe data variabel penampung adalah float.")),(0,i.kt)("p",null,"Bisa gunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"tipedata::MIN")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"tipedata::MAX")," untuk mengetahui nilai minimal dan juga maksimal tipe data floating point."),(0,i.kt)("p",null,"Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let min_f32 = f32::MIN;\nlet max_f32 = f32::MAX;\n\nprintln!("min_f32={} | max_f32={}", min_f32, max_f32);\n// output ==> min_f32=-340282350000000000000000000000000000000 | max_f32=340282350000000000000000000000000000000\n')),(0,i.kt)("p",null,"Catatan saja, variabel yang dideklarasikan dengan predefined value numerik yang ada titiknya (",(0,i.kt)("inlineCode",{parentName:"p"},"3.10"),") adalah floating point, by default tipe datanya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"f64"),"."),(0,i.kt)("h2",{id:"a54-bool"},"A.5.4. Bool"),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"bool")," menerima dua pilihan nilai saja, ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let b1 = true;\nlet b2 = false;\n\nprintln!("{} | {}", b1, b2);\n// output ==> true | false\n')),(0,i.kt)("h2",{id:"a55-char"},"A.5.5. Char"),(0,i.kt)("p",null,"Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"char")," menampung sebuah data (unicode), contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"'n'"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"'-'"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"'2'"),". Penulisan literal untuk tipe ini menggunakan notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"''"),", diapit tanda petik satu."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let c1 = 'n';\nlet c2 = '-';\nlet c3 = '2';\n\nprintln!(\"{} | {} | {}\", c1, c2, c3);\n// output ==> n | - | 2\n")),(0,i.kt)("h2",{id:"a56-pointer-scalar"},"A.5.6. Pointer scalar"),(0,i.kt)("p",null,"Deklarasi tipe data pointer cukup mudah, yaitu dengan menuliskan deklarasinya seperti biasa tapi ditambahkan karakter ",(0,i.kt)("inlineCode",{parentName:"p"},"&"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let ptr1: &i32 = &24;\nprintln!("{}", ptr1);\n// output ==> 24\n')),(0,i.kt)("p",null,"Perihal apa itu tipe data pointer dan apa kegunaan prefix ",(0,i.kt)("inlineCode",{parentName:"p"},"&")," akan dibahas pada chapter terpisah, yaitu ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"),"."),(0,i.kt)("h2",{id:"a57-tipe-data-primitive-compound"},"A.5.7. Tipe data primitive compound"),(0,i.kt)("p",null,"Selain beberapa tipe data yang sudah dibahas di atas, ada juga jenis tipe data primitif jenis lainnya, yaitu primitive compound yang di antaranya adalah ",(0,i.kt)("a",{parentName:"p",href:"/basic/array"},"Array")," dan ",(0,i.kt)("a",{parentName:"p",href:"/basic/tuple"},"Tuple"),". Lebih detailnya mengenai tipe tersebut dibahas pada chapter terpisah."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/tipe_data_primitive_scalar"},"github.com/novalagung/dasarpemrogramanrust-example/../tipe_data_primitive_scalar")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/tipe-data-string-literal"},"Tipe Data \u279c String Literal (&str)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/array"},"Array")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/slice"},"Slice (Basic)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/tuple"},"Tuple")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/tipe-data-custom-type-string-slice"},"Tipe Data \u279c String Custom Type"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/primitives.html"},"https://doc.rust-lang.org/rust-by-example/primitives.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/fmt/index.html#syntax"},"https://doc.rust-lang.org/std/fmt/index.html#syntax")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://en.wikipedia.org/wiki/Integer_(computer_science)"},"https://en.wikipedia.org/wiki/Integer_(computer_science)"))))}m.isMDXComponent=!0},4362:(a,e,t)=>{t.d(e,{Z:()=>n});const n=t.p+"assets/images/tipe-data-primitive-scalar-1-7710e1ad76b0cc40fbae8a8d42ead294.png"}}]); \ No newline at end of file diff --git a/assets/js/bd9b9d52.c2ec587a.js b/assets/js/bd9b9d52.c2ec587a.js deleted file mode 100644 index 74682a5d..00000000 --- a/assets/js/bd9b9d52.c2ec587a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[909],{3905:(a,e,t)=>{t.d(e,{Zo:()=>k,kt:()=>o});var n=t(7294);function i(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function r(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),t.push.apply(t,n)}return t}function l(a){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?r(Object(t),!0).forEach((function(e){i(a,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(t,e))}))}return a}function p(a,e){if(null==a)return{};var t,n,i=function(a,e){if(null==a)return{};var t,n,i={},r=Object.keys(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||(i[t]=a[t]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(a,t)&&(i[t]=a[t])}return i}var u=n.createContext({}),d=function(a){var e=n.useContext(u),t=e;return a&&(t="function"==typeof a?a(e):l(l({},e),a)),t},k=function(a){var e=d(a.components);return n.createElement(u.Provider,{value:e},a.children)},m={inlineCode:"code",wrapper:function(a){var e=a.children;return n.createElement(n.Fragment,{},e)}},s=n.forwardRef((function(a,e){var t=a.components,i=a.mdxType,r=a.originalType,u=a.parentName,k=p(a,["components","mdxType","originalType","parentName"]),s=d(t),o=i,g=s["".concat(u,".").concat(o)]||s[o]||m[o]||r;return t?n.createElement(g,l(l({ref:e},k),{},{components:t})):n.createElement(g,l({ref:e},k))}));function o(a,e){var t=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=t.length,l=new Array(r);l[0]=s;var p={};for(var u in e)hasOwnProperty.call(e,u)&&(p[u]=e[u]);p.originalType=a,p.mdxType="string"==typeof a?a:i,l[1]=p;for(var d=2;d<r;d++)l[d]=t[d];return n.createElement.apply(null,l)}return n.createElement.apply(null,t)}s.displayName="MDXCreateElement"},5943:(a,e,t)=>{t.r(e),t.d(e,{assets:()=>u,contentTitle:()=>l,default:()=>m,frontMatter:()=>r,metadata:()=>p,toc:()=>d});var n=t(7462),i=(t(7294),t(3905));const r={sidebar_position:5,title:"A.5. Tipe Data \u279c Primitive Scalar",sidebar_label:"A.5. Tipe Data \u279c Primitive Scalar"},l=void 0,p={unversionedId:"basic/tipe-data-primitive-scalar",id:"basic/tipe-data-primitive-scalar",title:"A.5. Tipe Data \u279c Primitive Scalar",description:"Tipe data di Rust dikategorikan menjadi beberapa group, salah satunya adalah group tipe data primitif scalar atau biasa disebut scalar types. Pada chapter ini kita akan mempelajarinya.",source:"@site/docs/basic/tipe-data-primitive-scalar.md",sourceDirName:"basic",slug:"/basic/tipe-data-primitive-scalar",permalink:"/basic/tipe-data-primitive-scalar",draft:!1,tags:[],version:"current",sidebarPosition:5,frontMatter:{sidebar_position:5,title:"A.5. Tipe Data \u279c Primitive Scalar",sidebar_label:"A.5. Tipe Data \u279c Primitive Scalar"},sidebar:"tutorialSidebar",previous:{title:"A.4. Variabel",permalink:"/basic/variabel"},next:{title:"A.6. Tipe Data \u279c String Literal (&str)",permalink:"/basic/tipe-data-string-literal"}},u={},d=[{value:"A.5.1. Signed integers",id:"a51-signed-integers",level:2},{value:"A.5.2. Unsigned integers",id:"a52-unsigned-integers",level:2},{value:"A.5.3. Floating point",id:"a53-floating-point",level:2},{value:"A.5.4. Bool",id:"a54-bool",level:2},{value:"A.5.5. Char",id:"a55-char",level:2},{value:"A.5.6. Pointer scalar",id:"a56-pointer-scalar",level:2},{value:"A.5.7. Tipe data primitive compound",id:"a57-tipe-data-primitive-compound",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],k={toc:d};function m(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,n.Z)({},k,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Tipe data di Rust dikategorikan menjadi beberapa group, salah satunya adalah group tipe data primitif scalar atau biasa disebut ",(0,i.kt)("strong",{parentName:"p"},"scalar types"),". Pada chapter ini kita akan mempelajarinya."),(0,i.kt)("p",null,"Tipe data scalar sendiri merupakan tipe data primitif yang isinya hanya 1 nilai. Rust memiliki 4 tipe scalar, yaitu integers, floating-point, boolean, dan character."),(0,i.kt)("h2",{id:"a51-signed-integers"},"A.5.1. Signed integers"),(0,i.kt)("p",null,"Signed integer merupakan tipe data numerik/integer yang bisa menampung nilai positif dan juga negatif. Ada beberapa tipe data singed integer tersedia di Rust yang dibedakan sesuai size-nya."),(0,i.kt)("p",null,"Tipe data ini keyword-nya ditandai dengan huruf awalan ",(0,i.kt)("inlineCode",{parentName:"p"},"i"),", contohnya ",(0,i.kt)("inlineCode",{parentName:"p"},"i8"),", yang mana tipe ini adalah tipe data numerik integer dengan range value yang bisa ditampung adalah mulai dari angka ",(0,i.kt)("strong",{parentName:"p"},"\u2212128")," (didapat dari \u2212(2",(0,i.kt)("sup",null,"7"),") hingga ",(0,i.kt)("strong",{parentName:"p"},"127")," (didapat dari 2",(0,i.kt)("sup",null,"7"),"-1)."),(0,i.kt)("p",null,"Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let numerik1 = 24;\nlet numerik2: i8 = 2;\nlet numerik3: i64 = 12;\n\nprintln!("{} | {} | {}", numerik1, numerik2, numerik3);\n// output ==> 24 | 2 | 12\n')),(0,i.kt)("p",null,"Dengan menggunakan teknik deklarasi ",(0,i.kt)("em",{parentName:"p"},"type inference"),", maka default angka numerik tipe datanya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),"."),(0,i.kt)("p",null,"Range value pada tipe data itu cukup penting untuk diperhatikan, jika ada sebuah variabel yang tipe datanya pasti dan diisi dengan nilai di luar kapasitas yang bisa ditampung, maka akan muncul error. Contoh, tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"i8"),", jika diisi nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"128")," maka error."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"data type error",src:t(4362).Z,width:"642",height:"488"})),(0,i.kt)("p",null,"Umumnya, tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"i32")," cukup digunakan untuk kebutuhan menampung nilai, namun sebenarnya ada banyak case lainnya di mana kita perlu tipe dengan size yang lebih besar seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"i64"),"."),(0,i.kt)("p",null,"Berikut merupakan list tipe data signed integers yang ada di Rust. Tidak perlu dihafal."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Tipe data"),(0,i.kt)("th",{parentName:"tr",align:null},"Deskripsi"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"i8")),(0,i.kt)("td",{parentName:"tr",align:null},"\u2212(2",(0,i.kt)("sup",null,"7"),") hingga (2",(0,i.kt)("sup",null,"7"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"i16")),(0,i.kt)("td",{parentName:"tr",align:null},"\u2212(2",(0,i.kt)("sup",null,"15"),") hingga (2",(0,i.kt)("sup",null,"15"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"i32")),(0,i.kt)("td",{parentName:"tr",align:null},"\u2212(2",(0,i.kt)("sup",null,"31"),") hingga (2",(0,i.kt)("sup",null,"31"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"i64")),(0,i.kt)("td",{parentName:"tr",align:null},"\u2212(2",(0,i.kt)("sup",null,"63"),") hingga (2",(0,i.kt)("sup",null,"63"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"i128")),(0,i.kt)("td",{parentName:"tr",align:null},"\u2212(2",(0,i.kt)("sup",null,"127"),") hingga (2",(0,i.kt)("sup",null,"127"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"isize")),(0,i.kt)("td",{parentName:"tr",align:null},"tipe pointer")))),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya tentang tipe data ",(0,i.kt)("strong",{parentName:"p"},"pointer")," dibahas pada chapter terpisah, ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"))),(0,i.kt)("p",null,"Bisa gunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"tipedata::MIN")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"tipedata::MAX")," untuk mengetahui nilai minimal dan juga maksimal tipe data signed integers."),(0,i.kt)("p",null,"Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let min_i8 = i8::MIN;\nlet max_i8 = i8::MAX;\n\nprintln!("{} | {}", min_i8, max_i8);\n// output ==> -128 | 127\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"i8::MIN")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"i8::MAX")," memiliki tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"::")," yang di Rust merupakan path separator. Untuk sekarang penulis anjurkan tidak terlalu pusing memahami apa itu path separator, karena nantinya akan ada pembahasan yang cukup detail khusus untuk mengupas topik tersebut.")),(0,i.kt)("h2",{id:"a52-unsigned-integers"},"A.5.2. Unsigned integers"),(0,i.kt)("p",null,"Perbedaan antara signed dan unsigned adalah pada range value yang ditampung, size-nya sama, hanya angka minimal dan maksimalnya berbeda."),(0,i.kt)("p",null,"Unsigned di sini maksudnya adalah hanya bisa menampung angka mulai dari 0. Tipe data unsigned tidak bisa menampung angka negatif (jika dipaksa akan memunculkan error)."),(0,i.kt)("p",null,"Berikut list tipe data unsigned integer pada Rust:"),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Tipe data"),(0,i.kt)("th",{parentName:"tr",align:null},"Deskripsi"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"u8")),(0,i.kt)("td",{parentName:"tr",align:null},"0 hingga (2",(0,i.kt)("sup",null,"8"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"u16")),(0,i.kt)("td",{parentName:"tr",align:null},"0 hingga (2",(0,i.kt)("sup",null,"16"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"u32")),(0,i.kt)("td",{parentName:"tr",align:null},"0 hingga (2",(0,i.kt)("sup",null,"32"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"u64")),(0,i.kt)("td",{parentName:"tr",align:null},"0 hingga (2",(0,i.kt)("sup",null,"64"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"u128")),(0,i.kt)("td",{parentName:"tr",align:null},"0 hingga (2",(0,i.kt)("sup",null,"128"),")-1")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"usize")),(0,i.kt)("td",{parentName:"tr",align:null},"tipe pointer")))),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya tentang tipe data ",(0,i.kt)("strong",{parentName:"p"},"pointer")," dibahas pada chapter terpisah, ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"))),(0,i.kt)("p",null,"Contoh penerapan unsigned integer:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let numerik4: u32 = 28;\nlet numerik5: u8 = 16;\nlet numerik6: u64 = 42;\n\nprintln!("{} | {} | {}", numerik4, numerik5, numerik6);\n// output ==> 28 | 16 | 42\n')),(0,i.kt)("p",null,"Bisa gunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"tipedata::MIN")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"tipedata::MAX")," untuk mengetahui nilai minimal dan juga maksimal tipe data unsigned integers."),(0,i.kt)("p",null,"Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let min_u8 = u8::MIN;\nlet max_u8 = u8::MAX;\n\nprintln!("{} | {}", min_u8, max_u8);\n// output ==> 0 | 255\n')),(0,i.kt)("p",null,"Catatan saja, variabel yang dideklarasikan dengan predefined value adalah numerik, by default tipe datanya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"i32")," (signed)."),(0,i.kt)("h2",{id:"a53-floating-point"},"A.5.3. Floating point"),(0,i.kt)("p",null,"Floating point adalah tipe data yang mendukung nilai dibelakang koma, contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"3.14"),". Di Rust ada dua tipe data floating point, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"f32")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"f64"),". Contoh penggunaan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let fp1: f32 = 3.14;\nlet fp2: f64 = 3.1415926535;\n\nprintln!("{} | {:.5}", fp1, fp2);\n// output ==> 3.14 | 3.14159\n')),(0,i.kt)("p",null,"O iya, jumlah digit di belakang koma bisa diatur saat diprint menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),". Caranya dengan menggunakan notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"{:.n}"),". Sebagai contoh ",(0,i.kt)("inlineCode",{parentName:"p"},"{:.5}")," maka akan menampilkan hanya 5 digit dibelakang koma."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Dalam penerapan definisi variabel sekaligus nilai, jika nilai dituliskan dalam desimal seperti contohnya ",(0,i.kt)("inlineCode",{parentName:"p"},"24"),", maka tipe data variabel penampung adalah numerik."),(0,i.kt)("p",{parentName:"blockquote"},"Jika dituliskan dalam notasi floating point, contohnya ",(0,i.kt)("inlineCode",{parentName:"p"},"3.14"),", maka tipe data variabel penampung adalah float.")),(0,i.kt)("p",null,"Bisa gunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"tipedata::MIN")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"tipedata::MAX")," untuk mengetahui nilai minimal dan juga maksimal tipe data floating point."),(0,i.kt)("p",null,"Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let min_f32 = f32::MIN;\nlet max_f32 = f32::MAX;\n\nprintln!("min_f32={} | max_f32={}", min_f32, max_f32);\n// output ==> min_f32=-340282350000000000000000000000000000000 | max_f32=340282350000000000000000000000000000000\n')),(0,i.kt)("p",null,"Catatan saja, variabel yang dideklarasikan dengan predefined value numerik yang ada titiknya (",(0,i.kt)("inlineCode",{parentName:"p"},"3.10"),") adalah floating point, by default tipe datanya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"f64"),"."),(0,i.kt)("h2",{id:"a54-bool"},"A.5.4. Bool"),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"bool")," menerima dua pilihan nilai saja, ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let b1 = true;\nlet b2 = false;\n\nprintln!("{} | {}", b1, b2);\n// output ==> true | false\n')),(0,i.kt)("h2",{id:"a55-char"},"A.5.5. Char"),(0,i.kt)("p",null,"Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"char")," menampung sebuah data (unicode), contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"'n'"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"'-'"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"'2'"),". Penulisan literal untuk tipe ini menggunakan notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"''"),", diapit tanda petik satu."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let c1 = 'n';\nlet c2 = '-';\nlet c3 = '2';\n\nprintln!(\"{} | {} | {}\", c1, c2, c3);\n// output ==> n | - | 2\n")),(0,i.kt)("h2",{id:"a56-pointer-scalar"},"A.5.6. Pointer scalar"),(0,i.kt)("p",null,"Deklarasi tipe data pointer cukup mudah, yaitu dengan menuliskan deklarasinya seperti biasa tapi ditambahkan karakter ",(0,i.kt)("inlineCode",{parentName:"p"},"&"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let ptr1: &i32 = &24;\nprintln!("{}", ptr1);\n// output ==> 24\n')),(0,i.kt)("p",null,"Perihal apa itu tipe data pointer dan apa kegunaan prefix ",(0,i.kt)("inlineCode",{parentName:"p"},"&")," akan dibahas pada chapter terpisah, yaitu ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"),"."),(0,i.kt)("h2",{id:"a57-tipe-data-primitive-compound"},"A.5.7. Tipe data primitive compound"),(0,i.kt)("p",null,"Selain beberapa tipe data yang sudah dibahas di atas, ada juga jenis tipe data primitif jenis lainnya, yaitu primitive compound yang di antaranya adalah ",(0,i.kt)("a",{parentName:"p",href:"/basic/array"},"Array")," dan ",(0,i.kt)("a",{parentName:"p",href:"/basic/tuple"},"Tuple"),". Lebih detailnya mengenai tipe tersebut dibahas pada chapter terpisah."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/tipe_data_primitive_scalar"},"github.com/novalagung/dasarpemrogramanrust-example/../tipe_data_primitive_scalar")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/tipe-data-string-literal"},"Tipe Data \u279c String Literal (&str)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/array"},"Array")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/slice"},"Slice (Basic)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/tuple"},"Tuple")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/tipe-data-custom-type-string-slice"},"Tipe Data \u279c String Custom Type"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/primitives.html"},"https://doc.rust-lang.org/rust-by-example/primitives.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/fmt/index.html#syntax"},"https://doc.rust-lang.org/std/fmt/index.html#syntax")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://en.wikipedia.org/wiki/Integer_(computer_science)"},"https://en.wikipedia.org/wiki/Integer_(computer_science)"))))}m.isMDXComponent=!0},4362:(a,e,t)=>{t.d(e,{Z:()=>n});const n=t.p+"assets/images/tipe-data-primitive-scalar-1-7710e1ad76b0cc40fbae8a8d42ead294.png"}}]); \ No newline at end of file diff --git a/assets/js/bdfc7662.5ed547e8.js b/assets/js/bdfc7662.5ed547e8.js deleted file mode 100644 index 889c2c09..00000000 --- a/assets/js/bdfc7662.5ed547e8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[7720],{3905:(e,a,n)=>{n.d(a,{Zo:()=>d,kt:()=>c});var t=n(7294);function i(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function r(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function l(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?r(Object(n),!0).forEach((function(a){i(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function o(e,a){if(null==e)return{};var n,t,i=function(e,a){if(null==e)return{};var n,t,i={},r=Object.keys(e);for(t=0;t<r.length;t++)n=r[t],a.indexOf(n)>=0||(i[n]=e[n]);return i}(e,a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t<r.length;t++)n=r[t],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var u=t.createContext({}),m=function(e){var a=t.useContext(u),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},d=function(e){var a=m(e.components);return t.createElement(u.Provider,{value:a},e.children)},s={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},p=t.forwardRef((function(e,a){var n=e.components,i=e.mdxType,r=e.originalType,u=e.parentName,d=o(e,["components","mdxType","originalType","parentName"]),p=m(n),c=i,g=p["".concat(u,".").concat(c)]||p[c]||s[c]||r;return n?t.createElement(g,l(l({ref:a},d),{},{components:n})):t.createElement(g,l({ref:a},d))}));function c(e,a){var n=arguments,i=a&&a.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=p;var o={};for(var u in a)hasOwnProperty.call(a,u)&&(o[u]=a[u]);o.originalType=e,o.mdxType="string"==typeof e?e:i,l[1]=o;for(var m=2;m<r;m++)l[m]=n[m];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}p.displayName="MDXCreateElement"},2486:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>u,contentTitle:()=>l,default:()=>s,frontMatter:()=>r,metadata:()=>o,toc:()=>m});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:24,title:"A.24. Associated Function",sidebar_label:"A.24. Associated Function"},l=void 0,o={unversionedId:"basic/associated-function",id:"basic/associated-function",title:"A.24. Associated Function",description:"Chapter ini membahas tentang associated function. Kita akan belajar apa itu associated function dan apa perbedannya dengan fungsi biasa.",source:"@site/docs/basic/associated-function.md",sourceDirName:"basic",slug:"/basic/associated-function",permalink:"/basic/associated-function",draft:!1,tags:[],version:"current",sidebarPosition:24,frontMatter:{sidebar_position:24,title:"A.24. Associated Function",sidebar_label:"A.24. Associated Function"},sidebar:"tutorialSidebar",previous:{title:"A.23. Struct",permalink:"/basic/struct"},next:{title:"A.25. Method",permalink:"/basic/method"}},u={},m=[{value:"A.24.1. <em>Associated item</em> & <em>associated function</em>",id:"a241-associated-item--associated-function",level:2},{value:"A.24.2. Keyword <code>impl</code>",id:"a242-keyword-impl",level:2},{value:"\u25c9 Fungsi <code>LegoSet::new</code>",id:"-fungsi-legosetnew",level:3},{value:"\u25c9 <em>Naming convention</em> associated function",id:"-naming-convention-associated-function",level:3},{value:"A.24.3. Tipe data <code>Self</code>",id:"a243-tipe-data-self",level:2},{value:"A.24.4. Associated function dalam module",id:"a244-associated-function-dalam-module",level:2},{value:"A.24.5. Tuple struct associated function",id:"a245-tuple-struct-associated-function",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:m};function s(e){let{components:a,...r}=e;return(0,i.kt)("wrapper",(0,t.Z)({},d,r,{components:a,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Chapter ini membahas tentang ",(0,i.kt)("em",{parentName:"p"},"associated function"),". Kita akan belajar apa itu associated function dan apa perbedannya dengan fungsi biasa."),(0,i.kt)("h2",{id:"a241-associated-item--associated-function"},"A.24.1. ",(0,i.kt)("em",{parentName:"h2"},"Associated item")," & ",(0,i.kt)("em",{parentName:"h2"},"associated function")),(0,i.kt)("p",null,(0,i.kt)("em",{parentName:"p"},"Associated item")," adalah item yang memiliki asosiasi/hubungan dengan struct atau trait. Item di sini bisa dalam banyak hal, bisa berupa fungsi atau lainnya."),(0,i.kt)("p",null,"Fungsi yang terhubung dengan suatu struct atau trait disebut dengan ",(0,i.kt)("em",{parentName:"p"},"associated function"),". Fungsi jenis ini ekuivalen seperti fungsi biasa, perbedaannya adalah pada deklarasinya yang harus berada di dalam blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl"),", dan pemanggilannya harus menggunakan notasi path ",(0,i.kt)("inlineCode",{parentName:"p"},"NamaStruct::nama_fungsi"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai trait dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai macam-macam item dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/path-item#a183-rust-items"},"Path & Item")))),(0,i.kt)("p",null,"Ok, mari kita lanjut ke bagian praktik. Silakan tulis kode berikut terlebih dahulu."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[derive(Debug)]\nstruct LegoSet {\n code: i32,\n name: String,\n category: String,\n age_minimum: i32,\n}\n\nfn main() {\n let rough_terrain_crane = LegoSet{\n code: 42082,\n name: String::from("Rough Terrain Crane"),\n category: String::from("Technic"),\n age_minimum: 11,\n };\n\n println!("{:#?}", rough_terrain_crane);\n}\n')),(0,i.kt)("p",null,"Sebuah struct bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet")," didefinisikan memiliki 4 buah property. Di blok kode fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),", dibuat sebuah variabel bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"rough_terrain_crane")," yang merupakan object/instance dari struct ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet"),", kemudian object tersebut di-print."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Object struct bisa di-print menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"println")," karena pada definisi struct ditambahkan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"#[derive(Debug)]"),"."),(0,i.kt)("p",{parentName:"blockquote"},"Lebih detailnya mengenai attribute dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/attributes"},"Attributes"),".")),(0,i.kt)("p",null,"Selanjutnya kita siapkan dua buah fungsi yang berasosiasi dengan struct ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet"),"."),(0,i.kt)("h2",{id:"a242-keyword-impl"},"A.24.2. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"impl")),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," digunakan untuk membuat ",(0,i.kt)("em",{parentName:"p"},"associated item"),"."),(0,i.kt)("p",null,"Pada konteks ini keyword tersebut digunakan untuk membuat ",(0,i.kt)("em",{parentName:"p"},"associated function")," untuk struct ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet"),", sebuah fungsi bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"new")," dengan tugas adalah untuk membantu pembuatan object ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet"),"."),(0,i.kt)("p",null,"Silakan tambahkan blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," berikut setelah definisi struct ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"#[derive(Debug)]\nstruct LegoSet {\n code: i32,\n name: String,\n category: String,\n age_minimum: i32,\n}\n\nimpl LegoSet {\n\n fn new(code: i32, name: String, category: String, age_minimum: i32) -> LegoSet {\n LegoSet { code, name, category, age_minimum }\n }\n}\n")),(0,i.kt)("p",null,"Notasi penulisan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," bisa dilihat pada contoh di atas, cukup tulis saja keyword tersebut diikuti nama struct yang diinginkan, kemudian diikuti dengan blok kode berisi definisi fungsi."),(0,i.kt)("p",null,"Fungsi dalam blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," adalah yang disebut dengan ",(0,i.kt)("em",{parentName:"p"},"associated function"),". Pada contoh di atas, fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"new")," memiliki asosiasi dengan struct ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet"),"."),(0,i.kt)("p",null,"Lanjut, panggil fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"new")," tersebut untuk membuat object baru bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"xtreme_offroader")," lalu print isinya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let rough_terrain_crane = LegoSet{\n code: 42082,\n name: String::from("Rough Terrain Crane"),\n category: String::from("Technic"),\n age_minimum: 11,\n };\n println!("{:#?}", rough_terrain_crane);\n \n let xtreme_offroader = LegoSet::new(\n 42099, \n String::from("4X4 X-treme Off-Roader"), \n String::from("Technic"), \n 11,\n );\n println!("{:#?}", xtreme_offroader);\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Associated function",src:n(8317).Z,width:"447",height:"276"})),(0,i.kt)("p",null,"Bisa dilihat pada blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),", cara pemanggilan associated function adalah dengan menuliskan nama struct diikuti nama fungsi dengan notasi penulisan path."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"NamaStruct::nama_fungsi();\nNamaStruct::nama_fungsi(arg1, arg2, arg3, arg4);\nLegoSet::new(arg1, arg2, arg3, arg4);\n")),(0,i.kt)("p",null,"Jadi seperti itu, semoga cukup jelas. Silakan berkreasi dengan menambahkan ",(0,i.kt)("em",{parentName:"p"},"associated function")," lainnya agar makin terbiasa. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'impl LegoSet {\n\n fn new(code: i32, name: String, category: String, age_minimum: i32) -> LegoSet {\n LegoSet { code, name, category, age_minimum }\n }\n\n fn what_is_lego() {\n println!("Lego is a line of plastic construction toys")\n }\n}\n\nfn main() {\n LegoSet::what_is_lego();\n\n let xtreme_offroader = LegoSet::new(\n 42099, \n String::from("4X4 X-treme Off-Roader"), \n String::from("Technic"), \n 11,\n );\n println!("{:#?}", xtreme_offroader);\n}\n')),(0,i.kt)("h3",{id:"-fungsi-legosetnew"},"\u25c9 Fungsi ",(0,i.kt)("inlineCode",{parentName:"h3"},"LegoSet::new")),(0,i.kt)("p",null,"O iya, sedikit tambahan info saja, fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"new")," di-atas didefinisikan menggunakan metode ",(0,i.kt)("a",{parentName:"p",href:"/basic/struct#-field-init-shorthand"},"field init shorthand"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn new(code: i32, name: String, category: String, age_minimum: i32) -> LegoSet {\n LegoSet { code, name, category, age_minimum }\n}\n\n// ... adalah ekuivalen dengan ...\n\nfn new(code: i32, name: String, category: String, age_minimum: i32) -> LegoSet {\n LegoSet {\n code: code,\n name: name,\n category: category,\n age_minimum: age_minimum\n }\n}\n")),(0,i.kt)("h3",{id:"-naming-convention-associated-function"},"\u25c9 ",(0,i.kt)("em",{parentName:"h3"},"Naming convention")," associated function"),(0,i.kt)("p",null,"Sesuai anjuran di ",(0,i.kt)("a",{parentName:"p",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"halaman dokumentasi Rust"),", snake case digunakan dalam penamaan associated function. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"impl NamaStruct {\n\n fn nama_associated_func() {\n // ...\n }\n}\n")),(0,i.kt)("h2",{id:"a243-tipe-data-self"},"A.24.3. Tipe data ",(0,i.kt)("inlineCode",{parentName:"h2"},"Self")),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Self")," (perhatikan huruf ",(0,i.kt)("inlineCode",{parentName:"p"},"S"),"-nya adalah kapital) merupakan representasi untuk tipe data struct atau trait di mana blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," dideklarasikan."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Self")," hanya bisa digunakan dalam blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl"))),(0,i.kt)("p",null,"Sebagai contoh, pada kode yang sudah dipraktikkan, keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," diterapkan dalam pembuatan ",(0,i.kt)("em",{parentName:"p"},"associated items")," untuk struct ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet"),". Dalam blok kode tersebut, tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet")," bisa diganti dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"Self"),"."),(0,i.kt)("p",null,"Silakan lihat contoh di bawah ini, ada 4 buah cara deklarasi fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"new")," yang kesemuanya adalah ekuivalen."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"impl LegoSet {\n fn new(code: i32, name: String, category: String, age_minimum: i32) -> LegoSet {\n LegoSet { code, name, category, age_minimum }\n }\n}\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"impl LegoSet {\n fn new(code: i32, name: String, category: String, age_minimum: i32) -> LegoSet {\n Self { code, name, category, age_minimum }\n }\n}\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"impl LegoSet {\n fn new(code: i32, name: String, category: String, age_minimum: i32) -> Self {\n LegoSet { code, name, category, age_minimum }\n }\n}\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"impl LegoSet {\n fn new(code: i32, name: String, category: String, age_minimum: i32) -> Self {\n Self { code, name, category, age_minimum }\n }\n}\n")),(0,i.kt)("h2",{id:"a244-associated-function-dalam-module"},"A.24.4. Associated function dalam module"),(0,i.kt)("p",null,"Struct adalah salah satu dari beberapa item yang ada di Rust. Struct bisa saja berada dalam sebuah module, baik inline maupun ",(0,i.kt)("em",{parentName:"p"},"normal")," module."),(0,i.kt)("p",null,"Sekarang, kode yang sudah dipraktikkan di atas akan kita refactor. Struct ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet")," beserta associated items-nya dipindah ke module file bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"lego"),", dengan itu maka pemanggilan struct tersebut harus menggunakan path ",(0,i.kt)("inlineCode",{parentName:"p"},"lego::LegoSet"),"."),(0,i.kt)("p",null,"Kurang lebih struktur package mendi seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 lego.rs\n \u2514\u2500\u2500\u2500 main.rs\n")),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Associated function",src:n(6314).Z,width:"918",height:"814"})),(0,i.kt)("p",null,"Ada yang aneh, padahal pemanggilan struct ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet")," sudah diganti menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"lego::LegoSet"),", tapi kenapa ada error di kode? Silakan ",(0,i.kt)("em",{parentName:"p"},"hover")," baris kode yang ada highlight merah, atau jalankan saja program untuk melihat detail errornya."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Associated function",src:n(8820).Z,width:"481",height:"216"})),(0,i.kt)("p",null,"Error muncul karena struct ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet")," adalah private. Solusinya cukup tambahkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," dalam definisi struct beserta ",(0,i.kt)("em",{parentName:"p"},"associated function"),"-nya."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Untuk blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," tidak perlu ditambahi keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub"))),(0,i.kt)("p",null,"Ok, setelah update diaplikasikan, coba lihat lagi. Sekarang error-nya berubah, bagian baris pengisian property struct yang jadi error."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Associated function",src:n(2039).Z,width:"741",height:"798"})),(0,i.kt)("p",null,"Error ini terjadi karena property dari struct terdeteksi sebagai ",(0,i.kt)("strong",{parentName:"p"},"private"),". Solusi yang bisa dipergunakan ada 2:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Tambahkan saja keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," pada definisi property struct."),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/lego.rs"',title:'"src/lego.rs"'},"pub struct LegoSet {\n pub code: i32,\n pub name: String,\n pub category: String,\n pub age_minimum: i32,\n}\n"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Atau, tetap biarkan property struct sebagai ",(0,i.kt)("strong",{parentName:"p"},"private"),", namun pada semua statement pembuatan object menggunakan tipe tersebut harus selalu dilakukan via ",(0,i.kt)("inlineCode",{parentName:"p"},"lego::LegoSet::new()"),"."),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'let object = lego::LegoSet::new(\n 42099, \n String::from("4X4 X-treme Off-Roader"), \n String::from("Technic"), \n 11,\n);\n')))),(0,i.kt)("p",null,"Opsi mana yang paling pas? Pertanyaan ini jawabannya adalah tergantung kebutuhan dan ",(0,i.kt)("em",{parentName:"p"},"case"),". Jika memang property struct di-desain agar private (tidak perlu diakses secara publik), maka gunakan saja associated function dalam pembuatan object-nya."),(0,i.kt)("p",null,"Namun jika memang ada kebutuhan salah satu property atau kesemuanya harus bisa diakses secara publik, maka tambahkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," sesuai kebutuhan."),(0,i.kt)("h2",{id:"a245-tuple-struct-associated-function"},"A.24.5. Tuple struct associated function"),(0,i.kt)("p",null,"Sama seperti struct, tuple struct juga bisa memiliki ",(0,i.kt)("em",{parentName:"p"},"associated items"),". Cara deklarasi dan pemanggilan item-nya juga sama."),(0,i.kt)("p",null,"Pada contoh berikut, tuple struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Color")," memiliki 3 buah associated functions, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"red"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"green"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"blue"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 model.rs\n \u2514\u2500\u2500\u2500 main.rs\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/model.rs"',title:'"src/model.rs"'},"#[derive(Debug)]\npub struct Color(i32, i32, i32);\n\nimpl Color {\n\n pub fn red() -> Self {\n Self(255, 0, 0)\n }\n\n pub fn green() -> Self {\n Self(0, 255, 0)\n }\n\n pub fn blue() -> Self {\n Self(0, 0, 255)\n }\n}\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod model;\n\nfn main() {\n let red = model::Color::red();\n let green = model::Color::green();\n let blue = model::Color::blue();\n\n println!("{:#?} {:#?} {:#?}", red, green, blue);\n \n let random_color = model::Color(12, 25, 47);\n println!("{:#?} ", random_color);\n}\n')),(0,i.kt)("p",null,"Hmm, ada yang aneh, karena suatu alasan statement ",(0,i.kt)("inlineCode",{parentName:"p"},"model::Color")," dianggap error."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Associated function",src:n(6605).Z,width:"662",height:"244"})),(0,i.kt)("p",null,"Error ini sebenarnya mirip dengan error praktik sebelumnya, ketika mencoba membuat object baru dari struct sedangkan property struct tersebut adalah private."),(0,i.kt)("p",null,"Pada kasus struct, solusinya cukup dengan tambahkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," atau siapkan ",(0,i.kt)("em",{parentName:"p"},"associated function")," untuk pembuatan object. Pada tuple struct, solusinya juga mirip, ada dua opsi yang bisa dipilih."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Tambahkan saja keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," pada definisi parameter tuple struct."),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/model.rs"',title:'"src/model.rs"'},"// before\npub struct Color(i32, i32, i32);\n\n// after\npub struct Color(pub i32, pub i32, pub i32);\n"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Atau, tetap biarkan parameter tuple struct sebagai ",(0,i.kt)("strong",{parentName:"p"},"private"),", namun siapkan ",(0,i.kt)("em",{parentName:"p"},"associated function")," baru untuk pembuatan object struct tuple, seperti ini:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/model.rs"',title:'"src/model.rs"'},"// ...\n\nimpl Color {\n pub fn new(r: i32, g: i32, b: i32) -> Self {\n Self(r, g, b)\n }\n\n // ...\n}\n")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'fn main() {\n // ...\n\n let random_color = model::Color::new(12, 25, 47);\n println!("{:#?} ", random_color);\n}\n')))),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai visibility property dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/visibility-privacy"},"Module System \u279c Visibility & Privacy"))),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/associated_function"},"github.com/novalagung/dasarpemrogramanrust-example/../associated_function")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/function"},"Function")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/method"},"Method")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/visibility-privacy"},"Module System \u279c Visibility & Privacy"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch05-03-method-syntax.html"},"https://doc.rust-lang.org/book/ch05-03-method-syntax.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.impl.html"},"https://doc.rust-lang.org/std/keyword.impl.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.SelfTy.html"},"https://doc.rust-lang.org/std/keyword.SelfTy.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/fn/methods.html"},"https://doc.rust-lang.org/rust-by-example/fn/methods.html"))))}s.isMDXComponent=!0},8317:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAAEUCAIAAAA0qq8IAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTAtMjhUMTc6MDQ6MzkrMDc6MDAiIHhtcDpNb2RpZn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5x9Lp45f+o0PrKtYoOrA4bVMvWzks7ax50q3H56eh22NvygmAgAx7anDEJW8cZOlrDT6716rP/XCzaqDhhWy3Tt6a694TF5N+YTewJgT60M+3KMMKHTZgl/8ewZRXoW7FkVU6SW6drTX3tbU2BPAOxZ2XHvO8sq3lhlCWNPADisPXUQsog3rk/4xZ4AcBB72iBkP3S9yp+3tWeQXf9WsucK454kGQMctucug5CdeGOdJVxjTyc2uDpg2HPiMO/1AvsC9kzWPrypSY9akGQMcFR7OgKZH298FEgyBsCeojf/NDXe+DDiRJ0A2DPRQunOeNO/n5aGDACwI3sCAGBPAADsCQAA2BMA4Eb27G475CIvAMCE2nPis4cAAEfvucdpRwAA2BN7AgBgTwCAbdmzPiwOAAB7JgLlmUgAwJ6tPXcuugMAMO4JAIA9AQCwJwDAnuzJsCcAQJs9+9frUHkCAEzouQMAAPYEAMCeAADYEwAAewIAYE8AAMCeAADYEwAAewIAYE8AAOwJAADYEwAAewIAYE8AAOwJALBb/g9Ev5BPF8iv7AAAAABJRU5ErkJggg=="},6314:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/associated-function-2-a72ff54955e3f2afff46536bcf659087.png"},8820:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeEAAADYCAIAAABTKsyIAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi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4-91b4741ed57bb3ce42997c90f9c0c58e.png"},6605:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/associated-function-5-cb72a7e4944bd7b12502c0dc6e7acd7a.png"}}]); \ No newline at end of file diff --git a/assets/js/bdfc7662.8583c2cb.js b/assets/js/bdfc7662.8583c2cb.js new file mode 100644 index 00000000..759b28b7 --- /dev/null +++ b/assets/js/bdfc7662.8583c2cb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[7720],{3905:(e,a,n)=>{n.d(a,{Zo:()=>d,kt:()=>c});var t=n(7294);function i(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function r(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function l(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?r(Object(n),!0).forEach((function(a){i(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function o(e,a){if(null==e)return{};var n,t,i=function(e,a){if(null==e)return{};var n,t,i={},r=Object.keys(e);for(t=0;t<r.length;t++)n=r[t],a.indexOf(n)>=0||(i[n]=e[n]);return i}(e,a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t<r.length;t++)n=r[t],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var u=t.createContext({}),m=function(e){var a=t.useContext(u),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},d=function(e){var a=m(e.components);return t.createElement(u.Provider,{value:a},e.children)},s={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},p=t.forwardRef((function(e,a){var n=e.components,i=e.mdxType,r=e.originalType,u=e.parentName,d=o(e,["components","mdxType","originalType","parentName"]),p=m(n),c=i,g=p["".concat(u,".").concat(c)]||p[c]||s[c]||r;return n?t.createElement(g,l(l({ref:a},d),{},{components:n})):t.createElement(g,l({ref:a},d))}));function c(e,a){var n=arguments,i=a&&a.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=p;var o={};for(var u in a)hasOwnProperty.call(a,u)&&(o[u]=a[u]);o.originalType=e,o.mdxType="string"==typeof e?e:i,l[1]=o;for(var m=2;m<r;m++)l[m]=n[m];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}p.displayName="MDXCreateElement"},2486:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>u,contentTitle:()=>l,default:()=>s,frontMatter:()=>r,metadata:()=>o,toc:()=>m});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:24,title:"A.24. Associated Function",sidebar_label:"A.24. Associated Function"},l=void 0,o={unversionedId:"basic/associated-function",id:"basic/associated-function",title:"A.24. Associated Function",description:"Chapter ini membahas tentang associated function. Kita akan belajar apa itu associated function dan apa perbedannya dengan fungsi biasa.",source:"@site/docs/basic/associated-function.md",sourceDirName:"basic",slug:"/basic/associated-function",permalink:"/basic/associated-function",draft:!1,tags:[],version:"current",sidebarPosition:24,frontMatter:{sidebar_position:24,title:"A.24. Associated Function",sidebar_label:"A.24. Associated Function"},sidebar:"tutorialSidebar",previous:{title:"A.23. Struct",permalink:"/basic/struct"},next:{title:"A.25. Method",permalink:"/basic/method"}},u={},m=[{value:"A.24.1. <em>Associated item</em> & <em>associated function</em>",id:"a241-associated-item--associated-function",level:2},{value:"A.24.2. Keyword <code>impl</code>",id:"a242-keyword-impl",level:2},{value:"\u25c9 Fungsi <code>LegoSet::new</code>",id:"-fungsi-legosetnew",level:3},{value:"\u25c9 <em>Naming convention</em> associated function",id:"-naming-convention-associated-function",level:3},{value:"A.24.3. Tipe data <code>Self</code>",id:"a243-tipe-data-self",level:2},{value:"A.24.4. Associated function dalam module",id:"a244-associated-function-dalam-module",level:2},{value:"A.24.5. Tuple struct associated function",id:"a245-tuple-struct-associated-function",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:m};function s(e){let{components:a,...r}=e;return(0,i.kt)("wrapper",(0,t.Z)({},d,r,{components:a,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Chapter ini membahas tentang ",(0,i.kt)("em",{parentName:"p"},"associated function"),". Kita akan belajar apa itu associated function dan apa perbedannya dengan fungsi biasa."),(0,i.kt)("h2",{id:"a241-associated-item--associated-function"},"A.24.1. ",(0,i.kt)("em",{parentName:"h2"},"Associated item")," & ",(0,i.kt)("em",{parentName:"h2"},"associated function")),(0,i.kt)("p",null,(0,i.kt)("em",{parentName:"p"},"Associated item")," adalah item yang memiliki asosiasi/hubungan dengan struct atau trait. Item di sini bisa dalam banyak hal, bisa berupa fungsi atau lainnya."),(0,i.kt)("p",null,"Fungsi yang terhubung dengan suatu struct atau trait disebut dengan ",(0,i.kt)("em",{parentName:"p"},"associated function"),". Fungsi jenis ini ekuivalen seperti fungsi biasa, perbedaannya adalah pada deklarasinya yang harus berada di dalam blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl"),", dan pemanggilannya harus menggunakan notasi path ",(0,i.kt)("inlineCode",{parentName:"p"},"NamaStruct::nama_fungsi"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai trait dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai macam-macam item dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/path-item#a183-rust-items"},"Path & Item")))),(0,i.kt)("p",null,"Ok, mari kita lanjut ke bagian praktik. Silakan tulis kode berikut terlebih dahulu."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'#[derive(Debug)]\nstruct LegoSet {\n code: i32,\n name: String,\n category: String,\n age_minimum: i32,\n}\n\nfn main() {\n let rough_terrain_crane = LegoSet{\n code: 42082,\n name: String::from("Rough Terrain Crane"),\n category: String::from("Technic"),\n age_minimum: 11,\n };\n\n println!("{:#?}", rough_terrain_crane);\n}\n')),(0,i.kt)("p",null,"Sebuah struct bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet")," didefinisikan memiliki 4 buah property. Di blok kode fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),", dibuat sebuah variabel bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"rough_terrain_crane")," yang merupakan object/instance dari struct ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet"),", kemudian object tersebut di-print."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Object struct bisa di-print menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"println")," karena pada definisi struct ditambahkan attribute ",(0,i.kt)("inlineCode",{parentName:"p"},"#[derive(Debug)]"),"."),(0,i.kt)("p",{parentName:"blockquote"},"Lebih detailnya mengenai attribute dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/attributes"},"Attributes"),".")),(0,i.kt)("p",null,"Selanjutnya kita siapkan dua buah fungsi yang berasosiasi dengan struct ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet"),"."),(0,i.kt)("h2",{id:"a242-keyword-impl"},"A.24.2. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"impl")),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," digunakan untuk membuat ",(0,i.kt)("em",{parentName:"p"},"associated item"),"."),(0,i.kt)("p",null,"Pada konteks ini keyword tersebut digunakan untuk membuat ",(0,i.kt)("em",{parentName:"p"},"associated function")," untuk struct ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet"),", sebuah fungsi bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"new")," dengan tugas adalah untuk membantu pembuatan object ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet"),"."),(0,i.kt)("p",null,"Silakan tambahkan blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," berikut setelah definisi struct ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"#[derive(Debug)]\nstruct LegoSet {\n code: i32,\n name: String,\n category: String,\n age_minimum: i32,\n}\n\nimpl LegoSet {\n\n fn new(code: i32, name: String, category: String, age_minimum: i32) -> LegoSet {\n LegoSet { code, name, category, age_minimum }\n }\n}\n")),(0,i.kt)("p",null,"Notasi penulisan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," bisa dilihat pada contoh di atas, cukup tulis saja keyword tersebut diikuti nama struct yang diinginkan, kemudian diikuti dengan blok kode berisi definisi fungsi."),(0,i.kt)("p",null,"Fungsi dalam blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," adalah yang disebut dengan ",(0,i.kt)("em",{parentName:"p"},"associated function"),". Pada contoh di atas, fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"new")," memiliki asosiasi dengan struct ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet"),"."),(0,i.kt)("p",null,"Lanjut, panggil fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"new")," tersebut untuk membuat object baru bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"xtreme_offroader")," lalu print isinya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let rough_terrain_crane = LegoSet{\n code: 42082,\n name: String::from("Rough Terrain Crane"),\n category: String::from("Technic"),\n age_minimum: 11,\n };\n println!("{:#?}", rough_terrain_crane);\n \n let xtreme_offroader = LegoSet::new(\n 42099, \n String::from("4X4 X-treme Off-Roader"), \n String::from("Technic"), \n 11,\n );\n println!("{:#?}", xtreme_offroader);\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Associated function",src:n(8317).Z,width:"447",height:"276"})),(0,i.kt)("p",null,"Bisa dilihat pada blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),", cara pemanggilan associated function adalah dengan menuliskan nama struct diikuti nama fungsi dengan notasi penulisan path."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"NamaStruct::nama_fungsi();\nNamaStruct::nama_fungsi(arg1, arg2, arg3, arg4);\nLegoSet::new(arg1, arg2, arg3, arg4);\n")),(0,i.kt)("p",null,"Jadi seperti itu, semoga cukup jelas. Silakan berkreasi dengan menambahkan ",(0,i.kt)("em",{parentName:"p"},"associated function")," lainnya agar makin terbiasa. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'impl LegoSet {\n\n fn new(code: i32, name: String, category: String, age_minimum: i32) -> LegoSet {\n LegoSet { code, name, category, age_minimum }\n }\n\n fn what_is_lego() {\n println!("Lego is a line of plastic construction toys")\n }\n}\n\nfn main() {\n LegoSet::what_is_lego();\n\n let xtreme_offroader = LegoSet::new(\n 42099, \n String::from("4X4 X-treme Off-Roader"), \n String::from("Technic"), \n 11,\n );\n println!("{:#?}", xtreme_offroader);\n}\n')),(0,i.kt)("h3",{id:"-fungsi-legosetnew"},"\u25c9 Fungsi ",(0,i.kt)("inlineCode",{parentName:"h3"},"LegoSet::new")),(0,i.kt)("p",null,"O iya, sedikit tambahan info saja, fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"new")," di-atas didefinisikan menggunakan metode ",(0,i.kt)("a",{parentName:"p",href:"/basic/struct#-field-init-shorthand"},"field init shorthand"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn new(code: i32, name: String, category: String, age_minimum: i32) -> LegoSet {\n LegoSet { code, name, category, age_minimum }\n}\n\n// ... adalah ekuivalen dengan ...\n\nfn new(code: i32, name: String, category: String, age_minimum: i32) -> LegoSet {\n LegoSet {\n code: code,\n name: name,\n category: category,\n age_minimum: age_minimum\n }\n}\n")),(0,i.kt)("h3",{id:"-naming-convention-associated-function"},"\u25c9 ",(0,i.kt)("em",{parentName:"h3"},"Naming convention")," associated function"),(0,i.kt)("p",null,"Sesuai anjuran di ",(0,i.kt)("a",{parentName:"p",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"halaman dokumentasi Rust"),", snake case digunakan dalam penamaan associated function. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"impl NamaStruct {\n\n fn nama_associated_func() {\n // ...\n }\n}\n")),(0,i.kt)("h2",{id:"a243-tipe-data-self"},"A.24.3. Tipe data ",(0,i.kt)("inlineCode",{parentName:"h2"},"Self")),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Self")," (perhatikan huruf ",(0,i.kt)("inlineCode",{parentName:"p"},"S"),"-nya adalah kapital) merupakan representasi untuk tipe data struct atau trait di mana blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," dideklarasikan."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Self")," hanya bisa digunakan dalam blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl"))),(0,i.kt)("p",null,"Sebagai contoh, pada kode yang sudah dipraktikkan, keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," diterapkan dalam pembuatan ",(0,i.kt)("em",{parentName:"p"},"associated items")," untuk struct ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet"),". Dalam blok kode tersebut, tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet")," bisa diganti dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"Self"),"."),(0,i.kt)("p",null,"Silakan lihat contoh di bawah ini, ada 4 buah cara deklarasi fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"new")," yang kesemuanya adalah ekuivalen."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"impl LegoSet {\n fn new(code: i32, name: String, category: String, age_minimum: i32) -> LegoSet {\n LegoSet { code, name, category, age_minimum }\n }\n}\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"impl LegoSet {\n fn new(code: i32, name: String, category: String, age_minimum: i32) -> LegoSet {\n Self { code, name, category, age_minimum }\n }\n}\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"impl LegoSet {\n fn new(code: i32, name: String, category: String, age_minimum: i32) -> Self {\n LegoSet { code, name, category, age_minimum }\n }\n}\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"impl LegoSet {\n fn new(code: i32, name: String, category: String, age_minimum: i32) -> Self {\n Self { code, name, category, age_minimum }\n }\n}\n")),(0,i.kt)("h2",{id:"a244-associated-function-dalam-module"},"A.24.4. Associated function dalam module"),(0,i.kt)("p",null,"Struct adalah salah satu dari beberapa item yang ada di Rust. Struct bisa saja berada dalam sebuah module, baik inline maupun ",(0,i.kt)("em",{parentName:"p"},"normal")," module."),(0,i.kt)("p",null,"Sekarang, kode yang sudah dipraktikkan di atas akan kita refactor. Struct ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet")," beserta associated items-nya dipindah ke module file bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"lego"),", dengan itu maka pemanggilan struct tersebut harus menggunakan path ",(0,i.kt)("inlineCode",{parentName:"p"},"lego::LegoSet"),"."),(0,i.kt)("p",null,"Kurang lebih struktur package mendi seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 lego.rs\n \u2514\u2500\u2500\u2500 main.rs\n")),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Associated function",src:n(6314).Z,width:"918",height:"814"})),(0,i.kt)("p",null,"Ada yang aneh, padahal pemanggilan struct ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet")," sudah diganti menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"lego::LegoSet"),", tapi kenapa ada error di kode? Silakan ",(0,i.kt)("em",{parentName:"p"},"hover")," baris kode yang ada highlight merah, atau jalankan saja program untuk melihat detail errornya."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Associated function",src:n(8820).Z,width:"481",height:"216"})),(0,i.kt)("p",null,"Error muncul karena struct ",(0,i.kt)("inlineCode",{parentName:"p"},"LegoSet")," adalah private. Solusinya cukup tambahkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," dalam definisi struct beserta ",(0,i.kt)("em",{parentName:"p"},"associated function"),"-nya."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Untuk blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," tidak perlu ditambahi keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub"))),(0,i.kt)("p",null,"Ok, setelah update diaplikasikan, coba lihat lagi. Sekarang error-nya berubah, bagian baris pengisian property struct yang jadi error."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Associated function",src:n(2039).Z,width:"741",height:"798"})),(0,i.kt)("p",null,"Error ini terjadi karena property dari struct terdeteksi sebagai ",(0,i.kt)("strong",{parentName:"p"},"private"),". Solusi yang bisa dipergunakan ada 2:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Tambahkan saja keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," pada definisi property struct."),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/lego.rs"',title:'"src/lego.rs"'},"pub struct LegoSet {\n pub code: i32,\n pub name: String,\n pub category: String,\n pub age_minimum: i32,\n}\n"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Atau, tetap biarkan property struct sebagai ",(0,i.kt)("strong",{parentName:"p"},"private"),", namun pada semua statement pembuatan object menggunakan tipe tersebut harus selalu dilakukan via ",(0,i.kt)("inlineCode",{parentName:"p"},"lego::LegoSet::new()"),"."),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'let object = lego::LegoSet::new(\n 42099, \n String::from("4X4 X-treme Off-Roader"), \n String::from("Technic"), \n 11,\n);\n')))),(0,i.kt)("p",null,"Opsi mana yang paling pas? Pertanyaan ini jawabannya adalah tergantung kebutuhan dan ",(0,i.kt)("em",{parentName:"p"},"case"),". Jika memang property struct di-desain agar private (tidak perlu diakses secara publik), maka gunakan saja associated function dalam pembuatan object-nya."),(0,i.kt)("p",null,"Namun jika memang ada kebutuhan salah satu property atau kesemuanya harus bisa diakses secara publik, maka tambahkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," sesuai kebutuhan."),(0,i.kt)("h2",{id:"a245-tuple-struct-associated-function"},"A.24.5. Tuple struct associated function"),(0,i.kt)("p",null,"Sama seperti struct, tuple struct juga bisa memiliki ",(0,i.kt)("em",{parentName:"p"},"associated items"),". Cara deklarasi dan pemanggilan item-nya juga sama."),(0,i.kt)("p",null,"Pada contoh berikut, tuple struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Color")," memiliki 3 buah associated functions, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"red"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"green"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"blue"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="package source code structure"',title:'"package',source:!0,code:!0,'structure"':!0},"my_package\n\u2502\u2500\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500\u2500 src\n \u2502\u2500\u2500\u2500 model.rs\n \u2514\u2500\u2500\u2500 main.rs\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/model.rs"',title:'"src/model.rs"'},"#[derive(Debug)]\npub struct Color(i32, i32, i32);\n\nimpl Color {\n\n pub fn red() -> Self {\n Self(255, 0, 0)\n }\n\n pub fn green() -> Self {\n Self(0, 255, 0)\n }\n\n pub fn blue() -> Self {\n Self(0, 0, 255)\n }\n}\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'mod model;\n\nfn main() {\n let red = model::Color::red();\n let green = model::Color::green();\n let blue = model::Color::blue();\n\n println!("{:#?} {:#?} {:#?}", red, green, blue);\n \n let random_color = model::Color(12, 25, 47);\n println!("{:#?} ", random_color);\n}\n')),(0,i.kt)("p",null,"Hmm, ada yang aneh, karena suatu alasan statement ",(0,i.kt)("inlineCode",{parentName:"p"},"model::Color")," dianggap error."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Associated function",src:n(6605).Z,width:"662",height:"244"})),(0,i.kt)("p",null,"Error ini sebenarnya mirip dengan error praktik sebelumnya, ketika mencoba membuat object baru dari struct sedangkan property struct tersebut adalah private."),(0,i.kt)("p",null,"Pada kasus struct, solusinya cukup dengan tambahkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," atau siapkan ",(0,i.kt)("em",{parentName:"p"},"associated function")," untuk pembuatan object. Pada tuple struct, solusinya juga mirip, ada dua opsi yang bisa dipilih."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Tambahkan saja keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub")," pada definisi parameter tuple struct."),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/model.rs"',title:'"src/model.rs"'},"// before\npub struct Color(i32, i32, i32);\n\n// after\npub struct Color(pub i32, pub i32, pub i32);\n"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Atau, tetap biarkan parameter tuple struct sebagai ",(0,i.kt)("strong",{parentName:"p"},"private"),", namun siapkan ",(0,i.kt)("em",{parentName:"p"},"associated function")," baru untuk pembuatan object struct tuple, seperti ini:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/model.rs"',title:'"src/model.rs"'},"// ...\n\nimpl Color {\n pub fn new(r: i32, g: i32, b: i32) -> Self {\n Self(r, g, b)\n }\n\n // ...\n}\n")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},'fn main() {\n // ...\n\n let random_color = model::Color::new(12, 25, 47);\n println!("{:#?} ", random_color);\n}\n')))),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai visibility property dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/visibility-privacy"},"Module System \u279c Visibility & Privacy"))),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/associated_function"},"github.com/novalagung/dasarpemrogramanrust-example/../associated_function")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/function"},"Function")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/method"},"Method")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/visibility-privacy"},"Module System \u279c Visibility & Privacy"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch05-03-method-syntax.html"},"https://doc.rust-lang.org/book/ch05-03-method-syntax.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.impl.html"},"https://doc.rust-lang.org/std/keyword.impl.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.SelfTy.html"},"https://doc.rust-lang.org/std/keyword.SelfTy.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/fn/methods.html"},"https://doc.rust-lang.org/rust-by-example/fn/methods.html"))))}s.isMDXComponent=!0},8317:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAAEUCAIAAAA0qq8IAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgN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UgAwJ6tPXcuugMAMO4JAIA9AQCwJwDAnuzJsCcAQJs9+9frUHkCAEzouQMAAPYEAMCeAADYEwAAewIAYE8AAMCeAADYEwAAewIAYE8AAOwJAADYEwAAewIAYE8AAOwJALBb/g9Ev5BPF8iv7AAAAABJRU5ErkJggg=="},6314:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/associated-function-2-a72ff54955e3f2afff46536bcf659087.png"},8820:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeEAAADYCAIAAABTKsyIAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4b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woQK6bbf2UZrR8Y/udBPloEQUyQ0aGhcadKkzWORR5tFlGF0t/ol9HCixDOg+GyyKMNT8MWPEZ7DRb1Q7fkTj2jVQb99Wuff/wknyuCICbP6OQjRGFSu9w5yKODtz0wOmVSe+zO+M4ZG9rm4BGIWzwzJI8mCGLyXkfBYvmoMDA9/NDmtfSjvTrj+tGFlRyRVPoSucrSm07XKUCfHodn/RP8aIIgJsfox/9t5Z/+53Y8TiNImeUzQ2kO2HxZjOsIEvBujPYavxyP67gjnxk2VfYM63gESLxSL+nWiGdcB0EQ05BHt4wgj3aW9LjRechzkEdnUuYhvmcIowmCmFJGBz6GtDg2mNHBd1L0ELpOX1EZg9H6e4YnLvPZIghi+vLowOvoCdAq9u6eNyj86cHv3v/Rj/732R80lbzyq/8WPfmvq+utlhq9RHSW3+sgCGJKGT1UKA4qLCog/t8Pfvjd2QNXD31v2kr4MBEE8egy2mBRSQHRJLDTVsKHiSCIR5fRBEEQMJogCIKA0QRBEASMJgiCgNEEQRAEjCYIgoDRBEEQBIwmCIIgYDRBEASMJgiCIGA0QRAEjCYIgiCmIP4fuRW765zw4d0AAAAASUVORK5CYII="},2039:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/associated-function-4-91b4741ed57bb3ce42997c90f9c0c58e.png"},6605:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/associated-function-5-cb72a7e4944bd7b12502c0dc6e7acd7a.png"}}]); \ No newline at end of file diff --git a/assets/js/be3f5c40.3675591d.js b/assets/js/be3f5c40.3675591d.js deleted file mode 100644 index bfb38427..00000000 --- a/assets/js/be3f5c40.3675591d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[5572],{3905:(e,a,n)=>{n.d(a,{Zo:()=>o,kt:()=>c});var t=n(7294);function l(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function i(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function d(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?i(Object(n),!0).forEach((function(a){l(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function m(e,a){if(null==e)return{};var n,t,l=function(e,a){if(null==e)return{};var n,t,l={},i=Object.keys(e);for(t=0;t<i.length;t++)n=i[t],a.indexOf(n)>=0||(l[n]=e[n]);return l}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t<i.length;t++)n=i[t],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var r=t.createContext({}),u=function(e){var a=t.useContext(r),n=a;return e&&(n="function"==typeof e?e(a):d(d({},a),e)),n},o=function(e){var a=u(e.components);return t.createElement(r.Provider,{value:a},e.children)},p={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},s=t.forwardRef((function(e,a){var n=e.components,l=e.mdxType,i=e.originalType,r=e.parentName,o=m(e,["components","mdxType","originalType","parentName"]),s=u(n),c=l,k=s["".concat(r,".").concat(c)]||s[c]||p[c]||i;return n?t.createElement(k,d(d({ref:a},o),{},{components:n})):t.createElement(k,d({ref:a},o))}));function c(e,a){var n=arguments,l=a&&a.mdxType;if("string"==typeof e||l){var i=n.length,d=new Array(i);d[0]=s;var m={};for(var r in a)hasOwnProperty.call(a,r)&&(m[r]=a[r]);m.originalType=e,m.mdxType="string"==typeof e?e:l,d[1]=m;for(var u=2;u<i;u++)d[u]=n[u];return t.createElement.apply(null,d)}return t.createElement.apply(null,n)}s.displayName="MDXCreateElement"},4387:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>r,contentTitle:()=>d,default:()=>p,frontMatter:()=>i,metadata:()=>m,toc:()=>u});var t=n(7462),l=(n(7294),n(3905));const i={sidebar_position:22,title:"A.22. Module System \u279c Scope & Akses Item",sidebar_label:"A.22. Module System \u279c Scope & Akses Item"},d=void 0,m={unversionedId:"basic/module-scope-item-access",id:"basic/module-scope-item-access",title:"A.22. Module System \u279c Scope & Akses Item",description:"Pembahasan chapter ini masih dalam lingkup module system, yaitu tentang scope dan pengakesan module item.",source:"@site/docs/basic/module-scope-item-access.md",sourceDirName:"basic",slug:"/basic/module-scope-item-access",permalink:"/basic/module-scope-item-access",draft:!1,tags:[],version:"current",sidebarPosition:22,frontMatter:{sidebar_position:22,title:"A.22. Module System \u279c Scope & Akses Item",sidebar_label:"A.22. Module System \u279c Scope & Akses Item"},sidebar:"tutorialSidebar",previous:{title:"A.21. Module System \u279c Inline Module",permalink:"/basic/module-inline"},next:{title:"A.23. Struct",permalink:"/basic/struct"}},r={},u=[{value:"A.22.1. Scope",id:"a221-scope",level:2},{value:"A.22.2. Module Scope",id:"a222-module-scope",level:2},{value:"A.22.3. Keyword <code>self</code> dan <em>crate root</em>",id:"a223-keyword-self-dan-crate-root",level:2},{value:"A.22.4. Keyword <code>self</code> pada module scope",id:"a224-keyword-self-pada-module-scope",level:2},{value:"A.22.5. Keyword <code>crate</code> pada module scope",id:"a225-keyword-crate-pada-module-scope",level:2},{value:"A.22.6. Keyword <code>super</code>",id:"a226-keyword-super",level:2},{value:"A.22.7. Praktik lanjutan",id:"a227-praktik-lanjutan",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],o={toc:u};function p(e){let{components:a,...i}=e;return(0,l.kt)("wrapper",(0,t.Z)({},o,i,{components:a,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"Pembahasan chapter ini masih dalam lingkup module system, yaitu tentang scope dan pengakesan module item."),(0,l.kt)("h2",{id:"a221-scope"},"A.22.1. Scope"),(0,l.kt)("p",null,"Scope bisa diartikan dengan: representasi di mana kode berada. Apapun yang ditulis dalam blok kode (ditandai dengan diapit tanda kurung kurawal ",(0,l.kt)("inlineCode",{parentName:"p"},"{ }"),") berarti dalam satu scope yang sama."),(0,l.kt)("p",null,"Agar lebih jelas, lihat kode berikut kemudian pelajari penjelasan di bawahnya:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'const PI: f64 = 3.14;\n\nfn main() {\n my_func();\n}\n\nfn my_func() {\n let nama = "Sylvanas Windrunner";\n let occupation = "ex-Warchief of the Horde";\n\n // ...\n}\n')),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Konstanta ",(0,l.kt)("inlineCode",{parentName:"li"},"PI"),", fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"main"),", dan juga fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"my_func")," di definisikan satu level dan berada di scope terluar (yang pada ebook ini disebut sebagai ",(0,l.kt)("em",{parentName:"li"},"root"),")."),(0,l.kt)("li",{parentName:"ul"},"Statement pemanggilan fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"my_func()")," berada dalam scope blok kode fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"main"),"."),(0,l.kt)("li",{parentName:"ul"},"Variabel ",(0,l.kt)("inlineCode",{parentName:"li"},"nama")," dan ",(0,l.kt)("inlineCode",{parentName:"li"},"occupation")," berada pada scope blok kode fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"my_func"),".")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"Sebenarnya pembahasan mengenai ",(0,l.kt)("inlineCode",{parentName:"p"},"scope")," harus diiringi dengan pembahasan tentang ",(0,l.kt)("a",{parentName:"p",href:"/basic/block-expression"},"Block expression"),", namun karena kita belum mempelajarinya, chapter ini pembahasan hanya akan fokus pada penerapan scope yang berhubungan dengan ",(0,l.kt)("strong",{parentName:"p"},"module scope"),".")),(0,l.kt)("h2",{id:"a222-module-scope"},"A.22.2. Module Scope"),(0,l.kt)("p",null,"Module scope adalah scope untuk module. Apa bedanya dengan scope secara umum? Silakan perhatikan kode berikut terlebih dahulu:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'mod my_module {\n\n const event_one: &str = "Siege of Ogrimmar";\n\n mod my_submodule {\n \n const event_two: &str = "Battle for Azeroth";\n\n fn func_two() {\n const event_three: &str = "Sepulcher of the First Ones";\n }\n }\n}\n')),(0,l.kt)("p",null,"Pada kode di atas:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Konstanta ",(0,l.kt)("inlineCode",{parentName:"li"},"event_one")," berada dalam module scope ",(0,l.kt)("inlineCode",{parentName:"li"},"my_module"),"."),(0,l.kt)("li",{parentName:"ul"},"Module ",(0,l.kt)("inlineCode",{parentName:"li"},"my_submodule")," adalah sebuah inline module yang berada dalam module scope ",(0,l.kt)("inlineCode",{parentName:"li"},"my_module"),". Module ",(0,l.kt)("inlineCode",{parentName:"li"},"my_submodule")," berada dalam satu scope yang sama dengan variabel ",(0,l.kt)("inlineCode",{parentName:"li"},"event_one"),"."),(0,l.kt)("li",{parentName:"ul"},"Konstanta ",(0,l.kt)("inlineCode",{parentName:"li"},"event_two")," berada dalam module scope ",(0,l.kt)("inlineCode",{parentName:"li"},"my_submodule"),"."),(0,l.kt)("li",{parentName:"ul"},"Fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"func_two")," berada dalam module scope ",(0,l.kt)("inlineCode",{parentName:"li"},"my_submodule"),"."),(0,l.kt)("li",{parentName:"ul"},"Konstanta ",(0,l.kt)("inlineCode",{parentName:"li"},"event_three")," ",(0,l.kt)("strong",{parentName:"li"},"scope"),"-nya adalah dalam blok fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"func_two"),". Sedangkan ",(0,l.kt)("strong",{parentName:"li"},"module scope"),"-nya adalah dalam module scope ",(0,l.kt)("inlineCode",{parentName:"li"},"my_submodule"),". Jadi kelihatan ya bedanya.")),(0,l.kt)("p",null,"Pemahaman tentang module scope ini penting karena akan berhubungan dengan apa yang akan dipelajari di ",(0,l.kt)("em",{parentName:"p"},"section")," berikutnya."),(0,l.kt)("h2",{id:"a223-keyword-self-dan-crate-root"},"A.22.3. Keyword ",(0,l.kt)("inlineCode",{parentName:"h2"},"self")," dan ",(0,l.kt)("em",{parentName:"h2"},"crate root")),(0,l.kt)("p",null,"Keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," merepresentasikan current module scope. Dengannya kita bisa mengakses item yang deklarasinya ada pada module scope yang sama."),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"Sebenarnya selain penjelasan di atas, keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," juga digunakan untuk hal lain yaitu sebagai receiver method."),(0,l.kt)("p",{parentName:"blockquote"},"Pembahasan tentang penerapan keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," sebagai receiver method dibahas pada chapter ",(0,l.kt)("a",{parentName:"p",href:"/basic/method"},"Method"))),(0,l.kt)("p",null,"Selanjutnya, apa itu ",(0,l.kt)("em",{parentName:"p"},"crate root"),"? ",(0,l.kt)("strong",{parentName:"p"},"Crate root")," adalah apapun yang didefinisikan di file entrypoint crate (yaitu ",(0,l.kt)("inlineCode",{parentName:"p"},"src/main.rs")," untuk binary crate, dan ",(0,l.kt)("inlineCode",{parentName:"p"},"src/lib.rs")," untuk library crate). ",(0,l.kt)("strong",{parentName:"p"},"Crate root")," adalah module scope yang berada di root (paling atas). Apapun yang berada di ",(0,l.kt)("em",{parentName:"p"},"crate root")," berarti berada dalam module scope yang sama."),(0,l.kt)("p",null,"Sebagai contoh, pada kode program berikut, module ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod")," dan fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"main")," dideklarasikan di ",(0,l.kt)("em",{parentName:"p"},"crate root")," ",(0,l.kt)("inlineCode",{parentName:"p"},"src/main.rs"),". Artinya kedua item tersebut berada dalam satu module scope yang sama, yaitu di ",(0,l.kt)("em",{parentName:"p"},"crate root"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'mod my_mod {\n pub fn run_the_app(note: &str) {\n println!("calling `my_mod::run_the_app()`. note {}", note);\n }\n}\n\nfn main() {\n my_mod::run_the_app("1st call");\n self::my_mod::run_the_app("2nd call");\n}\n')),(0,l.kt)("p",null,(0,l.kt)("img",{alt:"Module item access self",src:n(7116).Z,width:"490",height:"128"})),(0,l.kt)("p",null,"Pada fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"main"),", ada dua statement pemanggilan module item ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod::run_the_app"),". Kedua statement tersebut adalah mirip, pembedanya ada pada statement ke-2, yaitu keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," digunakan di segment path sebagai prefix."),(0,l.kt)("p",null,"Keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," menginstruksi program bahwa item yang dipanggil adalah item yang module scope-nya sama."),(0,l.kt)("p",null,"Pada contoh di atas, module ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod")," berada dalam satu scope yang sama dengan fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"main"),", yaitu di ",(0,l.kt)("em",{parentName:"p"},"crate root"),". Karena itu, ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod")," bisa diakses dengan menggunakan keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self"),", atau lansung panggil saja nama module seperti biasanya, ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod()"),"."),(0,l.kt)("p",null,"Bisa dibilang keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," ini opsional dalam penggunaannya, boleh ikut dituliskan dan boleh juga tidak."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'my_mod::run_the_app("1st call");\nself::my_mod::run_the_app("2nd call");\n')),(0,l.kt)("h2",{id:"a224-keyword-self-pada-module-scope"},"A.22.4. Keyword ",(0,l.kt)("inlineCode",{parentName:"h2"},"self")," pada module scope"),(0,l.kt)("p",null,"Lanjut ke praktik berikutnya. Masih tentang keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self"),", kita akan gunakan keyword ini untuk mengakses item dalam module."),(0,l.kt)("p",null,"Silakan tulis kode berikut kemudian jalankan."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'fn my_func() {\n println!("calling `my_func()`");\n}\n\nmod my_mod {\n \n pub fn my_func() {\n println!("calling `my_mod::my_func()`");\n }\n \n pub fn run_the_app() {\n println!("calling `my_mod::run_the_app()`");\n my_func();\n self::my_func();\n }\n}\n\nfn main() {\n my_mod::run_the_app();\n}\n')),(0,l.kt)("p",null,"Pada contoh bisa dilihat ada dua buah fungsi dideklarasikan dengan nama yang sama persis, yang satu berada di ",(0,l.kt)("em",{parentName:"p"},"crate root"),", satunya lagi merupakan item milik ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod"),"."),(0,l.kt)("p",null,"Di dalam ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod::run_the_app")," ada 2 kali pemanggilan fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func"),", satunya menggunakan keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," dan satunya tidak. Fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func")," manakah yang dipanggil? Hasilnya bisa dilihat pada gambar di bawah ini."),(0,l.kt)("p",null,(0,l.kt)("img",{alt:"Module item access self",src:n(576).Z,width:"681",height:"290"})),(0,l.kt)("p",null,"Kedua statement ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func()")," dan ",(0,l.kt)("inlineCode",{parentName:"p"},"self::my_func()")," dalam ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod::run_the_app")," adalah mengarah ke fungsi yang sama, yaitu ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod::my_func"),"."),(0,l.kt)("p",null,"Jadi kesimpulan dari penerapan keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," dalam module item adalah sama seperti penerapannya pada ",(0,l.kt)("em",{parentName:"p"},"crate root"),", yaitu boleh dipakai boleh tidak. Keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," adalah opsional."),(0,l.kt)("p",null,"Lalu bagaimana cara memanggil ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func")," yang berada di ",(0,l.kt)("em",{parentName:"p"},"crate root"),", dengan pemanggilan adalah dari dalam module item? Caranya adalah menggunakan keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"crate"),"."),(0,l.kt)("h2",{id:"a225-keyword-crate-pada-module-scope"},"A.22.5. Keyword ",(0,l.kt)("inlineCode",{parentName:"h2"},"crate")," pada module scope"),(0,l.kt)("p",null,"Keyword ini digunakan untuk mengakses apapun yang ada di ",(0,l.kt)("em",{parentName:"p"},"crate root"),"."),(0,l.kt)("p",null,"Pada contoh di atas, fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func")," yang berada di ",(0,l.kt)("em",{parentName:"p"},"crate root")," bisa dipanggil dari fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"main")," dengan statement ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func()")," atau ",(0,l.kt)("inlineCode",{parentName:"p"},"self::my_func()"),". Untuk bagian ini penulis rasa sudah cukup jelas."),(0,l.kt)("p",null,"Beda cerita kalau fungsi tersebut dipanggil dari dalam module item ",(0,l.kt)("inlineCode",{parentName:"p"},"run_the_app"),". Kedua statement ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func()")," dan ",(0,l.kt)("inlineCode",{parentName:"p"},"self::my_func()")," mengarah ke ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod::my_func"),", bukan ke fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func")," di ",(0,l.kt)("em",{parentName:"p"},"crate root"),". Hal ini karena ",(0,l.kt)("strong",{parentName:"p"},"current module scope")," dalam statement ",(0,l.kt)("inlineCode",{parentName:"p"},"run_the_app")," adalah module ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod"),", maka pemanggilan ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func")," tanpa ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," atau dengannya mengarah ke fungsi yang sama yaitu ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod::my_func"),"."),(0,l.kt)("p",null,"Pada ",(0,l.kt)("em",{parentName:"p"},"section")," ini kita akan belajar tentang keyword baru, yaitu ",(0,l.kt)("inlineCode",{parentName:"p"},"crate"),". Keyword tersebut digunakan untuk mengakses apapun yang berada di ",(0,l.kt)("em",{parentName:"p"},"crate root"),". Kita bisa memanfaatkannya untuk mengakses ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func")," yang berada di ",(0,l.kt)("em",{parentName:"p"},"crate root")," dengan pengaksesan dari dalam module item."),(0,l.kt)("p",null,"Silakan ubah kode di atas menjadi seperti berikut. Perubahannya ada pada statement dalam fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"run_the_app"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'fn my_func() {\n println!("calling `my_func()`");\n}\n\nmod my_mod {\n \n pub fn my_func() {\n println!("calling `my_mod::my_func()`");\n }\n \n pub fn run_the_app() {\n println!("calling `my_mod::run_the_app()`");\n crate::my_func();\n self::my_func();\n }\n}\n\nfn main() {\n my_mod::run_the_app();\n}\n')),(0,l.kt)("p",null,"Jalankan program, hasilnya berbeda dengan eksekusi program sebelumnya. Statement ",(0,l.kt)("inlineCode",{parentName:"p"},"crate::my_func()")," dalam fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"run_the_app")," mengarah ke fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func")," di root, sedangkan ",(0,l.kt)("inlineCode",{parentName:"p"},"self::my_func")," mengarah ke ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod::my_func"),"."),(0,l.kt)("p",null,(0,l.kt)("img",{alt:"Module item access crate",src:n(7721).Z,width:"487",height:"136"})),(0,l.kt)("h2",{id:"a226-keyword-super"},"A.22.6. Keyword ",(0,l.kt)("inlineCode",{parentName:"h2"},"super")),(0,l.kt)("p",null,"Selain ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," dan ",(0,l.kt)("inlineCode",{parentName:"p"},"crate")," ada juga keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"super"),", yang gunanya adalah untuk mengakses ",(0,l.kt)("em",{parentName:"p"},"parent")," module scope atau 1 scope di atas ",(0,l.kt)("em",{parentName:"p"},"current")," module scope. Agar lebih jelas silakan pelajari kode berikut:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'fn my_func() {\n println!("calling `my_func()`");\n}\n\nmod my_mod {\n \n pub fn my_func() {\n println!("calling `my_mod::my_func()`");\n }\n \n pub mod my_submod {\n\n pub fn my_func() {\n println!("calling `my_mod::my_submod::my_func()`");\n }\n \n pub fn run_the_app() {\n println!("calling `my_mod::my_submod::run_the_app()`");\n crate::my_func();\n super::my_func();\n self::my_func();\n }\n }\n}\n\nfn main() {\n my_mod::my_submod::run_the_app();\n}\n')),(0,l.kt)("p",null,"Ada 3 buah fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func")," dideklarasikan:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"my_func")," yang berada di ",(0,l.kt)("em",{parentName:"li"},"crate root"),"."),(0,l.kt)("li",{parentName:"ul"},"Fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"my_func")," yang merupakan module item milik ",(0,l.kt)("inlineCode",{parentName:"li"},"my_mod"),"."),(0,l.kt)("li",{parentName:"ul"},"Fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"my_func")," yang merupakan module item milik submodule ",(0,l.kt)("inlineCode",{parentName:"li"},"my_submod"),".")),(0,l.kt)("p",null,"Dalam fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"run_the_app"),", ketiga fungsi dengan nama tersebut dipanggil."),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Statement ",(0,l.kt)("inlineCode",{parentName:"li"},"crate::my_func()")," akan mengarah ke fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"my_func")," yang ada di ",(0,l.kt)("em",{parentName:"li"},"crate root"),"."),(0,l.kt)("li",{parentName:"ul"},"Statement ",(0,l.kt)("inlineCode",{parentName:"li"},"super::my_func()")," akan mengarah ke fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"my_func")," yang ada di parent module scope, yaitu ",(0,l.kt)("inlineCode",{parentName:"li"},"my_mod::my_func"),"."),(0,l.kt)("li",{parentName:"ul"},"Statement ",(0,l.kt)("inlineCode",{parentName:"li"},"self::my_func()")," akan mengarah ke fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"my_func")," yang ada di current module scope, yaitu ",(0,l.kt)("inlineCode",{parentName:"li"},"my_mod::my_submod::my_func"),".")),(0,l.kt)("p",null,(0,l.kt)("img",{alt:"Module item access super",src:n(2781).Z,width:"487",height:"152"})),(0,l.kt)("p",null,"Semoga cukup jelas ya. Silakan ulangi terus praktik di atas jika perlu, agar makin paham."),(0,l.kt)("p",null,"O iya, keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"super")," ini bisa digunakan banyak kali sesuai kebutuhan. Setiap kali keyword ditulis sebagai segment path, maka artinya 1 level parent module scope."),(0,l.kt)("p",null,"Jika mengacu ke contoh program di atas, maka kedua statement berikut adalah ekuivalen."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},"crate::my_func();\nsuper::super::my_func();\n")),(0,l.kt)("h2",{id:"a227-praktik-lanjutan"},"A.22.7. Praktik lanjutan"),(0,l.kt)("p",null,"Agar pemahaman makin mantab, silakan pelajari program berikut."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'fn my_func() {\n println!("call `my_func()`");\n}\n\nmod module_a {\n\n // path item \u279c `module_a::my_func`.\n pub fn my_func() {\n println!("call `module_a::my_func()`");\n }\n}\n\nmod module_b {\n\n // path item \u279c `module_b::submodule_b_one`.\n mod submodule_b_one {\n\n // path item \u279c `module_b::submodule_b_one::my_func`.\n pub fn my_func() {\n println!("call `module_b::submodule_b_one::my_func()`");\n }\n }\n\n // path item \u279c `module_b::submodule_b_two`.\n mod submodule_b_two {\n\n // path item \u279c `module_b::submodule_b_two::my_func`.\n pub fn my_func() {\n println!("call `module_b::submodule_b_two::my_func()`");\n\n // current module scope adalah module `submodule_b_two`.\n // keyword `super` di sini mengarah ke parent scope, yaitu `module`.\n //\n // statement `super::my_func()` berikut adalah\n // ekuivalen dengan `module_b::my_func()`\n // jika diakses dari crate root.\n super::my_func();\n //\n // statement `super::submodule_b_one::my_func()` berikut adalah\n // ekuivalen dengan `module_b::submodule_b_one::my_func()`\n // jika diakses dari crate root.\n super::submodule_b_one::my_func();\n }\n }\n \n // path item \u279c `module_b::my_func`.\n // fungsi ini tidak publik, jadi hanya bisa diakses dalam scope module `module_b` saja.\n fn my_func() {\n println!("call `module_b::my_func()`");\n }\n \n // path item \u279c `module_b::run_all_funcs`.\n pub fn run_all_funcs() {\n\n // semua fungsi yang didefinisikan akan di call dalam blok kode ini.\n print!("call `my::run_all_funcs()`");\n \n // keyword `self` merepresentasikan current module scope.\n // menjadikan dua statement berikut adalah ekuivalen:\n // `my_func()` adalah ekuivalen dengan `self::my_func()`.\n my_func();\n self::my_func();\n\n // current module scope adalah `module_b`.\n // keyword `super` di sini mengarah ke parent scope, yaitu root atau scope paling luar.\n //\n // statement `super::my_func()` berikut adalah\n // memanggil fungsi `my_func` yang ada di crate root,\n // yang deklarasinya satu level dengan fungsi `main`.\n super::my_func();\n //\n // statement `super::module_a::my_func()` berikut adalah\n // memanggil fungsi `my_func` milik module `module_a` yang ada di crate root.\n super::module_a::my_func();\n //\n // module `submodule_b_two` bisa diakses menggunakan self ataupun tidak\n // karena module tersebut merupakan item yang deklarasinya 1 scope dengan fungsi ini,\n // 1 level dengan `run_all_funcs`.\n submodule_b_two::my_func();\n self::submodule_b_two::my_func();\n }\n}\n\nfn main() {\n module_b::run_all_funcs();\n}\n')),(0,l.kt)("hr",null),(0,l.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,l.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,l.kt)("pre",null,(0,l.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/module_scope_item_access"},"github.com/novalagung/dasarpemrogramanrust-example/../module_scope_item_access")),(0,l.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html"},"https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.self.html"},"https://doc.rust-lang.org/std/keyword.self.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.super.html"},"https://doc.rust-lang.org/std/keyword.super.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.crate.html"},"https://doc.rust-lang.org/std/keyword.crate.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/mod.html"},"https://doc.rust-lang.org/rust-by-example/mod.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/meta/doc.html"},"https://doc.rust-lang.org/rust-by-example/meta/doc.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://aloso.github.io/2021/03/28/module-system.html"},"https://aloso.github.io/2021/03/28/module-system.html"))))}p.isMDXComponent=!0},7116:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeoAAACACAIAAABLF73lAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlI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DO2Si/iIPPo7NduYjjoFvw2RNa6mqQgzi9s6P8LCvYyw44tAtWt9ZN8iNxYXwHXm+q00zC9/BiC47Nset745Wu8e3c6DLdt+n9R38qvBdRz7btIhqzG99LzTi0M35vtVMMPENLmZ9n9kHTXx3//3xw+c5jvAdDaR+2CYu+omvLk0mDKug6/AtX6mVpjh+w3Bo9/CefeXIg2WE+Ro7q18vvnXDmbVU1e9sfJcTWnvEoZvDdzJvG8zX0yzuW/RWTcys/QfL1ne1AV7At3w95L08yFS+qOH7Y7fu4Wx8B/XUrXypx3e2gsK63Fo2U7qdbHexTCK5oeU+cfJmOr6NhhO15K+QrCefZh7/ehNaZ8ShG8b3xSRmiXMtnN3wp5E7U63xt7l13wiB7wUUW2ozfoVXeoOGlsW3+6tLhNCO8Z06T2Yg7vGG2XxeaB98XyLzVfec5Hod2/MEIbR7fCOEEALfCCEEvhFCCIFvhBBCl8Q34Rr6nBCuoaaObi5cw1w9hHANiHANV4tvwjUs3l7+rXYX6yF8dQm+7+hM4Psy8L50pZ2RdPCBreMzXvCNLoFvwjUQriE/k3ANWZueGk6m7t2ZYIkRh24V34RrIFxDqd0J15Dju1zJY9Y34RrQTPgmXAPhGsrtTriGpAXH984s3pJwDWg2fBOugXAN5XYnXEMyMzwT34RrQLNa34RrIFyD3e63Hq6h5arpzJhmfROuAc3j+yZcA+Eaiu1+0+EaMnaPuwFHS0C4BjQbvu8I10C4BnU7wjWIrRnNd86FHrLCiEM3jO+LiXANOxDhGhAC38XJ+h3hGq4E34RrQOgW8E24htoaIlwDQuAbIYQQ+EYIIQS+EUIIgW+EEALfCCGEwDdCCCHwjRBC4BshhBD4RgghBL4RQujW9H+5773REWOSYgAAAABJRU5ErkJggg=="},576:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/module-scope-item-access-2-d5e5b26c8180ce6a413ba9a494361526.png"},7721:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA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}}]); \ No newline at end of file diff --git a/assets/js/be3f5c40.c88245c9.js b/assets/js/be3f5c40.c88245c9.js new file mode 100644 index 00000000..f80a0f45 --- /dev/null +++ b/assets/js/be3f5c40.c88245c9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[5572],{3905:(e,a,n)=>{n.d(a,{Zo:()=>u,kt:()=>c});var t=n(7294);function l(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function i(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function d(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?i(Object(n),!0).forEach((function(a){l(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function m(e,a){if(null==e)return{};var n,t,l=function(e,a){if(null==e)return{};var n,t,l={},i=Object.keys(e);for(t=0;t<i.length;t++)n=i[t],a.indexOf(n)>=0||(l[n]=e[n]);return l}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t<i.length;t++)n=i[t],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var r=t.createContext({}),o=function(e){var a=t.useContext(r),n=a;return e&&(n="function"==typeof e?e(a):d(d({},a),e)),n},u=function(e){var a=o(e.components);return t.createElement(r.Provider,{value:a},e.children)},p={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},s=t.forwardRef((function(e,a){var n=e.components,l=e.mdxType,i=e.originalType,r=e.parentName,u=m(e,["components","mdxType","originalType","parentName"]),s=o(n),c=l,k=s["".concat(r,".").concat(c)]||s[c]||p[c]||i;return n?t.createElement(k,d(d({ref:a},u),{},{components:n})):t.createElement(k,d({ref:a},u))}));function c(e,a){var n=arguments,l=a&&a.mdxType;if("string"==typeof e||l){var i=n.length,d=new Array(i);d[0]=s;var m={};for(var r in a)hasOwnProperty.call(a,r)&&(m[r]=a[r]);m.originalType=e,m.mdxType="string"==typeof e?e:l,d[1]=m;for(var o=2;o<i;o++)d[o]=n[o];return t.createElement.apply(null,d)}return t.createElement.apply(null,n)}s.displayName="MDXCreateElement"},4387:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>r,contentTitle:()=>d,default:()=>p,frontMatter:()=>i,metadata:()=>m,toc:()=>o});var t=n(7462),l=(n(7294),n(3905));const i={sidebar_position:22,title:"A.22. Module System \u279c Scope & Akses Item",sidebar_label:"A.22. Module System \u279c Scope & Akses Item"},d=void 0,m={unversionedId:"basic/module-scope-item-access",id:"basic/module-scope-item-access",title:"A.22. Module System \u279c Scope & Akses Item",description:"Pembahasan chapter ini masih dalam lingkup module system, yaitu tentang scope dan pengakesan module item.",source:"@site/docs/basic/module-scope-item-access.md",sourceDirName:"basic",slug:"/basic/module-scope-item-access",permalink:"/basic/module-scope-item-access",draft:!1,tags:[],version:"current",sidebarPosition:22,frontMatter:{sidebar_position:22,title:"A.22. Module System \u279c Scope & Akses Item",sidebar_label:"A.22. Module System \u279c Scope & Akses Item"},sidebar:"tutorialSidebar",previous:{title:"A.21. Module System \u279c Inline Module",permalink:"/basic/module-inline"},next:{title:"A.23. Struct",permalink:"/basic/struct"}},r={},o=[{value:"A.22.1. Scope",id:"a221-scope",level:2},{value:"A.22.2. Module Scope",id:"a222-module-scope",level:2},{value:"A.22.3. Keyword <code>self</code> dan <em>crate root</em>",id:"a223-keyword-self-dan-crate-root",level:2},{value:"A.22.4. Keyword <code>self</code> pada module scope",id:"a224-keyword-self-pada-module-scope",level:2},{value:"A.22.5. Keyword <code>crate</code> pada module scope",id:"a225-keyword-crate-pada-module-scope",level:2},{value:"A.22.6. Keyword <code>super</code>",id:"a226-keyword-super",level:2},{value:"A.22.7. Praktik lanjutan",id:"a227-praktik-lanjutan",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],u={toc:o};function p(e){let{components:a,...i}=e;return(0,l.kt)("wrapper",(0,t.Z)({},u,i,{components:a,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"Pembahasan chapter ini masih dalam lingkup module system, yaitu tentang scope dan pengakesan module item."),(0,l.kt)("h2",{id:"a221-scope"},"A.22.1. Scope"),(0,l.kt)("p",null,"Scope bisa diartikan dengan: representasi di mana kode berada. Apapun yang ditulis dalam blok kode (ditandai dengan diapit tanda kurung kurawal ",(0,l.kt)("inlineCode",{parentName:"p"},"{ }"),") berarti dalam satu scope yang sama."),(0,l.kt)("p",null,"Agar lebih jelas, lihat kode berikut kemudian pelajari penjelasan di bawahnya:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'const PI: f64 = 3.14;\n\nfn main() {\n my_func();\n}\n\nfn my_func() {\n let nama = "Sylvanas Windrunner";\n let occupation = "ex-Warchief of the Horde";\n\n // ...\n}\n')),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Konstanta ",(0,l.kt)("inlineCode",{parentName:"li"},"PI"),", fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"main"),", dan juga fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"my_func")," di definisikan satu level dan berada di scope terluar (yang pada ebook ini disebut sebagai ",(0,l.kt)("em",{parentName:"li"},"root"),")."),(0,l.kt)("li",{parentName:"ul"},"Statement pemanggilan fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"my_func()")," berada dalam scope blok kode fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"main"),"."),(0,l.kt)("li",{parentName:"ul"},"Variabel ",(0,l.kt)("inlineCode",{parentName:"li"},"nama")," dan ",(0,l.kt)("inlineCode",{parentName:"li"},"occupation")," berada pada scope blok kode fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"my_func"),".")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"Sebenarnya pembahasan mengenai ",(0,l.kt)("inlineCode",{parentName:"p"},"scope")," harus diiringi dengan pembahasan tentang ",(0,l.kt)("a",{parentName:"p",href:"/basic/block-expression"},"Block expression"),", namun karena kita belum mempelajarinya, chapter ini pembahasan hanya akan fokus pada penerapan scope yang berhubungan dengan ",(0,l.kt)("strong",{parentName:"p"},"module scope"),".")),(0,l.kt)("h2",{id:"a222-module-scope"},"A.22.2. Module Scope"),(0,l.kt)("p",null,"Module scope adalah scope untuk module. Apa bedanya dengan scope secara umum? Silakan perhatikan kode berikut terlebih dahulu:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'mod my_module {\n\n const event_one: &str = "Siege of Ogrimmar";\n\n mod my_submodule {\n \n const event_two: &str = "Battle for Azeroth";\n\n fn func_two() {\n const event_three: &str = "Sepulcher of the First Ones";\n }\n }\n}\n')),(0,l.kt)("p",null,"Pada kode di atas:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Konstanta ",(0,l.kt)("inlineCode",{parentName:"li"},"event_one")," berada dalam module scope ",(0,l.kt)("inlineCode",{parentName:"li"},"my_module"),"."),(0,l.kt)("li",{parentName:"ul"},"Module ",(0,l.kt)("inlineCode",{parentName:"li"},"my_submodule")," adalah sebuah inline module yang berada dalam module scope ",(0,l.kt)("inlineCode",{parentName:"li"},"my_module"),". Module ",(0,l.kt)("inlineCode",{parentName:"li"},"my_submodule")," berada dalam satu scope yang sama dengan variabel ",(0,l.kt)("inlineCode",{parentName:"li"},"event_one"),"."),(0,l.kt)("li",{parentName:"ul"},"Konstanta ",(0,l.kt)("inlineCode",{parentName:"li"},"event_two")," berada dalam module scope ",(0,l.kt)("inlineCode",{parentName:"li"},"my_submodule"),"."),(0,l.kt)("li",{parentName:"ul"},"Fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"func_two")," berada dalam module scope ",(0,l.kt)("inlineCode",{parentName:"li"},"my_submodule"),"."),(0,l.kt)("li",{parentName:"ul"},"Konstanta ",(0,l.kt)("inlineCode",{parentName:"li"},"event_three")," ",(0,l.kt)("strong",{parentName:"li"},"scope"),"-nya adalah dalam blok fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"func_two"),". Sedangkan ",(0,l.kt)("strong",{parentName:"li"},"module scope"),"-nya adalah dalam module scope ",(0,l.kt)("inlineCode",{parentName:"li"},"my_submodule"),". Jadi kelihatan ya bedanya.")),(0,l.kt)("p",null,"Pemahaman tentang module scope ini penting karena akan berhubungan dengan apa yang akan dipelajari di ",(0,l.kt)("em",{parentName:"p"},"section")," berikutnya."),(0,l.kt)("h2",{id:"a223-keyword-self-dan-crate-root"},"A.22.3. Keyword ",(0,l.kt)("inlineCode",{parentName:"h2"},"self")," dan ",(0,l.kt)("em",{parentName:"h2"},"crate root")),(0,l.kt)("p",null,"Keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," merepresentasikan current module scope. Dengannya kita bisa mengakses item yang deklarasinya ada pada module scope yang sama."),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"Sebenarnya selain penjelasan di atas, keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," juga digunakan untuk hal lain yaitu sebagai receiver method."),(0,l.kt)("p",{parentName:"blockquote"},"Pembahasan tentang penerapan keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," sebagai receiver method dibahas pada chapter ",(0,l.kt)("a",{parentName:"p",href:"/basic/method"},"Method"))),(0,l.kt)("p",null,"Selanjutnya, apa itu ",(0,l.kt)("em",{parentName:"p"},"crate root"),"? ",(0,l.kt)("strong",{parentName:"p"},"Crate root")," adalah apapun yang didefinisikan di file entrypoint crate (yaitu ",(0,l.kt)("inlineCode",{parentName:"p"},"src/main.rs")," untuk binary crate, dan ",(0,l.kt)("inlineCode",{parentName:"p"},"src/lib.rs")," untuk library crate). ",(0,l.kt)("strong",{parentName:"p"},"Crate root")," adalah module scope yang berada di root (paling atas). Apapun yang berada di ",(0,l.kt)("em",{parentName:"p"},"crate root")," berarti berada dalam module scope yang sama."),(0,l.kt)("p",null,"Sebagai contoh, pada kode program berikut, module ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod")," dan fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"main")," dideklarasikan di ",(0,l.kt)("em",{parentName:"p"},"crate root")," ",(0,l.kt)("inlineCode",{parentName:"p"},"src/main.rs"),". Artinya kedua item tersebut berada dalam satu module scope yang sama, yaitu di ",(0,l.kt)("em",{parentName:"p"},"crate root"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'mod my_mod {\n pub fn run_the_app(note: &str) {\n println!("calling `my_mod::run_the_app()`. note {}", note);\n }\n}\n\nfn main() {\n my_mod::run_the_app("1st call");\n self::my_mod::run_the_app("2nd call");\n}\n')),(0,l.kt)("p",null,(0,l.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Module item access self",src:n(7116).Z,width:"490",height:"128"})),(0,l.kt)("p",null,"Pada fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"main"),", ada dua statement pemanggilan module item ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod::run_the_app"),". Kedua statement tersebut adalah mirip, pembedanya ada pada statement ke-2, yaitu keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," digunakan di segment path sebagai prefix."),(0,l.kt)("p",null,"Keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," menginstruksi program bahwa item yang dipanggil adalah item yang module scope-nya sama."),(0,l.kt)("p",null,"Pada contoh di atas, module ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod")," berada dalam satu scope yang sama dengan fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"main"),", yaitu di ",(0,l.kt)("em",{parentName:"p"},"crate root"),". Karena itu, ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod")," bisa diakses dengan menggunakan keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self"),", atau lansung panggil saja nama module seperti biasanya, ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod()"),"."),(0,l.kt)("p",null,"Bisa dibilang keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," ini opsional dalam penggunaannya, boleh ikut dituliskan dan boleh juga tidak."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'my_mod::run_the_app("1st call");\nself::my_mod::run_the_app("2nd call");\n')),(0,l.kt)("h2",{id:"a224-keyword-self-pada-module-scope"},"A.22.4. Keyword ",(0,l.kt)("inlineCode",{parentName:"h2"},"self")," pada module scope"),(0,l.kt)("p",null,"Lanjut ke praktik berikutnya. Masih tentang keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self"),", kita akan gunakan keyword ini untuk mengakses item dalam module."),(0,l.kt)("p",null,"Silakan tulis kode berikut kemudian jalankan."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'fn my_func() {\n println!("calling `my_func()`");\n}\n\nmod my_mod {\n \n pub fn my_func() {\n println!("calling `my_mod::my_func()`");\n }\n \n pub fn run_the_app() {\n println!("calling `my_mod::run_the_app()`");\n my_func();\n self::my_func();\n }\n}\n\nfn main() {\n my_mod::run_the_app();\n}\n')),(0,l.kt)("p",null,"Pada contoh bisa dilihat ada dua buah fungsi dideklarasikan dengan nama yang sama persis, yang satu berada di ",(0,l.kt)("em",{parentName:"p"},"crate root"),", satunya lagi merupakan item milik ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod"),"."),(0,l.kt)("p",null,"Di dalam ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod::run_the_app")," ada 2 kali pemanggilan fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func"),", satunya menggunakan keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," dan satunya tidak. Fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func")," manakah yang dipanggil? Hasilnya bisa dilihat pada gambar di bawah ini."),(0,l.kt)("p",null,(0,l.kt)("img",{loading:"lazy",alt:"Module item access self",src:n(576).Z,width:"681",height:"290"})),(0,l.kt)("p",null,"Kedua statement ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func()")," dan ",(0,l.kt)("inlineCode",{parentName:"p"},"self::my_func()")," dalam ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod::run_the_app")," adalah mengarah ke fungsi yang sama, yaitu ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod::my_func"),"."),(0,l.kt)("p",null,"Jadi kesimpulan dari penerapan keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," dalam module item adalah sama seperti penerapannya pada ",(0,l.kt)("em",{parentName:"p"},"crate root"),", yaitu boleh dipakai boleh tidak. Keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," adalah opsional."),(0,l.kt)("p",null,"Lalu bagaimana cara memanggil ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func")," yang berada di ",(0,l.kt)("em",{parentName:"p"},"crate root"),", dengan pemanggilan adalah dari dalam module item? Caranya adalah menggunakan keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"crate"),"."),(0,l.kt)("h2",{id:"a225-keyword-crate-pada-module-scope"},"A.22.5. Keyword ",(0,l.kt)("inlineCode",{parentName:"h2"},"crate")," pada module scope"),(0,l.kt)("p",null,"Keyword ini digunakan untuk mengakses apapun yang ada di ",(0,l.kt)("em",{parentName:"p"},"crate root"),"."),(0,l.kt)("p",null,"Pada contoh di atas, fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func")," yang berada di ",(0,l.kt)("em",{parentName:"p"},"crate root")," bisa dipanggil dari fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"main")," dengan statement ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func()")," atau ",(0,l.kt)("inlineCode",{parentName:"p"},"self::my_func()"),". Untuk bagian ini penulis rasa sudah cukup jelas."),(0,l.kt)("p",null,"Beda cerita kalau fungsi tersebut dipanggil dari dalam module item ",(0,l.kt)("inlineCode",{parentName:"p"},"run_the_app"),". Kedua statement ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func()")," dan ",(0,l.kt)("inlineCode",{parentName:"p"},"self::my_func()")," mengarah ke ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod::my_func"),", bukan ke fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func")," di ",(0,l.kt)("em",{parentName:"p"},"crate root"),". Hal ini karena ",(0,l.kt)("strong",{parentName:"p"},"current module scope")," dalam statement ",(0,l.kt)("inlineCode",{parentName:"p"},"run_the_app")," adalah module ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod"),", maka pemanggilan ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func")," tanpa ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," atau dengannya mengarah ke fungsi yang sama yaitu ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod::my_func"),"."),(0,l.kt)("p",null,"Pada ",(0,l.kt)("em",{parentName:"p"},"section")," ini kita akan belajar tentang keyword baru, yaitu ",(0,l.kt)("inlineCode",{parentName:"p"},"crate"),". Keyword tersebut digunakan untuk mengakses apapun yang berada di ",(0,l.kt)("em",{parentName:"p"},"crate root"),". Kita bisa memanfaatkannya untuk mengakses ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func")," yang berada di ",(0,l.kt)("em",{parentName:"p"},"crate root")," dengan pengaksesan dari dalam module item."),(0,l.kt)("p",null,"Silakan ubah kode di atas menjadi seperti berikut. Perubahannya ada pada statement dalam fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"run_the_app"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'fn my_func() {\n println!("calling `my_func()`");\n}\n\nmod my_mod {\n \n pub fn my_func() {\n println!("calling `my_mod::my_func()`");\n }\n \n pub fn run_the_app() {\n println!("calling `my_mod::run_the_app()`");\n crate::my_func();\n self::my_func();\n }\n}\n\nfn main() {\n my_mod::run_the_app();\n}\n')),(0,l.kt)("p",null,"Jalankan program, hasilnya berbeda dengan eksekusi program sebelumnya. Statement ",(0,l.kt)("inlineCode",{parentName:"p"},"crate::my_func()")," dalam fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"run_the_app")," mengarah ke fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func")," di root, sedangkan ",(0,l.kt)("inlineCode",{parentName:"p"},"self::my_func")," mengarah ke ",(0,l.kt)("inlineCode",{parentName:"p"},"my_mod::my_func"),"."),(0,l.kt)("p",null,(0,l.kt)("img",{loading:"lazy",alt:"Module item access crate",src:n(7721).Z,width:"487",height:"136"})),(0,l.kt)("h2",{id:"a226-keyword-super"},"A.22.6. Keyword ",(0,l.kt)("inlineCode",{parentName:"h2"},"super")),(0,l.kt)("p",null,"Selain ",(0,l.kt)("inlineCode",{parentName:"p"},"self")," dan ",(0,l.kt)("inlineCode",{parentName:"p"},"crate")," ada juga keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"super"),", yang gunanya adalah untuk mengakses ",(0,l.kt)("em",{parentName:"p"},"parent")," module scope atau 1 scope di atas ",(0,l.kt)("em",{parentName:"p"},"current")," module scope. Agar lebih jelas silakan pelajari kode berikut:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'fn my_func() {\n println!("calling `my_func()`");\n}\n\nmod my_mod {\n \n pub fn my_func() {\n println!("calling `my_mod::my_func()`");\n }\n \n pub mod my_submod {\n\n pub fn my_func() {\n println!("calling `my_mod::my_submod::my_func()`");\n }\n \n pub fn run_the_app() {\n println!("calling `my_mod::my_submod::run_the_app()`");\n crate::my_func();\n super::my_func();\n self::my_func();\n }\n }\n}\n\nfn main() {\n my_mod::my_submod::run_the_app();\n}\n')),(0,l.kt)("p",null,"Ada 3 buah fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"my_func")," dideklarasikan:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"my_func")," yang berada di ",(0,l.kt)("em",{parentName:"li"},"crate root"),"."),(0,l.kt)("li",{parentName:"ul"},"Fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"my_func")," yang merupakan module item milik ",(0,l.kt)("inlineCode",{parentName:"li"},"my_mod"),"."),(0,l.kt)("li",{parentName:"ul"},"Fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"my_func")," yang merupakan module item milik submodule ",(0,l.kt)("inlineCode",{parentName:"li"},"my_submod"),".")),(0,l.kt)("p",null,"Dalam fungsi ",(0,l.kt)("inlineCode",{parentName:"p"},"run_the_app"),", ketiga fungsi dengan nama tersebut dipanggil."),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Statement ",(0,l.kt)("inlineCode",{parentName:"li"},"crate::my_func()")," akan mengarah ke fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"my_func")," yang ada di ",(0,l.kt)("em",{parentName:"li"},"crate root"),"."),(0,l.kt)("li",{parentName:"ul"},"Statement ",(0,l.kt)("inlineCode",{parentName:"li"},"super::my_func()")," akan mengarah ke fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"my_func")," yang ada di parent module scope, yaitu ",(0,l.kt)("inlineCode",{parentName:"li"},"my_mod::my_func"),"."),(0,l.kt)("li",{parentName:"ul"},"Statement ",(0,l.kt)("inlineCode",{parentName:"li"},"self::my_func()")," akan mengarah ke fungsi ",(0,l.kt)("inlineCode",{parentName:"li"},"my_func")," yang ada di current module scope, yaitu ",(0,l.kt)("inlineCode",{parentName:"li"},"my_mod::my_submod::my_func"),".")),(0,l.kt)("p",null,(0,l.kt)("img",{loading:"lazy",alt:"Module item access super",src:n(2781).Z,width:"487",height:"152"})),(0,l.kt)("p",null,"Semoga cukup jelas ya. Silakan ulangi terus praktik di atas jika perlu, agar makin paham."),(0,l.kt)("p",null,"O iya, keyword ",(0,l.kt)("inlineCode",{parentName:"p"},"super")," ini bisa digunakan banyak kali sesuai kebutuhan. Setiap kali keyword ditulis sebagai segment path, maka artinya 1 level parent module scope."),(0,l.kt)("p",null,"Jika mengacu ke contoh program di atas, maka kedua statement berikut adalah ekuivalen."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},"crate::my_func();\nsuper::super::my_func();\n")),(0,l.kt)("h2",{id:"a227-praktik-lanjutan"},"A.22.7. Praktik lanjutan"),(0,l.kt)("p",null,"Agar pemahaman makin mantab, silakan pelajari program berikut."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-rust"},'fn my_func() {\n println!("call `my_func()`");\n}\n\nmod module_a {\n\n // path item \u279c `module_a::my_func`.\n pub fn my_func() {\n println!("call `module_a::my_func()`");\n }\n}\n\nmod module_b {\n\n // path item \u279c `module_b::submodule_b_one`.\n mod submodule_b_one {\n\n // path item \u279c `module_b::submodule_b_one::my_func`.\n pub fn my_func() {\n println!("call `module_b::submodule_b_one::my_func()`");\n }\n }\n\n // path item \u279c `module_b::submodule_b_two`.\n mod submodule_b_two {\n\n // path item \u279c `module_b::submodule_b_two::my_func`.\n pub fn my_func() {\n println!("call `module_b::submodule_b_two::my_func()`");\n\n // current module scope adalah module `submodule_b_two`.\n // keyword `super` di sini mengarah ke parent scope, yaitu `module`.\n //\n // statement `super::my_func()` berikut adalah\n // ekuivalen dengan `module_b::my_func()`\n // jika diakses dari crate root.\n super::my_func();\n //\n // statement `super::submodule_b_one::my_func()` berikut adalah\n // ekuivalen dengan `module_b::submodule_b_one::my_func()`\n // jika diakses dari crate root.\n super::submodule_b_one::my_func();\n }\n }\n \n // path item \u279c `module_b::my_func`.\n // fungsi ini tidak publik, jadi hanya bisa diakses dalam scope module `module_b` saja.\n fn my_func() {\n println!("call `module_b::my_func()`");\n }\n \n // path item \u279c `module_b::run_all_funcs`.\n pub fn run_all_funcs() {\n\n // semua fungsi yang didefinisikan akan di call dalam blok kode ini.\n print!("call `my::run_all_funcs()`");\n \n // keyword `self` merepresentasikan current module scope.\n // menjadikan dua statement berikut adalah ekuivalen:\n // `my_func()` adalah ekuivalen dengan `self::my_func()`.\n my_func();\n self::my_func();\n\n // current module scope adalah `module_b`.\n // keyword `super` di sini mengarah ke parent scope, yaitu root atau scope paling luar.\n //\n // statement `super::my_func()` berikut adalah\n // memanggil fungsi `my_func` yang ada di crate root,\n // yang deklarasinya satu level dengan fungsi `main`.\n super::my_func();\n //\n // statement `super::module_a::my_func()` berikut adalah\n // memanggil fungsi `my_func` milik module `module_a` yang ada di crate root.\n super::module_a::my_func();\n //\n // module `submodule_b_two` bisa diakses menggunakan self ataupun tidak\n // karena module tersebut merupakan item yang deklarasinya 1 scope dengan fungsi ini,\n // 1 level dengan `run_all_funcs`.\n submodule_b_two::my_func();\n self::submodule_b_two::my_func();\n }\n}\n\nfn main() {\n module_b::run_all_funcs();\n}\n')),(0,l.kt)("hr",null),(0,l.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,l.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,l.kt)("pre",null,(0,l.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/module_scope_item_access"},"github.com/novalagung/dasarpemrogramanrust-example/../module_scope_item_access")),(0,l.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html"},"https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.self.html"},"https://doc.rust-lang.org/std/keyword.self.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.super.html"},"https://doc.rust-lang.org/std/keyword.super.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.crate.html"},"https://doc.rust-lang.org/std/keyword.crate.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/mod.html"},"https://doc.rust-lang.org/rust-by-example/mod.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/meta/doc.html"},"https://doc.rust-lang.org/rust-by-example/meta/doc.html")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://aloso.github.io/2021/03/28/module-system.html"},"https://aloso.github.io/2021/03/28/module-system.html"))))}p.isMDXComponent=!0},7116:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeoAAACACAIAAABLF73lAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25z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1+0+EaMnaPuwFHS0C4BjQbvu8I10C4BnU7wjWIrRnNd86FHrLCiEM3jO+LiXANOxDhGhAC38XJ+h3hGq4E34RrQOgW8E24htoaIlwDQuAbIYQQ+EYIIQS+EUIIgW+EEALfCCGEwDdCCCHwjRBC4BshhBD4RgghBL4RQujW9H+5773REWOSYgAAAABJRU5ErkJggg=="},576:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/module-scope-item-access-2-d5e5b26c8180ce6a413ba9a494361526.png"},7721:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAecAAACICAIAAABSurQ4AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS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qw9K0JY+hgQxQgUFXcyyR9I/oD2Rm2yIqw7K4LRvdWsCJdzkvyBIFloX9QmK8IGsiKoJ5ojKGsfZpbkDwSkRfuiNlkRtpEVYZj6hwZyhdp95Un+QPIHtD9bm6wIG8iKkF4an63de5ZJ/oCtjXZEbbIibCQrQurRqmZFuOxA8gf82mhn1H4gK8LasyLE/Rl1osiKkHYmyR9I/oD2R+27iawIR5mjk/wBoX1Qm6wI3w7xKR7JHxDaC7XJirD6eu6nmSR/QFAbIYQQ1EYIIQS1EUIIaiOEEILaCCGEoDZCCEFthBBCM+l/ifoKd1JW4mkAAAAASUVORK5CYII="}}]); \ No newline at end of file diff --git a/assets/js/c377a04b.4292a80d.js b/assets/js/c377a04b.de18b94b.js similarity index 95% rename from assets/js/c377a04b.4292a80d.js rename to assets/js/c377a04b.de18b94b.js index f7c8db6f..dd405efe 100644 --- a/assets/js/c377a04b.4292a80d.js +++ b/assets/js/c377a04b.de18b94b.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[6971],{3905:(a,e,t)=>{t.d(e,{Zo:()=>p,kt:()=>g});var r=t(7294);function n(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function o(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),t.push.apply(t,r)}return t}function i(a){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?o(Object(t),!0).forEach((function(e){n(a,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(t,e))}))}return a}function u(a,e){if(null==a)return{};var t,r,n=function(a,e){if(null==a)return{};var t,r,n={},o=Object.keys(a);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)>=0||(n[t]=a[t]);return n}(a,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(a);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(a,t)&&(n[t]=a[t])}return n}var s=r.createContext({}),l=function(a){var e=r.useContext(s),t=e;return a&&(t="function"==typeof a?a(e):i(i({},e),a)),t},p=function(a){var e=l(a.components);return r.createElement(s.Provider,{value:e},a.children)},m={inlineCode:"code",wrapper:function(a){var e=a.children;return r.createElement(r.Fragment,{},e)}},k=r.forwardRef((function(a,e){var t=a.components,n=a.mdxType,o=a.originalType,s=a.parentName,p=u(a,["components","mdxType","originalType","parentName"]),k=l(t),g=n,d=k["".concat(s,".").concat(g)]||k[g]||m[g]||o;return t?r.createElement(d,i(i({ref:e},p),{},{components:t})):r.createElement(d,i({ref:e},p))}));function g(a,e){var t=arguments,n=e&&e.mdxType;if("string"==typeof a||n){var o=t.length,i=new Array(o);i[0]=k;var u={};for(var s in e)hasOwnProperty.call(e,s)&&(u[s]=e[s]);u.originalType=a,u.mdxType="string"==typeof a?a:n,i[1]=u;for(var l=2;l<o;l++)i[l]=t[l];return r.createElement.apply(null,i)}return r.createElement.apply(null,t)}k.displayName="MDXCreateElement"},1269:(a,e,t)=>{t.r(e),t.d(e,{assets:()=>s,contentTitle:()=>i,default:()=>m,frontMatter:()=>o,metadata:()=>u,toc:()=>l});var r=t(7462),n=(t(7294),t(3905));const o={sidebar_position:1,title:"Tutorial Belajar Rust (Gratis!)",sidebar_label:"Dasar Pemrograman Rust"},i=void 0,u={unversionedId:"index",id:"index",title:"Tutorial Belajar Rust (Gratis!)",description:"Rust adalah sebuah bahasa pemrograman general purpose yang fokus pada performance, type safety, dan concurrency. Bahasa ini diciptakan sebagai alternatif bahasa pemrograman yang berfokus pada hal-hal yang cukup low-level tapi tetap men-support fitur yang sifatnya high-level.",source:"@site/docs/index.md",sourceDirName:".",slug:"/",permalink:"/",draft:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,title:"Tutorial Belajar Rust (Gratis!)",sidebar_label:"Dasar Pemrograman Rust"},sidebar:"tutorialSidebar",next:{title:"Pengenalan Rust Programming",permalink:"/pengelanan-rust-programming"}},s={},l=[{value:"Update Konten & Versi Terbaru",id:"update-konten--versi-terbaru",level:2},{value:"Download Ebook File (pdf)",id:"download-ebook-file-pdf",level:2},{value:"Source Code",id:"source-code",level:2},{value:"Kontribusi",id:"kontribusi",level:2},{value:"Lisensi dan Status FOSSA",id:"lisensi-dan-status-fossa",level:2},{value:"Author & Maintainer",id:"author--maintainer",level:2}],p={toc:l};function m(a){let{components:e,...t}=a;return(0,n.kt)("wrapper",(0,r.Z)({},p,t,{components:e,mdxType:"MDXLayout"}),(0,n.kt)("p",null,"Rust adalah sebuah bahasa pemrograman ",(0,n.kt)("em",{parentName:"p"},"general purpose")," yang fokus pada ",(0,n.kt)("em",{parentName:"p"},"performance"),", ",(0,n.kt)("em",{parentName:"p"},"type safety"),", dan ",(0,n.kt)("em",{parentName:"p"},"concurrency"),". Bahasa ini diciptakan sebagai alternatif bahasa pemrograman yang berfokus pada hal-hal yang cukup ",(0,n.kt)("em",{parentName:"p"},"low-level")," tapi tetap men-support fitur yang sifatnya ",(0,n.kt)("em",{parentName:"p"},"high-level"),"."),(0,n.kt)("p",null,"Website/ebook tutorial Dasar Pemrograman Rust ini dibuat dengan harapan bisa menjadi alternatif referensi belajar Rust, disajikan dengan penyampaian yang cocok untuk pembaca di level ",(0,n.kt)("em",{parentName:"p"},"beginner"),", dan gratis. Buku ini ada bukan untuk menggantikan ",(0,n.kt)("em",{parentName:"p"},"the book"),", melainkan sebagai komplemen."),(0,n.kt)("p",null,(0,n.kt)("a",{parentName:"p",href:"https://www.rust-lang.org/learn"},"Dokumentasi ",(0,n.kt)("em",{parentName:"a"},"official")," Rust")," sangat lengkap, dan aktif di-update oleh komunitas. Jika pembaca sudah memiliki banyak pengalaman dalam programming, sudah paham mengenai system programming seperti C atau C++, maka penulis sangat anjurkan untuk langsung menggunakan ",(0,n.kt)("a",{parentName:"p",href:"https://www.rust-lang.org/learn"},(0,n.kt)("em",{parentName:"a"},"the book"))," sebagai referensi belajar."),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Versi website/ebook: ",(0,n.kt)("strong",{parentName:"p"},"v1.0.20240731"),", dan versi ",(0,n.kt)("a",{parentName:"p",href:"https://blog.rust-lang.org/2024/06/13/Rust-1.79.0.html"},"Rust 1.79.0"),".")),(0,n.kt)("h2",{id:"update-konten--versi-terbaru"},"Update Konten & Versi Terbaru"),(0,n.kt)("p",null,"Setiap perubahan pada website/ebook bisa dilihat di halaman berikut:"),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},(0,n.kt)("a",{parentName:"p",href:"/CHANGELOG"},"Version Changelogs & Updates"))),(0,n.kt)("h2",{id:"download-ebook-file-pdf"},"Download Ebook File (pdf)"),(0,n.kt)("p",null,"Versi ebook bisa di-download dalam bentuk file di link berikut:"),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"PDF/Ebook file: ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/novalagung/dasarpemrogramanrust/raw/ebooks/dasarpemrogramanrust.pdf?v=v1.0.20240731"},"Dasar Pemrograman Rust.pdf"))),(0,n.kt)("h2",{id:"source-code"},"Source Code"),(0,n.kt)("p",null,"Source code website/ebook & praktik program bisa diunduh di link berikut:"),(0,n.kt)("blockquote",null,(0,n.kt)("ul",{parentName:"blockquote"},(0,n.kt)("li",{parentName:"ul"},"Source code website/ebook \u27a1\ufe0f ",(0,n.kt)("a",{parentName:"li",href:"https://github.com/novalagung/dasarpemrogramanrust"},"https://github.com/novalagung/dasarpemrogramanrust")),(0,n.kt)("li",{parentName:"ul"},"Source code praktik \u27a1\ufe0f ",(0,n.kt)("a",{parentName:"li",href:"https://github.com/novalagung/dasarpemrogramanrust-example"},"https://github.com/novalagung/dasarpemrogramanrust-example")))),(0,n.kt)("p",null,"Dianjurkan untuk sekedar tidak copy-paste dari source code dalam proses belajar, usahakan tulis sendiri kode program agar cepat terbiasa dengan bahasa Rust."),(0,n.kt)("h2",{id:"kontribusi"},"Kontribusi"),(0,n.kt)("p",null,"Website/ebook ini merupakan project open source, teruntuk siapapun yang ingin berkontribusi silakan langsung saja cek ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/novalagung/dasarpemrogramanrust"},"github.com/novalagung/dasarpemrogramanrust"),". Cek juga halaman kontributor berikut untuk melihat list kontributor."),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},(0,n.kt)("a",{parentName:"p",href:"/CONTRIBUTING"},"Contribution & Tech Stack"))),(0,n.kt)("h2",{id:"lisensi-dan-status-fossa"},"Lisensi dan Status FOSSA"),(0,n.kt)("p",null,"Website/ebook tutorial Dasar Pemrograman Rust gratis untuk disebarluaskan secara bebas, baik untuk komersil maupun tidak, dengan catatan harus disertakan credit sumber aslinya (yaitu Dasar Pemrograman Rust atau novalagung) dan tidak mengubah lisensi aslinya (yaitu CC BY-SA 4.0). Lebih jelasnya silakan cek halaman berikut:"),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},(0,n.kt)("a",{parentName:"p",href:"/LICENSE"},"lisensi dan distribusi konten"))),(0,n.kt)("p",null,"FOSSA Status:"),(0,n.kt)("p",null,(0,n.kt)("a",{parentName:"p",href:"https://app.fossa.io/projects/git%2Bgithub.com%2Fnovalagung%2Fdasarpemrogramanrust?ref=badge_large"},(0,n.kt)("img",{parentName:"a",src:"https://app.fossa.io/api/projects/git%2Bgithub.com%2Fnovalagung%2Fdasarpemrogramanrust.svg?type=large",alt:"FOSSA Status"}))),(0,n.kt)("h2",{id:"author--maintainer"},"Author & Maintainer"),(0,n.kt)("p",null,"Ebook ini dibuat oleh Noval Agung Prayogo. Untuk pertanyaan, kritik, dan saran, silakan drop email ke ",(0,n.kt)("a",{parentName:"p",href:"mailto:hello@novalagung.com"},"hello@novalagung.com"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[6971],{3905:(a,e,t)=>{t.d(e,{Zo:()=>p,kt:()=>g});var r=t(7294);function n(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function o(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),t.push.apply(t,r)}return t}function i(a){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?o(Object(t),!0).forEach((function(e){n(a,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(t,e))}))}return a}function u(a,e){if(null==a)return{};var t,r,n=function(a,e){if(null==a)return{};var t,r,n={},o=Object.keys(a);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)>=0||(n[t]=a[t]);return n}(a,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(a);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(a,t)&&(n[t]=a[t])}return n}var s=r.createContext({}),l=function(a){var e=r.useContext(s),t=e;return a&&(t="function"==typeof a?a(e):i(i({},e),a)),t},p=function(a){var e=l(a.components);return r.createElement(s.Provider,{value:e},a.children)},m={inlineCode:"code",wrapper:function(a){var e=a.children;return r.createElement(r.Fragment,{},e)}},k=r.forwardRef((function(a,e){var t=a.components,n=a.mdxType,o=a.originalType,s=a.parentName,p=u(a,["components","mdxType","originalType","parentName"]),k=l(t),g=n,d=k["".concat(s,".").concat(g)]||k[g]||m[g]||o;return t?r.createElement(d,i(i({ref:e},p),{},{components:t})):r.createElement(d,i({ref:e},p))}));function g(a,e){var t=arguments,n=e&&e.mdxType;if("string"==typeof a||n){var o=t.length,i=new Array(o);i[0]=k;var u={};for(var s in e)hasOwnProperty.call(e,s)&&(u[s]=e[s]);u.originalType=a,u.mdxType="string"==typeof a?a:n,i[1]=u;for(var l=2;l<o;l++)i[l]=t[l];return r.createElement.apply(null,i)}return r.createElement.apply(null,t)}k.displayName="MDXCreateElement"},1269:(a,e,t)=>{t.r(e),t.d(e,{assets:()=>s,contentTitle:()=>i,default:()=>m,frontMatter:()=>o,metadata:()=>u,toc:()=>l});var r=t(7462),n=(t(7294),t(3905));const o={sidebar_position:1,title:"Tutorial Belajar Rust (Gratis!)",sidebar_label:"Dasar Pemrograman Rust"},i=void 0,u={unversionedId:"index",id:"index",title:"Tutorial Belajar Rust (Gratis!)",description:"Rust adalah sebuah bahasa pemrograman general purpose yang fokus pada performance, type safety, dan concurrency. Bahasa ini diciptakan sebagai alternatif bahasa pemrograman yang berfokus pada hal-hal yang cukup low-level tapi tetap men-support fitur yang sifatnya high-level.",source:"@site/docs/index.md",sourceDirName:".",slug:"/",permalink:"/",draft:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,title:"Tutorial Belajar Rust (Gratis!)",sidebar_label:"Dasar Pemrograman Rust"},sidebar:"tutorialSidebar",next:{title:"Pengenalan Rust Programming",permalink:"/pengelanan-rust-programming"}},s={},l=[{value:"Update Konten & Versi Terbaru",id:"update-konten--versi-terbaru",level:2},{value:"Download Ebook File (pdf)",id:"download-ebook-file-pdf",level:2},{value:"Source Code",id:"source-code",level:2},{value:"Kontribusi",id:"kontribusi",level:2},{value:"Lisensi dan Status FOSSA",id:"lisensi-dan-status-fossa",level:2},{value:"Author & Maintainer",id:"author--maintainer",level:2}],p={toc:l};function m(a){let{components:e,...t}=a;return(0,n.kt)("wrapper",(0,r.Z)({},p,t,{components:e,mdxType:"MDXLayout"}),(0,n.kt)("p",null,"Rust adalah sebuah bahasa pemrograman ",(0,n.kt)("em",{parentName:"p"},"general purpose")," yang fokus pada ",(0,n.kt)("em",{parentName:"p"},"performance"),", ",(0,n.kt)("em",{parentName:"p"},"type safety"),", dan ",(0,n.kt)("em",{parentName:"p"},"concurrency"),". Bahasa ini diciptakan sebagai alternatif bahasa pemrograman yang berfokus pada hal-hal yang cukup ",(0,n.kt)("em",{parentName:"p"},"low-level")," tapi tetap men-support fitur yang sifatnya ",(0,n.kt)("em",{parentName:"p"},"high-level"),"."),(0,n.kt)("p",null,"Website/ebook tutorial Dasar Pemrograman Rust ini dibuat dengan harapan bisa menjadi alternatif referensi belajar Rust, disajikan dengan penyampaian yang cocok untuk pembaca di level ",(0,n.kt)("em",{parentName:"p"},"beginner"),", dan gratis. Buku ini ada bukan untuk menggantikan ",(0,n.kt)("em",{parentName:"p"},"the book"),", melainkan sebagai komplemen."),(0,n.kt)("p",null,(0,n.kt)("a",{parentName:"p",href:"https://www.rust-lang.org/learn"},"Dokumentasi ",(0,n.kt)("em",{parentName:"a"},"official")," Rust")," sangat lengkap, dan aktif di-update oleh komunitas. Jika pembaca sudah memiliki banyak pengalaman dalam programming, sudah paham mengenai system programming seperti C atau C++, maka penulis sangat anjurkan untuk langsung menggunakan ",(0,n.kt)("a",{parentName:"p",href:"https://www.rust-lang.org/learn"},(0,n.kt)("em",{parentName:"a"},"the book"))," sebagai referensi belajar."),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Versi website/ebook: ",(0,n.kt)("strong",{parentName:"p"},"v1.0.20240731"),", dan versi ",(0,n.kt)("a",{parentName:"p",href:"https://blog.rust-lang.org/2024/06/13/Rust-1.79.0.html"},"Rust 1.79.0"),".")),(0,n.kt)("h2",{id:"update-konten--versi-terbaru"},"Update Konten & Versi Terbaru"),(0,n.kt)("p",null,"Setiap perubahan pada website/ebook bisa dilihat di halaman berikut:"),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},(0,n.kt)("a",{parentName:"p",href:"/CHANGELOG"},"Version Changelogs & Updates"))),(0,n.kt)("h2",{id:"download-ebook-file-pdf"},"Download Ebook File (pdf)"),(0,n.kt)("p",null,"Versi ebook bisa di-download dalam bentuk file di link berikut:"),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"PDF/Ebook file: ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/novalagung/dasarpemrogramanrust/raw/ebooks/dasarpemrogramanrust.pdf?v=v1.0.20240731"},"Dasar Pemrograman Rust.pdf"))),(0,n.kt)("h2",{id:"source-code"},"Source Code"),(0,n.kt)("p",null,"Source code website/ebook & praktik program bisa diunduh di link berikut:"),(0,n.kt)("blockquote",null,(0,n.kt)("ul",{parentName:"blockquote"},(0,n.kt)("li",{parentName:"ul"},"Source code website/ebook \u27a1\ufe0f ",(0,n.kt)("a",{parentName:"li",href:"https://github.com/novalagung/dasarpemrogramanrust"},"https://github.com/novalagung/dasarpemrogramanrust")),(0,n.kt)("li",{parentName:"ul"},"Source code praktik \u27a1\ufe0f ",(0,n.kt)("a",{parentName:"li",href:"https://github.com/novalagung/dasarpemrogramanrust-example"},"https://github.com/novalagung/dasarpemrogramanrust-example")))),(0,n.kt)("p",null,"Dianjurkan untuk sekedar tidak copy-paste dari source code dalam proses belajar, usahakan tulis sendiri kode program agar cepat terbiasa dengan bahasa Rust."),(0,n.kt)("h2",{id:"kontribusi"},"Kontribusi"),(0,n.kt)("p",null,"Website/ebook ini merupakan project open source, teruntuk siapapun yang ingin berkontribusi silakan langsung saja cek ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/novalagung/dasarpemrogramanrust"},"github.com/novalagung/dasarpemrogramanrust"),". Cek juga halaman kontributor berikut untuk melihat list kontributor."),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},(0,n.kt)("a",{parentName:"p",href:"/CONTRIBUTING"},"Contribution & Tech Stack"))),(0,n.kt)("h2",{id:"lisensi-dan-status-fossa"},"Lisensi dan Status FOSSA"),(0,n.kt)("p",null,"Website/ebook tutorial Dasar Pemrograman Rust gratis untuk disebarluaskan secara bebas, baik untuk komersil maupun tidak, dengan catatan harus disertakan credit sumber aslinya (yaitu Dasar Pemrograman Rust atau novalagung) dan tidak mengubah lisensi aslinya (yaitu CC BY-SA 4.0). Lebih jelasnya silakan cek halaman berikut:"),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},(0,n.kt)("a",{parentName:"p",href:"/LICENSE"},"lisensi dan distribusi konten"))),(0,n.kt)("p",null,"FOSSA Status:"),(0,n.kt)("p",null,(0,n.kt)("a",{parentName:"p",href:"https://app.fossa.io/projects/git%2Bgithub.com%2Fnovalagung%2Fdasarpemrogramanrust?ref=badge_large"},(0,n.kt)("img",{parentName:"a",src:"https://app.fossa.io/api/projects/git%2Bgithub.com%2Fnovalagung%2Fdasarpemrogramanrust.svg?type=large",alt:"FOSSA Status",fetchpriority:"high",loading:"eager"}))),(0,n.kt)("h2",{id:"author--maintainer"},"Author & Maintainer"),(0,n.kt)("p",null,"Ebook ini dibuat oleh Noval Agung Prayogo. Untuk pertanyaan, kritik, dan saran, silakan drop email ke ",(0,n.kt)("a",{parentName:"p",href:"mailto:hello@novalagung.com"},"hello@novalagung.com"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c526a898.18163a59.js b/assets/js/c526a898.18163a59.js deleted file mode 100644 index 2973574a..00000000 --- a/assets/js/c526a898.18163a59.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[9157],{3905:(a,e,n)=>{n.d(e,{Zo:()=>d,kt:()=>o});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function l(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function r(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function p(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},l=Object.keys(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var u=t.createContext({}),m=function(a){var e=t.useContext(u),n=e;return a&&(n="function"==typeof a?a(e):r(r({},e),a)),n},d=function(a){var e=m(a.components);return t.createElement(u.Provider,{value:e},a.children)},k={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},s=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,l=a.originalType,u=a.parentName,d=p(a,["components","mdxType","originalType","parentName"]),s=m(n),o=i,g=s["".concat(u,".").concat(o)]||s[o]||k[o]||l;return n?t.createElement(g,r(r({ref:e},d),{},{components:n})):t.createElement(g,r({ref:e},d))}));function o(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var l=n.length,r=new Array(l);r[0]=s;var p={};for(var u in e)hasOwnProperty.call(e,u)&&(p[u]=e[u]);p.originalType=a,p.mdxType="string"==typeof a?a:i,r[1]=p;for(var m=2;m<l;m++)r[m]=n[m];return t.createElement.apply(null,r)}return t.createElement.apply(null,n)}s.displayName="MDXCreateElement"},3024:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>u,contentTitle:()=>r,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>m});var t=n(7462),i=(n(7294),n(3905));const l={sidebar_position:17,title:"A.17. Function",sidebar_label:"A.17. Function"},r=void 0,p={unversionedId:"basic/function",id:"basic/function",title:"A.17. Function",description:"Pada chapter ini kita akan belajar tentang function atau fungsi.",source:"@site/docs/basic/function.md",sourceDirName:"basic",slug:"/basic/function",permalink:"/basic/function",draft:!1,tags:[],version:"current",sidebarPosition:17,frontMatter:{sidebar_position:17,title:"A.17. Function",sidebar_label:"A.17. Function"},sidebar:"tutorialSidebar",previous:{title:"A.16. Vector",permalink:"/basic/vector"},next:{title:"A.18. Module System \u279c Path & Item",permalink:"/basic/path-item"}},u={},m=[{value:"A.17.1. Keyword <code>fn</code>",id:"a171-keyword-fn",level:2},{value:"A.17.2. <em>Naming convention</em> fungsi",id:"a172-naming-convention-fungsi",level:2},{value:"A.17.3. Parameter fungsi dan argumen fungsi",id:"a173-parameter-fungsi-dan-argumen-fungsi",level:2},{value:"A.17.4. Nilai balik fungsi (<em>return value</em>)",id:"a174-nilai-balik-fungsi-return-value",level:2},{value:"\u25c9 Keyword <code>return</code> untuk penentuan nilai balik",id:"-keyword-return-untuk-penentuan-nilai-balik",level:3},{value:"\u25c9 <em>Return value</em> tanpa keyword <code>return</code>",id:"-return-value-tanpa-keyword-return",level:3},{value:"\u25c9 Statemen sebagai <em>return value</em> tanpa keyword <code>return</code>",id:"-statemen-sebagai-return-value-tanpa-keyword-return",level:3},{value:"\u25c9 Macro <code>format</code> untuk membuat <em>formatted</em> string",id:"-macro-format-untuk-membuat-formatted-string",level:3},{value:"A.17.5. <em>Conditional return value</em>",id:"a175-conditional-return-value",level:2},{value:"A.17.6. Nilai balik fungsi bertipe string literal <code>&str</code>",id:"a176-nilai-balik-fungsi-bertipe-string-literal-str",level:2},{value:"A.17.7. <em>Default return value</em>",id:"a177-default-return-value",level:2},{value:"A.17.8. Pembahasan lanjutan",id:"a178-pembahasan-lanjutan",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Work in progress",id:"-work-in-progress",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:m};function k(a){let{components:e,...l}=a;return(0,i.kt)("wrapper",(0,t.Z)({},d,l,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan belajar tentang ",(0,i.kt)("em",{parentName:"p"},"function")," atau fungsi."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Definisi fungsi dalam programming secara terminologi adalah sebuah modul atau sub-program kecil yang digunakan untuk mengeksekusi sebuah perintah, dan bisa di-",(0,i.kt)("em",{parentName:"p"},"reuse")," dalam penggunaannya.")),(0,i.kt)("h2",{id:"a171-keyword-fn"},"A.17.1. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"fn")),(0,i.kt)("p",null,"Fungsi di Rust dibuat menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"fn"),". Salah satu contoh penerapan keyword ini dalam pembuatan fungsi sudah kita praktikkan berulang kali pada definisi fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),", yang merupakan fungsi utama atau entrypoint sebuah program."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn main() {\n\n}\n")),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," ini spesial, ketika program dijalankan maka ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," otomatis dipanggil atau dieksekusi."),(0,i.kt)("p",null,"Pembuatan fungsi lainnya-pun juga didefinisikan dengan notasi penulisan yang sama. Pada contoh berikut kita akan buat fungsi bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"greet")," yang tugasnya adalah menampilkan message ke layar output."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn greet() {\n println!("hello world");\n}\n')),(0,i.kt)("p",null,"Panggil fungsi tersebut di ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),", lalu run program."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n println!("hello rust");\n greet();\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"function",src:n(2114).Z,width:"447",height:"86"})),(0,i.kt)("p",null,"Bisa dilihat ada 2 message muncul, yang pertama adalah pesan ",(0,i.kt)("inlineCode",{parentName:"p"},"hello rust")," yang muncul hasil eksekusi statement ",(0,i.kt)("inlineCode",{parentName:"p"},'println!("hello rust")'),", lalu diikuti ",(0,i.kt)("inlineCode",{parentName:"p"},"hello world")," yang statement print untuk menampilkan message tersebut ada dalam fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"greet"),"."),(0,i.kt)("p",null,"O iya, definisi fungsi tidak mengenal urutan ya. Sebagai contoh fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"greet")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," di atas, bebas mana yang ditulis lebih dulu."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn greet() {\n // ..\n}\n\nfn main() {\n // ..\n}\n")),(0,i.kt)("p",null,"... atau ..."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn main() {\n // ..\n}\n\nfn greet() {\n // ..\n}\n")),(0,i.kt)("h2",{id:"a172-naming-convention-fungsi"},"A.17.2. ",(0,i.kt)("em",{parentName:"h2"},"Naming convention")," fungsi"),(0,i.kt)("p",null,"Sesuai anjuran di ",(0,i.kt)("a",{parentName:"p",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"halaman dokumentasi Rust"),", aturan penulisan nama fungsi di Rust adalah menggunakan ",(0,i.kt)("strong",{parentName:"p"},"snake case"),". Nama fungsi dituliskan dalam huruf kecil dengan separator tanda garis bawah atau underscore (",(0,i.kt)("inlineCode",{parentName:"p"},"_"),"). Contohnya seperti: ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"greet_message"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"get_report_Status"),", dll."),(0,i.kt)("h2",{id:"a173-parameter-fungsi-dan-argumen-fungsi"},"A.17.3. Parameter fungsi dan argumen fungsi"),(0,i.kt)("p",null,"Fungsi bisa didefinisikan dengan disertai parameter, dengan itu bisa menyisipkan data saat pemanggilan fungsi."),(0,i.kt)("p",null,"Parameter dituliskan di statement pendefinisian fungsi dengan notasi seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn func_name(param_a: i32) {\n // ...\n}\n\nfn func_name(param_a: i32, param_b: bool) {\n // ...\n}\n\nfn func_name(param_a: i32, param_b: bool, param_c: &str) {\n // ...\n}\n\n// ...\n")),(0,i.kt)("p",null,"Kembali ke praktik, pada bagian ini kita akan buat sebuah fungsi bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"greet_custom_message"),". Fungsi ini tugasnya masih sama seperti seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"greet")," hanya saja pesan yang ditampilkan adalah sesuai dengan value parameter fungsi."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn greet_custom_message(name: &str, message: &str) {\n println!("hi {name}, {message}");\n}\n')),(0,i.kt)("p",null,"Ada dua parameter yang didefinisikan:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"name"),", tipe datanya string literal"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"message"),", tipe datanya juga string literal")),(0,i.kt)("p",null,"Kedua nilai parameter tersebut di-",(0,i.kt)("em",{parentName:"p"},"combine")," lalu di-print menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),"."),(0,i.kt)("p",null,"Ok, sekarang panggil fungsi tersebut dalam ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),", sisipkan argumen pertama ",(0,i.kt)("inlineCode",{parentName:"p"},"Damian")," yang ditampung parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"name"),", dan argumen ke-2 ",(0,i.kt)("inlineCode",{parentName:"p"},"welcome to the castle!")," untuk parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"message")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n greet_custom_message("Damian", "welcome to the castle!");\n}\n')),(0,i.kt)("p",null,"Jalankan program. Output bisa dilihat di gambar berikut."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"function",src:n(4002).Z,width:"450",height:"71"})),(0,i.kt)("p",null,"O iya, parameter bisa memiliki tipe data apa saja selama di-",(0,i.kt)("em",{parentName:"p"},"support")," oleh Rust, jadi tidak hanya string literal ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Secara terminologi, parameter adalah variabel yang didefinisikan di fungsi, sedangkan argumen adalah nilai yang disisipkan pada parameter saat pemanggilan fungsi."),(0,i.kt)("p",{parentName:"blockquote"},"Seiring berjalannya waktu, terjadi ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/book/ch03-03-how-functions-work.html#parameters"},"sedikit perubahan")," mengenai makna untuk istilah ",(0,i.kt)("inlineCode",{parentName:"p"},"parameter")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"argumen"),". Sekarang kedua istilah tersebut lebih sering dimaknai sama.")),(0,i.kt)("h2",{id:"a174-nilai-balik-fungsi-return-value"},"A.17.4. Nilai balik fungsi (",(0,i.kt)("em",{parentName:"h2"},"return value"),")"),(0,i.kt)("p",null,"Sebuah fungsi bisa di-desain memiliki nilai balik. Caranya dengan menambahkan tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"->")," diikuti tipe data dari nilai balik pada pendefinisian fungsi."),(0,i.kt)("p",null,"Pada contoh berikut, sebuah fungsi dibuat dengan nama ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_box_volume1"),", memiliki 3 buah parameter bertipe numerik (",(0,i.kt)("inlineCode",{parentName:"p"},"width"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"height"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"length"),"), dan nilai balik bertipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),". Tugas dari fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_box_volume1")," adalah melakukan operasi matematika perhitungan volume terhadap data yang didapat dari parameter, yang kemudian hasil kalkulasinya dijadikan nilai balik."),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"return")," (diikuti dengan data) digunakan untuk menentukan nilai balik suatu fungsi. Pada contoh berikut, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"volume")," adalah nilai balik fungsi."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn calculate_box_volume1(width: i32, height: i32, length: i32) -> i32 {\n let volume = width * height * length;\n return volume;\n}\n")),(0,i.kt)("p",null,"Selanjutnya siapkan beberapa variabel yang nantinya digunakan saat pemanggilan ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_box_volume1"),". Lalu panggil fungsi tersebut kemudian tampilkan ",(0,i.kt)("em",{parentName:"p"},"return value"),"-nya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let width = 5;\nlet height = 8;\nlet length = 12;\n\nlet res1 = calculate_box_volume1(width, height, length);\nprintln!("result: {res1}");\n')),(0,i.kt)("p",null,"Jalankan program, hasilnya adalah sesuai harapan. Volume dari persegi panjang dengan data ",(0,i.kt)("inlineCode",{parentName:"p"},"5 x 8 x 12")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"480"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"function",src:n(9031).Z,width:"451",height:"64"})),(0,i.kt)("h3",{id:"-keyword-return-untuk-penentuan-nilai-balik"},"\u25c9 Keyword ",(0,i.kt)("inlineCode",{parentName:"h3"},"return")," untuk penentuan nilai balik"),(0,i.kt)("p",null,"Salah satu hal yang unik yang ada di Rust adalah beberapa variasi cara penulisan nilai balik fungsi. Cara pertama adalah menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"return")," seperti yang sudah dipraktikkan."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn calculate_box_volume1(width: i32, height: i32, length: i32) -> i32 {\n let volume = width * height * length;\n return volume;\n}\n")),(0,i.kt)("p",null,"Untuk cara ini penulis rasa cukup jelas."),(0,i.kt)("h3",{id:"-return-value-tanpa-keyword-return"},"\u25c9 ",(0,i.kt)("em",{parentName:"h3"},"Return value")," tanpa keyword ",(0,i.kt)("inlineCode",{parentName:"h3"},"return")),(0,i.kt)("p",null,"Cara ke-2 kita langsung praktikkan menggunakan kode berikut, silakan tulis lalu jalankan program:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn calculate_box_volume2(width: i32, height: i32, length: i32) -> i32 {\n let volume = width * height * length;\n volume\n}\n\nfn main() {\n let name2 = "Damian";\n let res2 = calculate_box_volume2(width, height, length);\n println!("hi {name2}, the box volume is {res2}");\n}\n')),(0,i.kt)("p",null,"Hasilnya kurang lebih sama, hanya di-bagian outputnya beda karena pada contoh ini pesan yang ditampilkan diubah."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"function",src:n(3307).Z,width:"446",height:"67"})),(0,i.kt)("p",null,"Sekarang kita fokus ke kode yang sudah ditulis. Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_box_volume2")," kurang lebih struktur dan isinya sama seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_box_volume1"),", bedanya hanya pada dua hal:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Fungsi ",(0,i.kt)("inlineCode",{parentName:"li"},"calculate_box_volume2")," nilai baliknya dituliskan tanpa keyword ",(0,i.kt)("inlineCode",{parentName:"li"},"return")),(0,i.kt)("li",{parentName:"ul"},"Fungsi ",(0,i.kt)("inlineCode",{parentName:"li"},"calculate_box_volume2")," pada statement terakhir tidak diakhir tanda akhir statement ",(0,i.kt)("inlineCode",{parentName:"li"},";"))),(0,i.kt)("p",null,"Kedua poin tersebut merupakan syarat untuk penerapan ",(0,i.kt)("em",{parentName:"p"},"return value")," tanpa keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"return"),". Caranya kurang lebih adalah dengan menuliskan data nilai balik dengan tanpa keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"return")," dan di akhir statement tidak ditambahi tanda semicolon ",(0,i.kt)("inlineCode",{parentName:"p"},";"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Statement terakhir sebuah blok kode fungsi yang ditulis tanpa semicolon ",(0,i.kt)("inlineCode",{parentName:"p"},";")," disebut sebagai ",(0,i.kt)("inlineCode",{parentName:"p"},"tail")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"body tail"),".")),(0,i.kt)("h3",{id:"-statemen-sebagai-return-value-tanpa-keyword-return"},"\u25c9 Statemen sebagai ",(0,i.kt)("em",{parentName:"h3"},"return value")," tanpa keyword ",(0,i.kt)("inlineCode",{parentName:"h3"},"return")),(0,i.kt)("p",null,"Cara selanjutnya yang akan kita bahas ini sebenarnya sama seperti sebelumnya, hanya saja bedanya di sini tidak menggunakan nama variabel sebagai nilai balik, melainkan langsung statement, yang hasil eksekusi statement tersebut dijadikan nilai balik fungsi."),(0,i.kt)("p",null,"Langsung saja kita praktikkan. Siapkan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_box_volume3")," berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn calculate_box_volume3(width: i32, height: i32, length: i32) -> i32 {\n width * height * length\n}\n\nfn greet_custom_message(name: &str, message: &str) {\n println!("hi {name}, {message}");\n}\n')),(0,i.kt)("p",null,"Panggil fungsi tersebut, tampung nilai baliknya ke variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"res3"),". Lalu siapkan ",(0,i.kt)("inlineCode",{parentName:"p"},"message3")," yang isinya adalah sebuah pesan string literal yang dibuat menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"format"),". Terakhir tampilkan pesan tersebut menggunakan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"greet_custom_message"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let res3 = calculate_box_volume3(width, height, length);\n let message3 = format!("the box volume is {}", res3);\n\n greet_custom_message("Damian", message3.as_str());\n}\n')),(0,i.kt)("p",null,"Bisa dilihat hasilnya sama seperti pada program sebelumnya."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"function",src:n(3307).Z,width:"446",height:"67"})),(0,i.kt)("h3",{id:"-macro-format-untuk-membuat-formatted-string"},"\u25c9 Macro ",(0,i.kt)("inlineCode",{parentName:"h3"},"format")," untuk membuat ",(0,i.kt)("em",{parentName:"h3"},"formatted")," string"),(0,i.kt)("p",null,"Bagian ini adalah penjelasan tambahan dari kode program yang baru saja dipraktikkan."),(0,i.kt)("p",null,"Macro ",(0,i.kt)("inlineCode",{parentName:"p"},"format")," digunakan untuk ",(0,i.kt)("em",{parentName:"p"},"formatting")," sebuah string. ",(0,i.kt)("em",{parentName:"p"},"Formatting")," di sini maksudnya adalah pembuatan string dengan menggunakan teknik penyusunan isi string dalam format tertentu, mirip seperti yang dilakukan menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"print")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),", bedanya hanya pada macro ",(0,i.kt)("inlineCode",{parentName:"p"},"format")," hasilnya bukan sebuah output ke console output, melainkan sebagai nilai balik."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'// 2 bari statements berikut ...\nlet message3 = format!("the box volume is {}", res3);\nprintln!("{}", message3.as_str());\n\n// ... adalah sama dengan statement berikut ...\nprintln!("the box volume is {}", res3);\n')),(0,i.kt)("p",null,"Satu hal yang penting diketahui dari macro ",(0,i.kt)("inlineCode",{parentName:"p"},"format"),". Nilai balik macro ini bukanlah string literal ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),", tetapi tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),". ",(0,i.kt)("strong",{parentName:"p"},"Dua tipe tersebut adalah berbeda"),"."),(0,i.kt)("p",null,"Pada contoh di atas, method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_str")," milik tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," digunakan untuk mengambil data string literal-nya. Method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_str")," ini menghasilkan data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," dari sebuah ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,i.kt)("h2",{id:"a175-conditional-return-value"},"A.17.5. ",(0,i.kt)("em",{parentName:"h2"},"Conditional return value")),(0,i.kt)("p",null,"Kapan harus menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"return")," dalam penentuan nilai balik dan kapan tidak? Jawabannya mungkin adalah preferensi, tapi di luar itu ada juga case di mana keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"return")," harus digunakan, yaitu pada fungsi yang memiliki nilai balik terkondisi. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn get_score_message(score: f32) -> &\'static str {\n if score == 100.0 {\n return "you got a perfect score!"\n }\n \n if score > 76.0 {\n return "congrats, you passed the exam!"\n }\n\n "your score is below the passing grade"\n}\n\nfn main() {\n println!("{}", get_score_message(100.0));\n println!("{}", get_score_message(98.2));\n println!("{}", get_score_message(33.12));\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"function",src:n(6415).Z,width:"446",height:"100"})),(0,i.kt)("p",null,"Teknik penentuan nilai balik tanpa keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"return")," hanya bisa dipergunakan di akhir blok kode, contohnya pada fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"get_score_message")," statement terakhir blok kode adalah string literal ",(0,i.kt)("inlineCode",{parentName:"p"},'"your score is below the passing grade"'),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Jika pada selain akhir blok ada kondisi di mana nilai balik harus ditentukan, maka wajib menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"strong"},"return")),". Bisa dilihat pada fungsi yang sudah ditulis, ",(0,i.kt)("inlineCode",{parentName:"p"},"return")," statement dalam blok kode seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," dipergunakan."),(0,i.kt)("h2",{id:"a176-nilai-balik-fungsi-bertipe-string-literal-str"},"A.17.6. Nilai balik fungsi bertipe string literal ",(0,i.kt)("inlineCode",{parentName:"h2"},"&str")),(0,i.kt)("p",null,"Khusus untuk beberapa jenis tipe data, seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),", jika digunakan sebagai tipe data ",(0,i.kt)("em",{parentName:"p"},"return value")," fungsi harus ditambahi keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"static")," dengan penulisan ",(0,i.kt)("inlineCode",{parentName:"p"},"&'static str"),". Contoh penerapan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn get_score_message(score: f32) -> &\'static str {\n return "you got a perfect score!"\n}\n')),(0,i.kt)("p",null,"Agar tidak makin bingung, pembahasannya dipisah pada chapter lain, yaitu ",(0,i.kt)("a",{parentName:"p",href:"/basic/static"},"Static")," dan ",(0,i.kt)("a",{parentName:"p",href:"/basic/lifetime"},"Lifetime"),"."),(0,i.kt)("h2",{id:"a177-default-return-value"},"A.17.7. ",(0,i.kt)("em",{parentName:"h2"},"Default return value")),(0,i.kt)("p",null,"Tambahan info saja, bahwa di Rust, semua fungsi itu memiliki nilai balik, yep semuanya. Untuk fungsi yang tidak didefinisikan nilai baliknya maka nilai baliknya adalah tuple kosong ",(0,i.kt)("inlineCode",{parentName:"p"},"()"),". Sebagai contoh fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"greet_custom_message")," yang sudah ditulis, coba saja tampung nilai baliknya dan print. Outputnya adalah ",(0,i.kt)("em",{parentName:"p"},"empty tuple")," atau tuple kosong ",(0,i.kt)("inlineCode",{parentName:"p"},"()"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let a = greet_custom_message("Damian", "welcome to the castle!");\nprintln!("result: {:?}", a);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"function",src:n(3438).Z,width:"628",height:"237"})),(0,i.kt)("h2",{id:"a178-pembahasan-lanjutan"},"A.17.8. Pembahasan lanjutan"),(0,i.kt)("p",null,"Ada beberapa topik lainnya yang relevan dengan function, yaitu:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"Associated function"),", pembahasannya ada di chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/associated-function"},"Associated Function")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"Method"),", pembahasannya juga di chapter terpisah, yaitu ",(0,i.kt)("a",{parentName:"li",href:"/basic/method"},"Method"))),(0,i.kt)("p",null,"Selain itu nantinya juga ada pembahasan mengenai topik yang cukup advance yang berhubungan dengan fungsi, yaitu:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"Unsafe function"),", pembahasannya ada di chapter ",(0,i.kt)("a",{parentName:"li",href:"#/wip/safe-unsafe"},"Safe & Unsafe")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"Async function"),", pembahasannya ada di chapter ",(0,i.kt)("a",{parentName:"li",href:"#/wip/async"},"Async")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"Constant function"),", pembahasannya ada di chapter ",(0,i.kt)("a",{parentName:"li",href:"#/wip/constant-evaluation"},"Constant Evaluation")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"Trait \u279c Function"),", pembahasannya ada di chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/trait-function"},"Trait \u279c Function"))),(0,i.kt)("p",null,"Untuk sekarang silakan lanjut ke pembahasan chapter berikutnya terlebih dahulu, jangan langsung loncat ke chapter di atas."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/function"},"github.com/novalagung/dasarpemrogramanrust-example/../function")),(0,i.kt)("h3",{id:"-work-in-progress"},"\u25c9 Work in progress"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Pembahasan tentang diverging function (",(0,i.kt)("inlineCode",{parentName:"li"},"() -> !"),")")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch03-03-how-functions-work.html"},"https://doc.rust-lang.org/book/ch03-03-how-functions-work.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.fn.html"},"https://doc.rust-lang.org/std/keyword.fn.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.return.html"},"https://doc.rust-lang.org/std/keyword.return.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.static.html"},"https://doc.rust-lang.org/std/keyword.static.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/fn.html"},"https://doc.rust-lang.org/rust-by-example/fn.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"https://rust-lang.github.io/api-guidelines/naming.html"))))}k.isMDXComponent=!0},2114:(a,e,n)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IYRAJ0IIgU6EEAKdCCEEOm9Z01OJpSq4TTQ/8LjtfaXd3rla3MgtSsbrTQh07hSdG4Htdqw5QScCnQh0HuvKCTpRJXSuNgZWXI0zc9ko06zRssE+2Zi38GZndv9iC+EIbGGN7CjcxtV4E/NmqZELHLJTYewiL+24/TzP1r08i4xuMupcawwsuhoXBGJWo2U5I7uJr1gGc+QmWx0ncn+KXtIPahRlnSlLbVfjTcybtbobHbIzA3SRl7ZoHV06bBDoTA/0JcbAWec1/2QNvrUaLZ+kjEpMfHV0mtgp+HWmc/d2ENtz3Nto0Vbb1XgL82YVnUaH7NylvdxLW65l8bBBoDM50hcZAxcNvMgD2Gq0fBIzspv46rGSzVNZoEE69xCdcXsOtkin94tOWS/gyq7GW5g3F6BTdsjOXHAXeGmL6CwfNgh0ps6iZcbAi67ZU9BgNVrW0Vm2UpU08zUvNkg/hpHaQW7Prr1P791CYN5grrKr8RbmzQXolB2ysyudxV7aKjpZ4EQV0LnKGHgROv11NJPRsjqnLDoL9LPGvk6b9ipWg7qoRv0PSL735/I58szf5qrtalzbvNmMztXG9WYvbdE6eluHL/SZ0LnCGNiMTtXA2Ga0rGVkNPGNJmkZT2VjLvF2MaM7zTravYC0dTXewrxZbWSjQ3Y26lzipS1bR9u9nxHozIWdjJ/PpKvOWu0O2c29tBEqQGdtY2AEOgsGXGr+3NJLGyE7OrcxBkag0zbwDGsle/PSRqATIYQQ6EQIIdCJEEKgEyGEQCdCCIFOhBBCvf4H243KXipxqzoAAAAASUVORK5CYII="},3438:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/function-6-2ed9468eff22575ec04867323e17a7b2.png"}}]); \ No newline at end of file diff --git a/assets/js/c526a898.d1a213c9.js b/assets/js/c526a898.d1a213c9.js new file mode 100644 index 00000000..a7570bec --- /dev/null +++ b/assets/js/c526a898.d1a213c9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[9157],{3905:(a,e,n)=>{n.d(e,{Zo:()=>d,kt:()=>o});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function l(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function r(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function p(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},l=Object.keys(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(t=0;t<l.length;t++)n=l[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var u=t.createContext({}),m=function(a){var e=t.useContext(u),n=e;return a&&(n="function"==typeof a?a(e):r(r({},e),a)),n},d=function(a){var e=m(a.components);return t.createElement(u.Provider,{value:e},a.children)},k={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},s=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,l=a.originalType,u=a.parentName,d=p(a,["components","mdxType","originalType","parentName"]),s=m(n),o=i,g=s["".concat(u,".").concat(o)]||s[o]||k[o]||l;return n?t.createElement(g,r(r({ref:e},d),{},{components:n})):t.createElement(g,r({ref:e},d))}));function o(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var l=n.length,r=new Array(l);r[0]=s;var p={};for(var u in e)hasOwnProperty.call(e,u)&&(p[u]=e[u]);p.originalType=a,p.mdxType="string"==typeof a?a:i,r[1]=p;for(var m=2;m<l;m++)r[m]=n[m];return t.createElement.apply(null,r)}return t.createElement.apply(null,n)}s.displayName="MDXCreateElement"},3024:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>u,contentTitle:()=>r,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>m});var t=n(7462),i=(n(7294),n(3905));const l={sidebar_position:17,title:"A.17. Function",sidebar_label:"A.17. Function"},r=void 0,p={unversionedId:"basic/function",id:"basic/function",title:"A.17. Function",description:"Pada chapter ini kita akan belajar tentang function atau fungsi.",source:"@site/docs/basic/function.md",sourceDirName:"basic",slug:"/basic/function",permalink:"/basic/function",draft:!1,tags:[],version:"current",sidebarPosition:17,frontMatter:{sidebar_position:17,title:"A.17. Function",sidebar_label:"A.17. Function"},sidebar:"tutorialSidebar",previous:{title:"A.16. Vector",permalink:"/basic/vector"},next:{title:"A.18. Module System \u279c Path & Item",permalink:"/basic/path-item"}},u={},m=[{value:"A.17.1. Keyword <code>fn</code>",id:"a171-keyword-fn",level:2},{value:"A.17.2. <em>Naming convention</em> fungsi",id:"a172-naming-convention-fungsi",level:2},{value:"A.17.3. Parameter fungsi dan argumen fungsi",id:"a173-parameter-fungsi-dan-argumen-fungsi",level:2},{value:"A.17.4. Nilai balik fungsi (<em>return value</em>)",id:"a174-nilai-balik-fungsi-return-value",level:2},{value:"\u25c9 Keyword <code>return</code> untuk penentuan nilai balik",id:"-keyword-return-untuk-penentuan-nilai-balik",level:3},{value:"\u25c9 <em>Return value</em> tanpa keyword <code>return</code>",id:"-return-value-tanpa-keyword-return",level:3},{value:"\u25c9 Statemen sebagai <em>return value</em> tanpa keyword <code>return</code>",id:"-statemen-sebagai-return-value-tanpa-keyword-return",level:3},{value:"\u25c9 Macro <code>format</code> untuk membuat <em>formatted</em> string",id:"-macro-format-untuk-membuat-formatted-string",level:3},{value:"A.17.5. <em>Conditional return value</em>",id:"a175-conditional-return-value",level:2},{value:"A.17.6. Nilai balik fungsi bertipe string literal <code>&str</code>",id:"a176-nilai-balik-fungsi-bertipe-string-literal-str",level:2},{value:"A.17.7. <em>Default return value</em>",id:"a177-default-return-value",level:2},{value:"A.17.8. Pembahasan lanjutan",id:"a178-pembahasan-lanjutan",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Work in progress",id:"-work-in-progress",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],d={toc:m};function k(a){let{components:e,...l}=a;return(0,i.kt)("wrapper",(0,t.Z)({},d,l,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan belajar tentang ",(0,i.kt)("em",{parentName:"p"},"function")," atau fungsi."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Definisi fungsi dalam programming secara terminologi adalah sebuah modul atau sub-program kecil yang digunakan untuk mengeksekusi sebuah perintah, dan bisa di-",(0,i.kt)("em",{parentName:"p"},"reuse")," dalam penggunaannya.")),(0,i.kt)("h2",{id:"a171-keyword-fn"},"A.17.1. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"fn")),(0,i.kt)("p",null,"Fungsi di Rust dibuat menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"fn"),". Salah satu contoh penerapan keyword ini dalam pembuatan fungsi sudah kita praktikkan berulang kali pada definisi fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),", yang merupakan fungsi utama atau entrypoint sebuah program."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn main() {\n\n}\n")),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," ini spesial, ketika program dijalankan maka ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," otomatis dipanggil atau dieksekusi."),(0,i.kt)("p",null,"Pembuatan fungsi lainnya-pun juga didefinisikan dengan notasi penulisan yang sama. Pada contoh berikut kita akan buat fungsi bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"greet")," yang tugasnya adalah menampilkan message ke layar output."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn greet() {\n println!("hello world");\n}\n')),(0,i.kt)("p",null,"Panggil fungsi tersebut di ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),", lalu run program."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n println!("hello rust");\n greet();\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"function",src:n(2114).Z,width:"447",height:"86"})),(0,i.kt)("p",null,"Bisa dilihat ada 2 message muncul, yang pertama adalah pesan ",(0,i.kt)("inlineCode",{parentName:"p"},"hello rust")," yang muncul hasil eksekusi statement ",(0,i.kt)("inlineCode",{parentName:"p"},'println!("hello rust")'),", lalu diikuti ",(0,i.kt)("inlineCode",{parentName:"p"},"hello world")," yang statement print untuk menampilkan message tersebut ada dalam fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"greet"),"."),(0,i.kt)("p",null,"O iya, definisi fungsi tidak mengenal urutan ya. Sebagai contoh fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"greet")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," di atas, bebas mana yang ditulis lebih dulu."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn greet() {\n // ..\n}\n\nfn main() {\n // ..\n}\n")),(0,i.kt)("p",null,"... atau ..."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn main() {\n // ..\n}\n\nfn greet() {\n // ..\n}\n")),(0,i.kt)("h2",{id:"a172-naming-convention-fungsi"},"A.17.2. ",(0,i.kt)("em",{parentName:"h2"},"Naming convention")," fungsi"),(0,i.kt)("p",null,"Sesuai anjuran di ",(0,i.kt)("a",{parentName:"p",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"halaman dokumentasi Rust"),", aturan penulisan nama fungsi di Rust adalah menggunakan ",(0,i.kt)("strong",{parentName:"p"},"snake case"),". Nama fungsi dituliskan dalam huruf kecil dengan separator tanda garis bawah atau underscore (",(0,i.kt)("inlineCode",{parentName:"p"},"_"),"). Contohnya seperti: ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"greet_message"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"get_report_Status"),", dll."),(0,i.kt)("h2",{id:"a173-parameter-fungsi-dan-argumen-fungsi"},"A.17.3. Parameter fungsi dan argumen fungsi"),(0,i.kt)("p",null,"Fungsi bisa didefinisikan dengan disertai parameter, dengan itu bisa menyisipkan data saat pemanggilan fungsi."),(0,i.kt)("p",null,"Parameter dituliskan di statement pendefinisian fungsi dengan notasi seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn func_name(param_a: i32) {\n // ...\n}\n\nfn func_name(param_a: i32, param_b: bool) {\n // ...\n}\n\nfn func_name(param_a: i32, param_b: bool, param_c: &str) {\n // ...\n}\n\n// ...\n")),(0,i.kt)("p",null,"Kembali ke praktik, pada bagian ini kita akan buat sebuah fungsi bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"greet_custom_message"),". Fungsi ini tugasnya masih sama seperti seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"greet")," hanya saja pesan yang ditampilkan adalah sesuai dengan value parameter fungsi."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn greet_custom_message(name: &str, message: &str) {\n println!("hi {name}, {message}");\n}\n')),(0,i.kt)("p",null,"Ada dua parameter yang didefinisikan:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"name"),", tipe datanya string literal"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"message"),", tipe datanya juga string literal")),(0,i.kt)("p",null,"Kedua nilai parameter tersebut di-",(0,i.kt)("em",{parentName:"p"},"combine")," lalu di-print menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),"."),(0,i.kt)("p",null,"Ok, sekarang panggil fungsi tersebut dalam ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),", sisipkan argumen pertama ",(0,i.kt)("inlineCode",{parentName:"p"},"Damian")," yang ditampung parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"name"),", dan argumen ke-2 ",(0,i.kt)("inlineCode",{parentName:"p"},"welcome to the castle!")," untuk parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"message")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n greet_custom_message("Damian", "welcome to the castle!");\n}\n')),(0,i.kt)("p",null,"Jalankan program. Output bisa dilihat di gambar berikut."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"function",src:n(4002).Z,width:"450",height:"71"})),(0,i.kt)("p",null,"O iya, parameter bisa memiliki tipe data apa saja selama di-",(0,i.kt)("em",{parentName:"p"},"support")," oleh Rust, jadi tidak hanya string literal ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Secara terminologi, parameter adalah variabel yang didefinisikan di fungsi, sedangkan argumen adalah nilai yang disisipkan pada parameter saat pemanggilan fungsi."),(0,i.kt)("p",{parentName:"blockquote"},"Seiring berjalannya waktu, terjadi ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/book/ch03-03-how-functions-work.html#parameters"},"sedikit perubahan")," mengenai makna untuk istilah ",(0,i.kt)("inlineCode",{parentName:"p"},"parameter")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"argumen"),". Sekarang kedua istilah tersebut lebih sering dimaknai sama.")),(0,i.kt)("h2",{id:"a174-nilai-balik-fungsi-return-value"},"A.17.4. Nilai balik fungsi (",(0,i.kt)("em",{parentName:"h2"},"return value"),")"),(0,i.kt)("p",null,"Sebuah fungsi bisa di-desain memiliki nilai balik. Caranya dengan menambahkan tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"->")," diikuti tipe data dari nilai balik pada pendefinisian fungsi."),(0,i.kt)("p",null,"Pada contoh berikut, sebuah fungsi dibuat dengan nama ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_box_volume1"),", memiliki 3 buah parameter bertipe numerik (",(0,i.kt)("inlineCode",{parentName:"p"},"width"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"height"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"length"),"), dan nilai balik bertipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),". Tugas dari fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_box_volume1")," adalah melakukan operasi matematika perhitungan volume terhadap data yang didapat dari parameter, yang kemudian hasil kalkulasinya dijadikan nilai balik."),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"return")," (diikuti dengan data) digunakan untuk menentukan nilai balik suatu fungsi. Pada contoh berikut, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"volume")," adalah nilai balik fungsi."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn calculate_box_volume1(width: i32, height: i32, length: i32) -> i32 {\n let volume = width * height * length;\n return volume;\n}\n")),(0,i.kt)("p",null,"Selanjutnya siapkan beberapa variabel yang nantinya digunakan saat pemanggilan ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_box_volume1"),". Lalu panggil fungsi tersebut kemudian tampilkan ",(0,i.kt)("em",{parentName:"p"},"return value"),"-nya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let width = 5;\nlet height = 8;\nlet length = 12;\n\nlet res1 = calculate_box_volume1(width, height, length);\nprintln!("result: {res1}");\n')),(0,i.kt)("p",null,"Jalankan program, hasilnya adalah sesuai harapan. Volume dari persegi panjang dengan data ",(0,i.kt)("inlineCode",{parentName:"p"},"5 x 8 x 12")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"480"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"function",src:n(9031).Z,width:"451",height:"64"})),(0,i.kt)("h3",{id:"-keyword-return-untuk-penentuan-nilai-balik"},"\u25c9 Keyword ",(0,i.kt)("inlineCode",{parentName:"h3"},"return")," untuk penentuan nilai balik"),(0,i.kt)("p",null,"Salah satu hal yang unik yang ada di Rust adalah beberapa variasi cara penulisan nilai balik fungsi. Cara pertama adalah menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"return")," seperti yang sudah dipraktikkan."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"fn calculate_box_volume1(width: i32, height: i32, length: i32) -> i32 {\n let volume = width * height * length;\n return volume;\n}\n")),(0,i.kt)("p",null,"Untuk cara ini penulis rasa cukup jelas."),(0,i.kt)("h3",{id:"-return-value-tanpa-keyword-return"},"\u25c9 ",(0,i.kt)("em",{parentName:"h3"},"Return value")," tanpa keyword ",(0,i.kt)("inlineCode",{parentName:"h3"},"return")),(0,i.kt)("p",null,"Cara ke-2 kita langsung praktikkan menggunakan kode berikut, silakan tulis lalu jalankan program:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn calculate_box_volume2(width: i32, height: i32, length: i32) -> i32 {\n let volume = width * height * length;\n volume\n}\n\nfn main() {\n let name2 = "Damian";\n let res2 = calculate_box_volume2(width, height, length);\n println!("hi {name2}, the box volume is {res2}");\n}\n')),(0,i.kt)("p",null,"Hasilnya kurang lebih sama, hanya di-bagian outputnya beda karena pada contoh ini pesan yang ditampilkan diubah."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"function",src:n(3307).Z,width:"446",height:"67"})),(0,i.kt)("p",null,"Sekarang kita fokus ke kode yang sudah ditulis. Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_box_volume2")," kurang lebih struktur dan isinya sama seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_box_volume1"),", bedanya hanya pada dua hal:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Fungsi ",(0,i.kt)("inlineCode",{parentName:"li"},"calculate_box_volume2")," nilai baliknya dituliskan tanpa keyword ",(0,i.kt)("inlineCode",{parentName:"li"},"return")),(0,i.kt)("li",{parentName:"ul"},"Fungsi ",(0,i.kt)("inlineCode",{parentName:"li"},"calculate_box_volume2")," pada statement terakhir tidak diakhir tanda akhir statement ",(0,i.kt)("inlineCode",{parentName:"li"},";"))),(0,i.kt)("p",null,"Kedua poin tersebut merupakan syarat untuk penerapan ",(0,i.kt)("em",{parentName:"p"},"return value")," tanpa keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"return"),". Caranya kurang lebih adalah dengan menuliskan data nilai balik dengan tanpa keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"return")," dan di akhir statement tidak ditambahi tanda semicolon ",(0,i.kt)("inlineCode",{parentName:"p"},";"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Statement terakhir sebuah blok kode fungsi yang ditulis tanpa semicolon ",(0,i.kt)("inlineCode",{parentName:"p"},";")," disebut sebagai ",(0,i.kt)("inlineCode",{parentName:"p"},"tail")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"body tail"),".")),(0,i.kt)("h3",{id:"-statemen-sebagai-return-value-tanpa-keyword-return"},"\u25c9 Statemen sebagai ",(0,i.kt)("em",{parentName:"h3"},"return value")," tanpa keyword ",(0,i.kt)("inlineCode",{parentName:"h3"},"return")),(0,i.kt)("p",null,"Cara selanjutnya yang akan kita bahas ini sebenarnya sama seperti sebelumnya, hanya saja bedanya di sini tidak menggunakan nama variabel sebagai nilai balik, melainkan langsung statement, yang hasil eksekusi statement tersebut dijadikan nilai balik fungsi."),(0,i.kt)("p",null,"Langsung saja kita praktikkan. Siapkan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"calculate_box_volume3")," berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn calculate_box_volume3(width: i32, height: i32, length: i32) -> i32 {\n width * height * length\n}\n\nfn greet_custom_message(name: &str, message: &str) {\n println!("hi {name}, {message}");\n}\n')),(0,i.kt)("p",null,"Panggil fungsi tersebut, tampung nilai baliknya ke variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"res3"),". Lalu siapkan ",(0,i.kt)("inlineCode",{parentName:"p"},"message3")," yang isinya adalah sebuah pesan string literal yang dibuat menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"format"),". Terakhir tampilkan pesan tersebut menggunakan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"greet_custom_message"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let res3 = calculate_box_volume3(width, height, length);\n let message3 = format!("the box volume is {}", res3);\n\n greet_custom_message("Damian", message3.as_str());\n}\n')),(0,i.kt)("p",null,"Bisa dilihat hasilnya sama seperti pada program sebelumnya."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"function",src:n(3307).Z,width:"446",height:"67"})),(0,i.kt)("h3",{id:"-macro-format-untuk-membuat-formatted-string"},"\u25c9 Macro ",(0,i.kt)("inlineCode",{parentName:"h3"},"format")," untuk membuat ",(0,i.kt)("em",{parentName:"h3"},"formatted")," string"),(0,i.kt)("p",null,"Bagian ini adalah penjelasan tambahan dari kode program yang baru saja dipraktikkan."),(0,i.kt)("p",null,"Macro ",(0,i.kt)("inlineCode",{parentName:"p"},"format")," digunakan untuk ",(0,i.kt)("em",{parentName:"p"},"formatting")," sebuah string. ",(0,i.kt)("em",{parentName:"p"},"Formatting")," di sini maksudnya adalah pembuatan string dengan menggunakan teknik penyusunan isi string dalam format tertentu, mirip seperti yang dilakukan menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"print")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),", bedanya hanya pada macro ",(0,i.kt)("inlineCode",{parentName:"p"},"format")," hasilnya bukan sebuah output ke console output, melainkan sebagai nilai balik."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'// 2 bari statements berikut ...\nlet message3 = format!("the box volume is {}", res3);\nprintln!("{}", message3.as_str());\n\n// ... adalah sama dengan statement berikut ...\nprintln!("the box volume is {}", res3);\n')),(0,i.kt)("p",null,"Satu hal yang penting diketahui dari macro ",(0,i.kt)("inlineCode",{parentName:"p"},"format"),". Nilai balik macro ini bukanlah string literal ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),", tetapi tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),". ",(0,i.kt)("strong",{parentName:"p"},"Dua tipe tersebut adalah berbeda"),"."),(0,i.kt)("p",null,"Pada contoh di atas, method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_str")," milik tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," digunakan untuk mengambil data string literal-nya. Method ",(0,i.kt)("inlineCode",{parentName:"p"},"as_str")," ini menghasilkan data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," dari sebuah ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,i.kt)("h2",{id:"a175-conditional-return-value"},"A.17.5. ",(0,i.kt)("em",{parentName:"h2"},"Conditional return value")),(0,i.kt)("p",null,"Kapan harus menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"return")," dalam penentuan nilai balik dan kapan tidak? Jawabannya mungkin adalah preferensi, tapi di luar itu ada juga case di mana keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"return")," harus digunakan, yaitu pada fungsi yang memiliki nilai balik terkondisi. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn get_score_message(score: f32) -> &\'static str {\n if score == 100.0 {\n return "you got a perfect score!"\n }\n \n if score > 76.0 {\n return "congrats, you passed the exam!"\n }\n\n "your score is below the passing grade"\n}\n\nfn main() {\n println!("{}", get_score_message(100.0));\n println!("{}", get_score_message(98.2));\n println!("{}", get_score_message(33.12));\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"function",src:n(6415).Z,width:"446",height:"100"})),(0,i.kt)("p",null,"Teknik penentuan nilai balik tanpa keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"return")," hanya bisa dipergunakan di akhir blok kode, contohnya pada fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"get_score_message")," statement terakhir blok kode adalah string literal ",(0,i.kt)("inlineCode",{parentName:"p"},'"your score is below the passing grade"'),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Jika pada selain akhir blok ada kondisi di mana nilai balik harus ditentukan, maka wajib menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"strong"},"return")),". Bisa dilihat pada fungsi yang sudah ditulis, ",(0,i.kt)("inlineCode",{parentName:"p"},"return")," statement dalam blok kode seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," dipergunakan."),(0,i.kt)("h2",{id:"a176-nilai-balik-fungsi-bertipe-string-literal-str"},"A.17.6. Nilai balik fungsi bertipe string literal ",(0,i.kt)("inlineCode",{parentName:"h2"},"&str")),(0,i.kt)("p",null,"Khusus untuk beberapa jenis tipe data, seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),", jika digunakan sebagai tipe data ",(0,i.kt)("em",{parentName:"p"},"return value")," fungsi harus ditambahi keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"static")," dengan penulisan ",(0,i.kt)("inlineCode",{parentName:"p"},"&'static str"),". Contoh penerapan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn get_score_message(score: f32) -> &\'static str {\n return "you got a perfect score!"\n}\n')),(0,i.kt)("p",null,"Agar tidak makin bingung, pembahasannya dipisah pada chapter lain, yaitu ",(0,i.kt)("a",{parentName:"p",href:"/basic/static"},"Static")," dan ",(0,i.kt)("a",{parentName:"p",href:"/basic/lifetime"},"Lifetime"),"."),(0,i.kt)("h2",{id:"a177-default-return-value"},"A.17.7. ",(0,i.kt)("em",{parentName:"h2"},"Default return value")),(0,i.kt)("p",null,"Tambahan info saja, bahwa di Rust, semua fungsi itu memiliki nilai balik, yep semuanya. Untuk fungsi yang tidak didefinisikan nilai baliknya maka nilai baliknya adalah tuple kosong ",(0,i.kt)("inlineCode",{parentName:"p"},"()"),". Sebagai contoh fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"greet_custom_message")," yang sudah ditulis, coba saja tampung nilai baliknya dan print. Outputnya adalah ",(0,i.kt)("em",{parentName:"p"},"empty tuple")," atau tuple kosong ",(0,i.kt)("inlineCode",{parentName:"p"},"()"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let a = greet_custom_message("Damian", "welcome to the castle!");\nprintln!("result: {:?}", a);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"function",src:n(3438).Z,width:"628",height:"237"})),(0,i.kt)("h2",{id:"a178-pembahasan-lanjutan"},"A.17.8. Pembahasan lanjutan"),(0,i.kt)("p",null,"Ada beberapa topik lainnya yang relevan dengan function, yaitu:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"Associated function"),", pembahasannya ada di chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/associated-function"},"Associated Function")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"Method"),", pembahasannya juga di chapter terpisah, yaitu ",(0,i.kt)("a",{parentName:"li",href:"/basic/method"},"Method"))),(0,i.kt)("p",null,"Selain itu nantinya juga ada pembahasan mengenai topik yang cukup advance yang berhubungan dengan fungsi, yaitu:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"Unsafe function"),", pembahasannya ada di chapter ",(0,i.kt)("a",{parentName:"li",href:"#/wip/safe-unsafe"},"Safe & Unsafe")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"Async function"),", pembahasannya ada di chapter ",(0,i.kt)("a",{parentName:"li",href:"#/wip/async"},"Async")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"Constant function"),", pembahasannya ada di chapter ",(0,i.kt)("a",{parentName:"li",href:"#/wip/constant-evaluation"},"Constant Evaluation")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"Trait \u279c Function"),", pembahasannya ada di chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/trait-function"},"Trait \u279c Function"))),(0,i.kt)("p",null,"Untuk sekarang silakan lanjut ke pembahasan chapter berikutnya terlebih dahulu, jangan langsung loncat ke chapter di atas."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/function"},"github.com/novalagung/dasarpemrogramanrust-example/../function")),(0,i.kt)("h3",{id:"-work-in-progress"},"\u25c9 Work in progress"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Pembahasan tentang diverging function (",(0,i.kt)("inlineCode",{parentName:"li"},"() -> !"),")")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch03-03-how-functions-work.html"},"https://doc.rust-lang.org/book/ch03-03-how-functions-work.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.fn.html"},"https://doc.rust-lang.org/std/keyword.fn.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.return.html"},"https://doc.rust-lang.org/std/keyword.return.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.static.html"},"https://doc.rust-lang.org/std/keyword.static.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/fn.html"},"https://doc.rust-lang.org/rust-by-example/fn.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://rust-lang.github.io/api-guidelines/naming.html"},"https://rust-lang.github.io/api-guidelines/naming.html"))))}k.isMDXComponent=!0},2114:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAABWCAIAAADQTQ/bAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy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WYvbdE6eluHL/SZ0LnCGNiMTtXA2Ga0rGVkNPGNJmkZT2VjLvF2MaM7zTravYC0dTXewrxZbWSjQ3Y26lzipS1bR9u9nxHozIWdjJ/PpKvOWu0O2c29tBEqQGdtY2AEOgsGXGr+3NJLGyE7OrcxBkag0zbwDGsle/PSRqATIYQQ6EQIIdCJEEKgEyGEQCdCCIFOhBBCvf4H243KXipxqzoAAAAASUVORK5CYII="},3438:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/function-6-2ed9468eff22575ec04867323e17a7b2.png"}}]); \ No newline at end of file diff --git a/assets/js/c76cc2e3.5381dbe2.js b/assets/js/c76cc2e3.5381dbe2.js new file mode 100644 index 00000000..bde4c23b --- /dev/null +++ b/assets/js/c76cc2e3.5381dbe2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4729],{3905:(e,a,n)=>{n.d(a,{Zo:()=>o,kt:()=>k});var t=n(7294);function i(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function d(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?l(Object(n),!0).forEach((function(a){i(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function p(e,a){if(null==e)return{};var n,t,i=function(e,a){if(null==e)return{};var n,t,i={},l=Object.keys(e);for(t=0;t<l.length;t++)n=l[t],a.indexOf(n)>=0||(i[n]=e[n]);return i}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t<l.length;t++)n=l[t],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var r=t.createContext({}),c=function(e){var a=t.useContext(r),n=a;return e&&(n="function"==typeof e?e(a):d(d({},a),e)),n},o=function(e){var a=c(e.components);return t.createElement(r.Provider,{value:a},e.children)},m={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},u=t.forwardRef((function(e,a){var n=e.components,i=e.mdxType,l=e.originalType,r=e.parentName,o=p(e,["components","mdxType","originalType","parentName"]),u=c(n),k=i,A=u["".concat(r,".").concat(k)]||u[k]||m[k]||l;return n?t.createElement(A,d(d({ref:a},o),{},{components:n})):t.createElement(A,d({ref:a},o))}));function k(e,a){var n=arguments,i=a&&a.mdxType;if("string"==typeof e||i){var l=n.length,d=new Array(l);d[0]=u;var p={};for(var r in a)hasOwnProperty.call(a,r)&&(p[r]=a[r]);p.originalType=e,p.mdxType="string"==typeof e?e:i,d[1]=p;for(var c=2;c<l;c++)d[c]=n[c];return t.createElement.apply(null,d)}return t.createElement.apply(null,n)}u.displayName="MDXCreateElement"},6556:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>r,contentTitle:()=>d,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var t=n(7462),i=(n(7294),n(3905));const l={sidebar_position:16,title:"A.16. Tipe Data \u279c Vector",sidebar_label:"A.16. Vector"},d=void 0,p={unversionedId:"basic/vector",id:"basic/vector",title:"A.16. Tipe Data \u279c Vector",description:"Pada chapter ini kita akan belajar tetang tipe data Vector. Vector adalah tipe data seperti array tapi dinamis. Dinamis di sini artinya bisa bertambah dan berkurang kapanpun sesuai kebutuhan.",source:"@site/docs/basic/vector.md",sourceDirName:"basic",slug:"/basic/vector",permalink:"/basic/vector",draft:!1,tags:[],version:"current",sidebarPosition:16,frontMatter:{sidebar_position:16,title:"A.16. Tipe Data \u279c Vector",sidebar_label:"A.16. Vector"},sidebar:"tutorialSidebar",previous:{title:"A.15. Tuple",permalink:"/basic/tuple"},next:{title:"A.17. Function",permalink:"/basic/function"}},r={},c=[{value:"A.16.1. Tipe data <code>Vec<T></code>",id:"a161-tipe-data-vect",level:2},{value:"\u25c9 Deklarasi vektor, size, dan capacity",id:"-deklarasi-vektor-size-dan-capacity",level:3},{value:"\u25c9 Method <code>pop</code> \u279c menghapus elemen terakhir",id:"-method-pop--menghapus-elemen-terakhir",level:3},{value:"\u25c9 Method <code>remove</code> \u279c menghapus elemen index ke <code>I</code>",id:"-method-remove--menghapus-elemen-index-ke-i",level:3},{value:"\u25c9 Method <code>push</code> \u279c menambahkan elemen baru",id:"-method-push--menambahkan-elemen-baru",level:3},{value:"\u25c9 Realokasi vector",id:"-realokasi-vector",level:3},{value:"\u25c9 Mengubah value sebuah elemen menggunakan notasi <code>[i]</code>",id:"-mengubah-value-sebuah-elemen-menggunakan-notasi-i",level:3},{value:"\u25c9 Method <code>is_empty</code> \u279c mengecek apakah vector kosong",id:"-method-is_empty--mengecek-apakah-vector-kosong",level:3},{value:"\u25c9 Method <code>clear</code> \u279c mengosongkan isi vector",id:"-method-clear--mengosongkan-isi-vector",level:3},{value:"\u25c9 Method <code>append</code> \u279c concatenation/penggabungan vector",id:"-method-append--concatenationpenggabungan-vector",level:3},{value:"\u25c9 Method <code>sort</code> \u279c untuk mengurutkan vector",id:"-method-sort--untuk-mengurutkan-vector",level:3},{value:"A.16.2. Macam deklarasi vektor",id:"a162-macam-deklarasi-vektor",level:2},{value:"A.16.3. Iterasi data vector",id:"a163-iterasi-data-vector",level:2},{value:"A.16.4. Ownership tipe data vector",id:"a164-ownership-tipe-data-vector",level:2},{value:"A.16.5. Vector slice",id:"a165-vector-slice",level:2},{value:"A.16.6. Tipe data <code>VecDeque<T></code>",id:"a166-tipe-data-vecdequet",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],o={toc:c};function m(e){let{components:a,...l}=e;return(0,i.kt)("wrapper",(0,t.Z)({},o,l,{components:a,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan belajar tetang tipe data ",(0,i.kt)("em",{parentName:"p"},"Vector"),". Vector adalah tipe data seperti array tapi dinamis. Dinamis di sini artinya bisa bertambah dan berkurang kapanpun sesuai kebutuhan."),(0,i.kt)("p",null,"Vector sangat mirip seperti array, yang karakteristiknya adalah tipe data elemen wajib sama, punya informasi size, elemen-nya bisa diakses atau diubah. Salah satu perbedaan vector dibanding array adalah jumlah elemen pada vector bisa bertambah lebih dari kapasitas yang sudah ditentukan."),(0,i.kt)("p",null,"Vector memiliki 3 buah atribut yg penting untuk diketahui:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"pointer ke data asli"),(0,i.kt)("li",{parentName:"ul"},"lebar atau size"),(0,i.kt)("li",{parentName:"ul"},"kapasitas (representasi dari seberapa banyak memori di-booking untuk data vector tersebut)")),(0,i.kt)("p",null,"Vector bisa bertambah jumlah isinya selama size di bawah kapasitas yang sudah dialokasikan. Jika suatu ketika vector isinya bertambah lebih banyak dari jumlah alokasi maksimal kapasitas, maka vector akan dialokasikan ulang dengan kapasitas yang lebih besar."),(0,i.kt)("h2",{id:"a161-tipe-data-vect"},"A.16.1. Tipe data ",(0,i.kt)("inlineCode",{parentName:"h2"},"Vec<T>")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Vec<T>")," adalah tipe data yang merepresentasikan vector, yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," adalah generics. Vector datanya dialokasikan di heap memory."),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai generic dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/generics"},"Generics")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai heap dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/basic-memory-management"},"Basic Memory Management")))),(0,i.kt)("p",null,"Langsung saja kita praktikkan."),(0,i.kt)("h3",{id:"-deklarasi-vektor-size-dan-capacity"},"\u25c9 Deklarasi vektor, size, dan capacity"),(0,i.kt)("p",null,"Ada beberapa cara yang bisa dipakai untuk membuat data vector. Salah satunya adalah menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"vec"),", penulisannya seperti pembuatan array hanya saja perlu ditambahi prefix ",(0,i.kt)("inlineCode",{parentName:"p"},"vec!"),". Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut data_one = vec!["batman", "superman", "lobo"];\n\nprintln!("data: {:?}", data_one);\nprintln!("length: {}, capacity: {}", data_one.len(), data_one.capacity());\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Vector",src:n(7662).Z,width:"453",height:"110"})),(0,i.kt)("p",null,"Pada contoh di atas variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"data_one")," adalah sebuah vector yang isinya 3 elemen, yaitu literal string ",(0,i.kt)("inlineCode",{parentName:"p"},"batman"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"superman"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"lobo"),". Vector ",(0,i.kt)("inlineCode",{parentName:"p"},"data_one")," dideklarasikan menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"vec")," kemudiaan diikuti notasi penulisan yang mirip seperti array."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai macro dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/macro"},"Macro"))),(0,i.kt)("p",null,"Pembuatan vector menggunakan teknik ini hasilnya adalah data vector yang ",(0,i.kt)("inlineCode",{parentName:"p"},"size")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"capacity")," nya adalah sesuai dengan ",(0,i.kt)("em",{parentName:"p"},"predefined value"),", yang pada konteks ini adalah 3."),(0,i.kt)("p",null,"Umumnya vector dideklarasikan dengan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"mut")," agar bisa diubah nilainya, karena tujuan disediakannya tipe data ini adalah untuk bisa mengakomodir tipe data array tetapi dinamis (bisa manipulasi datanya)."),(0,i.kt)("p",null,"Perihal method ",(0,i.kt)("inlineCode",{parentName:"p"},"len")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"capacity"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Method ",(0,i.kt)("inlineCode",{parentName:"li"},"len")," digunakan untuk mencari tahu size atau jumlah elemen yang ada pada sebuah vector"),(0,i.kt)("li",{parentName:"ul"},"Method ",(0,i.kt)("inlineCode",{parentName:"li"},"capacity")," digunakan untuk mencari tahu kapasitas atau jumlah maksimum elemen yang ada pada sebuah vector")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"O iya, kode program di atas akan menghasilkan warning saat di-run. Hal ini dikarenakan variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"data_one")," yang didefinisikan mutable belum diubah nilainya. Hiraukan saja, karena selanjutnya kita akan manipulasi data variabel tersebut.")),(0,i.kt)("h3",{id:"-method-pop--menghapus-elemen-terakhir"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"pop")," \u279c menghapus elemen terakhir"),(0,i.kt)("p",null,"Oke, selanjutnya mari kita oprek variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"data_one")," yang sudah ditulis."),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<T>")," memiliki method ",(0,i.kt)("inlineCode",{parentName:"p"},"pop")," yang fungsinya menghapus data elemen terakhir. Mari gunakan method ini pada ",(0,i.kt)("inlineCode",{parentName:"p"},"data_one"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'data_one.pop();\n\nprintln!("data: {:?}", data_one);\nprintln!("length: {}, capacity: {}", data_one.len(), data_one.capacity());\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Vector",src:n(7554).Z,width:"450",height:"116"})),(0,i.kt)("p",null,"Bisa dilihat pada contoh di atas, setelah menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"pop"),", isi ",(0,i.kt)("inlineCode",{parentName:"p"},"data_one")," menjadi 2 elemen saja. Elemen terakhir (yaitu string ",(0,i.kt)("inlineCode",{parentName:"p"},"lobo"),") dihapus. Efeknya, atribut size menjadi 2, tapi kapasitas tetap 3."),(0,i.kt)("h3",{id:"-method-remove--menghapus-elemen-index-ke-i"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"remove")," \u279c menghapus elemen index ke ",(0,i.kt)("inlineCode",{parentName:"h3"},"I")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"remove")," adalah salah satu method lainnya yang ada pada tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<T>"),". Kegunaan dari method ",(0,i.kt)("inlineCode",{parentName:"p"},"remove")," adalah untuk menghapus elemen pada indeks tertentu."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'data_one.remove(1);\n\nprintln!("data: {:?}", data_one);\nprintln!("length: {}, capacity: {}", data_one.len(), data_one.capacity());\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Vector",src:n(41).Z,width:"450",height:"134"})),(0,i.kt)("p",null,"Dicontohkan di atas elemen indeks ke-",(0,i.kt)("inlineCode",{parentName:"p"},"1")," dihapus dengan cara memanggil method ",(0,i.kt)("inlineCode",{parentName:"p"},"remove")," lalu menyisipkan indeks elemen sebagai parameter pemanggilan method. Hasilnya elemen ",(0,i.kt)("inlineCode",{parentName:"p"},"superman")," dihapus dari vector."),(0,i.kt)("h3",{id:"-method-push--menambahkan-elemen-baru"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"push")," \u279c menambahkan elemen baru"),(0,i.kt)("p",null,"Sekarang isi dari vector ",(0,i.kt)("inlineCode",{parentName:"p"},"data_one")," tinggal 1 elemen, mari kita tambahkan 3 elemen baru dengan memanfaatkan method ",(0,i.kt)("inlineCode",{parentName:"p"},"push"),"."),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"push")," fungsinya adalah untuk menambahkan elemen baru pada vector."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'data_one.push("constantine");\ndata_one.push("trigon");\ndata_one.push("darkseid");\n\nprintln!("data: {:?}", data_one);\nprintln!("length: {}, capacity: {}", data_one.len(), data_one.capacity());\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Vector",src:n(4480).Z,width:"452",height:"135"})),(0,i.kt)("p",null,"Bisa dilihat sekarang ",(0,i.kt)("inlineCode",{parentName:"p"},"data_one")," isinya adalah 4 elemen dan atribut size-nya cocok, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"4"),". Namun ada yang aneh, kenapa kapasitas jadi ",(0,i.kt)("inlineCode",{parentName:"p"},"6")," padahal di awal kapasitas adalah 3."),(0,i.kt)("h3",{id:"-realokasi-vector"},"\u25c9 Realokasi vector"),(0,i.kt)("p",null,"Perubahan kapasitas atau realokasi vector terjadi ketika sebuah vector isinya bertambah lebih banyak dari jumlah alokasi maksimal kapasitas."),(0,i.kt)("p",null,"Lalu apa efeknya? secara high level bisa dibilang tidak ada, namun kalau dibahas lebih rinci, efeknya adalah di sisi alokasi space untuk menampung elemen. Proses realokasi menghasilkan vector yang baru dengan kapasitas lebih besar."),(0,i.kt)("h3",{id:"-mengubah-value-sebuah-elemen-menggunakan-notasi-i"},"\u25c9 Mengubah value sebuah elemen menggunakan notasi ",(0,i.kt)("inlineCode",{parentName:"h3"},"[i]")),(0,i.kt)("p",null,"Sama seperti array, vector juga bisa dimodifikasi nilai elemennya dengan menggunakan notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"[i]"),"."),(0,i.kt)("p",null,"Pada contoh berikut elemen indeks ke-",(0,i.kt)("inlineCode",{parentName:"p"},"2")," diubah nilainya dari ",(0,i.kt)("inlineCode",{parentName:"p"},"trigon")," ke ",(0,i.kt)("inlineCode",{parentName:"p"},"red hood"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'data_one[2] = "red hood";\n\nprintln!("data: {:?}", data_one);\nprintln!("length: {}, capacity: {}", data_one.len(), data_one.capacity());\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Vector",src:n(5216).Z,width:"449",height:"131"})),(0,i.kt)("h3",{id:"-method-is_empty--mengecek-apakah-vector-kosong"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"is_empty")," \u279c mengecek apakah vector kosong"),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"is_empty")," digunakan untuk mengidentifikasi apakah sebuah vector isinya kosong atau tidak."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let is_vector_empty = data_one.is_empty();\nprintln!("result: {:?}", is_vector_empty);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Vector",src:n(8859).Z,width:"447",height:"109"})),(0,i.kt)("h3",{id:"-method-clear--mengosongkan-isi-vector"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"clear")," \u279c mengosongkan isi vector"),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"clear")," digunakan untuk mengosongkan sebuah vektor."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'data_one.clear();\nprintln!("data: {:?}", data_one);\nprintln!("length: {}, capacity: {}", data_one.len(), data_one.capacity());\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Vector",src:n(802).Z,width:"445",height:"94"})),(0,i.kt)("h3",{id:"-method-append--concatenationpenggabungan-vector"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"append")," \u279c concatenation/penggabungan vector"),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"append")," digunakan untuk menggabungkan dua buah vector. Penggunaannya cukup mudah, panggil saja method nya lalu sisipkan ",(0,i.kt)("em",{parentName:"p"},"mutable reference")," dari vector satunya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut result_one = vec![3, 1, 2];\n\nlet mut data_two = vec![7, 6, 8];\nresult_one.append(&mut data_two);\n\nprintln!("data: {:?}", result_one);\nprintln!("length: {}, capacity: {}", result_one.len(), result_one.capacity());\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Vector",src:n(2366).Z,width:"450",height:"125"})),(0,i.kt)("p",null,"Pada contoh di atas ",(0,i.kt)("inlineCode",{parentName:"p"},"result_one")," adalah vector mutable dengan isi 3 elemen. Kemudian dideklarasikan ",(0,i.kt)("inlineCode",{parentName:"p"},"data_two")," yang isinya juga vector 3 elemen. Vector ",(0,i.kt)("inlineCode",{parentName:"p"},"data_two")," dimasukkan kedalam vector ",(0,i.kt)("inlineCode",{parentName:"p"},"result_one")," dengan menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"append"),", dengan ini maka isi ",(0,i.kt)("inlineCode",{parentName:"p"},"result_one")," adalah gabungan dari ",(0,i.kt)("inlineCode",{parentName:"p"},"result_one")," yang lama dan ",(0,i.kt)("inlineCode",{parentName:"p"},"data_two"),"."),(0,i.kt)("p",null,"Proses append vector mengharuskan parameter method ",(0,i.kt)("inlineCode",{parentName:"p"},"append")," diisi dengan ",(0,i.kt)("em",{parentName:"p"},"mutable reference")," dari vector yang ingin dimasukkan. Cara untuk mengambil ",(0,i.kt)("em",{parentName:"p"},"mutable reference")," adalah dengan menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut"),"."),(0,i.kt)("p",null,"Ok, selanjutnya tambahkan lagi isi ",(0,i.kt)("inlineCode",{parentName:"p"},"result_one")," dengan vector lain."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'result_one.append(&mut vec![4, 5]);\n\nprintln!("data: {:?}", result_one);\nprintln!("length: {}, capacity: {}", result_one.len(), result_one.capacity());\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Vector",src:n(6241).Z,width:"447",height:"127"})),(0,i.kt)("p",null,"Proses penggabungan vector pada contoh ke-dua di atas sedikit berbeda. Method ",(0,i.kt)("inlineCode",{parentName:"p"},"append")," parameternya adalah langsung ",(0,i.kt)("em",{parentName:"p"},"mutable reference")," dari literal vector. Ini merupakan salah satu cara yang bisa digunakan dalam penggabungan vector."),(0,i.kt)("h3",{id:"-method-sort--untuk-mengurutkan-vector"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"sort")," \u279c untuk mengurutkan vector"),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"sort")," digunakan untuk mengurutkan elemen vector."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'println!("data: {:?}", result_one);\nresult_one.sort();\nprintln!("data: {:?}", result_one);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Vector",src:n(3380).Z,width:"447",height:"127"})),(0,i.kt)("h2",{id:"a162-macam-deklarasi-vektor"},"A.16.2. Macam deklarasi vektor"),(0,i.kt)("p",null,"Ada beberapa cara deklarasi vector. Pada contoh berikut dua buah vector dideklarasikan menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"vec!"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let mut vector_4 = vec![1, 2, 3];\nlet mut vector_5: Vec<i64> = vec![1, 2, 3];\n")),(0,i.kt)("p",null,"Vector ",(0,i.kt)("inlineCode",{parentName:"p"},"vector_4")," didefinisikan dengan cara yang sudah kita terapkan sebelumnya, yaitu menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"vec"),". Vector ",(0,i.kt)("inlineCode",{parentName:"p"},"vector_5")," juga didefinisikan dengan cara yang sama, hanya saja pada vector ini tipe datanya ditentukan secara eksplisit yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<i64>"),"."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Vec<i64>")," Artinya adalah vector dengan tipe data elemen adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"i64"),". Dengan notasi penulisan ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<T>")," bisa ditentukan tipe data elemen yang diinginkan."),(0,i.kt)("p",null,"Cara deklarasi vector selanjutnya adalah pembuatan vector dengan isi kosong. Deklarasi vector ini mewajibkan tipe data vector dituliskan secara eksplisit, dikarenakan tipe data tidak bisa diidentifikasi dari isinya (karena isinya kosong). Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let mut vector_7: Vec<&str> = vec![];\nlet mut vector_8: Vec<&str> = Vec::new();\n")),(0,i.kt)("p",null,"Vector ",(0,i.kt)("inlineCode",{parentName:"p"},"vector_7")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"vector_8")," keduanya bertipe vector dengan isi atau elemen bertipe data literal string ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),"."),(0,i.kt)("p",null,"Deklarasi vector kosong bisa dilakukan dengan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"vec")," yang ditulis tanpa isi, atau bisa menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec::new()"),"."),(0,i.kt)("h2",{id:"a163-iterasi-data-vector"},"A.16.3. Iterasi data vector"),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," bisa digunakan untuk iterasi vector. Cara penerapannya seperti pada array atau slice."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let vec_eight = vec![1, 2, 3];\nfor e in vec_eight {\n print!("{e} ");\n}\n\n// 1 2 3\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let vec_nine = vec![1, 2, 3];\nfor i in 0..vec_nine.len() {\n print!("{} ", vec_nine[i]);\n}\n\n// 1 2 3\n')),(0,i.kt)("p",null,"Keyword perulangan lainnya juga bisa digunakan."),(0,i.kt)("h2",{id:"a164-ownership-tipe-data-vector"},"A.16.4. Ownership tipe data vector"),(0,i.kt)("p",null,"Salah satu atribut vector yang penting untuk diketahui adalah, pemilik data sebenarnya (atau owner). Agar lebih jelas, silakan coba terlebih dahulu kode berikut."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let vec_ten = vec![1, 2, 3];\nfor e in vec_ten {\n print!("{e} ");\n}\nfor i in 0..vec_ten.len() {\n print!("{} ", vec_ten[i]);\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Vector",src:n(2061).Z,width:"634",height:"626"})),(0,i.kt)("p",null,"Terlihat sekilas tidak ada kode yang bermasalah dari program di atas, tapi error, aneh."),(0,i.kt)("p",null,"Di Rust, ownership atau kepemilikan data adalah hal yang sangat penting. Saking pentingnya, beberapa orang menyebut Rust sebagai bahasa yang ",(0,i.kt)("em",{parentName:"p"},"value oriented"),"."),(0,i.kt)("p",null,"Dalam kasus kode program vector di atas, ketika keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," digunakan untuk mengiterasi vector ",(0,i.kt)("inlineCode",{parentName:"p"},"vec_ten"),", membuat pemilik data vektor berpindah ke variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"e"),". Hal ini efeknya adalah ketika kita berusaha mengakses variabel yang sama setelah perulangan selesai, maka yang muncul adalah error, karena value-nya sudah berpindah."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Perpindahan owner disebut dengan ",(0,i.kt)("em",{parentName:"p"},"move semantics"),". Lebih jelasnya nanti dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/ownership"},"Ownership"))),(0,i.kt)("p",null,"Solusi untuk antisipasi error ini adalah dengan cara meminjam value yang sebenarnya dari owner, untuk kemudian digunakan dalam perulangan. Caranya dengan menggunakan teknik ",(0,i.kt)("em",{parentName:"p"},"borrowing")," menggunakan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"reference")," yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"&"),". Data sebenarnya milik owner dipinjam untuk dipergunakan di perulangan."),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai reference dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/pointer-references"},"Pointer & References")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai borrowing dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/borrowing"},"Borrowing")))),(0,i.kt)("p",null,"Silakan ubah kode yang sebelumnya ..."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'for e in vec_ten {\n print!("{e} ");\n}\n')),(0,i.kt)("p",null,"... menjadi seperti ini, kemudian run, maka error akan hilang."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'for e in &vec_ten {\n print!("{e} ");\n}\n')),(0,i.kt)("p",null,"Salah satu alternatif cara lainnya untuk antisipasi value berpindah tempat adalah dengan menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"iter")," untuk mengkonversi vector menjadi iterator. Jadi yang di-iterasi bukan vector-nya, melainkan objek iterator yang dibuat dari vector tersebut."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'for e in vec_ten.iter() {\n print!("{e} ");\n}\n')),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai ",(0,i.kt)("em",{parentName:"li"},"ownership")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/ownership"},"Ownership")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai ",(0,i.kt)("em",{parentName:"li"},"borrowing")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/borrowing"},"Borrowing")))),(0,i.kt)("h2",{id:"a165-vector-slice"},"A.16.5. Vector slice"),(0,i.kt)("p",null,"Seperti array, slice juga bisa dibuat dari vector. Cara penerapannya juga sama persis. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let vec_population = vec![2, 1, 3];\nlet vec_sample = &vec_population[0..1];\nprintln!("{:?}", vec_sample); // [2]\n')),(0,i.kt)("p",null,"Semua operasi slice bisa diterapkan di vector."),(0,i.kt)("h2",{id:"a166-tipe-data-vecdequet"},"A.16.6. Tipe data ",(0,i.kt)("inlineCode",{parentName:"h2"},"VecDeque<T>")),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"VecDeque<T>")," adalah sama seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<T>")," plus mendukung operasi menambah dan mengurangi elemen dari dua sisi secara efisien."),(0,i.kt)("p",null,"Pada tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<T>"),", ada method ",(0,i.kt)("inlineCode",{parentName:"p"},"pop")," yang fungsinya menghapus data elemen terakhir dan method ",(0,i.kt)("inlineCode",{parentName:"p"},"push")," untuk menambah elemen baru dari kanan. Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"VecDeque")," memiliki bebebrapa method tambahan, yaitu:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"method ",(0,i.kt)("inlineCode",{parentName:"li"},"pop_front")," untuk hapus data elemen pertama atau paling kiri (indeks ke-0)"),(0,i.kt)("li",{parentName:"ul"},"method ",(0,i.kt)("inlineCode",{parentName:"li"},"push_front")," untuk menambah data dari kiri (indeks ke-0)"),(0,i.kt)("li",{parentName:"ul"},"method ",(0,i.kt)("inlineCode",{parentName:"li"},"pop_back")," untuk hapus data elemen pertama atau paling kanan (indeks terakhir)"),(0,i.kt)("li",{parentName:"ul"},"method ",(0,i.kt)("inlineCode",{parentName:"li"},"push_back")," untuk menambah data dari kanan (indeks terakhir)")),(0,i.kt)("p",null,"Contoh penerapan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'use std::collections::VecDeque;\n\nlet mut vec_10 = VecDeque::from(vec!["a", "b", "c"]);\n\nvec_10.pop_front();\nvec_10.push_front("z");\nprintln!("data: {:?}", vec_10);\n\nvec_10.pop_back();\nvec_10.push_back("h");\nprintln!("data: {:?}", vec_10);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Vector",src:n(4050).Z,width:"453",height:"129"})),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"VecDeque<T>")," tidak otomatis di-import. Kita perlu mengimport path di mana tipe data tersebut berada menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"use"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"use std::collections::VecDeque;\n")),(0,i.kt)("p",null,"Cara membuat vector ",(0,i.kt)("inlineCode",{parentName:"p"},"VecDeque<T>")," bisa menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"VecDeque::from")," dengan parameter diisi data vectornya, seperti pada kode program yang sudah ditulis."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/vector"},"github.com/novalagung/dasarpemrogramanrust-example/../vector")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/macro.vec.html"},"https://doc.rust-lang.org/std/macro.vec.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/vec/struct.Vec.html"},"https://doc.rust-lang.org/std/vec/struct.Vec.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/std/vec.html"},"https://doc.rust-lang.org/rust-by-example/std/vec.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/collections/struct.VecDeque.html"},"https://doc.rust-lang.org/std/collections/struct.VecDeque.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/36672845/in-rust-is-a-vector-an-iterator"},"https://stackoverflow.com/questions/36672845/in-rust-is-a-vector-an-iterator")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/28800121/what-do-i-have-to-do-to-solve-a-use-of-moved-value-error"},"https://stackoverflow.com/questions/28800121/what-do-i-have-to-do-to-solve-a-use-of-moved-value-error")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/43036279/what-does-it-mean-to-pass-in-a-vector-into-a-for-loop-versus-a-reference-to-a"},"https://stackoverflow.com/questions/43036279/what-does-it-mean-to-pass-in-a-vector-into-a-for-loop-versus-a-reference-to-a"))))}m.isMDXComponent=!0},7662:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcUAAABuCAIAAADZD59KAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6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oKnsooR+OpmrJ5fHqO0XzlRExRdu/NlLQZ3fGpUjInTw9Sdys+nW4bsO4oJXlKHWH+dOmM0UxVNjW3dFcxqaambLMelZXCXU6dKWL3SqYk83ubwBJ4Gk0WyiIl5JVlq+LpxesuA+84Thc3mOS8i5TkKXV5nkZjzt8/p/XddBg9rg2nI654cK2nbLEela/oesupjHnR7rUxWn4bqZs+lfMkYfO0Gr+sycjVbLDdP94/UN2XPKJVe/n0yF+x2lkxxUSeUn14emld4xOZd9qUR/th8Qur++23IUWekqdRkNS89IdkQae6k6cUebpqvuG6w1Sy4PD9i21I3T5PKYqiyFOKoijylKIoiiJPKYqiDspTt7PvRr2oRZVxDYTLaxT1MuPT3Wm3xuuyjKhrWagFPN39sbCrahCKIk+PxNM0p+uL/Ro+ZnudDUJRL4en0qtYMxuO46QhKlOcpzVj4Dv/m6lb0QQ8iP2eyopttshTzp+oFteqqUevBqEoqgNPkVcxNhvO/FQ09zXTq7gSH+vogV6NLHkql4yr9dctZTQOrbkUc6UuDUJRVBeeAq9ixSwj5oDt5L/dC27Lyll5SGyY433RU2p5Ongap1n/YSbOn1LUsXmKvIqtT3Es8ekChQY8rYAjjE7BAUueynGAKlJavpsenibfj9tERE6gUtSheSqvb5wknj1FjqMteLpid7hH2VPZNK62SuHi6ZxqK075hj9FHXi8D72KERD161iETAZPVyy/CKfTUniGqlT0VA4YxcbVxqfgZMPgGHKg7J8/wLJ0Q4NQFHUhnmrOvtLHtxyfqm7HBa9iDz6S8khSeT9xqa3Fp57KfuNqkafWnnfw887KktbGBqEo6qLx6T7jzAvN4+3qatx56My1eYoiT9WRd99QaX9X46485UCdosjTHGg3NO7sxNNzuzE2pSjylKIoijylKIqiyFOKoijylKIoijylKIoiTymKoijylKIoijylKIoiTymKoijylKIoijylKIo6rv4HCffy3PPDcloAAAAASUVORK5CYII="},3380:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAAB/CAIAAAD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EiULCAx7GXAWkqq/q29rM8Oe4IDsuTd15OuWN75fUGDYVeKZGKpJl9rSZoY9weHYc7fqyNuzZxt5Ligw7Cvx2/s8Cw+N31TStJlhT3Aw9typOvI87Nk6cZ+kzbykwLAv8kRx5YkrNKo2M+wJboQ9d6COvK28cWMRlhUYrvQYW/mq2fKmNjPsCW6CPXehjrypvHHjiF9YYLjSlo18NeVbnIY2M+wJDsaeO1ZH3lDeWCaAbQWGVxBXNl5aE7WZYU9wRPbcuzry6vLGE7WZjYpNFBheRVx5orSzqs0Me4JDsufWQB35FqLDngD23I490SdGHRkA2FOe7XHP/ZjgnjuAPQEAAPYEAAAAewIAAOwJAACwJwAAwJ4AAAB7AgAAgD0BAGAJ/A9wxxZFJeVMpwAAAABJRU5ErkJggg=="},2061:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/vector-11-27b0884891ab00c87d90603997e1878c.png"},4050:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcUAAACBCAIAAAA+HTYdAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6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zliQNpZsKfQkhpCWs6dhz2nQA0fM4Ls2SjtTBBEC3vKsYeDaIpoM7Nnm+6vkiGUdga+pytkBXsOoVq+BCfZs1namSCI+pk79F0Q/ekEIka1wZ6OZb5m3V9UJSjtnEjpW3LRhosnDYOn2GdO/SM+pVa/7knqJIjV2FPM0uV3hoNvEtu+Z0xiya59G3ueZtD9leK9SNoZfp9ZFYEWaWr2PClHMeH6pMcgQATalHYmCGIZ37Nh3ph8xWyD8TrrDsnKd6KWOURPEMTe2RN8dmjdzYp5hHs3Y0+eKiKIW2XPdK54BUywEns2fHSdIIirYE+CIAiyJ0EQBEH2JAiCIHsSBEGQPQmCIMieBEEQZE+CIAiC7EkQBEH2JAiC2Aj/A0eMR7gw7IWCAAAAAElFTkSuQmCC"}}]); \ No newline at end of file diff --git a/assets/js/c76cc2e3.978efe66.js b/assets/js/c76cc2e3.978efe66.js deleted file mode 100644 index 764a965f..00000000 --- a/assets/js/c76cc2e3.978efe66.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4729],{3905:(e,a,n)=>{n.d(a,{Zo:()=>o,kt:()=>k});var t=n(7294);function i(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function d(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?l(Object(n),!0).forEach((function(a){i(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function p(e,a){if(null==e)return{};var n,t,i=function(e,a){if(null==e)return{};var n,t,i={},l=Object.keys(e);for(t=0;t<l.length;t++)n=l[t],a.indexOf(n)>=0||(i[n]=e[n]);return i}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t<l.length;t++)n=l[t],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var r=t.createContext({}),c=function(e){var a=t.useContext(r),n=a;return e&&(n="function"==typeof e?e(a):d(d({},a),e)),n},o=function(e){var a=c(e.components);return t.createElement(r.Provider,{value:a},e.children)},m={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},u=t.forwardRef((function(e,a){var n=e.components,i=e.mdxType,l=e.originalType,r=e.parentName,o=p(e,["components","mdxType","originalType","parentName"]),u=c(n),k=i,A=u["".concat(r,".").concat(k)]||u[k]||m[k]||l;return n?t.createElement(A,d(d({ref:a},o),{},{components:n})):t.createElement(A,d({ref:a},o))}));function k(e,a){var n=arguments,i=a&&a.mdxType;if("string"==typeof e||i){var l=n.length,d=new Array(l);d[0]=u;var p={};for(var r in a)hasOwnProperty.call(a,r)&&(p[r]=a[r]);p.originalType=e,p.mdxType="string"==typeof e?e:i,d[1]=p;for(var c=2;c<l;c++)d[c]=n[c];return t.createElement.apply(null,d)}return t.createElement.apply(null,n)}u.displayName="MDXCreateElement"},6556:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>r,contentTitle:()=>d,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var t=n(7462),i=(n(7294),n(3905));const l={sidebar_position:16,title:"A.16. Tipe Data \u279c Vector",sidebar_label:"A.16. Vector"},d=void 0,p={unversionedId:"basic/vector",id:"basic/vector",title:"A.16. Tipe Data \u279c Vector",description:"Pada chapter ini kita akan belajar tetang tipe data Vector. Vector adalah tipe data seperti array tapi dinamis. Dinamis di sini artinya bisa bertambah dan berkurang kapanpun sesuai kebutuhan.",source:"@site/docs/basic/vector.md",sourceDirName:"basic",slug:"/basic/vector",permalink:"/basic/vector",draft:!1,tags:[],version:"current",sidebarPosition:16,frontMatter:{sidebar_position:16,title:"A.16. Tipe Data \u279c Vector",sidebar_label:"A.16. Vector"},sidebar:"tutorialSidebar",previous:{title:"A.15. Tuple",permalink:"/basic/tuple"},next:{title:"A.17. Function",permalink:"/basic/function"}},r={},c=[{value:"A.16.1. Tipe data <code>Vec<T></code>",id:"a161-tipe-data-vect",level:2},{value:"\u25c9 Deklarasi vektor, size, dan capacity",id:"-deklarasi-vektor-size-dan-capacity",level:3},{value:"\u25c9 Method <code>pop</code> \u279c menghapus elemen terakhir",id:"-method-pop--menghapus-elemen-terakhir",level:3},{value:"\u25c9 Method <code>remove</code> \u279c menghapus elemen index ke <code>I</code>",id:"-method-remove--menghapus-elemen-index-ke-i",level:3},{value:"\u25c9 Method <code>push</code> \u279c menambahkan elemen baru",id:"-method-push--menambahkan-elemen-baru",level:3},{value:"\u25c9 Realokasi vector",id:"-realokasi-vector",level:3},{value:"\u25c9 Mengubah value sebuah elemen menggunakan notasi <code>[i]</code>",id:"-mengubah-value-sebuah-elemen-menggunakan-notasi-i",level:3},{value:"\u25c9 Method <code>is_empty</code> \u279c mengecek apakah vector kosong",id:"-method-is_empty--mengecek-apakah-vector-kosong",level:3},{value:"\u25c9 Method <code>clear</code> \u279c mengosongkan isi vector",id:"-method-clear--mengosongkan-isi-vector",level:3},{value:"\u25c9 Method <code>append</code> \u279c concatenation/penggabungan vector",id:"-method-append--concatenationpenggabungan-vector",level:3},{value:"\u25c9 Method <code>sort</code> \u279c untuk mengurutkan vector",id:"-method-sort--untuk-mengurutkan-vector",level:3},{value:"A.16.2. Macam deklarasi vektor",id:"a162-macam-deklarasi-vektor",level:2},{value:"A.16.3. Iterasi data vector",id:"a163-iterasi-data-vector",level:2},{value:"A.16.4. Ownership tipe data vector",id:"a164-ownership-tipe-data-vector",level:2},{value:"A.16.5. Vector slice",id:"a165-vector-slice",level:2},{value:"A.16.6. Tipe data <code>VecDeque<T></code>",id:"a166-tipe-data-vecdequet",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],o={toc:c};function m(e){let{components:a,...l}=e;return(0,i.kt)("wrapper",(0,t.Z)({},o,l,{components:a,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan belajar tetang tipe data ",(0,i.kt)("em",{parentName:"p"},"Vector"),". Vector adalah tipe data seperti array tapi dinamis. Dinamis di sini artinya bisa bertambah dan berkurang kapanpun sesuai kebutuhan."),(0,i.kt)("p",null,"Vector sangat mirip seperti array, yang karakteristiknya adalah tipe data elemen wajib sama, punya informasi size, elemen-nya bisa diakses atau diubah. Salah satu perbedaan vector dibanding array adalah jumlah elemen pada vector bisa bertambah lebih dari kapasitas yang sudah ditentukan."),(0,i.kt)("p",null,"Vector memiliki 3 buah atribut yg penting untuk diketahui:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"pointer ke data asli"),(0,i.kt)("li",{parentName:"ul"},"lebar atau size"),(0,i.kt)("li",{parentName:"ul"},"kapasitas (representasi dari seberapa banyak memori di-booking untuk data vector tersebut)")),(0,i.kt)("p",null,"Vector bisa bertambah jumlah isinya selama size di bawah kapasitas yang sudah dialokasikan. Jika suatu ketika vector isinya bertambah lebih banyak dari jumlah alokasi maksimal kapasitas, maka vector akan dialokasikan ulang dengan kapasitas yang lebih besar."),(0,i.kt)("h2",{id:"a161-tipe-data-vect"},"A.16.1. Tipe data ",(0,i.kt)("inlineCode",{parentName:"h2"},"Vec<T>")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Vec<T>")," adalah tipe data yang merepresentasikan vector, yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," adalah generics. Vector datanya dialokasikan di heap memory."),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai generic dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/generics"},"Generics")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai heap dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/basic-memory-management"},"Basic Memory Management")))),(0,i.kt)("p",null,"Langsung saja kita praktikkan."),(0,i.kt)("h3",{id:"-deklarasi-vektor-size-dan-capacity"},"\u25c9 Deklarasi vektor, size, dan capacity"),(0,i.kt)("p",null,"Ada beberapa cara yang bisa dipakai untuk membuat data vector. Salah satunya adalah menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"vec"),", penulisannya seperti pembuatan array hanya saja perlu ditambahi prefix ",(0,i.kt)("inlineCode",{parentName:"p"},"vec!"),". Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut data_one = vec!["batman", "superman", "lobo"];\n\nprintln!("data: {:?}", data_one);\nprintln!("length: {}, capacity: {}", data_one.len(), data_one.capacity());\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Vector",src:n(7662).Z,width:"453",height:"110"})),(0,i.kt)("p",null,"Pada contoh di atas variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"data_one")," adalah sebuah vector yang isinya 3 elemen, yaitu literal string ",(0,i.kt)("inlineCode",{parentName:"p"},"batman"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"superman"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"lobo"),". Vector ",(0,i.kt)("inlineCode",{parentName:"p"},"data_one")," dideklarasikan menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"vec")," kemudiaan diikuti notasi penulisan yang mirip seperti array."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai macro dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/macro"},"Macro"))),(0,i.kt)("p",null,"Pembuatan vector menggunakan teknik ini hasilnya adalah data vector yang ",(0,i.kt)("inlineCode",{parentName:"p"},"size")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"capacity")," nya adalah sesuai dengan ",(0,i.kt)("em",{parentName:"p"},"predefined value"),", yang pada konteks ini adalah 3."),(0,i.kt)("p",null,"Umumnya vector dideklarasikan dengan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"mut")," agar bisa diubah nilainya, karena tujuan disediakannya tipe data ini adalah untuk bisa mengakomodir tipe data array tetapi dinamis (bisa manipulasi datanya)."),(0,i.kt)("p",null,"Perihal method ",(0,i.kt)("inlineCode",{parentName:"p"},"len")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"capacity"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Method ",(0,i.kt)("inlineCode",{parentName:"li"},"len")," digunakan untuk mencari tahu size atau jumlah elemen yang ada pada sebuah vector"),(0,i.kt)("li",{parentName:"ul"},"Method ",(0,i.kt)("inlineCode",{parentName:"li"},"capacity")," digunakan untuk mencari tahu kapasitas atau jumlah maksimum elemen yang ada pada sebuah vector")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"O iya, kode program di atas akan menghasilkan warning saat di-run. Hal ini dikarenakan variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"data_one")," yang didefinisikan mutable belum diubah nilainya. Hiraukan saja, karena selanjutnya kita akan manipulasi data variabel tersebut.")),(0,i.kt)("h3",{id:"-method-pop--menghapus-elemen-terakhir"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"pop")," \u279c menghapus elemen terakhir"),(0,i.kt)("p",null,"Oke, selanjutnya mari kita oprek variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"data_one")," yang sudah ditulis."),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<T>")," memiliki method ",(0,i.kt)("inlineCode",{parentName:"p"},"pop")," yang fungsinya menghapus data elemen terakhir. Mari gunakan method ini pada ",(0,i.kt)("inlineCode",{parentName:"p"},"data_one"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'data_one.pop();\n\nprintln!("data: {:?}", data_one);\nprintln!("length: {}, capacity: {}", data_one.len(), data_one.capacity());\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Vector",src:n(7554).Z,width:"450",height:"116"})),(0,i.kt)("p",null,"Bisa dilihat pada contoh di atas, setelah menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"pop"),", isi ",(0,i.kt)("inlineCode",{parentName:"p"},"data_one")," menjadi 2 elemen saja. Elemen terakhir (yaitu string ",(0,i.kt)("inlineCode",{parentName:"p"},"lobo"),") dihapus. Efeknya, atribut size menjadi 2, tapi kapasitas tetap 3."),(0,i.kt)("h3",{id:"-method-remove--menghapus-elemen-index-ke-i"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"remove")," \u279c menghapus elemen index ke ",(0,i.kt)("inlineCode",{parentName:"h3"},"I")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"remove")," adalah salah satu method lainnya yang ada pada tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<T>"),". Kegunaan dari method ",(0,i.kt)("inlineCode",{parentName:"p"},"remove")," adalah untuk menghapus elemen pada indeks tertentu."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'data_one.remove(1);\n\nprintln!("data: {:?}", data_one);\nprintln!("length: {}, capacity: {}", data_one.len(), data_one.capacity());\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Vector",src:n(41).Z,width:"450",height:"134"})),(0,i.kt)("p",null,"Dicontohkan di atas elemen indeks ke-",(0,i.kt)("inlineCode",{parentName:"p"},"1")," dihapus dengan cara memanggil method ",(0,i.kt)("inlineCode",{parentName:"p"},"remove")," lalu menyisipkan indeks elemen sebagai parameter pemanggilan method. Hasilnya elemen ",(0,i.kt)("inlineCode",{parentName:"p"},"superman")," dihapus dari vector."),(0,i.kt)("h3",{id:"-method-push--menambahkan-elemen-baru"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"push")," \u279c menambahkan elemen baru"),(0,i.kt)("p",null,"Sekarang isi dari vector ",(0,i.kt)("inlineCode",{parentName:"p"},"data_one")," tinggal 1 elemen, mari kita tambahkan 3 elemen baru dengan memanfaatkan method ",(0,i.kt)("inlineCode",{parentName:"p"},"push"),"."),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"push")," fungsinya adalah untuk menambahkan elemen baru pada vector."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'data_one.push("constantine");\ndata_one.push("trigon");\ndata_one.push("darkseid");\n\nprintln!("data: {:?}", data_one);\nprintln!("length: {}, capacity: {}", data_one.len(), data_one.capacity());\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Vector",src:n(4480).Z,width:"452",height:"135"})),(0,i.kt)("p",null,"Bisa dilihat sekarang ",(0,i.kt)("inlineCode",{parentName:"p"},"data_one")," isinya adalah 4 elemen dan atribut size-nya cocok, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"4"),". Namun ada yang aneh, kenapa kapasitas jadi ",(0,i.kt)("inlineCode",{parentName:"p"},"6")," padahal di awal kapasitas adalah 3."),(0,i.kt)("h3",{id:"-realokasi-vector"},"\u25c9 Realokasi vector"),(0,i.kt)("p",null,"Perubahan kapasitas atau realokasi vector terjadi ketika sebuah vector isinya bertambah lebih banyak dari jumlah alokasi maksimal kapasitas."),(0,i.kt)("p",null,"Lalu apa efeknya? secara high level bisa dibilang tidak ada, namun kalau dibahas lebih rinci, efeknya adalah di sisi alokasi space untuk menampung elemen. Proses realokasi menghasilkan vector yang baru dengan kapasitas lebih besar."),(0,i.kt)("h3",{id:"-mengubah-value-sebuah-elemen-menggunakan-notasi-i"},"\u25c9 Mengubah value sebuah elemen menggunakan notasi ",(0,i.kt)("inlineCode",{parentName:"h3"},"[i]")),(0,i.kt)("p",null,"Sama seperti array, vector juga bisa dimodifikasi nilai elemennya dengan menggunakan notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"[i]"),"."),(0,i.kt)("p",null,"Pada contoh berikut elemen indeks ke-",(0,i.kt)("inlineCode",{parentName:"p"},"2")," diubah nilainya dari ",(0,i.kt)("inlineCode",{parentName:"p"},"trigon")," ke ",(0,i.kt)("inlineCode",{parentName:"p"},"red hood"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'data_one[2] = "red hood";\n\nprintln!("data: {:?}", data_one);\nprintln!("length: {}, capacity: {}", data_one.len(), data_one.capacity());\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Vector",src:n(5216).Z,width:"449",height:"131"})),(0,i.kt)("h3",{id:"-method-is_empty--mengecek-apakah-vector-kosong"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"is_empty")," \u279c mengecek apakah vector kosong"),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"is_empty")," digunakan untuk mengidentifikasi apakah sebuah vector isinya kosong atau tidak."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let is_vector_empty = data_one.is_empty();\nprintln!("result: {:?}", is_vector_empty);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Vector",src:n(8859).Z,width:"447",height:"109"})),(0,i.kt)("h3",{id:"-method-clear--mengosongkan-isi-vector"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"clear")," \u279c mengosongkan isi vector"),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"clear")," digunakan untuk mengosongkan sebuah vektor."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'data_one.clear();\nprintln!("data: {:?}", data_one);\nprintln!("length: {}, capacity: {}", data_one.len(), data_one.capacity());\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Vector",src:n(802).Z,width:"445",height:"94"})),(0,i.kt)("h3",{id:"-method-append--concatenationpenggabungan-vector"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"append")," \u279c concatenation/penggabungan vector"),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"append")," digunakan untuk menggabungkan dua buah vector. Penggunaannya cukup mudah, panggil saja method nya lalu sisipkan ",(0,i.kt)("em",{parentName:"p"},"mutable reference")," dari vector satunya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut result_one = vec![3, 1, 2];\n\nlet mut data_two = vec![7, 6, 8];\nresult_one.append(&mut data_two);\n\nprintln!("data: {:?}", result_one);\nprintln!("length: {}, capacity: {}", result_one.len(), result_one.capacity());\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Vector",src:n(2366).Z,width:"450",height:"125"})),(0,i.kt)("p",null,"Pada contoh di atas ",(0,i.kt)("inlineCode",{parentName:"p"},"result_one")," adalah vector mutable dengan isi 3 elemen. Kemudian dideklarasikan ",(0,i.kt)("inlineCode",{parentName:"p"},"data_two")," yang isinya juga vector 3 elemen. Vector ",(0,i.kt)("inlineCode",{parentName:"p"},"data_two")," dimasukkan kedalam vector ",(0,i.kt)("inlineCode",{parentName:"p"},"result_one")," dengan menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"append"),", dengan ini maka isi ",(0,i.kt)("inlineCode",{parentName:"p"},"result_one")," adalah gabungan dari ",(0,i.kt)("inlineCode",{parentName:"p"},"result_one")," yang lama dan ",(0,i.kt)("inlineCode",{parentName:"p"},"data_two"),"."),(0,i.kt)("p",null,"Proses append vector mengharuskan parameter method ",(0,i.kt)("inlineCode",{parentName:"p"},"append")," diisi dengan ",(0,i.kt)("em",{parentName:"p"},"mutable reference")," dari vector yang ingin dimasukkan. Cara untuk mengambil ",(0,i.kt)("em",{parentName:"p"},"mutable reference")," adalah dengan menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut"),"."),(0,i.kt)("p",null,"Ok, selanjutnya tambahkan lagi isi ",(0,i.kt)("inlineCode",{parentName:"p"},"result_one")," dengan vector lain."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'result_one.append(&mut vec![4, 5]);\n\nprintln!("data: {:?}", result_one);\nprintln!("length: {}, capacity: {}", result_one.len(), result_one.capacity());\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Vector",src:n(6241).Z,width:"447",height:"127"})),(0,i.kt)("p",null,"Proses penggabungan vector pada contoh ke-dua di atas sedikit berbeda. Method ",(0,i.kt)("inlineCode",{parentName:"p"},"append")," parameternya adalah langsung ",(0,i.kt)("em",{parentName:"p"},"mutable reference")," dari literal vector. Ini merupakan salah satu cara yang bisa digunakan dalam penggabungan vector."),(0,i.kt)("h3",{id:"-method-sort--untuk-mengurutkan-vector"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"sort")," \u279c untuk mengurutkan vector"),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"sort")," digunakan untuk mengurutkan elemen vector."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'println!("data: {:?}", result_one);\nresult_one.sort();\nprintln!("data: {:?}", result_one);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Vector",src:n(3380).Z,width:"447",height:"127"})),(0,i.kt)("h2",{id:"a162-macam-deklarasi-vektor"},"A.16.2. Macam deklarasi vektor"),(0,i.kt)("p",null,"Ada beberapa cara deklarasi vector. Pada contoh berikut dua buah vector dideklarasikan menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"vec!"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let mut vector_4 = vec![1, 2, 3];\nlet mut vector_5: Vec<i64> = vec![1, 2, 3];\n")),(0,i.kt)("p",null,"Vector ",(0,i.kt)("inlineCode",{parentName:"p"},"vector_4")," didefinisikan dengan cara yang sudah kita terapkan sebelumnya, yaitu menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"vec"),". Vector ",(0,i.kt)("inlineCode",{parentName:"p"},"vector_5")," juga didefinisikan dengan cara yang sama, hanya saja pada vector ini tipe datanya ditentukan secara eksplisit yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<i64>"),"."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Vec<i64>")," Artinya adalah vector dengan tipe data elemen adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"i64"),". Dengan notasi penulisan ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<T>")," bisa ditentukan tipe data elemen yang diinginkan."),(0,i.kt)("p",null,"Cara deklarasi vector selanjutnya adalah pembuatan vector dengan isi kosong. Deklarasi vector ini mewajibkan tipe data vector dituliskan secara eksplisit, dikarenakan tipe data tidak bisa diidentifikasi dari isinya (karena isinya kosong). Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let mut vector_7: Vec<&str> = vec![];\nlet mut vector_8: Vec<&str> = Vec::new();\n")),(0,i.kt)("p",null,"Vector ",(0,i.kt)("inlineCode",{parentName:"p"},"vector_7")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"vector_8")," keduanya bertipe vector dengan isi atau elemen bertipe data literal string ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),"."),(0,i.kt)("p",null,"Deklarasi vector kosong bisa dilakukan dengan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"vec")," yang ditulis tanpa isi, atau bisa menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec::new()"),"."),(0,i.kt)("h2",{id:"a163-iterasi-data-vector"},"A.16.3. Iterasi data vector"),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," bisa digunakan untuk iterasi vector. Cara penerapannya seperti pada array atau slice."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let vec_eight = vec![1, 2, 3];\nfor e in vec_eight {\n print!("{e} ");\n}\n\n// 1 2 3\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let vec_nine = vec![1, 2, 3];\nfor i in 0..vec_nine.len() {\n print!("{} ", vec_nine[i]);\n}\n\n// 1 2 3\n')),(0,i.kt)("p",null,"Keyword perulangan lainnya juga bisa digunakan."),(0,i.kt)("h2",{id:"a164-ownership-tipe-data-vector"},"A.16.4. Ownership tipe data vector"),(0,i.kt)("p",null,"Salah satu atribut vector yang penting untuk diketahui adalah, pemilik data sebenarnya (atau owner). Agar lebih jelas, silakan coba terlebih dahulu kode berikut."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let vec_ten = vec![1, 2, 3];\nfor e in vec_ten {\n print!("{e} ");\n}\nfor i in 0..vec_ten.len() {\n print!("{} ", vec_ten[i]);\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Vector",src:n(2061).Z,width:"634",height:"626"})),(0,i.kt)("p",null,"Terlihat sekilas tidak ada kode yang bermasalah dari program di atas, tapi error, aneh."),(0,i.kt)("p",null,"Di Rust, ownership atau kepemilikan data adalah hal yang sangat penting. Saking pentingnya, beberapa orang menyebut Rust sebagai bahasa yang ",(0,i.kt)("em",{parentName:"p"},"value oriented"),"."),(0,i.kt)("p",null,"Dalam kasus kode program vector di atas, ketika keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," digunakan untuk mengiterasi vector ",(0,i.kt)("inlineCode",{parentName:"p"},"vec_ten"),", membuat pemilik data vektor berpindah ke variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"e"),". Hal ini efeknya adalah ketika kita berusaha mengakses variabel yang sama setelah perulangan selesai, maka yang muncul adalah error, karena value-nya sudah berpindah."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Perpindahan owner disebut dengan ",(0,i.kt)("em",{parentName:"p"},"move semantics"),". Lebih jelasnya nanti dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/ownership"},"Ownership"))),(0,i.kt)("p",null,"Solusi untuk antisipasi error ini adalah dengan cara meminjam value yang sebenarnya dari owner, untuk kemudian digunakan dalam perulangan. Caranya dengan menggunakan teknik ",(0,i.kt)("em",{parentName:"p"},"borrowing")," menggunakan operator ",(0,i.kt)("inlineCode",{parentName:"p"},"reference")," yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"&"),". Data sebenarnya milik owner dipinjam untuk dipergunakan di perulangan."),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai reference dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/pointer-references"},"Pointer & References")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai borrowing dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/borrowing"},"Borrowing")))),(0,i.kt)("p",null,"Silakan ubah kode yang sebelumnya ..."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'for e in vec_ten {\n print!("{e} ");\n}\n')),(0,i.kt)("p",null,"... menjadi seperti ini, kemudian run, maka error akan hilang."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'for e in &vec_ten {\n print!("{e} ");\n}\n')),(0,i.kt)("p",null,"Salah satu alternatif cara lainnya untuk antisipasi value berpindah tempat adalah dengan menggunakan method ",(0,i.kt)("inlineCode",{parentName:"p"},"iter")," untuk mengkonversi vector menjadi iterator. Jadi yang di-iterasi bukan vector-nya, melainkan objek iterator yang dibuat dari vector tersebut."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'for e in vec_ten.iter() {\n print!("{e} ");\n}\n')),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai ",(0,i.kt)("em",{parentName:"li"},"ownership")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/ownership"},"Ownership")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai ",(0,i.kt)("em",{parentName:"li"},"borrowing")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/borrowing"},"Borrowing")))),(0,i.kt)("h2",{id:"a165-vector-slice"},"A.16.5. Vector slice"),(0,i.kt)("p",null,"Seperti array, slice juga bisa dibuat dari vector. Cara penerapannya juga sama persis. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let vec_population = vec![2, 1, 3];\nlet vec_sample = &vec_population[0..1];\nprintln!("{:?}", vec_sample); // [2]\n')),(0,i.kt)("p",null,"Semua operasi slice bisa diterapkan di vector."),(0,i.kt)("h2",{id:"a166-tipe-data-vecdequet"},"A.16.6. Tipe data ",(0,i.kt)("inlineCode",{parentName:"h2"},"VecDeque<T>")),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"VecDeque<T>")," adalah sama seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<T>")," plus mendukung operasi menambah dan mengurangi elemen dari dua sisi secara efisien."),(0,i.kt)("p",null,"Pada tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec<T>"),", ada method ",(0,i.kt)("inlineCode",{parentName:"p"},"pop")," yang fungsinya menghapus data elemen terakhir dan method ",(0,i.kt)("inlineCode",{parentName:"p"},"push")," untuk menambah elemen baru dari kanan. Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"VecDeque")," memiliki bebebrapa method tambahan, yaitu:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"method ",(0,i.kt)("inlineCode",{parentName:"li"},"pop_front")," untuk hapus data elemen pertama atau paling kiri (indeks ke-0)"),(0,i.kt)("li",{parentName:"ul"},"method ",(0,i.kt)("inlineCode",{parentName:"li"},"push_front")," untuk menambah data dari kiri (indeks ke-0)"),(0,i.kt)("li",{parentName:"ul"},"method ",(0,i.kt)("inlineCode",{parentName:"li"},"pop_back")," untuk hapus data elemen pertama atau paling kanan (indeks terakhir)"),(0,i.kt)("li",{parentName:"ul"},"method ",(0,i.kt)("inlineCode",{parentName:"li"},"push_back")," untuk menambah data dari kanan (indeks terakhir)")),(0,i.kt)("p",null,"Contoh penerapan:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'use std::collections::VecDeque;\n\nlet mut vec_10 = VecDeque::from(vec!["a", "b", "c"]);\n\nvec_10.pop_front();\nvec_10.push_front("z");\nprintln!("data: {:?}", vec_10);\n\nvec_10.pop_back();\nvec_10.push_back("h");\nprintln!("data: {:?}", vec_10);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Vector",src:n(4050).Z,width:"453",height:"129"})),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"VecDeque<T>")," tidak otomatis di-import. Kita perlu mengimport path di mana tipe data tersebut berada menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"use"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"use std::collections::VecDeque;\n")),(0,i.kt)("p",null,"Cara membuat vector ",(0,i.kt)("inlineCode",{parentName:"p"},"VecDeque<T>")," bisa menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"VecDeque::from")," dengan parameter diisi data vectornya, seperti pada kode program yang sudah ditulis."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/vector"},"github.com/novalagung/dasarpemrogramanrust-example/../vector")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/macro.vec.html"},"https://doc.rust-lang.org/std/macro.vec.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/vec/struct.Vec.html"},"https://doc.rust-lang.org/std/vec/struct.Vec.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/std/vec.html"},"https://doc.rust-lang.org/rust-by-example/std/vec.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/collections/struct.VecDeque.html"},"https://doc.rust-lang.org/std/collections/struct.VecDeque.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/36672845/in-rust-is-a-vector-an-iterator"},"https://stackoverflow.com/questions/36672845/in-rust-is-a-vector-an-iterator")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/28800121/what-do-i-have-to-do-to-solve-a-use-of-moved-value-error"},"https://stackoverflow.com/questions/28800121/what-do-i-have-to-do-to-solve-a-use-of-moved-value-error")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/43036279/what-does-it-mean-to-pass-in-a-vector-into-a-for-loop-versus-a-reference-to-a"},"https://stackoverflow.com/questions/43036279/what-does-it-mean-to-pass-in-a-vector-into-a-for-loop-versus-a-reference-to-a"))))}m.isMDXComponent=!0},7662:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcUAAABuCAIAAADZD59KAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29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sooR+OpmrJ5fHqO0XzlRExRdu/NlLQZ3fGpUjInTw9Sdys+nW4bsO4oJXlKHWH+dOmM0UxVNjW3dFcxqaambLMelZXCXU6dKWL3SqYk83ubwBJ4Gk0WyiIl5JVlq+LpxesuA+84Thc3mOS8i5TkKXV5nkZjzt8/p/XddBg9rg2nI654cK2nbLEela/oesupjHnR7rUxWn4bqZs+lfMkYfO0Gr+sycjVbLDdP94/UN2XPKJVe/n0yF+x2lkxxUSeUn14emld4xOZd9qUR/th8Qur++23IUWekqdRkNS89IdkQae6k6cUebpqvuG6w1Sy4PD9i21I3T5PKYqiyFOKoijylKIoiiJPKYqiDspTt7PvRr2oRZVxDYTLaxT1MuPT3Wm3xuuyjKhrWagFPN39sbCrahCKIk+PxNM0p+uL/Ro+ZnudDUJRL4en0qtYMxuO46QhKlOcpzVj4Dv/m6lb0QQ8iP2eyopttshTzp+oFteqqUevBqEoqgNPkVcxNhvO/FQ09zXTq7gSH+vogV6NLHkql4yr9dctZTQOrbkUc6UuDUJRVBeeAq9ixSwj5oDt5L/dC27Lyll5SGyY433RU2p5Ongap1n/YSbOn1LUsXmKvIqtT3Es8ekChQY8rYAjjE7BAUueynGAKlJavpsenibfj9tERE6gUtSheSqvb5wknj1FjqMteLpid7hH2VPZNK62SuHi6ZxqK075hj9FHXi8D72KERD161iETAZPVyy/CKfTUniGqlT0VA4YxcbVxqfgZMPgGHKg7J8/wLJ0Q4NQFHUhnmrOvtLHtxyfqm7HBa9iDz6S8khSeT9xqa3Fp57KfuNqkafWnnfw887KktbGBqEo6qLx6T7jzAvN4+3qatx56My1eYoiT9WRd99QaX9X46485UCdosjTHGg3NO7sxNNzuzE2pSjylKIoijylKIqiyFOKoijylKIoijylKIoiTymKoijylKIoijylKIoiTymKoijylKIoijylKIo6rv4HCffy3PPDcloAAAAASUVORK5CYII="},3380:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAAB/CAIAAADw7l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CAx7GXAWkqq/q29rM8Oe4IDsuTd15OuWN75fUGDYVeKZGKpJl9rSZoY9weHYc7fqyNuzZxt5Ligw7Cvx2/s8Cw+N31TStJlhT3Aw9typOvI87Nk6cZ+kzbykwLAv8kRx5YkrNKo2M+wJboQ9d6COvK28cWMRlhUYrvQYW/mq2fKmNjPsCW6CPXehjrypvHHjiF9YYLjSlo18NeVbnIY2M+wJDsaeO1ZH3lDeWCaAbQWGVxBXNl5aE7WZYU9wRPbcuzry6vLGE7WZjYpNFBheRVx5orSzqs0Me4JDsufWQB35FqLDngD23I490SdGHRkA2FOe7XHP/ZjgnjuAPQEAAPYEAAAAewIAAOwJAACwJwAAwJ4AAAB7AgAAgD0BAGAJ/A9wxxZFJeVMpwAAAABJRU5ErkJggg=="},2061:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/vector-11-27b0884891ab00c87d90603997e1878c.png"},4050:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcUAAACBCAIAAAA+HTYdAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9w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NpZsKfQkhpCWs6dhz2nQA0fM4Ls2SjtTBBEC3vKsYeDaIpoM7Nnm+6vkiGUdga+pytkBXsOoVq+BCfZs1namSCI+pk79F0Q/ekEIka1wZ6OZb5m3V9UJSjtnEjpW3LRhosnDYOn2GdO/SM+pVa/7knqJIjV2FPM0uV3hoNvEtu+Z0xiya59G3ueZtD9leK9SNoZfp9ZFYEWaWr2PClHMeH6pMcgQATalHYmCGIZ37Nh3ph8xWyD8TrrDsnKd6KWOURPEMTe2RN8dmjdzYp5hHs3Y0+eKiKIW2XPdK54BUywEns2fHSdIIirYE+CIAiyJ0EQBEH2JAiCIHsSBEGQPQmCIMieBEEQZE+CIAiC7EkQBEH2JAiC2Aj/A0eMR7gw7IWCAAAAAElFTkSuQmCC"}}]); \ No newline at end of file diff --git a/assets/js/ca36df4d.008163ca.js b/assets/js/ca36df4d.008163ca.js deleted file mode 100644 index 3bd15f10..00000000 --- a/assets/js/ca36df4d.008163ca.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[917],{3905:(e,a,t)=>{t.d(a,{Zo:()=>s,kt:()=>d});var r=t(7294);function n(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function i(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);a&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?i(Object(t),!0).forEach((function(a){n(e,a,t[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}))}return e}function o(e,a){if(null==e)return{};var t,r,n=function(e,a){if(null==e)return{};var t,r,n={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],a.indexOf(t)>=0||(n[t]=e[t]);return n}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],a.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}var p=r.createContext({}),u=function(e){var a=r.useContext(p),t=a;return e&&(t="function"==typeof e?e(a):l(l({},a),e)),t},s=function(e){var a=u(e.components);return r.createElement(p.Provider,{value:a},e.children)},m={inlineCode:"code",wrapper:function(e){var a=e.children;return r.createElement(r.Fragment,{},a)}},c=r.forwardRef((function(e,a){var t=e.components,n=e.mdxType,i=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),c=u(t),d=n,k=c["".concat(p,".").concat(d)]||c[d]||m[d]||i;return t?r.createElement(k,l(l({ref:a},s),{},{components:t})):r.createElement(k,l({ref:a},s))}));function d(e,a){var t=arguments,n=a&&a.mdxType;if("string"==typeof e||n){var i=t.length,l=new Array(i);l[0]=c;var o={};for(var p in a)hasOwnProperty.call(a,p)&&(o[p]=a[p]);o.originalType=e,o.mdxType="string"==typeof e?e:n,l[1]=o;for(var u=2;u<i;u++)l[u]=t[u];return r.createElement.apply(null,l)}return r.createElement.apply(null,t)}c.displayName="MDXCreateElement"},2197:(e,a,t)=>{t.r(a),t.d(a,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>o,toc:()=>u});var r=t(7462),n=(t(7294),t(3905));const i={sidebar_position:3,title:"Version Changelogs & Updates",sidebar_label:"Version Changelogs & Updates"},l=void 0,o={unversionedId:"CHANGELOG",id:"CHANGELOG",title:"Version Changelogs & Updates",description:"\ud83d\udcdd Release v1.0.20240731 (2024-07-31)",source:"@site/docs/CHANGELOG.md",sourceDirName:".",slug:"/CHANGELOG",permalink:"/CHANGELOG",draft:!1,tags:[],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3,title:"Version Changelogs & Updates",sidebar_label:"Version Changelogs & Updates"},sidebar:"tutorialSidebar",previous:{title:"Pengenalan Rust Programming",permalink:"/pengelanan-rust-programming"},next:{title:"Contribution & Tech Stack",permalink:"/CONTRIBUTING"}},p={},u=[{value:"\ud83d\udcdd Release v1.0.20240731 (2024-07-31)",id:"-release-v1020240731-2024-07-31",level:2},{value:"\u25c9 Chapter baru",id:"-chapter-baru",level:4},{value:"\u25c9 Chapter update",id:"-chapter-update",level:4},{value:"\u25c9 General update",id:"-general-update",level:4}],s={toc:u};function m(e){let{components:a,...t}=e;return(0,n.kt)("wrapper",(0,r.Z)({},s,t,{components:a,mdxType:"MDXLayout"}),(0,n.kt)("h2",{id:"-release-v1020240731-2024-07-31"},"\ud83d\udcdd Release v1.0.20240731 (2024-07-31)"),(0,n.kt)("h4",{id:"-chapter-baru"},"\u25c9 Chapter baru"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/operator-tanda-tanya"},"Operator ?")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/unrecoverable-panic-error"},"Error \u279c Unrecoverable Error / Panic")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/recoverable-error-handling"},"Error \u279c Recoverable Error & Error Handling"))),(0,n.kt)("h4",{id:"-chapter-update"},"\u25c9 Chapter update"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/variabel"},"Variabel"),(0,n.kt)("ul",{parentName:"li"},(0,n.kt)("li",{parentName:"ul"},"Penambahan penjelasan tentang variabel ",(0,n.kt)("inlineCode",{parentName:"li"},"_")))),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/result-type"},"Tipe Data \u279c Result"),(0,n.kt)("ul",{parentName:"li"},(0,n.kt)("li",{parentName:"ul"},"Perbaikan konten"),(0,n.kt)("li",{parentName:"ul"},"Penambahan penjelasan tentang tipe ",(0,n.kt)("inlineCode",{parentName:"li"},"Result<T>")," dan ",(0,n.kt)("inlineCode",{parentName:"li"},"Result<(), E>")),(0,n.kt)("li",{parentName:"ul"},"Penambahan penjelasan tentang intro error handling di Rust"))),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/file-path-directory"},"File, Path, Directory"),(0,n.kt)("ul",{parentName:"li"},(0,n.kt)("li",{parentName:"ul"},"Penambahan penjelasan terkait OS path ketika method ",(0,n.kt)("inlineCode",{parentName:"li"},".join()")," digunakan"),(0,n.kt)("li",{parentName:"ul"},"Penambahan contoh operasi baca file ke string & vector"),(0,n.kt)("li",{parentName:"ul"},"Penambahan sample source code yang sebelumnya tidak ada"),(0,n.kt)("li",{parentName:"ul"},"Perbaikan syntax error"))),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits"),(0,n.kt)("ul",{parentName:"li"},(0,n.kt)("li",{parentName:"ul"},"Chapter di-split menjadi 2, yaitu ",(0,n.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits")," dan ",(0,n.kt)("a",{parentName:"li",href:"/basic/advanced-traits"},"Traits \u279c Advanced")),(0,n.kt)("li",{parentName:"ul"},"Penambahan penjelasan tentang ",(0,n.kt)("strong",{parentName:"li"},"external traits")," vs ",(0,n.kt)("strong",{parentName:"li"},"internal traits")),(0,n.kt)("li",{parentName:"ul"},"Perbaikan narasi konten"))),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/attributes"},"Attributes"),(0,n.kt)("ul",{parentName:"li"},(0,n.kt)("li",{parentName:"ul"},"Penambahan attribute configuration"),(0,n.kt)("li",{parentName:"ul"},"Penambahan section macro ",(0,n.kt)("inlineCode",{parentName:"li"},"cfg!()")," dan conditional compilation"),(0,n.kt)("li",{parentName:"ul"},"Penambahan section configuration ",(0,n.kt)("inlineCode",{parentName:"li"},"debug_assertions")),(0,n.kt)("li",{parentName:"ul"},"Penambahan attribute linting: ",(0,n.kt)("inlineCode",{parentName:"li"},"#[forbid]"))))),(0,n.kt)("h4",{id:"-general-update"},"\u25c9 General update"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Peningkatan keyword untuk keperluan SEO"),(0,n.kt)("li",{parentName:"ul"},"Perubahan isi konten halaman utama"),(0,n.kt)("li",{parentName:"ul"},"Perbaikan typo")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ca36df4d.5c72c081.js b/assets/js/ca36df4d.5c72c081.js new file mode 100644 index 00000000..c2bc72aa --- /dev/null +++ b/assets/js/ca36df4d.5c72c081.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[917],{3905:(e,a,t)=>{t.d(a,{Zo:()=>s,kt:()=>d});var r=t(7294);function n(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function i(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);a&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?i(Object(t),!0).forEach((function(a){n(e,a,t[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}))}return e}function o(e,a){if(null==e)return{};var t,r,n=function(e,a){if(null==e)return{};var t,r,n={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],a.indexOf(t)>=0||(n[t]=e[t]);return n}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],a.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}var p=r.createContext({}),u=function(e){var a=r.useContext(p),t=a;return e&&(t="function"==typeof e?e(a):l(l({},a),e)),t},s=function(e){var a=u(e.components);return r.createElement(p.Provider,{value:a},e.children)},m={inlineCode:"code",wrapper:function(e){var a=e.children;return r.createElement(r.Fragment,{},a)}},c=r.forwardRef((function(e,a){var t=e.components,n=e.mdxType,i=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),c=u(t),d=n,k=c["".concat(p,".").concat(d)]||c[d]||m[d]||i;return t?r.createElement(k,l(l({ref:a},s),{},{components:t})):r.createElement(k,l({ref:a},s))}));function d(e,a){var t=arguments,n=a&&a.mdxType;if("string"==typeof e||n){var i=t.length,l=new Array(i);l[0]=c;var o={};for(var p in a)hasOwnProperty.call(a,p)&&(o[p]=a[p]);o.originalType=e,o.mdxType="string"==typeof e?e:n,l[1]=o;for(var u=2;u<i;u++)l[u]=t[u];return r.createElement.apply(null,l)}return r.createElement.apply(null,t)}c.displayName="MDXCreateElement"},2197:(e,a,t)=>{t.r(a),t.d(a,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>o,toc:()=>u});var r=t(7462),n=(t(7294),t(3905));const i={sidebar_position:3,title:"Version Changelogs & Updates",sidebar_label:"Version Changelogs & Updates"},l=void 0,o={unversionedId:"CHANGELOG",id:"CHANGELOG",title:"Version Changelogs & Updates",description:"\ud83d\udcdd Release v1.0.20240830 (2024-08-30)",source:"@site/docs/CHANGELOG.md",sourceDirName:".",slug:"/CHANGELOG",permalink:"/CHANGELOG",draft:!1,tags:[],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3,title:"Version Changelogs & Updates",sidebar_label:"Version Changelogs & Updates"},sidebar:"tutorialSidebar",previous:{title:"Pengenalan Rust Programming",permalink:"/pengelanan-rust-programming"},next:{title:"Contribution & Tech Stack",permalink:"/CONTRIBUTING"}},p={},u=[{value:"\ud83d\udcdd Release v1.0.20240830 (2024-08-30)",id:"-release-v1020240830-2024-08-30",level:2},{value:"\u25c9 General update",id:"-general-update",level:4},{value:"\ud83d\udcdd Release v1.0.20240731 (2024-07-31)",id:"-release-v1020240731-2024-07-31",level:2},{value:"\u25c9 Chapter baru",id:"-chapter-baru",level:4},{value:"\u25c9 Chapter update",id:"-chapter-update",level:4},{value:"\u25c9 General update",id:"-general-update-1",level:4}],s={toc:u};function m(e){let{components:a,...t}=e;return(0,n.kt)("wrapper",(0,r.Z)({},s,t,{components:a,mdxType:"MDXLayout"}),(0,n.kt)("h2",{id:"-release-v1020240830-2024-08-30"},"\ud83d\udcdd Release v1.0.20240830 (2024-08-30)"),(0,n.kt)("h4",{id:"-general-update"},"\u25c9 General update"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Optimasi pagespeed")),(0,n.kt)("h2",{id:"-release-v1020240731-2024-07-31"},"\ud83d\udcdd Release v1.0.20240731 (2024-07-31)"),(0,n.kt)("h4",{id:"-chapter-baru"},"\u25c9 Chapter baru"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/operator-tanda-tanya"},"Operator ?")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/unrecoverable-panic-error"},"Error \u279c Unrecoverable Error / Panic")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/recoverable-error-handling"},"Error \u279c Recoverable Error & Error Handling"))),(0,n.kt)("h4",{id:"-chapter-update"},"\u25c9 Chapter update"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/variabel"},"Variabel"),(0,n.kt)("ul",{parentName:"li"},(0,n.kt)("li",{parentName:"ul"},"Penambahan penjelasan tentang variabel ",(0,n.kt)("inlineCode",{parentName:"li"},"_")))),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/result-type"},"Tipe Data \u279c Result"),(0,n.kt)("ul",{parentName:"li"},(0,n.kt)("li",{parentName:"ul"},"Perbaikan konten"),(0,n.kt)("li",{parentName:"ul"},"Penambahan penjelasan tentang tipe ",(0,n.kt)("inlineCode",{parentName:"li"},"Result<T>")," dan ",(0,n.kt)("inlineCode",{parentName:"li"},"Result<(), E>")),(0,n.kt)("li",{parentName:"ul"},"Penambahan penjelasan tentang intro error handling di Rust"))),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/file-path-directory"},"File, Path, Directory"),(0,n.kt)("ul",{parentName:"li"},(0,n.kt)("li",{parentName:"ul"},"Penambahan penjelasan terkait OS path ketika method ",(0,n.kt)("inlineCode",{parentName:"li"},".join()")," digunakan"),(0,n.kt)("li",{parentName:"ul"},"Penambahan contoh operasi baca file ke string & vector"),(0,n.kt)("li",{parentName:"ul"},"Penambahan sample source code yang sebelumnya tidak ada"),(0,n.kt)("li",{parentName:"ul"},"Perbaikan syntax error"))),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits"),(0,n.kt)("ul",{parentName:"li"},(0,n.kt)("li",{parentName:"ul"},"Chapter di-split menjadi 2, yaitu ",(0,n.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits")," dan ",(0,n.kt)("a",{parentName:"li",href:"/basic/advanced-traits"},"Traits \u279c Advanced")),(0,n.kt)("li",{parentName:"ul"},"Penambahan penjelasan tentang ",(0,n.kt)("strong",{parentName:"li"},"external traits")," vs ",(0,n.kt)("strong",{parentName:"li"},"internal traits")),(0,n.kt)("li",{parentName:"ul"},"Perbaikan narasi konten"))),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"/basic/attributes"},"Attributes"),(0,n.kt)("ul",{parentName:"li"},(0,n.kt)("li",{parentName:"ul"},"Penambahan attribute configuration"),(0,n.kt)("li",{parentName:"ul"},"Penambahan section macro ",(0,n.kt)("inlineCode",{parentName:"li"},"cfg!()")," dan conditional compilation"),(0,n.kt)("li",{parentName:"ul"},"Penambahan section configuration ",(0,n.kt)("inlineCode",{parentName:"li"},"debug_assertions")),(0,n.kt)("li",{parentName:"ul"},"Penambahan attribute linting: ",(0,n.kt)("inlineCode",{parentName:"li"},"#[forbid]"))))),(0,n.kt)("h4",{id:"-general-update-1"},"\u25c9 General update"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Peningkatan keyword untuk keperluan SEO"),(0,n.kt)("li",{parentName:"ul"},"Perubahan isi konten halaman utama"),(0,n.kt)("li",{parentName:"ul"},"Perbaikan typo")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/cb962766.4f3c4b22.js b/assets/js/cb962766.4f3c4b22.js deleted file mode 100644 index eb39bd17..00000000 --- a/assets/js/cb962766.4f3c4b22.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[6691],{3905:(e,n,t)=>{t.d(n,{Zo:()=>s,kt:()=>c});var a=t(7294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function u(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)t=i[a],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)t=i[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var p=a.createContext({}),o=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},s=function(e){var n=o(e.components);return a.createElement(p.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},d=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,s=u(e,["components","mdxType","originalType","parentName"]),d=o(t),c=r,k=d["".concat(p,".").concat(c)]||d[c]||m[c]||i;return t?a.createElement(k,l(l({ref:n},s),{},{components:t})):a.createElement(k,l({ref:n},s))}));function c(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,l=new Array(i);l[0]=d;var u={};for(var p in n)hasOwnProperty.call(n,p)&&(u[p]=n[p]);u.originalType=e,u.mdxType="string"==typeof e?e:r,l[1]=u;for(var o=2;o<i;o++)l[o]=t[o];return a.createElement.apply(null,l)}return a.createElement.apply(null,t)}d.displayName="MDXCreateElement"},2900:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>u,toc:()=>o});var a=t(7462),r=(t(7294),t(3905));const i={sidebar_position:49,title:"A.49. Trait \u279c Function (Fn, FnMut, FnOnce)",sidebar_label:"A.49. Trait \u279c Function (Fn, FnMut, FnOnce)"},l=void 0,u={unversionedId:"basic/trait-function",id:"basic/trait-function",title:"A.49. Trait \u279c Function (Fn, FnMut, FnOnce)",description:"Chapter ini merupakan topik lanjutan dari chapter sebelumnya, di sini kita akan bahas beberapa jenis trait yang digunakan di closure.",source:"@site/docs/basic/trait-function.md",sourceDirName:"basic",slug:"/basic/trait-function",permalink:"/basic/trait-function",draft:!1,tags:[],version:"current",sidebarPosition:49,frontMatter:{sidebar_position:49,title:"A.49. Trait \u279c Function (Fn, FnMut, FnOnce)",sidebar_label:"A.49. Trait \u279c Function (Fn, FnMut, FnOnce)"},sidebar:"tutorialSidebar",previous:{title:"A.48. Closures",permalink:"/basic/closures"},next:{title:"A.50. Trait \u279c Iterator",permalink:"/basic/trait-iterator"}},p={},o=[{value:"A.49.1. Trait <code>Fn</code>",id:"a491-trait-fn",level:2},{value:"A.49.2. Trait <code>FnMut</code>",id:"a492-trait-fnmut",level:2},{value:"A.49.3. Trait <code>FnOnce</code>",id:"a493-trait-fnonce",level:2},{value:"A.49.4. Relasi antara trait function dengan function",id:"a494-relasi-antara-trait-function-dengan-function",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],s={toc:o};function m(e){let{components:n,...i}=e;return(0,r.kt)("wrapper",(0,a.Z)({},s,i,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Chapter ini merupakan topik lanjutan dari chapter sebelumnya, di sini kita akan bahas beberapa jenis trait yang digunakan di closure."),(0,r.kt)("p",null,"Rust memiliki 3 buah trait yang otomatis ter-implement pada closure, yaitu ",(0,r.kt)("inlineCode",{parentName:"p"},"Fn"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"FnMut"),", dan ",(0,r.kt)("inlineCode",{parentName:"p"},"FnOnce"),". Ketiga trait ini juga otomatis ter-implement pada fungsi yang didefinisikan menggunakan keyword ",(0,r.kt)("inlineCode",{parentName:"p"},"fn"),"."),(0,r.kt)("h2",{id:"a491-trait-fn"},"A.49.1. Trait ",(0,r.kt)("inlineCode",{parentName:"h2"},"Fn")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Fn")," sudah kita terapkan beberapa kali saat praktik pembuatan closure di chapter sebelumnya. Fn adalah trait (",(0,r.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/std/ops/trait.Fn.html"},"std::ops::Fn"),"), yang dipakai oleh Rust untuk menandai bahwa suatu closure bisa dipanggil berkali-kali dengan catatan di dalam closure tersebut tidak ada operasi mutable terhadap variabel yang scope-nya berada di luar block closure."),(0,r.kt)("p",null,"Contoh penerapan trait ",(0,r.kt)("inlineCode",{parentName:"p"},"Fn")," bisa dilihat pada kode berikut. Trait tersebut secara otomatis ter-implement pada closure ",(0,r.kt)("inlineCode",{parentName:"p"},"pow"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'let pow_number = |n: i32| n.pow(2);\n\nprintln!("pow_number(2): {}", pow_number(2));\nprintln!("pow_number(3): {}", pow_number(3));\nprintln!("pow_number(4): {}", pow_number(4));\n')),(0,r.kt)("p",null,"Contoh penerapan trait ",(0,r.kt)("inlineCode",{parentName:"p"},"Fn")," lainnya pada fungsi yang memiliki parameter closure:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let result = do_something_with_number_v1(13, |d: i32| d * 2);\n println!("result: {result}");\n}\n\nfn do_something_with_number_v1<F>(n: i32, f: F) -> i32\nwhere\n F: Fn(i32) -> i32, // <----- Fn digunakan\n{\n // Statement `f(n)` bisa dipanggil berkali-kali\n return f(n);\n}\n')),(0,r.kt)("h2",{id:"a492-trait-fnmut"},"A.49.2. Trait ",(0,r.kt)("inlineCode",{parentName:"h2"},"FnMut")),(0,r.kt)("p",null,"Trait ",(0,r.kt)("inlineCode",{parentName:"p"},"FnMut")," (",(0,r.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/std/ops/trait.FnMut.html"},"std::ops::FnMut"),") merupakan trait yang menjadikan suatu closure bisa diakses berkali-kali dan bisa me-mutate atau mengubah data suatu variabel yang berada di luar scope block closure. Trait ini juga otomatis ter-implement pada closure yang di dalamnya ada kode pengaksesan variabel yang berada di luar scope block closure."),(0,r.kt)("p",null,"Contoh penerapannya silakan lihat closure ",(0,r.kt)("inlineCode",{parentName:"p"},"square_x")," berikut. Closure tersebut di-dalamnya mengubah nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"x")," yang dideklarasikan di luar blcok closure, oleh karenanya trait ",(0,r.kt)("inlineCode",{parentName:"p"},"FnMut")," otomatis ter-implement."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'let mut x = 5;\n{\n let mut square_x = || x *= x;\n square_x();\n}\nprintln!("result: {}", x);\n')),(0,r.kt)("p",null,"Contoh lain penerapan ",(0,r.kt)("inlineCode",{parentName:"p"},"FnMut")," pada fungsi yang memiliki parameter closure:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let mut number = 1;\n do_something_with_number_v2(14, |x| number += x);\n println!("number: {number}");\n}\n\nfn do_something_with_number_v2<F>(n: i32, mut f: F)\nwhere\n F: FnMut(i32), // <----- FnMut digunakan\n{\n // Statement `f(n)` berisi kode yang mengubah isi variavel `number` (mutable).\n // `f(n)` bisa dipanggil berkali-kali\n f(n);\n}\n')),(0,r.kt)("p",null,"Parameter ke-2 fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"do_something_with_number_v2")," adalah closure yang me-mutate nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),", berarti terjadi mutable borrow karena variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," berada di luar block closure. Karena alasan tersebut maka closure harus dideklarasikan menggunakan ",(0,r.kt)("inlineCode",{parentName:"p"},"FnMut")," (bukan ",(0,r.kt)("inlineCode",{parentName:"p"},"Fn"),")."),(0,r.kt)("p",null,"Jika dipaksa deklarasi menggunakan ",(0,r.kt)("inlineCode",{parentName:"p"},"Fn"),", hasilnya pasti error."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Closure",src:t(2212).Z,width:"673",height:"274"})),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"FnMut")," merupakan supertrait dari ",(0,r.kt)("inlineCode",{parentName:"p"},"Fn"),", artinya closure dengan trait ",(0,r.kt)("inlineCode",{parentName:"p"},"Fn")," juga bisa digunakan sebagai argument pemanggilan fungsi di mana parameter fungsi tersebut bertipe ",(0,r.kt)("inlineCode",{parentName:"p"},"FnMut"),"."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai supertrait dibahas pada chpater ",(0,r.kt)("a",{parentName:"p",href:"#/wip/supertrait"},"Supertrait"))),(0,r.kt)("h2",{id:"a493-trait-fnonce"},"A.49.3. Trait ",(0,r.kt)("inlineCode",{parentName:"h2"},"FnOnce")),(0,r.kt)("p",null,"Trait ",(0,r.kt)("inlineCode",{parentName:"p"},"FnOnce")," (",(0,r.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/std/ops/trait.FnOnce.html"},"std::ops::FnOnce"),") adalah trait yang menjadikan suatu closure hanya boleh di akses sekali saja, dan closure tersebut bisa berisi operasi mutable ataupun tidak."),(0,r.kt)("p",null,"Contoh penerapan ",(0,r.kt)("inlineCode",{parentName:"p"},"FnOnce")," pada fungsi yang memiliki parameter closure."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let mut number = 1;\n do_something_with_number_v3(14, |x| number += x);\n println!("number: {number}");\n}\n\nfn do_something_with_number_v3<F>(n: i32, f: F)\nwhere\n F: FnOnce(i32), // <----- FnOnce digunakan\n{\n f(n);\n}\n')),(0,r.kt)("p",null,"Jika closure dengan tipe ",(0,r.kt)("inlineCode",{parentName:"p"},"FnOnce")," dipaksa diakses dua kali, pasti muncul error. Contohnya bisa dilihat pada parameter ",(0,r.kt)("inlineCode",{parentName:"p"},"f")," berikut."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Closure",src:t(1385).Z,width:"506",height:"395"})),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai supertrait dibahas pada chpater ",(0,r.kt)("a",{parentName:"p",href:"#/wip/supertrait"},"Supertrait"))),(0,r.kt)("h2",{id:"a494-relasi-antara-trait-function-dengan-function"},"A.49.4. Relasi antara trait function dengan function"),(0,r.kt)("p",null,"Trait ",(0,r.kt)("inlineCode",{parentName:"p"},"Fn"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"FnMut"),", dan juga ",(0,r.kt)("inlineCode",{parentName:"p"},"FnOnce")," tidak hanya ter-implement pada closure, tapi juga ter-implement pada fungsi juga (secara otomatis)."),(0,r.kt)("p",null,"Contohnya bisa dilihat pada contoh berikut. Fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"do_something_with_number_v1")," dipanggil 3 kali."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Pemanggilan pertama, argument ",(0,r.kt)("inlineCode",{parentName:"li"},"f")," diisi dengan closure ",(0,r.kt)("inlineCode",{parentName:"li"},"|d: i32| d * 2")),(0,r.kt)("li",{parentName:"ul"},"Pemanggilan kedua, argument ",(0,r.kt)("inlineCode",{parentName:"li"},"f")," diisi dengan fungsi ",(0,r.kt)("inlineCode",{parentName:"li"},"double")),(0,r.kt)("li",{parentName:"ul"},"Pemanggilan ketiga, argument ",(0,r.kt)("inlineCode",{parentName:"li"},"f")," diisi dengan fungsi ",(0,r.kt)("inlineCode",{parentName:"li"},"pow_number"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let result = do_something_with_number_v1(13, |d: i32| d * 2);\n println!("result: {result}");\n \n let result = do_something_with_number_v1(13, double);\n println!("result: {result}");\n \n let result = do_something_with_number_v1(13, pow_number);\n println!("result: {result}");\n}\n\nfn do_something_with_number_v1<F>(n: i32, f: F) -> i32\nwhere\n F: Fn(i32) -> i32,\n{\n return f(n);\n}\n\nfn double(d: i32) -> i32 {\n d * 2\n}\n\nfn pow_number(d: i32) -> i32 {\n d.pow(2)\n}\n')),(0,r.kt)("p",null,"Dari contoh di atas terbukti bahwa fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"double")," dan juga ",(0,r.kt)("inlineCode",{parentName:"p"},"pow_number")," memenuhi kriteria tipe ",(0,r.kt)("inlineCode",{parentName:"p"},"F")," yaitu ",(0,r.kt)("inlineCode",{parentName:"p"},"Fn(i32) -> i32"),"."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Closure",src:t(2795).Z,width:"450",height:"143"})),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,r.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,r.kt)("pre",null,(0,r.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/trait_function"},"github.com/novalagung/dasarpemrogramanrust-example/../trait_function")),(0,r.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/basic/function"},"Function")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/basic/closures"},"Closures"))),(0,r.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch13-01-closures.html"},"https://doc.rust-lang.org/book/ch13-01-closures.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/beta/rust-by-example/fn/closures.html"},"https://doc.rust-lang.org/beta/rust-by-example/fn/closures.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/ops/trait.Fn.html"},"https://doc.rust-lang.org/std/ops/trait.Fn.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/ops/trait.FnMut.html"},"https://doc.rust-lang.org/std/ops/trait.FnMut.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/ops/trait.FnOnce.html"},"https://doc.rust-lang.org/std/ops/trait.FnOnce.html"))))}m.isMDXComponent=!0},2212:(e,n,t)=>{t.d(n,{Z:()=>a});const a=t.p+"assets/images/trait-function-1-69d13024d5321866a37aa3bb1f72a1b2.png"},1385:(e,n,t)=>{t.d(n,{Z:()=>a});const a=t.p+"assets/images/trait-function-2-5f9002b90d061f7ad1815a678e71f312.png"},2795:(e,n,t)=>{t.d(n,{Z:()=>a});const a="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAACPCAIAAADmy0wUAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG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tH+/+9u/0FAAuLyMjqJ2ErsuzpuEatomoku/jBaj0cUy2qX3gzE9AFxcRkdt65QvDfIG8VMD6CYyOo8pw32IO5wiKggAwM6D+kwbY8JpyWjD3jIaSXn1fAAAl5PRsh6Nkd+uMtppaJhAnB4yCgBHkdH68+9xwnSaOT1HqkUZDfZORbkqgJmGDkeGg3pUFACOIaPpwH6aGs2fs4+b//3x/ayb2aSAfNY/70n99HJoPK1gvk0KALCTjAIAADIKAICMAgAgowAAyCgAACCjAADIKADAu5ZRbJsBABltJKbYNgMAMnoMGcW2GQCOKqPYNgMArJVRbJsBANbJKLbNAAArB/WZNmLbDACAbTMAwGVkFNtmAIB1MnqHbTMAwB2LQQEAkFEAAGQUAAAZBQBARgEAABkFAEBGAQCQ0TrYNgMAMtpITBuvqe9ewldLmWLRnrbgVQIAyGiolj9/JMtJxbLVcMUpC0QBYHsZvRLb5u8/0zX85yPT42LlxK4EAPaQ0SuybY5lVNk2J+doYnEKAMhoRUavx7Y5klFl25y7PiGjALDHoD7TqgPbNseiL84XPnPia00AcCEZPaJtsx7UF22bgw+KAgDsJqOHtG2WKZRtm43TAQBsLqN3x7NtztI0bZsxcgaAfWUUAACQUQAAZBQAABkFAEBGAQAAGQUAQEYBAJBRAABkFAAAGQUAAGQUAOAy/A82p+fN3SYAAgAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/cb962766.d729d41c.js b/assets/js/cb962766.d729d41c.js new file mode 100644 index 00000000..a166b64f --- /dev/null +++ b/assets/js/cb962766.d729d41c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[6691],{3905:(e,n,t)=>{t.d(n,{Zo:()=>s,kt:()=>c});var a=t(7294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function u(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)t=i[a],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)t=i[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var p=a.createContext({}),o=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},s=function(e){var n=o(e.components);return a.createElement(p.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},d=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,s=u(e,["components","mdxType","originalType","parentName"]),d=o(t),c=r,k=d["".concat(p,".").concat(c)]||d[c]||m[c]||i;return t?a.createElement(k,l(l({ref:n},s),{},{components:t})):a.createElement(k,l({ref:n},s))}));function c(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,l=new Array(i);l[0]=d;var u={};for(var p in n)hasOwnProperty.call(n,p)&&(u[p]=n[p]);u.originalType=e,u.mdxType="string"==typeof e?e:r,l[1]=u;for(var o=2;o<i;o++)l[o]=t[o];return a.createElement.apply(null,l)}return a.createElement.apply(null,t)}d.displayName="MDXCreateElement"},2900:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>u,toc:()=>o});var a=t(7462),r=(t(7294),t(3905));const i={sidebar_position:49,title:"A.49. Trait \u279c Function (Fn, FnMut, FnOnce)",sidebar_label:"A.49. Trait \u279c Function (Fn, FnMut, FnOnce)"},l=void 0,u={unversionedId:"basic/trait-function",id:"basic/trait-function",title:"A.49. Trait \u279c Function (Fn, FnMut, FnOnce)",description:"Chapter ini merupakan topik lanjutan dari chapter sebelumnya, di sini kita akan bahas beberapa jenis trait yang digunakan di closure.",source:"@site/docs/basic/trait-function.md",sourceDirName:"basic",slug:"/basic/trait-function",permalink:"/basic/trait-function",draft:!1,tags:[],version:"current",sidebarPosition:49,frontMatter:{sidebar_position:49,title:"A.49. Trait \u279c Function (Fn, FnMut, FnOnce)",sidebar_label:"A.49. Trait \u279c Function (Fn, FnMut, FnOnce)"},sidebar:"tutorialSidebar",previous:{title:"A.48. Closures",permalink:"/basic/closures"},next:{title:"A.50. Trait \u279c Iterator",permalink:"/basic/trait-iterator"}},p={},o=[{value:"A.49.1. Trait <code>Fn</code>",id:"a491-trait-fn",level:2},{value:"A.49.2. Trait <code>FnMut</code>",id:"a492-trait-fnmut",level:2},{value:"A.49.3. Trait <code>FnOnce</code>",id:"a493-trait-fnonce",level:2},{value:"A.49.4. Relasi antara trait function dengan function",id:"a494-relasi-antara-trait-function-dengan-function",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],s={toc:o};function m(e){let{components:n,...i}=e;return(0,r.kt)("wrapper",(0,a.Z)({},s,i,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Chapter ini merupakan topik lanjutan dari chapter sebelumnya, di sini kita akan bahas beberapa jenis trait yang digunakan di closure."),(0,r.kt)("p",null,"Rust memiliki 3 buah trait yang otomatis ter-implement pada closure, yaitu ",(0,r.kt)("inlineCode",{parentName:"p"},"Fn"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"FnMut"),", dan ",(0,r.kt)("inlineCode",{parentName:"p"},"FnOnce"),". Ketiga trait ini juga otomatis ter-implement pada fungsi yang didefinisikan menggunakan keyword ",(0,r.kt)("inlineCode",{parentName:"p"},"fn"),"."),(0,r.kt)("h2",{id:"a491-trait-fn"},"A.49.1. Trait ",(0,r.kt)("inlineCode",{parentName:"h2"},"Fn")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Fn")," sudah kita terapkan beberapa kali saat praktik pembuatan closure di chapter sebelumnya. Fn adalah trait (",(0,r.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/std/ops/trait.Fn.html"},"std::ops::Fn"),"), yang dipakai oleh Rust untuk menandai bahwa suatu closure bisa dipanggil berkali-kali dengan catatan di dalam closure tersebut tidak ada operasi mutable terhadap variabel yang scope-nya berada di luar block closure."),(0,r.kt)("p",null,"Contoh penerapan trait ",(0,r.kt)("inlineCode",{parentName:"p"},"Fn")," bisa dilihat pada kode berikut. Trait tersebut secara otomatis ter-implement pada closure ",(0,r.kt)("inlineCode",{parentName:"p"},"pow"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'let pow_number = |n: i32| n.pow(2);\n\nprintln!("pow_number(2): {}", pow_number(2));\nprintln!("pow_number(3): {}", pow_number(3));\nprintln!("pow_number(4): {}", pow_number(4));\n')),(0,r.kt)("p",null,"Contoh penerapan trait ",(0,r.kt)("inlineCode",{parentName:"p"},"Fn")," lainnya pada fungsi yang memiliki parameter closure:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let result = do_something_with_number_v1(13, |d: i32| d * 2);\n println!("result: {result}");\n}\n\nfn do_something_with_number_v1<F>(n: i32, f: F) -> i32\nwhere\n F: Fn(i32) -> i32, // <----- Fn digunakan\n{\n // Statement `f(n)` bisa dipanggil berkali-kali\n return f(n);\n}\n')),(0,r.kt)("h2",{id:"a492-trait-fnmut"},"A.49.2. Trait ",(0,r.kt)("inlineCode",{parentName:"h2"},"FnMut")),(0,r.kt)("p",null,"Trait ",(0,r.kt)("inlineCode",{parentName:"p"},"FnMut")," (",(0,r.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/std/ops/trait.FnMut.html"},"std::ops::FnMut"),") merupakan trait yang menjadikan suatu closure bisa diakses berkali-kali dan bisa me-mutate atau mengubah data suatu variabel yang berada di luar scope block closure. Trait ini juga otomatis ter-implement pada closure yang di dalamnya ada kode pengaksesan variabel yang berada di luar scope block closure."),(0,r.kt)("p",null,"Contoh penerapannya silakan lihat closure ",(0,r.kt)("inlineCode",{parentName:"p"},"square_x")," berikut. Closure tersebut di-dalamnya mengubah nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"x")," yang dideklarasikan di luar blcok closure, oleh karenanya trait ",(0,r.kt)("inlineCode",{parentName:"p"},"FnMut")," otomatis ter-implement."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'let mut x = 5;\n{\n let mut square_x = || x *= x;\n square_x();\n}\nprintln!("result: {}", x);\n')),(0,r.kt)("p",null,"Contoh lain penerapan ",(0,r.kt)("inlineCode",{parentName:"p"},"FnMut")," pada fungsi yang memiliki parameter closure:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let mut number = 1;\n do_something_with_number_v2(14, |x| number += x);\n println!("number: {number}");\n}\n\nfn do_something_with_number_v2<F>(n: i32, mut f: F)\nwhere\n F: FnMut(i32), // <----- FnMut digunakan\n{\n // Statement `f(n)` berisi kode yang mengubah isi variavel `number` (mutable).\n // `f(n)` bisa dipanggil berkali-kali\n f(n);\n}\n')),(0,r.kt)("p",null,"Parameter ke-2 fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"do_something_with_number_v2")," adalah closure yang me-mutate nilai ",(0,r.kt)("inlineCode",{parentName:"p"},"number"),", berarti terjadi mutable borrow karena variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," berada di luar block closure. Karena alasan tersebut maka closure harus dideklarasikan menggunakan ",(0,r.kt)("inlineCode",{parentName:"p"},"FnMut")," (bukan ",(0,r.kt)("inlineCode",{parentName:"p"},"Fn"),")."),(0,r.kt)("p",null,"Jika dipaksa deklarasi menggunakan ",(0,r.kt)("inlineCode",{parentName:"p"},"Fn"),", hasilnya pasti error."),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Closure",src:t(2212).Z,width:"673",height:"274"})),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"FnMut")," merupakan supertrait dari ",(0,r.kt)("inlineCode",{parentName:"p"},"Fn"),", artinya closure dengan trait ",(0,r.kt)("inlineCode",{parentName:"p"},"Fn")," juga bisa digunakan sebagai argument pemanggilan fungsi di mana parameter fungsi tersebut bertipe ",(0,r.kt)("inlineCode",{parentName:"p"},"FnMut"),"."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai supertrait dibahas pada chpater ",(0,r.kt)("a",{parentName:"p",href:"#/wip/supertrait"},"Supertrait"))),(0,r.kt)("h2",{id:"a493-trait-fnonce"},"A.49.3. Trait ",(0,r.kt)("inlineCode",{parentName:"h2"},"FnOnce")),(0,r.kt)("p",null,"Trait ",(0,r.kt)("inlineCode",{parentName:"p"},"FnOnce")," (",(0,r.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/std/ops/trait.FnOnce.html"},"std::ops::FnOnce"),") adalah trait yang menjadikan suatu closure hanya boleh di akses sekali saja, dan closure tersebut bisa berisi operasi mutable ataupun tidak."),(0,r.kt)("p",null,"Contoh penerapan ",(0,r.kt)("inlineCode",{parentName:"p"},"FnOnce")," pada fungsi yang memiliki parameter closure."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let mut number = 1;\n do_something_with_number_v3(14, |x| number += x);\n println!("number: {number}");\n}\n\nfn do_something_with_number_v3<F>(n: i32, f: F)\nwhere\n F: FnOnce(i32), // <----- FnOnce digunakan\n{\n f(n);\n}\n')),(0,r.kt)("p",null,"Jika closure dengan tipe ",(0,r.kt)("inlineCode",{parentName:"p"},"FnOnce")," dipaksa diakses dua kali, pasti muncul error. Contohnya bisa dilihat pada parameter ",(0,r.kt)("inlineCode",{parentName:"p"},"f")," berikut."),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"lazy",alt:"Closure",src:t(1385).Z,width:"506",height:"395"})),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai supertrait dibahas pada chpater ",(0,r.kt)("a",{parentName:"p",href:"#/wip/supertrait"},"Supertrait"))),(0,r.kt)("h2",{id:"a494-relasi-antara-trait-function-dengan-function"},"A.49.4. Relasi antara trait function dengan function"),(0,r.kt)("p",null,"Trait ",(0,r.kt)("inlineCode",{parentName:"p"},"Fn"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"FnMut"),", dan juga ",(0,r.kt)("inlineCode",{parentName:"p"},"FnOnce")," tidak hanya ter-implement pada closure, tapi juga ter-implement pada fungsi juga (secara otomatis)."),(0,r.kt)("p",null,"Contohnya bisa dilihat pada contoh berikut. Fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"do_something_with_number_v1")," dipanggil 3 kali."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Pemanggilan pertama, argument ",(0,r.kt)("inlineCode",{parentName:"li"},"f")," diisi dengan closure ",(0,r.kt)("inlineCode",{parentName:"li"},"|d: i32| d * 2")),(0,r.kt)("li",{parentName:"ul"},"Pemanggilan kedua, argument ",(0,r.kt)("inlineCode",{parentName:"li"},"f")," diisi dengan fungsi ",(0,r.kt)("inlineCode",{parentName:"li"},"double")),(0,r.kt)("li",{parentName:"ul"},"Pemanggilan ketiga, argument ",(0,r.kt)("inlineCode",{parentName:"li"},"f")," diisi dengan fungsi ",(0,r.kt)("inlineCode",{parentName:"li"},"pow_number"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let result = do_something_with_number_v1(13, |d: i32| d * 2);\n println!("result: {result}");\n \n let result = do_something_with_number_v1(13, double);\n println!("result: {result}");\n \n let result = do_something_with_number_v1(13, pow_number);\n println!("result: {result}");\n}\n\nfn do_something_with_number_v1<F>(n: i32, f: F) -> i32\nwhere\n F: Fn(i32) -> i32,\n{\n return f(n);\n}\n\nfn double(d: i32) -> i32 {\n d * 2\n}\n\nfn pow_number(d: i32) -> i32 {\n d.pow(2)\n}\n')),(0,r.kt)("p",null,"Dari contoh di atas terbukti bahwa fungsi ",(0,r.kt)("inlineCode",{parentName:"p"},"double")," dan juga ",(0,r.kt)("inlineCode",{parentName:"p"},"pow_number")," memenuhi kriteria tipe ",(0,r.kt)("inlineCode",{parentName:"p"},"F")," yaitu ",(0,r.kt)("inlineCode",{parentName:"p"},"Fn(i32) -> i32"),"."),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"lazy",alt:"Closure",src:t(2795).Z,width:"450",height:"143"})),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,r.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,r.kt)("pre",null,(0,r.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/trait_function"},"github.com/novalagung/dasarpemrogramanrust-example/../trait_function")),(0,r.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/basic/function"},"Function")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/basic/closures"},"Closures"))),(0,r.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch13-01-closures.html"},"https://doc.rust-lang.org/book/ch13-01-closures.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/beta/rust-by-example/fn/closures.html"},"https://doc.rust-lang.org/beta/rust-by-example/fn/closures.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/ops/trait.Fn.html"},"https://doc.rust-lang.org/std/ops/trait.Fn.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/ops/trait.FnMut.html"},"https://doc.rust-lang.org/std/ops/trait.FnMut.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/ops/trait.FnOnce.html"},"https://doc.rust-lang.org/std/ops/trait.FnOnce.html"))))}m.isMDXComponent=!0},2212:(e,n,t)=>{t.d(n,{Z:()=>a});const a=t.p+"assets/images/trait-function-1-69d13024d5321866a37aa3bb1f72a1b2.png"},1385:(e,n,t)=>{t.d(n,{Z:()=>a});const a=t.p+"assets/images/trait-function-2-5f9002b90d061f7ad1815a678e71f312.png"},2795:(e,n,t)=>{t.d(n,{Z:()=>a});const a="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAACPCAIAAADmy0wUAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIEN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AAAGQUAAGQUAOAy/A82p+fN3SYAAgAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/d8837387.31f2a62c.js b/assets/js/d8837387.31f2a62c.js deleted file mode 100644 index 674fa912..00000000 --- a/assets/js/d8837387.31f2a62c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4622],{3905:(a,t,A)=>{A.d(t,{Zo:()=>g,kt:()=>b});var e=A(7294);function i(a,t,A){return t in a?Object.defineProperty(a,t,{value:A,enumerable:!0,configurable:!0,writable:!0}):a[t]=A,a}function n(a,t){var A=Object.keys(a);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(a);t&&(e=e.filter((function(t){return Object.getOwnPropertyDescriptor(a,t).enumerable}))),A.push.apply(A,e)}return A}function l(a){for(var t=1;t<arguments.length;t++){var A=null!=arguments[t]?arguments[t]:{};t%2?n(Object(A),!0).forEach((function(t){i(a,t,A[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(A)):n(Object(A)).forEach((function(t){Object.defineProperty(a,t,Object.getOwnPropertyDescriptor(A,t))}))}return a}function r(a,t){if(null==a)return{};var A,e,i=function(a,t){if(null==a)return{};var A,e,i={},n=Object.keys(a);for(e=0;e<n.length;e++)A=n[e],t.indexOf(A)>=0||(i[A]=a[A]);return i}(a,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);for(e=0;e<n.length;e++)A=n[e],t.indexOf(A)>=0||Object.prototype.propertyIsEnumerable.call(a,A)&&(i[A]=a[A])}return i}var p=e.createContext({}),d=function(a){var t=e.useContext(p),A=t;return a&&(A="function"==typeof a?a(t):l(l({},t),a)),A},g=function(a){var t=d(a.components);return e.createElement(p.Provider,{value:t},a.children)},m={inlineCode:"code",wrapper:function(a){var t=a.children;return e.createElement(e.Fragment,{},t)}},k=e.forwardRef((function(a,t){var A=a.components,i=a.mdxType,n=a.originalType,p=a.parentName,g=r(a,["components","mdxType","originalType","parentName"]),k=d(A),b=i,c=k["".concat(p,".").concat(b)]||k[b]||m[b]||n;return A?e.createElement(c,l(l({ref:t},g),{},{components:A})):e.createElement(c,l({ref:t},g))}));function b(a,t){var A=arguments,i=t&&t.mdxType;if("string"==typeof a||i){var n=A.length,l=new Array(n);l[0]=k;var r={};for(var p in t)hasOwnProperty.call(t,p)&&(r[p]=t[p]);r.originalType=a,r.mdxType="string"==typeof a?a:i,l[1]=r;for(var d=2;d<n;d++)l[d]=A[d];return e.createElement.apply(null,l)}return e.createElement.apply(null,A)}k.displayName="MDXCreateElement"},8007:(a,t,A)=>{A.r(t),A.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>n,metadata:()=>r,toc:()=>d});var e=A(7462),i=(A(7294),A(3905));const n={sidebar_position:6,title:"A.6. Tipe Data \u279c String Literal (&str)",sidebar_label:"A.6. Tipe Data \u279c String Literal (&str)"},l=void 0,r={unversionedId:"basic/tipe-data-string-literal",id:"basic/tipe-data-string-literal",title:"A.6. Tipe Data \u279c String Literal (&str)",description:"String adalah tipe data penting dalam pemrograman manapun. Biasanya tiap bahasa punya cara berbeda dalam meng-handle tipe ini. Di bahasa Rust, ada dua jenis tipe data string:",source:"@site/docs/basic/tipe-data-string-literal.md",sourceDirName:"basic",slug:"/basic/tipe-data-string-literal",permalink:"/basic/tipe-data-string-literal",draft:!1,tags:[],version:"current",sidebarPosition:6,frontMatter:{sidebar_position:6,title:"A.6. Tipe Data \u279c String Literal (&str)",sidebar_label:"A.6. Tipe Data \u279c String Literal (&str)"},sidebar:"tutorialSidebar",previous:{title:"A.5. Tipe Data \u279c Primitive Scalar",permalink:"/basic/tipe-data-primitive-scalar"},next:{title:"A.7. Konstanta",permalink:"/basic/konstanta"}},p={},d=[{value:"A.6.1. String literal atau <code>&str</code>",id:"a61-string-literal-atau-str",level:2},{value:"A.6.2. Escape karakter menggunakan <code></code>",id:"a62-escape-karakter-menggunakan-",level:2},{value:"A.6.3. Multiline string literal",id:"a63-multiline-string-literal",level:2},{value:"A.6.4. Raw string",id:"a64-raw-string",level:2},{value:"A.6.5. Pembahasan lanjutan tentang string",id:"a65-pembahasan-lanjutan-tentang-string",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],g={toc:d};function m(a){let{components:t,...n}=a;return(0,i.kt)("wrapper",(0,e.Z)({},g,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"String adalah tipe data penting dalam pemrograman manapun. Biasanya tiap bahasa punya cara berbeda dalam meng-handle tipe ini. Di bahasa Rust, ada dua jenis tipe data string:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Tipe string literal (kadang disebut dengan string slice, atau ",(0,i.kt)("inlineCode",{parentName:"li"},"&str"),"). Tipe data ini ada pada nilai yang dideklarasikan dengan diapit tanda petik dua (string literal), contohnya ",(0,i.kt)("inlineCode",{parentName:"li"},'"Hello, world!"'),"."),(0,i.kt)("li",{parentName:"ul"},"Tipe ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," yang merupakan tipe data custom atau ",(0,i.kt)("em",{parentName:"li"},"custom types")," yang merupakan sebuah struct. Lebih jelasnya akan kita bahas pada chapter terpisah.")),(0,i.kt)("p",null,"Chapter ini hanya fokus pada string literal, dengan level pembahasan yang tidak terlalu advance."),(0,i.kt)("h2",{id:"a61-string-literal-atau-str"},"A.6.1. String literal atau ",(0,i.kt)("inlineCode",{parentName:"h2"},"&str")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Kita tidak akan bahas terlalu low-level untuk topik ini, karena memang masih di chapter awal-awal.")),(0,i.kt)("p",null,"Rust adalah bahasa yang ",(0,i.kt)("em",{parentName:"p"},"statically typed"),", tipe data harus diketahui saat kompilasi. Setiap pendefinisian variabel, entah itu dengan di-specify tipe datanya (contoh: ",(0,i.kt)("inlineCode",{parentName:"p"},"let x: i32 = 5"),") atau menggunakan teknik ",(0,i.kt)("em",{parentName:"p"},"type inference")," (contoh: ",(0,i.kt)("inlineCode",{parentName:"p"},"let x = 5"),"), tipe datanya akan diketahui di awal saat kompilasi program."),(0,i.kt)("p",null,"Begitu juga pada tipe string. Sebagai contoh, statement ",(0,i.kt)("inlineCode",{parentName:"p"},'let y = "hello"'),", variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"y")," di sini memiliki tipe data, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),"."),(0,i.kt)("p",null,"Apa itu tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),"? Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"str")," merupakan salah satu tipe primitif yang ada di Rust. Penulisan ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," menandakan bahwa tipe tersebut adalah ",(0,i.kt)("strong",{parentName:"p"},"pointer ",(0,i.kt)("inlineCode",{parentName:"strong"},"str")),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Untuk pembahasan lebih detail mengenai tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"&")," pada tipe data akan dibahas pada chapter terpisah, ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"))),(0,i.kt)("p",null,"Untuk kawan-kawan yang menggunakan VSCode dengan ekstensi ",(0,i.kt)("inlineCode",{parentName:"p"},"rust-analyzer"),", tipe data variabel bisa terlihat saat definisi."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"rust string literal",src:A(7031).Z,width:"299",height:"146"})),(0,i.kt)("p",null,"Ok, sampai sini yang paling penting adalah dipahami dulu bahwa string literal tipe datanya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),". Jadi selanjutnya kalau melihat tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," jangan bingung, itu berarti string."),(0,i.kt)("h2",{id:"a62-escape-karakter-menggunakan-"},"A.6.2. Escape karakter menggunakan ",(0,i.kt)("inlineCode",{parentName:"h2"},"\\")),(0,i.kt)("p",null,"Tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"\\")," digunakan untuk ",(0,i.kt)("em",{parentName:"p"},"escape")," beberapa karakter string."),(0,i.kt)("p",null,"Silakan perhatikan contoh berikut. Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"var2")," isinya adalah string yang di dalamnya ada beberapa karakter yang di escape, yaitu tanda ",(0,i.kt)("inlineCode",{parentName:"p"},'"')," dan baris baru atau newline."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let var2 = "hello \\\n \\"rust\\" \\\n and \\\n \\"world\\"";\nprintln!("{}", var2);\n')),(0,i.kt)("p",null,"Coba jalankan kode di atas."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"rust string literal",src:A(6028).Z,width:"445",height:"115"})),(0,i.kt)("p",null,"Karena semua baris baru pada contoh di atas di-escape, jadinya string akan tetap 1 baris. Tanda ",(0,i.kt)("inlineCode",{parentName:"p"},'"')," juga tetap muncul karena di-escape."),(0,i.kt)("h2",{id:"a63-multiline-string-literal"},"A.6.3. Multiline string literal"),(0,i.kt)("p",null,"Penulisan string banyak baris atau ",(0,i.kt)("em",{parentName:"p"},"multiline string")," adalah sama seperti penulisan string biasa, yaitu langsung tulis saja string dengan diapit tanda ",(0,i.kt)("inlineCode",{parentName:"p"},'"'),", tambahkan baris baru di dalam string tersebut sesuai kebutuhan."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let var3 = "baris satu\nbaris dua\nbaris tiga";\nprintln!("{}", var3);\n')),(0,i.kt)("p",null,"Hasilnya adalah sesuai dengan string yang sudah didefinisikan."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"rust string literal",src:A(1664).Z,width:"452",height:"129"})),(0,i.kt)("p",null,"Perlu diketahui bahwa karakter spasi, baris baru, dan lainnya adalah ",(0,i.kt)("strong",{parentName:"p"},"tidak dihiraukan"),", jadi jika kawan-kawan menuliskan string multiline seperti ini ..."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let var4 = "baris satu\n baris dua\n baris tiga";\nprintln!("{}", var4);\n')),(0,i.kt)("p",null,"... maka hasilnya juga sesuai dengan yang ditulis, yaitu ada 4 karakter spasi di baris ke-2 dan ke-3."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"rust string literal",src:A(8353).Z,width:"449",height:"130"})),(0,i.kt)("h2",{id:"a64-raw-string"},"A.6.4. Raw string"),(0,i.kt)("p",null,"Raw string adalah istilah untuk string yang tidak meng-",(0,i.kt)("em",{parentName:"p"},"escape")," karakter apapun. Di Rust, string literal bisa didefinisikan dengan menuliskan string diapit ",(0,i.kt)("inlineCode",{parentName:"p"},'r#"')," dan ",(0,i.kt)("inlineCode",{parentName:"p"},'"#'),". Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let var5 = r#"\n {\n "name": "tim drake",\n "gender": "male"\n }\n"#;\nprintln!("{}", var5);\n')),(0,i.kt)("p",null,"Kode di atas hasilnya adalah ekuivalen dengan kode di bawah ini, yang mana string didefinisikan dengan meng-escape karakter ",(0,i.kt)("inlineCode",{parentName:"p"},'"')," menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"\\"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let var6 = "\n {\n \\"name\\": \\"cassandra cain\\",\n \\"gender\\": \\"female\\"\n }\n";\nprintln!("{}", var6);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"raw string literal",src:A(8532).Z,width:"430",height:"260"})),(0,i.kt)("h2",{id:"a65-pembahasan-lanjutan-tentang-string"},"A.6.5. Pembahasan lanjutan tentang string"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"String adalah salah satu topik yang sangat luas cakupan pembahasannya"),", tidak cukup jika dirangkum dalam 1 chapter. Selain itu, bisa bikin makin bingung jika dibahas sekarang."),(0,i.kt)("p",null,"Penulis anjurkan untuk mempelajari chapter-chapter berikutnya secara urut terlebih dahulu."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/tipe_data_string_literal"},"github.com/novalagung/dasarpemrogramanrust-example/../tipe_data_string_literal")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/pointer-references"},"Pointer & References")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/string-slice-vs-string-literal"},"String Literal (&str) vs. String Custom Type")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/tipe-data-custom-type-string-slice"},"Tipe Data \u279c String Custom Type"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/tokens.html#raw-string-literals"},"https://doc.rust-lang.org/reference/tokens.html#raw-string-literals")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/str/index.html"},"https://doc.rust-lang.org/std/str/index.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/first-edition/strings.html"},"https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/first-edition/strings.html"))))}m.isMDXComponent=!0},7031:(a,t,A)=>{A.d(t,{Z:()=>e});const e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASsAAACSCAIAAACSdHvqAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF5WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMDctMjlUMTk6MDM6MjUrMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyLTEyLTA1VDE4OjI0OjMxKzA3Oj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FQ4c0B1ykikF4D7b1crvq4xdMwf7UPjxdNk2XNn/delDvH7xVPhhysuaaHqMgvWSFNhesMBoMLZKvSGg79VFQaTVXxE0C3LoqI2GvgO40a3OcKHwtfLVCisrtKkmWuECgEVrq9CqdxRVbjOISguKVuWSUPQ8UPx6zNVmG3S9DVChYAKN1ChcwJQrwqL79mYfq5QWpLUzvwgdPhQ/HqmQ9xTdJoKk02avkazVOi2GwAVGgfI7lXhN70qHM7Zm8fHs64gu0uKlt23Mxhhel4JR53a1wXFOJdqu2u32gBZmueia5RSdnZRlI6ACuHYiCcLAFAhHMqCeBBQIQAAKgQAQIUAAKgQAAAVAgCgQp/KYXZTHkGul2w4hr4scOlUyobZppMBUCEqtH9decJ3vhBRIcDVq7ByrueUuVYKea3zUK5proSnAuxdhXoZE2XLxIGsBZmmYp6rEnSabNWskNfgy1GTLGG0vssiFRbF1gKgwp2L0EkaGJ+4DQNZCzNNozxXMeh0cRXGsWFDiRY2SQmjNYenlsbWAqDCazChH9kSBrKWpFfJea72+KqFV6uvAMM1UgMm1DIwWt11YmsBUGF1nFIwqP/8QXOBCpU811VdEahQXCNNhcbw1PViawFQ4TrSiN90JJRsRSoUKr6tVSjFpMqvKLCFpxKXCnA7KtStl35RRzLTVL6NpFCFy142UWJSFRXaw1ORIcANVoXyJWBHcMZM08SrMjdSodQkZYBsDk89FcbWAqDCa6kKuRAKAEdUoV89MeQDAAbI3CgMAEdVIQAAKgQAQIUAAKgQAGDXKrzcscadLQBAVcgz/gCACsP0EwAAVAgAgAoBAA6qQpKgAAAV9jbkiTgAOPgAmUvIAIAKqQcBABWiQgBAhagQAFAhpwoB4NAq7N+aQU0IAAyQAQBQIQAAKgQAQIUAAKgQAAAVAgCgQgAAVAgAgAoBAFAhAAAqBABAhQAAqBAAABUCANwG/wPCySSNXW5ZPQAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/d8837387.cbb6525d.js b/assets/js/d8837387.cbb6525d.js new file mode 100644 index 00000000..3d3e6a6a --- /dev/null +++ b/assets/js/d8837387.cbb6525d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4622],{3905:(a,t,A)=>{A.d(t,{Zo:()=>g,kt:()=>b});var e=A(7294);function i(a,t,A){return t in a?Object.defineProperty(a,t,{value:A,enumerable:!0,configurable:!0,writable:!0}):a[t]=A,a}function n(a,t){var A=Object.keys(a);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(a);t&&(e=e.filter((function(t){return Object.getOwnPropertyDescriptor(a,t).enumerable}))),A.push.apply(A,e)}return A}function l(a){for(var t=1;t<arguments.length;t++){var A=null!=arguments[t]?arguments[t]:{};t%2?n(Object(A),!0).forEach((function(t){i(a,t,A[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(A)):n(Object(A)).forEach((function(t){Object.defineProperty(a,t,Object.getOwnPropertyDescriptor(A,t))}))}return a}function r(a,t){if(null==a)return{};var A,e,i=function(a,t){if(null==a)return{};var A,e,i={},n=Object.keys(a);for(e=0;e<n.length;e++)A=n[e],t.indexOf(A)>=0||(i[A]=a[A]);return i}(a,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);for(e=0;e<n.length;e++)A=n[e],t.indexOf(A)>=0||Object.prototype.propertyIsEnumerable.call(a,A)&&(i[A]=a[A])}return i}var p=e.createContext({}),d=function(a){var t=e.useContext(p),A=t;return a&&(A="function"==typeof a?a(t):l(l({},t),a)),A},g=function(a){var t=d(a.components);return e.createElement(p.Provider,{value:t},a.children)},m={inlineCode:"code",wrapper:function(a){var t=a.children;return e.createElement(e.Fragment,{},t)}},k=e.forwardRef((function(a,t){var A=a.components,i=a.mdxType,n=a.originalType,p=a.parentName,g=r(a,["components","mdxType","originalType","parentName"]),k=d(A),b=i,c=k["".concat(p,".").concat(b)]||k[b]||m[b]||n;return A?e.createElement(c,l(l({ref:t},g),{},{components:A})):e.createElement(c,l({ref:t},g))}));function b(a,t){var A=arguments,i=t&&t.mdxType;if("string"==typeof a||i){var n=A.length,l=new Array(n);l[0]=k;var r={};for(var p in t)hasOwnProperty.call(t,p)&&(r[p]=t[p]);r.originalType=a,r.mdxType="string"==typeof a?a:i,l[1]=r;for(var d=2;d<n;d++)l[d]=A[d];return e.createElement.apply(null,l)}return e.createElement.apply(null,A)}k.displayName="MDXCreateElement"},8007:(a,t,A)=>{A.r(t),A.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>n,metadata:()=>r,toc:()=>d});var e=A(7462),i=(A(7294),A(3905));const n={sidebar_position:6,title:"A.6. Tipe Data \u279c String Literal (&str)",sidebar_label:"A.6. Tipe Data \u279c String Literal (&str)"},l=void 0,r={unversionedId:"basic/tipe-data-string-literal",id:"basic/tipe-data-string-literal",title:"A.6. Tipe Data \u279c String Literal (&str)",description:"String adalah tipe data penting dalam pemrograman manapun. Biasanya tiap bahasa punya cara berbeda dalam meng-handle tipe ini. Di bahasa Rust, ada dua jenis tipe data string:",source:"@site/docs/basic/tipe-data-string-literal.md",sourceDirName:"basic",slug:"/basic/tipe-data-string-literal",permalink:"/basic/tipe-data-string-literal",draft:!1,tags:[],version:"current",sidebarPosition:6,frontMatter:{sidebar_position:6,title:"A.6. Tipe Data \u279c String Literal (&str)",sidebar_label:"A.6. Tipe Data \u279c String Literal (&str)"},sidebar:"tutorialSidebar",previous:{title:"A.5. Tipe Data \u279c Primitive Scalar",permalink:"/basic/tipe-data-primitive-scalar"},next:{title:"A.7. Konstanta",permalink:"/basic/konstanta"}},p={},d=[{value:"A.6.1. String literal atau <code>&str</code>",id:"a61-string-literal-atau-str",level:2},{value:"A.6.2. Escape karakter menggunakan <code></code>",id:"a62-escape-karakter-menggunakan-",level:2},{value:"A.6.3. Multiline string literal",id:"a63-multiline-string-literal",level:2},{value:"A.6.4. Raw string",id:"a64-raw-string",level:2},{value:"A.6.5. Pembahasan lanjutan tentang string",id:"a65-pembahasan-lanjutan-tentang-string",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],g={toc:d};function m(a){let{components:t,...n}=a;return(0,i.kt)("wrapper",(0,e.Z)({},g,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"String adalah tipe data penting dalam pemrograman manapun. Biasanya tiap bahasa punya cara berbeda dalam meng-handle tipe ini. Di bahasa Rust, ada dua jenis tipe data string:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Tipe string literal (kadang disebut dengan string slice, atau ",(0,i.kt)("inlineCode",{parentName:"li"},"&str"),"). Tipe data ini ada pada nilai yang dideklarasikan dengan diapit tanda petik dua (string literal), contohnya ",(0,i.kt)("inlineCode",{parentName:"li"},'"Hello, world!"'),"."),(0,i.kt)("li",{parentName:"ul"},"Tipe ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," yang merupakan tipe data custom atau ",(0,i.kt)("em",{parentName:"li"},"custom types")," yang merupakan sebuah struct. Lebih jelasnya akan kita bahas pada chapter terpisah.")),(0,i.kt)("p",null,"Chapter ini hanya fokus pada string literal, dengan level pembahasan yang tidak terlalu advance."),(0,i.kt)("h2",{id:"a61-string-literal-atau-str"},"A.6.1. String literal atau ",(0,i.kt)("inlineCode",{parentName:"h2"},"&str")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Kita tidak akan bahas terlalu low-level untuk topik ini, karena memang masih di chapter awal-awal.")),(0,i.kt)("p",null,"Rust adalah bahasa yang ",(0,i.kt)("em",{parentName:"p"},"statically typed"),", tipe data harus diketahui saat kompilasi. Setiap pendefinisian variabel, entah itu dengan di-specify tipe datanya (contoh: ",(0,i.kt)("inlineCode",{parentName:"p"},"let x: i32 = 5"),") atau menggunakan teknik ",(0,i.kt)("em",{parentName:"p"},"type inference")," (contoh: ",(0,i.kt)("inlineCode",{parentName:"p"},"let x = 5"),"), tipe datanya akan diketahui di awal saat kompilasi program."),(0,i.kt)("p",null,"Begitu juga pada tipe string. Sebagai contoh, statement ",(0,i.kt)("inlineCode",{parentName:"p"},'let y = "hello"'),", variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"y")," di sini memiliki tipe data, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),"."),(0,i.kt)("p",null,"Apa itu tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),"? Tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"str")," merupakan salah satu tipe primitif yang ada di Rust. Penulisan ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," menandakan bahwa tipe tersebut adalah ",(0,i.kt)("strong",{parentName:"p"},"pointer ",(0,i.kt)("inlineCode",{parentName:"strong"},"str")),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Untuk pembahasan lebih detail mengenai tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"&")," pada tipe data akan dibahas pada chapter terpisah, ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"))),(0,i.kt)("p",null,"Untuk kawan-kawan yang menggunakan VSCode dengan ekstensi ",(0,i.kt)("inlineCode",{parentName:"p"},"rust-analyzer"),", tipe data variabel bisa terlihat saat definisi."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"rust string literal",src:A(7031).Z,width:"299",height:"146"})),(0,i.kt)("p",null,"Ok, sampai sini yang paling penting adalah dipahami dulu bahwa string literal tipe datanya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"&str"),". Jadi selanjutnya kalau melihat tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," jangan bingung, itu berarti string."),(0,i.kt)("h2",{id:"a62-escape-karakter-menggunakan-"},"A.6.2. Escape karakter menggunakan ",(0,i.kt)("inlineCode",{parentName:"h2"},"\\")),(0,i.kt)("p",null,"Tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"\\")," digunakan untuk ",(0,i.kt)("em",{parentName:"p"},"escape")," beberapa karakter string."),(0,i.kt)("p",null,"Silakan perhatikan contoh berikut. Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"var2")," isinya adalah string yang di dalamnya ada beberapa karakter yang di escape, yaitu tanda ",(0,i.kt)("inlineCode",{parentName:"p"},'"')," dan baris baru atau newline."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let var2 = "hello \\\n \\"rust\\" \\\n and \\\n \\"world\\"";\nprintln!("{}", var2);\n')),(0,i.kt)("p",null,"Coba jalankan kode di atas."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"rust string literal",src:A(6028).Z,width:"445",height:"115"})),(0,i.kt)("p",null,"Karena semua baris baru pada contoh di atas di-escape, jadinya string akan tetap 1 baris. Tanda ",(0,i.kt)("inlineCode",{parentName:"p"},'"')," juga tetap muncul karena di-escape."),(0,i.kt)("h2",{id:"a63-multiline-string-literal"},"A.6.3. Multiline string literal"),(0,i.kt)("p",null,"Penulisan string banyak baris atau ",(0,i.kt)("em",{parentName:"p"},"multiline string")," adalah sama seperti penulisan string biasa, yaitu langsung tulis saja string dengan diapit tanda ",(0,i.kt)("inlineCode",{parentName:"p"},'"'),", tambahkan baris baru di dalam string tersebut sesuai kebutuhan."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let var3 = "baris satu\nbaris dua\nbaris tiga";\nprintln!("{}", var3);\n')),(0,i.kt)("p",null,"Hasilnya adalah sesuai dengan string yang sudah didefinisikan."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"rust string literal",src:A(1664).Z,width:"452",height:"129"})),(0,i.kt)("p",null,"Perlu diketahui bahwa karakter spasi, baris baru, dan lainnya adalah ",(0,i.kt)("strong",{parentName:"p"},"tidak dihiraukan"),", jadi jika kawan-kawan menuliskan string multiline seperti ini ..."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let var4 = "baris satu\n baris dua\n baris tiga";\nprintln!("{}", var4);\n')),(0,i.kt)("p",null,"... maka hasilnya juga sesuai dengan yang ditulis, yaitu ada 4 karakter spasi di baris ke-2 dan ke-3."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"rust string literal",src:A(8353).Z,width:"449",height:"130"})),(0,i.kt)("h2",{id:"a64-raw-string"},"A.6.4. Raw string"),(0,i.kt)("p",null,"Raw string adalah istilah untuk string yang tidak meng-",(0,i.kt)("em",{parentName:"p"},"escape")," karakter apapun. Di Rust, string literal bisa didefinisikan dengan menuliskan string diapit ",(0,i.kt)("inlineCode",{parentName:"p"},'r#"')," dan ",(0,i.kt)("inlineCode",{parentName:"p"},'"#'),". Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let var5 = r#"\n {\n "name": "tim drake",\n "gender": "male"\n }\n"#;\nprintln!("{}", var5);\n')),(0,i.kt)("p",null,"Kode di atas hasilnya adalah ekuivalen dengan kode di bawah ini, yang mana string didefinisikan dengan meng-escape karakter ",(0,i.kt)("inlineCode",{parentName:"p"},'"')," menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"\\"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let var6 = "\n {\n \\"name\\": \\"cassandra cain\\",\n \\"gender\\": \\"female\\"\n }\n";\nprintln!("{}", var6);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"raw string literal",src:A(8532).Z,width:"430",height:"260"})),(0,i.kt)("h2",{id:"a65-pembahasan-lanjutan-tentang-string"},"A.6.5. Pembahasan lanjutan tentang string"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"String adalah salah satu topik yang sangat luas cakupan pembahasannya"),", tidak cukup jika dirangkum dalam 1 chapter. Selain itu, bisa bikin makin bingung jika dibahas sekarang."),(0,i.kt)("p",null,"Penulis anjurkan untuk mempelajari chapter-chapter berikutnya secara urut terlebih dahulu."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/tipe_data_string_literal"},"github.com/novalagung/dasarpemrogramanrust-example/../tipe_data_string_literal")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/pointer-references"},"Pointer & References")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/string-slice-vs-string-literal"},"String Literal (&str) vs. String Custom Type")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/tipe-data-custom-type-string-slice"},"Tipe Data \u279c String Custom Type"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/tokens.html#raw-string-literals"},"https://doc.rust-lang.org/reference/tokens.html#raw-string-literals")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/str/index.html"},"https://doc.rust-lang.org/std/str/index.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/first-edition/strings.html"},"https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/first-edition/strings.html"))))}m.isMDXComponent=!0},7031:(a,t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MBoMLZKvSGg79VFQaTVXxE0C3LoqI2GvgO40a3OcKHwtfLVCisrtKkmWuECgEVrq9CqdxRVbjOISguKVuWSUPQ8UPx6zNVmG3S9DVChYAKN1ChcwJQrwqL79mYfq5QWpLUzvwgdPhQ/HqmQ9xTdJoKk02avkazVOi2GwAVGgfI7lXhN70qHM7Zm8fHs64gu0uKlt23Mxhhel4JR53a1wXFOJdqu2u32gBZmueia5RSdnZRlI6ACuHYiCcLAFAhHMqCeBBQIQAAKgQAQIUAAKgQAAAVAgCgQp/KYXZTHkGul2w4hr4scOlUyobZppMBUCEqtH9decJ3vhBRIcDVq7ByrueUuVYKea3zUK5proSnAuxdhXoZE2XLxIGsBZmmYp6rEnSabNWskNfgy1GTLGG0vssiFRbF1gKgwp2L0EkaGJ+4DQNZCzNNozxXMeh0cRXGsWFDiRY2SQmjNYenlsbWAqDCazChH9kSBrKWpFfJea72+KqFV6uvAMM1UgMm1DIwWt11YmsBUGF1nFIwqP/8QXOBCpU811VdEahQXCNNhcbw1PViawFQ4TrSiN90JJRsRSoUKr6tVSjFpMqvKLCFpxKXCnA7KtStl35RRzLTVL6NpFCFy142UWJSFRXaw1ORIcANVoXyJWBHcMZM08SrMjdSodQkZYBsDk89FcbWAqDCa6kKuRAKAEdUoV89MeQDAAbI3CgMAEdVIQAAKgQAQIUAAKgQAGDXKrzcscadLQBAVcgz/gCACsP0EwAAVAgAgAoBAA6qQpKgAAAV9jbkiTgAOPgAmUvIAIAKqQcBABWiQgBAhagQAFAhpwoB4NAq7N+aQU0IAAyQAQBQIQAAKgQAQIUAAKgQAAAVAgCgQgAAVAgAgAoBAFAhAAAqBABAhQAAqBAAABUCANwG/wPCySSNXW5ZPQAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/dabee7bd.7ac3877f.js b/assets/js/dabee7bd.647618a7.js similarity index 55% rename from assets/js/dabee7bd.7ac3877f.js rename to assets/js/dabee7bd.647618a7.js index 48e88f4f..df1e9218 100644 --- a/assets/js/dabee7bd.7ac3877f.js +++ b/assets/js/dabee7bd.647618a7.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4943],{3905:(e,a,t)=>{t.d(a,{Zo:()=>m,kt:()=>s});var n=t(7294);function r(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function i(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function l(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?i(Object(t),!0).forEach((function(a){r(e,a,t[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}))}return e}function p(e,a){if(null==e)return{};var t,n,r=function(e,a){if(null==e)return{};var t,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],a.indexOf(t)>=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],a.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var o=n.createContext({}),d=function(e){var a=n.useContext(o),t=a;return e&&(t="function"==typeof e?e(a):l(l({},a),e)),t},m=function(e){var a=d(e.components);return n.createElement(o.Provider,{value:a},e.children)},u={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},k=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),k=d(t),s=r,c=k["".concat(o,".").concat(s)]||k[s]||u[s]||i;return t?n.createElement(c,l(l({ref:a},m),{},{components:t})):n.createElement(c,l({ref:a},m))}));function s(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var i=t.length,l=new Array(i);l[0]=k;var p={};for(var o in a)hasOwnProperty.call(a,o)&&(p[o]=a[o]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var d=2;d<i;d++)l[d]=t[d];return n.createElement.apply(null,l)}return n.createElement.apply(null,t)}k.displayName="MDXCreateElement"},3296:(e,a,t)=>{t.r(a),t.d(a,{assets:()=>o,contentTitle:()=>l,default:()=>u,frontMatter:()=>i,metadata:()=>p,toc:()=>d});var n=t(7462),r=(t(7294),t(3905));const i={sidebar_position:8,title:"A.8. Operator",sidebar_label:"A.8. Operator"},l=void 0,p={unversionedId:"basic/operator",id:"basic/operator",title:"A.8. Operator",description:"Chapter ini membahas mengenai operator pada pemrograman rust.",source:"@site/docs/basic/operator.md",sourceDirName:"basic",slug:"/basic/operator",permalink:"/basic/operator",draft:!1,tags:[],version:"current",sidebarPosition:8,frontMatter:{sidebar_position:8,title:"A.8. Operator",sidebar_label:"A.8. Operator"},sidebar:"tutorialSidebar",previous:{title:"A.7. Konstanta",permalink:"/basic/konstanta"},next:{title:"A.9. Seleksi Kondisi \u279c if, else if, else",permalink:"/basic/seleksi-kondisi-if"}},o={},d=[{value:"A.8.1. Operator aritmatika",id:"a81-operator-aritmatika",level:2},{value:"A.8.2. Operator perbandingan",id:"a82-operator-perbandingan",level:2},{value:"\u25c9 <em>Named argument</em> macro <code>println</code>",id:"-named-argument-macro-println",level:3},{value:"A.8.3. Operator negasi",id:"a83-operator-negasi",level:2},{value:"A.8.4. Operator logika / <code>bool</code>",id:"a84-operator-logika--bool",level:2},{value:"\u25c9 <em>Whitespace character</em> tab <code>\t</code>",id:"-whitespace-character-tab-t",level:3},{value:"A.8.5. Operator reference dan dereference",id:"a85-operator-reference-dan-dereference",level:2},{value:"A.8.6. Operator bitwise",id:"a86-operator-bitwise",level:2},{value:"A.8.7. Operator lainnya",id:"a87-operator-lainnya",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:d};function u(e){let{components:a,...i}=e;return(0,r.kt)("wrapper",(0,n.Z)({},m,i,{components:a,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Chapter ini membahas mengenai operator pada pemrograman rust."),(0,r.kt)("h2",{id:"a81-operator-aritmatika"},"A.8.1. Operator aritmatika"),(0,r.kt)("p",null,"Berikut merupakan list operator untuk operasi aritmatika beserta contoh penerapannya di rust."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"Simbol"),(0,r.kt)("th",{parentName:"tr",align:null},"Kegunaan"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"+")),(0,r.kt)("td",{parentName:"tr",align:null},"penambahan")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"-")),(0,r.kt)("td",{parentName:"tr",align:null},"pengurangan")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"*")),(0,r.kt)("td",{parentName:"tr",align:null},"pengalian")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"/")),(0,r.kt)("td",{parentName:"tr",align:null},"pembagian")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"%")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("em",{parentName:"td"},"modulus")," atau sisa hasil bagi")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'let (num1, num2) = (12, 4);\n\nlet value_addition = num1 + num2;\nprintln!("{} + {} = {}", num1, num2, value_addition);\n// output => 12 + 4 = 16\n\nlet value_sub = num1 - num2;\nprintln!("{} - {} = {}", num1, num2, value_sub);\n// output => 12 - 4 = 8\n\nlet value_mut = num1 * num2;\nprintln!("{} * {} = {}", num1, num2, value_mut);\n// output => 12 * 4 = 48\n\nlet value_div = num1 / num2;\nprintln!("{} / {} = {}", num1, num2, value_div);\n// output => 12 / 4 = 3\n\nlet value_mod = num1 % num2;\nprintln!("{} % {} = {}", num1, num2, value_mod);\n// output => 12 % 4 = 0\n')),(0,r.kt)("h2",{id:"a82-operator-perbandingan"},"A.8.2. Operator perbandingan"),(0,r.kt)("p",null,"Operator perbandingan selalu menghasilkan nilai bertipe data ",(0,r.kt)("inlineCode",{parentName:"p"},"bool"),"."),(0,r.kt)("p",null,"Berikut merupakan list operator untuk operasi perbandingan beserta contoh penerapannya di rust."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"Simbol"),(0,r.kt)("th",{parentName:"tr",align:null},"Kegunaan untuk mengecek"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"==")),(0,r.kt)("td",{parentName:"tr",align:null},"apakah kiri sama dengan kanan?")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"!=")),(0,r.kt)("td",{parentName:"tr",align:null},"apakah kiri tidak sama dengan kanan?")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},">")),(0,r.kt)("td",{parentName:"tr",align:null},"apakah kiri lebih besar dari kanan?")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"<")),(0,r.kt)("td",{parentName:"tr",align:null},"apakah kiri lebih kecil dari kanan?")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},">=")),(0,r.kt)("td",{parentName:"tr",align:null},"apakah kiri lebih besar atau sama dengan kanan?")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"<=")),(0,r.kt)("td",{parentName:"tr",align:null},"apakah kiri lebih kecil atau sama dengan kanan?")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'let number_a = 12;\nlet number_b = 24;\n\nlet res_one = number_a == number_b;\nprintln!("res_one: {res_one}");\n\nlet res_two = number_a != number_b;\nprintln!("res_two: {res_two}");\n\nlet res_three = number_a > number_b;\nprintln!("res_three: {res_three}");\n\nlet res_four = number_a < number_b;\nprintln!("res_four: {res_four}");\n\nlet res_five = number_a >= number_b;\nprintln!("res_five: {res_five}");\n\nlet res_six = number_a <= number_b;\nprintln!("res_six: {res_six}");\n')),(0,r.kt)("p",null,"Pada contoh di atas, variabel di print menggunakan macro ",(0,r.kt)("inlineCode",{parentName:"p"},"println")," tanpa disisipkan paramnya. Penjelasannya ada di bawah ini."),(0,r.kt)("h3",{id:"-named-argument-macro-println"},"\u25c9 ",(0,r.kt)("em",{parentName:"h3"},"Named argument")," macro ",(0,r.kt)("inlineCode",{parentName:"h3"},"println")),(0,r.kt)("p",null,"Salah satu teknik ",(0,r.kt)("em",{parentName:"p"},"formatted print")," macro ",(0,r.kt)("inlineCode",{parentName:"p"},"println")," adalah dengan menerapkan ",(0,r.kt)("em",{parentName:"p"},"named argument"),". Yang biasanya menggunakan ",(0,r.kt)("inlineCode",{parentName:"p"},"{}")," atau ",(0,r.kt)("inlineCode",{parentName:"p"},"{1}"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"{2}"),", dan seterusnya, diganti dengan nama variabel yang diapit tanda kurung kurawal, contohnya ",(0,r.kt)("inlineCode",{parentName:"p"},"res_one"),". Dengan teknik ini maka jika variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"res_one")," ada, akan langsung mereplace argument ",(0,r.kt)("inlineCode",{parentName:"p"},"{res_one}")," tanpa perlu menyisipkan variabel tersebut saat pemanggilan macro ",(0,r.kt)("inlineCode",{parentName:"p"},"println"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'let res_one = number_a == number_b;\nprintln!("res_one: {res_one}");\n// output => res_one: false\n\nlet res_two = number_a != number_b;\nprintln!("res_two: {res_two}");\n// output => res_one: true\n')),(0,r.kt)("h2",{id:"a83-operator-negasi"},"A.8.3. Operator negasi"),(0,r.kt)("p",null,"Berikut merupakan list operator untuk operasi negasi beserta contoh penerapannya di rust."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"Simbol"),(0,r.kt)("th",{parentName:"tr",align:null},"Kegunaan"),(0,r.kt)("th",{parentName:"tr",align:null},"Catatan"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"-")),(0,r.kt)("td",{parentName:"tr",align:null},"negasi numerik"),(0,r.kt)("td",{parentName:"tr",align:null},"bisa digunakan pada tipe data integer dan float")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"!")),(0,r.kt)("td",{parentName:"tr",align:null},"logika ",(0,r.kt)("inlineCode",{parentName:"td"},"NOT")," atau bitwise ",(0,r.kt)("inlineCode",{parentName:"td"},"NOT")),(0,r.kt)("td",{parentName:"tr",align:null},"bisa digunakan pada tipe data integer dan bool")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'let (value_left, value_right) = (12, -12);\nlet res_one = -value_left == value_right;\nlet res_two = !(value_left == value_right);\nprintln!("{res_one} {res_two}");\n// output => true true\n')),(0,r.kt)("p",null,"Untuk menggunakan operator negasi pada tipe data numerik, caranya dengan langsung menambahkan prefix ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," pada angka atau variabel. Contohnya ",(0,r.kt)("inlineCode",{parentName:"p"},"-12")," atau ",(0,r.kt)("inlineCode",{parentName:"p"},"-value_left"),"."),(0,r.kt)("p",null,"Penggunaan operator logika ",(0,r.kt)("inlineCode",{parentName:"p"},"!")," juga sama, tinggal tambahkan saja sebagai prefix dari data ",(0,r.kt)("inlineCode",{parentName:"p"},"bool")," atau statement yang menghasilkan data ",(0,r.kt)("inlineCode",{parentName:"p"},"bool"),", contohnya ",(0,r.kt)("inlineCode",{parentName:"p"},"!(value_left == value_right)"),"."),(0,r.kt)("h2",{id:"a84-operator-logika--bool"},"A.8.4. Operator logika / ",(0,r.kt)("inlineCode",{parentName:"h2"},"bool")),(0,r.kt)("p",null,"Berikut merupakan list operator untuk operasi logika ",(0,r.kt)("inlineCode",{parentName:"p"},"bool")," beserta contoh penerapannya di rust."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"Simbol"),(0,r.kt)("th",{parentName:"tr",align:null},"Kegunaan"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"&&")),(0,r.kt)("td",{parentName:"tr",align:null},"logika ",(0,r.kt)("inlineCode",{parentName:"td"},"AND"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},"|","|"),(0,r.kt)("td",{parentName:"tr",align:null},"logika ",(0,r.kt)("inlineCode",{parentName:"td"},"OR"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"!")),(0,r.kt)("td",{parentName:"tr",align:null},"logika ",(0,r.kt)("inlineCode",{parentName:"td"},"NOT"))))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'let (bool_left, bool_right) = (false, true);\nprintln!("AND result \\t: {}", bool_left && bool_right);\nprintln!("OR result \\t: {}", bool_left || bool_right);\n')),(0,r.kt)("h3",{id:"-whitespace-character-tab-t"},"\u25c9 ",(0,r.kt)("em",{parentName:"h3"},"Whitespace character")," tab ",(0,r.kt)("inlineCode",{parentName:"h3"},"\\t")),(0,r.kt)("p",null,"Rust mendukung karakter standar whitespace seperti ",(0,r.kt)("inlineCode",{parentName:"p"},"\\t")," yang kegunaannya adalah untuk horizontal tab. Contoh penerapannya seperti pada kode di atas, tulis saja ",(0,r.kt)("inlineCode",{parentName:"p"},"\\t")," dalam string literal, hasilnya bisa dilihat saat di-print."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'println!("AND result \\t: {}", bool_left && bool_right);\nprintln!("OR result \\t: {}", bool_left || bool_right);\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"operator boolean",src:t(6032).Z,width:"381",height:"100"})),(0,r.kt)("h2",{id:"a85-operator-reference-dan-dereference"},"A.8.5. Operator reference dan dereference"),(0,r.kt)("p",null,"Untuk jenis operasi ini ada 3 buah operator yang bisa dipergunakan yaitu ",(0,r.kt)("inlineCode",{parentName:"p"},"*"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"&")," dan ",(0,r.kt)("inlineCode",{parentName:"p"},"&mut"),". Untuk sekarang kita tidak akan membahas topik ini karena masih terlalu awal. Nantinya kita akan kupas tuntas di chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"),". Sementara kita pelajari chapter per chapter secara berurutan dulu."),(0,r.kt)("h2",{id:"a86-operator-bitwise"},"A.8.6. Operator bitwise"),(0,r.kt)("p",null,"Rust mendukung operator bitwise standar yang ada di bahasa pemrograman."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"Simbol"),(0,r.kt)("th",{parentName:"tr",align:null},"Kegunaan"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"&")),(0,r.kt)("td",{parentName:"tr",align:null},"bitwise ",(0,r.kt)("inlineCode",{parentName:"td"},"AND"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("code",null,"|")),(0,r.kt)("td",{parentName:"tr",align:null},"bitwise ",(0,r.kt)("inlineCode",{parentName:"td"},"OR"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"^")),(0,r.kt)("td",{parentName:"tr",align:null},"bitwise ",(0,r.kt)("inlineCode",{parentName:"td"},"XOR"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"!")),(0,r.kt)("td",{parentName:"tr",align:null},"bitwise ",(0,r.kt)("inlineCode",{parentName:"td"},"NOT"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"<<")),(0,r.kt)("td",{parentName:"tr",align:null},"left shift")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},">>")),(0,r.kt)("td",{parentName:"tr",align:null},"right shift")))),(0,r.kt)("h2",{id:"a87-operator-lainnya"},"A.8.7. Operator lainnya"),(0,r.kt)("p",null,"Sebenarnya ada banyak lagi jenis operator di Rust programming, seperti type cast operator, reference/borrow operator, dll. Nantinya kita akan bahas operator tersebut satu per satu secara terpisah di chapter berbeda."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Type cast operator dibahas pada chapter ",(0,r.kt)("a",{parentName:"li",href:"/basic/type-alias-casting"},"Type Alias & Casting")),(0,r.kt)("li",{parentName:"ul"},"Reference/borrow operator dibahas pada chapter ",(0,r.kt)("a",{parentName:"li",href:"/basic/pointer-references"},"Pointer & References")),(0,r.kt)("li",{parentName:"ul"},"Operator ",(0,r.kt)("inlineCode",{parentName:"li"},"?")," dibahas pada chapter ",(0,r.kt)("a",{parentName:"li",href:"/basic/operator-tanda-tanya"},"Operator ?"))),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,r.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,r.kt)("pre",null,(0,r.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/operator"},"github.com/novalagung/dasarpemrogramanrust-example/../operator")),(0,r.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/basic/pointer-references"},"Pointer & References")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#/wip/macro"},"Macro")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#/wip/whitespace-token"},"Whitespace Token")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/basic/operator-tanda-tanya"},"Operator ?"))),(0,r.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/expressions/operator-expr.html"},"https://doc.rust-lang.org/reference/expressions/operator-expr.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/whitespace.html"},"https://doc.rust-lang.org/reference/whitespace.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/hello/print.html"},"https://doc.rust-lang.org/rust-by-example/hello/print.html"))))}u.isMDXComponent=!0},6032:(e,a,t)=>{t.d(a,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAX0AAABkCAIAAADltXfhAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb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self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4943],{3905:(e,a,t)=>{t.d(a,{Zo:()=>m,kt:()=>s});var n=t(7294);function r(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function i(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function l(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?i(Object(t),!0).forEach((function(a){r(e,a,t[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}))}return e}function p(e,a){if(null==e)return{};var t,n,r=function(e,a){if(null==e)return{};var t,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],a.indexOf(t)>=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],a.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var o=n.createContext({}),d=function(e){var a=n.useContext(o),t=a;return e&&(t="function"==typeof e?e(a):l(l({},a),e)),t},m=function(e){var a=d(e.components);return n.createElement(o.Provider,{value:a},e.children)},u={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},k=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),k=d(t),s=r,c=k["".concat(o,".").concat(s)]||k[s]||u[s]||i;return t?n.createElement(c,l(l({ref:a},m),{},{components:t})):n.createElement(c,l({ref:a},m))}));function s(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var i=t.length,l=new Array(i);l[0]=k;var p={};for(var o in a)hasOwnProperty.call(a,o)&&(p[o]=a[o]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var d=2;d<i;d++)l[d]=t[d];return n.createElement.apply(null,l)}return n.createElement.apply(null,t)}k.displayName="MDXCreateElement"},3296:(e,a,t)=>{t.r(a),t.d(a,{assets:()=>o,contentTitle:()=>l,default:()=>u,frontMatter:()=>i,metadata:()=>p,toc:()=>d});var n=t(7462),r=(t(7294),t(3905));const i={sidebar_position:8,title:"A.8. Operator",sidebar_label:"A.8. Operator"},l=void 0,p={unversionedId:"basic/operator",id:"basic/operator",title:"A.8. Operator",description:"Chapter ini membahas mengenai operator pada pemrograman rust.",source:"@site/docs/basic/operator.md",sourceDirName:"basic",slug:"/basic/operator",permalink:"/basic/operator",draft:!1,tags:[],version:"current",sidebarPosition:8,frontMatter:{sidebar_position:8,title:"A.8. Operator",sidebar_label:"A.8. Operator"},sidebar:"tutorialSidebar",previous:{title:"A.7. Konstanta",permalink:"/basic/konstanta"},next:{title:"A.9. Seleksi Kondisi \u279c if, else if, else",permalink:"/basic/seleksi-kondisi-if"}},o={},d=[{value:"A.8.1. Operator aritmatika",id:"a81-operator-aritmatika",level:2},{value:"A.8.2. Operator perbandingan",id:"a82-operator-perbandingan",level:2},{value:"\u25c9 <em>Named argument</em> macro <code>println</code>",id:"-named-argument-macro-println",level:3},{value:"A.8.3. Operator negasi",id:"a83-operator-negasi",level:2},{value:"A.8.4. Operator logika / <code>bool</code>",id:"a84-operator-logika--bool",level:2},{value:"\u25c9 <em>Whitespace character</em> tab <code>\t</code>",id:"-whitespace-character-tab-t",level:3},{value:"A.8.5. Operator reference dan dereference",id:"a85-operator-reference-dan-dereference",level:2},{value:"A.8.6. Operator bitwise",id:"a86-operator-bitwise",level:2},{value:"A.8.7. Operator lainnya",id:"a87-operator-lainnya",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:d};function u(e){let{components:a,...i}=e;return(0,r.kt)("wrapper",(0,n.Z)({},m,i,{components:a,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Chapter ini membahas mengenai operator pada pemrograman rust."),(0,r.kt)("h2",{id:"a81-operator-aritmatika"},"A.8.1. Operator aritmatika"),(0,r.kt)("p",null,"Berikut merupakan list operator untuk operasi aritmatika beserta contoh penerapannya di rust."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"Simbol"),(0,r.kt)("th",{parentName:"tr",align:null},"Kegunaan"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"+")),(0,r.kt)("td",{parentName:"tr",align:null},"penambahan")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"-")),(0,r.kt)("td",{parentName:"tr",align:null},"pengurangan")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"*")),(0,r.kt)("td",{parentName:"tr",align:null},"pengalian")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"/")),(0,r.kt)("td",{parentName:"tr",align:null},"pembagian")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"%")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("em",{parentName:"td"},"modulus")," atau sisa hasil bagi")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'let (num1, num2) = (12, 4);\n\nlet value_addition = num1 + num2;\nprintln!("{} + {} = {}", num1, num2, value_addition);\n// output => 12 + 4 = 16\n\nlet value_sub = num1 - num2;\nprintln!("{} - {} = {}", num1, num2, value_sub);\n// output => 12 - 4 = 8\n\nlet value_mut = num1 * num2;\nprintln!("{} * {} = {}", num1, num2, value_mut);\n// output => 12 * 4 = 48\n\nlet value_div = num1 / num2;\nprintln!("{} / {} = {}", num1, num2, value_div);\n// output => 12 / 4 = 3\n\nlet value_mod = num1 % num2;\nprintln!("{} % {} = {}", num1, num2, value_mod);\n// output => 12 % 4 = 0\n')),(0,r.kt)("h2",{id:"a82-operator-perbandingan"},"A.8.2. Operator perbandingan"),(0,r.kt)("p",null,"Operator perbandingan selalu menghasilkan nilai bertipe data ",(0,r.kt)("inlineCode",{parentName:"p"},"bool"),"."),(0,r.kt)("p",null,"Berikut merupakan list operator untuk operasi perbandingan beserta contoh penerapannya di rust."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"Simbol"),(0,r.kt)("th",{parentName:"tr",align:null},"Kegunaan untuk mengecek"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"==")),(0,r.kt)("td",{parentName:"tr",align:null},"apakah kiri sama dengan kanan?")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"!=")),(0,r.kt)("td",{parentName:"tr",align:null},"apakah kiri tidak sama dengan kanan?")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},">")),(0,r.kt)("td",{parentName:"tr",align:null},"apakah kiri lebih besar dari kanan?")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"<")),(0,r.kt)("td",{parentName:"tr",align:null},"apakah kiri lebih kecil dari kanan?")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},">=")),(0,r.kt)("td",{parentName:"tr",align:null},"apakah kiri lebih besar atau sama dengan kanan?")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"<=")),(0,r.kt)("td",{parentName:"tr",align:null},"apakah kiri lebih kecil atau sama dengan kanan?")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'let number_a = 12;\nlet number_b = 24;\n\nlet res_one = number_a == number_b;\nprintln!("res_one: {res_one}");\n\nlet res_two = number_a != number_b;\nprintln!("res_two: {res_two}");\n\nlet res_three = number_a > number_b;\nprintln!("res_three: {res_three}");\n\nlet res_four = number_a < number_b;\nprintln!("res_four: {res_four}");\n\nlet res_five = number_a >= number_b;\nprintln!("res_five: {res_five}");\n\nlet res_six = number_a <= number_b;\nprintln!("res_six: {res_six}");\n')),(0,r.kt)("p",null,"Pada contoh di atas, variabel di print menggunakan macro ",(0,r.kt)("inlineCode",{parentName:"p"},"println")," tanpa disisipkan paramnya. Penjelasannya ada di bawah ini."),(0,r.kt)("h3",{id:"-named-argument-macro-println"},"\u25c9 ",(0,r.kt)("em",{parentName:"h3"},"Named argument")," macro ",(0,r.kt)("inlineCode",{parentName:"h3"},"println")),(0,r.kt)("p",null,"Salah satu teknik ",(0,r.kt)("em",{parentName:"p"},"formatted print")," macro ",(0,r.kt)("inlineCode",{parentName:"p"},"println")," adalah dengan menerapkan ",(0,r.kt)("em",{parentName:"p"},"named argument"),". Yang biasanya menggunakan ",(0,r.kt)("inlineCode",{parentName:"p"},"{}")," atau ",(0,r.kt)("inlineCode",{parentName:"p"},"{1}"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"{2}"),", dan seterusnya, diganti dengan nama variabel yang diapit tanda kurung kurawal, contohnya ",(0,r.kt)("inlineCode",{parentName:"p"},"res_one"),". Dengan teknik ini maka jika variabel ",(0,r.kt)("inlineCode",{parentName:"p"},"res_one")," ada, akan langsung mereplace argument ",(0,r.kt)("inlineCode",{parentName:"p"},"{res_one}")," tanpa perlu menyisipkan variabel tersebut saat pemanggilan macro ",(0,r.kt)("inlineCode",{parentName:"p"},"println"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'let res_one = number_a == number_b;\nprintln!("res_one: {res_one}");\n// output => res_one: false\n\nlet res_two = number_a != number_b;\nprintln!("res_two: {res_two}");\n// output => res_one: true\n')),(0,r.kt)("h2",{id:"a83-operator-negasi"},"A.8.3. Operator negasi"),(0,r.kt)("p",null,"Berikut merupakan list operator untuk operasi negasi beserta contoh penerapannya di rust."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"Simbol"),(0,r.kt)("th",{parentName:"tr",align:null},"Kegunaan"),(0,r.kt)("th",{parentName:"tr",align:null},"Catatan"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"-")),(0,r.kt)("td",{parentName:"tr",align:null},"negasi numerik"),(0,r.kt)("td",{parentName:"tr",align:null},"bisa digunakan pada tipe data integer dan float")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"!")),(0,r.kt)("td",{parentName:"tr",align:null},"logika ",(0,r.kt)("inlineCode",{parentName:"td"},"NOT")," atau bitwise ",(0,r.kt)("inlineCode",{parentName:"td"},"NOT")),(0,r.kt)("td",{parentName:"tr",align:null},"bisa digunakan pada tipe data integer dan bool")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'let (value_left, value_right) = (12, -12);\nlet res_one = -value_left == value_right;\nlet res_two = !(value_left == value_right);\nprintln!("{res_one} {res_two}");\n// output => true true\n')),(0,r.kt)("p",null,"Untuk menggunakan operator negasi pada tipe data numerik, caranya dengan langsung menambahkan prefix ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," pada angka atau variabel. Contohnya ",(0,r.kt)("inlineCode",{parentName:"p"},"-12")," atau ",(0,r.kt)("inlineCode",{parentName:"p"},"-value_left"),"."),(0,r.kt)("p",null,"Penggunaan operator logika ",(0,r.kt)("inlineCode",{parentName:"p"},"!")," juga sama, tinggal tambahkan saja sebagai prefix dari data ",(0,r.kt)("inlineCode",{parentName:"p"},"bool")," atau statement yang menghasilkan data ",(0,r.kt)("inlineCode",{parentName:"p"},"bool"),", contohnya ",(0,r.kt)("inlineCode",{parentName:"p"},"!(value_left == value_right)"),"."),(0,r.kt)("h2",{id:"a84-operator-logika--bool"},"A.8.4. Operator logika / ",(0,r.kt)("inlineCode",{parentName:"h2"},"bool")),(0,r.kt)("p",null,"Berikut merupakan list operator untuk operasi logika ",(0,r.kt)("inlineCode",{parentName:"p"},"bool")," beserta contoh penerapannya di rust."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"Simbol"),(0,r.kt)("th",{parentName:"tr",align:null},"Kegunaan"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"&&")),(0,r.kt)("td",{parentName:"tr",align:null},"logika ",(0,r.kt)("inlineCode",{parentName:"td"},"AND"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},"|","|"),(0,r.kt)("td",{parentName:"tr",align:null},"logika ",(0,r.kt)("inlineCode",{parentName:"td"},"OR"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"!")),(0,r.kt)("td",{parentName:"tr",align:null},"logika ",(0,r.kt)("inlineCode",{parentName:"td"},"NOT"))))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'let (bool_left, bool_right) = (false, true);\nprintln!("AND result \\t: {}", bool_left && bool_right);\nprintln!("OR result \\t: {}", bool_left || bool_right);\n')),(0,r.kt)("h3",{id:"-whitespace-character-tab-t"},"\u25c9 ",(0,r.kt)("em",{parentName:"h3"},"Whitespace character")," tab ",(0,r.kt)("inlineCode",{parentName:"h3"},"\\t")),(0,r.kt)("p",null,"Rust mendukung karakter standar whitespace seperti ",(0,r.kt)("inlineCode",{parentName:"p"},"\\t")," yang kegunaannya adalah untuk horizontal tab. Contoh penerapannya seperti pada kode di atas, tulis saja ",(0,r.kt)("inlineCode",{parentName:"p"},"\\t")," dalam string literal, hasilnya bisa dilihat saat di-print."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'println!("AND result \\t: {}", bool_left && bool_right);\nprintln!("OR result \\t: {}", bool_left || bool_right);\n')),(0,r.kt)("p",null,(0,r.kt)("img",{loading:"eager",fetchpriority:"high",alt:"operator boolean",src:t(6032).Z,width:"381",height:"100"})),(0,r.kt)("h2",{id:"a85-operator-reference-dan-dereference"},"A.8.5. Operator reference dan dereference"),(0,r.kt)("p",null,"Untuk jenis operasi ini ada 3 buah operator yang bisa dipergunakan yaitu ",(0,r.kt)("inlineCode",{parentName:"p"},"*"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"&")," dan ",(0,r.kt)("inlineCode",{parentName:"p"},"&mut"),". Untuk sekarang kita tidak akan membahas topik ini karena masih terlalu awal. Nantinya kita akan kupas tuntas di chapter ",(0,r.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"),". Sementara kita pelajari chapter per chapter secara berurutan dulu."),(0,r.kt)("h2",{id:"a86-operator-bitwise"},"A.8.6. Operator bitwise"),(0,r.kt)("p",null,"Rust mendukung operator bitwise standar yang ada di bahasa pemrograman."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"center"},"Simbol"),(0,r.kt)("th",{parentName:"tr",align:null},"Kegunaan"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"&")),(0,r.kt)("td",{parentName:"tr",align:null},"bitwise ",(0,r.kt)("inlineCode",{parentName:"td"},"AND"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("code",null,"|")),(0,r.kt)("td",{parentName:"tr",align:null},"bitwise ",(0,r.kt)("inlineCode",{parentName:"td"},"OR"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"^")),(0,r.kt)("td",{parentName:"tr",align:null},"bitwise ",(0,r.kt)("inlineCode",{parentName:"td"},"XOR"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"!")),(0,r.kt)("td",{parentName:"tr",align:null},"bitwise ",(0,r.kt)("inlineCode",{parentName:"td"},"NOT"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},"<<")),(0,r.kt)("td",{parentName:"tr",align:null},"left shift")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"center"},(0,r.kt)("inlineCode",{parentName:"td"},">>")),(0,r.kt)("td",{parentName:"tr",align:null},"right shift")))),(0,r.kt)("h2",{id:"a87-operator-lainnya"},"A.8.7. Operator lainnya"),(0,r.kt)("p",null,"Sebenarnya ada banyak lagi jenis operator di Rust programming, seperti type cast operator, reference/borrow operator, dll. Nantinya kita akan bahas operator tersebut satu per satu secara terpisah di chapter berbeda."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Type cast operator dibahas pada chapter ",(0,r.kt)("a",{parentName:"li",href:"/basic/type-alias-casting"},"Type Alias & Casting")),(0,r.kt)("li",{parentName:"ul"},"Reference/borrow operator dibahas pada chapter ",(0,r.kt)("a",{parentName:"li",href:"/basic/pointer-references"},"Pointer & References")),(0,r.kt)("li",{parentName:"ul"},"Operator ",(0,r.kt)("inlineCode",{parentName:"li"},"?")," dibahas pada chapter ",(0,r.kt)("a",{parentName:"li",href:"/basic/operator-tanda-tanya"},"Operator ?"))),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,r.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,r.kt)("pre",null,(0,r.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/operator"},"github.com/novalagung/dasarpemrogramanrust-example/../operator")),(0,r.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/basic/pointer-references"},"Pointer & References")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#/wip/macro"},"Macro")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#/wip/whitespace-token"},"Whitespace Token")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/basic/operator-tanda-tanya"},"Operator ?"))),(0,r.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/expressions/operator-expr.html"},"https://doc.rust-lang.org/reference/expressions/operator-expr.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/whitespace.html"},"https://doc.rust-lang.org/reference/whitespace.html")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/hello/print.html"},"https://doc.rust-lang.org/rust-by-example/hello/print.html"))))}u.isMDXComponent=!0},6032:(e,a,t)=>{t.d(a,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAX0AAABkCAIAAADltXfhAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodH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3Qy/fV1a/1yirTVfp4zXnU5wLui3eaTvv19/36nxfKO19fw5WYdz7fe42SloQIW4F3wDsAYOIdzyUt+7wQ3vl8f//srrC84+nJs5VMai8+TqIdpsn0n78axJCimKopjFayTzNUR+KdJCzb+SzMzuDKc7F21u3G2h8AVuGdgUqoUw4Xm0vtLYl3BuIpd5X225Snrk4/9Bn6mY1cannntuKC2siRfS7WzordJPsDwBq843usJxdKRt0oOpV3PJ35fEhZtLih/4Qi7oF3ZplnCXbm7abYHwAW553EL71DhyDItXOtibyTxy/MhCF0g3yLCrxj4h1znKjbHwAW5p3c/6Jhsg/Irys9E9Z3uP4Qjbfa7KOPxcA7s/KOwf4AsBjvxB04rAvQfavm8+cnt5/VrkuW1gXY/mBcU6Df9enzXX+pFDr1ONL6DvtcRTsndsOaDrAZ7yQjZ1iQzPfLufd3/EA6gnfyvJiL+StFXdJh2YmZMJCyoruH2M9Snku0M2c3yf4AsAbvAAAAgHcAAADvAAAAgHcAAADvAAAAgHcAAADvzALo7FDQTXDT+TjYDdgV78TvcSTv7OzuvPJdvZcsN1n30p+baDcA2IZ36FmEE3kRlh68StKAd/YR7NQd4wTvAHvinX7gjM55tudBowOflgMH0NmZEL9Uvq8s8E6wc3Y35x3W/kp7AcBsvJO7Iz0ASkS/ygEFdHZW4B2GZ4l+CNUVKNrNcm4OZ7iARXgndyxWSNl6Dgs6O/uYZ1nsJtgfujzAPuId46AHnZ1teSc1tfG8fmJ/6PIAK63vRGsuw3oPnWcNI+MY3oHOziq8k6zHGe3G2R+6PMAKvBOv3fh1gcSP8/UCI++coLMz6/qOzDthZ73XRTLzjmR/AFiKd4KbxsF5On4aQh7o7GzIO32M4635XrCbZn/o8gAr8A4AAAB4BwAA8A4AAAB4BwAA8A4AAAB4BwAA8A4AAOAdAAAA8A4AAOAdAACAKfgPih3v0dH3yZcAAAAASUVORK5CYII="}}]); \ No newline at end of file diff --git a/assets/js/dadaca00.64b4e275.js b/assets/js/dadaca00.64b4e275.js deleted file mode 100644 index a4082ca1..00000000 --- a/assets/js/dadaca00.64b4e275.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[8051],{3905:(a,e,n)=>{n.d(e,{Zo:()=>k,kt:()=>A});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function d(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},r=Object.keys(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var p=t.createContext({}),m=function(a){var e=t.useContext(p),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},k=function(a){var e=m(a.components);return t.createElement(p.Provider,{value:e},a.children)},u={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},s=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,r=a.originalType,p=a.parentName,k=d(a,["components","mdxType","originalType","parentName"]),s=m(n),A=i,o=s["".concat(p,".").concat(A)]||s[A]||u[A]||r;return n?t.createElement(o,l(l({ref:e},k),{},{components:n})):t.createElement(o,l({ref:e},k))}));function A(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=n.length,l=new Array(r);l[0]=s;var d={};for(var p in e)hasOwnProperty.call(e,p)&&(d[p]=e[p]);d.originalType=a,d.mdxType="string"==typeof a?a:i,l[1]=d;for(var m=2;m<r;m++)l[m]=n[m];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}s.displayName="MDXCreateElement"},375:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>r,metadata:()=>d,toc:()=>m});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:13,title:"A.13. Tipe Data \u279c Array",sidebar_label:"A.13. Array",description:"Belajar array pada rust. Contoh penerapan array, iterasi array, dan operasi lainnya pada array",keywords:["rust","belajar rust","array rust","slice rust"]},l=void 0,d={unversionedId:"basic/array",id:"basic/array",title:"A.13. Tipe Data \u279c Array",description:"Belajar array pada rust. Contoh penerapan array, iterasi array, dan operasi lainnya pada array",source:"@site/docs/basic/array.md",sourceDirName:"basic",slug:"/basic/array",permalink:"/basic/array",draft:!1,tags:[],version:"current",sidebarPosition:13,frontMatter:{sidebar_position:13,title:"A.13. Tipe Data \u279c Array",sidebar_label:"A.13. Array",description:"Belajar array pada rust. Contoh penerapan array, iterasi array, dan operasi lainnya pada array",keywords:["rust","belajar rust","array rust","slice rust"]},sidebar:"tutorialSidebar",previous:{title:"A.12. Perulangan \u279c for in",permalink:"/basic/perulangan-for-in"},next:{title:"A.14. Slice (Basic)",permalink:"/basic/slice"}},p={},m=[{value:"A.13.1. Pengenalan array",id:"a131-pengenalan-array",level:2},{value:"\u25c9 Deklarasi variabel array (<em>type inference</em>)",id:"-deklarasi-variabel-array-type-inference",level:3},{value:"\u25c9 Pengaksesan elemen array",id:"-pengaksesan-elemen-array",level:3},{value:"\u25c9 Mengubah isi elemen array",id:"-mengubah-isi-elemen-array",level:3},{value:"\u25c9 Formatted print <code>{:?}</code>",id:"-formatted-print-",level:3},{value:"\u25c9 Formatted print <code>{namaVariabel:?}</code>",id:"-formatted-print-namavariabel",level:3},{value:"A.13.2. Notasi penulisan tipe data array",id:"a132-notasi-penulisan-tipe-data-array",level:2},{value:"A.13.3. Macam-macam deklarasi array",id:"a133-macam-macam-deklarasi-array",level:2},{value:"\u25c9 Deklarasi array dengan metode <em>type inference</em>",id:"-deklarasi-array-dengan-metode-type-inference",level:3},{value:"\u25c9 Deklarasi array dengan metode <em>manifest typing</em> disertai <em>predefined value</em>",id:"-deklarasi-array-dengan-metode-manifest-typing-disertai-predefined-value",level:3},{value:"\u25c9 Deklarasi array dengan notasi penulisan <code>[T; N]</code>",id:"-deklarasi-array-dengan-notasi-penulisan-t-n",level:3},{value:"A.13.4. Melihat size array menggunakan method <code>len</code>",id:"a134-melihat-size-array-menggunakan-method-len",level:2},{value:"A.13.5. Iterasi array menggunakan <code>for in</code>",id:"a135-iterasi-array-menggunakan-for-in",level:2},{value:"A.13.6. Iterasi array menggunakan <code>while</code> dan <code>loop</code>",id:"a136-iterasi-array-menggunakan-while-dan-loop",level:2},{value:"A.13.7. Iterasi array menggunakan <code>for in</code> dan <em>tuple</em>",id:"a137-iterasi-array-menggunakan-for-in-dan-tuple",level:2},{value:"A.13.8. Append elemen ke array",id:"a138-append-elemen-ke-array",level:2},{value:"A.13.9. Nested array",id:"a139-nested-array",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],k={toc:m};function u(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,t.Z)({},k,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter awal kita sudah mempelajari tipe data primitif jenis scalar. Selain ",(0,i.kt)("em",{parentName:"p"},"scalar types")," ada juga tipe data primitif lainnya yaitu ",(0,i.kt)("strong",{parentName:"p"},"compound types"),". Compound types sendiri adalah jenis tipe data kolektif yang isinya banyak data. Kesemua data tersebut memiliki tipe data yang sama dan di-group menjadi satu."),(0,i.kt)("p",null,"Array adalah salah satu tipe data compound yang tersedia di Rust, dan pada chapter ini kita akan mempelajarinya."),(0,i.kt)("h2",{id:"a131-pengenalan-array"},"A.13.1. Pengenalan array"),(0,i.kt)("p",null,"Menurut dokumentasi official Rust, array adalah:"),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"An array is a collection of objects of the same type T, stored in contiguous memory."),(0,i.kt)("p",{parentName:"blockquote"},"A fixed-size array, denoted ","[T; N]",", for the element type, T, and the non-negative compile-time constant size, N.")),(0,i.kt)("p",null,"Array (atau ",(0,i.kt)("em",{parentName:"p"},"fixed size array"),") adalah kumpulan data dengan tipe sejenis, disimpan dalam 1 variabel. Array memiliki kapasitas yang nilainya ditentukan saat deklarasi/alokasi. Jumlah data dalam array pasti tidak boleh lebih dari kapasitas yang sudah ditentukan di awal. Data dalam array biasa disebut dengan ",(0,i.kt)("em",{parentName:"p"},"element")," atau item."),(0,i.kt)("p",null,"Ada beberapa notasi deklarasi array yang bisa dipakai, kesemuanya akan dibahas pada chapter ini."),(0,i.kt)("p",null,"Ok, Sekarang kita mulai praktik dengan bermain-main terlebih dahulu dengan tipe data array ini. Silakan pelajari dan praktikkan contoh berikut, sebuah program yang isinya menampilkan data array."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut numbers = [24, 12, 32, 7];\nprintln!("array {:?}", numbers);\n\nlet data0 = numbers[0];\nprintln!("elemen array ke 0 {data0}");\n\nlet data1 = numbers[1];\nprintln!("elemen array ke 1 {data1}");\n\nnumbers[1] = 16;\nnumbers[3] = 8;\nprintln!("array {numbers:?}");\n')),(0,i.kt)("p",null,"Coba jalankan aplikasi, muncul dua baris output di console."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"array",src:n(3421).Z,width:"448",height:"164"})),(0,i.kt)("p",null,"Selanjutnya mari kita bahas dengan detail contoh di atas."),(0,i.kt)("h3",{id:"-deklarasi-variabel-array-type-inference"},"\u25c9 Deklarasi variabel array (",(0,i.kt)("em",{parentName:"h3"},"type inference"),")"),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," dideklarasikan sebagai array ",(0,i.kt)("em",{parentName:"p"},"mutable")," dengan metode deklarasi type inference, yang tipe datanya didapat langsung dari nilai."),(0,i.kt)("p",null,"Value dari ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"[24, 12, 32, 7]"),", yang mana artinya sebuah array dengan size 4, bertipe numerik, dengan isi ",(0,i.kt)("inlineCode",{parentName:"p"},"24"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"12"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"32"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"7"),"."),(0,i.kt)("p",null,"Sintaks ",(0,i.kt)("inlineCode",{parentName:"p"},"[24, 12, 32, 7]")," adalah salah satu cara menulis literal array. Tulis saja data yang diinginkan dengan separator ",(0,i.kt)("inlineCode",{parentName:"p"},",")," dan diapit tanda kurung siku ",(0,i.kt)("inlineCode",{parentName:"p"},"[ ]"),"."),(0,i.kt)("p",null,"Contoh lain deklarasi array:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut alphabets = ["a", "b", "c", "d"];\nlet booleans = [true, false];\nlet floatingNumbers = [32.0000078, 3.14, 0.5];\n')),(0,i.kt)("p",null,"O iya, penulisan literal array juga bisa dituliskan dalam multi-baris, contohnya seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut alphabets = [\n "a",\n "b",\n "c",\n "d"\n];\nlet booleans = [\n true,\n false\n];\n')),(0,i.kt)("h3",{id:"-pengaksesan-elemen-array"},"\u25c9 Pengaksesan elemen array"),(0,i.kt)("p",null,"Pengaksesan elemen array dilakukan dengan menuliskan nama variabel array kemudian diikuti kurung siku yang mengapit angka indeks elemen yang diinginkan."),(0,i.kt)("p",null,"Indeks array dimulai dari 0. Pada contoh di atas, ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," size-nya adalah 4 elemen, berarti elemen array ada pada indeks ke 0, 1, 2, 3."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data0 = numbers[0];\nprintln!("elemen array ke 0 {data0}");\n\nlet data1 = numbers[1];\nprintln!("elemen array ke 1 {data1}");\n')),(0,i.kt)("p",null,"Array hanya bisa diakses elemennya sesuai size saat deklarasi. Sebagai contoh, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," yang size nya 4, jika dipaksa mengakses elemen indeks ke-7 maka akan menghasilkan error."),(0,i.kt)("h3",{id:"-mengubah-isi-elemen-array"},"\u25c9 Mengubah isi elemen array"),(0,i.kt)("p",null,"Array bisa diubah isi elemen-nya jika variabel tersebut adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"mutable"),". Pada contoh yang sudah dibuat, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," dideklarasikan mutable dengan tipe data elemen adalah numerik. Dengan ini kita bisa mengubah value elemen array dengan value baru bertipe data sama."),(0,i.kt)("p",null,"Bisa dilihat pada contoh yang sudah dipraktikkan, elemen indeks ke-1 diubah nilainya menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"16"),", dan elemen indeks ke-3 value-nya menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"8")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"numbers[1] = 16;\nnumbers[3] = 8;\n")),(0,i.kt)("p",null,"Array hanya bisa diubah elemen-nya sesuai size saat deklarasi. Sebagai contoh, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," yang size nya 4, jika dipaksa mengakses dan/atau mengubah elemen indeks ke-7 maka akan menghasilkan error."),(0,i.kt)("p",null,"Selain itu, operasi assignment atau pengubahan nilai pada elemen array hanya bisa dilakukan dengan tipe data yang sama. Pada contoh di atas ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," adalah array bertipe numerik, karenanya tidak akan bisa diubah nilai elemen-nya dengan tipe lain, dan jika dipaksa akan menghasilkan error."),(0,i.kt)("h3",{id:"-formatted-print-"},"\u25c9 Formatted print ",(0,i.kt)("inlineCode",{parentName:"h3"},"{:?}")),(0,i.kt)("p",null,"Formatted print ",(0,i.kt)("inlineCode",{parentName:"p"},"{:?}")," berguna untuk memformat macam-macam tipe data ke bentuk string, yang salah satunya adalah tipe data array. Dengan menggunakan formatted print ini kita bisa menampilkan nilai elemen array dalam bentuk string."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'println!("array {:?}", numbers);\n')),(0,i.kt)("h3",{id:"-formatted-print-namavariabel"},"\u25c9 Formatted print ",(0,i.kt)("inlineCode",{parentName:"h3"},"{namaVariabel:?}")),(0,i.kt)("p",null,"Formatted print ",(0,i.kt)("inlineCode",{parentName:"p"},"{namaVariabel:?}")," kegunaannya sama seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"{:?}"),", dengan perbedaan: pada penggunaan formatted print ",(0,i.kt)("inlineCode",{parentName:"p"},"{namaVariabel:?}")," tidak perlu menuliskan variabel yang ingin di-format sebagai argumen. Cukup ganti ",(0,i.kt)("inlineCode",{parentName:"p"},"namaVariabel")," dengan nama variabel yang ingin di-format."),(0,i.kt)("p",null,"Silakan lihat contoh berikut. Keduanya adalah ekuivalen, menghasilkan nilai yang sama."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'println!("array {:?}", numbers);\nprintln!("array {numbers:?}");\n')),(0,i.kt)("h2",{id:"a132-notasi-penulisan-tipe-data-array"},"A.13.2. Notasi penulisan tipe data array"),(0,i.kt)("p",null,"Pada contoh program yang sudah dipraktikkan, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," tipe datanya adalah array numerik, terlihat saat deklarasinya ",(0,i.kt)("em",{parentName:"p"},"predefined value")," diisi dengan literal elemen array bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),"."),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"i32")," di sini adalah milik elemen array, sedang array ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," itu sendiri tipe datanya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"[i32; 4]"),", yang artinya adalah ",(0,i.kt)("strong",{parentName:"p"},"sebuah array dengan elemen bertipe ",(0,i.kt)("inlineCode",{parentName:"strong"},"i32")," dengan size ",(0,i.kt)("inlineCode",{parentName:"strong"},"4")),"."),(0,i.kt)("p",null,"Jika kawan-kawan menggunakan ekstensi VSCode ",(0,i.kt)("inlineCode",{parentName:"p"},"rust-analyzer"),", akan terlihat informasi tipe data array-nya."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"array",src:n(2957).Z,width:"445",height:"336"})),(0,i.kt)("h2",{id:"a133-macam-macam-deklarasi-array"},"A.13.3. Macam-macam deklarasi array"),(0,i.kt)("p",null,"Array lebih mudah dideklarasikan dengan metode ",(0,i.kt)("em",{parentName:"p"},"type inference"),". Namun tak menutup kemungkinan ada kebutuhan di mana array harus dideklarasikan dengan menuliskan tipe datanya secara eksplisit. Berikut adalah macam-macam cara mendeklarasikan array."),(0,i.kt)("h3",{id:"-deklarasi-array-dengan-metode-type-inference"},"\u25c9 Deklarasi array dengan metode ",(0,i.kt)("em",{parentName:"h3"},"type inference")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let angka_integer = [24, 12, 32, 7];\nprintln!("{angka_integer:?}");\n// output: [24, 12, 32, 7]\n\nlet angka_float = [24.2, 12.5, 32.00002, 7.2];\nprintln!("{angka_float:?}");\n// output: [24.2, 12.5, 32.00002, 7.2]\n')),(0,i.kt)("h3",{id:"-deklarasi-array-dengan-metode-manifest-typing-disertai-predefined-value"},"\u25c9 Deklarasi array dengan metode ",(0,i.kt)("em",{parentName:"h3"},"manifest typing")," disertai ",(0,i.kt)("em",{parentName:"h3"},"predefined value")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_boolean: [bool; 2] = [false, true];\nprintln!("{data_boolean:?}");\n// output: [false, true]\n\nlet angka_unsigned_integer: [u32; 3] = [24, 0, 12];\nprintln!("{angka_unsigned_integer:?}");\n// output: [24, 0, 12]\n')),(0,i.kt)("h3",{id:"-deklarasi-array-dengan-notasi-penulisan-t-n"},"\u25c9 Deklarasi array dengan notasi penulisan ",(0,i.kt)("inlineCode",{parentName:"h3"},"[T; N]")),(0,i.kt)("p",null,"Pada contoh berikut, ",(0,i.kt)("inlineCode",{parentName:"p"},"data_numerik1")," dideklarasikan bertipe array dengan tipe data data elemen adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),", mempunyai size ",(0,i.kt)("inlineCode",{parentName:"p"},"10"),", dengan ",(0,i.kt)("em",{parentName:"p"},"predefined value")," untuk setiap elemen array adalah angka ",(0,i.kt)("inlineCode",{parentName:"p"},"0"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_numerik1: [i32; 10] = [0; 10];\nprintln!("{data_numerik1:?}");\n// output: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n')),(0,i.kt)("p",null,"Pada contoh ke-dua ini, ",(0,i.kt)("inlineCode",{parentName:"p"},"data_numerik2")," dideklarasikan dengan ",(0,i.kt)("em",{parentName:"p"},"predefined value")," adalah array yang size-nya ",(0,i.kt)("inlineCode",{parentName:"p"},"5")," dan nilai default tiap elemen adalah angka ",(0,i.kt)("inlineCode",{parentName:"p"},"4"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_numerik2 = [4; 5];\nprintln!("{data_numerik2:?}");\n// output: [4, 4, 4, 4, 4]\n')),(0,i.kt)("p",null,"Tambahan penjelasan mengenai notasi penulisan ",(0,i.kt)("inlineCode",{parentName:"p"},"[T; N]"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Jika digunakan pada penulisan tipe data array saat deklarasi, ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," adalah tipe data elemen, dan ",(0,i.kt)("inlineCode",{parentName:"li"},"N")," adalah lebar/size array. Contoh: ",(0,i.kt)("inlineCode",{parentName:"li"},"let data_numerik1: [i32; 10]"),"."),(0,i.kt)("li",{parentName:"ul"},"Jika digunakan pada penulisan ",(0,i.kt)("em",{parentName:"li"},"predefined value"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," adalah nilai setiap elemen array, dan ",(0,i.kt)("inlineCode",{parentName:"li"},"N")," adalah lebar/size array. Contoh: ",(0,i.kt)("inlineCode",{parentName:"li"},"[4; 2]"),", yang artinya semua elemen array diisi dengan angka ",(0,i.kt)("inlineCode",{parentName:"li"},"4"),".")),(0,i.kt)("h2",{id:"a134-melihat-size-array-menggunakan-method-len"},"A.13.4. Melihat size array menggunakan method ",(0,i.kt)("inlineCode",{parentName:"h2"},"len")),(0,i.kt)("p",null,"Array secara ",(0,i.kt)("em",{parentName:"p"},"default")," properti tipe data ",(0,i.kt)("strong",{parentName:"p"},"slice"),", yang salah satunya adalah method bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"len")," yang berguna untuk melihat size dari sebuah array. Cara penggunaannya cukup dengan menuliskan ",(0,i.kt)("inlineCode",{parentName:"p"},".len()")," setelah variabel array. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let names = ["jason", "grayon", "drake", "damian"];\nlet length = names.len();\nprintln!("array size is {}", length);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"array for in",src:n(7674).Z,width:"449",height:"113"})),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai slice dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/slice"},"Slice"))),(0,i.kt)("h2",{id:"a135-iterasi-array-menggunakan-for-in"},"A.13.5. Iterasi array menggunakan ",(0,i.kt)("inlineCode",{parentName:"h2"},"for in")),(0,i.kt)("p",null,"Pada contoh berikut, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"names")," adalah array bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"[&str; 4]"),", dideklarasikan dengan ",(0,i.kt)("em",{parentName:"p"},"predefined value"),". Elemen array tersebut kemudian diiterasi menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," untuk di-print ke layar console value setiap elemennya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let names: [&str; 4] = ["jason", "grayon", "drake", "damian"];\nfor name in names {\n println!("{name}");\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"array for in",src:n(2977).Z,width:"445",height:"149"})),(0,i.kt)("p",null,"Bisa juga dengan memanfaatkan ",(0,i.kt)("em",{parentName:"p"},"range syntax")," dalam perulangan array. Benefitnya adalah pengaksesan indeks array lebih mudah."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let names: [&str; 4] = ["jason", "grayon", "drake", "damian"];\nfor i in 0..names.len() {\n println!("array index ke-{}: {}", i, names[i]);\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"array for in",src:n(4097).Z,width:"447",height:"148"})),(0,i.kt)("p",null,"Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"names.len()")," mengembalikan informasi size sebuah array, nilainya bisa dimanfaatkan dalam perulangan ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," untuk iterasi indeks ke-0 hingga terakhir."),(0,i.kt)("h2",{id:"a136-iterasi-array-menggunakan-while-dan-loop"},"A.13.6. Iterasi array menggunakan ",(0,i.kt)("inlineCode",{parentName:"h2"},"while")," dan ",(0,i.kt)("inlineCode",{parentName:"h2"},"loop")),(0,i.kt)("p",null,"Contoh iterasi array menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"while"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let names: [&str; 4] = ["jason", "grayon", "drake", "damian"];\n\nlet mut i = 0;\nwhile i < names.len() {\n println!("array index ke-{}: {}", i, names[i]);\n i += 1;\n}\n')),(0,i.kt)("p",null,"Contoh iterasi array menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"loop"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let names: [&str; 4] = ["jason", "grayon", "drake", "damian"];\n\nlet mut i = 0;\nloop {\n if i >= names.len() {\n break;\n }\n\n println!("array index ke-{}: {}", i, names[i]);\n i += 1;\n}\n')),(0,i.kt)("p",null,"Iterasi array menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"while")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"loop")," umumnya kurang praktis jika dibandingkan dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"for in"),". Tapi pastinya ada case di mana ",(0,i.kt)("inlineCode",{parentName:"p"},"while")," dan/atau ",(0,i.kt)("inlineCode",{parentName:"p"},"loop")," akan dibutuhkan."),(0,i.kt)("h2",{id:"a137-iterasi-array-menggunakan-for-in-dan-tuple"},"A.13.7. Iterasi array menggunakan ",(0,i.kt)("inlineCode",{parentName:"h2"},"for in")," dan ",(0,i.kt)("em",{parentName:"h2"},"tuple")),(0,i.kt)("p",null,"Mengiterasi value sekaligus ",(0,i.kt)("em",{parentName:"p"},"counter")," perulangan sebenarnya bisa juga dilakukan menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"for in"),", contohnya seperti yang sudah kita praktikkan di atas yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"for i in 0..names.len()"),"."),(0,i.kt)("p",null,"Ada juga bentuk lain pemanfaatan ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," untuk mengiterasi sebuah array. Caranya dengan menggunakan teknik tuple untuk menampung data ",(0,i.kt)("em",{parentName:"p"},"counter")," sekaligus value tiap elemen. Lebih jelasnya silakan lihat dan praktikkan contoh berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let names: [&str; 4] = ["jason", "grayon", "drake", "damian"];\n\nfor (i, name) in names.iter().enumerate() {\n println!("array index ke-{i}: {name}");\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"array enumerate",src:n(4097).Z,width:"447",height:"148"})),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"names")," yang notabene bertipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"[&str; 4]")," perlu dikonversi ke tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," terlebih dahulu caranya lewat pemanggilan method ",(0,i.kt)("inlineCode",{parentName:"p"},".iter()"),". Kemudian dari tipe tersebut perlu dikonversi lagi ke tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Enumerate")," dengan cara memanggil method ",(0,i.kt)("inlineCode",{parentName:"p"},".enumerate()"),"."),(0,i.kt)("p",null,"Setelah mendapatkan objek bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Enumerate"),", keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," digunakan untuk menampung tiap elemen array dalam bentuk ",(0,i.kt)("em",{parentName:"p"},"tuple")," ",(0,i.kt)("inlineCode",{parentName:"p"},"(i, name)"),". Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"i")," di situ berisi counter iterasi, dan ",(0,i.kt)("inlineCode",{parentName:"p"},"name")," adalah value-nya."),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai traits dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai ",(0,i.kt)("inlineCode",{parentName:"li"},"Enumerate")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/trait-iterator"},"Trait \u279c Iterator")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai tuple dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/tuple"},"Tuple")))),(0,i.kt)("h2",{id:"a138-append-elemen-ke-array"},"A.13.8. Append elemen ke array"),(0,i.kt)("p",null,"Operasi menambahkan sebuah elemen ke array yang hasilnya melebihi kapasitas ... adalah tidak bisa. Karena array memiliki size fixed, tidak dinamis. Solusinya adalah menggunakan tipe data Vector. Nantinya array perlu dikonversi ke bentu Vector terlebih dahulu kemudian di-append, lebih jelasnya kita bahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/vector"},"Vector"),"."),(0,i.kt)("h2",{id:"a139-nested-array"},"A.13.9. Nested array"),(0,i.kt)("p",null,"Data nested array bisa dibuat dengan level kedalaman tanpa batas, tetapi harus mengikuti aturan tipe data array yaitu: fixed size dan elemen bertipe data sejenis."),(0,i.kt)("p",null,"Pada contoh berikut variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"data_arr")," didefinisikan sebagai sebuah array bersarang atau nested dengan kedalaman 2 level."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_arr = [\n ["salad", "fried rice"],\n ["apple", "coconut"],\n ["spinach", "jalapeno"],\n];\nfor sub_arr in data_arr {\n for el in sub_arr {\n print!("{el}, ");\n }\n println!();\n}\n\n// salad, fried rice,\n// apple, coconut,\n// spinach, jalapeno,\n')),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"data_arr")," pada contoh di atas bertipe data",(0,i.kt)("inlineCode",{parentName:"p"},"[[&str; 2]; 3]"),", yang artinya adalah sebuah array dengan size 3, dengan isi elemen adalah juga array dengan size 2. Selalu ingat bahwa size array adalah fixed."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/array"},"github.com/novalagung/dasarpemrogramanrust-example/../array")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/slice"},"Slice (Basic)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/vector"},"Tipe Data \u279c Vector")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/slice-memory-management"},"Slice Memory Management"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/primitive.array.html"},"https://doc.rust-lang.org/std/primitive.array.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/primitive.slice.html"},"https://doc.rust-lang.org/std/primitive.slice.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/iter/index.html"},"https://doc.rust-lang.org/std/iter/index.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/iter/struct.Enumerate.html"},"https://doc.rust-lang.org/std/iter/struct.Enumerate.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/iter/trait.Iterator.html"},"https://doc.rust-lang.org/std/iter/trait.Iterator.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/trait/iter.html"},"https://doc.rust-lang.org/rust-by-example/trait/iter.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/flow_control/for.html"},"https://doc.rust-lang.org/rust-by-example/flow_control/for.html"))))}u.isMDXComponent=!0},3421:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/array-1-919358da6705a5ced706fbcd108be794.png"},2957:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/array-2-bc70d4683afb247a4d30a6551aabec0a.png"},7674:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcEAAABxCAIAAAAiZI9+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xL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QBgvOhqfdNDonhI0QEAYKR0sZ9uSBTrM+1mcIx+RgcAgBHTpW6xl0QxJz1GBwCAEdKFbnGARHGHrQPrhHytWFzT9sk5owMAwHgC3WIAABADzwsBAIAY8JsAACAG/CYAAIgBvwkAAGLAbwIAgBjwmwAAIAb8JgAAiAG/CQAAYsBvAgCAGPCbAAAgBvwmAACIAb8JAABiwG8CAIAY8JsAACAG/CYAAIgBvwkAAGL8P8WW/mrC7FDtAAAAAElFTkSuQmCC"}}]); \ No newline at end of file diff --git a/assets/js/dadaca00.ca5007fb.js b/assets/js/dadaca00.ca5007fb.js new file mode 100644 index 00000000..ba5e7b14 --- /dev/null +++ b/assets/js/dadaca00.ca5007fb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[8051],{3905:(a,e,n)=>{n.d(e,{Zo:()=>k,kt:()=>A});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function d(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},r=Object.keys(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var p=t.createContext({}),m=function(a){var e=t.useContext(p),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},k=function(a){var e=m(a.components);return t.createElement(p.Provider,{value:e},a.children)},u={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},s=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,r=a.originalType,p=a.parentName,k=d(a,["components","mdxType","originalType","parentName"]),s=m(n),A=i,o=s["".concat(p,".").concat(A)]||s[A]||u[A]||r;return n?t.createElement(o,l(l({ref:e},k),{},{components:n})):t.createElement(o,l({ref:e},k))}));function A(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=n.length,l=new Array(r);l[0]=s;var d={};for(var p in e)hasOwnProperty.call(e,p)&&(d[p]=e[p]);d.originalType=a,d.mdxType="string"==typeof a?a:i,l[1]=d;for(var m=2;m<r;m++)l[m]=n[m];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}s.displayName="MDXCreateElement"},375:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>r,metadata:()=>d,toc:()=>m});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:13,title:"A.13. Tipe Data \u279c Array",sidebar_label:"A.13. Array",description:"Belajar array pada rust. Contoh penerapan array, iterasi array, dan operasi lainnya pada array",keywords:["rust","belajar rust","array rust","slice rust"]},l=void 0,d={unversionedId:"basic/array",id:"basic/array",title:"A.13. Tipe Data \u279c Array",description:"Belajar array pada rust. Contoh penerapan array, iterasi array, dan operasi lainnya pada array",source:"@site/docs/basic/array.md",sourceDirName:"basic",slug:"/basic/array",permalink:"/basic/array",draft:!1,tags:[],version:"current",sidebarPosition:13,frontMatter:{sidebar_position:13,title:"A.13. Tipe Data \u279c Array",sidebar_label:"A.13. Array",description:"Belajar array pada rust. Contoh penerapan array, iterasi array, dan operasi lainnya pada array",keywords:["rust","belajar rust","array rust","slice rust"]},sidebar:"tutorialSidebar",previous:{title:"A.12. Perulangan \u279c for in",permalink:"/basic/perulangan-for-in"},next:{title:"A.14. Slice (Basic)",permalink:"/basic/slice"}},p={},m=[{value:"A.13.1. Pengenalan array",id:"a131-pengenalan-array",level:2},{value:"\u25c9 Deklarasi variabel array (<em>type inference</em>)",id:"-deklarasi-variabel-array-type-inference",level:3},{value:"\u25c9 Pengaksesan elemen array",id:"-pengaksesan-elemen-array",level:3},{value:"\u25c9 Mengubah isi elemen array",id:"-mengubah-isi-elemen-array",level:3},{value:"\u25c9 Formatted print <code>{:?}</code>",id:"-formatted-print-",level:3},{value:"\u25c9 Formatted print <code>{namaVariabel:?}</code>",id:"-formatted-print-namavariabel",level:3},{value:"A.13.2. Notasi penulisan tipe data array",id:"a132-notasi-penulisan-tipe-data-array",level:2},{value:"A.13.3. Macam-macam deklarasi array",id:"a133-macam-macam-deklarasi-array",level:2},{value:"\u25c9 Deklarasi array dengan metode <em>type inference</em>",id:"-deklarasi-array-dengan-metode-type-inference",level:3},{value:"\u25c9 Deklarasi array dengan metode <em>manifest typing</em> disertai <em>predefined value</em>",id:"-deklarasi-array-dengan-metode-manifest-typing-disertai-predefined-value",level:3},{value:"\u25c9 Deklarasi array dengan notasi penulisan <code>[T; N]</code>",id:"-deklarasi-array-dengan-notasi-penulisan-t-n",level:3},{value:"A.13.4. Melihat size array menggunakan method <code>len</code>",id:"a134-melihat-size-array-menggunakan-method-len",level:2},{value:"A.13.5. Iterasi array menggunakan <code>for in</code>",id:"a135-iterasi-array-menggunakan-for-in",level:2},{value:"A.13.6. Iterasi array menggunakan <code>while</code> dan <code>loop</code>",id:"a136-iterasi-array-menggunakan-while-dan-loop",level:2},{value:"A.13.7. Iterasi array menggunakan <code>for in</code> dan <em>tuple</em>",id:"a137-iterasi-array-menggunakan-for-in-dan-tuple",level:2},{value:"A.13.8. Append elemen ke array",id:"a138-append-elemen-ke-array",level:2},{value:"A.13.9. Nested array",id:"a139-nested-array",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],k={toc:m};function u(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,t.Z)({},k,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter awal kita sudah mempelajari tipe data primitif jenis scalar. Selain ",(0,i.kt)("em",{parentName:"p"},"scalar types")," ada juga tipe data primitif lainnya yaitu ",(0,i.kt)("strong",{parentName:"p"},"compound types"),". Compound types sendiri adalah jenis tipe data kolektif yang isinya banyak data. Kesemua data tersebut memiliki tipe data yang sama dan di-group menjadi satu."),(0,i.kt)("p",null,"Array adalah salah satu tipe data compound yang tersedia di Rust, dan pada chapter ini kita akan mempelajarinya."),(0,i.kt)("h2",{id:"a131-pengenalan-array"},"A.13.1. Pengenalan array"),(0,i.kt)("p",null,"Menurut dokumentasi official Rust, array adalah:"),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"An array is a collection of objects of the same type T, stored in contiguous memory."),(0,i.kt)("p",{parentName:"blockquote"},"A fixed-size array, denoted ","[T; N]",", for the element type, T, and the non-negative compile-time constant size, N.")),(0,i.kt)("p",null,"Array (atau ",(0,i.kt)("em",{parentName:"p"},"fixed size array"),") adalah kumpulan data dengan tipe sejenis, disimpan dalam 1 variabel. Array memiliki kapasitas yang nilainya ditentukan saat deklarasi/alokasi. Jumlah data dalam array pasti tidak boleh lebih dari kapasitas yang sudah ditentukan di awal. Data dalam array biasa disebut dengan ",(0,i.kt)("em",{parentName:"p"},"element")," atau item."),(0,i.kt)("p",null,"Ada beberapa notasi deklarasi array yang bisa dipakai, kesemuanya akan dibahas pada chapter ini."),(0,i.kt)("p",null,"Ok, Sekarang kita mulai praktik dengan bermain-main terlebih dahulu dengan tipe data array ini. Silakan pelajari dan praktikkan contoh berikut, sebuah program yang isinya menampilkan data array."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut numbers = [24, 12, 32, 7];\nprintln!("array {:?}", numbers);\n\nlet data0 = numbers[0];\nprintln!("elemen array ke 0 {data0}");\n\nlet data1 = numbers[1];\nprintln!("elemen array ke 1 {data1}");\n\nnumbers[1] = 16;\nnumbers[3] = 8;\nprintln!("array {numbers:?}");\n')),(0,i.kt)("p",null,"Coba jalankan aplikasi, muncul dua baris output di console."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"array",src:n(3421).Z,width:"448",height:"164"})),(0,i.kt)("p",null,"Selanjutnya mari kita bahas dengan detail contoh di atas."),(0,i.kt)("h3",{id:"-deklarasi-variabel-array-type-inference"},"\u25c9 Deklarasi variabel array (",(0,i.kt)("em",{parentName:"h3"},"type inference"),")"),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," dideklarasikan sebagai array ",(0,i.kt)("em",{parentName:"p"},"mutable")," dengan metode deklarasi type inference, yang tipe datanya didapat langsung dari nilai."),(0,i.kt)("p",null,"Value dari ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"[24, 12, 32, 7]"),", yang mana artinya sebuah array dengan size 4, bertipe numerik, dengan isi ",(0,i.kt)("inlineCode",{parentName:"p"},"24"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"12"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"32"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"7"),"."),(0,i.kt)("p",null,"Sintaks ",(0,i.kt)("inlineCode",{parentName:"p"},"[24, 12, 32, 7]")," adalah salah satu cara menulis literal array. Tulis saja data yang diinginkan dengan separator ",(0,i.kt)("inlineCode",{parentName:"p"},",")," dan diapit tanda kurung siku ",(0,i.kt)("inlineCode",{parentName:"p"},"[ ]"),"."),(0,i.kt)("p",null,"Contoh lain deklarasi array:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut alphabets = ["a", "b", "c", "d"];\nlet booleans = [true, false];\nlet floatingNumbers = [32.0000078, 3.14, 0.5];\n')),(0,i.kt)("p",null,"O iya, penulisan literal array juga bisa dituliskan dalam multi-baris, contohnya seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut alphabets = [\n "a",\n "b",\n "c",\n "d"\n];\nlet booleans = [\n true,\n false\n];\n')),(0,i.kt)("h3",{id:"-pengaksesan-elemen-array"},"\u25c9 Pengaksesan elemen array"),(0,i.kt)("p",null,"Pengaksesan elemen array dilakukan dengan menuliskan nama variabel array kemudian diikuti kurung siku yang mengapit angka indeks elemen yang diinginkan."),(0,i.kt)("p",null,"Indeks array dimulai dari 0. Pada contoh di atas, ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," size-nya adalah 4 elemen, berarti elemen array ada pada indeks ke 0, 1, 2, 3."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data0 = numbers[0];\nprintln!("elemen array ke 0 {data0}");\n\nlet data1 = numbers[1];\nprintln!("elemen array ke 1 {data1}");\n')),(0,i.kt)("p",null,"Array hanya bisa diakses elemennya sesuai size saat deklarasi. Sebagai contoh, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," yang size nya 4, jika dipaksa mengakses elemen indeks ke-7 maka akan menghasilkan error."),(0,i.kt)("h3",{id:"-mengubah-isi-elemen-array"},"\u25c9 Mengubah isi elemen array"),(0,i.kt)("p",null,"Array bisa diubah isi elemen-nya jika variabel tersebut adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"mutable"),". Pada contoh yang sudah dibuat, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," dideklarasikan mutable dengan tipe data elemen adalah numerik. Dengan ini kita bisa mengubah value elemen array dengan value baru bertipe data sama."),(0,i.kt)("p",null,"Bisa dilihat pada contoh yang sudah dipraktikkan, elemen indeks ke-1 diubah nilainya menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"16"),", dan elemen indeks ke-3 value-nya menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"8")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"numbers[1] = 16;\nnumbers[3] = 8;\n")),(0,i.kt)("p",null,"Array hanya bisa diubah elemen-nya sesuai size saat deklarasi. Sebagai contoh, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," yang size nya 4, jika dipaksa mengakses dan/atau mengubah elemen indeks ke-7 maka akan menghasilkan error."),(0,i.kt)("p",null,"Selain itu, operasi assignment atau pengubahan nilai pada elemen array hanya bisa dilakukan dengan tipe data yang sama. Pada contoh di atas ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," adalah array bertipe numerik, karenanya tidak akan bisa diubah nilai elemen-nya dengan tipe lain, dan jika dipaksa akan menghasilkan error."),(0,i.kt)("h3",{id:"-formatted-print-"},"\u25c9 Formatted print ",(0,i.kt)("inlineCode",{parentName:"h3"},"{:?}")),(0,i.kt)("p",null,"Formatted print ",(0,i.kt)("inlineCode",{parentName:"p"},"{:?}")," berguna untuk memformat macam-macam tipe data ke bentuk string, yang salah satunya adalah tipe data array. Dengan menggunakan formatted print ini kita bisa menampilkan nilai elemen array dalam bentuk string."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'println!("array {:?}", numbers);\n')),(0,i.kt)("h3",{id:"-formatted-print-namavariabel"},"\u25c9 Formatted print ",(0,i.kt)("inlineCode",{parentName:"h3"},"{namaVariabel:?}")),(0,i.kt)("p",null,"Formatted print ",(0,i.kt)("inlineCode",{parentName:"p"},"{namaVariabel:?}")," kegunaannya sama seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"{:?}"),", dengan perbedaan: pada penggunaan formatted print ",(0,i.kt)("inlineCode",{parentName:"p"},"{namaVariabel:?}")," tidak perlu menuliskan variabel yang ingin di-format sebagai argumen. Cukup ganti ",(0,i.kt)("inlineCode",{parentName:"p"},"namaVariabel")," dengan nama variabel yang ingin di-format."),(0,i.kt)("p",null,"Silakan lihat contoh berikut. Keduanya adalah ekuivalen, menghasilkan nilai yang sama."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'println!("array {:?}", numbers);\nprintln!("array {numbers:?}");\n')),(0,i.kt)("h2",{id:"a132-notasi-penulisan-tipe-data-array"},"A.13.2. Notasi penulisan tipe data array"),(0,i.kt)("p",null,"Pada contoh program yang sudah dipraktikkan, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," tipe datanya adalah array numerik, terlihat saat deklarasinya ",(0,i.kt)("em",{parentName:"p"},"predefined value")," diisi dengan literal elemen array bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),"."),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"i32")," di sini adalah milik elemen array, sedang array ",(0,i.kt)("inlineCode",{parentName:"p"},"numbers")," itu sendiri tipe datanya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"[i32; 4]"),", yang artinya adalah ",(0,i.kt)("strong",{parentName:"p"},"sebuah array dengan elemen bertipe ",(0,i.kt)("inlineCode",{parentName:"strong"},"i32")," dengan size ",(0,i.kt)("inlineCode",{parentName:"strong"},"4")),"."),(0,i.kt)("p",null,"Jika kawan-kawan menggunakan ekstensi VSCode ",(0,i.kt)("inlineCode",{parentName:"p"},"rust-analyzer"),", akan terlihat informasi tipe data array-nya."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"array",src:n(2957).Z,width:"445",height:"336"})),(0,i.kt)("h2",{id:"a133-macam-macam-deklarasi-array"},"A.13.3. Macam-macam deklarasi array"),(0,i.kt)("p",null,"Array lebih mudah dideklarasikan dengan metode ",(0,i.kt)("em",{parentName:"p"},"type inference"),". Namun tak menutup kemungkinan ada kebutuhan di mana array harus dideklarasikan dengan menuliskan tipe datanya secara eksplisit. Berikut adalah macam-macam cara mendeklarasikan array."),(0,i.kt)("h3",{id:"-deklarasi-array-dengan-metode-type-inference"},"\u25c9 Deklarasi array dengan metode ",(0,i.kt)("em",{parentName:"h3"},"type inference")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let angka_integer = [24, 12, 32, 7];\nprintln!("{angka_integer:?}");\n// output: [24, 12, 32, 7]\n\nlet angka_float = [24.2, 12.5, 32.00002, 7.2];\nprintln!("{angka_float:?}");\n// output: [24.2, 12.5, 32.00002, 7.2]\n')),(0,i.kt)("h3",{id:"-deklarasi-array-dengan-metode-manifest-typing-disertai-predefined-value"},"\u25c9 Deklarasi array dengan metode ",(0,i.kt)("em",{parentName:"h3"},"manifest typing")," disertai ",(0,i.kt)("em",{parentName:"h3"},"predefined value")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_boolean: [bool; 2] = [false, true];\nprintln!("{data_boolean:?}");\n// output: [false, true]\n\nlet angka_unsigned_integer: [u32; 3] = [24, 0, 12];\nprintln!("{angka_unsigned_integer:?}");\n// output: [24, 0, 12]\n')),(0,i.kt)("h3",{id:"-deklarasi-array-dengan-notasi-penulisan-t-n"},"\u25c9 Deklarasi array dengan notasi penulisan ",(0,i.kt)("inlineCode",{parentName:"h3"},"[T; N]")),(0,i.kt)("p",null,"Pada contoh berikut, ",(0,i.kt)("inlineCode",{parentName:"p"},"data_numerik1")," dideklarasikan bertipe array dengan tipe data data elemen adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),", mempunyai size ",(0,i.kt)("inlineCode",{parentName:"p"},"10"),", dengan ",(0,i.kt)("em",{parentName:"p"},"predefined value")," untuk setiap elemen array adalah angka ",(0,i.kt)("inlineCode",{parentName:"p"},"0"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_numerik1: [i32; 10] = [0; 10];\nprintln!("{data_numerik1:?}");\n// output: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n')),(0,i.kt)("p",null,"Pada contoh ke-dua ini, ",(0,i.kt)("inlineCode",{parentName:"p"},"data_numerik2")," dideklarasikan dengan ",(0,i.kt)("em",{parentName:"p"},"predefined value")," adalah array yang size-nya ",(0,i.kt)("inlineCode",{parentName:"p"},"5")," dan nilai default tiap elemen adalah angka ",(0,i.kt)("inlineCode",{parentName:"p"},"4"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_numerik2 = [4; 5];\nprintln!("{data_numerik2:?}");\n// output: [4, 4, 4, 4, 4]\n')),(0,i.kt)("p",null,"Tambahan penjelasan mengenai notasi penulisan ",(0,i.kt)("inlineCode",{parentName:"p"},"[T; N]"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Jika digunakan pada penulisan tipe data array saat deklarasi, ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," adalah tipe data elemen, dan ",(0,i.kt)("inlineCode",{parentName:"li"},"N")," adalah lebar/size array. Contoh: ",(0,i.kt)("inlineCode",{parentName:"li"},"let data_numerik1: [i32; 10]"),"."),(0,i.kt)("li",{parentName:"ul"},"Jika digunakan pada penulisan ",(0,i.kt)("em",{parentName:"li"},"predefined value"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," adalah nilai setiap elemen array, dan ",(0,i.kt)("inlineCode",{parentName:"li"},"N")," adalah lebar/size array. Contoh: ",(0,i.kt)("inlineCode",{parentName:"li"},"[4; 2]"),", yang artinya semua elemen array diisi dengan angka ",(0,i.kt)("inlineCode",{parentName:"li"},"4"),".")),(0,i.kt)("h2",{id:"a134-melihat-size-array-menggunakan-method-len"},"A.13.4. Melihat size array menggunakan method ",(0,i.kt)("inlineCode",{parentName:"h2"},"len")),(0,i.kt)("p",null,"Array secara ",(0,i.kt)("em",{parentName:"p"},"default")," properti tipe data ",(0,i.kt)("strong",{parentName:"p"},"slice"),", yang salah satunya adalah method bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"len")," yang berguna untuk melihat size dari sebuah array. Cara penggunaannya cukup dengan menuliskan ",(0,i.kt)("inlineCode",{parentName:"p"},".len()")," setelah variabel array. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let names = ["jason", "grayon", "drake", "damian"];\nlet length = names.len();\nprintln!("array size is {}", length);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"array for in",src:n(7674).Z,width:"449",height:"113"})),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai slice dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/slice"},"Slice"))),(0,i.kt)("h2",{id:"a135-iterasi-array-menggunakan-for-in"},"A.13.5. Iterasi array menggunakan ",(0,i.kt)("inlineCode",{parentName:"h2"},"for in")),(0,i.kt)("p",null,"Pada contoh berikut, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"names")," adalah array bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"[&str; 4]"),", dideklarasikan dengan ",(0,i.kt)("em",{parentName:"p"},"predefined value"),". Elemen array tersebut kemudian diiterasi menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," untuk di-print ke layar console value setiap elemennya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let names: [&str; 4] = ["jason", "grayon", "drake", "damian"];\nfor name in names {\n println!("{name}");\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"array for in",src:n(2977).Z,width:"445",height:"149"})),(0,i.kt)("p",null,"Bisa juga dengan memanfaatkan ",(0,i.kt)("em",{parentName:"p"},"range syntax")," dalam perulangan array. Benefitnya adalah pengaksesan indeks array lebih mudah."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let names: [&str; 4] = ["jason", "grayon", "drake", "damian"];\nfor i in 0..names.len() {\n println!("array index ke-{}: {}", i, names[i]);\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"array for in",src:n(4097).Z,width:"447",height:"148"})),(0,i.kt)("p",null,"Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"names.len()")," mengembalikan informasi size sebuah array, nilainya bisa dimanfaatkan dalam perulangan ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," untuk iterasi indeks ke-0 hingga terakhir."),(0,i.kt)("h2",{id:"a136-iterasi-array-menggunakan-while-dan-loop"},"A.13.6. Iterasi array menggunakan ",(0,i.kt)("inlineCode",{parentName:"h2"},"while")," dan ",(0,i.kt)("inlineCode",{parentName:"h2"},"loop")),(0,i.kt)("p",null,"Contoh iterasi array menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"while"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let names: [&str; 4] = ["jason", "grayon", "drake", "damian"];\n\nlet mut i = 0;\nwhile i < names.len() {\n println!("array index ke-{}: {}", i, names[i]);\n i += 1;\n}\n')),(0,i.kt)("p",null,"Contoh iterasi array menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"loop"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let names: [&str; 4] = ["jason", "grayon", "drake", "damian"];\n\nlet mut i = 0;\nloop {\n if i >= names.len() {\n break;\n }\n\n println!("array index ke-{}: {}", i, names[i]);\n i += 1;\n}\n')),(0,i.kt)("p",null,"Iterasi array menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"while")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"loop")," umumnya kurang praktis jika dibandingkan dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"for in"),". Tapi pastinya ada case di mana ",(0,i.kt)("inlineCode",{parentName:"p"},"while")," dan/atau ",(0,i.kt)("inlineCode",{parentName:"p"},"loop")," akan dibutuhkan."),(0,i.kt)("h2",{id:"a137-iterasi-array-menggunakan-for-in-dan-tuple"},"A.13.7. Iterasi array menggunakan ",(0,i.kt)("inlineCode",{parentName:"h2"},"for in")," dan ",(0,i.kt)("em",{parentName:"h2"},"tuple")),(0,i.kt)("p",null,"Mengiterasi value sekaligus ",(0,i.kt)("em",{parentName:"p"},"counter")," perulangan sebenarnya bisa juga dilakukan menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"for in"),", contohnya seperti yang sudah kita praktikkan di atas yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"for i in 0..names.len()"),"."),(0,i.kt)("p",null,"Ada juga bentuk lain pemanfaatan ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," untuk mengiterasi sebuah array. Caranya dengan menggunakan teknik tuple untuk menampung data ",(0,i.kt)("em",{parentName:"p"},"counter")," sekaligus value tiap elemen. Lebih jelasnya silakan lihat dan praktikkan contoh berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let names: [&str; 4] = ["jason", "grayon", "drake", "damian"];\n\nfor (i, name) in names.iter().enumerate() {\n println!("array index ke-{i}: {name}");\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"array enumerate",src:n(4097).Z,width:"447",height:"148"})),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"names")," yang notabene bertipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"[&str; 4]")," perlu dikonversi ke tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Iterator")," terlebih dahulu caranya lewat pemanggilan method ",(0,i.kt)("inlineCode",{parentName:"p"},".iter()"),". Kemudian dari tipe tersebut perlu dikonversi lagi ke tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Enumerate")," dengan cara memanggil method ",(0,i.kt)("inlineCode",{parentName:"p"},".enumerate()"),"."),(0,i.kt)("p",null,"Setelah mendapatkan objek bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Enumerate"),", keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," digunakan untuk menampung tiap elemen array dalam bentuk ",(0,i.kt)("em",{parentName:"p"},"tuple")," ",(0,i.kt)("inlineCode",{parentName:"p"},"(i, name)"),". Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"i")," di situ berisi counter iterasi, dan ",(0,i.kt)("inlineCode",{parentName:"p"},"name")," adalah value-nya."),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai traits dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/traits"},"Traits")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai ",(0,i.kt)("inlineCode",{parentName:"li"},"Enumerate")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/trait-iterator"},"Trait \u279c Iterator")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai tuple dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/tuple"},"Tuple")))),(0,i.kt)("h2",{id:"a138-append-elemen-ke-array"},"A.13.8. Append elemen ke array"),(0,i.kt)("p",null,"Operasi menambahkan sebuah elemen ke array yang hasilnya melebihi kapasitas ... adalah tidak bisa. Karena array memiliki size fixed, tidak dinamis. Solusinya adalah menggunakan tipe data Vector. Nantinya array perlu dikonversi ke bentu Vector terlebih dahulu kemudian di-append, lebih jelasnya kita bahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/vector"},"Vector"),"."),(0,i.kt)("h2",{id:"a139-nested-array"},"A.13.9. Nested array"),(0,i.kt)("p",null,"Data nested array bisa dibuat dengan level kedalaman tanpa batas, tetapi harus mengikuti aturan tipe data array yaitu: fixed size dan elemen bertipe data sejenis."),(0,i.kt)("p",null,"Pada contoh berikut variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"data_arr")," didefinisikan sebagai sebuah array bersarang atau nested dengan kedalaman 2 level."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let data_arr = [\n ["salad", "fried rice"],\n ["apple", "coconut"],\n ["spinach", "jalapeno"],\n];\nfor sub_arr in data_arr {\n for el in sub_arr {\n print!("{el}, ");\n }\n println!();\n}\n\n// salad, fried rice,\n// apple, coconut,\n// spinach, jalapeno,\n')),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"data_arr")," pada contoh di atas bertipe data",(0,i.kt)("inlineCode",{parentName:"p"},"[[&str; 2]; 3]"),", yang artinya adalah sebuah array dengan size 3, dengan isi elemen adalah juga array dengan size 2. Selalu ingat bahwa size array adalah fixed."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/array"},"github.com/novalagung/dasarpemrogramanrust-example/../array")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/slice"},"Slice (Basic)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/vector"},"Tipe Data \u279c Vector")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/slice-memory-management"},"Slice Memory Management"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/primitive.array.html"},"https://doc.rust-lang.org/std/primitive.array.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/primitive.slice.html"},"https://doc.rust-lang.org/std/primitive.slice.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/iter/index.html"},"https://doc.rust-lang.org/std/iter/index.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/iter/struct.Enumerate.html"},"https://doc.rust-lang.org/std/iter/struct.Enumerate.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/iter/trait.Iterator.html"},"https://doc.rust-lang.org/std/iter/trait.Iterator.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/trait/iter.html"},"https://doc.rust-lang.org/rust-by-example/trait/iter.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/flow_control/for.html"},"https://doc.rust-lang.org/rust-by-example/flow_control/for.html"))))}u.isMDXComponent=!0},3421:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/array-1-919358da6705a5ced706fbcd108be794.png"},2957:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/array-2-bc70d4683afb247a4d30a6551aabec0a.png"},7674:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcEAAABxCAIAAAAiZI9+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtM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dkK6jpH/RVPMP6UEul9846AxcsagJALjE+M7TD748NV6strK5Y32tJRObbrE1ma37uxVZX8g82C835bX8BjMFAAAYf/zHm9u53SVduLiym1dXH3iH9NQt1hPKz+/kcsWd1fz9rfu0uZPrzNShlwQAuFxADwkAAMTAuXcAABADfhMAAMSA3wQAADHgNwEAQAz4TQAAEAN+EwAAxBiobnEnXhHyxQCAKwPGmwAAIEa/nk/3YTuXwcPoAICrQze6xQyJ4o18camhzilKpKnulhNrSqSp5u9vUSecTcrDrXC8srnzgB7uR3PaQ/AQ/gAAjC/d6BazJYplJbqf2a1ElDXt/8TqCh1s3de0ja1peigcR5TcaiNvlUIGAIBxpBvdYrZEcVMtblv/98RL4biyq+l7OGSPAQBgvOhqfdNDonhI0QEAYKR0sZ9uSBTrM+1mcIx+RgcAgBHTpW6xl0QxJz1GBwCAEdKFbnGARHGHrQPrhHytWFzT9sk5owMAwHgC3WIAABADzwsBAIAY8JsAACAG/CYAAIgBvwkAAGLAbwIAgBjwmwAAIAb8JgAAiAG/CQAAYsBvAgCAGPCbAAAgBvwmAACIAb8JAABiwG8CAIAY8JsAACAG/CYAAIgBvwkAAGL8P8WW/mrC7FDtAAAAAElFTkSuQmCC"}}]); \ No newline at end of file diff --git a/assets/js/db8ccf76.18592c1d.js b/assets/js/db8ccf76.18592c1d.js new file mode 100644 index 00000000..99482154 --- /dev/null +++ b/assets/js/db8ccf76.18592c1d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4861],{3905:(a,t,e)=>{e.d(t,{Zo:()=>s,kt:()=>o});var n=e(7294);function i(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}function r(a,t){var e=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(a,t).enumerable}))),e.push.apply(e,n)}return e}function l(a){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?r(Object(e),!0).forEach((function(t){i(a,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(e)):r(Object(e)).forEach((function(t){Object.defineProperty(a,t,Object.getOwnPropertyDescriptor(e,t))}))}return a}function p(a,t){if(null==a)return{};var e,n,i=function(a,t){if(null==a)return{};var e,n,i={},r=Object.keys(a);for(n=0;n<r.length;n++)e=r[n],t.indexOf(e)>=0||(i[e]=a[e]);return i}(a,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(n=0;n<r.length;n++)e=r[n],t.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(a,e)&&(i[e]=a[e])}return i}var d=n.createContext({}),m=function(a){var t=n.useContext(d),e=t;return a&&(e="function"==typeof a?a(t):l(l({},t),a)),e},s=function(a){var t=m(a.components);return n.createElement(d.Provider,{value:t},a.children)},u={inlineCode:"code",wrapper:function(a){var t=a.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(a,t){var e=a.components,i=a.mdxType,r=a.originalType,d=a.parentName,s=p(a,["components","mdxType","originalType","parentName"]),k=m(e),o=i,c=k["".concat(d,".").concat(o)]||k[o]||u[o]||r;return e?n.createElement(c,l(l({ref:t},s),{},{components:e})):n.createElement(c,l({ref:t},s))}));function o(a,t){var e=arguments,i=t&&t.mdxType;if("string"==typeof a||i){var r=e.length,l=new Array(r);l[0]=k;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=a,p.mdxType="string"==typeof a?a:i,l[1]=p;for(var m=2;m<r;m++)l[m]=e[m];return n.createElement.apply(null,l)}return n.createElement.apply(null,e)}k.displayName="MDXCreateElement"},5443:(a,t,e)=>{e.r(t),e.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>u,frontMatter:()=>r,metadata:()=>p,toc:()=>m});var n=e(7462),i=(e(7294),e(3905));const r={sidebar_position:36,title:"A.36. Traits",sidebar_label:"A.36. Traits"},l=void 0,p={unversionedId:"basic/traits",id:"basic/traits",title:"A.36. Traits",description:"Trait jika diartikan dalam Bahasa Indonesia artinya adalah sifat. Chapter ini akan membahas tentang apa itu trait, apa kegunaannya, dan bagaimana cara penerapannya di Rust programming.",source:"@site/docs/basic/traits.md",sourceDirName:"basic",slug:"/basic/traits",permalink:"/basic/traits",draft:!1,tags:[],version:"current",sidebarPosition:36,frontMatter:{sidebar_position:36,title:"A.36. Traits",sidebar_label:"A.36. Traits"},sidebar:"tutorialSidebar",previous:{title:"A.35. Borrowing",permalink:"/basic/borrowing"},next:{title:"A.37. Traits \u279c Advanced",permalink:"/basic/advanced-traits"}},d={},m=[{value:"A.36.1. Konsep traits",id:"a361-konsep-traits",level:2},{value:"\u25c9 Jenis traits berdasarkan tempat dideklarasikannya",id:"-jenis-traits-berdasarkan-tempat-dideklarasikannya",level:3},{value:"A.36.2. Implementasi trait",id:"a362-implementasi-trait",level:2},{value:"\u25c9 Struct <code>Circle</code>",id:"-struct-circle",level:3},{value:"\u25c9 Block kode <code>impl X for Y</code>",id:"-block-kode-impl-x-for-y",level:3},{value:"\u25c9 Block kode method dalam <code>impl</code>",id:"-block-kode-method-dalam-impl",level:3},{value:"\u25c9 Macro <code>write</code>",id:"-macro-write",level:3},{value:"\u25c9 Print data menggunakan formatted print <code>{:?}</code>",id:"-print-data-menggunakan-formatted-print-",level:3},{value:"\u25c9 Print data menggunakan formatted print <code>{}</code>",id:"-print-data-menggunakan-formatted-print--1",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Work in progress",id:"-work-in-progress",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],s={toc:m};function u(a){let{components:t,...r}=a;return(0,i.kt)("wrapper",(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Trait jika diartikan dalam Bahasa Indonesia artinya adalah sifat. Chapter ini akan membahas tentang apa itu trait, apa kegunaannya, dan bagaimana cara penerapannya di Rust programming."),(0,i.kt)("h2",{id:"a361-konsep-traits"},"A.36.1. Konsep traits"),(0,i.kt)("p",null,"Di Rust kita bisa mendefinisikan trait/sifat, isinya adalah definisi header method yang bisa di-share ke banyak tipe data."),(0,i.kt)("p",null,"Trait isinya hanya definisi header method (bisa diartikan method tanpa isi). Ketika ada tipe data yang meng-implement suatu trait, maka tipe tersebut wajib untuk menuliskan implementasi method sesuai dengan header method yang ada di trait."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pada bahasa pemrograman lain, contohnya Java, konsep trait mirip dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"interface"))),(0,i.kt)("p",null,"Ada dua bagian penting dalam trait yang harus diketahui:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Deklarasi trait"),(0,i.kt)("li",{parentName:"ol"},"Implementasi trait ke tipe data")),(0,i.kt)("p",null,"Perihal point pertama, intinya kita bisa menciptakan trait sesuai kebutuhan. Terlepas dari itu, Rust juga menyediakan cukup banyak traits yang di-implement ke banyak tipe data yang ada di Rust standard library. Beberapa di antaranya:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Trait ",(0,i.kt)("inlineCode",{parentName:"li"},"std::fmt::Debug"),", digunakan agar data bisa di-print menggunakan formatted print ",(0,i.kt)("inlineCode",{parentName:"li"},"{:?}"),"."),(0,i.kt)("li",{parentName:"ul"},"Trait ",(0,i.kt)("inlineCode",{parentName:"li"},"std::iter::Enumerate"),", digunakan agar data bisa di-iterasi menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"li"},"for"),"."),(0,i.kt)("li",{parentName:"ul"},"Trait ",(0,i.kt)("inlineCode",{parentName:"li"},"std::ops::Add"),", di-implementasikan agar data bisa digunakan pada operasi aritmatik penambahan ",(0,i.kt)("inlineCode",{parentName:"li"},"+"),".")),(0,i.kt)("p",null,"Ok, biar lebih jelas, mari lanjut pembelajaran menggunakan contoh. Kita mulai dengan pembahasan tentang cara implementasi trait. Contoh yang digunakan adalah implementasi salah satu trait milik Rust standard library, yaitu trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Debug"),"."),(0,i.kt)("h3",{id:"-jenis-traits-berdasarkan-tempat-dideklarasikannya"},"\u25c9 Jenis traits berdasarkan tempat dideklarasikannya"),(0,i.kt)("p",null,"Berdasarkan tempat dimana traits dibuat, ada 2 jenis traits:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"External traits")," (atau foreign traits)."),(0,i.kt)("p",{parentName:"li"}," Yaitu traits yang tempat dideklarasikannya berada di luar create kode yang ditulis. Misalnya, trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Debug")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"std::ops::Add"),", keduanya merupakan external traits yang berada di crate ",(0,i.kt)("inlineCode",{parentName:"p"},"std")," atau crate Rust Standard Library."),(0,i.kt)("p",{parentName:"li"}," Pada case yang berhubungan dengan external traits, kita programmer umumnya hanya fokus ke implementasi saya, bagaimana cara memanfaatkan dan menggunakan external traits yang sudah ada ke dalam kode yang ditulis.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Local traits"),"."),(0,i.kt)("p",{parentName:"li"}," Adalah traits yang kita ciptakan di crate yang berada di dalam package/project yang sedang kita kerjakan. "))),(0,i.kt)("p",null,"Chapter ini fokusnya adalah pembahasan tentang dasar implementasi ",(0,i.kt)("strong",{parentName:"p"},"external traits")," dan cara kerjanya."),(0,i.kt)("h2",{id:"a362-implementasi-trait"},"A.36.2. Implementasi trait"),(0,i.kt)("p",null,"Kita pilih trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Debug")," milik Rust standard library untuk belajar cara implementasi trait pada tipe data."),(0,i.kt)("p",null,"Kegunaan dari trait ini adalah: jika di-implement ke tipe data tertentu maka data dengan tipe tersebut bisa di-print via macro ",(0,i.kt)("inlineCode",{parentName:"p"},"println")," atau macro printing lainnya, dengan menggunakan formatted print ",(0,i.kt)("inlineCode",{parentName:"p"},"{:?}"),"."),(0,i.kt)("p",null,"Trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," ini diimplementasikan ke pada banyak tipe data yang di Rust standard library, baik itu tipe primitif maupun non-primitif. Contohnya bisa dilihat pada kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let number = 12;\nprintln!("{:?}", number);\n\nlet text = String::from("hello");\nprintln!("{:?}", text);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Trait",src:e(2767).Z,width:"451",height:"109"})),(0,i.kt)("p",null,"Dua variabel di atas sukses di-print tanpa error, karena tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"i32")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," ",(0,i.kt)("em",{parentName:"p"},"by default")," sudah implement trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Debug"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Jika tertarik untuk pengecekan lebih lanjut, silakan lihat di halaman dokumentasi tipe data ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/std/primitive.i32.html"},"i32")," dan ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/std/string/struct.String.html"},"String"),".")),(0,i.kt)("p",null,"Bagaimana dengan custom type yang kita buat sendiri? Misalnya struct."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let circle_one = Circle{raidus: 6};\n println!("{:?}", circle_one);\n}\n\nstruct Circle {\n raidus: i32,\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Trait",src:e(9856).Z,width:"841",height:"512"})),(0,i.kt)("p",null,"Hasilnya error, karena struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," yang dibuat tidak implement trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Debug"),"."),(0,i.kt)("p",null,"Solusi agar tidak error adalah dengan mengimplementasikan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Debug")," ke tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle"),", dengan itu semua data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," akan bisa di-print menggunakan formatted print ",(0,i.kt)("inlineCode",{parentName:"p"},"{:?}"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Selain via implementasi trait, tipe data custom bisa di-print dengan cara menambahkan atribut ",(0,i.kt)("inlineCode",{parentName:"p"},"#[derive(Debug)]")," pada definisi tipe data-nya. Namun kita tidak membahas itu pada chapter ini.")),(0,i.kt)("p",null,"Langkah pertama untuk implementasi trait adalah mencari tau terlebih dahulu spesifikasi trait yang ingin diimplementasikan. Trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Debug")," adalah traits milik Rust standard library, maka harusnya spesifikasi bisa dilihat di dokumentasi Rust."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/std/fmt/trait.Debug.html"},"https://doc.rust-lang.org/std/fmt/trait.Debug.html"))),(0,i.kt)("p",null,"Pada URL dokumentasi bisa dilihat kalau trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," memiliki struktur kurang lebih seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait Debug {\n fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>;\n}\n")),(0,i.kt)("p",null,"Trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," mempunyai satu spesifikasi method, bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"fmt")," yang detail strukturnya bisa dilihat di atas."),(0,i.kt)("p",null,"Kita akan implement trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," ini ke tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle"),", maka wajib hukumnya untuk menuliskan implementasi method sesuai dengan yang ada di trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug"),"."),(0,i.kt)("p",null,"Di bawah ini adalah contoh cara implementasi trait."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'struct Circle {\n raidus: i32,\n}\n\nimpl std::fmt::Debug for Circle {\n fn fmt(&self, f: &mut std::fmt::Formatter<\'_>) -> std::fmt::Result {\n write!(f, "Circle radius: {}", self.raidus)\n }\n}\n\nfn main() {\n let circle_one = Circle{raidus: 6};\n println!("{:?}", circle_one);\n}\n')),(0,i.kt)("p",null,"Ketika program di-run, hasilnya sukses tanpa error. Artinya implementasi trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," pada tipe data struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," adalah sukses."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Trait",src:e(4666).Z,width:"457",height:"115"})),(0,i.kt)("p",null,"Cara implementasi trait ke struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," memang step-nya agak panjang, tapi penulis yakin lama-kelamaan pasti terbiasa. Ok, sekarang kita bahas satu per satu kode di atas."),(0,i.kt)("h3",{id:"-struct-circle"},"\u25c9 Struct ",(0,i.kt)("inlineCode",{parentName:"h3"},"Circle")),(0,i.kt)("p",null,"Block kode definisi struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," cukup straightforward, isinya hanya 1 property bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"radius")," bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),"."),(0,i.kt)("h3",{id:"-block-kode-impl-x-for-y"},"\u25c9 Block kode ",(0,i.kt)("inlineCode",{parentName:"h3"},"impl X for Y")),(0,i.kt)("p",null,"Notasi penulisan implementasi trait adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"impl X for Y"),", yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"X")," adalah trait yang ingin diimplementasikan dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Y")," adalah tipe data tujuan implementasi."),(0,i.kt)("p",null,"Pada contoh di atas, trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," diimplementasikan ke custom type struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle"),". Maka statement-nya adalah:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"impl std::fmt::Debug for Circle {\n // ...\n}\n")),(0,i.kt)("h3",{id:"-block-kode-method-dalam-impl"},"\u25c9 Block kode method dalam ",(0,i.kt)("inlineCode",{parentName:"h3"},"impl")),(0,i.kt)("p",null,"Block kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," harus diikuti dengan implementasi method. Pada contoh ini, method ",(0,i.kt)("inlineCode",{parentName:"p"},"fmt")," milik trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," wajib untuk diimplementasikan. Spesifikasi method ini adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>")," (lebih jelasnya silakan lihat dokumentasi)."),(0,i.kt)("p",null,"Silakan copy method tersebut kemudian paste ke dalam block kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," yang sudah ditulis, kemudian tambahkan block kurung kurawal."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"impl std::fmt::Debug for Circle {\n fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n // ...\n }\n}\n")),(0,i.kt)("p",null,"Kemudian tulis implementasi method ",(0,i.kt)("inlineCode",{parentName:"p"},"fmt")," dalam block method. Tulis statement macro ",(0,i.kt)("inlineCode",{parentName:"p"},"write")," untuk data string (yang ingin di-print) dengan tujuan adalah variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"f"),"."),(0,i.kt)("p",null,"Di contoh, format ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle radius: {}")," digunakan. Dengan ini nantinya saat printing data, yang muncul adalah text ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle radius: {}"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'impl std::fmt::Debug for Circle {\n fn fmt(&self, f: &mut std::fmt::Formatter<\'_>) -> std::fmt::Result {\n write!(f, "Circle radius: {}", self.raidus)\n }\n}\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Tips untuk pengguna visual studio code dengan rust-analyzer extension ter-install, setelah selesai menulis block kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl"),", cukup jalankan ",(0,i.kt)("inlineCode",{parentName:"p"},"ctrl+space")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"cmd+space")," untuk men-trigger autocomplete suggestion. Kemudian klik opsi method yang ada di situ, maka kode implementasi method langsung muncul dengan sendirinya.")),(0,i.kt)("h3",{id:"-macro-write"},"\u25c9 Macro ",(0,i.kt)("inlineCode",{parentName:"h3"},"write")),(0,i.kt)("p",null,"Macro ini digunakan untuk menuliskan sebuah data ke object tertentu. Pada contoh kita gunakan untuk menulis string ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle radius: {}")," ke variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"f")," yang bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Formatter<'_>"),"."),(0,i.kt)("p",null,"Notasi penulisan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"write"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'// notasi penulisan\nwrite!(variabel_tujuan, data_yang_ingin_di_print, arg1, arg2, ...);\n\n// contoh penerapan\nwrite!(f, "Circle radius: {}", self.raidus);\n')),(0,i.kt)("h3",{id:"-print-data-menggunakan-formatted-print-"},"\u25c9 Print data menggunakan formatted print ",(0,i.kt)("inlineCode",{parentName:"h3"},"{:?}")),(0,i.kt)("p",null,"Step terakhir adalah print variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"circle")," menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),". Hasilnya sukses, tidak error seperti sebelumnya."),(0,i.kt)("h3",{id:"-print-data-menggunakan-formatted-print--1"},"\u25c9 Print data menggunakan formatted print ",(0,i.kt)("inlineCode",{parentName:"h3"},"{}")),(0,i.kt)("p",null,"Coba tambahkan statement ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),", tetapi kali ini gunakan formatted print ",(0,i.kt)("inlineCode",{parentName:"p"},"{}"),", apakah hasilnya juga tidak error?"),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Trait",src:e(8738).Z,width:"849",height:"309"})),(0,i.kt)("p",null,"Hasilnya error, karena trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Debug")," hanya berguna untuk formatted print ",(0,i.kt)("inlineCode",{parentName:"p"},"{:?}"),". Agar data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," bisa di-print menggunakan formatted print ",(0,i.kt)("inlineCode",{parentName:"p"},"{}")," maka trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Display")," harus di-implementasikan juga."),(0,i.kt)("p",null,"Ubah kode dengan menambahkan implementasi trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Display"),". Hasilnya kurang lebih seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'struct Circle {\n raidus: i32,\n}\n\nimpl std::fmt::Debug for Circle {\n fn fmt(&self, f: &mut std::fmt::Formatter<\'_>) -> std::fmt::Result {\n write!(f, "Circle radius: {}", self.raidus)\n }\n}\n\nimpl std::fmt::Display for Circle {\n fn fmt(&self, f: &mut std::fmt::Formatter<\'_>) -> std::fmt::Result {\n write!(f, "Circle radius: {}", self.raidus)\n }\n}\n')),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Link dokumentasi trait ",(0,i.kt)("inlineCode",{parentName:"li"},"Debug")," ",(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/fmt/trait.Debug.html"},"https://doc.rust-lang.org/std/fmt/trait.Debug.html")),(0,i.kt)("li",{parentName:"ul"},"Link dokumentasi trait ",(0,i.kt)("inlineCode",{parentName:"li"},"Display")," ",(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/fmt/trait.Display.html"},"https://doc.rust-lang.org/std/fmt/trait.Display.html")))),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/traits"},"github.com/novalagung/dasarpemrogramanrust-example/../traits")),(0,i.kt)("h3",{id:"-work-in-progress"},"\u25c9 Work in progress"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Pembahasan tentang trait bounds untuk implementasi method kondisional"),(0,i.kt)("li",{parentName:"ul"},"Pembahasan tentang trait overloading")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch10-02-traits.html"},"https://doc.rust-lang.org/book/ch10-02-traits.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/fmt/trait.Debug.html"},"https://doc.rust-lang.org/std/fmt/trait.Debug.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/fmt/trait.Display.html"},"https://doc.rust-lang.org/std/fmt/trait.Display.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/string/struct.String.html"},"https://doc.rust-lang.org/std/string/struct.String.html"))))}u.isMDXComponent=!0},2767:(a,t,e)=>{e.d(t,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcMAAABtCAIAAABShZ2jAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyM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lOVuBs6RaETyNAHi/Gx439tjpbz7/2kapaZigf4Qrcy8riX9CKEGw1eNV32tP7NN4aaZr6fNtJ7S7v6cfXBNKHDL4P3Byq/uPbc4Ja6cPmn9+/nXfPU2ZkDLE1/uQDQugtshUhhBBsRQgh2IoQQrAVIYQQbEUIIdiKEEKwFSGEEGxFCCHYihBCsBUhhGArQggh2IoQQrAVIYRgK0IIIdiKEEKH1P/rrMjnM/fMegAAAABJRU5ErkJggg=="},8738:(a,t,e)=>{e.d(t,{Z:()=>n});const n=e.p+"assets/images/traits-4-fe5c6a716894397c8088bae54e7194f9.png"}}]); \ No newline at end of file diff --git a/assets/js/db8ccf76.3fc0ba0e.js b/assets/js/db8ccf76.3fc0ba0e.js deleted file mode 100644 index fd95552e..00000000 --- a/assets/js/db8ccf76.3fc0ba0e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[4861],{3905:(a,t,e)=>{e.d(t,{Zo:()=>s,kt:()=>o});var n=e(7294);function i(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}function r(a,t){var e=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(a,t).enumerable}))),e.push.apply(e,n)}return e}function l(a){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?r(Object(e),!0).forEach((function(t){i(a,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(e)):r(Object(e)).forEach((function(t){Object.defineProperty(a,t,Object.getOwnPropertyDescriptor(e,t))}))}return a}function p(a,t){if(null==a)return{};var e,n,i=function(a,t){if(null==a)return{};var e,n,i={},r=Object.keys(a);for(n=0;n<r.length;n++)e=r[n],t.indexOf(e)>=0||(i[e]=a[e]);return i}(a,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(n=0;n<r.length;n++)e=r[n],t.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(a,e)&&(i[e]=a[e])}return i}var d=n.createContext({}),m=function(a){var t=n.useContext(d),e=t;return a&&(e="function"==typeof a?a(t):l(l({},t),a)),e},s=function(a){var t=m(a.components);return n.createElement(d.Provider,{value:t},a.children)},u={inlineCode:"code",wrapper:function(a){var t=a.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(a,t){var e=a.components,i=a.mdxType,r=a.originalType,d=a.parentName,s=p(a,["components","mdxType","originalType","parentName"]),k=m(e),o=i,c=k["".concat(d,".").concat(o)]||k[o]||u[o]||r;return e?n.createElement(c,l(l({ref:t},s),{},{components:e})):n.createElement(c,l({ref:t},s))}));function o(a,t){var e=arguments,i=t&&t.mdxType;if("string"==typeof a||i){var r=e.length,l=new Array(r);l[0]=k;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=a,p.mdxType="string"==typeof a?a:i,l[1]=p;for(var m=2;m<r;m++)l[m]=e[m];return n.createElement.apply(null,l)}return n.createElement.apply(null,e)}k.displayName="MDXCreateElement"},5443:(a,t,e)=>{e.r(t),e.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>u,frontMatter:()=>r,metadata:()=>p,toc:()=>m});var n=e(7462),i=(e(7294),e(3905));const r={sidebar_position:36,title:"A.36. Traits",sidebar_label:"A.36. Traits"},l=void 0,p={unversionedId:"basic/traits",id:"basic/traits",title:"A.36. Traits",description:"Trait jika diartikan dalam Bahasa Indonesia artinya adalah sifat. Chapter ini akan membahas tentang apa itu trait, apa kegunaannya, dan bagaimana cara penerapannya di Rust programming.",source:"@site/docs/basic/traits.md",sourceDirName:"basic",slug:"/basic/traits",permalink:"/basic/traits",draft:!1,tags:[],version:"current",sidebarPosition:36,frontMatter:{sidebar_position:36,title:"A.36. Traits",sidebar_label:"A.36. Traits"},sidebar:"tutorialSidebar",previous:{title:"A.35. Borrowing",permalink:"/basic/borrowing"},next:{title:"A.37. Traits \u279c Advanced",permalink:"/basic/advanced-traits"}},d={},m=[{value:"A.36.1. Konsep traits",id:"a361-konsep-traits",level:2},{value:"\u25c9 Jenis traits berdasarkan tempat dideklarasikannya",id:"-jenis-traits-berdasarkan-tempat-dideklarasikannya",level:3},{value:"A.36.2. Implementasi trait",id:"a362-implementasi-trait",level:2},{value:"\u25c9 Struct <code>Circle</code>",id:"-struct-circle",level:3},{value:"\u25c9 Block kode <code>impl X for Y</code>",id:"-block-kode-impl-x-for-y",level:3},{value:"\u25c9 Block kode method dalam <code>impl</code>",id:"-block-kode-method-dalam-impl",level:3},{value:"\u25c9 Macro <code>write</code>",id:"-macro-write",level:3},{value:"\u25c9 Print data menggunakan formatted print <code>{:?}</code>",id:"-print-data-menggunakan-formatted-print-",level:3},{value:"\u25c9 Print data menggunakan formatted print <code>{}</code>",id:"-print-data-menggunakan-formatted-print--1",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Work in progress",id:"-work-in-progress",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],s={toc:m};function u(a){let{components:t,...r}=a;return(0,i.kt)("wrapper",(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Trait jika diartikan dalam Bahasa Indonesia artinya adalah sifat. Chapter ini akan membahas tentang apa itu trait, apa kegunaannya, dan bagaimana cara penerapannya di Rust programming."),(0,i.kt)("h2",{id:"a361-konsep-traits"},"A.36.1. Konsep traits"),(0,i.kt)("p",null,"Di Rust kita bisa mendefinisikan trait/sifat, isinya adalah definisi header method yang bisa di-share ke banyak tipe data."),(0,i.kt)("p",null,"Trait isinya hanya definisi header method (bisa diartikan method tanpa isi). Ketika ada tipe data yang meng-implement suatu trait, maka tipe tersebut wajib untuk menuliskan implementasi method sesuai dengan header method yang ada di trait."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pada bahasa pemrograman lain, contohnya Java, konsep trait mirip dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"interface"))),(0,i.kt)("p",null,"Ada dua bagian penting dalam trait yang harus diketahui:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Deklarasi trait"),(0,i.kt)("li",{parentName:"ol"},"Implementasi trait ke tipe data")),(0,i.kt)("p",null,"Perihal point pertama, intinya kita bisa menciptakan trait sesuai kebutuhan. Terlepas dari itu, Rust juga menyediakan cukup banyak traits yang di-implement ke banyak tipe data yang ada di Rust standard library. Beberapa di antaranya:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Trait ",(0,i.kt)("inlineCode",{parentName:"li"},"std::fmt::Debug"),", digunakan agar data bisa di-print menggunakan formatted print ",(0,i.kt)("inlineCode",{parentName:"li"},"{:?}"),"."),(0,i.kt)("li",{parentName:"ul"},"Trait ",(0,i.kt)("inlineCode",{parentName:"li"},"std::iter::Enumerate"),", digunakan agar data bisa di-iterasi menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"li"},"for"),"."),(0,i.kt)("li",{parentName:"ul"},"Trait ",(0,i.kt)("inlineCode",{parentName:"li"},"std::ops::Add"),", di-implementasikan agar data bisa digunakan pada operasi aritmatik penambahan ",(0,i.kt)("inlineCode",{parentName:"li"},"+"),".")),(0,i.kt)("p",null,"Ok, biar lebih jelas, mari lanjut pembelajaran menggunakan contoh. Kita mulai dengan pembahasan tentang cara implementasi trait. Contoh yang digunakan adalah implementasi salah satu trait milik Rust standard library, yaitu trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Debug"),"."),(0,i.kt)("h3",{id:"-jenis-traits-berdasarkan-tempat-dideklarasikannya"},"\u25c9 Jenis traits berdasarkan tempat dideklarasikannya"),(0,i.kt)("p",null,"Berdasarkan tempat dimana traits dibuat, ada 2 jenis traits:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"External traits")," (atau foreign traits)."),(0,i.kt)("p",{parentName:"li"}," Yaitu traits yang tempat dideklarasikannya berada di luar create kode yang ditulis. Misalnya, trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Debug")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"std::ops::Add"),", keduanya merupakan external traits yang berada di crate ",(0,i.kt)("inlineCode",{parentName:"p"},"std")," atau crate Rust Standard Library."),(0,i.kt)("p",{parentName:"li"}," Pada case yang berhubungan dengan external traits, kita programmer umumnya hanya fokus ke implementasi saya, bagaimana cara memanfaatkan dan menggunakan external traits yang sudah ada ke dalam kode yang ditulis.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Local traits"),"."),(0,i.kt)("p",{parentName:"li"}," Adalah traits yang kita ciptakan di crate yang berada di dalam package/project yang sedang kita kerjakan. "))),(0,i.kt)("p",null,"Chapter ini fokusnya adalah pembahasan tentang dasar implementasi ",(0,i.kt)("strong",{parentName:"p"},"external traits")," dan cara kerjanya."),(0,i.kt)("h2",{id:"a362-implementasi-trait"},"A.36.2. Implementasi trait"),(0,i.kt)("p",null,"Kita pilih trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Debug")," milik Rust standard library untuk belajar cara implementasi trait pada tipe data."),(0,i.kt)("p",null,"Kegunaan dari trait ini adalah: jika di-implement ke tipe data tertentu maka data dengan tipe tersebut bisa di-print via macro ",(0,i.kt)("inlineCode",{parentName:"p"},"println")," atau macro printing lainnya, dengan menggunakan formatted print ",(0,i.kt)("inlineCode",{parentName:"p"},"{:?}"),"."),(0,i.kt)("p",null,"Trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," ini diimplementasikan ke pada banyak tipe data yang di Rust standard library, baik itu tipe primitif maupun non-primitif. Contohnya bisa dilihat pada kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let number = 12;\nprintln!("{:?}", number);\n\nlet text = String::from("hello");\nprintln!("{:?}", text);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Trait",src:e(2767).Z,width:"451",height:"109"})),(0,i.kt)("p",null,"Dua variabel di atas sukses di-print tanpa error, karena tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"i32")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," ",(0,i.kt)("em",{parentName:"p"},"by default")," sudah implement trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Debug"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Jika tertarik untuk pengecekan lebih lanjut, silakan lihat di halaman dokumentasi tipe data ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/std/primitive.i32.html"},"i32")," dan ",(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/std/string/struct.String.html"},"String"),".")),(0,i.kt)("p",null,"Bagaimana dengan custom type yang kita buat sendiri? Misalnya struct."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let circle_one = Circle{raidus: 6};\n println!("{:?}", circle_one);\n}\n\nstruct Circle {\n raidus: i32,\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Trait",src:e(9856).Z,width:"841",height:"512"})),(0,i.kt)("p",null,"Hasilnya error, karena struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," yang dibuat tidak implement trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Debug"),"."),(0,i.kt)("p",null,"Solusi agar tidak error adalah dengan mengimplementasikan trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Debug")," ke tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle"),", dengan itu semua data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," akan bisa di-print menggunakan formatted print ",(0,i.kt)("inlineCode",{parentName:"p"},"{:?}"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Selain via implementasi trait, tipe data custom bisa di-print dengan cara menambahkan atribut ",(0,i.kt)("inlineCode",{parentName:"p"},"#[derive(Debug)]")," pada definisi tipe data-nya. Namun kita tidak membahas itu pada chapter ini.")),(0,i.kt)("p",null,"Langkah pertama untuk implementasi trait adalah mencari tau terlebih dahulu spesifikasi trait yang ingin diimplementasikan. Trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Debug")," adalah traits milik Rust standard library, maka harusnya spesifikasi bisa dilihat di dokumentasi Rust."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},(0,i.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/std/fmt/trait.Debug.html"},"https://doc.rust-lang.org/std/fmt/trait.Debug.html"))),(0,i.kt)("p",null,"Pada URL dokumentasi bisa dilihat kalau trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," memiliki struktur kurang lebih seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait Debug {\n fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>;\n}\n")),(0,i.kt)("p",null,"Trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," mempunyai satu spesifikasi method, bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"fmt")," yang detail strukturnya bisa dilihat di atas."),(0,i.kt)("p",null,"Kita akan implement trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," ini ke tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle"),", maka wajib hukumnya untuk menuliskan implementasi method sesuai dengan yang ada di trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug"),"."),(0,i.kt)("p",null,"Di bawah ini adalah contoh cara implementasi trait."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'struct Circle {\n raidus: i32,\n}\n\nimpl std::fmt::Debug for Circle {\n fn fmt(&self, f: &mut std::fmt::Formatter<\'_>) -> std::fmt::Result {\n write!(f, "Circle radius: {}", self.raidus)\n }\n}\n\nfn main() {\n let circle_one = Circle{raidus: 6};\n println!("{:?}", circle_one);\n}\n')),(0,i.kt)("p",null,"Ketika program di-run, hasilnya sukses tanpa error. Artinya implementasi trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," pada tipe data struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," adalah sukses."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Trait",src:e(4666).Z,width:"457",height:"115"})),(0,i.kt)("p",null,"Cara implementasi trait ke struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," memang step-nya agak panjang, tapi penulis yakin lama-kelamaan pasti terbiasa. Ok, sekarang kita bahas satu per satu kode di atas."),(0,i.kt)("h3",{id:"-struct-circle"},"\u25c9 Struct ",(0,i.kt)("inlineCode",{parentName:"h3"},"Circle")),(0,i.kt)("p",null,"Block kode definisi struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," cukup straightforward, isinya hanya 1 property bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"radius")," bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),"."),(0,i.kt)("h3",{id:"-block-kode-impl-x-for-y"},"\u25c9 Block kode ",(0,i.kt)("inlineCode",{parentName:"h3"},"impl X for Y")),(0,i.kt)("p",null,"Notasi penulisan implementasi trait adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"impl X for Y"),", yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"X")," adalah trait yang ingin diimplementasikan dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Y")," adalah tipe data tujuan implementasi."),(0,i.kt)("p",null,"Pada contoh di atas, trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," diimplementasikan ke custom type struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle"),". Maka statement-nya adalah:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"impl std::fmt::Debug for Circle {\n // ...\n}\n")),(0,i.kt)("h3",{id:"-block-kode-method-dalam-impl"},"\u25c9 Block kode method dalam ",(0,i.kt)("inlineCode",{parentName:"h3"},"impl")),(0,i.kt)("p",null,"Block kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," harus diikuti dengan implementasi method. Pada contoh ini, method ",(0,i.kt)("inlineCode",{parentName:"p"},"fmt")," milik trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Debug")," wajib untuk diimplementasikan. Spesifikasi method ini adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>")," (lebih jelasnya silakan lihat dokumentasi)."),(0,i.kt)("p",null,"Silakan copy method tersebut kemudian paste ke dalam block kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl")," yang sudah ditulis, kemudian tambahkan block kurung kurawal."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"impl std::fmt::Debug for Circle {\n fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n // ...\n }\n}\n")),(0,i.kt)("p",null,"Kemudian tulis implementasi method ",(0,i.kt)("inlineCode",{parentName:"p"},"fmt")," dalam block method. Tulis statement macro ",(0,i.kt)("inlineCode",{parentName:"p"},"write")," untuk data string (yang ingin di-print) dengan tujuan adalah variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"f"),"."),(0,i.kt)("p",null,"Di contoh, format ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle radius: {}")," digunakan. Dengan ini nantinya saat printing data, yang muncul adalah text ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle radius: {}"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'impl std::fmt::Debug for Circle {\n fn fmt(&self, f: &mut std::fmt::Formatter<\'_>) -> std::fmt::Result {\n write!(f, "Circle radius: {}", self.raidus)\n }\n}\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Tips untuk pengguna visual studio code dengan rust-analyzer extension ter-install, setelah selesai menulis block kode ",(0,i.kt)("inlineCode",{parentName:"p"},"impl"),", cukup jalankan ",(0,i.kt)("inlineCode",{parentName:"p"},"ctrl+space")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"cmd+space")," untuk men-trigger autocomplete suggestion. Kemudian klik opsi method yang ada di situ, maka kode implementasi method langsung muncul dengan sendirinya.")),(0,i.kt)("h3",{id:"-macro-write"},"\u25c9 Macro ",(0,i.kt)("inlineCode",{parentName:"h3"},"write")),(0,i.kt)("p",null,"Macro ini digunakan untuk menuliskan sebuah data ke object tertentu. Pada contoh kita gunakan untuk menulis string ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle radius: {}")," ke variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"f")," yang bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Formatter<'_>"),"."),(0,i.kt)("p",null,"Notasi penulisan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"write"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'// notasi penulisan\nwrite!(variabel_tujuan, data_yang_ingin_di_print, arg1, arg2, ...);\n\n// contoh penerapan\nwrite!(f, "Circle radius: {}", self.raidus);\n')),(0,i.kt)("h3",{id:"-print-data-menggunakan-formatted-print-"},"\u25c9 Print data menggunakan formatted print ",(0,i.kt)("inlineCode",{parentName:"h3"},"{:?}")),(0,i.kt)("p",null,"Step terakhir adalah print variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"circle")," menggunakan macro ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),". Hasilnya sukses, tidak error seperti sebelumnya."),(0,i.kt)("h3",{id:"-print-data-menggunakan-formatted-print--1"},"\u25c9 Print data menggunakan formatted print ",(0,i.kt)("inlineCode",{parentName:"h3"},"{}")),(0,i.kt)("p",null,"Coba tambahkan statement ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),", tetapi kali ini gunakan formatted print ",(0,i.kt)("inlineCode",{parentName:"p"},"{}"),", apakah hasilnya juga tidak error?"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Trait",src:e(8738).Z,width:"849",height:"309"})),(0,i.kt)("p",null,"Hasilnya error, karena trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Debug")," hanya berguna untuk formatted print ",(0,i.kt)("inlineCode",{parentName:"p"},"{:?}"),". Agar data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Circle")," bisa di-print menggunakan formatted print ",(0,i.kt)("inlineCode",{parentName:"p"},"{}")," maka trait ",(0,i.kt)("inlineCode",{parentName:"p"},"std::fmt::Display")," harus di-implementasikan juga."),(0,i.kt)("p",null,"Ubah kode dengan menambahkan implementasi trait ",(0,i.kt)("inlineCode",{parentName:"p"},"Display"),". Hasilnya kurang lebih seperti ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'struct Circle {\n raidus: i32,\n}\n\nimpl std::fmt::Debug for Circle {\n fn fmt(&self, f: &mut std::fmt::Formatter<\'_>) -> std::fmt::Result {\n write!(f, "Circle radius: {}", self.raidus)\n }\n}\n\nimpl std::fmt::Display for Circle {\n fn fmt(&self, f: &mut std::fmt::Formatter<\'_>) -> std::fmt::Result {\n write!(f, "Circle radius: {}", self.raidus)\n }\n}\n')),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Link dokumentasi trait ",(0,i.kt)("inlineCode",{parentName:"li"},"Debug")," ",(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/fmt/trait.Debug.html"},"https://doc.rust-lang.org/std/fmt/trait.Debug.html")),(0,i.kt)("li",{parentName:"ul"},"Link dokumentasi trait ",(0,i.kt)("inlineCode",{parentName:"li"},"Display")," ",(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/fmt/trait.Display.html"},"https://doc.rust-lang.org/std/fmt/trait.Display.html")))),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/traits"},"github.com/novalagung/dasarpemrogramanrust-example/../traits")),(0,i.kt)("h3",{id:"-work-in-progress"},"\u25c9 Work in progress"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Pembahasan tentang trait bounds untuk implementasi method kondisional"),(0,i.kt)("li",{parentName:"ul"},"Pembahasan tentang trait overloading")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch10-02-traits.html"},"https://doc.rust-lang.org/book/ch10-02-traits.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/fmt/trait.Debug.html"},"https://doc.rust-lang.org/std/fmt/trait.Debug.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/fmt/trait.Display.html"},"https://doc.rust-lang.org/std/fmt/trait.Display.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/string/struct.String.html"},"https://doc.rust-lang.org/std/string/struct.String.html"))))}u.isMDXComponent=!0},2767:(a,t,e)=>{e.d(t,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcMAAABtCAIAAABShZ2jAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJl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snrf6M5bV1K75lPdLqUElPTso/vJd3lbJU189k5V0i2NeLM/bW6BnGfMp6SlONWppPJQpylpoeafpwPgbQC7VlIVnwYGzCsoaXfGGXFo8RLd1Ig3U5qtLZBznZOfdih91iKoJatiijromqkUiaQ3sP7URjzFy7NOsGslHbSvmy0dP7s0GTA3Bqou9+ijUp8Ulp7ViDcXn40skCvznLWZDVlLlnv0fcWm2mcMnOa+6A08/CU27A6eSm367jSgpNdNMjd6mF4YV73WZ1lr4fXWPTz5ZNUFUNLbJfoiXh+fbqikZ7AWvup8AqCk5yIe3W8oo2J0v195uoR8JjMQPDYPKCkAAEoKAICSAgAASgoAgJICAKCkAAAoKQAAoKQAACgpAABKCgCAkgIAwCJK+t+PX79+/fz+edzw+fvPXwM//qMaAQAlravoj+/vyjkp6buOHn8c/hpKLAAASprraKeTnyMlzYSWsBQAUNIqKCkAwFpKyuAeAOAkJe2WnYhHAQAlnauknYwSjgIAzFVSZBQAwK+kwYOjPT+/D4+XxhsRVQBASQEAACUFAEBJAQBQUgAAlBQAAFBSAACUFADgWpX0+Gp98G7o4Z/Ot0Sn51GDHeRG99kBAG5MSSfpzHZwHQUlBYBrUNJR8N5FbXiXaUMlFWcHALg4JTXlbXxndJRD85skPiUNXkJFNAHgFpT0qHaTt0ng+ZxaRzmUNNyFoTwA3EpMmvx4F9JA/OLBeF1JE+v95vkDAIArUNLMNKpZSatBLADADSipqX3NMSlfhwKAmxzdlyY3HfOk4Reh7O/vAQBctZLeJ7bQ49edI0bNTTfeR2v3xKMAcO1KCgAAKCkAAEoKAICSAgCgpAAAgJICAKCkAAAoKQAASgoAACgpAABKCgCAkgIAXAf/A/sstK3qbfb1AAAAAElFTkSuQmCC"},9856:(a,t,e)=>{e.d(t,{Z:()=>n});const n=e.p+"assets/images/traits-2-7c5e41bf2bd31dba0f78fc7afd81c7ba.png"},4666:(a,t,e)=>{e.d(t,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAABzCAI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AZwO6MraqGDaxrN6ArV2JM2LV6kG7q3WxYc/eptGWfLaejY+FJL3kdUyVjKEVT5GodPx0en6o6ZgFT1qh62LrmYbdquvweavRsnpiMBvy276we1Ho+qLWxRZHO5lGN9ZLW+shspc8v+2bhrF3zEq5rL1wUzZ9klucJ0/JTvoqOIKtb03FGutpUWK4n7a91jVj3u6OSqSe3M9BsBWNyr5F2MewO7L1BcyYX3U9EYKtx1G+JrAjWMWawHGBdQ31lB/x5CyAYCtCCMFWhBBCsBUhhGArQgjBVoQQgq0IIYRgK0IIwVaEEIKtCCGEYCtCCMFWhBCCrXF9+/Hr16+f3/+Zvuc/33/+6vXj227Nfq5uUtn5lUcIoZXY2oGoU0qjpXg6Efb1s3Xsux3bihA6PFu7GHOA0D/ff6zGoxdl6y7q+g6kIgRbddhl6SAv6nt4DT+Nv4yhW0Y3w9Yx1zqQnIKS3cdiko2XzaryWV2SP9Ld0zp1TWpR8zkRYEUItsbRquF4Rmi35fRTT7LTVh0vit0TolViTFlQElHnhV+KKOLWvHTNVj+yjrC1K/A7SwIIwdblbP2Z8u1HnZL57nmQV72AtwV9kzmbAuawdTYT+5A3ITu3zhCCrTPZauhR29/wLFeVreLHIoc12JquZ0wGY9E7O68uI4QOzdZq5BZga40oLs8CwJcQL2PZNdgq859TTdiKEGwtoZJi54eLCxlOVuBs6RaETyNAHi/Gx439tjpbz7/2kapaZigf4Qrcy8riX9CKEGw1eNV32tP7NN4aaZr6fNtJ7S7v6cfXBNKHDL4P3Byq/uPbc4Ja6cPmn9+/nXfPU2ZkDLE1/uQDQugtshUhhBBsRQgh2IoQQrAVIYQQbEUIIdiKEEKwFSGEEGxFCCHYihBCsBUhhGArQggh2IoQQrAVIYRgK0IIIdiKEEKH1P/rrMjnM/fMegAAAABJRU5ErkJggg=="},8738:(a,t,e)=>{e.d(t,{Z:()=>n});const n=e.p+"assets/images/traits-4-fe5c6a716894397c8088bae54e7194f9.png"}}]); \ No newline at end of file diff --git a/assets/js/e4904969.59f9cb8c.js b/assets/js/e4904969.59f9cb8c.js deleted file mode 100644 index 2743e4cd..00000000 --- a/assets/js/e4904969.59f9cb8c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[8732],{3905:(e,a,n)=>{n.d(a,{Zo:()=>m,kt:()=>s});var t=n(7294);function i(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function r(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?l(Object(n),!0).forEach((function(a){i(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function p(e,a){if(null==e)return{};var n,t,i=function(e,a){if(null==e)return{};var n,t,i={},l=Object.keys(e);for(t=0;t<l.length;t++)n=l[t],a.indexOf(n)>=0||(i[n]=e[n]);return i}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t<l.length;t++)n=l[t],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var d=t.createContext({}),o=function(e){var a=t.useContext(d),n=a;return e&&(n="function"==typeof e?e(a):r(r({},a),e)),n},m=function(e){var a=o(e.components);return t.createElement(d.Provider,{value:a},e.children)},u={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},k=t.forwardRef((function(e,a){var n=e.components,i=e.mdxType,l=e.originalType,d=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),k=o(n),s=i,c=k["".concat(d,".").concat(s)]||k[s]||u[s]||l;return n?t.createElement(c,r(r({ref:a},m),{},{components:n})):t.createElement(c,r({ref:a},m))}));function s(e,a){var n=arguments,i=a&&a.mdxType;if("string"==typeof e||i){var l=n.length,r=new Array(l);r[0]=k;var p={};for(var d in a)hasOwnProperty.call(a,d)&&(p[d]=a[d]);p.originalType=e,p.mdxType="string"==typeof e?e:i,r[1]=p;for(var o=2;o<l;o++)r[o]=n[o];return t.createElement.apply(null,r)}return t.createElement.apply(null,n)}k.displayName="MDXCreateElement"},4510:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>d,contentTitle:()=>r,default:()=>u,frontMatter:()=>l,metadata:()=>p,toc:()=>o});var t=n(7462),i=(n(7294),n(3905));const l={sidebar_position:39,title:"A.39. Tipe Data \u279c Option",sidebar_label:"A.39. Tipe Data \u279c Option"},r=void 0,p={unversionedId:"basic/option-type",id:"basic/option-type",title:"A.39. Tipe Data \u279c Option",description:"Option adalah salah satu tipe data penting pada Rust programming, digunakan untuk menampung data yang isinya bisa berpotensi kosong (None). Chapter ini membahas tentang tipe data tersebut.",source:"@site/docs/basic/option-type.md",sourceDirName:"basic",slug:"/basic/option-type",permalink:"/basic/option-type",draft:!1,tags:[],version:"current",sidebarPosition:39,frontMatter:{sidebar_position:39,title:"A.39. Tipe Data \u279c Option",sidebar_label:"A.39. Tipe Data \u279c Option"},sidebar:"tutorialSidebar",previous:{title:"A.38. Generics",permalink:"/basic/generics"},next:{title:"A.40. Tipe Data \u279c Result",permalink:"/basic/result-type"}},d={},o=[{value:"A.39.1. Konsep <code>Option</code>",id:"a391-konsep-option",level:2},{value:"A.39.2. Pattern matching pada tipe <code>Option</code>",id:"a392-pattern-matching-pada-tipe-option",level:2},{value:"\u25c9 Tips pattern matching",id:"-tips-pattern-matching",level:3},{value:"A.39.3. Method tipe data <code>Option</code>",id:"a393-method-tipe-data-option",level:2},{value:"\u25c9 Method <code>unwrap</code>",id:"-method-unwrap",level:3},{value:"\u25c9 Method <code>is_some</code> & <code>is_none</code>",id:"-method-is_some--is_none",level:3},{value:"\u25c9 Method <code>unwrap_or_default</code>",id:"-method-unwrap_or_default",level:3},{value:"\u25c9 Method <code>unwrap_or</code>",id:"-method-unwrap_or",level:3},{value:"\u25c9 Method <code>unwrap_or_else</code>",id:"-method-unwrap_or_else",level:3},{value:"A.38.4. Operator <code>?</code> pada tipe <code>Option</code>",id:"a384-operator--pada-tipe-option",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:o};function u(e){let{components:a,...l}=e;return(0,i.kt)("wrapper",(0,t.Z)({},m,l,{components:a,mdxType:"MDXLayout"}),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Option")," adalah salah satu tipe data penting pada Rust programming, digunakan untuk menampung data yang isinya bisa berpotensi kosong (",(0,i.kt)("inlineCode",{parentName:"p"},"None"),"). Chapter ini membahas tentang tipe data tersebut."),(0,i.kt)("h2",{id:"a391-konsep-option"},"A.39.1. Konsep ",(0,i.kt)("inlineCode",{parentName:"h2"},"Option")),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Option")," adalah enum dengan isi 2 buah enum value:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"Option::Some<T>")," (atau ",(0,i.kt)("inlineCode",{parentName:"li"},"Some<T>"),"), digunakan untuk menandai bahwa data memiliki value/nilai."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"Option::None")," (atau ",(0,i.kt)("inlineCode",{parentName:"li"},"None"),"), digunakan untuk menandai bawah data adalah tidak ada nilainya.")),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"None")," bisa disamakan dengan nilai ",(0,i.kt)("inlineCode",{parentName:"li"},"null")," atau ",(0,i.kt)("inlineCode",{parentName:"li"},"nil")," pada bahasa pemrograman lain."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"T")," merupakan parameter generic. Lebih jelasnya mengenai generic dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/generics"},"Generics"),"."))),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Option")," memiliki notasi penulisan ",(0,i.kt)("inlineCode",{parentName:"p"},"Option<T>")," yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," adalah tipe data sebenarnya yang dibungkus oleh enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Some"),"."),(0,i.kt)("p",null,"Berikut adalah contoh cara penerapan ",(0,i.kt)("inlineCode",{parentName:"p"},"Option"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn divider(a: i32, b: i32) -> Option<i32> {\n if b == 0 {\n return None;\n }\n\n let result = a / b;\n return Some(result);\n}\n\nfn main() {\n let result1 = divider(10, 5);\n println!("result: {:?}", result1);\n\n let result2: Option<i32> = divider(10, 0);\n println!("result: {:?}", result2);\n}\n')),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider")," di atas tugasnya adalah melakukan operasi aritmatika pembagian angka numerik ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),", parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"a")," dibagi ",(0,i.kt)("inlineCode",{parentName:"p"},"b"),"."),(0,i.kt)("p",null,"Pada fungsi tersebut terdapat pengecekan apabila nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"b")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"0"),", maka yang dikembalikan adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),", selainnya maka hasil operasi pembagian dikembalikan dibungkus dalam enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Some<i32>"),". Bisa dilihat pada statement return value fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider"),", nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"result")," dibungkus menggunakan tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Some"),"."),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider")," nilai baliknya bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Option<i32>"),". Dari tipe data yang digunakan nantinya bisa diprediksi pasti akan ada 2 potensi value:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Return value adalah enum value ",(0,i.kt)("inlineCode",{parentName:"li"},"None"),", muncul ketika nilai ",(0,i.kt)("inlineCode",{parentName:"li"},"b")," adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"0")),(0,i.kt)("li",{parentName:"ul"},"Return value adalah nilai hasil numerik yang dibungkus oleh enum value ",(0,i.kt)("inlineCode",{parentName:"li"},"Some<i32>"))),(0,i.kt)("p",null,"Output program di atas saat di-run:"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Option type",src:n(1384).Z,width:"450",height:"127"})),(0,i.kt)("h2",{id:"a392-pattern-matching-pada-tipe-option"},"A.39.2. Pattern matching pada tipe ",(0,i.kt)("inlineCode",{parentName:"h2"},"Option")),(0,i.kt)("p",null,"Dalam penerapannya, ketika ada data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Option")," artinya data tersebut berpotensi untuk berisi nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"None")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"Some<T>"),", pasti antara 2 nilai tersebut."),(0,i.kt)("p",null,"Umumnya penggunaan tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Option")," selalu diikuti dengan seleksi kondisi. Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," bisa digunakan dalam seleksi kondisi, namun dalam Praktiknya lebih baik menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," karena memberikan kemudahan dalam pengaksesan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," milik ",(0,i.kt)("inlineCode",{parentName:"p"},"Some")," (yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," adalah data yang kita cari dibungkus dalam enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Some"),")."),(0,i.kt)("p",null,"Mari kita praktikkan. Ubah isi fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," dengan kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result1 = divider(10, 5);\nmatch result1 {\n None => println!("cannot divide by 0"),\n Some(x) => println!("result: {x}"),\n}\n\nlet result2 = divider(10, 0);\nmatch result2 {\n None => println!("cannot divide by 0"),\n Some(x) => {\n println!("result: {}", x)\n },\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Option type",src:n(4890).Z,width:"446",height:"124"})),(0,i.kt)("p",null,"Bisa dilihat cara mengambil nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," dari enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Some<T>")," cukup mudah dengan menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),". Penerapan ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," untuk seleksi kondisi biasa disebut dengan ",(0,i.kt)("strong",{parentName:"p"},"pattern matching")," dan teknik ini sangat fleksibel dan advance."),(0,i.kt)("p",null,"Sebagai contoh, dengan penerapan match yang seperti ini kita bisa meng-handle 3 skenario seleksi kondisi:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result1 = divider(10, 5);\nmatch result1 {\n None => println!("cannot divide by 0"),\n Some(2) => println!("the result is 2"),\n Some(x) => println!("result: {x}"),\n}\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Kondisi ke-1: jika nilai adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"None"),", maka munculkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"cannot divide by 0")),(0,i.kt)("li",{parentName:"ul"},"Kondisi ke-2: jika nilai adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"2"),", maka munculkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"the result is 2")),(0,i.kt)("li",{parentName:"ul"},"Kondisi ke-1: jika nilai adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"Some")," selain dari ",(0,i.kt)("inlineCode",{parentName:"li"},"None")," dan ",(0,i.kt)("inlineCode",{parentName:"li"},"Some(2)"),", maka munculkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"result: {x}"))),(0,i.kt)("h3",{id:"-tips-pattern-matching"},"\u25c9 Tips pattern matching"),(0,i.kt)("p",null,"Silakan perhatikan kode yang sudah kita praktikkan berikut ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10, 5);\nmatch result {\n None => println!("cannot divide by 0"),\n Some(x) => println!("result: {x}"),\n}\n')),(0,i.kt)("p",null,"Penerapan pattern matching seperti contoh di atas memiliki konsekuensi, yaitu variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," hanya bisa diakses pada block ",(0,i.kt)("inlineCode",{parentName:"p"},"Some(x)")," saja."),(0,i.kt)("p",null,"Adakalanya kita butuh untuk mengeluarkan variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," ke luar block. Hal seperti ini mudah untuk dilakukan, dan ada beberapa cara yang bisa dipilih, namun menurut penulis yang paling elegan adalah cara berikut ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let result = match divider(10, 5) {\n None => {\n println!("cannot divide by 0");\n 0\n },\n Some(x) => x,\n };\n\n println!("result: {:?}", result);\n}\n')),(0,i.kt)("p",null,"Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"divider(10, 5)")," mengembalikan data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Option<i32>"),". Data tersebut digunakan pada keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," seperti biasa. Namun pada contoh di atas ada yang berbeda, yaitu return value dari statement ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," ditampung ke variabel (",(0,i.kt)("inlineCode",{parentName:"p"},"result"),")."),(0,i.kt)("p",null,"Isi dari pattern matching ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," sendiri ada dua:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Ketika block ",(0,i.kt)("inlineCode",{parentName:"li"},"None")," match, pesan error di-print kemudian nilai ",(0,i.kt)("inlineCode",{parentName:"li"},"0")," dijadikan return statement ",(0,i.kt)("inlineCode",{parentName:"li"},"match"),"."),(0,i.kt)("li",{parentName:"ul"},"Ketika block ",(0,i.kt)("inlineCode",{parentName:"li"},"Some")," match, data ",(0,i.kt)("inlineCode",{parentName:"li"},"x")," dijadikan return value statement ",(0,i.kt)("inlineCode",{parentName:"li"},"match"),".")),(0,i.kt)("p",null,"Dengan penerapan pattern matching seperti di atas, maka variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"result")," akan selalu berisi data hasil operasi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider(10, 5)"),". Dengan pengecualian ketika ada error, pesan errornya dimunculkan kemudian hasil operasi pembagian di-set sebagai ",(0,i.kt)("inlineCode",{parentName:"p"},"0"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai pattern matching dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pattern-matching"},"Pattern Matching"))),(0,i.kt)("h2",{id:"a393-method-tipe-data-option"},"A.39.3. Method tipe data ",(0,i.kt)("inlineCode",{parentName:"h2"},"Option")),(0,i.kt)("h3",{id:"-method-unwrap"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"unwrap")),(0,i.kt)("p",null,"Isi dari enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Some<T>")," bisa diakses tanpa menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," dengan cara memanfaatkan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap")," milik ",(0,i.kt)("inlineCode",{parentName:"p"},"Option<T>"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result1 = divider(10, 5);\nif result1 != None {\n let number = result1.unwrap();\n println!("result: {}", number);\n}\n')),(0,i.kt)("p",null,"Penggunaan method tersebut sangat dianjurkan diiringi dengan seleksi kondisi untuk memastikan data ",(0,i.kt)("inlineCode",{parentName:"p"},"Option")," tidak berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),". Jika data ternyata adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"None")," dan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap")," diakses, hasilnya adalah panic error. Contohnya bisa dilihat pada gambar berikut:"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Option type",src:n(5499).Z,width:"659",height:"262"})),(0,i.kt)("p",null,"Selain method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap")," ada beberapa method sejenis lainnya yang bisa dimanfaatkan untuk pengambilan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T"),". Kita akan bahas satu per satu."),(0,i.kt)("h3",{id:"-method-is_some--is_none"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"is_some")," & ",(0,i.kt)("inlineCode",{parentName:"h3"},"is_none")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"is_some")," menghasilkan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," jika data isinya adalah enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Some<T>"),". Sedangkan ",(0,i.kt)("inlineCode",{parentName:"p"},"is_none")," bernilai ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," jika data berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),"."),(0,i.kt)("p",null,"Contoh penerapannya bisa dilihat pada program berikut. Kesemua seleksi kondisi pada konteks ini menghasilkan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result1 = divider(10, 5);\n\nif result1 != None {\n let number = result1.unwrap();\n println!("result: {}", number);\n}\n\nif result1.is_some() {\n let number = result1.unwrap();\n println!("result: {}", number);\n}\n\nif !result1.is_none() {\n let number = result1.unwrap();\n println!("result: {}", number);\n}\n')),(0,i.kt)("h3",{id:"-method-unwrap_or_default"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"unwrap_or_default")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap_or_default")," mengembalikan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," ketika data berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Some<T>"),". Jika data ternyata isinya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),", maka nilai yang dikembalikan adalah ",(0,i.kt)("em",{parentName:"p"},"default value")," dari tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"T"),"."),(0,i.kt)("p",null,"Sebagai contoh, pada kode berikut statement ",(0,i.kt)("inlineCode",{parentName:"p"},"divider(10, 0)")," return type-nya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Option<i32>"),", sedangkan return value-nya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),". Pengaksesan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap_or_default")," menghasilkan ",(0,i.kt)("em",{parentName:"p"},"default value")," dari tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),", yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"0")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result2 = divider(10, 0);\nlet number = result2.unwrap_or_default();\nprintln!("result: {}", number);\n// result: 0\n')),(0,i.kt)("h3",{id:"-method-unwrap_or"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"unwrap_or")),(0,i.kt)("p",null,"Method ini mengembalikan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," ketika data berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Some<T>"),", namun jika data ternyata isinya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),", maka nilai yang dikembalikan adalah argument pemanggilan method tersebut."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result2 = divider(10, 0);\nlet number = result2.unwrap_or(0);\nprintln!("result: {}", number);\n// result: 0\n')),(0,i.kt)("p",null,"Pada contoh di atas argument pemanggilan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap_or")," adalah angka ",(0,i.kt)("inlineCode",{parentName:"p"},"0"),", artinya ketika ",(0,i.kt)("inlineCode",{parentName:"p"},"result2")," isinya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"None")," maka angka ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," adalah return value pengaksesan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap_or"),"."),(0,i.kt)("h3",{id:"-method-unwrap_or_else"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"unwrap_or_else")),(0,i.kt)("p",null,"Method ini mengembalikan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," ketika data berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Some<T>"),", namun jika data isinya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),", maka nilai yang dikembalikan adalah hasil eksekusi closure yang disisipkan saat memanggil method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap_or_else"),". Contoh pengaplikasiannya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result2 = divider(10, 0);\nlet number = result2.unwrap_or_else(|| 0);\nprintln!("result: {}", number);\n// result: 0\n')),(0,i.kt)("p",null,"Closure harus dalam notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"FnOnce() -> T")," yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," pada konteks ini adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Closure ",(0,i.kt)("inlineCode",{parentName:"p"},"|| 0")," adalah kependekan dari ",(0,i.kt)("inlineCode",{parentName:"p"},"|| -> i32 { 0 }"),"."),(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai closure dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/closures"},"Closures"),".")),(0,i.kt)("h2",{id:"a384-operator--pada-tipe-option"},"A.38.4. Operator ",(0,i.kt)("inlineCode",{parentName:"h2"},"?")," pada tipe ",(0,i.kt)("inlineCode",{parentName:"h2"},"Option")),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Option")," bisa digunakan pada operator ",(0,i.kt)("inlineCode",{parentName:"p"},"?"),". Penjelasannya ada di chapter terpisah di ",(0,i.kt)("a",{parentName:"p",href:"/basic/operator-tanda-tanya"},"Operator ?"),"."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/option_type"},"github.com/novalagung/dasarpemrogramanrust-example/../option_type")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/generics"},"Generics")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/pattern-matching"},"Pattern Matching")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/closures"},"Closures")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/operator-tanda-tanya"},"Operator ?"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html"},"https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/option/index.html"},"https://doc.rust-lang.org/std/option/index.html"))))}u.isMDXComponent=!0},1384:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAAB/CAIAAADzWVUNAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50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53H+0Y0FUWd8i2RldA4bMnI60elEmFWmqcYud9OmZQuE0IHRKW2NkzXAxqgzIm+EDd8dkuno0RKjQfoOmt9//Cp+cE7n6f9aR/pxz6lIJw7++lWpVGjTzF0ihG4CncnsPL2d/fvnj9aoM5ijlm5z12e4pzRDOFmwT06cko2UIs8747Z7uYWSZM6HjaYc4CZCN4JOtEBMvxECnagdnNzyQQh0ohZoMv1GCHQihBACnQghBDoRQgh0IoQQ6EQIIdCJEEKgEyGEEOhECCHQiRBCoBMhhEAnQgi9Of0fmQb7AJMnfVgAAAAASUVORK5CYII="},5499:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/option-type-3-e2943c7c0a60b13cd69ce8461805846c.png"}}]); \ No newline at end of file diff --git a/assets/js/e4904969.cad57b1a.js b/assets/js/e4904969.cad57b1a.js new file mode 100644 index 00000000..ef182fe1 --- /dev/null +++ b/assets/js/e4904969.cad57b1a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[8732],{3905:(e,a,n)=>{n.d(a,{Zo:()=>m,kt:()=>s});var t=n(7294);function i(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function r(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?l(Object(n),!0).forEach((function(a){i(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function p(e,a){if(null==e)return{};var n,t,i=function(e,a){if(null==e)return{};var n,t,i={},l=Object.keys(e);for(t=0;t<l.length;t++)n=l[t],a.indexOf(n)>=0||(i[n]=e[n]);return i}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t<l.length;t++)n=l[t],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var d=t.createContext({}),o=function(e){var a=t.useContext(d),n=a;return e&&(n="function"==typeof e?e(a):r(r({},a),e)),n},m=function(e){var a=o(e.components);return t.createElement(d.Provider,{value:a},e.children)},u={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},k=t.forwardRef((function(e,a){var n=e.components,i=e.mdxType,l=e.originalType,d=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),k=o(n),s=i,c=k["".concat(d,".").concat(s)]||k[s]||u[s]||l;return n?t.createElement(c,r(r({ref:a},m),{},{components:n})):t.createElement(c,r({ref:a},m))}));function s(e,a){var n=arguments,i=a&&a.mdxType;if("string"==typeof e||i){var l=n.length,r=new Array(l);r[0]=k;var p={};for(var d in a)hasOwnProperty.call(a,d)&&(p[d]=a[d]);p.originalType=e,p.mdxType="string"==typeof e?e:i,r[1]=p;for(var o=2;o<l;o++)r[o]=n[o];return t.createElement.apply(null,r)}return t.createElement.apply(null,n)}k.displayName="MDXCreateElement"},4510:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>d,contentTitle:()=>r,default:()=>u,frontMatter:()=>l,metadata:()=>p,toc:()=>o});var t=n(7462),i=(n(7294),n(3905));const l={sidebar_position:39,title:"A.39. Tipe Data \u279c Option",sidebar_label:"A.39. Tipe Data \u279c Option"},r=void 0,p={unversionedId:"basic/option-type",id:"basic/option-type",title:"A.39. Tipe Data \u279c Option",description:"Option adalah salah satu tipe data penting pada Rust programming, digunakan untuk menampung data yang isinya bisa berpotensi kosong (None). Chapter ini membahas tentang tipe data tersebut.",source:"@site/docs/basic/option-type.md",sourceDirName:"basic",slug:"/basic/option-type",permalink:"/basic/option-type",draft:!1,tags:[],version:"current",sidebarPosition:39,frontMatter:{sidebar_position:39,title:"A.39. Tipe Data \u279c Option",sidebar_label:"A.39. Tipe Data \u279c Option"},sidebar:"tutorialSidebar",previous:{title:"A.38. Generics",permalink:"/basic/generics"},next:{title:"A.40. Tipe Data \u279c Result",permalink:"/basic/result-type"}},d={},o=[{value:"A.39.1. Konsep <code>Option</code>",id:"a391-konsep-option",level:2},{value:"A.39.2. Pattern matching pada tipe <code>Option</code>",id:"a392-pattern-matching-pada-tipe-option",level:2},{value:"\u25c9 Tips pattern matching",id:"-tips-pattern-matching",level:3},{value:"A.39.3. Method tipe data <code>Option</code>",id:"a393-method-tipe-data-option",level:2},{value:"\u25c9 Method <code>unwrap</code>",id:"-method-unwrap",level:3},{value:"\u25c9 Method <code>is_some</code> & <code>is_none</code>",id:"-method-is_some--is_none",level:3},{value:"\u25c9 Method <code>unwrap_or_default</code>",id:"-method-unwrap_or_default",level:3},{value:"\u25c9 Method <code>unwrap_or</code>",id:"-method-unwrap_or",level:3},{value:"\u25c9 Method <code>unwrap_or_else</code>",id:"-method-unwrap_or_else",level:3},{value:"A.38.4. Operator <code>?</code> pada tipe <code>Option</code>",id:"a384-operator--pada-tipe-option",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Chapter relevan lainnya",id:"-chapter-relevan-lainnya",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:o};function u(e){let{components:a,...l}=e;return(0,i.kt)("wrapper",(0,t.Z)({},m,l,{components:a,mdxType:"MDXLayout"}),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Option")," adalah salah satu tipe data penting pada Rust programming, digunakan untuk menampung data yang isinya bisa berpotensi kosong (",(0,i.kt)("inlineCode",{parentName:"p"},"None"),"). Chapter ini membahas tentang tipe data tersebut."),(0,i.kt)("h2",{id:"a391-konsep-option"},"A.39.1. Konsep ",(0,i.kt)("inlineCode",{parentName:"h2"},"Option")),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Option")," adalah enum dengan isi 2 buah enum value:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"Option::Some<T>")," (atau ",(0,i.kt)("inlineCode",{parentName:"li"},"Some<T>"),"), digunakan untuk menandai bahwa data memiliki value/nilai."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"Option::None")," (atau ",(0,i.kt)("inlineCode",{parentName:"li"},"None"),"), digunakan untuk menandai bawah data adalah tidak ada nilainya.")),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"None")," bisa disamakan dengan nilai ",(0,i.kt)("inlineCode",{parentName:"li"},"null")," atau ",(0,i.kt)("inlineCode",{parentName:"li"},"nil")," pada bahasa pemrograman lain."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"T")," merupakan parameter generic. Lebih jelasnya mengenai generic dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/generics"},"Generics"),"."))),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Option")," memiliki notasi penulisan ",(0,i.kt)("inlineCode",{parentName:"p"},"Option<T>")," yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," adalah tipe data sebenarnya yang dibungkus oleh enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Some"),"."),(0,i.kt)("p",null,"Berikut adalah contoh cara penerapan ",(0,i.kt)("inlineCode",{parentName:"p"},"Option"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn divider(a: i32, b: i32) -> Option<i32> {\n if b == 0 {\n return None;\n }\n\n let result = a / b;\n return Some(result);\n}\n\nfn main() {\n let result1 = divider(10, 5);\n println!("result: {:?}", result1);\n\n let result2: Option<i32> = divider(10, 0);\n println!("result: {:?}", result2);\n}\n')),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider")," di atas tugasnya adalah melakukan operasi aritmatika pembagian angka numerik ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),", parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"a")," dibagi ",(0,i.kt)("inlineCode",{parentName:"p"},"b"),"."),(0,i.kt)("p",null,"Pada fungsi tersebut terdapat pengecekan apabila nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"b")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"0"),", maka yang dikembalikan adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),", selainnya maka hasil operasi pembagian dikembalikan dibungkus dalam enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Some<i32>"),". Bisa dilihat pada statement return value fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider"),", nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"result")," dibungkus menggunakan tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Some"),"."),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider")," nilai baliknya bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Option<i32>"),". Dari tipe data yang digunakan nantinya bisa diprediksi pasti akan ada 2 potensi value:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Return value adalah enum value ",(0,i.kt)("inlineCode",{parentName:"li"},"None"),", muncul ketika nilai ",(0,i.kt)("inlineCode",{parentName:"li"},"b")," adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"0")),(0,i.kt)("li",{parentName:"ul"},"Return value adalah nilai hasil numerik yang dibungkus oleh enum value ",(0,i.kt)("inlineCode",{parentName:"li"},"Some<i32>"))),(0,i.kt)("p",null,"Output program di atas saat di-run:"),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Option type",src:n(1384).Z,width:"450",height:"127"})),(0,i.kt)("h2",{id:"a392-pattern-matching-pada-tipe-option"},"A.39.2. Pattern matching pada tipe ",(0,i.kt)("inlineCode",{parentName:"h2"},"Option")),(0,i.kt)("p",null,"Dalam penerapannya, ketika ada data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Option")," artinya data tersebut berpotensi untuk berisi nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"None")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"Some<T>"),", pasti antara 2 nilai tersebut."),(0,i.kt)("p",null,"Umumnya penggunaan tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Option")," selalu diikuti dengan seleksi kondisi. Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," bisa digunakan dalam seleksi kondisi, namun dalam Praktiknya lebih baik menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," karena memberikan kemudahan dalam pengaksesan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," milik ",(0,i.kt)("inlineCode",{parentName:"p"},"Some")," (yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," adalah data yang kita cari dibungkus dalam enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Some"),")."),(0,i.kt)("p",null,"Mari kita praktikkan. Ubah isi fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," dengan kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result1 = divider(10, 5);\nmatch result1 {\n None => println!("cannot divide by 0"),\n Some(x) => println!("result: {x}"),\n}\n\nlet result2 = divider(10, 0);\nmatch result2 {\n None => println!("cannot divide by 0"),\n Some(x) => {\n println!("result: {}", x)\n },\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Option type",src:n(4890).Z,width:"446",height:"124"})),(0,i.kt)("p",null,"Bisa dilihat cara mengambil nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," dari enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Some<T>")," cukup mudah dengan menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match"),". Penerapan ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," untuk seleksi kondisi biasa disebut dengan ",(0,i.kt)("strong",{parentName:"p"},"pattern matching")," dan teknik ini sangat fleksibel dan advance."),(0,i.kt)("p",null,"Sebagai contoh, dengan penerapan match yang seperti ini kita bisa meng-handle 3 skenario seleksi kondisi:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result1 = divider(10, 5);\nmatch result1 {\n None => println!("cannot divide by 0"),\n Some(2) => println!("the result is 2"),\n Some(x) => println!("result: {x}"),\n}\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Kondisi ke-1: jika nilai adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"None"),", maka munculkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"cannot divide by 0")),(0,i.kt)("li",{parentName:"ul"},"Kondisi ke-2: jika nilai adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"2"),", maka munculkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"the result is 2")),(0,i.kt)("li",{parentName:"ul"},"Kondisi ke-1: jika nilai adalah ",(0,i.kt)("inlineCode",{parentName:"li"},"Some")," selain dari ",(0,i.kt)("inlineCode",{parentName:"li"},"None")," dan ",(0,i.kt)("inlineCode",{parentName:"li"},"Some(2)"),", maka munculkan pesan ",(0,i.kt)("inlineCode",{parentName:"li"},"result: {x}"))),(0,i.kt)("h3",{id:"-tips-pattern-matching"},"\u25c9 Tips pattern matching"),(0,i.kt)("p",null,"Silakan perhatikan kode yang sudah kita praktikkan berikut ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result = divider(10, 5);\nmatch result {\n None => println!("cannot divide by 0"),\n Some(x) => println!("result: {x}"),\n}\n')),(0,i.kt)("p",null,"Penerapan pattern matching seperti contoh di atas memiliki konsekuensi, yaitu variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," hanya bisa diakses pada block ",(0,i.kt)("inlineCode",{parentName:"p"},"Some(x)")," saja."),(0,i.kt)("p",null,"Adakalanya kita butuh untuk mengeluarkan variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," ke luar block. Hal seperti ini mudah untuk dilakukan, dan ada beberapa cara yang bisa dipilih, namun menurut penulis yang paling elegan adalah cara berikut ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let result = match divider(10, 5) {\n None => {\n println!("cannot divide by 0");\n 0\n },\n Some(x) => x,\n };\n\n println!("result: {:?}", result);\n}\n')),(0,i.kt)("p",null,"Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"divider(10, 5)")," mengembalikan data bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Option<i32>"),". Data tersebut digunakan pada keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," seperti biasa. Namun pada contoh di atas ada yang berbeda, yaitu return value dari statement ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," ditampung ke variabel (",(0,i.kt)("inlineCode",{parentName:"p"},"result"),")."),(0,i.kt)("p",null,"Isi dari pattern matching ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," sendiri ada dua:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Ketika block ",(0,i.kt)("inlineCode",{parentName:"li"},"None")," match, pesan error di-print kemudian nilai ",(0,i.kt)("inlineCode",{parentName:"li"},"0")," dijadikan return statement ",(0,i.kt)("inlineCode",{parentName:"li"},"match"),"."),(0,i.kt)("li",{parentName:"ul"},"Ketika block ",(0,i.kt)("inlineCode",{parentName:"li"},"Some")," match, data ",(0,i.kt)("inlineCode",{parentName:"li"},"x")," dijadikan return value statement ",(0,i.kt)("inlineCode",{parentName:"li"},"match"),".")),(0,i.kt)("p",null,"Dengan penerapan pattern matching seperti di atas, maka variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"result")," akan selalu berisi data hasil operasi ",(0,i.kt)("inlineCode",{parentName:"p"},"divider(10, 5)"),". Dengan pengecualian ketika ada error, pesan errornya dimunculkan kemudian hasil operasi pembagian di-set sebagai ",(0,i.kt)("inlineCode",{parentName:"p"},"0"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai pattern matching dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pattern-matching"},"Pattern Matching"))),(0,i.kt)("h2",{id:"a393-method-tipe-data-option"},"A.39.3. Method tipe data ",(0,i.kt)("inlineCode",{parentName:"h2"},"Option")),(0,i.kt)("h3",{id:"-method-unwrap"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"unwrap")),(0,i.kt)("p",null,"Isi dari enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Some<T>")," bisa diakses tanpa menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"match")," dengan cara memanfaatkan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap")," milik ",(0,i.kt)("inlineCode",{parentName:"p"},"Option<T>"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result1 = divider(10, 5);\nif result1 != None {\n let number = result1.unwrap();\n println!("result: {}", number);\n}\n')),(0,i.kt)("p",null,"Penggunaan method tersebut sangat dianjurkan diiringi dengan seleksi kondisi untuk memastikan data ",(0,i.kt)("inlineCode",{parentName:"p"},"Option")," tidak berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),". Jika data ternyata adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"None")," dan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap")," diakses, hasilnya adalah panic error. Contohnya bisa dilihat pada gambar berikut:"),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Option type",src:n(5499).Z,width:"659",height:"262"})),(0,i.kt)("p",null,"Selain method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap")," ada beberapa method sejenis lainnya yang bisa dimanfaatkan untuk pengambilan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T"),". Kita akan bahas satu per satu."),(0,i.kt)("h3",{id:"-method-is_some--is_none"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"is_some")," & ",(0,i.kt)("inlineCode",{parentName:"h3"},"is_none")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"is_some")," menghasilkan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," jika data isinya adalah enum value ",(0,i.kt)("inlineCode",{parentName:"p"},"Some<T>"),". Sedangkan ",(0,i.kt)("inlineCode",{parentName:"p"},"is_none")," bernilai ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," jika data berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),"."),(0,i.kt)("p",null,"Contoh penerapannya bisa dilihat pada program berikut. Kesemua seleksi kondisi pada konteks ini menghasilkan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result1 = divider(10, 5);\n\nif result1 != None {\n let number = result1.unwrap();\n println!("result: {}", number);\n}\n\nif result1.is_some() {\n let number = result1.unwrap();\n println!("result: {}", number);\n}\n\nif !result1.is_none() {\n let number = result1.unwrap();\n println!("result: {}", number);\n}\n')),(0,i.kt)("h3",{id:"-method-unwrap_or_default"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"unwrap_or_default")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap_or_default")," mengembalikan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," ketika data berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Some<T>"),". Jika data ternyata isinya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),", maka nilai yang dikembalikan adalah ",(0,i.kt)("em",{parentName:"p"},"default value")," dari tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"T"),"."),(0,i.kt)("p",null,"Sebagai contoh, pada kode berikut statement ",(0,i.kt)("inlineCode",{parentName:"p"},"divider(10, 0)")," return type-nya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Option<i32>"),", sedangkan return value-nya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),". Pengaksesan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap_or_default")," menghasilkan ",(0,i.kt)("em",{parentName:"p"},"default value")," dari tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),", yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"0")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result2 = divider(10, 0);\nlet number = result2.unwrap_or_default();\nprintln!("result: {}", number);\n// result: 0\n')),(0,i.kt)("h3",{id:"-method-unwrap_or"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"unwrap_or")),(0,i.kt)("p",null,"Method ini mengembalikan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," ketika data berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Some<T>"),", namun jika data ternyata isinya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),", maka nilai yang dikembalikan adalah argument pemanggilan method tersebut."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result2 = divider(10, 0);\nlet number = result2.unwrap_or(0);\nprintln!("result: {}", number);\n// result: 0\n')),(0,i.kt)("p",null,"Pada contoh di atas argument pemanggilan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap_or")," adalah angka ",(0,i.kt)("inlineCode",{parentName:"p"},"0"),", artinya ketika ",(0,i.kt)("inlineCode",{parentName:"p"},"result2")," isinya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"None")," maka angka ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," adalah return value pengaksesan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap_or"),"."),(0,i.kt)("h3",{id:"-method-unwrap_or_else"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"unwrap_or_else")),(0,i.kt)("p",null,"Method ini mengembalikan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," ketika data berisi ",(0,i.kt)("inlineCode",{parentName:"p"},"Some<T>"),", namun jika data isinya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),", maka nilai yang dikembalikan adalah hasil eksekusi closure yang disisipkan saat memanggil method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap_or_else"),". Contoh pengaplikasiannya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let result2 = divider(10, 0);\nlet number = result2.unwrap_or_else(|| 0);\nprintln!("result: {}", number);\n// result: 0\n')),(0,i.kt)("p",null,"Closure harus dalam notasi ",(0,i.kt)("inlineCode",{parentName:"p"},"FnOnce() -> T")," yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"T")," pada konteks ini adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"i32"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Closure ",(0,i.kt)("inlineCode",{parentName:"p"},"|| 0")," adalah kependekan dari ",(0,i.kt)("inlineCode",{parentName:"p"},"|| -> i32 { 0 }"),"."),(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai closure dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/closures"},"Closures"),".")),(0,i.kt)("h2",{id:"a384-operator--pada-tipe-option"},"A.38.4. Operator ",(0,i.kt)("inlineCode",{parentName:"h2"},"?")," pada tipe ",(0,i.kt)("inlineCode",{parentName:"h2"},"Option")),(0,i.kt)("p",null,"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"Option")," bisa digunakan pada operator ",(0,i.kt)("inlineCode",{parentName:"p"},"?"),". Penjelasannya ada di chapter terpisah di ",(0,i.kt)("a",{parentName:"p",href:"/basic/operator-tanda-tanya"},"Operator ?"),"."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/option_type"},"github.com/novalagung/dasarpemrogramanrust-example/../option_type")),(0,i.kt)("h3",{id:"-chapter-relevan-lainnya"},"\u25c9 Chapter relevan lainnya"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/generics"},"Generics")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/pattern-matching"},"Pattern Matching")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/closures"},"Closures")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/basic/operator-tanda-tanya"},"Operator ?"))),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html"},"https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/option/index.html"},"https://doc.rust-lang.org/std/option/index.html"))))}u.isMDXComponent=!0},1384:(e,a,n)=>{n.d(a,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAAB/CAIAAADzWVUNAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAA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QGqVMQV0NJuIkQOjg600n7tNSZ3x8fN//68f3MymzCL+/Rt91hH5cK0jUEhBC6ADoRQgiBToQQAp0IIQQ6EUIIdCKEEOhECCEEOhFC6C2iM37stHu60/VEZyll+0tN9ferEEKgcx8Ovil0YtSMEOi8GDovVYyl6Axs8jB+Quhm0Bm85RhaIsWbep/2MelodZxvFDkWrY6LMdrvwC1UHCQ2x0veA40OIfJ0B4M9OuNqGkc39p5oabzIjxC6LnSqMOjzj5+hhWdAv4lj5Y0RmwakOMO9kELJLnH4F+Gq7Nsk85SOzjbKA5+T017R0Uv2y2EdQmdphNDVorMeA30OTD0yTqmNCUWCJC50ZnS00Rn+DD5elKfUeWpHZ1eZ0soXaxZ9w6RvIMJOhK4bnUa0lEywW9Fp0G51dE6/U3I60Gk7OlfKFB50nLwX4sgk0uR2PUK3EXVm53H+0Y0FUWd8i2RldA4bMnI60elEmFWmqcYud9OmZQuE0IHRKW2NkzXAxqgzIm+EDd8dkuno0RKjQfoOmt9//Cp+cE7n6f9aR/pxz6lIJw7++lWpVGjTzF0ihG4CncnsPL2d/fvnj9aoM5ijlm5z12e4pzRDOFmwT06cko2UIs8747Z7uYWSZM6HjaYc4CZCN4JOtEBMvxECnagdnNzyQQh0ohZoMv1GCHQihBACnQghBDoRQgh0IoQQ6EQIIdCJEEKgEyGEEOhECCHQiRBCoBMhhEAnQgi9Of0fmQb7AJMnfVgAAAAASUVORK5CYII="},5499:(e,a,n)=>{n.d(a,{Z:()=>t});const t=n.p+"assets/images/option-type-3-e2943c7c0a60b13cd69ce8461805846c.png"}}]); \ No newline at end of file diff --git a/assets/js/e7bd9b37.6bffc9e2.js b/assets/js/e7bd9b37.6bffc9e2.js deleted file mode 100644 index acf68c01..00000000 --- a/assets/js/e7bd9b37.6bffc9e2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[7539],{3905:(a,e,t)=>{t.d(e,{Zo:()=>u,kt:()=>o});var n=t(7294);function i(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function r(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),t.push.apply(t,n)}return t}function p(a){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?r(Object(t),!0).forEach((function(e){i(a,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(t,e))}))}return a}function l(a,e){if(null==a)return{};var t,n,i=function(a,e){if(null==a)return{};var t,n,i={},r=Object.keys(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||(i[t]=a[t]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(a,t)&&(i[t]=a[t])}return i}var s=n.createContext({}),m=function(a){var e=n.useContext(s),t=e;return a&&(t="function"==typeof a?a(e):p(p({},e),a)),t},u=function(a){var e=m(a.components);return n.createElement(s.Provider,{value:e},a.children)},d={inlineCode:"code",wrapper:function(a){var e=a.children;return n.createElement(n.Fragment,{},e)}},k=n.forwardRef((function(a,e){var t=a.components,i=a.mdxType,r=a.originalType,s=a.parentName,u=l(a,["components","mdxType","originalType","parentName"]),k=m(t),o=i,h=k["".concat(s,".").concat(o)]||k[o]||d[o]||r;return t?n.createElement(h,p(p({ref:e},u),{},{components:t})):n.createElement(h,p({ref:e},u))}));function o(a,e){var t=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=t.length,p=new Array(r);p[0]=k;var l={};for(var s in e)hasOwnProperty.call(e,s)&&(l[s]=e[s]);l.originalType=a,l.mdxType="string"==typeof a?a:i,p[1]=l;for(var m=2;m<r;m++)p[m]=t[m];return n.createElement.apply(null,p)}return n.createElement.apply(null,t)}k.displayName="MDXCreateElement"},2079:(a,e,t)=>{t.r(e),t.d(e,{assets:()=>s,contentTitle:()=>p,default:()=>d,frontMatter:()=>r,metadata:()=>l,toc:()=>m});var n=t(7462),i=(t(7294),t(3905));const r={sidebar_position:18,title:"A.18. Module System \u279c Path & Item",sidebar_label:"A.18. Module System \u279c Path & Item"},p=void 0,l={unversionedId:"basic/path-item",id:"basic/path-item",title:"A.18. Module System \u279c Path & Item",description:"Chapter ini membahas tentang konsep path dan item dalam Rust programming.",source:"@site/docs/basic/path-item.md",sourceDirName:"basic",slug:"/basic/path-item",permalink:"/basic/path-item",draft:!1,tags:[],version:"current",sidebarPosition:18,frontMatter:{sidebar_position:18,title:"A.18. Module System \u279c Path & Item",sidebar_label:"A.18. Module System \u279c Path & Item"},sidebar:"tutorialSidebar",previous:{title:"A.17. Function",permalink:"/basic/function"},next:{title:"A.19. Module System \u279c Package & Crate",permalink:"/basic/package-crate"}},s={},m=[{value:"A.18.1. Rust <em>Paths</em>",id:"a181-rust-paths",level:2},{value:"A.18.2. Absolute & relative paths",id:"a182-absolute--relative-paths",level:2},{value:"A.18.3. Rust <em>Items</em>",id:"a183-rust-items",level:2},{value:"A.18.4. Penerapan paths dalam penggaksesan item",id:"a184-penerapan-paths-dalam-penggaksesan-item",level:2},{value:"\u25c9 <code>std::string::String::new()</code>",id:"-stdstringstringnew",level:3},{value:"\u25c9 <code>std::io::stdin()</code>",id:"-stdiostdin",level:3},{value:"\u25c9 <code>stdin_reader.read_line(&mut message)</code>",id:"-stdin_readerread_linemut-message",level:3},{value:"\u25c9 Pengecekan error <code>stdin_reader</code>",id:"-pengecekan-error-stdin_reader",level:3},{value:"\u25c9 Menampilkan isi <code>message</code>",id:"-menampilkan-isi-message",level:3},{value:"A.18.5. Penggunaan keyword <code>use</code> untuk import path",id:"a185-penggunaan-keyword-use-untuk-import-path",level:2},{value:"\u25c9 Import beberapa items yang parent path-nya yang sama",id:"-import-beberapa-items-yang-parent-path-nya-yang-sama",level:3},{value:"\u25c9 Import semua items dalam suatu path",id:"-import-semua-items-dalam-suatu-path",level:3},{value:"A.18.6. Pembahasan lanjutan",id:"a186-pembahasan-lanjutan",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],u={toc:m};function d(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,n.Z)({},u,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Chapter ini membahas tentang konsep ",(0,i.kt)("em",{parentName:"p"},"path")," dan ",(0,i.kt)("em",{parentName:"p"},"item")," dalam Rust programming."),(0,i.kt)("h2",{id:"a181-rust-paths"},"A.18.1. Rust ",(0,i.kt)("em",{parentName:"h2"},"Paths")),(0,i.kt)("p",null,"Paths (atau Path) adalah notasi penulisan alamat sebuah item, contohnya ",(0,i.kt)("inlineCode",{parentName:"p"},"std::time::Duration"),"."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"std::time::Duration")," adalah ",(0,i.kt)("em",{parentName:"p"},"path")," untuk item yang isinya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"struct")," bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"Duration"),". Item bisa berupa banyak jenis, bisa saja struct, atau ",(0,i.kt)("em",{parentName:"p"},"macro"),", konstanta, atau lainnya. Lebih jelasnya silakan cek pada halaman dokumentasi ",(0,i.kt)("inlineCode",{parentName:"p"},"std::time::Duration"),"."),(0,i.kt)("p",null,"Sebuah path bisa memiliki banyak bagian (biasa disebut ",(0,i.kt)("em",{parentName:"p"},"segment"),"), sebagai contoh, path ",(0,i.kt)("inlineCode",{parentName:"p"},"std::time::Duration")," memiliki 3 segmen yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"std"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"time"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Duration"),". Karakter ",(0,i.kt)("inlineCode",{parentName:"p"},"::")," digunakan dalam penulisan path sebagai pembatas antar segmen (jika path memiliki lebih dari 1 segmen)."),(0,i.kt)("p",null,"Dalam sebuah path, yang disebut dengan item adalah segment terakhir. Contohnya path ",(0,i.kt)("inlineCode",{parentName:"p"},"std::time::Duration"),", maka item yang dituju adalah struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Duration"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Rust paths mirip seperti konsep ",(0,i.kt)("em",{parentName:"p"},"filesystem")," path di sistem operasi. Seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"C:\\Users\\novalagung\\Desktop")," di windows, atau ",(0,i.kt)("inlineCode",{parentName:"p"},"/etc/nginx/conf.d/nginx.conf")," di Unix/Linux."),(0,i.kt)("p",{parentName:"blockquote"},"Di Rust, path tidak menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"\\")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"/")," sebagai separator, melainkan ",(0,i.kt)("inlineCode",{parentName:"p"},"::"),".")),(0,i.kt)("p",null,"Jika di-breakdown, berikut adalah penjelasan dari setiap kombinasi segmen path pada contoh ",(0,i.kt)("inlineCode",{parentName:"p"},"std::time::Duration"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Path ",(0,i.kt)("inlineCode",{parentName:"li"},"std")," \u279c adalah path untuk ",(0,i.kt)("strong",{parentName:"li"},"crate")," bernama ",(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/"},(0,i.kt)("strong",{parentName:"a"},"Rust Standard Library")),", isinya adalah sangat banyak item untuk keperluan umum di Rust programming. Lebih jelasnya akan dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"#/wip/rust-standard-library"},"Rust standard library"),"."),(0,i.kt)("li",{parentName:"ul"},"Path ",(0,i.kt)("inlineCode",{parentName:"li"},"std::time")," \u279c adalah path untuk ",(0,i.kt)("strong",{parentName:"li"},"module")," bernama ",(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/time/index.html"},(0,i.kt)("inlineCode",{parentName:"a"},"time")),", isinya banyak item yang berhubungan dengan operasi waktu/time."),(0,i.kt)("li",{parentName:"ul"},"Path ",(0,i.kt)("inlineCode",{parentName:"li"},"std::time::Duration")," \u279c adalah path untuk ",(0,i.kt)("strong",{parentName:"li"},"struct")," bernama ",(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/time/index.html"},(0,i.kt)("inlineCode",{parentName:"a"},"Duration")),", yang merupakan representasi dari unit waktu.")),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai crate dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/package-crate"},"Module System \u279c Package & Crate")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai module dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/module-basic"},"Module System \u279c Module")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai struct dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/struct"},"Struct")))),(0,i.kt)("h2",{id:"a182-absolute--relative-paths"},"A.18.2. Absolute & relative paths"),(0,i.kt)("p",null,"Rust mengenal dua jenis path:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Absolute path \u279c adalah path yang penulisannya lengkap dari root path, contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"li"},"std::time::Duration"),"."),(0,i.kt)("li",{parentName:"ul"},"Relative path \u279c adalah path yang penulisannya relatif terhadap current path, contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"li"},"self::my_func"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"super::my_mod::my_consntan"),".")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai relative path dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/module-scope-item-access"},"Module System \u279c Scope & Akses Item"),".")),(0,i.kt)("h2",{id:"a183-rust-items"},"A.18.3. Rust ",(0,i.kt)("em",{parentName:"h2"},"Items")),(0,i.kt)("p",null,"Seperti yang sudah dibahas bahwa path adalah notasi penulisan alamat untuk item. Lalu apa saja yang disebut dengan item? Di Rust ada banyak hal, yang kurang lebih list-nya bisa dilihat berikut:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"modules ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter ",(0,i.kt)("a",{parentName:"em",href:"/basic/module-basic"},"Module System \u279c Module"),")")),(0,i.kt)("li",{parentName:"ul"},"extern crate declarations"),(0,i.kt)("li",{parentName:"ul"},"use declarations ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter ",(0,i.kt)("a",{parentName:"em",href:"/basic/use"},"Module System \u279c Use"),")")),(0,i.kt)("li",{parentName:"ul"},"function definitions ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter ",(0,i.kt)("a",{parentName:"em",href:"/basic/function"},"Function"),", ",(0,i.kt)("a",{parentName:"em",href:"/basic/associated-function"},"Associated Function"),", dan ",(0,i.kt)("a",{parentName:"em",href:"/basic/method"},"Method"),")")),(0,i.kt)("li",{parentName:"ul"},"type definitions ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter-chapter tentang tipe data)")),(0,i.kt)("li",{parentName:"ul"},"struct definitions ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter ",(0,i.kt)("a",{parentName:"em",href:"/basic/struct"},"Struct"),")")),(0,i.kt)("li",{parentName:"ul"},"enumeration definitions ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter ",(0,i.kt)("a",{parentName:"em",href:"/basic/enum"},"Enum"),")")),(0,i.kt)("li",{parentName:"ul"},"union definitions"),(0,i.kt)("li",{parentName:"ul"},"constant items ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter ",(0,i.kt)("a",{parentName:"em",href:"/basic/konstanta"},"Konstanta"),")")),(0,i.kt)("li",{parentName:"ul"},"static items ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter ",(0,i.kt)("a",{parentName:"em",href:"/basic/static"},"Static Items"),")")),(0,i.kt)("li",{parentName:"ul"},"trait definitions ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter ",(0,i.kt)("a",{parentName:"em",href:"/basic/traits"},"Traits"),")")),(0,i.kt)("li",{parentName:"ul"},"implementations ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter ",(0,i.kt)("a",{parentName:"em",href:"/basic/function"},"Function"),", ",(0,i.kt)("a",{parentName:"em",href:"/basic/associated-function"},"Associated Function"),", dan ",(0,i.kt)("a",{parentName:"em",href:"/basic/method"},"Method"),")")),(0,i.kt)("li",{parentName:"ul"},"extern blocks")),(0,i.kt)("h2",{id:"a184-penerapan-paths-dalam-penggaksesan-item"},"A.18.4. Penerapan paths dalam penggaksesan item"),(0,i.kt)("p",null,"Pada bagian ini, kita akan coba terapkan path untuk mengakses beberapa item."),(0,i.kt)("p",null,"Dalam program sederhana berikut, inputan user ditampung sebagai string, kemudian ditampilkan."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n // tampilkan intro untuk user agar menginput sebuah pesan\n println!("enter a message:");\n\n // variabel yang akan menampung inputan user dalam string\n let mut message = std::string::String::new();\n\n // objek reader untuk membaca inputan user\n let stdin_reader = std::io::stdin(); \n\n // proses pembacaan inputan user\n let reader_res = stdin_reader.read_line(&mut message);\n\n // pengecekan apakah ada error dalam pembacaan inputan.\n // jika iya, maka tampilkan error dan hentikan program\n if reader_res.is_err() {\n println!("error! {:?}", reader_res.err());\n return;\n }\n\n // tampilkan pesan inputan user\n println!("message: {}", message);\n}\n')),(0,i.kt)("p",null,"Jalankan program, lalu inputkan sebuah pesan, kemudian enter."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Module system path",src:t(7873).Z,width:"452",height:"153"})),(0,i.kt)("p",null,"Bisa dilihat pesan ditampilkan sesuai inputan. Oke, sekarang kita akan bahas program di atas per-barisnya."),(0,i.kt)("h3",{id:"-stdstringstringnew"},"\u25c9 ",(0,i.kt)("inlineCode",{parentName:"h3"},"std::string::String::new()")),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"message")," adalah string yang dibuat menggunakan tipe data custom ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),". Salah satu cara pembuatan string bertipe data ini adalah menggunakan statement ",(0,i.kt)("inlineCode",{parentName:"p"},"std::string::String::new()"),"."),(0,i.kt)("p",null,"Bisa dilihat tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"::")," digunakan pada statement tersebut. Path tersebut jika dijabarkan per segment:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Segment ",(0,i.kt)("inlineCode",{parentName:"li"},"std")," adalah crate ",(0,i.kt)("em",{parentName:"li"},"Rust Standard Library")),(0,i.kt)("li",{parentName:"ul"},"Pada path ",(0,i.kt)("inlineCode",{parentName:"li"},"std::string"),", segment ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," adalah module"),(0,i.kt)("li",{parentName:"ul"},"Pada path ",(0,i.kt)("inlineCode",{parentName:"li"},"std::string::String"),", segment ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," adalah struct String, yang biasa disebut dengan ",(0,i.kt)("em",{parentName:"li"},"custom type ",(0,i.kt)("inlineCode",{parentName:"em"},"String"))),(0,i.kt)("li",{parentName:"ul"},"Pada path ",(0,i.kt)("inlineCode",{parentName:"li"},"std::string::String::new"),", segment ",(0,i.kt)("inlineCode",{parentName:"li"},"new")," adalah sebuah fungsi milik struct ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," yang mengembalikan data bertipe custom string ",(0,i.kt)("inlineCode",{parentName:"li"},"String"),"."),(0,i.kt)("li",{parentName:"ul"},"Di segment terakhir, yaitu ",(0,i.kt)("inlineCode",{parentName:"li"},"new"),", ditambahkan tanda pemanggilan fungsi ",(0,i.kt)("inlineCode",{parentName:"li"},"()"),", yang menandakan bahwa fungsi ",(0,i.kt)("inlineCode",{parentName:"li"},"new")," dipanggil. Dengan itu maka nilai baliknya (yang berupa ",(0,i.kt)("inlineCode",{parentName:"li"},"String"),") ditampung oleh variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"message"),".")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Terkesan banyak sekali penjelasan dalam 1 baris kode, tapi tidak perlu dihafal, lama-kelamaan akan terbiasa.")),(0,i.kt)("p",null,"Salah satu yang menarik dari crate ",(0,i.kt)("em",{parentName:"p"},"Rust Standard Library")," adalah, beberapa segmen otomatis di-import atau dipakai. Jadi tidak perlu menuliskan path secara full."),(0,i.kt)("p",null,"Pada contoh yang sudah dibuat, statement pembuatan data ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," bisa diubah dari ..."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let mut message = std::string::String::new();\n")),(0,i.kt)("p",null,"... menjadi cukup ..."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let mut message = String::new();\n")),(0,i.kt)("h3",{id:"-stdiostdin"},"\u25c9 ",(0,i.kt)("inlineCode",{parentName:"h3"},"std::io::stdin()")),(0,i.kt)("p",null,"Berbeda dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),", path ",(0,i.kt)("inlineCode",{parentName:"p"},"std::io::stdin")," tidak otomatis ter-import, jadi harus dituliskan secara full meskipun sama-sama di bawah crate ",(0,i.kt)("em",{parentName:"p"},"Rust Standard Library"),"."),(0,i.kt)("p",null,"Path ",(0,i.kt)("inlineCode",{parentName:"p"},"std::io")," berisi module untuk keperluan I/O atau input output. Salah satu item yang ada dalam module ini adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"stdin"),", yang merupakan sebuah fungsi berguna untuk pembuatan objek handler untuk keperluan yang berhubungan dengan console (",(0,i.kt)("em",{parentName:"p"},"stdin"),"). Objek tersebut ditampung oleh variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"stdin_reader"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Secara terminologi, ",(0,i.kt)("em",{parentName:"p"},"stdin")," (merupakan kependekan dari ",(0,i.kt)("em",{parentName:"p"},"standard input"),") adalah sebuah input stream yang nilainya dibaca oleh program sebagai inputan.")),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"stdin_reader")," ini kemudian kita gunakan untuk berinteraksi dengan input stream, untuk menangkap inputan user."),(0,i.kt)("h3",{id:"-stdin_readerread_linemut-message"},"\u25c9 ",(0,i.kt)("inlineCode",{parentName:"h3"},"stdin_reader.read_line(&mut message)")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"read_line")," milik variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"stdin_reader")," berguna untuk menangkap inputan user. Variabel yang disisipkan sebagai argumen pemanggilan method tersebut menjadi penampung inputan user, yang pada contoh ini adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"message"),"."),(0,i.kt)("p",null,"Perlu diperhatikan bahwa ",(0,i.kt)("inlineCode",{parentName:"p"},"message")," disisipkan ",(0,i.kt)("em",{parentName:"p"},"mutable reference"),"-nya sebagai argumen pemanggilan fungsi."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai pointer dan ",(0,i.kt)("em",{parentName:"p"},"mutable reference")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"))),(0,i.kt)("p",null,"Eksekusi dari statement ",(0,i.kt)("inlineCode",{parentName:"p"},"stdin_reader.read_line(&mut message)")," adalah blocking, artinya program akan berhenti untuk sementara di baris tersebut, hingga ada inputan dari user dan tombol enter ditekan."),(0,i.kt)("h3",{id:"-pengecekan-error-stdin_reader"},"\u25c9 Pengecekan error ",(0,i.kt)("inlineCode",{parentName:"h3"},"stdin_reader")),(0,i.kt)("p",null,"Blok statement ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," pada contoh di atas bertugas melakukan pengecekan error. Jika ada error, maka ",(0,i.kt)("inlineCode",{parentName:"p"},"reader_res.is_err()")," bernilai ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),", dan pesan error-nya dimunculkan."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'if reader_res.is_err() {\n println!("error! {:?}", reader_res.err());\n return;\n}\n')),(0,i.kt)("h3",{id:"-menampilkan-isi-message"},"\u25c9 Menampilkan isi ",(0,i.kt)("inlineCode",{parentName:"h3"},"message")),(0,i.kt)("p",null,"Jika program berlajan sesuai harapan, tanpa error, pada baris terakhir data dalam ",(0,i.kt)("inlineCode",{parentName:"p"},"message")," ditampilkan ke layar."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," ini tidak perlu di-konversi ke bentuk literal string ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," untuk ditampilkan menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),". Langsung saja sisipkan variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," ke macro tersebut dan ",(0,i.kt)("inlineCode",{parentName:"p"},"println")," akan tau harus menampilkan apa.")),(0,i.kt)("p",null,"Oke, Penulis rasa sudah cukup jelas perihal bagaimana cara menggunakan path untuk mengakses item. Cukup tulis saja path-nya. Jika path-nya panjang? ya ditulis semua."),(0,i.kt)("h2",{id:"a185-penggunaan-keyword-use-untuk-import-path"},"A.18.5. Penggunaan keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"use")," untuk import path"),(0,i.kt)("p",null,"Ada alternatif cara lain untuk memperpendek penulisan dan pengaksesan path, yaitu dengan menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"use"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Penggunaan ",(0,i.kt)("inlineCode",{parentName:"p"},"use")," juga sempat dipraktikkan pada chapter sebelumnya, yaitu ",(0,i.kt)("a",{parentName:"p",href:"/basic/perulangan-while"},"Perulangan \u279c while"),".")),(0,i.kt)("p",null,"Cara penerapannya bisa dilihat pada kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let stdin_reader = std::io::stdin();\n\n// ... atau ...\n\nuse std::io;\nlet stdin_reader = io::stdin();\n\n// ... atau ...\n\nuse std::io::stdin;\nlet stdin_reader = stdin();\n\n// ... atau ...\n\nuse std::io::{stdin};\nlet stdin_reader = stdin();\n")),(0,i.kt)("p",null,"Dengan menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"use")," kita bisa memperpendek pengaksesan sebuah path."),(0,i.kt)("p",null,"O iya keyword ini bisa digunakan di mana saja, artinya tidak harus di luar fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),". Bisa saja di dalam fungsi, atau di dalam blok kode seleksi kondisi atau lainnya."),(0,i.kt)("h3",{id:"-import-beberapa-items-yang-parent-path-nya-yang-sama"},"\u25c9 Import beberapa items yang parent path-nya yang sama"),(0,i.kt)("p",null,"Pada contoh di atas, path yang diimport adalah sebuah item ",(0,i.kt)("inlineCode",{parentName:"p"},"std::io::stdin"),". Dimisalkan ada path lain (sebagai contoh ",(0,i.kt)("inlineCode",{parentName:"p"},"std::io::stderr"),") yang juga ikut diimport, maka penulisannya kurang lebih seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"use std::io::stdin;\nuse std::io::stderr;\n\n// ... atau ...\n\nuse std::io::{stdin, stderr};\n")),(0,i.kt)("h3",{id:"-import-semua-items-dalam-suatu-path"},"\u25c9 Import semua items dalam suatu path"),(0,i.kt)("p",null,"Suatu path bisa saja memiliki cukup banyak item/child di bawahnya. Sebagai contoh, path ",(0,i.kt)("inlineCode",{parentName:"p"},"std::io")," merupakan parent path dari ",(0,i.kt)("inlineCode",{parentName:"p"},"stdin")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"stderr"),". Selain dua items tersebut, ada juga item lainnya."),(0,i.kt)("p",null,"Ada shortcut yang membuat penulisan import path lebih praktis, tidak perlu menuliskan satu-per-satu, caranya adalah menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"*"),". Sebagai contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"use std::io::*;\n\n// ... adalah ekuivalen dengan ...\n\nuse std::io::{stdin, stderr, stdout, <path lainnya>};\n\n// ... atau ...\n\nuse std::io::stdin;\nuse std::io::stderr;\nuse std::io::stdout;\nuse std::io::<path lainnya>;\n")),(0,i.kt)("h2",{id:"a186-pembahasan-lanjutan"},"A.18.6. Pembahasan lanjutan"),(0,i.kt)("p",null,"Kita sudah beberapa kali menerapkan path untuk mengakses item milik crate ",(0,i.kt)("em",{parentName:"p"},"Rust Standard Library"),", lalu bagaimana penerapan path untuk internal item, pastinya pada proyek real dalam 1 program akan ada banyak item."),(0,i.kt)("p",null,"Jawabannya akan ada di beberapa chapter berikutnya. Untuk sekarang khusus pada bagian ",(0,i.kt)("strong",{parentName:"p"},"module system")," ini, penulis anjurkan untuk mengikuti urutan pembelajaran ebook terlebih dahulu."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/path_item"},"github.com/novalagung/dasarpemrogramanrust-example/../path_item")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.html"},"https://doc.rust-lang.org/book/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/paths.html"},"https://doc.rust-lang.org/reference/paths.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/items.html"},"https://doc.rust-lang.org/reference/items.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.use.html"},"https://doc.rust-lang.org/std/keyword.use.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/edition-guide/rust-2018/path-changes.html"},"https://doc.rust-lang.org/edition-guide/rust-2018/path-changes.html"))))}d.isMDXComponent=!0},7873:(a,e,t)=>{t.d(e,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcQAAACZCAIAAAA+Wt3VAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIi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ium6TCfSTgAQEwBABBTAABATAEAEFMAAMQUAAAxBQAAxBQAADEFAEBMAQAAMQUAQEwBABBTAIDL4f+9xQMz8c2S2gAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/e7bd9b37.76164cf5.js b/assets/js/e7bd9b37.76164cf5.js new file mode 100644 index 00000000..5bf9b37e --- /dev/null +++ b/assets/js/e7bd9b37.76164cf5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[7539],{3905:(a,e,t)=>{t.d(e,{Zo:()=>u,kt:()=>o});var n=t(7294);function i(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function r(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),t.push.apply(t,n)}return t}function p(a){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?r(Object(t),!0).forEach((function(e){i(a,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(t,e))}))}return a}function l(a,e){if(null==a)return{};var t,n,i=function(a,e){if(null==a)return{};var t,n,i={},r=Object.keys(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||(i[t]=a[t]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(n=0;n<r.length;n++)t=r[n],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(a,t)&&(i[t]=a[t])}return i}var s=n.createContext({}),m=function(a){var e=n.useContext(s),t=e;return a&&(t="function"==typeof a?a(e):p(p({},e),a)),t},u=function(a){var e=m(a.components);return n.createElement(s.Provider,{value:e},a.children)},d={inlineCode:"code",wrapper:function(a){var e=a.children;return n.createElement(n.Fragment,{},e)}},k=n.forwardRef((function(a,e){var t=a.components,i=a.mdxType,r=a.originalType,s=a.parentName,u=l(a,["components","mdxType","originalType","parentName"]),k=m(t),o=i,h=k["".concat(s,".").concat(o)]||k[o]||d[o]||r;return t?n.createElement(h,p(p({ref:e},u),{},{components:t})):n.createElement(h,p({ref:e},u))}));function o(a,e){var t=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=t.length,p=new Array(r);p[0]=k;var l={};for(var s in e)hasOwnProperty.call(e,s)&&(l[s]=e[s]);l.originalType=a,l.mdxType="string"==typeof a?a:i,p[1]=l;for(var m=2;m<r;m++)p[m]=t[m];return n.createElement.apply(null,p)}return n.createElement.apply(null,t)}k.displayName="MDXCreateElement"},2079:(a,e,t)=>{t.r(e),t.d(e,{assets:()=>s,contentTitle:()=>p,default:()=>d,frontMatter:()=>r,metadata:()=>l,toc:()=>m});var n=t(7462),i=(t(7294),t(3905));const r={sidebar_position:18,title:"A.18. Module System \u279c Path & Item",sidebar_label:"A.18. Module System \u279c Path & Item"},p=void 0,l={unversionedId:"basic/path-item",id:"basic/path-item",title:"A.18. Module System \u279c Path & Item",description:"Chapter ini membahas tentang konsep path dan item dalam Rust programming.",source:"@site/docs/basic/path-item.md",sourceDirName:"basic",slug:"/basic/path-item",permalink:"/basic/path-item",draft:!1,tags:[],version:"current",sidebarPosition:18,frontMatter:{sidebar_position:18,title:"A.18. Module System \u279c Path & Item",sidebar_label:"A.18. Module System \u279c Path & Item"},sidebar:"tutorialSidebar",previous:{title:"A.17. Function",permalink:"/basic/function"},next:{title:"A.19. Module System \u279c Package & Crate",permalink:"/basic/package-crate"}},s={},m=[{value:"A.18.1. Rust <em>Paths</em>",id:"a181-rust-paths",level:2},{value:"A.18.2. Absolute & relative paths",id:"a182-absolute--relative-paths",level:2},{value:"A.18.3. Rust <em>Items</em>",id:"a183-rust-items",level:2},{value:"A.18.4. Penerapan paths dalam penggaksesan item",id:"a184-penerapan-paths-dalam-penggaksesan-item",level:2},{value:"\u25c9 <code>std::string::String::new()</code>",id:"-stdstringstringnew",level:3},{value:"\u25c9 <code>std::io::stdin()</code>",id:"-stdiostdin",level:3},{value:"\u25c9 <code>stdin_reader.read_line(&mut message)</code>",id:"-stdin_readerread_linemut-message",level:3},{value:"\u25c9 Pengecekan error <code>stdin_reader</code>",id:"-pengecekan-error-stdin_reader",level:3},{value:"\u25c9 Menampilkan isi <code>message</code>",id:"-menampilkan-isi-message",level:3},{value:"A.18.5. Penggunaan keyword <code>use</code> untuk import path",id:"a185-penggunaan-keyword-use-untuk-import-path",level:2},{value:"\u25c9 Import beberapa items yang parent path-nya yang sama",id:"-import-beberapa-items-yang-parent-path-nya-yang-sama",level:3},{value:"\u25c9 Import semua items dalam suatu path",id:"-import-semua-items-dalam-suatu-path",level:3},{value:"A.18.6. Pembahasan lanjutan",id:"a186-pembahasan-lanjutan",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],u={toc:m};function d(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,n.Z)({},u,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Chapter ini membahas tentang konsep ",(0,i.kt)("em",{parentName:"p"},"path")," dan ",(0,i.kt)("em",{parentName:"p"},"item")," dalam Rust programming."),(0,i.kt)("h2",{id:"a181-rust-paths"},"A.18.1. Rust ",(0,i.kt)("em",{parentName:"h2"},"Paths")),(0,i.kt)("p",null,"Paths (atau Path) adalah notasi penulisan alamat sebuah item, contohnya ",(0,i.kt)("inlineCode",{parentName:"p"},"std::time::Duration"),"."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"std::time::Duration")," adalah ",(0,i.kt)("em",{parentName:"p"},"path")," untuk item yang isinya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"struct")," bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"Duration"),". Item bisa berupa banyak jenis, bisa saja struct, atau ",(0,i.kt)("em",{parentName:"p"},"macro"),", konstanta, atau lainnya. Lebih jelasnya silakan cek pada halaman dokumentasi ",(0,i.kt)("inlineCode",{parentName:"p"},"std::time::Duration"),"."),(0,i.kt)("p",null,"Sebuah path bisa memiliki banyak bagian (biasa disebut ",(0,i.kt)("em",{parentName:"p"},"segment"),"), sebagai contoh, path ",(0,i.kt)("inlineCode",{parentName:"p"},"std::time::Duration")," memiliki 3 segmen yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"std"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"time"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"Duration"),". Karakter ",(0,i.kt)("inlineCode",{parentName:"p"},"::")," digunakan dalam penulisan path sebagai pembatas antar segmen (jika path memiliki lebih dari 1 segmen)."),(0,i.kt)("p",null,"Dalam sebuah path, yang disebut dengan item adalah segment terakhir. Contohnya path ",(0,i.kt)("inlineCode",{parentName:"p"},"std::time::Duration"),", maka item yang dituju adalah struct ",(0,i.kt)("inlineCode",{parentName:"p"},"Duration"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Rust paths mirip seperti konsep ",(0,i.kt)("em",{parentName:"p"},"filesystem")," path di sistem operasi. Seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"C:\\Users\\novalagung\\Desktop")," di windows, atau ",(0,i.kt)("inlineCode",{parentName:"p"},"/etc/nginx/conf.d/nginx.conf")," di Unix/Linux."),(0,i.kt)("p",{parentName:"blockquote"},"Di Rust, path tidak menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"\\")," atau ",(0,i.kt)("inlineCode",{parentName:"p"},"/")," sebagai separator, melainkan ",(0,i.kt)("inlineCode",{parentName:"p"},"::"),".")),(0,i.kt)("p",null,"Jika di-breakdown, berikut adalah penjelasan dari setiap kombinasi segmen path pada contoh ",(0,i.kt)("inlineCode",{parentName:"p"},"std::time::Duration"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Path ",(0,i.kt)("inlineCode",{parentName:"li"},"std")," \u279c adalah path untuk ",(0,i.kt)("strong",{parentName:"li"},"crate")," bernama ",(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/"},(0,i.kt)("strong",{parentName:"a"},"Rust Standard Library")),", isinya adalah sangat banyak item untuk keperluan umum di Rust programming. Lebih jelasnya akan dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"#/wip/rust-standard-library"},"Rust standard library"),"."),(0,i.kt)("li",{parentName:"ul"},"Path ",(0,i.kt)("inlineCode",{parentName:"li"},"std::time")," \u279c adalah path untuk ",(0,i.kt)("strong",{parentName:"li"},"module")," bernama ",(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/time/index.html"},(0,i.kt)("inlineCode",{parentName:"a"},"time")),", isinya banyak item yang berhubungan dengan operasi waktu/time."),(0,i.kt)("li",{parentName:"ul"},"Path ",(0,i.kt)("inlineCode",{parentName:"li"},"std::time::Duration")," \u279c adalah path untuk ",(0,i.kt)("strong",{parentName:"li"},"struct")," bernama ",(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/time/index.html"},(0,i.kt)("inlineCode",{parentName:"a"},"Duration")),", yang merupakan representasi dari unit waktu.")),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai crate dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/package-crate"},"Module System \u279c Package & Crate")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai module dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/module-basic"},"Module System \u279c Module")),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai struct dibahas pada chapter ",(0,i.kt)("a",{parentName:"li",href:"/basic/struct"},"Struct")))),(0,i.kt)("h2",{id:"a182-absolute--relative-paths"},"A.18.2. Absolute & relative paths"),(0,i.kt)("p",null,"Rust mengenal dua jenis path:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Absolute path \u279c adalah path yang penulisannya lengkap dari root path, contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"li"},"std::time::Duration"),"."),(0,i.kt)("li",{parentName:"ul"},"Relative path \u279c adalah path yang penulisannya relatif terhadap current path, contohnya seperti ",(0,i.kt)("inlineCode",{parentName:"li"},"self::my_func"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"super::my_mod::my_consntan"),".")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai relative path dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/module-scope-item-access"},"Module System \u279c Scope & Akses Item"),".")),(0,i.kt)("h2",{id:"a183-rust-items"},"A.18.3. Rust ",(0,i.kt)("em",{parentName:"h2"},"Items")),(0,i.kt)("p",null,"Seperti yang sudah dibahas bahwa path adalah notasi penulisan alamat untuk item. Lalu apa saja yang disebut dengan item? Di Rust ada banyak hal, yang kurang lebih list-nya bisa dilihat berikut:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"modules ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter ",(0,i.kt)("a",{parentName:"em",href:"/basic/module-basic"},"Module System \u279c Module"),")")),(0,i.kt)("li",{parentName:"ul"},"extern crate declarations"),(0,i.kt)("li",{parentName:"ul"},"use declarations ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter ",(0,i.kt)("a",{parentName:"em",href:"/basic/use"},"Module System \u279c Use"),")")),(0,i.kt)("li",{parentName:"ul"},"function definitions ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter ",(0,i.kt)("a",{parentName:"em",href:"/basic/function"},"Function"),", ",(0,i.kt)("a",{parentName:"em",href:"/basic/associated-function"},"Associated Function"),", dan ",(0,i.kt)("a",{parentName:"em",href:"/basic/method"},"Method"),")")),(0,i.kt)("li",{parentName:"ul"},"type definitions ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter-chapter tentang tipe data)")),(0,i.kt)("li",{parentName:"ul"},"struct definitions ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter ",(0,i.kt)("a",{parentName:"em",href:"/basic/struct"},"Struct"),")")),(0,i.kt)("li",{parentName:"ul"},"enumeration definitions ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter ",(0,i.kt)("a",{parentName:"em",href:"/basic/enum"},"Enum"),")")),(0,i.kt)("li",{parentName:"ul"},"union definitions"),(0,i.kt)("li",{parentName:"ul"},"constant items ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter ",(0,i.kt)("a",{parentName:"em",href:"/basic/konstanta"},"Konstanta"),")")),(0,i.kt)("li",{parentName:"ul"},"static items ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter ",(0,i.kt)("a",{parentName:"em",href:"/basic/static"},"Static Items"),")")),(0,i.kt)("li",{parentName:"ul"},"trait definitions ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter ",(0,i.kt)("a",{parentName:"em",href:"/basic/traits"},"Traits"),")")),(0,i.kt)("li",{parentName:"ul"},"implementations ",(0,i.kt)("em",{parentName:"li"},"(dibahas pada chapter ",(0,i.kt)("a",{parentName:"em",href:"/basic/function"},"Function"),", ",(0,i.kt)("a",{parentName:"em",href:"/basic/associated-function"},"Associated Function"),", dan ",(0,i.kt)("a",{parentName:"em",href:"/basic/method"},"Method"),")")),(0,i.kt)("li",{parentName:"ul"},"extern blocks")),(0,i.kt)("h2",{id:"a184-penerapan-paths-dalam-penggaksesan-item"},"A.18.4. Penerapan paths dalam penggaksesan item"),(0,i.kt)("p",null,"Pada bagian ini, kita akan coba terapkan path untuk mengakses beberapa item."),(0,i.kt)("p",null,"Dalam program sederhana berikut, inputan user ditampung sebagai string, kemudian ditampilkan."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n // tampilkan intro untuk user agar menginput sebuah pesan\n println!("enter a message:");\n\n // variabel yang akan menampung inputan user dalam string\n let mut message = std::string::String::new();\n\n // objek reader untuk membaca inputan user\n let stdin_reader = std::io::stdin(); \n\n // proses pembacaan inputan user\n let reader_res = stdin_reader.read_line(&mut message);\n\n // pengecekan apakah ada error dalam pembacaan inputan.\n // jika iya, maka tampilkan error dan hentikan program\n if reader_res.is_err() {\n println!("error! {:?}", reader_res.err());\n return;\n }\n\n // tampilkan pesan inputan user\n println!("message: {}", message);\n}\n')),(0,i.kt)("p",null,"Jalankan program, lalu inputkan sebuah pesan, kemudian enter."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Module system path",src:t(7873).Z,width:"452",height:"153"})),(0,i.kt)("p",null,"Bisa dilihat pesan ditampilkan sesuai inputan. Oke, sekarang kita akan bahas program di atas per-barisnya."),(0,i.kt)("h3",{id:"-stdstringstringnew"},"\u25c9 ",(0,i.kt)("inlineCode",{parentName:"h3"},"std::string::String::new()")),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"message")," adalah string yang dibuat menggunakan tipe data custom ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),". Salah satu cara pembuatan string bertipe data ini adalah menggunakan statement ",(0,i.kt)("inlineCode",{parentName:"p"},"std::string::String::new()"),"."),(0,i.kt)("p",null,"Bisa dilihat tanda ",(0,i.kt)("inlineCode",{parentName:"p"},"::")," digunakan pada statement tersebut. Path tersebut jika dijabarkan per segment:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Segment ",(0,i.kt)("inlineCode",{parentName:"li"},"std")," adalah crate ",(0,i.kt)("em",{parentName:"li"},"Rust Standard Library")),(0,i.kt)("li",{parentName:"ul"},"Pada path ",(0,i.kt)("inlineCode",{parentName:"li"},"std::string"),", segment ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," adalah module"),(0,i.kt)("li",{parentName:"ul"},"Pada path ",(0,i.kt)("inlineCode",{parentName:"li"},"std::string::String"),", segment ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," adalah struct String, yang biasa disebut dengan ",(0,i.kt)("em",{parentName:"li"},"custom type ",(0,i.kt)("inlineCode",{parentName:"em"},"String"))),(0,i.kt)("li",{parentName:"ul"},"Pada path ",(0,i.kt)("inlineCode",{parentName:"li"},"std::string::String::new"),", segment ",(0,i.kt)("inlineCode",{parentName:"li"},"new")," adalah sebuah fungsi milik struct ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," yang mengembalikan data bertipe custom string ",(0,i.kt)("inlineCode",{parentName:"li"},"String"),"."),(0,i.kt)("li",{parentName:"ul"},"Di segment terakhir, yaitu ",(0,i.kt)("inlineCode",{parentName:"li"},"new"),", ditambahkan tanda pemanggilan fungsi ",(0,i.kt)("inlineCode",{parentName:"li"},"()"),", yang menandakan bahwa fungsi ",(0,i.kt)("inlineCode",{parentName:"li"},"new")," dipanggil. Dengan itu maka nilai baliknya (yang berupa ",(0,i.kt)("inlineCode",{parentName:"li"},"String"),") ditampung oleh variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"message"),".")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Terkesan banyak sekali penjelasan dalam 1 baris kode, tapi tidak perlu dihafal, lama-kelamaan akan terbiasa.")),(0,i.kt)("p",null,"Salah satu yang menarik dari crate ",(0,i.kt)("em",{parentName:"p"},"Rust Standard Library")," adalah, beberapa segmen otomatis di-import atau dipakai. Jadi tidak perlu menuliskan path secara full."),(0,i.kt)("p",null,"Pada contoh yang sudah dibuat, statement pembuatan data ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," bisa diubah dari ..."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let mut message = std::string::String::new();\n")),(0,i.kt)("p",null,"... menjadi cukup ..."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let mut message = String::new();\n")),(0,i.kt)("h3",{id:"-stdiostdin"},"\u25c9 ",(0,i.kt)("inlineCode",{parentName:"h3"},"std::io::stdin()")),(0,i.kt)("p",null,"Berbeda dengan ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),", path ",(0,i.kt)("inlineCode",{parentName:"p"},"std::io::stdin")," tidak otomatis ter-import, jadi harus dituliskan secara full meskipun sama-sama di bawah crate ",(0,i.kt)("em",{parentName:"p"},"Rust Standard Library"),"."),(0,i.kt)("p",null,"Path ",(0,i.kt)("inlineCode",{parentName:"p"},"std::io")," berisi module untuk keperluan I/O atau input output. Salah satu item yang ada dalam module ini adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"stdin"),", yang merupakan sebuah fungsi berguna untuk pembuatan objek handler untuk keperluan yang berhubungan dengan console (",(0,i.kt)("em",{parentName:"p"},"stdin"),"). Objek tersebut ditampung oleh variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"stdin_reader"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Secara terminologi, ",(0,i.kt)("em",{parentName:"p"},"stdin")," (merupakan kependekan dari ",(0,i.kt)("em",{parentName:"p"},"standard input"),") adalah sebuah input stream yang nilainya dibaca oleh program sebagai inputan.")),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"stdin_reader")," ini kemudian kita gunakan untuk berinteraksi dengan input stream, untuk menangkap inputan user."),(0,i.kt)("h3",{id:"-stdin_readerread_linemut-message"},"\u25c9 ",(0,i.kt)("inlineCode",{parentName:"h3"},"stdin_reader.read_line(&mut message)")),(0,i.kt)("p",null,"Method ",(0,i.kt)("inlineCode",{parentName:"p"},"read_line")," milik variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"stdin_reader")," berguna untuk menangkap inputan user. Variabel yang disisipkan sebagai argumen pemanggilan method tersebut menjadi penampung inputan user, yang pada contoh ini adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"message"),"."),(0,i.kt)("p",null,"Perlu diperhatikan bahwa ",(0,i.kt)("inlineCode",{parentName:"p"},"message")," disisipkan ",(0,i.kt)("em",{parentName:"p"},"mutable reference"),"-nya sebagai argumen pemanggilan fungsi."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai pointer dan ",(0,i.kt)("em",{parentName:"p"},"mutable reference")," dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"))),(0,i.kt)("p",null,"Eksekusi dari statement ",(0,i.kt)("inlineCode",{parentName:"p"},"stdin_reader.read_line(&mut message)")," adalah blocking, artinya program akan berhenti untuk sementara di baris tersebut, hingga ada inputan dari user dan tombol enter ditekan."),(0,i.kt)("h3",{id:"-pengecekan-error-stdin_reader"},"\u25c9 Pengecekan error ",(0,i.kt)("inlineCode",{parentName:"h3"},"stdin_reader")),(0,i.kt)("p",null,"Blok statement ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," pada contoh di atas bertugas melakukan pengecekan error. Jika ada error, maka ",(0,i.kt)("inlineCode",{parentName:"p"},"reader_res.is_err()")," bernilai ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),", dan pesan error-nya dimunculkan."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'if reader_res.is_err() {\n println!("error! {:?}", reader_res.err());\n return;\n}\n')),(0,i.kt)("h3",{id:"-menampilkan-isi-message"},"\u25c9 Menampilkan isi ",(0,i.kt)("inlineCode",{parentName:"h3"},"message")),(0,i.kt)("p",null,"Jika program berlajan sesuai harapan, tanpa error, pada baris terakhir data dalam ",(0,i.kt)("inlineCode",{parentName:"p"},"message")," ditampilkan ke layar."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," ini tidak perlu di-konversi ke bentuk literal string ",(0,i.kt)("inlineCode",{parentName:"p"},"&str")," untuk ditampilkan menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"println"),". Langsung saja sisipkan variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"String")," ke macro tersebut dan ",(0,i.kt)("inlineCode",{parentName:"p"},"println")," akan tau harus menampilkan apa.")),(0,i.kt)("p",null,"Oke, Penulis rasa sudah cukup jelas perihal bagaimana cara menggunakan path untuk mengakses item. Cukup tulis saja path-nya. Jika path-nya panjang? ya ditulis semua."),(0,i.kt)("h2",{id:"a185-penggunaan-keyword-use-untuk-import-path"},"A.18.5. Penggunaan keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"use")," untuk import path"),(0,i.kt)("p",null,"Ada alternatif cara lain untuk memperpendek penulisan dan pengaksesan path, yaitu dengan menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"use"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Penggunaan ",(0,i.kt)("inlineCode",{parentName:"p"},"use")," juga sempat dipraktikkan pada chapter sebelumnya, yaitu ",(0,i.kt)("a",{parentName:"p",href:"/basic/perulangan-while"},"Perulangan \u279c while"),".")),(0,i.kt)("p",null,"Cara penerapannya bisa dilihat pada kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"let stdin_reader = std::io::stdin();\n\n// ... atau ...\n\nuse std::io;\nlet stdin_reader = io::stdin();\n\n// ... atau ...\n\nuse std::io::stdin;\nlet stdin_reader = stdin();\n\n// ... atau ...\n\nuse std::io::{stdin};\nlet stdin_reader = stdin();\n")),(0,i.kt)("p",null,"Dengan menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"use")," kita bisa memperpendek pengaksesan sebuah path."),(0,i.kt)("p",null,"O iya keyword ini bisa digunakan di mana saja, artinya tidak harus di luar fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),". Bisa saja di dalam fungsi, atau di dalam blok kode seleksi kondisi atau lainnya."),(0,i.kt)("h3",{id:"-import-beberapa-items-yang-parent-path-nya-yang-sama"},"\u25c9 Import beberapa items yang parent path-nya yang sama"),(0,i.kt)("p",null,"Pada contoh di atas, path yang diimport adalah sebuah item ",(0,i.kt)("inlineCode",{parentName:"p"},"std::io::stdin"),". Dimisalkan ada path lain (sebagai contoh ",(0,i.kt)("inlineCode",{parentName:"p"},"std::io::stderr"),") yang juga ikut diimport, maka penulisannya kurang lebih seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"use std::io::stdin;\nuse std::io::stderr;\n\n// ... atau ...\n\nuse std::io::{stdin, stderr};\n")),(0,i.kt)("h3",{id:"-import-semua-items-dalam-suatu-path"},"\u25c9 Import semua items dalam suatu path"),(0,i.kt)("p",null,"Suatu path bisa saja memiliki cukup banyak item/child di bawahnya. Sebagai contoh, path ",(0,i.kt)("inlineCode",{parentName:"p"},"std::io")," merupakan parent path dari ",(0,i.kt)("inlineCode",{parentName:"p"},"stdin")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"stderr"),". Selain dua items tersebut, ada juga item lainnya."),(0,i.kt)("p",null,"Ada shortcut yang membuat penulisan import path lebih praktis, tidak perlu menuliskan satu-per-satu, caranya adalah menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"*"),". Sebagai contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"use std::io::*;\n\n// ... adalah ekuivalen dengan ...\n\nuse std::io::{stdin, stderr, stdout, <path lainnya>};\n\n// ... atau ...\n\nuse std::io::stdin;\nuse std::io::stderr;\nuse std::io::stdout;\nuse std::io::<path lainnya>;\n")),(0,i.kt)("h2",{id:"a186-pembahasan-lanjutan"},"A.18.6. Pembahasan lanjutan"),(0,i.kt)("p",null,"Kita sudah beberapa kali menerapkan path untuk mengakses item milik crate ",(0,i.kt)("em",{parentName:"p"},"Rust Standard Library"),", lalu bagaimana penerapan path untuk internal item, pastinya pada proyek real dalam 1 program akan ada banyak item."),(0,i.kt)("p",null,"Jawabannya akan ada di beberapa chapter berikutnya. Untuk sekarang khusus pada bagian ",(0,i.kt)("strong",{parentName:"p"},"module system")," ini, penulis anjurkan untuk mengikuti urutan pembelajaran ebook terlebih dahulu."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/path_item"},"github.com/novalagung/dasarpemrogramanrust-example/../path_item")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.html"},"https://doc.rust-lang.org/book/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/paths.html"},"https://doc.rust-lang.org/reference/paths.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/items.html"},"https://doc.rust-lang.org/reference/items.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.use.html"},"https://doc.rust-lang.org/std/keyword.use.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/edition-guide/rust-2018/path-changes.html"},"https://doc.rust-lang.org/edition-guide/rust-2018/path-changes.html"))))}d.isMDXComponent=!0},7873:(a,e,t)=>{t.d(e,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcQAAACZCAIAAAA+Wt3VAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94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XnAabNbA8sUAMQUMUVMAS5JTD1WyvopT2XkXPGWDh6+/BKZqKohcOdHWlcnnK1xtgZYg5gqK2VpZuxxO+02Cifm4ZyB74ftmuwVU5ytR+UTZ2uAycVUeywJM2OpN1UREk5U0XV6jGsyztY4WwOsWUxtM+PUINnaKJyYgys6Nts7wjUZZ2ucrQHWLqZlWZGGUP1G7cQczpgG0nPMJBzO1jhbA6x6mO8au0sLZDXJtvugr8lCQv4FKHs+AWdrM584WwPML6bpIrtcQI4u7nT4KZ2Y5Vq+7Zo8WkxxtnbmE2drgAnFdDHEeHvVVyXO1gCwSjGNJ+lWPXTE2RoA1ium6TCfSTgAQEwBABBTAABATAEAEFMAAMQUAAAxBQAAxBQAADEFAEBMAQAAMQUAQEwBABBTAIDL4f+9xQMz8c2S2gAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/eb2a6637.409557c9.js b/assets/js/eb2a6637.409557c9.js new file mode 100644 index 00000000..87925b62 --- /dev/null +++ b/assets/js/eb2a6637.409557c9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[6388],{3905:(e,a,t)=>{t.d(a,{Zo:()=>s,kt:()=>o});var n=t(7294);function i(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function r(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function l(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?r(Object(t),!0).forEach((function(a){i(e,a,t[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}))}return e}function p(e,a){if(null==e)return{};var t,n,i=function(e,a){if(null==e)return{};var t,n,i={},r=Object.keys(e);for(n=0;n<r.length;n++)t=r[n],a.indexOf(t)>=0||(i[t]=e[t]);return i}(e,a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)t=r[n],a.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var u=n.createContext({}),m=function(e){var a=n.useContext(u),t=a;return e&&(t="function"==typeof e?e(a):l(l({},a),e)),t},s=function(e){var a=m(e.components);return n.createElement(u.Provider,{value:a},e.children)},d={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},k=n.forwardRef((function(e,a){var t=e.components,i=e.mdxType,r=e.originalType,u=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),k=m(t),o=i,A=k["".concat(u,".").concat(o)]||k[o]||d[o]||r;return t?n.createElement(A,l(l({ref:a},s),{},{components:t})):n.createElement(A,l({ref:a},s))}));function o(e,a){var t=arguments,i=a&&a.mdxType;if("string"==typeof e||i){var r=t.length,l=new Array(r);l[0]=k;var p={};for(var u in a)hasOwnProperty.call(a,u)&&(p[u]=a[u]);p.originalType=e,p.mdxType="string"==typeof e?e:i,l[1]=p;for(var m=2;m<r;m++)l[m]=t[m];return n.createElement.apply(null,l)}return n.createElement.apply(null,t)}k.displayName="MDXCreateElement"},164:(e,a,t)=>{t.r(a),t.d(a,{assets:()=>u,contentTitle:()=>l,default:()=>d,frontMatter:()=>r,metadata:()=>p,toc:()=>m});var n=t(7462),i=(t(7294),t(3905));const r={sidebar_position:29,title:"A.29. Module System \u279c Use, Import, Re-export",sidebar_label:"A.29. Module System \u279c Use, Import, Re-export"},l=void 0,p={unversionedId:"basic/use",id:"basic/use",title:"A.29. Module System \u279c Use, Import, Re-export",description:"Keyword use digunakan untuk dua hal, yaitu import path dan re-export path. Sebenarnya kita telah mempelajari kedua penerapan tersebut pada beberapa chapter sebelumnya. Pada chapter ini kita akan ulang lagi pembahasan agar lebih jelas.",source:"@site/docs/basic/use.md",sourceDirName:"basic",slug:"/basic/use",permalink:"/basic/use",draft:!1,tags:[],version:"current",sidebarPosition:29,frontMatter:{sidebar_position:29,title:"A.29. Module System \u279c Use, Import, Re-export",sidebar_label:"A.29. Module System \u279c Use, Import, Re-export"},sidebar:"tutorialSidebar",previous:{title:"A.28. Module System \u279c Visibility & Privacy",permalink:"/basic/visibility-privacy"},next:{title:"A.30. Block Expression",permalink:"/basic/block-expression"}},u={},m=[{value:"A.29.1. Keyword <code>use</code> untuk import path",id:"a291-keyword-use-untuk-import-path",level:2},{value:"\u25c9 Import items dari module yang sama",id:"-import-items-dari-module-yang-sama",level:3},{value:"A.29.2. Keyword <code>use</code> untuk re-export path",id:"a292-keyword-use-untuk-re-export-path",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],s={toc:m};function d(e){let{components:a,...r}=e;return(0,i.kt)("wrapper",(0,n.Z)({},s,r,{components:a,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"use")," digunakan untuk dua hal, yaitu ",(0,i.kt)("em",{parentName:"p"},"import")," path dan ",(0,i.kt)("em",{parentName:"p"},"re-export")," path. Sebenarnya kita telah mempelajari kedua penerapan tersebut pada beberapa chapter sebelumnya. Pada chapter ini kita akan ulang lagi pembahasan agar lebih jelas."),(0,i.kt)("h2",{id:"a291-keyword-use-untuk-import-path"},"A.29.1. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"use")," untuk import path"),(0,i.kt)("p",null,"Untuk bisa menggunakan sebuah item dari crate lain, entah itu dari rust standard library crate maupun 3rd-party, caranya cukup dengan menuliskan path item. Contohnya bisa dilihat di bawah ini, fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"current_dir")," digunakan untuk mengambil path dari current directory. Fungsi tersebut merupakan item dari module ",(0,i.kt)("inlineCode",{parentName:"p"},"std::env"),", maka untuk mengaksesnya kita harus menuliskan path secara lengkap."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let package_path = std::env::current_dir().unwrap();\nprintln!("package_path: {:?}", package_path);\n')),(0,i.kt)("p",null,"Selain cara di atas, bisa juga gunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"use")," untuk meng-import fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"current_dir")," ke kode program, dengannya kita tidak perlu menulis path secara lengkap. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'use std::env::current_dir;\n\nfn main() {\n let package_path = current_dir().unwrap();\n println!("package_path: {:?}", package_path);\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Rust use",src:t(9772).Z,width:"818",height:"104"})),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Di contoh, pengaksesan current directory di-chain dengan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap")," karena nilai balik fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"current_dir")," adalah bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"std::io::Result"),"."),(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai tipe tersebut dibahas pada chapter terpisah, ",(0,i.kt)("a",{parentName:"p",href:"/basic/result-type"},"Tipe Data \u279c Result"))),(0,i.kt)("h3",{id:"-import-items-dari-module-yang-sama"},"\u25c9 Import items dari module yang sama"),(0,i.kt)("p",null,"Pada contoh selanjutnya ini, kita akan coba praktikkan penerapan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"std::env::args")," untuk mengambil ",(0,i.kt)("em",{parentName:"p"},"argument")," saat eksekusi program, kemudian menampilkannya ke layar."),(0,i.kt)("p",null,"Ok, berarti akan ada 2 path yang akan di-import:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"use std::env::current_dir;\nuse std::env::args;\n")),(0,i.kt)("p",null,"Ada notasi penulisan import path lainnya yang bisa digunakan jika path-nya memiliki parent segment yang sama. Contohnya seperti di atas, kedua fungsi tersebut memiliki parent segment path yang sama yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"std::env"),". Yang seperti ini bisa dituliskan juga dengan notasi penulisan import berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"use std::env::{current_dir, args};\n")),(0,i.kt)("p",null,"Ok, lanjut ke praktik. Silakan tulis kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'use std::env::{current_dir, args};\n\nfn main() {\n let package_path = current_dir().unwrap();\n println!("package_path: {:?}", package_path);\n\n for i in 1..=args().len() {\n let each_arg = args().nth(i);\n if each_arg != None {\n println!("arg{}: {:?}", i, each_arg.unwrap());\n }\n }\n}\n')),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"std::env::args")," digunakan untuk mengambil argument eksekusi program baik eksekusi via ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run")," ataupun via pemanggilan binary. Fungsi tersebut nilai baliknya adalah iterator, jadi bisa digunakan dalam blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," dengan mudah."),(0,i.kt)("p",null,"Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"args().nth(i)")," mengembalikan nilai argument pada index ke-",(0,i.kt)("inlineCode",{parentName:"p"},"i")," dalam tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Option"),", dan nilai tersebut bisa saja tidak ada (direpresentasikan dengan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),"). Oleh karena itu penting untuk dicek terlebih dahulu menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"if"),". Jika memang nilainya adalah selain ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),", gunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap")," untuk mengambil nilainya dalam tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai Iterator akan dibahas pada chapter terpisah, ",(0,i.kt)("a",{parentName:"li",href:"/basic/trait-iterator"},"Trait \u279c Iterator"),"."),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai tipe ",(0,i.kt)("inlineCode",{parentName:"li"},"Option")," akan dibahas pada chapter terpisah, ",(0,i.kt)("a",{parentName:"li",href:"/basic/option-type"},"Tipe Data \u279c Option"),"."))),(0,i.kt)("p",null,"Silakan coba jalankan menggunakan dua command, yang pertama ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run"),", kemudian ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run tulis argumen di sini dengan pembatas spasi"),"."),(0,i.kt)("p",null,"Bisa dilihat pada gambar berikut, jika ada argument disisipkan dalam eksekusi program, maka ditampilkan. Pada gambar berikut dicontohkan argument yang dipakai adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"hello")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"world"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Rust use",src:t(4887).Z,width:"793",height:"223"})),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai Iterator dibahas pada chapter terpisah, ",(0,i.kt)("a",{parentName:"p",href:"/basic/trait-iterator"},"Trait \u279c Iterator"))),(0,i.kt)("h2",{id:"a292-keyword-use-untuk-re-export-path"},"A.29.2. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"use")," untuk re-export path"),(0,i.kt)("p",null,"Re-export item adalah sebuah cara untuk mem-",(0,i.kt)("em",{parentName:"p"},"bypass")," pengaksesan item yang secara hirarki memang tidak bisa diakses dari luar module (bisa jadi karena visibility item ataupun parent module nya adalah private). Dengan teknik ini, maka item pasti bisa diakses dari luar module."),(0,i.kt)("p",null,"Item yang di-re-export akan menjadi item milik ",(0,i.kt)("em",{parentName:"p"},"current module")," di mana statement re-export tersebut ditulis."),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub use")," digunakan untuk operasi re-export. Notasi penulisannya bisa dilihat di bawah ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"// pub use the_path\npub use self::sub_module::say_hello_message;\n\n// pub use the_path as exported_name;\npub use self::sub_module::say_hello_message as say_hello;\n")),(0,i.kt)("p",null,"Contoh penerapan bisa dilihat pada kode berikut. Submodule ",(0,i.kt)("inlineCode",{parentName:"p"},"sub_module")," milik module ",(0,i.kt)("inlineCode",{parentName:"p"},"messaging")," adalah private module, yang di dalamnya ada item dengan visibility publik."),(0,i.kt)("p",null,"Agar ",(0,i.kt)("inlineCode",{parentName:"p"},"say_hello_message")," tidak bisa diakses dari ",(0,i.kt)("em",{parentName:"p"},"crate root")," karena ",(0,i.kt)("inlineCode",{parentName:"p"},"sub_module")," yang merupakan module scope item tersebut adalah private. Agar item tersebut bisa diakses dari publik, maka bisa dengan menggunakan teknik ",(0,i.kt)("em",{parentName:"p"},"re-export"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/messaging.rs"',title:'"src/messaging.rs"'},'pub use self::sub_module::say_hello_message;\n\nmod sub_module {\n\n pub fn say_hello_message() {\n println!("hello rust")\n }\n}\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"mod messaging;\n\nfn main() {\n messaging::say_hello_message();\n}\n")),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Visibility & Privacy",src:t(2201).Z,width:"466",height:"109"})),(0,i.kt)("p",null,"Bisa dilihat item ",(0,i.kt)("inlineCode",{parentName:"p"},"say_hello_message")," sekarang bisa diakses dari fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," via path ",(0,i.kt)("inlineCode",{parentName:"p"},"messaging::say_hello_message")," setelah di-re-export."),(0,i.kt)("p",null,"O iya, jika suatu item ingin di-re-export dengan nama berbeda, tambahkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"as")," diikuti alias atau nama item export. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/messaging.rs"',title:'"src/messaging.rs"'},'pub use self::sub_module::say_hello_message as say_hello;\n\nmod sub_module {\n\n pub fn say_hello_message() {\n println!("hello rust")\n }\n}\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"mod messaging;\n\nfn main() {\n messaging::say_hello();\n}\n")),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/use"},"github.com/novalagung/dasarpemrogramanrust-example/../use")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.use.html"},"https://doc.rust-lang.org/std/keyword.use.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/items/use-declarations.html"},"https://doc.rust-lang.org/reference/items/use-declarations.html"))))}d.isMDXComponent=!0},9772:(e,a,t)=>{t.d(a,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAzIAAABoCAIAAAClqlJ2AAAACXBIWXMAAA7EAAAOxAGVKw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0i5plyAI0q7Koi/clUQKpuBBwqc+2h0z/GuTYkeaY2FtHlFmwY+gSu2l8DcDHQRBnIl2B2ps/t39q2HNgOxC5nTQbnhLm7/Ohj09j3T757dGu5pDTW+XIIgTBxmGHy9UFjBcTGx52g04OxuAaNKOmbcpLdpF+ZB2CYI4P+3K1Xsp7WbdY4s0tSDDFLkIbyHtEgRxG7SrEmWxt5v8XEC70EUm7RIEcQNBBisg64jthrSYhoadtNtf7PzbtLgoz0wBBEEQZ6DdS3JMoKU1EXqApwn624OTDObpAuyrjrn++f0rfBLgPNVDFwRBEBXSLkEQBEHaJQiCIO0SBEEQpF2CIAjSLkEQBGmXIAiCIO0SBEGQdgmCIAjSLkEQBGmXIAiCIO0SBEGQdgmCIEi7BEEQxCb4HzjE/yVJRbnzAAAAAElFTkSuQmCC"}}]); \ No newline at end of file diff --git a/assets/js/eb2a6637.570a9def.js b/assets/js/eb2a6637.570a9def.js deleted file mode 100644 index 4102ce1a..00000000 --- a/assets/js/eb2a6637.570a9def.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[6388],{3905:(e,a,t)=>{t.d(a,{Zo:()=>s,kt:()=>A});var n=t(7294);function i(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function r(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function l(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?r(Object(t),!0).forEach((function(a){i(e,a,t[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}))}return e}function p(e,a){if(null==e)return{};var t,n,i=function(e,a){if(null==e)return{};var t,n,i={},r=Object.keys(e);for(n=0;n<r.length;n++)t=r[n],a.indexOf(t)>=0||(i[t]=e[t]);return i}(e,a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)t=r[n],a.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var u=n.createContext({}),m=function(e){var a=n.useContext(u),t=a;return e&&(t="function"==typeof e?e(a):l(l({},a),e)),t},s=function(e){var a=m(e.components);return n.createElement(u.Provider,{value:a},e.children)},d={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},k=n.forwardRef((function(e,a){var t=e.components,i=e.mdxType,r=e.originalType,u=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),k=m(t),A=i,o=k["".concat(u,".").concat(A)]||k[A]||d[A]||r;return t?n.createElement(o,l(l({ref:a},s),{},{components:t})):n.createElement(o,l({ref:a},s))}));function A(e,a){var t=arguments,i=a&&a.mdxType;if("string"==typeof e||i){var r=t.length,l=new Array(r);l[0]=k;var p={};for(var u in a)hasOwnProperty.call(a,u)&&(p[u]=a[u]);p.originalType=e,p.mdxType="string"==typeof e?e:i,l[1]=p;for(var m=2;m<r;m++)l[m]=t[m];return n.createElement.apply(null,l)}return n.createElement.apply(null,t)}k.displayName="MDXCreateElement"},164:(e,a,t)=>{t.r(a),t.d(a,{assets:()=>u,contentTitle:()=>l,default:()=>d,frontMatter:()=>r,metadata:()=>p,toc:()=>m});var n=t(7462),i=(t(7294),t(3905));const r={sidebar_position:29,title:"A.29. Module System \u279c Use, Import, Re-export",sidebar_label:"A.29. Module System \u279c Use, Import, Re-export"},l=void 0,p={unversionedId:"basic/use",id:"basic/use",title:"A.29. Module System \u279c Use, Import, Re-export",description:"Keyword use digunakan untuk dua hal, yaitu import path dan re-export path. Sebenarnya kita telah mempelajari kedua penerapan tersebut pada beberapa chapter sebelumnya. Pada chapter ini kita akan ulang lagi pembahasan agar lebih jelas.",source:"@site/docs/basic/use.md",sourceDirName:"basic",slug:"/basic/use",permalink:"/basic/use",draft:!1,tags:[],version:"current",sidebarPosition:29,frontMatter:{sidebar_position:29,title:"A.29. Module System \u279c Use, Import, Re-export",sidebar_label:"A.29. Module System \u279c Use, Import, Re-export"},sidebar:"tutorialSidebar",previous:{title:"A.28. Module System \u279c Visibility & Privacy",permalink:"/basic/visibility-privacy"},next:{title:"A.30. Block Expression",permalink:"/basic/block-expression"}},u={},m=[{value:"A.29.1. Keyword <code>use</code> untuk import path",id:"a291-keyword-use-untuk-import-path",level:2},{value:"\u25c9 Import items dari module yang sama",id:"-import-items-dari-module-yang-sama",level:3},{value:"A.29.2. Keyword <code>use</code> untuk re-export path",id:"a292-keyword-use-untuk-re-export-path",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],s={toc:m};function d(e){let{components:a,...r}=e;return(0,i.kt)("wrapper",(0,n.Z)({},s,r,{components:a,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"use")," digunakan untuk dua hal, yaitu ",(0,i.kt)("em",{parentName:"p"},"import")," path dan ",(0,i.kt)("em",{parentName:"p"},"re-export")," path. Sebenarnya kita telah mempelajari kedua penerapan tersebut pada beberapa chapter sebelumnya. Pada chapter ini kita akan ulang lagi pembahasan agar lebih jelas."),(0,i.kt)("h2",{id:"a291-keyword-use-untuk-import-path"},"A.29.1. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"use")," untuk import path"),(0,i.kt)("p",null,"Untuk bisa menggunakan sebuah item dari crate lain, entah itu dari rust standard library crate maupun 3rd-party, caranya cukup dengan menuliskan path item. Contohnya bisa dilihat di bawah ini, fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"current_dir")," digunakan untuk mengambil path dari current directory. Fungsi tersebut merupakan item dari module ",(0,i.kt)("inlineCode",{parentName:"p"},"std::env"),", maka untuk mengaksesnya kita harus menuliskan path secara lengkap."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let package_path = std::env::current_dir().unwrap();\nprintln!("package_path: {:?}", package_path);\n')),(0,i.kt)("p",null,"Selain cara di atas, bisa juga gunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"use")," untuk meng-import fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"current_dir")," ke kode program, dengannya kita tidak perlu menulis path secara lengkap. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'use std::env::current_dir;\n\nfn main() {\n let package_path = current_dir().unwrap();\n println!("package_path: {:?}", package_path);\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Rust use",src:t(9772).Z,width:"818",height:"104"})),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Di contoh, pengaksesan current directory di-chain dengan method ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap")," karena nilai balik fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"current_dir")," adalah bertipe ",(0,i.kt)("inlineCode",{parentName:"p"},"std::io::Result"),"."),(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai tipe tersebut dibahas pada chapter terpisah, ",(0,i.kt)("a",{parentName:"p",href:"/basic/result-type"},"Tipe Data \u279c Result"))),(0,i.kt)("h3",{id:"-import-items-dari-module-yang-sama"},"\u25c9 Import items dari module yang sama"),(0,i.kt)("p",null,"Pada contoh selanjutnya ini, kita akan coba praktikkan penerapan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"std::env::args")," untuk mengambil ",(0,i.kt)("em",{parentName:"p"},"argument")," saat eksekusi program, kemudian menampilkannya ke layar."),(0,i.kt)("p",null,"Ok, berarti akan ada 2 path yang akan di-import:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"use std::env::current_dir;\nuse std::env::args;\n")),(0,i.kt)("p",null,"Ada notasi penulisan import path lainnya yang bisa digunakan jika path-nya memiliki parent segment yang sama. Contohnya seperti di atas, kedua fungsi tersebut memiliki parent segment path yang sama yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"std::env"),". Yang seperti ini bisa dituliskan juga dengan notasi penulisan import berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"use std::env::{current_dir, args};\n")),(0,i.kt)("p",null,"Ok, lanjut ke praktik. Silakan tulis kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'use std::env::{current_dir, args};\n\nfn main() {\n let package_path = current_dir().unwrap();\n println!("package_path: {:?}", package_path);\n\n for i in 1..=args().len() {\n let each_arg = args().nth(i);\n if each_arg != None {\n println!("arg{}: {:?}", i, each_arg.unwrap());\n }\n }\n}\n')),(0,i.kt)("p",null,"Fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"std::env::args")," digunakan untuk mengambil argument eksekusi program baik eksekusi via ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run")," ataupun via pemanggilan binary. Fungsi tersebut nilai baliknya adalah iterator, jadi bisa digunakan dalam blok kode ",(0,i.kt)("inlineCode",{parentName:"p"},"for in")," dengan mudah."),(0,i.kt)("p",null,"Statement ",(0,i.kt)("inlineCode",{parentName:"p"},"args().nth(i)")," mengembalikan nilai argument pada index ke-",(0,i.kt)("inlineCode",{parentName:"p"},"i")," dalam tipe ",(0,i.kt)("inlineCode",{parentName:"p"},"Option"),", dan nilai tersebut bisa saja tidak ada (direpresentasikan dengan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),"). Oleh karena itu penting untuk dicek terlebih dahulu menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"if"),". Jika memang nilainya adalah selain ",(0,i.kt)("inlineCode",{parentName:"p"},"None"),", gunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"unwrap")," untuk mengambil nilainya dalam tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("ul",{parentName:"blockquote"},(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai Iterator akan dibahas pada chapter terpisah, ",(0,i.kt)("a",{parentName:"li",href:"/basic/trait-iterator"},"Trait \u279c Iterator"),"."),(0,i.kt)("li",{parentName:"ul"},"Lebih jelasnya mengenai tipe ",(0,i.kt)("inlineCode",{parentName:"li"},"Option")," akan dibahas pada chapter terpisah, ",(0,i.kt)("a",{parentName:"li",href:"/basic/option-type"},"Tipe Data \u279c Option"),"."))),(0,i.kt)("p",null,"Silakan coba jalankan menggunakan dua command, yang pertama ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run"),", kemudian ",(0,i.kt)("inlineCode",{parentName:"p"},"cargo run tulis argumen di sini dengan pembatas spasi"),"."),(0,i.kt)("p",null,"Bisa dilihat pada gambar berikut, jika ada argument disisipkan dalam eksekusi program, maka ditampilkan. Pada gambar berikut dicontohkan argument yang dipakai adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"hello")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"world"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Rust use",src:t(4887).Z,width:"793",height:"223"})),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai Iterator dibahas pada chapter terpisah, ",(0,i.kt)("a",{parentName:"p",href:"/basic/trait-iterator"},"Trait \u279c Iterator"))),(0,i.kt)("h2",{id:"a292-keyword-use-untuk-re-export-path"},"A.29.2. Keyword ",(0,i.kt)("inlineCode",{parentName:"h2"},"use")," untuk re-export path"),(0,i.kt)("p",null,"Re-export item adalah sebuah cara untuk mem-",(0,i.kt)("em",{parentName:"p"},"bypass")," pengaksesan item yang secara hirarki memang tidak bisa diakses dari luar module (bisa jadi karena visibility item ataupun parent module nya adalah private). Dengan teknik ini, maka item pasti bisa diakses dari luar module."),(0,i.kt)("p",null,"Item yang di-re-export akan menjadi item milik ",(0,i.kt)("em",{parentName:"p"},"current module")," di mana statement re-export tersebut ditulis."),(0,i.kt)("p",null,"Keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"pub use")," digunakan untuk operasi re-export. Notasi penulisannya bisa dilihat di bawah ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},"// pub use the_path\npub use self::sub_module::say_hello_message;\n\n// pub use the_path as exported_name;\npub use self::sub_module::say_hello_message as say_hello;\n")),(0,i.kt)("p",null,"Contoh penerapan bisa dilihat pada kode berikut. Submodule ",(0,i.kt)("inlineCode",{parentName:"p"},"sub_module")," milik module ",(0,i.kt)("inlineCode",{parentName:"p"},"messaging")," adalah private module, yang di dalamnya ada item dengan visibility publik."),(0,i.kt)("p",null,"Agar ",(0,i.kt)("inlineCode",{parentName:"p"},"say_hello_message")," tidak bisa diakses dari ",(0,i.kt)("em",{parentName:"p"},"crate root")," karena ",(0,i.kt)("inlineCode",{parentName:"p"},"sub_module")," yang merupakan module scope item tersebut adalah private. Agar item tersebut bisa diakses dari publik, maka bisa dengan menggunakan teknik ",(0,i.kt)("em",{parentName:"p"},"re-export"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/messaging.rs"',title:'"src/messaging.rs"'},'pub use self::sub_module::say_hello_message;\n\nmod sub_module {\n\n pub fn say_hello_message() {\n println!("hello rust")\n }\n}\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"mod messaging;\n\nfn main() {\n messaging::say_hello_message();\n}\n")),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Visibility & Privacy",src:t(2201).Z,width:"466",height:"109"})),(0,i.kt)("p",null,"Bisa dilihat item ",(0,i.kt)("inlineCode",{parentName:"p"},"say_hello_message")," sekarang bisa diakses dari fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," via path ",(0,i.kt)("inlineCode",{parentName:"p"},"messaging::say_hello_message")," setelah di-re-export."),(0,i.kt)("p",null,"O iya, jika suatu item ingin di-re-export dengan nama berbeda, tambahkan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"as")," diikuti alias atau nama item export. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/messaging.rs"',title:'"src/messaging.rs"'},'pub use self::sub_module::say_hello_message as say_hello;\n\nmod sub_module {\n\n pub fn say_hello_message() {\n println!("hello rust")\n }\n}\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/main.rs"',title:'"src/main.rs"'},"mod messaging;\n\nfn main() {\n messaging::say_hello();\n}\n")),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/use"},"github.com/novalagung/dasarpemrogramanrust-example/../use")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/std/keyword.use.html"},"https://doc.rust-lang.org/std/keyword.use.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/reference/items/use-declarations.html"},"https://doc.rust-lang.org/reference/items/use-declarations.html"))))}d.isMDXComponent=!0},9772:(e,a,t)=>{t.d(a,{Z:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAzIAAABoCAIAAAClqlJ2AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLn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uTYkeaY2FtHlFmwY+gSu2l8DcDHQRBnIl2B2ps/t39q2HNgOxC5nTQbnhLm7/Ohj09j3T757dGu5pDTW+XIIgTBxmGHy9UFjBcTGx52g04OxuAaNKOmbcpLdpF+ZB2CYI4P+3K1Xsp7WbdY4s0tSDDFLkIbyHtEgRxG7SrEmWxt5v8XEC70EUm7RIEcQNBBisg64jthrSYhoadtNtf7PzbtLgoz0wBBEEQZ6DdS3JMoKU1EXqApwn624OTDObpAuyrjrn++f0rfBLgPNVDFwRBEBXSLkEQBEHaJQiCIO0SBEEQpF2CIAjSLkEQBGmXIAiCIO0SBEGQdgmCIAjSLkEQBGmXIAiCIO0SBEGQdgmCIEi7BEEQxCb4HzjE/yVJRbnzAAAAAElFTkSuQmCC"}}]); \ No newline at end of file diff --git a/assets/js/f8d4e457.b9fffacd.js b/assets/js/f8d4e457.b9fffacd.js deleted file mode 100644 index 3f891e50..00000000 --- a/assets/js/f8d4e457.b9fffacd.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[740],{3905:(a,e,n)=>{n.d(e,{Zo:()=>p,kt:()=>o});var i=n(7294);function t(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function l(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,i)}return n}function r(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){t(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function m(a,e){if(null==a)return{};var n,i,t=function(a,e){if(null==a)return{};var n,i,t={},l=Object.keys(a);for(i=0;i<l.length;i++)n=l[i],e.indexOf(n)>=0||(t[n]=a[n]);return t}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(i=0;i<l.length;i++)n=l[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(t[n]=a[n])}return t}var d=i.createContext({}),u=function(a){var e=i.useContext(d),n=e;return a&&(n="function"==typeof a?a(e):r(r({},e),a)),n},p=function(a){var e=u(a.components);return i.createElement(d.Provider,{value:e},a.children)},s={inlineCode:"code",wrapper:function(a){var e=a.children;return i.createElement(i.Fragment,{},e)}},k=i.forwardRef((function(a,e){var n=a.components,t=a.mdxType,l=a.originalType,d=a.parentName,p=m(a,["components","mdxType","originalType","parentName"]),k=u(n),o=t,g=k["".concat(d,".").concat(o)]||k[o]||s[o]||l;return n?i.createElement(g,r(r({ref:e},p),{},{components:n})):i.createElement(g,r({ref:e},p))}));function o(a,e){var n=arguments,t=e&&e.mdxType;if("string"==typeof a||t){var l=n.length,r=new Array(l);r[0]=k;var m={};for(var d in e)hasOwnProperty.call(e,d)&&(m[d]=e[d]);m.originalType=a,m.mdxType="string"==typeof a?a:t,r[1]=m;for(var u=2;u<l;u++)r[u]=n[u];return i.createElement.apply(null,r)}return i.createElement.apply(null,n)}k.displayName="MDXCreateElement"},8514:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>d,contentTitle:()=>r,default:()=>s,frontMatter:()=>l,metadata:()=>m,toc:()=>u});var i=n(7462),t=(n(7294),n(3905));const l={sidebar_position:44,title:"A.44. Lifetime",sidebar_label:"A.44. Lifetime"},r=void 0,m={unversionedId:"basic/lifetime",id:"basic/lifetime",title:"A.44. Lifetime",description:"Pada chapter ini kita akan belajar tentang lifetime. Lifetime adalah yang digunakan oleh Rust compiler untuk memonitor umur dari references agar tetap dianggap valid.",source:"@site/docs/basic/lifetime.md",sourceDirName:"basic",slug:"/basic/lifetime",permalink:"/basic/lifetime",draft:!1,tags:[],version:"current",sidebarPosition:44,frontMatter:{sidebar_position:44,title:"A.44. Lifetime",sidebar_label:"A.44. Lifetime"},sidebar:"tutorialSidebar",previous:{title:"A.43. Static Item",permalink:"/basic/static"},next:{title:"A.45. Slice Memory Management",permalink:"/basic/slice-memory-management"}},d={},u=[{value:"A.44.1. Konsep Lifetime",id:"a441-konsep-lifetime",level:2},{value:"A.44.2. Relasi antara lifetime dengan owner dan borrower",id:"a442-relasi-antara-lifetime-dengan-owner-dan-borrower",level:2},{value:"A.44.3. Lifetime annotation dan penerapannya pada return value",id:"a443-lifetime-annotation-dan-penerapannya-pada-return-value",level:2},{value:"A.44.4. Lifetime pada parameter",id:"a444-lifetime-pada-parameter",level:2},{value:"A.44.5. Lifetime elision",id:"a445-lifetime-elision",level:2},{value:"A.44.6. Lifetime pada struct",id:"a446-lifetime-pada-struct",level:2},{value:"A.44.7. Lifetime pada method",id:"a447-lifetime-pada-method",level:2},{value:"A.44.8. Generic parameter + trait bounds + lifetime",id:"a448-generic-parameter--trait-bounds--lifetime",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],p={toc:u};function s(a){let{components:e,...l}=a;return(0,t.kt)("wrapper",(0,i.Z)({},p,l,{components:e,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Pada chapter ini kita akan belajar tentang lifetime. Lifetime adalah yang digunakan oleh Rust compiler untuk memonitor umur dari references agar tetap dianggap valid."),(0,t.kt)("p",null,"Normalnya kita tidak perlu berurusan dengan lifetime, karena Rust-lah yang mengelola lifetime sebuah reference. Namun di luar itu, pada beberapa case kita bisa me-manage lifetime data dengan memanfaatkan ",(0,t.kt)("em",{parentName:"p"},"annotation"),"."),(0,t.kt)("p",null,"Ketika berurusan dengan data primitif maupun non-primitif tak perlu khawatir perihal urusan lifetime. Aspek lifetime hanya perlu diperhatikan sewaktu berurusan dengan data pointer/reference, apalagi kalau data tersebut keluar masuk block scope."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Topik lifetime adalah salah satu yang paling membingungkan di Rust. Wajar jika membutuhkan waktu lebih lama untuk menguasainya. ",(0,t.kt)("em",{parentName:"p"},"Take your time"),", pelajari pelan-pelan dan ulangi berkali-kali jika perlu.")),(0,t.kt)("h2",{id:"a441-konsep-lifetime"},"A.44.1. Konsep Lifetime"),(0,t.kt)("p",null,"Lifetime adalah yang digunakan oleh Rust compiler untuk memonitor umur dari references agar tetap valid. Lifetime menempel di variabel, lebih tepatnya di reference variabel."),(0,t.kt)("p",null,"Rust menerapkan default lifetime dalam pengecekan reference. Beberapa aturan pada default lifetime sudah kita pelajari pada chapter sebelumnya, seperti variabel yang hanya akan valid di dalam block dan invalid di luar block dan data yang akan di-dealokasi ketika sudah tidak ada reference-nya."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Rust mengidentifikasi default lifetime menggunakan ",(0,t.kt)("strong",{parentName:"p"},"lifetime elision"),", yang juga akan dibahas pada chapter ini.")),(0,t.kt)("p",null,"Agar mudah memahami konsep default lifetime, mari mulai dengan kode sederhana berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let r;\n {\n let x = 5;\n r = &x;\n }\n println!("r: {}", r);\n}\n')),(0,t.kt)("p",null,"Kode di atas kalau di jalankan hasilnya error, karena ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," di-dealokasi ketika block expression selesai dieksekusi, meskipun data tersebut dipinjamkan pada ",(0,t.kt)("inlineCode",{parentName:"p"},"r")," yang scope-nya berada di atasnya."),(0,t.kt)("p",null,"Kalau diilustrasikan, lifetime variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"r")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," kurang lebih seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn main() {\n let r; // -----------+-- 'lf1\n { // |\n let x = 5; // -+-- 'lf2 |\n r = &x; // | |\n } // -+ |\n println!(\"r: {}\", r); // |\n} // -----------+\n")),(0,t.kt)("p",null,"Setiap data memiliki default lifetime."),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Variabel ",(0,t.kt)("inlineCode",{parentName:"li"},"r")," memiliki lifetime yang pada contoh di atas diilustrasikan sebagai ",(0,t.kt)("inlineCode",{parentName:"li"},"'lf1"),"."),(0,t.kt)("li",{parentName:"ul"},"Variabel ",(0,t.kt)("inlineCode",{parentName:"li"},"x")," memiliki lifetime yang pada contoh di atas diilustrasikan sebagai ",(0,t.kt)("inlineCode",{parentName:"li"},"'lf2"),"."),(0,t.kt)("li",{parentName:"ul"},"Lifetime ",(0,t.kt)("inlineCode",{parentName:"li"},"'lf2")," milik variabel ",(0,t.kt)("inlineCode",{parentName:"li"},"x")," menjadikan umur variabel tersebut valid mulai variabel tersebut dideklarasikan, hingga block expression selesai."),(0,t.kt)("li",{parentName:"ul"},"Lifetime ",(0,t.kt)("inlineCode",{parentName:"li"},"'lf2")," sudah tidak valid di luar block expression. Inilah kenapa program di atas menjadi error."),(0,t.kt)("li",{parentName:"ul"},"Lifetime ",(0,t.kt)("inlineCode",{parentName:"li"},"'lf1")," milik variabel ",(0,t.kt)("inlineCode",{parentName:"li"},"r")," menjadikan umur variabel tersebut valid mulai variabel tersebut dideklarasikan, hingga block fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"main")," selesai.")),(0,t.kt)("p",null,"Default lifetime bisa di-override menggunakan lifetime yang kita definisikan sendiri."),(0,t.kt)("h2",{id:"a442-relasi-antara-lifetime-dengan-owner-dan-borrower"},"A.44.2. Relasi antara lifetime dengan owner dan borrower"),(0,t.kt)("p",null,"Lifetime menjadi salah satu hal yang wajib diperhatikan ketika bermain dengan references. Operasi seperti melempar reference ke luar scope, atau memasukan reference ke block scope baru berpotensi memunculkan error yang berhubungan dengan lifetime."),(0,t.kt)("p",null,"Setelah ini kita akan praktik penerapan pembuatan lifetime, namun sebelum itu mari pelajari dulu pembahasan pada section berikut agar tau kenapa dan kapan kita harus menerapkan lifetime yang kita buat sendiri."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let message = String::from("darkspear is better than zandalari");\n print_mesage(&message)\n}\n\nfn print_mesage(m: &String) {\n println!("the message: {m}")\n}\n')),(0,t.kt)("p",null,"Program di atas menampilkan pesan string via fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"print_message"),". Data string didapat dari parameter pointer ",(0,t.kt)("inlineCode",{parentName:"p"},"m")," milik fungsi tersebut."),(0,t.kt)("p",null,"Pada fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),", ada string bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"message"),", niainya dipinjamkan sebagai argument pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"print_message"),"."),(0,t.kt)("p",null,"Setelah eksekusi fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"print_message")," selesai, yang terjadi di block kode fungsi tersebut adalah data ",(0,t.kt)("inlineCode",{parentName:"p"},"m")," di-dealokasi. Hasil dari dealokasi sendiri adalah nilai sebenarnya dikembalikan ke owner (pemilik aslinya). Sampai sini harusnya cukup jelas."),(0,t.kt)("p",null,"Sekarang lanjut ke contoh ke-2 berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let m: &String = get_message();\n println!("the message: {m}");\n}\n\nfn get_message() -> &String {\n let message = String::from("darkspear is better than zandalari");\n &message\n}\n')),(0,t.kt)("p",null,"Esensi program ke-2 ini sama seperti program sebelumnya, yaitu menampilkan pesan string yang sama persis. Perbedaannya, pesan string datanya ada di dalam fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"get_message"),". Fungsi tersebut dipanggil kemudian reference dari pesan string dipinjamkan, maka dengan ini variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"m")," pada fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main")," nilainya adalah data pinjaman (borrowing)."),(0,t.kt)("p",null,"Ketika di-run, hasilnya error."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Lifetime",src:n(8116).Z,width:"779",height:"275"})),(0,t.kt)("p",null,"Error tersebut muncul karena setelah eksekusi fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"get_message")," selesai, semua data dalam fungsi tersebut di-dealokasi. Termasuk variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"message")," yang merupakan owner dari data yang dipinjamkan ke variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"m"),"."),(0,t.kt)("p",null,"Ok, jadi owner-nya sudah di-dealokasi, lalu bagaimana nasib dari peminjam data (variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"m"),")? Variabel tersebut menjadi bermasalah, karena owner data aslinya sudah tidak ada di memory, dan itulah kenapa muncul error."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Error ini disebut dengan ",(0,t.kt)("strong",{parentName:"p"},"dangling reference"),", muncul ketika data di-share ke variabel lain tapi owner-nya sudah tidak ada di-memory."),(0,t.kt)("p",{parentName:"blockquote"},"Di pemrograman Rust, error jenis ini bisa di-identifikasi saat kompilasi.")),(0,t.kt)("p",null,"Solusi pada error di atas, salah satunya adalah dengan tidak menggunakan tipe data pointer sebagai nilai balik. Gunakan saja tipe data ",(0,t.kt)("inlineCode",{parentName:"p"},"String"),". Solusi ini aman, karena tipe data ",(0,t.kt)("inlineCode",{parentName:"p"},"String")," owner-nya selalu berpindah saat ada operasi asignment, dengan ini maka manajemen memory menjadi efisien."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'// ganti kode berikut ...\nfn get_message() -> &String {\n let message = String::from("darkspear is better than zandalari");\n message\n}\n\n// ... menjadi ...\nfn get_message() -> String {\n let message = String::from("darkspear is better than zandalari");\n message\n}\n')),(0,t.kt)("p",null,"Ok, bagaimana dengan tipe data lain yang mengadopsi ",(0,t.kt)("em",{parentName:"p"},"copy semantics"),", misalnya ada kebutuhan untuk share reference data tersebut ke block lain. Mari kita coba."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let n = get_number();\n println!("the number: {n}");\n}\n\nfn get_number() -> &i32 {\n let number = 13;\n &number\n}\n')),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Lifetime",src:n(5384).Z,width:"782",height:"276"})),(0,t.kt)("p",null,"Bisa dilihat, ada error, karena kondisi tersebut menimbulkan dangling reference (sama seperti contoh sebelumnya). Namun pada contoh ini kita tidak bisa menerapkan solusi yang sama, karena variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"number")," mengadopsi ",(0,t.kt)("em",{parentName:"p"},"copy semantics"),", bukan ",(0,t.kt)("em",{parentName:"p"},"move semantics"),"."),(0,t.kt)("p",null,"Di Rust error dangling reference diantisipasi saat kompilasi, menjadikan kode tidak bisa sukses dikompilasi."),(0,t.kt)("p",null,"Solusi yang bisa diambil adalah dengan menjadikan data tersebut tidak memiliki owner (atau owner-nya adalah program), caranya dengan langsung mengembalikan reference data tanpa perlu menampungnya terlebih dahulu ke variabel, seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let n = get_number();\n println!("the number: {n}");\n}\n\nfn get_number() -> &i32 {\n &13\n}\n')),(0,t.kt)("p",null,"Ok, tapi entah kenapa ketika dilihat masih muncul error."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Lifetime",src:n(6875).Z,width:"777",height:"260"})),(0,t.kt)("p",null,"Error tersebut muncul karena meskipun owner data ",(0,t.kt)("inlineCode",{parentName:"p"},"&13")," adalah program, ketika eksekusi fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"get_number")," selesai, data borrow tersebut langsung di-dealokasi, dan tidak ada variabel lain di-luar scope yang menampung reference data tersebut."),(0,t.kt)("p",null,"Agar tidak terjadi proses dealokasi, harus ada variabel yang menampung reference tersebut di-luar scope, tapi cara ini tidak bisa dilakukan karena data-nya saja baru dideklarasikan dalam block fungsi, tidak mungkin tiba-tiba ada yang menampung di-luar scope."),(0,t.kt)("p",null,"Solusi dari masalah ini adalah menggunakan lifetime ",(0,t.kt)("inlineCode",{parentName:"p"},"'static")," (yang detailnya sudah dibahas pada chapter sebelumnya). Dengan ini maka data reference ",(0,t.kt)("inlineCode",{parentName:"p"},"&13")," hidup lebih lama dari umur yang sebenarnya sudah ditakdirkan untuk data data tersebut."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn get_number() -> &'static i32 {\n &13\n}\n")),(0,t.kt)("p",null,"Namun perlu diingat, bahwa data efek dari lifetime ",(0,t.kt)("inlineCode",{parentName:"p"},"'static")," adalah data tidak akan pernah di-dealokasi. Data tersebut akan hidup selamanya di program hingga kecuali program dimatikan. Karena alasan itulah penggunaan ",(0,t.kt)("inlineCode",{parentName:"p"},"'static")," pada contoh ini bisa disebut berlebihan."),(0,t.kt)("p",null,"Solusi yang lebih pas adalah dengan membuat lifetime sendiri dengan cara menerapkan ",(0,t.kt)("strong",{parentName:"p"},"lifetime annotation")," (tidak menggunakan lifetime ",(0,t.kt)("inlineCode",{parentName:"p"},"'static"),")."),(0,t.kt)("h2",{id:"a443-lifetime-annotation-dan-penerapannya-pada-return-value"},"A.44.3. Lifetime annotation dan penerapannya pada return value"),(0,t.kt)("p",null,"Lifetime dituliskan dengan notasi ",(0,t.kt)("inlineCode",{parentName:"p"},"'nama_lifetime"),". Dengan notasi tersebut, kita bisa menciptakan lifetime baru misalnya ",(0,t.kt)("inlineCode",{parentName:"p"},"'a"),", ",(0,t.kt)("inlineCode",{parentName:"p"},"'b"),", ",(0,t.kt)("inlineCode",{parentName:"p"},"'ini_lifetime"),", dst."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"&i32 // => tipe data reference i32\n&'a i32 // => tipe data reference i32 dengan lifetime 'a\n&'a mut i32 // => tipe data mutable reference i32 dengan lifetime 'a\n")),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Lifetime dan block label memiliki bentuk literal yang sama, keduanya diawali tanda kutip ",(0,t.kt)("inlineCode",{parentName:"p"},"'"),". Yang membedakan hanya pada tempat di mana syntax tersebut ditulis.")),(0,t.kt)("p",null,"Kegunaan dari lifetime annotation adalah untuk menginformasikan compiler agar reference tidak langsung didealokasikan setelah eksekusi block selesai. Agar lebih jelas mari kita langsung terapkan saja pada fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"get_number")," yang sudah ditulis. Silakan tambahkan lifetime dengan nama bebas. Di sini penulis gunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"'my_lifetime"),".nnnn"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn get_number() -> &'my_lifetime i32 {\n &13\n}\n")),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Lifetime",src:n(4982).Z,width:"689",height:"184"})),(0,t.kt)("p",null,"Meski sudah ditambahkan, error tetap muncul, karena lifetime tersebut tidak dikenal. Berbeda dengan lifetime ",(0,t.kt)("inlineCode",{parentName:"p"},"'static")," yang memang sudah disediakan oleh Rust."),(0,t.kt)("p",null,"Step selanjutnya adalah mengenalkan lifetime tersebut, caranya dengan menambahkannya dalam notasi parameter generic fungsi, seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn get_number<'my_lifetime>() -> &'my_lifetime i32 {\n &13\n}\n")),(0,t.kt)("p",null,"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"get_number")," sekarang tidak menghasilkan error, karena reference yang dikembalikan memiliki umur ",(0,t.kt)("inlineCode",{parentName:"p"},"'my_lifetime")," yang membuatnya tetap valid sampai menjadi return value, meski eksekusi block fungsi-nya sendiri sudah selesai. Efeknya, data yang di-return bisa ditampung di luar scope fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"get_number"),"."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Lifetime",src:n(4734).Z,width:"460",height:"104"})),(0,t.kt)("p",null,"Tanpa adanya lifetime pada return value, maka data return value akan langsung di-dealokasi setelah block fungsi selesai dieksekusi. Tapi karena hal ini ",(0,t.kt)("em",{parentName:"p"},"by default")," sudah di-handle Rust, maka kita tidak perlu memikirkannya."),(0,t.kt)("h2",{id:"a444-lifetime-pada-parameter"},"A.44.4. Lifetime pada parameter"),(0,t.kt)("p",null,"Pada praktik ini kita akan bahas penerapan lifetime pada parameter."),(0,t.kt)("p",null,"Silakan perhatikan kode berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something_v1(x: &str) -> &str {\n x\n}\n")),(0,t.kt)("p",null,"Kode di atas tidak menghasilkan error, karena kalau dilihat dari sudut pandang lifetime (sesuai dengan aturan lifetime elision), yang sebenarnya terjadi adalah kurang lebih seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something_v2<'a>(x: &'a str) -> &'a str {\n x\n}\n")),(0,t.kt)("p",null,"Pada saat parameter ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," masuk ke fungsi, ",(0,t.kt)("em",{parentName:"p"},"by default")," variabel tersebut memiliki lifetime (yang pada contoh di atas diilustrasikan dengan `'a'). Lifetime tersebut akan aktif hingga menjadi return value karena lifetime yang sama digunakan juga pada return value. Dengan ini nantinya setelah fungsi selesai dieksekusi, nilai baliknya tetap bisa ditampung."),(0,t.kt)("p",null,"Beda lagi jika lifetime lain digunakan pada nilai balik fungsi, misalnya:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something_v3<'a, 'b>(x: &'a str) -> &'b str {\n x\n}\n")),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Lifetime",src:n(5109).Z,width:"736",height:"204"})),(0,t.kt)("p",null,"Error muncul dengan keterangan kurang lebih: data yang dijadikan return value pada block fungsi akan valid untuk lifetime ",(0,t.kt)("inlineCode",{parentName:"p"},"'b"),", namun data yang dijadikan return value hanya valid untuk lifetime ",(0,t.kt)("inlineCode",{parentName:"p"},"'a"),"."),(0,t.kt)("p",null,"Dari sini bisa ditarik kesimpulan: data yang didapat dari luar scope (yang memiliki lifetime sendiri) ketika digunakan sebagai nilai balik, lifetime-nya harus sama."),(0,t.kt)("p",null,"Sekarang mari kita modifikasi lagi fungsi menjadi seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something_v4<'a, 'b, 'c>(x: &'a str, y: &'b str) -> &'c str {\n \"hello\"\n}\n")),(0,t.kt)("p",null,"Fungsi di atas memiliki 2 buah lifetime, yaitu:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Lifetime ",(0,t.kt)("inlineCode",{parentName:"li"},"'a"),", digunakan pada parameter ",(0,t.kt)("inlineCode",{parentName:"li"},"x")),(0,t.kt)("li",{parentName:"ul"},"Lifetime ",(0,t.kt)("inlineCode",{parentName:"li"},"'b"),", digunakan pada parameter ",(0,t.kt)("inlineCode",{parentName:"li"},"y")),(0,t.kt)("li",{parentName:"ul"},"Lifetime ",(0,t.kt)("inlineCode",{parentName:"li"},"'c"),", digunakan pada return value")),(0,t.kt)("p",null,"Karena yang dikembalikan ada data baru, yaitu string ",(0,t.kt)("inlineCode",{parentName:"p"},"hello"),", maka kode di atas tidak error. Data tersebut lifetime-nya adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"'c"),", dan akan tetap valid setelah pemanggilan fungsi selesai."),(0,t.kt)("p",null,"Beda situasi jika yang dikembalikan adalah data dari parameter, misalnya, ",(0,t.kt)("inlineCode",{parentName:"p"},"x"),". Jika seperti ini, maka lifetime yang sama dengan lifetime parameter ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," harus digunakan, yaitu lifetime ",(0,t.kt)("inlineCode",{parentName:"p"},"'b"),". Contoh:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something_v5<'a, 'b, 'c>(x: &'a str, y: &'b str) -> &'b str {\n y\n}\n")),(0,t.kt)("p",null,"Pada kode di atas, lifetime ",(0,t.kt)("inlineCode",{parentName:"p"},"'c")," tidak dipergunakan sama sekali, maka lifetime tersebut boleh dihapus dari fungsi. Silakan cukup definisikan lifetime yang hanya digunakan saja pada block parameter generic."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something_v6<'a, 'b>(x: &'a str, y: &'b str) -> &'b str {\n y\n}\n")),(0,t.kt)("p",null,"Dimisalkan ada seleksi kondisi, jadi return value bisa saja ",(0,t.kt)("inlineCode",{parentName:"p"},"x"),", bisa juga ",(0,t.kt)("inlineCode",{parentName:"p"},"y"),". Jika seperti ini, maka ",(0,t.kt)("inlineCode",{parentName:"p"},"x"),", ",(0,t.kt)("inlineCode",{parentName:"p"},"y"),", dan juga return value harus memiliki lifetime yang sama."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something_v7<'a>(x: &'a str, y: &'a str) -> &'a str {\n if x.len() < y.len() {\n x\n } else {\n y\n }\n}\n")),(0,t.kt)("h2",{id:"a445-lifetime-elision"},"A.44.5. Lifetime elision"),(0,t.kt)("p",null,"Sampai section ini kita telah mempelajari kurang lebih 4 point berikut:"),(0,t.kt)("ol",null,(0,t.kt)("li",{parentName:"ol"},"Setiap data, lebih tepatnya setiap reference memiliki lifetime."),(0,t.kt)("li",{parentName:"ol"},"Lifetime digunakan oleh Rust dalam penentuan kapan reference tersebut di-dealokasi."),(0,t.kt)("li",{parentName:"ol"},"Pada beberapa case, lifetime perlu di-urus secara eksplisit (contohnya seperti pada fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"do_something_vx")," di atas)."),(0,t.kt)("li",{parentName:"ol"},"Pengecekan lifetime terjadi saat kompilasi.")),(0,t.kt)("p",null,"Rust memiliki sesuatu yang disebut dengan ",(0,t.kt)("strong",{parentName:"p"},"lifetime elision"),", isinya adalah aturan yang digunakan oleh Rust dalam menganalisa reference untuk menentukan lifetime ",(0,t.kt)("em",{parentName:"p"},"default"),"-nya."),(0,t.kt)("p",null,"Namun, bukan berarti Rust akan selalu tau lifetime tiap reference. Pada beberapa case, Rust membutuhkan bantuan kita selaku programmer untuk menginformasikan lifetime reference kode yang ditulis, contohnya seperti pada fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something_v7")," di atas."),(0,t.kt)("p",null,"Meskipun demikian, tak usah terlalu khawatir, karena pengecekan lifetime reference terjadi saat kompilasi, dan ketika ada reference yang perlu dikasih ",(0,t.kt)("em",{parentName:"p"},"annotication"),", Rust akan menginformasikan ke kita via pesan error."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Untuk sekarang, pembahasan detail mengenai lifetime elision tidak dibahas pada ebook ini. Silakan gunakan dokumentasi official Rust untuk ",(0,t.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/nomicon/lifetime-elision.html"},"lifetime elision")," jika berminat untuk pengkajian yang lebih dalam.")),(0,t.kt)("p",null,"Jika kawan-kawan menggunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"rust-analyzer")," extension di VSCode, tak perlu meng-compiler program untuk memunculkan error-nya, karena langsung muncul saat penulisan kode program."),(0,t.kt)("h2",{id:"a446-lifetime-pada-struct"},"A.44.6. Lifetime pada struct"),(0,t.kt)("p",null,"Tak hanya pada parameter fungsi dan return value fungsi, lifetime juga bisa diterapkan pada (property) struct."),(0,t.kt)("p",null,"Ketika menggunakan tipe data reference sebagai tipe property struct, Rust langsung menginformasikan kita via error message jika tidak ada anotasi lifetime pada field tersebut."),(0,t.kt)("p",null,"Contohnya bisa dilihat pada kode di bawah ini. Pesan error muncul karena tipe data ",(0,t.kt)("inlineCode",{parentName:"p"},"&str")," pada property struct tidak ada lifetime annotation-nya."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"struct Book {\n title: &str,\n}\n")),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Lifetime",src:n(7106).Z,width:"725",height:"160"})),(0,t.kt)("p",null,"Solusinya, tambahkan anotasi lifetime pada tipe data ",(0,t.kt)("inlineCode",{parentName:"p"},"&str"),", dan juga daftarkan lifetime tersebut pada struct. Notasi penulisannya seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"// struct NamaStruct<'lifetime_annotication> {\n// field: &'lifetime_annotication tipe_data,\n// }\n\nstruct Book<'abc> {\n title: &'abc str,\n}\n")),(0,t.kt)("p",null,"Contoh jika ada lebih dari 1 field dengan lifetime sama:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"struct Book<'abc> {\n title: &'abc str,\n description: &'abc str,\n}\n")),(0,t.kt)("p",null,"Contoh jika ada beberapa field yang di antaranya memiliki lifetime berbeda (artinya ada lebih dari 1 lifetime):"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"struct Book<'abc, 'def> {\n title: &'abc str,\n description: &'abc str,\n price: &'def i32,\n}\n\nfn main() {\n let book = Book {\n title: \"The Silmarillion\",\n description: \"Good story, 10/10, would read again\",\n price: &99,\n };\n}\n")),(0,t.kt)("h2",{id:"a447-lifetime-pada-method"},"A.44.7. Lifetime pada method"),(0,t.kt)("p",null,"Ada 2 hal yang perlu diketahui dalam penerapan lifetime pada method. Yang pertama, lifetime annotication harus ditulis pada block ",(0,t.kt)("inlineCode",{parentName:"p"},"impl")," meskipun pada block method tidak digunakan secara langsung."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"struct Book<'abc, 'def> {\n title: &'abc str,\n description: &'abc str,\n price: &'def i32,\n}\n\nimpl<'abc, 'def> Book<'abc, 'def> {\n\n fn get_info(&self) -> String {\n let info = format!(\"{} (${}), {}\", self.title, self.price, self.description);\n info\n }\n}\n")),(0,t.kt)("p",null,"Bisa dilihat statement block ",(0,t.kt)("inlineCode",{parentName:"p"},"impl<'abc, 'def> Book<'abc, 'def>"),", lifetime annotation-nya sama persis dengan yang ada di struct. Jika ingin mengetes, silakan coba saja hapus syntax lifetime dari statement itu, pasti muncul error."),(0,t.kt)("p",null,"Hal ke-2 yang penting diketahui, pada block kode method, tidak perlu menuliskan lifetime annotation, karena sudah ditulis di block kode ",(0,t.kt)("inlineCode",{parentName:"p"},"impl"),"."),(0,t.kt)("p",null,"Sebagai contoh, dua method berikut tidak memunculkan error:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"// ...\n\nimpl<'abc, 'def> Book<'abc, 'def> {\n\n fn get_info(&self) -> String {\n let info = format!(\"{} (${}), {}\", self.title, self.price, self.description);\n info\n }\n\n fn get_price(&self) -> &i32 {\n self.price\n }\n}\n")),(0,t.kt)("p",null,"Bandingkan dengan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"get_book_price")," berikut, error muncul karena lifetime annotation tidak ditambahkan ke block fungsi (meskipun fungsi tersebut mengembalikan property ",(0,t.kt)("inlineCode",{parentName:"p"},"price")," milik struct ",(0,t.kt)("inlineCode",{parentName:"p"},"Book")," yang sudah memiliki lifetime sendiri). Hal ini karena data ",(0,t.kt)("inlineCode",{parentName:"p"},"&i32")," yang dikembalikan statement ",(0,t.kt)("inlineCode",{parentName:"p"},"book.get_price()")," langsung didealokasi setelah block fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"get_book_price")," selesai dieksekusi."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Lifetime",src:n(378).Z,width:"813",height:"223"})),(0,t.kt)("p",null,"Agar error tidak muncul, tambahkan lifetime:"),(0,t.kt)("ol",null,(0,t.kt)("li",{parentName:"ol"},"ke return value (karena tipe data return value adalah reference)"),(0,t.kt)("li",{parentName:"ol"},"lalu pada parameter ",(0,t.kt)("inlineCode",{parentName:"li"},"book")," (karena di block fungsi return value berasal dari data milik property variabel ",(0,t.kt)("inlineCode",{parentName:"li"},"book"),"),"),(0,t.kt)("li",{parentName:"ol"},"dan juga tak lupa daftarkan lifetime annotation pada block fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"get_book_price"),".")),(0,t.kt)("p",null,"Kurang kode menjadi seperti berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'// ...\n\nfn get_book_price<\'ghi>(book: &\'ghi Book) -> &\'ghi i32 {\n book.get_price()\n}\n\nfn main() {\n let book = Book {\n title: "The Silmarillion",\n description: "Good story, 10/10, would read again",\n price: &99,\n };\n\n println!("{}", book.get_info());\n println!("the price: {}", get_book_price(&book));\n}\n')),(0,t.kt)("p",null,"Run program, hasilnya sukses."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Lifetime",src:n(7146).Z,width:"473",height:"127"})),(0,t.kt)("h2",{id:"a448-generic-parameter--trait-bounds--lifetime"},"A.44.8. Generic parameter + trait bounds + lifetime"),(0,t.kt)("p",null,"Lalu bagaimana jika ada fungsi yang di situ ada penerapan trait bounds, ada juga generic parameter, dan lifetime annotation. Cara penulisannya seperti apa? Silakan lihat contoh berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn find_greater_number<'a, T>(\n x: &'a T,\n y: &'a T,\n) -> &'a T\nwhere\n T: std::cmp::PartialOrd,\n{\n if x > y {\n x\n } else {\n y\n }\n}\n")),(0,t.kt)("p",null,"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"find_greater_number")," di atas digunakan untuk mencari angka terbesar dari dua inputan parameter (",(0,t.kt)("inlineCode",{parentName:"p"},"x")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"y"),"), dengan tipe data yang digunakan adalah generic ",(0,t.kt)("inlineCode",{parentName:"p"},"T"),". Dari sini maka nantinya fungsi ini bisa digunakan pada data bertipe ",(0,t.kt)("inlineCode",{parentName:"p"},"i32"),", ",(0,t.kt)("inlineCode",{parentName:"p"},"f64"),", dan data numerik lainnya."),(0,t.kt)("p",null,"Tipe ",(0,t.kt)("inlineCode",{parentName:"p"},"T")," diasosiasikan dengan trait ",(0,t.kt)("inlineCode",{parentName:"p"},"std::cmp::PartialOrd")," agar variabel dengan tipe tersebut bisa digunakan dalam seleksi kondisi ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," yang ada dalam block fungsi tersebut."),(0,t.kt)("p",null,"Ok, sampai sini semoga cukup jelas. Lalu bagaimana dengan lifetime annotation-nya? Karena lifetime annotation definisinya berada pada tempat yang sama dengan definisi tipe generic, maka langsung saja tulis di situ tanpa memperhatikan urutan. Sebagai contoh, dua definisi block fungsi berikut adalah ekuivalen."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn say_hello_v1<'abc, T>()\nfn say_hello_v2<T, 'abc>()\n")),(0,t.kt)("p",null,"Sekarang kembali ke pembahasan di atas. Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"find_greater_number")," mengembalikan tipe data reference ",(0,t.kt)("inlineCode",{parentName:"p"},"&T")," yang nilainya bisa saja dari ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," atau ",(0,t.kt)("inlineCode",{parentName:"p"},"y"),". Dari sini maka wajib hukumnya untuk return value memiliki lifetime yang sama dengan ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"y"),". Itulah kenapa definisi fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"find_greater_number")," agak panjang."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn find_greater_number<'a, T>(x: &'a T, y: &'a T) -> &'a T\n")),(0,t.kt)("p",null,"Lanjut, mari kita panggil fungsi tersebut pada dua block expression. Block pertama untuk pengecekan data numerik ",(0,t.kt)("inlineCode",{parentName:"p"},"i32"),", dan yang kedua untuk tipe ",(0,t.kt)("inlineCode",{parentName:"p"},"f64"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n\n {\n // i32 comparison test\n let x = 13;\n let y = 20;\n let result = find_greater_number::<i32>(&x, &y); // atau cukup `find_greater_number(&x, &y)`\n println!("result: {}", result);\n }\n \n {\n // f64 comparison test\n let x = 3.14;\n let y = 2.11;\n let result = find_greater_number::<f64>(&x, &y); // atau cukup `find_greater_number(&x, &y)`\n println!("result: {}", result);\n }\n}\n')),(0,t.kt)("p",null,"Jalankan program, hasilnya sesuai harapan, tidak ada error."),(0,t.kt)("p",null,(0,t.kt)("img",{alt:"Lifetime",src:n(757).Z,width:"1072",height:"200"})),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/lifetime"},"github.com/novalagung/dasarpemrogramanrust-example/../lifetime")),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html"},"https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/nomicon/lifetimes.html"},"https://doc.rust-lang.org/nomicon/lifetimes.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://dev.to/takaakifuruse/rust-lifetimes-a-high-wall-for-rust-newbies-3ap"},"https://dev.to/takaakifuruse/rust-lifetimes-a-high-wall-for-rust-newbies-3ap")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://anooppoommen.medium.com/lifetimes-in-rust-7f2331be998b"},"https://anooppoommen.medium.com/lifetimes-in-rust-7f2331be998b")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://blog.logrocket.com/understanding-lifetimes-in-rust/"},"https://blog.logrocket.com/understanding-lifetimes-in-rust/")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://educative.io/answers/what-are-generic-lifetime-parameters-in-a-rust-function"},"https://educative.io/answers/what-are-generic-lifetime-parameters-in-a-rust-function"))))}s.isMDXComponent=!0},8116:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/lifetime-1-49980dd171b372c65a19ab2c8bd2334f.png"},5384:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/lifetime-2-1116463c388b09c1a8822e3b1ff4682c.png"},6875:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/lifetime-3-d0688570ad7d667d603cde8665c863fc.png"},4982:(a,e,n)=>{n.d(e,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAArEAAAC4CAIAAAB7KCObAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1s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8UOBKWV9r4o+zJ3Q+vc04ihBCCP+bIH+Julzpj0dy3oty90jxtrJpSWmRQvPUdhXjtDJt/WqU97pZTUK/VCCJvfonuZ6lmm8b3v+i6/qFp887PX+KkRAghBH/Mkz8WV/N4/vr523fIfyCEEII/4I958cdLt/+b4gtCCCH4A/7wdfTQYxY4rj7+7S+/973Pv/OsXcIJhBBCCMEfs5JhDgMcBj7+99nvfvvIyTeffNou4QRCCCGE4I9ZyQKHsYEPmwixSziBEEIIoRnyB0IIIYQQ/IEQQggh+AMhhBBCCP5ACCGE0NLzx/Xbf3f/zw/c/5+v85QKhBBCCM2JP6ze//iBL2//AwOHEEIIofnxx4M//dr9j/+egUMIIYQQ/IEQQggh+AMhhBBCaDT+uPD1L//8tfcZOYQQQgjNjz8qBHmALAhCCCGE5sUfP/0at+AihBBCaO78QeYDIYQQQvAHQgghhOAPhBBCCKHx+IPnnyKEEEJofvxRff8LN98ihBBCaG78gRBCCCEEfyCEEEII/kAIIYQQgj8QQgghBH8ghBBCCMEfCCGEEII/EEIIIQR/IIQQQgjBHwghhBCCPxBCCCGE4A+EEEIIwR8IIYQQQvAHQgghhOAPhBBCCMEfCCGEEELwB0IIIYT2jP4fTuXrBQlA1EIAAAAASUVORK5CYII="},378:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/lifetime-8-da413de408eba24af5e0d0db885af9fc.png"},757:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/lifetime-9-fix-96c668297e128c0b8d548a6cf72dfd0c.png"},7146:(a,e,n)=>{n.d(e,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdkAAAB/CAIAAAAsFy8SAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4b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IgFxMEQRDkYoIgCHIxQRAEQS4mCIIgFxMEQRDkYoIgCHIxQRAEEeJ/kBoUtRad3qEAAAAASUVORK5CYII="}}]); \ No newline at end of file diff --git a/assets/js/f8d4e457.cd004603.js b/assets/js/f8d4e457.cd004603.js new file mode 100644 index 00000000..455c23e8 --- /dev/null +++ b/assets/js/f8d4e457.cd004603.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[740],{3905:(a,e,n)=>{n.d(e,{Zo:()=>p,kt:()=>g});var i=n(7294);function t(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function l(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,i)}return n}function r(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){t(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function d(a,e){if(null==a)return{};var n,i,t=function(a,e){if(null==a)return{};var n,i,t={},l=Object.keys(a);for(i=0;i<l.length;i++)n=l[i],e.indexOf(n)>=0||(t[n]=a[n]);return t}(a,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(i=0;i<l.length;i++)n=l[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(t[n]=a[n])}return t}var m=i.createContext({}),u=function(a){var e=i.useContext(m),n=e;return a&&(n="function"==typeof a?a(e):r(r({},e),a)),n},p=function(a){var e=u(a.components);return i.createElement(m.Provider,{value:e},a.children)},s={inlineCode:"code",wrapper:function(a){var e=a.children;return i.createElement(i.Fragment,{},e)}},k=i.forwardRef((function(a,e){var n=a.components,t=a.mdxType,l=a.originalType,m=a.parentName,p=d(a,["components","mdxType","originalType","parentName"]),k=u(n),g=t,o=k["".concat(m,".").concat(g)]||k[g]||s[g]||l;return n?i.createElement(o,r(r({ref:e},p),{},{components:n})):i.createElement(o,r({ref:e},p))}));function g(a,e){var n=arguments,t=e&&e.mdxType;if("string"==typeof a||t){var l=n.length,r=new Array(l);r[0]=k;var d={};for(var m in e)hasOwnProperty.call(e,m)&&(d[m]=e[m]);d.originalType=a,d.mdxType="string"==typeof a?a:t,r[1]=d;for(var u=2;u<l;u++)r[u]=n[u];return i.createElement.apply(null,r)}return i.createElement.apply(null,n)}k.displayName="MDXCreateElement"},8514:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>m,contentTitle:()=>r,default:()=>s,frontMatter:()=>l,metadata:()=>d,toc:()=>u});var i=n(7462),t=(n(7294),n(3905));const l={sidebar_position:44,title:"A.44. Lifetime",sidebar_label:"A.44. Lifetime"},r=void 0,d={unversionedId:"basic/lifetime",id:"basic/lifetime",title:"A.44. Lifetime",description:"Pada chapter ini kita akan belajar tentang lifetime. Lifetime adalah yang digunakan oleh Rust compiler untuk memonitor umur dari references agar tetap dianggap valid.",source:"@site/docs/basic/lifetime.md",sourceDirName:"basic",slug:"/basic/lifetime",permalink:"/basic/lifetime",draft:!1,tags:[],version:"current",sidebarPosition:44,frontMatter:{sidebar_position:44,title:"A.44. Lifetime",sidebar_label:"A.44. Lifetime"},sidebar:"tutorialSidebar",previous:{title:"A.43. Static Item",permalink:"/basic/static"},next:{title:"A.45. Slice Memory Management",permalink:"/basic/slice-memory-management"}},m={},u=[{value:"A.44.1. Konsep Lifetime",id:"a441-konsep-lifetime",level:2},{value:"A.44.2. Relasi antara lifetime dengan owner dan borrower",id:"a442-relasi-antara-lifetime-dengan-owner-dan-borrower",level:2},{value:"A.44.3. Lifetime annotation dan penerapannya pada return value",id:"a443-lifetime-annotation-dan-penerapannya-pada-return-value",level:2},{value:"A.44.4. Lifetime pada parameter",id:"a444-lifetime-pada-parameter",level:2},{value:"A.44.5. Lifetime elision",id:"a445-lifetime-elision",level:2},{value:"A.44.6. Lifetime pada struct",id:"a446-lifetime-pada-struct",level:2},{value:"A.44.7. Lifetime pada method",id:"a447-lifetime-pada-method",level:2},{value:"A.44.8. Generic parameter + trait bounds + lifetime",id:"a448-generic-parameter--trait-bounds--lifetime",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],p={toc:u};function s(a){let{components:e,...l}=a;return(0,t.kt)("wrapper",(0,i.Z)({},p,l,{components:e,mdxType:"MDXLayout"}),(0,t.kt)("p",null,"Pada chapter ini kita akan belajar tentang lifetime. Lifetime adalah yang digunakan oleh Rust compiler untuk memonitor umur dari references agar tetap dianggap valid."),(0,t.kt)("p",null,"Normalnya kita tidak perlu berurusan dengan lifetime, karena Rust-lah yang mengelola lifetime sebuah reference. Namun di luar itu, pada beberapa case kita bisa me-manage lifetime data dengan memanfaatkan ",(0,t.kt)("em",{parentName:"p"},"annotation"),"."),(0,t.kt)("p",null,"Ketika berurusan dengan data primitif maupun non-primitif tak perlu khawatir perihal urusan lifetime. Aspek lifetime hanya perlu diperhatikan sewaktu berurusan dengan data pointer/reference, apalagi kalau data tersebut keluar masuk block scope."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Topik lifetime adalah salah satu yang paling membingungkan di Rust. Wajar jika membutuhkan waktu lebih lama untuk menguasainya. ",(0,t.kt)("em",{parentName:"p"},"Take your time"),", pelajari pelan-pelan dan ulangi berkali-kali jika perlu.")),(0,t.kt)("h2",{id:"a441-konsep-lifetime"},"A.44.1. Konsep Lifetime"),(0,t.kt)("p",null,"Lifetime adalah yang digunakan oleh Rust compiler untuk memonitor umur dari references agar tetap valid. Lifetime menempel di variabel, lebih tepatnya di reference variabel."),(0,t.kt)("p",null,"Rust menerapkan default lifetime dalam pengecekan reference. Beberapa aturan pada default lifetime sudah kita pelajari pada chapter sebelumnya, seperti variabel yang hanya akan valid di dalam block dan invalid di luar block dan data yang akan di-dealokasi ketika sudah tidak ada reference-nya."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Rust mengidentifikasi default lifetime menggunakan ",(0,t.kt)("strong",{parentName:"p"},"lifetime elision"),", yang juga akan dibahas pada chapter ini.")),(0,t.kt)("p",null,"Agar mudah memahami konsep default lifetime, mari mulai dengan kode sederhana berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let r;\n {\n let x = 5;\n r = &x;\n }\n println!("r: {}", r);\n}\n')),(0,t.kt)("p",null,"Kode di atas kalau di jalankan hasilnya error, karena ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," di-dealokasi ketika block expression selesai dieksekusi, meskipun data tersebut dipinjamkan pada ",(0,t.kt)("inlineCode",{parentName:"p"},"r")," yang scope-nya berada di atasnya."),(0,t.kt)("p",null,"Kalau diilustrasikan, lifetime variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"r")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," kurang lebih seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn main() {\n let r; // -----------+-- 'lf1\n { // |\n let x = 5; // -+-- 'lf2 |\n r = &x; // | |\n } // -+ |\n println!(\"r: {}\", r); // |\n} // -----------+\n")),(0,t.kt)("p",null,"Setiap data memiliki default lifetime."),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Variabel ",(0,t.kt)("inlineCode",{parentName:"li"},"r")," memiliki lifetime yang pada contoh di atas diilustrasikan sebagai ",(0,t.kt)("inlineCode",{parentName:"li"},"'lf1"),"."),(0,t.kt)("li",{parentName:"ul"},"Variabel ",(0,t.kt)("inlineCode",{parentName:"li"},"x")," memiliki lifetime yang pada contoh di atas diilustrasikan sebagai ",(0,t.kt)("inlineCode",{parentName:"li"},"'lf2"),"."),(0,t.kt)("li",{parentName:"ul"},"Lifetime ",(0,t.kt)("inlineCode",{parentName:"li"},"'lf2")," milik variabel ",(0,t.kt)("inlineCode",{parentName:"li"},"x")," menjadikan umur variabel tersebut valid mulai variabel tersebut dideklarasikan, hingga block expression selesai."),(0,t.kt)("li",{parentName:"ul"},"Lifetime ",(0,t.kt)("inlineCode",{parentName:"li"},"'lf2")," sudah tidak valid di luar block expression. Inilah kenapa program di atas menjadi error."),(0,t.kt)("li",{parentName:"ul"},"Lifetime ",(0,t.kt)("inlineCode",{parentName:"li"},"'lf1")," milik variabel ",(0,t.kt)("inlineCode",{parentName:"li"},"r")," menjadikan umur variabel tersebut valid mulai variabel tersebut dideklarasikan, hingga block fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"main")," selesai.")),(0,t.kt)("p",null,"Default lifetime bisa di-override menggunakan lifetime yang kita definisikan sendiri."),(0,t.kt)("h2",{id:"a442-relasi-antara-lifetime-dengan-owner-dan-borrower"},"A.44.2. Relasi antara lifetime dengan owner dan borrower"),(0,t.kt)("p",null,"Lifetime menjadi salah satu hal yang wajib diperhatikan ketika bermain dengan references. Operasi seperti melempar reference ke luar scope, atau memasukan reference ke block scope baru berpotensi memunculkan error yang berhubungan dengan lifetime."),(0,t.kt)("p",null,"Setelah ini kita akan praktik penerapan pembuatan lifetime, namun sebelum itu mari pelajari dulu pembahasan pada section berikut agar tau kenapa dan kapan kita harus menerapkan lifetime yang kita buat sendiri."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let message = String::from("darkspear is better than zandalari");\n print_mesage(&message)\n}\n\nfn print_mesage(m: &String) {\n println!("the message: {m}")\n}\n')),(0,t.kt)("p",null,"Program di atas menampilkan pesan string via fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"print_message"),". Data string didapat dari parameter pointer ",(0,t.kt)("inlineCode",{parentName:"p"},"m")," milik fungsi tersebut."),(0,t.kt)("p",null,"Pada fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main"),", ada string bernama ",(0,t.kt)("inlineCode",{parentName:"p"},"message"),", niainya dipinjamkan sebagai argument pemanggilan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"print_message"),"."),(0,t.kt)("p",null,"Setelah eksekusi fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"print_message")," selesai, yang terjadi di block kode fungsi tersebut adalah data ",(0,t.kt)("inlineCode",{parentName:"p"},"m")," di-dealokasi. Hasil dari dealokasi sendiri adalah nilai sebenarnya dikembalikan ke owner (pemilik aslinya). Sampai sini harusnya cukup jelas."),(0,t.kt)("p",null,"Sekarang lanjut ke contoh ke-2 berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let m: &String = get_message();\n println!("the message: {m}");\n}\n\nfn get_message() -> &String {\n let message = String::from("darkspear is better than zandalari");\n &message\n}\n')),(0,t.kt)("p",null,"Esensi program ke-2 ini sama seperti program sebelumnya, yaitu menampilkan pesan string yang sama persis. Perbedaannya, pesan string datanya ada di dalam fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"get_message"),". Fungsi tersebut dipanggil kemudian reference dari pesan string dipinjamkan, maka dengan ini variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"m")," pada fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"main")," nilainya adalah data pinjaman (borrowing)."),(0,t.kt)("p",null,"Ketika di-run, hasilnya error."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Lifetime",src:n(8116).Z,width:"779",height:"275"})),(0,t.kt)("p",null,"Error tersebut muncul karena setelah eksekusi fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"get_message")," selesai, semua data dalam fungsi tersebut di-dealokasi. Termasuk variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"message")," yang merupakan owner dari data yang dipinjamkan ke variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"m"),"."),(0,t.kt)("p",null,"Ok, jadi owner-nya sudah di-dealokasi, lalu bagaimana nasib dari peminjam data (variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"m"),")? Variabel tersebut menjadi bermasalah, karena owner data aslinya sudah tidak ada di memory, dan itulah kenapa muncul error."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Error ini disebut dengan ",(0,t.kt)("strong",{parentName:"p"},"dangling reference"),", muncul ketika data di-share ke variabel lain tapi owner-nya sudah tidak ada di-memory."),(0,t.kt)("p",{parentName:"blockquote"},"Di pemrograman Rust, error jenis ini bisa di-identifikasi saat kompilasi.")),(0,t.kt)("p",null,"Solusi pada error di atas, salah satunya adalah dengan tidak menggunakan tipe data pointer sebagai nilai balik. Gunakan saja tipe data ",(0,t.kt)("inlineCode",{parentName:"p"},"String"),". Solusi ini aman, karena tipe data ",(0,t.kt)("inlineCode",{parentName:"p"},"String")," owner-nya selalu berpindah saat ada operasi asignment, dengan ini maka manajemen memory menjadi efisien."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'// ganti kode berikut ...\nfn get_message() -> &String {\n let message = String::from("darkspear is better than zandalari");\n message\n}\n\n// ... menjadi ...\nfn get_message() -> String {\n let message = String::from("darkspear is better than zandalari");\n message\n}\n')),(0,t.kt)("p",null,"Ok, bagaimana dengan tipe data lain yang mengadopsi ",(0,t.kt)("em",{parentName:"p"},"copy semantics"),", misalnya ada kebutuhan untuk share reference data tersebut ke block lain. Mari kita coba."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let n = get_number();\n println!("the number: {n}");\n}\n\nfn get_number() -> &i32 {\n let number = 13;\n &number\n}\n')),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Lifetime",src:n(5384).Z,width:"782",height:"276"})),(0,t.kt)("p",null,"Bisa dilihat, ada error, karena kondisi tersebut menimbulkan dangling reference (sama seperti contoh sebelumnya). Namun pada contoh ini kita tidak bisa menerapkan solusi yang sama, karena variabel ",(0,t.kt)("inlineCode",{parentName:"p"},"number")," mengadopsi ",(0,t.kt)("em",{parentName:"p"},"copy semantics"),", bukan ",(0,t.kt)("em",{parentName:"p"},"move semantics"),"."),(0,t.kt)("p",null,"Di Rust error dangling reference diantisipasi saat kompilasi, menjadikan kode tidak bisa sukses dikompilasi."),(0,t.kt)("p",null,"Solusi yang bisa diambil adalah dengan menjadikan data tersebut tidak memiliki owner (atau owner-nya adalah program), caranya dengan langsung mengembalikan reference data tanpa perlu menampungnya terlebih dahulu ke variabel, seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let n = get_number();\n println!("the number: {n}");\n}\n\nfn get_number() -> &i32 {\n &13\n}\n')),(0,t.kt)("p",null,"Ok, tapi entah kenapa ketika dilihat masih muncul error."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Lifetime",src:n(6875).Z,width:"777",height:"260"})),(0,t.kt)("p",null,"Error tersebut muncul karena meskipun owner data ",(0,t.kt)("inlineCode",{parentName:"p"},"&13")," adalah program, ketika eksekusi fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"get_number")," selesai, data borrow tersebut langsung di-dealokasi, dan tidak ada variabel lain di-luar scope yang menampung reference data tersebut."),(0,t.kt)("p",null,"Agar tidak terjadi proses dealokasi, harus ada variabel yang menampung reference tersebut di-luar scope, tapi cara ini tidak bisa dilakukan karena data-nya saja baru dideklarasikan dalam block fungsi, tidak mungkin tiba-tiba ada yang menampung di-luar scope."),(0,t.kt)("p",null,"Solusi dari masalah ini adalah menggunakan lifetime ",(0,t.kt)("inlineCode",{parentName:"p"},"'static")," (yang detailnya sudah dibahas pada chapter sebelumnya). Dengan ini maka data reference ",(0,t.kt)("inlineCode",{parentName:"p"},"&13")," hidup lebih lama dari umur yang sebenarnya sudah ditakdirkan untuk data data tersebut."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn get_number() -> &'static i32 {\n &13\n}\n")),(0,t.kt)("p",null,"Namun perlu diingat, bahwa data efek dari lifetime ",(0,t.kt)("inlineCode",{parentName:"p"},"'static")," adalah data tidak akan pernah di-dealokasi. Data tersebut akan hidup selamanya di program hingga kecuali program dimatikan. Karena alasan itulah penggunaan ",(0,t.kt)("inlineCode",{parentName:"p"},"'static")," pada contoh ini bisa disebut berlebihan."),(0,t.kt)("p",null,"Solusi yang lebih pas adalah dengan membuat lifetime sendiri dengan cara menerapkan ",(0,t.kt)("strong",{parentName:"p"},"lifetime annotation")," (tidak menggunakan lifetime ",(0,t.kt)("inlineCode",{parentName:"p"},"'static"),")."),(0,t.kt)("h2",{id:"a443-lifetime-annotation-dan-penerapannya-pada-return-value"},"A.44.3. Lifetime annotation dan penerapannya pada return value"),(0,t.kt)("p",null,"Lifetime dituliskan dengan notasi ",(0,t.kt)("inlineCode",{parentName:"p"},"'nama_lifetime"),". Dengan notasi tersebut, kita bisa menciptakan lifetime baru misalnya ",(0,t.kt)("inlineCode",{parentName:"p"},"'a"),", ",(0,t.kt)("inlineCode",{parentName:"p"},"'b"),", ",(0,t.kt)("inlineCode",{parentName:"p"},"'ini_lifetime"),", dst."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"&i32 // => tipe data reference i32\n&'a i32 // => tipe data reference i32 dengan lifetime 'a\n&'a mut i32 // => tipe data mutable reference i32 dengan lifetime 'a\n")),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Lifetime dan block label memiliki bentuk literal yang sama, keduanya diawali tanda kutip ",(0,t.kt)("inlineCode",{parentName:"p"},"'"),". Yang membedakan hanya pada tempat di mana syntax tersebut ditulis.")),(0,t.kt)("p",null,"Kegunaan dari lifetime annotation adalah untuk menginformasikan compiler agar reference tidak langsung didealokasikan setelah eksekusi block selesai. Agar lebih jelas mari kita langsung terapkan saja pada fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"get_number")," yang sudah ditulis. Silakan tambahkan lifetime dengan nama bebas. Di sini penulis gunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"'my_lifetime"),".nnnn"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn get_number() -> &'my_lifetime i32 {\n &13\n}\n")),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Lifetime",src:n(4982).Z,width:"689",height:"184"})),(0,t.kt)("p",null,"Meski sudah ditambahkan, error tetap muncul, karena lifetime tersebut tidak dikenal. Berbeda dengan lifetime ",(0,t.kt)("inlineCode",{parentName:"p"},"'static")," yang memang sudah disediakan oleh Rust."),(0,t.kt)("p",null,"Step selanjutnya adalah mengenalkan lifetime tersebut, caranya dengan menambahkannya dalam notasi parameter generic fungsi, seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn get_number<'my_lifetime>() -> &'my_lifetime i32 {\n &13\n}\n")),(0,t.kt)("p",null,"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"get_number")," sekarang tidak menghasilkan error, karena reference yang dikembalikan memiliki umur ",(0,t.kt)("inlineCode",{parentName:"p"},"'my_lifetime")," yang membuatnya tetap valid sampai menjadi return value, meski eksekusi block fungsi-nya sendiri sudah selesai. Efeknya, data yang di-return bisa ditampung di luar scope fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"get_number"),"."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Lifetime",src:n(4734).Z,width:"460",height:"104"})),(0,t.kt)("p",null,"Tanpa adanya lifetime pada return value, maka data return value akan langsung di-dealokasi setelah block fungsi selesai dieksekusi. Tapi karena hal ini ",(0,t.kt)("em",{parentName:"p"},"by default")," sudah di-handle Rust, maka kita tidak perlu memikirkannya."),(0,t.kt)("h2",{id:"a444-lifetime-pada-parameter"},"A.44.4. Lifetime pada parameter"),(0,t.kt)("p",null,"Pada praktik ini kita akan bahas penerapan lifetime pada parameter."),(0,t.kt)("p",null,"Silakan perhatikan kode berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something_v1(x: &str) -> &str {\n x\n}\n")),(0,t.kt)("p",null,"Kode di atas tidak menghasilkan error, karena kalau dilihat dari sudut pandang lifetime (sesuai dengan aturan lifetime elision), yang sebenarnya terjadi adalah kurang lebih seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something_v2<'a>(x: &'a str) -> &'a str {\n x\n}\n")),(0,t.kt)("p",null,"Pada saat parameter ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," masuk ke fungsi, ",(0,t.kt)("em",{parentName:"p"},"by default")," variabel tersebut memiliki lifetime (yang pada contoh di atas diilustrasikan dengan `'a'). Lifetime tersebut akan aktif hingga menjadi return value karena lifetime yang sama digunakan juga pada return value. Dengan ini nantinya setelah fungsi selesai dieksekusi, nilai baliknya tetap bisa ditampung."),(0,t.kt)("p",null,"Beda lagi jika lifetime lain digunakan pada nilai balik fungsi, misalnya:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something_v3<'a, 'b>(x: &'a str) -> &'b str {\n x\n}\n")),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Lifetime",src:n(5109).Z,width:"736",height:"204"})),(0,t.kt)("p",null,"Error muncul dengan keterangan kurang lebih: data yang dijadikan return value pada block fungsi akan valid untuk lifetime ",(0,t.kt)("inlineCode",{parentName:"p"},"'b"),", namun data yang dijadikan return value hanya valid untuk lifetime ",(0,t.kt)("inlineCode",{parentName:"p"},"'a"),"."),(0,t.kt)("p",null,"Dari sini bisa ditarik kesimpulan: data yang didapat dari luar scope (yang memiliki lifetime sendiri) ketika digunakan sebagai nilai balik, lifetime-nya harus sama."),(0,t.kt)("p",null,"Sekarang mari kita modifikasi lagi fungsi menjadi seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something_v4<'a, 'b, 'c>(x: &'a str, y: &'b str) -> &'c str {\n \"hello\"\n}\n")),(0,t.kt)("p",null,"Fungsi di atas memiliki 2 buah lifetime, yaitu:"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},"Lifetime ",(0,t.kt)("inlineCode",{parentName:"li"},"'a"),", digunakan pada parameter ",(0,t.kt)("inlineCode",{parentName:"li"},"x")),(0,t.kt)("li",{parentName:"ul"},"Lifetime ",(0,t.kt)("inlineCode",{parentName:"li"},"'b"),", digunakan pada parameter ",(0,t.kt)("inlineCode",{parentName:"li"},"y")),(0,t.kt)("li",{parentName:"ul"},"Lifetime ",(0,t.kt)("inlineCode",{parentName:"li"},"'c"),", digunakan pada return value")),(0,t.kt)("p",null,"Karena yang dikembalikan ada data baru, yaitu string ",(0,t.kt)("inlineCode",{parentName:"p"},"hello"),", maka kode di atas tidak error. Data tersebut lifetime-nya adalah ",(0,t.kt)("inlineCode",{parentName:"p"},"'c"),", dan akan tetap valid setelah pemanggilan fungsi selesai."),(0,t.kt)("p",null,"Beda situasi jika yang dikembalikan adalah data dari parameter, misalnya, ",(0,t.kt)("inlineCode",{parentName:"p"},"x"),". Jika seperti ini, maka lifetime yang sama dengan lifetime parameter ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," harus digunakan, yaitu lifetime ",(0,t.kt)("inlineCode",{parentName:"p"},"'b"),". Contoh:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something_v5<'a, 'b, 'c>(x: &'a str, y: &'b str) -> &'b str {\n y\n}\n")),(0,t.kt)("p",null,"Pada kode di atas, lifetime ",(0,t.kt)("inlineCode",{parentName:"p"},"'c")," tidak dipergunakan sama sekali, maka lifetime tersebut boleh dihapus dari fungsi. Silakan cukup definisikan lifetime yang hanya digunakan saja pada block parameter generic."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something_v6<'a, 'b>(x: &'a str, y: &'b str) -> &'b str {\n y\n}\n")),(0,t.kt)("p",null,"Dimisalkan ada seleksi kondisi, jadi return value bisa saja ",(0,t.kt)("inlineCode",{parentName:"p"},"x"),", bisa juga ",(0,t.kt)("inlineCode",{parentName:"p"},"y"),". Jika seperti ini, maka ",(0,t.kt)("inlineCode",{parentName:"p"},"x"),", ",(0,t.kt)("inlineCode",{parentName:"p"},"y"),", dan juga return value harus memiliki lifetime yang sama."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn do_something_v7<'a>(x: &'a str, y: &'a str) -> &'a str {\n if x.len() < y.len() {\n x\n } else {\n y\n }\n}\n")),(0,t.kt)("h2",{id:"a445-lifetime-elision"},"A.44.5. Lifetime elision"),(0,t.kt)("p",null,"Sampai section ini kita telah mempelajari kurang lebih 4 point berikut:"),(0,t.kt)("ol",null,(0,t.kt)("li",{parentName:"ol"},"Setiap data, lebih tepatnya setiap reference memiliki lifetime."),(0,t.kt)("li",{parentName:"ol"},"Lifetime digunakan oleh Rust dalam penentuan kapan reference tersebut di-dealokasi."),(0,t.kt)("li",{parentName:"ol"},"Pada beberapa case, lifetime perlu di-urus secara eksplisit (contohnya seperti pada fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"do_something_vx")," di atas)."),(0,t.kt)("li",{parentName:"ol"},"Pengecekan lifetime terjadi saat kompilasi.")),(0,t.kt)("p",null,"Rust memiliki sesuatu yang disebut dengan ",(0,t.kt)("strong",{parentName:"p"},"lifetime elision"),", isinya adalah aturan yang digunakan oleh Rust dalam menganalisa reference untuk menentukan lifetime ",(0,t.kt)("em",{parentName:"p"},"default"),"-nya."),(0,t.kt)("p",null,"Namun, bukan berarti Rust akan selalu tau lifetime tiap reference. Pada beberapa case, Rust membutuhkan bantuan kita selaku programmer untuk menginformasikan lifetime reference kode yang ditulis, contohnya seperti pada fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"do_something_v7")," di atas."),(0,t.kt)("p",null,"Meskipun demikian, tak usah terlalu khawatir, karena pengecekan lifetime reference terjadi saat kompilasi, dan ketika ada reference yang perlu dikasih ",(0,t.kt)("em",{parentName:"p"},"annotication"),", Rust akan menginformasikan ke kita via pesan error."),(0,t.kt)("blockquote",null,(0,t.kt)("p",{parentName:"blockquote"},"Untuk sekarang, pembahasan detail mengenai lifetime elision tidak dibahas pada ebook ini. Silakan gunakan dokumentasi official Rust untuk ",(0,t.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/nomicon/lifetime-elision.html"},"lifetime elision")," jika berminat untuk pengkajian yang lebih dalam.")),(0,t.kt)("p",null,"Jika kawan-kawan menggunakan ",(0,t.kt)("inlineCode",{parentName:"p"},"rust-analyzer")," extension di VSCode, tak perlu meng-compiler program untuk memunculkan error-nya, karena langsung muncul saat penulisan kode program."),(0,t.kt)("h2",{id:"a446-lifetime-pada-struct"},"A.44.6. Lifetime pada struct"),(0,t.kt)("p",null,"Tak hanya pada parameter fungsi dan return value fungsi, lifetime juga bisa diterapkan pada (property) struct."),(0,t.kt)("p",null,"Ketika menggunakan tipe data reference sebagai tipe property struct, Rust langsung menginformasikan kita via error message jika tidak ada anotasi lifetime pada field tersebut."),(0,t.kt)("p",null,"Contohnya bisa dilihat pada kode di bawah ini. Pesan error muncul karena tipe data ",(0,t.kt)("inlineCode",{parentName:"p"},"&str")," pada property struct tidak ada lifetime annotation-nya."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"struct Book {\n title: &str,\n}\n")),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Lifetime",src:n(7106).Z,width:"725",height:"160"})),(0,t.kt)("p",null,"Solusinya, tambahkan anotasi lifetime pada tipe data ",(0,t.kt)("inlineCode",{parentName:"p"},"&str"),", dan juga daftarkan lifetime tersebut pada struct. Notasi penulisannya seperti ini:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"// struct NamaStruct<'lifetime_annotication> {\n// field: &'lifetime_annotication tipe_data,\n// }\n\nstruct Book<'abc> {\n title: &'abc str,\n}\n")),(0,t.kt)("p",null,"Contoh jika ada lebih dari 1 field dengan lifetime sama:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"struct Book<'abc> {\n title: &'abc str,\n description: &'abc str,\n}\n")),(0,t.kt)("p",null,"Contoh jika ada beberapa field yang di antaranya memiliki lifetime berbeda (artinya ada lebih dari 1 lifetime):"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"struct Book<'abc, 'def> {\n title: &'abc str,\n description: &'abc str,\n price: &'def i32,\n}\n\nfn main() {\n let book = Book {\n title: \"The Silmarillion\",\n description: \"Good story, 10/10, would read again\",\n price: &99,\n };\n}\n")),(0,t.kt)("h2",{id:"a447-lifetime-pada-method"},"A.44.7. Lifetime pada method"),(0,t.kt)("p",null,"Ada 2 hal yang perlu diketahui dalam penerapan lifetime pada method. Yang pertama, lifetime annotication harus ditulis pada block ",(0,t.kt)("inlineCode",{parentName:"p"},"impl")," meskipun pada block method tidak digunakan secara langsung."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"struct Book<'abc, 'def> {\n title: &'abc str,\n description: &'abc str,\n price: &'def i32,\n}\n\nimpl<'abc, 'def> Book<'abc, 'def> {\n\n fn get_info(&self) -> String {\n let info = format!(\"{} (${}), {}\", self.title, self.price, self.description);\n info\n }\n}\n")),(0,t.kt)("p",null,"Bisa dilihat statement block ",(0,t.kt)("inlineCode",{parentName:"p"},"impl<'abc, 'def> Book<'abc, 'def>"),", lifetime annotation-nya sama persis dengan yang ada di struct. Jika ingin mengetes, silakan coba saja hapus syntax lifetime dari statement itu, pasti muncul error."),(0,t.kt)("p",null,"Hal ke-2 yang penting diketahui, pada block kode method, tidak perlu menuliskan lifetime annotation, karena sudah ditulis di block kode ",(0,t.kt)("inlineCode",{parentName:"p"},"impl"),"."),(0,t.kt)("p",null,"Sebagai contoh, dua method berikut tidak memunculkan error:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"// ...\n\nimpl<'abc, 'def> Book<'abc, 'def> {\n\n fn get_info(&self) -> String {\n let info = format!(\"{} (${}), {}\", self.title, self.price, self.description);\n info\n }\n\n fn get_price(&self) -> &i32 {\n self.price\n }\n}\n")),(0,t.kt)("p",null,"Bandingkan dengan fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"get_book_price")," berikut, error muncul karena lifetime annotation tidak ditambahkan ke block fungsi (meskipun fungsi tersebut mengembalikan property ",(0,t.kt)("inlineCode",{parentName:"p"},"price")," milik struct ",(0,t.kt)("inlineCode",{parentName:"p"},"Book")," yang sudah memiliki lifetime sendiri). Hal ini karena data ",(0,t.kt)("inlineCode",{parentName:"p"},"&i32")," yang dikembalikan statement ",(0,t.kt)("inlineCode",{parentName:"p"},"book.get_price()")," langsung didealokasi setelah block fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"get_book_price")," selesai dieksekusi."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Lifetime",src:n(378).Z,width:"813",height:"223"})),(0,t.kt)("p",null,"Agar error tidak muncul, tambahkan lifetime:"),(0,t.kt)("ol",null,(0,t.kt)("li",{parentName:"ol"},"ke return value (karena tipe data return value adalah reference)"),(0,t.kt)("li",{parentName:"ol"},"lalu pada parameter ",(0,t.kt)("inlineCode",{parentName:"li"},"book")," (karena di block fungsi return value berasal dari data milik property variabel ",(0,t.kt)("inlineCode",{parentName:"li"},"book"),"),"),(0,t.kt)("li",{parentName:"ol"},"dan juga tak lupa daftarkan lifetime annotation pada block fungsi ",(0,t.kt)("inlineCode",{parentName:"li"},"get_book_price"),".")),(0,t.kt)("p",null,"Kurang kode menjadi seperti berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'// ...\n\nfn get_book_price<\'ghi>(book: &\'ghi Book) -> &\'ghi i32 {\n book.get_price()\n}\n\nfn main() {\n let book = Book {\n title: "The Silmarillion",\n description: "Good story, 10/10, would read again",\n price: &99,\n };\n\n println!("{}", book.get_info());\n println!("the price: {}", get_book_price(&book));\n}\n')),(0,t.kt)("p",null,"Run program, hasilnya sukses."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Lifetime",src:n(7146).Z,width:"473",height:"127"})),(0,t.kt)("h2",{id:"a448-generic-parameter--trait-bounds--lifetime"},"A.44.8. Generic parameter + trait bounds + lifetime"),(0,t.kt)("p",null,"Lalu bagaimana jika ada fungsi yang di situ ada penerapan trait bounds, ada juga generic parameter, dan lifetime annotation. Cara penulisannya seperti apa? Silakan lihat contoh berikut:"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn find_greater_number<'a, T>(\n x: &'a T,\n y: &'a T,\n) -> &'a T\nwhere\n T: std::cmp::PartialOrd,\n{\n if x > y {\n x\n } else {\n y\n }\n}\n")),(0,t.kt)("p",null,"Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"find_greater_number")," di atas digunakan untuk mencari angka terbesar dari dua inputan parameter (",(0,t.kt)("inlineCode",{parentName:"p"},"x")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"y"),"), dengan tipe data yang digunakan adalah generic ",(0,t.kt)("inlineCode",{parentName:"p"},"T"),". Dari sini maka nantinya fungsi ini bisa digunakan pada data bertipe ",(0,t.kt)("inlineCode",{parentName:"p"},"i32"),", ",(0,t.kt)("inlineCode",{parentName:"p"},"f64"),", dan data numerik lainnya."),(0,t.kt)("p",null,"Tipe ",(0,t.kt)("inlineCode",{parentName:"p"},"T")," diasosiasikan dengan trait ",(0,t.kt)("inlineCode",{parentName:"p"},"std::cmp::PartialOrd")," agar variabel dengan tipe tersebut bisa digunakan dalam seleksi kondisi ",(0,t.kt)("inlineCode",{parentName:"p"},"if")," yang ada dalam block fungsi tersebut."),(0,t.kt)("p",null,"Ok, sampai sini semoga cukup jelas. Lalu bagaimana dengan lifetime annotation-nya? Karena lifetime annotation definisinya berada pada tempat yang sama dengan definisi tipe generic, maka langsung saja tulis di situ tanpa memperhatikan urutan. Sebagai contoh, dua definisi block fungsi berikut adalah ekuivalen."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn say_hello_v1<'abc, T>()\nfn say_hello_v2<T, 'abc>()\n")),(0,t.kt)("p",null,"Sekarang kembali ke pembahasan di atas. Fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"find_greater_number")," mengembalikan tipe data reference ",(0,t.kt)("inlineCode",{parentName:"p"},"&T")," yang nilainya bisa saja dari ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," atau ",(0,t.kt)("inlineCode",{parentName:"p"},"y"),". Dari sini maka wajib hukumnya untuk return value memiliki lifetime yang sama dengan ",(0,t.kt)("inlineCode",{parentName:"p"},"x")," dan ",(0,t.kt)("inlineCode",{parentName:"p"},"y"),". Itulah kenapa definisi fungsi ",(0,t.kt)("inlineCode",{parentName:"p"},"find_greater_number")," agak panjang."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},"fn find_greater_number<'a, T>(x: &'a T, y: &'a T) -> &'a T\n")),(0,t.kt)("p",null,"Lanjut, mari kita panggil fungsi tersebut pada dua block expression. Block pertama untuk pengecekan data numerik ",(0,t.kt)("inlineCode",{parentName:"p"},"i32"),", dan yang kedua untuk tipe ",(0,t.kt)("inlineCode",{parentName:"p"},"f64"),"."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n\n {\n // i32 comparison test\n let x = 13;\n let y = 20;\n let result = find_greater_number::<i32>(&x, &y); // atau cukup `find_greater_number(&x, &y)`\n println!("result: {}", result);\n }\n \n {\n // f64 comparison test\n let x = 3.14;\n let y = 2.11;\n let result = find_greater_number::<f64>(&x, &y); // atau cukup `find_greater_number(&x, &y)`\n println!("result: {}", result);\n }\n}\n')),(0,t.kt)("p",null,"Jalankan program, hasilnya sesuai harapan, tidak ada error."),(0,t.kt)("p",null,(0,t.kt)("img",{loading:"lazy",alt:"Lifetime",src:n(757).Z,width:"1072",height:"200"})),(0,t.kt)("hr",null),(0,t.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,t.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,t.kt)("pre",null,(0,t.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/lifetime"},"github.com/novalagung/dasarpemrogramanrust-example/../lifetime")),(0,t.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html"},"https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/nomicon/lifetimes.html"},"https://doc.rust-lang.org/nomicon/lifetimes.html")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://dev.to/takaakifuruse/rust-lifetimes-a-high-wall-for-rust-newbies-3ap"},"https://dev.to/takaakifuruse/rust-lifetimes-a-high-wall-for-rust-newbies-3ap")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://anooppoommen.medium.com/lifetimes-in-rust-7f2331be998b"},"https://anooppoommen.medium.com/lifetimes-in-rust-7f2331be998b")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://blog.logrocket.com/understanding-lifetimes-in-rust/"},"https://blog.logrocket.com/understanding-lifetimes-in-rust/")),(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"https://educative.io/answers/what-are-generic-lifetime-parameters-in-a-rust-function"},"https://educative.io/answers/what-are-generic-lifetime-parameters-in-a-rust-function"))))}s.isMDXComponent=!0},8116:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/lifetime-1-49980dd171b372c65a19ab2c8bd2334f.png"},5384:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/lifetime-2-1116463c388b09c1a8822e3b1ff4682c.png"},6875:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/lifetime-3-d0688570ad7d667d603cde8665c863fc.png"},4982:(a,e,n)=>{n.d(e,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAArEAAAC4CAIAAAB7KCObAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvM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d2sJVAnQra97nXI2nnWZ38SS6eoXXx5IiC7r+mC0UJ7W8gm5odzIbulp3L2p83drA/uz0D5INtWdx9kfZOmlaM/jJcX/CHQrUJWRbWBl/YKkO2OOCF6Tc/N63kqZxDa2s1aInDqdEFz3R3TBfaiKulAqr+1Ek+ls1AL3Spkz1jsZmaHT3KNXtqN4a3LCPwC8VnB7FU9lXPabORmLY/eZO9dW11QqrvXcTxdrfFU9tLPUsbe68G63KaPnCMg+2KVzMOe5iuGh2/ra1mX6PUev3jKycMfhICsUPQhxT6q3RCyV3CJftblRAjI7lDxdMGGhBXTBfsl162UEyEgixBCQBYhhBCQRQghIIsQQkAWIYQQkEUIISCLEEIIyCKEEJBFCCEgixBCCMgihNDuIfvPrz9/f/+8Vmmve3SEEFoasj9///3z65+XCtlj7f+G9e9+nwXrEUJAdiZgf/86Hi+uf1AQ+QeEEPJB9oSRRCe89ZgbQrqBeEHyEgWPyY5sSnaP0Hn+cUzSIe4USf48/9t09P7yMPwhKFS3ewXVP393CLVZml19EEJoqUj2cgs9IqgL+346Yjy5uwHZv8m/f+Ldx4PKo59J3G2Py+SBbC1ghbEIoQ2mCy4/TmHnTxeA5O4GZLtMwn/T6YIOrtbRT38cijF1miGD7BgyMyeLENoKsvnMwjaQ7X5ZR18k1rTDciZlEUKbQtYZ2C0dyf75ZR19ZciymgwhtARk5f2ypKSPOObuwTzrXx9koynd/Og2ZJeYkw3ngRFCaDJkswf3kpKHZDFC+cGX2H3Yu19KUISsOorYPg+y2RzEZW0D62QRQstCFiGEEJBFCCEgixBCQBYhhBCQRQghIIsQQkAWIYQQkEUIISCLEEIIyCKE0Eb6Hxjx0ddRBCZiAAAAAElFTkSuQmCC"},5109:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/lifetime-6-661acde878a7b7fc851b9e76b22e60a7.png"},7106:(a,e,n)=>{n.d(e,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtUAAACgCAIAAABMoQ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9ZyQKHsYEPmwixSziBEEIIoRnyB0IIIYQQ/IEQQggh+AMhhBBCCP5ACCGE0NLzx/Xbf3f/zw/c/5+v85QKhBBCCM2JP6ze//iBL2//AwOHEEIIofnxx4M//dr9j/+egUMIIYQQ/IEQQggh+AMhhBBCaDT+uPD1L//8tfcZOYQQQgjNjz8qBHmALAhCCCGE5sUfP/0at+AihBBCaO78QeYDIYQQQvAHQgghhOAPhBBCCKHx+IPnnyKEEEJofvxRff8LN98ihBBCaG78gRBCCCEEfyCEEEII/kAIIYQQgj8QQgghBH8ghBBCCMEfCCGEEII/EEIIIQR/IIQQQgjBHwghhBCCPxBCCCGE4A+EEEIIwR8IIYQQQvAHQgghhOAPhBBCCMEfCCGEEELwB0IIIYT2jP4fTuXrBQlA1EIAAAAASUVORK5CYII="},378:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/lifetime-8-da413de408eba24af5e0d0db885af9fc.png"},757:(a,e,n)=>{n.d(e,{Z:()=>i});const i=n.p+"assets/images/lifetime-9-fix-96c668297e128c0b8d548a6cf72dfd0c.png"},7146:(a,e,n)=>{n.d(e,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdkAAAB/CAIAAAAsFy8SAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24g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C2ahgUFqbMYLROoLyZXz8Xqu6bDMV7sF4vg1bZ+cTQyJluVDQLVvxuC4cK2GjvnJ40Vro8TxbyoNFO9GK6U+pjHoi+lIL2Lux/e3kAIrKo2kUGCX/R+dd3urdKwYP06DIUP31iEZ6JRd7o4cJg6uQr6SItAwL2eYhr6C0K366Qv5zu5+C22Si5EkSyKonvVFfUg1Jb8P1zTfbH8YndBBRfjVgUtKhgEwM0xrQRXrvP7XtHgvXF0VDS/k7LQxWDhGvrvuDu0VX7VyMbjFm4d87RddLHYqGOGigtuL6tSEAQI3UN1N9MQ3DIGrbePrJcPPUQxT0N/QdosNmMhU0p1wl4SFxMbADm1iz+dg7Notw2umwITSNO2t9ksex3dsWRaJE7vRRmLXHwebGw7ETXsPvgYVzDzwWLoAdt+Nd3RqiPrIqHkYmIvT6uRU32+k5cEd3kdetSPNcjFBEEQ5GKCIAiCXEwQBEEuJgiCIPbn4o136Z2ZIClBEMQqXKxL9l0SFxdotBMEQVwhF2+AYo12giCI7bhYUfVepiWvqDuX6b4DVXGt9PiECtUnLtRoJwiCOIJf3EpLfrqrQPcdfTSql+7j4mKNdoIgiCPFKMq15LGInlv3HRJ9mZK96Rh7NdoJgiCOx8UFWvJYus+tb4lCt3VK9jjo4dVoJwiCOCYXO7lK9Yt9XKzpFDZjSqdGO0EQxKZcjOTDlmjJJwfU5ETB8UnMSJMXl+6IF1uNVS8SBEFsysVii8IyLXklmVv3Pf0BHoBVtnZXodFOEASxORe3BbeHEQRBkIsJgiDIxeRigiCII3AxQRAEQS4mCIIgFxMEQRDkYoIgCHIxQRAEQS4mCIIgFxMEQRDkYoIgCHIxQRAEEeJ/kBoUtRad3qEAAAAASUVORK5CYII="}}]); \ No newline at end of file diff --git a/assets/js/fb18633e.5c83c6b6.js b/assets/js/fb18633e.5c83c6b6.js deleted file mode 100644 index 09ed60a2..00000000 --- a/assets/js/fb18633e.5c83c6b6.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[7310],{3905:(a,e,n)=>{n.d(e,{Zo:()=>m,kt:()=>k});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function o(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},r=Object.keys(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var s=t.createContext({}),u=function(a){var e=t.useContext(s),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},m=function(a){var e=u(a.components);return t.createElement(s.Provider,{value:e},a.children)},p={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},d=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,r=a.originalType,s=a.parentName,m=o(a,["components","mdxType","originalType","parentName"]),d=u(n),k=i,g=d["".concat(s,".").concat(k)]||d[k]||p[k]||r;return n?t.createElement(g,l(l({ref:e},m),{},{components:n})):t.createElement(g,l({ref:e},m))}));function k(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=n.length,l=new Array(r);l[0]=d;var o={};for(var s in e)hasOwnProperty.call(e,s)&&(o[s]=e[s]);o.originalType=a,o.mdxType="string"==typeof a?a:i,l[1]=o;for(var u=2;u<r;u++)l[u]=n[u];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}d.displayName="MDXCreateElement"},5555:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>s,contentTitle:()=>l,default:()=>p,frontMatter:()=>r,metadata:()=>o,toc:()=>u});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:35,title:"A.35. Borrowing",sidebar_label:"A.35. Borrowing"},l=void 0,o={unversionedId:"basic/borrowing",id:"basic/borrowing",title:"A.35. Borrowing",description:"Pada chapter ini kita akan belajar tentang apa itu borrowing dalam Rust programming.",source:"@site/docs/basic/borrowing.md",sourceDirName:"basic",slug:"/basic/borrowing",permalink:"/basic/borrowing",draft:!1,tags:[],version:"current",sidebarPosition:35,frontMatter:{sidebar_position:35,title:"A.35. Borrowing",sidebar_label:"A.35. Borrowing"},sidebar:"tutorialSidebar",previous:{title:"A.34. Ownership",permalink:"/basic/ownership"},next:{title:"A.36. Traits",permalink:"/basic/traits"}},s={},u=[{value:"A.35.1. Konsep borrowing",id:"a351-konsep-borrowing",level:2},{value:"A.35.2. Rust Borrow Checker",id:"a352-rust-borrow-checker",level:2},{value:"A.35.3. Aturan borrowing",id:"a353-aturan-borrowing",level:2},{value:"A.35.4. Borrowing mutable/immutable reference",id:"a354-borrowing-mutableimmutable-reference",level:2},{value:"\u25c9 Contoh ke-1",id:"-contoh-ke-1",level:3},{value:"\u25c9 Contoh ke-2",id:"-contoh-ke-2",level:3},{value:"\u25c9 Contoh ke-3",id:"-contoh-ke-3",level:3},{value:"A.35.5. Borrowing valid/invalid reference",id:"a355-borrowing-validinvalid-reference",level:2},{value:"A.35.6. Borrowing pada block",id:"a356-borrowing-pada-block",level:2},{value:"\u25c9 Method <code>contains</code> milik <code>String</code>",id:"-method-contains-milik-string",level:3},{value:"A.35.7. Owner dan borrower data literal",id:"a357-owner-dan-borrower-data-literal",level:2},{value:"A.35.8. Borrowing pada macro <code>println</code>",id:"a358-borrowing-pada-macro-println",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:u};function p(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,t.Z)({},m,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan belajar tentang apa itu borrowing dalam Rust programming."),(0,i.kt)("p",null,"Sebelum masuk ke pembelajaran, penulis anjurkan untuk paham terlebih dahulu tentang ",(0,i.kt)("a",{parentName:"p",href:"/basic/basic-memory-management"},"Basic Memory Management"),", ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"),", dan juga konsep ",(0,i.kt)("a",{parentName:"p",href:"/basic/ownership"},"Ownership"),". Ketiga topik tersebut dipelajari pada chapter sebelum ini."),(0,i.kt)("h2",{id:"a351-konsep-borrowing"},"A.35.1. Konsep borrowing"),(0,i.kt)("p",null,"Pada chapter sebelumnya kita telah belajar bahwa tipe data yang mengadopsi ",(0,i.kt)("em",{parentName:"p"},"move semantics")," (seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"), ketika digunakan pada operasi assignment maka owner-nya berpindah. Variabel yang sebelumnya adalah owner, setelah proses assignment menjadi invalid, karena owner data tersebut telah berpindah ke variabel baru. Efeknya, semua operasi yang dilakukan pada variabel owner sebelumnya menghasilkan error."),(0,i.kt)("p",null,"Sekarang perhatikan kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let msg_1 = String::from("hello");\nlet msg_2 = msg_1;\n\nprintln!("{:?}", msg_2);\nprintln!("{:?}", msg_1);\n')),(0,i.kt)("p",null,"Pada contoh di atas, statement print ",(0,i.kt)("inlineCode",{parentName:"p"},"msg_1")," menghasilkan error karena variabel tersebut telah invalid setelah statement ",(0,i.kt)("inlineCode",{parentName:"p"},"let msg_2 = msg_1"),"."),(0,i.kt)("p",null,"Programmer harus ekstra hati-hati dan bijak dalam pengelolaan owner data, agar memory ter-manage dengan baik. Tapi kalau dipikir-pikir, repot juga kalau owner harus dilempar-lempar setiap selesai digunakan agar tidak error."),(0,i.kt)("p",null,"Salah satu cara yang bisa digunakan agar tidak terlalu repot adalah dengan menerapkan cloning (seperti yang sudah dibahas pada chapter sebelumnya). Namun ini bukan opsi yang baik karena boros memory, sedangkan di sisi lain programmer dianjurkan untuk efisien dalam penggunaan memory."),(0,i.kt)("p",null,"Solusi yang paling pas adalah dengan menerapkan ",(0,i.kt)("strong",{parentName:"p"},"borrowing"),". Borrowing artinya adalah meminjam. Pada konteks Rust programming, borrowing berarti meminjam data milik owner, dipinjam agar bisa diakses tanpa perlu memindah owner-nya. Kemudian setelah peminjaman selesai, data dikembalikan."),(0,i.kt)("p",null,"Cara meminjam data di Rust sangat mudah, yaitu:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Untuk borrowing dengan level akses immutable/read-only, gunakan operator reference ",(0,i.kt)("inlineCode",{parentName:"p"},"&")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let msg_3 = String::from("hello rust");\nlet msg_4 = &msg_3; // <----- borrow operation\n\nprintln!("{:?}", msg_4); // output => hello rust\nprintln!("{:?}", msg_3); // output => hello rust\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Untuk borrowing dengan level akses mutable, gunakan operator reference ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut msg_3 = String::from("hello");\nlet msg_4 = &mut msg_3; // <----- mutable borrow operation\n\n*msg_4 = String::from("hello rust");\n\nprintln!("{:?}", msg_4); // output => hello rust\nprintln!("{:?}", msg_3); // output => hello rust\n')))),(0,i.kt)("p",null,"Di Rust, semua statement reference (baik mutable ataupun immutable) adalah operasi ",(0,i.kt)("em",{parentName:"p"},"borrowing"),". Yang terjadi pada statement reference adalah data milik owner dipinjam dalam bentuk pointer. Pointer itu sendiri merupakan alamat memory yang mengarah ke data sebenarnya (milik owner)."),(0,i.kt)("p",null,"Dari contoh di atas, bisa ditarik kesimpulan bahwa data string ",(0,i.kt)("inlineCode",{parentName:"p"},"hello rust")," memiliki dua reference:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Yang pertama adalah owner data, yaitu variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"msg_3")),(0,i.kt)("li",{parentName:"ul"},"Yang kedua adalah peminjam data, yaitu variabel pointer ",(0,i.kt)("inlineCode",{parentName:"li"},"msg_4"))),(0,i.kt)("h2",{id:"a352-rust-borrow-checker"},"A.35.2. Rust Borrow Checker"),(0,i.kt)("p",null,"Rust compiler memiliki 1 bagian bernama ",(0,i.kt)("strong",{parentName:"p"},"borrow checker"),", tugasnya untuk melakukan pengecekan pada source code apakah ada kode yang berhubungan dengan ownership dan borrowing, dan apakah kode tersebut mengikuti aturan borrowing yang sudah ditetapkan oleh Rust, atau tidak. Jika ada yang menyalahi aturan, maka borrow checker memunculkan error."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Borrow checker sangat galak, pastikan kode yang ditulis mengikuti aturan yang berlaku di pemrograman Rust.")),(0,i.kt)("h2",{id:"a353-aturan-borrowing"},"A.35.3. Aturan borrowing"),(0,i.kt)("p",null,"Aturan borrowing atau reference sempat disinggung pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"),", yang kurang lebih adalah:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Dalam waktu yang sama, hanya boleh ada satu mutable reference atau banyak immutable reference (keduanya tidak bisa bersamaan, harus salah satu)."),(0,i.kt)("li",{parentName:"ul"},"Reference harus selalu valid.")),(0,i.kt)("p",null,"Dua aturan tersebut wajib dipatuhi, jika tidak maka pasti muncul error."),(0,i.kt)("p",null,"Ok, selanjutnya mari kita test aturan tersebut."),(0,i.kt)("h2",{id:"a354-borrowing-mutableimmutable-reference"},"A.35.4. Borrowing mutable/immutable reference"),(0,i.kt)("h3",{id:"-contoh-ke-1"},"\u25c9 Contoh ke-1"),(0,i.kt)("p",null,"Pada contoh berikut kita simulasikan 1 data memiliki banyak immutable reference. Jika mengacu ke aturan di atas, maka hal seperti ini adalah boleh dan tidak menghasilkan error."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let msg_5 = String::from("hello rust");\n\nlet msg_6 = &msg_5;\nlet msg_7 = &msg_5;\nlet msg_8 = &msg_5;\n\nprintln!("{:?} {:?} {:?}", msg_6, msg_7, msg_8);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Borrowing",src:n(9470).Z,width:"470",height:"301"})),(0,i.kt)("h3",{id:"-contoh-ke-2"},"\u25c9 Contoh ke-2"),(0,i.kt)("p",null,"Pada contoh ke-2 ini, kita coba simulasikan 1 data memiliki 1 mutable reference. Harusnya tidak muncul error karena diperbolehkan di aturan yang tertulis."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut msg_9 = String::from("hello rust");\n\nlet msg_10 = &mut msg_9;\n\nprintln!("{:?}", msg_10);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Borrowing",src:n(5982).Z,width:"497",height:"272"})),(0,i.kt)("p",null,"Bagaimana jika ada lebih dari 1 mutable reference? mari kita test."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut msg_9 = String::from("hello rust");\n\nlet msg_10 = &mut msg_9;\nlet msg_11 = &mut msg_9;\n\nprintln!("{:?} {:?}", msg_10, msg_11);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Borrowing",src:n(8301).Z,width:"652",height:"613"})),(0,i.kt)("p",null,"Hasilnya error. Hal seperti ini tidak diperbolehkan. Sebuah data tidak boleh memiliki lebih dari 1 mutable reference."),(0,i.kt)("h3",{id:"-contoh-ke-3"},"\u25c9 Contoh ke-3"),(0,i.kt)("p",null,"Sekarang mari kita coba test lagi aturan di atas dengan skenario: dalam waktu yang sama, 1 data memiliki 1 mutable reference dan 1 immutable reference. Hasilnya seperti apa, (jika mengacu ke aturan, hal seperti ini adalah tidak diperbolehkan)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut msg_12 = String::from("hello rust");\n\nlet msg_13 = &msg_12;\nlet msg_14 = &mut msg_12;\n\nprintln!("{:?} {:?}", msg_13, msg_14);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Borrowing",src:n(6389).Z,width:"652",height:"486"})),(0,i.kt)("p",null,"Hasilnya error, kenapa? karena memang tidak boleh."),(0,i.kt)("p",null,"Jadi sampai sini cukup jelas ya. Sebuah data dalam waktu yang sama hanya diperbolehkan memiliki satu atau lebih immutable reference, atau hanya 1 mutable reference, dan keduanya tidak bisa bersamaan dalam satu waktu (harus pilih salah satu)."),(0,i.kt)("h2",{id:"a355-borrowing-validinvalid-reference"},"A.35.5. Borrowing valid/invalid reference"),(0,i.kt)("p",null,"Kita telah belajar tentang ",(0,i.kt)("a",{parentName:"p",href:"/basic/ownership#a333-variable-scope"},"valid/invalid variable dan juga variable scope")," pada chapter sebelumnya. Sekarang kita akan coba gabungkan dua aspek tersebut dengan borrowing."),(0,i.kt)("p",null,"Silakan praktikkan kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let mut fact_one = String::from("Arthas is the true lich king");\n\n change_value(&mut fact_one);\n\n let fact_two = &mut fact_one;\n println!("{:?}", fact_two);\n}\n\nfn change_value(txt: &mut String) {\n *txt = String::from("Bolvar is better lich king");\n}\n')),(0,i.kt)("p",null,"Pada kode di atas, ada satu buah mutable string bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"fact_one"),". String tersebut dipinjam menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut")," (yang berarti adalah mutable borrow) sebagai argumen pemanggilan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"change_value")," yang isinya kurang lebih adalah perubahan isi data string pada variabel pointer."),(0,i.kt)("p",null,"Kemudian, ada operasi peminjaman lagi (yang juga mutable borrow) dari variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"fact_one")," ke ",(0,i.kt)("inlineCode",{parentName:"p"},"fact_one"),"."),(0,i.kt)("p",null,"Ketika program di-run, hasilnya sukses. Kok bisa? padahal jelas di aturan tertulis bahwa dalam waktu yang sama tidak boleh ada lebih dari satu mutable borrow."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Borrowing",src:n(538).Z,width:"449",height:"88"})),(0,i.kt)("p",null,"Kata ",(0,i.kt)("strong",{parentName:"p"},"dalam waktu yang sama")," di sini adalah yang penting untuk dipahami. Arti ",(0,i.kt)("em",{parentName:"p"},"dalam waktu yang sama")," adalah dalam 1 scope yang sama. Jika ada 2 scope, maka itu sudah bukan dalam waktu yang sama lagi."),(0,i.kt)("p",null,"Pada contoh di atas, statement ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut fact_one")," terjadi pada block fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"change_value"),", lebih tepatnya pada parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"txt")," fungsi tersebut."),(0,i.kt)("p",null,"Kemudian setelah eksekusi fungsi tersebut selesai, yang terjadi adalah: reference yang tadinya dipinjam, sekarang dikembalikan. Tepat setelah eksekusi fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"change_value"),", state data ",(0,i.kt)("inlineCode",{parentName:"p"},"fact_one")," adalah tidak dipinjam siapapun. Tadinya memang ada yang meminjam (yaitu parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"txt")," di fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"change_value"),"), tapi setelah eksekusi fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"change_value")," selesai, data dikembalikan lagi ke owner."),(0,i.kt)("p",null,"Proses dealokasi pada variable scope, jika terjadi pada variable reference maka yang sebenarnya terjadi adalah pengembalian data hasil operasi borrow ke pemilik aslinya."),(0,i.kt)("p",null,"Kemudian, ada operasi pinjam lagi, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"let fact_two = &mut fact_one"),". Statement borrow ini tidak menghasilkan error karena memang kondisi data ",(0,i.kt)("inlineCode",{parentName:"p"},"fact_one")," sudah tidak ada yang meminjam. Bisa dibilang statement peminjaman ke-2 ini tidak terjadi dalam waktu yang sama dengan statement peminjaman pertama (pemanggilan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"change_value"),")."),(0,i.kt)("p",null,"Pada fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"change_value"),", variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"txt")," adalah valid saat fungsi dijalankan. Setelah pemanggilan fungsi selesai, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"txt")," di-dealokasi. Namun karena variabel tersebut bukanlah owner, melainkan hanya borrower yang meminjam data dari owner ",(0,i.kt)("inlineCode",{parentName:"p"},"fact_one"),", maka yang terjadi adalah: data yang dipinjam sekarang dikembalikan lagi ke pemilik aslinya."),(0,i.kt)("p",null,"Ok sampai sini semoga cukup jelas ya. Jika perlu silakan ulang-ulang penjelasan di atas."),(0,i.kt)("h2",{id:"a356-borrowing-pada-block"},"A.35.6. Borrowing pada block"),(0,i.kt)("p",null,"Kita sudah cukup paham kapan waktu terjadinya alokasi alamat memory dan juga kapan proses dealokasi terjadi, yaitu ketika variabel ",(0,i.kt)("strong",{parentName:"p"},"into scope")," dan ketika variabel ",(0,i.kt)("strong",{parentName:"p"},"out of scope"),"."),(0,i.kt)("p",null,"Scope di sini adalah variable scope, yang maksudnya adalah block scope, bisa berupa block expression, fungsi, block seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"if"),", dan juga jenis block lainnya."),(0,i.kt)("p",null,"Ok, sekarang mari kita praktikkan beberapa jenis block untuk isolasi operasi borrowing. Dengan ini maka klausul ",(0,i.kt)("strong",{parentName:"p"},"dalam satu waktu")," akan terpenuhi."),(0,i.kt)("p",null,"Silakan modifikasi program sebelumnya menjadi seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let mut fact_one = String::from("Arthas is the true lich king");\n println!("{:?}", fact_one);\n\n change_value(&mut fact_one);\n println!("{:?}", fact_one);\n\n {\n let fact_two = &mut fact_one;\n *fact_two = String::from("There must always be a lich king");\n println!("{:?}", fact_one);\n }\n\n if fact_one.contains("lich king") {\n let fact_three = &mut fact_one;\n *fact_three = String::from("Who is the real jailer?");\n println!("{:?}", fact_one);\n }\n\n for _ in 0..1 {\n let fact_four = &mut fact_one;\n *fact_four = String::from("Is it Zovaal or Primus?");\n println!("{:?}", fact_one);\n }\n}\n\nfn change_value(txt: &mut String) {\n *txt = String::from("Bolvar is better lich king");\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Borrowing",src:n(2751).Z,width:"459",height:"175"})),(0,i.kt)("p",null,"Bisa dilihat, hasilnya tidak error, meskipun terjadi beberapa kali operasi mutable borrow, tapi karena kesemuanya terjadi di waktu yang berbeda (di scope yang berbeda) maka tidak error."),(0,i.kt)("p",null,"Pada kode di atas, mutable borrow terjadi di banyak tempat, yaitu di block fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"change_value"),", block expression, block seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"if"),", dan juga block perulangan ",(0,i.kt)("inlineCode",{parentName:"p"},"for"),". Variabel pointer yang menampung data pinjaman akan valid di masing-masing block, kemudian menjadi invalid setelah eksekusi block selesai, dan yang terjadi setelah itu adalah pengembalian data yang telah dipinjam."),(0,i.kt)("h3",{id:"-method-contains-milik-string"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"contains")," milik ",(0,i.kt)("inlineCode",{parentName:"h3"},"String")),(0,i.kt)("p",null,"Pada contoh di atas kita menerapkan method baru bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"contains"),". Method ini tersedia untuk tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),", gunanya adalah untuk mengecek apakah string memiliki substring ",(0,i.kt)("inlineCode",{parentName:"p"},"x"),", yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," sendiri adalah argumen pemanggilan method. Method ini mengembalikan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"bool"),"."),(0,i.kt)("p",null,"Contoh penerapan method ",(0,i.kt)("inlineCode",{parentName:"p"},"contains"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let fact = String::from("There must always be a lich king");\nprintln!("{:?}", fact.contains("lich king")); // output => true\nprintln!("{:?}", fact.contains("bolvar")); // output => false\n')),(0,i.kt)("p",null,"O iya, pengecekan string-nya adalah case sensitive ya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let fact = String::from("There must always be a lich king");\nprintln!("{:?}", fact.contains("lich king")); // output => true\nprintln!("{:?}", fact.contains("Lich King")); // output => false\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai tipe data string dan method yang tersedia pada tipe tersebut akan dibahas terpisah pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/string-slice-vs-string-literal"},"Tipe Data \u279c String Custom Type vs &str"),".")),(0,i.kt)("h2",{id:"a357-owner-dan-borrower-data-literal"},"A.35.7. Owner dan borrower data literal"),(0,i.kt)("p",null,"Perhatikan statement berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let number = 12;\nlet a = &number;\n\nlet text = String::from("hello");\nlet b = &text;\n')),(0,i.kt)("p",null,"Pada kode di atas, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"text")," adalah ",(0,i.kt)("em",{parentName:"p"},"owner")," data masing-masing. Sedangkan variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"a")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"b")," adalah ",(0,i.kt)("em",{parentName:"p"},"borrower")," atau peminjam data (yang lebih jelasnya akan dibahas pada chapter ). Sampai sini penulis rasa cukup jelas."),(0,i.kt)("p",null,"Selanjutnya, bagaimana dengan contoh ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let c = &24;\nlet d = &false;\nlet e = &String::from("rust");\n')),(0,i.kt)("p",null,"Ketiga variabel, semuanya adalah ",(0,i.kt)("em",{parentName:"p"},"borrower")," atau peminjam data. Lalu siapa ",(0,i.kt)("em",{parentName:"p"},"owner"),"-nya? jawabannya adalah tidak ada, atau silakan juga simpulkan bawah data tersebut owner-nya adalah program."),(0,i.kt)("p",null,"Yang lebih penting untuk diurusi pada contoh di atas bukan siapa owner-nya, melainkan bagaimana caranya agar data pinjaman tersebut tidak di-dealokasi saat block kode selesai."),(0,i.kt)("p",null,"Untuk sekarang sampai sini dulu. Kita akan bahas topik ini lebih mendetail pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/static"},"Static item")," dan ",(0,i.kt)("a",{parentName:"p",href:"/basic/lifetime"},"Lifetime"),"."),(0,i.kt)("h2",{id:"a358-borrowing-pada-macro-println"},"A.35.8. Borrowing pada macro ",(0,i.kt)("inlineCode",{parentName:"h2"},"println")),(0,i.kt)("p",null,"Pada pemanggilan macro println untuk menampilkan data yang mengadopsi ",(0,i.kt)("em",{parentName:"p"},"move semantics"),", operasi borrowing tidak perlu dilakukan sewaktu pengisian argument. Karena macro tersebut secara cerdas akan melakukan opearsi peminjaman tanpa memindah owner-nya. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let str1 = String::from("luwe");\nprintln!("{:?}", str1);\n')),(0,i.kt)("p",null,"... adalah ekuivalen dengan ..."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let str2 = String::from("ngelak");\nprintln!("{:?}", &str2);\n')),(0,i.kt)("p",null,"Lebih jelasnya mengenai macro dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/macro"},"Macro"),"."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/borrowing"},"github.com/novalagung/dasarpemrogramanrust-example/../borrowing")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("p",null,"Beberapa referensi terkait chapter ini:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html"},"https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/57225055/in-rust-can-you-own-a-string-literal"},"https://stackoverflow.com/questions/57225055/in-rust-can-you-own-a-string-literal"))))}p.isMDXComponent=!0},9470:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/borrowing-1-6abee77c6350f8a390a807adac852003.png"},5982:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/borrowing-2-cf66c8ef1c4b76c209f6d8c7d3339a3f.png"},8301:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/borrowing-3-55cc0f7a0b551f62c748a9bf0396a671.png"},6389:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/borrowing-4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bxFaBeEleth/W7ZBWtqx3e2zWUHltV3vMxTO1svt9AWZ1+BsCpLirDRBRmWGBQdzSEsQnuLYRFCCEFYhBCCsAghBGERQghBWIQQgrAIIQRhEUIIQViEEIKwCCEEYRFCCEFYhBCCsAghdN/6P7tjVzmYr81GAAAAAElFTkSuQmCC"}}]); \ No newline at end of file diff --git a/assets/js/fb18633e.f01566da.js b/assets/js/fb18633e.f01566da.js new file mode 100644 index 00000000..64192880 --- /dev/null +++ b/assets/js/fb18633e.f01566da.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[7310],{3905:(a,e,n)=>{n.d(e,{Zo:()=>m,kt:()=>k});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function o(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},r=Object.keys(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var s=t.createContext({}),u=function(a){var e=t.useContext(s),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},m=function(a){var e=u(a.components);return t.createElement(s.Provider,{value:e},a.children)},p={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},d=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,r=a.originalType,s=a.parentName,m=o(a,["components","mdxType","originalType","parentName"]),d=u(n),k=i,g=d["".concat(s,".").concat(k)]||d[k]||p[k]||r;return n?t.createElement(g,l(l({ref:e},m),{},{components:n})):t.createElement(g,l({ref:e},m))}));function k(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=n.length,l=new Array(r);l[0]=d;var o={};for(var s in e)hasOwnProperty.call(e,s)&&(o[s]=e[s]);o.originalType=a,o.mdxType="string"==typeof a?a:i,l[1]=o;for(var u=2;u<r;u++)l[u]=n[u];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}d.displayName="MDXCreateElement"},5555:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>s,contentTitle:()=>l,default:()=>p,frontMatter:()=>r,metadata:()=>o,toc:()=>u});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:35,title:"A.35. Borrowing",sidebar_label:"A.35. Borrowing"},l=void 0,o={unversionedId:"basic/borrowing",id:"basic/borrowing",title:"A.35. Borrowing",description:"Pada chapter ini kita akan belajar tentang apa itu borrowing dalam Rust programming.",source:"@site/docs/basic/borrowing.md",sourceDirName:"basic",slug:"/basic/borrowing",permalink:"/basic/borrowing",draft:!1,tags:[],version:"current",sidebarPosition:35,frontMatter:{sidebar_position:35,title:"A.35. Borrowing",sidebar_label:"A.35. Borrowing"},sidebar:"tutorialSidebar",previous:{title:"A.34. Ownership",permalink:"/basic/ownership"},next:{title:"A.36. Traits",permalink:"/basic/traits"}},s={},u=[{value:"A.35.1. Konsep borrowing",id:"a351-konsep-borrowing",level:2},{value:"A.35.2. Rust Borrow Checker",id:"a352-rust-borrow-checker",level:2},{value:"A.35.3. Aturan borrowing",id:"a353-aturan-borrowing",level:2},{value:"A.35.4. Borrowing mutable/immutable reference",id:"a354-borrowing-mutableimmutable-reference",level:2},{value:"\u25c9 Contoh ke-1",id:"-contoh-ke-1",level:3},{value:"\u25c9 Contoh ke-2",id:"-contoh-ke-2",level:3},{value:"\u25c9 Contoh ke-3",id:"-contoh-ke-3",level:3},{value:"A.35.5. Borrowing valid/invalid reference",id:"a355-borrowing-validinvalid-reference",level:2},{value:"A.35.6. Borrowing pada block",id:"a356-borrowing-pada-block",level:2},{value:"\u25c9 Method <code>contains</code> milik <code>String</code>",id:"-method-contains-milik-string",level:3},{value:"A.35.7. Owner dan borrower data literal",id:"a357-owner-dan-borrower-data-literal",level:2},{value:"A.35.8. Borrowing pada macro <code>println</code>",id:"a358-borrowing-pada-macro-println",level:2},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],m={toc:u};function p(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,t.Z)({},m,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan belajar tentang apa itu borrowing dalam Rust programming."),(0,i.kt)("p",null,"Sebelum masuk ke pembelajaran, penulis anjurkan untuk paham terlebih dahulu tentang ",(0,i.kt)("a",{parentName:"p",href:"/basic/basic-memory-management"},"Basic Memory Management"),", ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"),", dan juga konsep ",(0,i.kt)("a",{parentName:"p",href:"/basic/ownership"},"Ownership"),". Ketiga topik tersebut dipelajari pada chapter sebelum ini."),(0,i.kt)("h2",{id:"a351-konsep-borrowing"},"A.35.1. Konsep borrowing"),(0,i.kt)("p",null,"Pada chapter sebelumnya kita telah belajar bahwa tipe data yang mengadopsi ",(0,i.kt)("em",{parentName:"p"},"move semantics")," (seperti ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),"), ketika digunakan pada operasi assignment maka owner-nya berpindah. Variabel yang sebelumnya adalah owner, setelah proses assignment menjadi invalid, karena owner data tersebut telah berpindah ke variabel baru. Efeknya, semua operasi yang dilakukan pada variabel owner sebelumnya menghasilkan error."),(0,i.kt)("p",null,"Sekarang perhatikan kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let msg_1 = String::from("hello");\nlet msg_2 = msg_1;\n\nprintln!("{:?}", msg_2);\nprintln!("{:?}", msg_1);\n')),(0,i.kt)("p",null,"Pada contoh di atas, statement print ",(0,i.kt)("inlineCode",{parentName:"p"},"msg_1")," menghasilkan error karena variabel tersebut telah invalid setelah statement ",(0,i.kt)("inlineCode",{parentName:"p"},"let msg_2 = msg_1"),"."),(0,i.kt)("p",null,"Programmer harus ekstra hati-hati dan bijak dalam pengelolaan owner data, agar memory ter-manage dengan baik. Tapi kalau dipikir-pikir, repot juga kalau owner harus dilempar-lempar setiap selesai digunakan agar tidak error."),(0,i.kt)("p",null,"Salah satu cara yang bisa digunakan agar tidak terlalu repot adalah dengan menerapkan cloning (seperti yang sudah dibahas pada chapter sebelumnya). Namun ini bukan opsi yang baik karena boros memory, sedangkan di sisi lain programmer dianjurkan untuk efisien dalam penggunaan memory."),(0,i.kt)("p",null,"Solusi yang paling pas adalah dengan menerapkan ",(0,i.kt)("strong",{parentName:"p"},"borrowing"),". Borrowing artinya adalah meminjam. Pada konteks Rust programming, borrowing berarti meminjam data milik owner, dipinjam agar bisa diakses tanpa perlu memindah owner-nya. Kemudian setelah peminjaman selesai, data dikembalikan."),(0,i.kt)("p",null,"Cara meminjam data di Rust sangat mudah, yaitu:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Untuk borrowing dengan level akses immutable/read-only, gunakan operator reference ",(0,i.kt)("inlineCode",{parentName:"p"},"&")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let msg_3 = String::from("hello rust");\nlet msg_4 = &msg_3; // <----- borrow operation\n\nprintln!("{:?}", msg_4); // output => hello rust\nprintln!("{:?}", msg_3); // output => hello rust\n'))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Untuk borrowing dengan level akses mutable, gunakan operator reference ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut msg_3 = String::from("hello");\nlet msg_4 = &mut msg_3; // <----- mutable borrow operation\n\n*msg_4 = String::from("hello rust");\n\nprintln!("{:?}", msg_4); // output => hello rust\nprintln!("{:?}", msg_3); // output => hello rust\n')))),(0,i.kt)("p",null,"Di Rust, semua statement reference (baik mutable ataupun immutable) adalah operasi ",(0,i.kt)("em",{parentName:"p"},"borrowing"),". Yang terjadi pada statement reference adalah data milik owner dipinjam dalam bentuk pointer. Pointer itu sendiri merupakan alamat memory yang mengarah ke data sebenarnya (milik owner)."),(0,i.kt)("p",null,"Dari contoh di atas, bisa ditarik kesimpulan bahwa data string ",(0,i.kt)("inlineCode",{parentName:"p"},"hello rust")," memiliki dua reference:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Yang pertama adalah owner data, yaitu variabel ",(0,i.kt)("inlineCode",{parentName:"li"},"msg_3")),(0,i.kt)("li",{parentName:"ul"},"Yang kedua adalah peminjam data, yaitu variabel pointer ",(0,i.kt)("inlineCode",{parentName:"li"},"msg_4"))),(0,i.kt)("h2",{id:"a352-rust-borrow-checker"},"A.35.2. Rust Borrow Checker"),(0,i.kt)("p",null,"Rust compiler memiliki 1 bagian bernama ",(0,i.kt)("strong",{parentName:"p"},"borrow checker"),", tugasnya untuk melakukan pengecekan pada source code apakah ada kode yang berhubungan dengan ownership dan borrowing, dan apakah kode tersebut mengikuti aturan borrowing yang sudah ditetapkan oleh Rust, atau tidak. Jika ada yang menyalahi aturan, maka borrow checker memunculkan error."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Borrow checker sangat galak, pastikan kode yang ditulis mengikuti aturan yang berlaku di pemrograman Rust.")),(0,i.kt)("h2",{id:"a353-aturan-borrowing"},"A.35.3. Aturan borrowing"),(0,i.kt)("p",null,"Aturan borrowing atau reference sempat disinggung pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/pointer-references"},"Pointer & References"),", yang kurang lebih adalah:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Dalam waktu yang sama, hanya boleh ada satu mutable reference atau banyak immutable reference (keduanya tidak bisa bersamaan, harus salah satu)."),(0,i.kt)("li",{parentName:"ul"},"Reference harus selalu valid.")),(0,i.kt)("p",null,"Dua aturan tersebut wajib dipatuhi, jika tidak maka pasti muncul error."),(0,i.kt)("p",null,"Ok, selanjutnya mari kita test aturan tersebut."),(0,i.kt)("h2",{id:"a354-borrowing-mutableimmutable-reference"},"A.35.4. Borrowing mutable/immutable reference"),(0,i.kt)("h3",{id:"-contoh-ke-1"},"\u25c9 Contoh ke-1"),(0,i.kt)("p",null,"Pada contoh berikut kita simulasikan 1 data memiliki banyak immutable reference. Jika mengacu ke aturan di atas, maka hal seperti ini adalah boleh dan tidak menghasilkan error."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let msg_5 = String::from("hello rust");\n\nlet msg_6 = &msg_5;\nlet msg_7 = &msg_5;\nlet msg_8 = &msg_5;\n\nprintln!("{:?} {:?} {:?}", msg_6, msg_7, msg_8);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Borrowing",src:n(9470).Z,width:"470",height:"301"})),(0,i.kt)("h3",{id:"-contoh-ke-2"},"\u25c9 Contoh ke-2"),(0,i.kt)("p",null,"Pada contoh ke-2 ini, kita coba simulasikan 1 data memiliki 1 mutable reference. Harusnya tidak muncul error karena diperbolehkan di aturan yang tertulis."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut msg_9 = String::from("hello rust");\n\nlet msg_10 = &mut msg_9;\n\nprintln!("{:?}", msg_10);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Borrowing",src:n(5982).Z,width:"497",height:"272"})),(0,i.kt)("p",null,"Bagaimana jika ada lebih dari 1 mutable reference? mari kita test."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut msg_9 = String::from("hello rust");\n\nlet msg_10 = &mut msg_9;\nlet msg_11 = &mut msg_9;\n\nprintln!("{:?} {:?}", msg_10, msg_11);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Borrowing",src:n(8301).Z,width:"652",height:"613"})),(0,i.kt)("p",null,"Hasilnya error. Hal seperti ini tidak diperbolehkan. Sebuah data tidak boleh memiliki lebih dari 1 mutable reference."),(0,i.kt)("h3",{id:"-contoh-ke-3"},"\u25c9 Contoh ke-3"),(0,i.kt)("p",null,"Sekarang mari kita coba test lagi aturan di atas dengan skenario: dalam waktu yang sama, 1 data memiliki 1 mutable reference dan 1 immutable reference. Hasilnya seperti apa, (jika mengacu ke aturan, hal seperti ini adalah tidak diperbolehkan)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let mut msg_12 = String::from("hello rust");\n\nlet msg_13 = &msg_12;\nlet msg_14 = &mut msg_12;\n\nprintln!("{:?} {:?}", msg_13, msg_14);\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Borrowing",src:n(6389).Z,width:"652",height:"486"})),(0,i.kt)("p",null,"Hasilnya error, kenapa? karena memang tidak boleh."),(0,i.kt)("p",null,"Jadi sampai sini cukup jelas ya. Sebuah data dalam waktu yang sama hanya diperbolehkan memiliki satu atau lebih immutable reference, atau hanya 1 mutable reference, dan keduanya tidak bisa bersamaan dalam satu waktu (harus pilih salah satu)."),(0,i.kt)("h2",{id:"a355-borrowing-validinvalid-reference"},"A.35.5. Borrowing valid/invalid reference"),(0,i.kt)("p",null,"Kita telah belajar tentang ",(0,i.kt)("a",{parentName:"p",href:"/basic/ownership#a333-variable-scope"},"valid/invalid variable dan juga variable scope")," pada chapter sebelumnya. Sekarang kita akan coba gabungkan dua aspek tersebut dengan borrowing."),(0,i.kt)("p",null,"Silakan praktikkan kode berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let mut fact_one = String::from("Arthas is the true lich king");\n\n change_value(&mut fact_one);\n\n let fact_two = &mut fact_one;\n println!("{:?}", fact_two);\n}\n\nfn change_value(txt: &mut String) {\n *txt = String::from("Bolvar is better lich king");\n}\n')),(0,i.kt)("p",null,"Pada kode di atas, ada satu buah mutable string bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"fact_one"),". String tersebut dipinjam menggunakan ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut")," (yang berarti adalah mutable borrow) sebagai argumen pemanggilan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"change_value")," yang isinya kurang lebih adalah perubahan isi data string pada variabel pointer."),(0,i.kt)("p",null,"Kemudian, ada operasi peminjaman lagi (yang juga mutable borrow) dari variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"fact_one")," ke ",(0,i.kt)("inlineCode",{parentName:"p"},"fact_one"),"."),(0,i.kt)("p",null,"Ketika program di-run, hasilnya sukses. Kok bisa? padahal jelas di aturan tertulis bahwa dalam waktu yang sama tidak boleh ada lebih dari satu mutable borrow."),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Borrowing",src:n(538).Z,width:"449",height:"88"})),(0,i.kt)("p",null,"Kata ",(0,i.kt)("strong",{parentName:"p"},"dalam waktu yang sama")," di sini adalah yang penting untuk dipahami. Arti ",(0,i.kt)("em",{parentName:"p"},"dalam waktu yang sama")," adalah dalam 1 scope yang sama. Jika ada 2 scope, maka itu sudah bukan dalam waktu yang sama lagi."),(0,i.kt)("p",null,"Pada contoh di atas, statement ",(0,i.kt)("inlineCode",{parentName:"p"},"&mut fact_one")," terjadi pada block fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"change_value"),", lebih tepatnya pada parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"txt")," fungsi tersebut."),(0,i.kt)("p",null,"Kemudian setelah eksekusi fungsi tersebut selesai, yang terjadi adalah: reference yang tadinya dipinjam, sekarang dikembalikan. Tepat setelah eksekusi fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"change_value"),", state data ",(0,i.kt)("inlineCode",{parentName:"p"},"fact_one")," adalah tidak dipinjam siapapun. Tadinya memang ada yang meminjam (yaitu parameter ",(0,i.kt)("inlineCode",{parentName:"p"},"txt")," di fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"change_value"),"), tapi setelah eksekusi fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"change_value")," selesai, data dikembalikan lagi ke owner."),(0,i.kt)("p",null,"Proses dealokasi pada variable scope, jika terjadi pada variable reference maka yang sebenarnya terjadi adalah pengembalian data hasil operasi borrow ke pemilik aslinya."),(0,i.kt)("p",null,"Kemudian, ada operasi pinjam lagi, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"let fact_two = &mut fact_one"),". Statement borrow ini tidak menghasilkan error karena memang kondisi data ",(0,i.kt)("inlineCode",{parentName:"p"},"fact_one")," sudah tidak ada yang meminjam. Bisa dibilang statement peminjaman ke-2 ini tidak terjadi dalam waktu yang sama dengan statement peminjaman pertama (pemanggilan fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"change_value"),")."),(0,i.kt)("p",null,"Pada fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"change_value"),", variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"txt")," adalah valid saat fungsi dijalankan. Setelah pemanggilan fungsi selesai, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"txt")," di-dealokasi. Namun karena variabel tersebut bukanlah owner, melainkan hanya borrower yang meminjam data dari owner ",(0,i.kt)("inlineCode",{parentName:"p"},"fact_one"),", maka yang terjadi adalah: data yang dipinjam sekarang dikembalikan lagi ke pemilik aslinya."),(0,i.kt)("p",null,"Ok sampai sini semoga cukup jelas ya. Jika perlu silakan ulang-ulang penjelasan di atas."),(0,i.kt)("h2",{id:"a356-borrowing-pada-block"},"A.35.6. Borrowing pada block"),(0,i.kt)("p",null,"Kita sudah cukup paham kapan waktu terjadinya alokasi alamat memory dan juga kapan proses dealokasi terjadi, yaitu ketika variabel ",(0,i.kt)("strong",{parentName:"p"},"into scope")," dan ketika variabel ",(0,i.kt)("strong",{parentName:"p"},"out of scope"),"."),(0,i.kt)("p",null,"Scope di sini adalah variable scope, yang maksudnya adalah block scope, bisa berupa block expression, fungsi, block seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"if"),", dan juga jenis block lainnya."),(0,i.kt)("p",null,"Ok, sekarang mari kita praktikkan beberapa jenis block untuk isolasi operasi borrowing. Dengan ini maka klausul ",(0,i.kt)("strong",{parentName:"p"},"dalam satu waktu")," akan terpenuhi."),(0,i.kt)("p",null,"Silakan modifikasi program sebelumnya menjadi seperti berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let mut fact_one = String::from("Arthas is the true lich king");\n println!("{:?}", fact_one);\n\n change_value(&mut fact_one);\n println!("{:?}", fact_one);\n\n {\n let fact_two = &mut fact_one;\n *fact_two = String::from("There must always be a lich king");\n println!("{:?}", fact_one);\n }\n\n if fact_one.contains("lich king") {\n let fact_three = &mut fact_one;\n *fact_three = String::from("Who is the real jailer?");\n println!("{:?}", fact_one);\n }\n\n for _ in 0..1 {\n let fact_four = &mut fact_one;\n *fact_four = String::from("Is it Zovaal or Primus?");\n println!("{:?}", fact_one);\n }\n}\n\nfn change_value(txt: &mut String) {\n *txt = String::from("Bolvar is better lich king");\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Borrowing",src:n(2751).Z,width:"459",height:"175"})),(0,i.kt)("p",null,"Bisa dilihat, hasilnya tidak error, meskipun terjadi beberapa kali operasi mutable borrow, tapi karena kesemuanya terjadi di waktu yang berbeda (di scope yang berbeda) maka tidak error."),(0,i.kt)("p",null,"Pada kode di atas, mutable borrow terjadi di banyak tempat, yaitu di block fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"change_value"),", block expression, block seleksi kondisi ",(0,i.kt)("inlineCode",{parentName:"p"},"if"),", dan juga block perulangan ",(0,i.kt)("inlineCode",{parentName:"p"},"for"),". Variabel pointer yang menampung data pinjaman akan valid di masing-masing block, kemudian menjadi invalid setelah eksekusi block selesai, dan yang terjadi setelah itu adalah pengembalian data yang telah dipinjam."),(0,i.kt)("h3",{id:"-method-contains-milik-string"},"\u25c9 Method ",(0,i.kt)("inlineCode",{parentName:"h3"},"contains")," milik ",(0,i.kt)("inlineCode",{parentName:"h3"},"String")),(0,i.kt)("p",null,"Pada contoh di atas kita menerapkan method baru bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"contains"),". Method ini tersedia untuk tipe data ",(0,i.kt)("inlineCode",{parentName:"p"},"String"),", gunanya adalah untuk mengecek apakah string memiliki substring ",(0,i.kt)("inlineCode",{parentName:"p"},"x"),", yang mana ",(0,i.kt)("inlineCode",{parentName:"p"},"x")," sendiri adalah argumen pemanggilan method. Method ini mengembalikan nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"bool"),"."),(0,i.kt)("p",null,"Contoh penerapan method ",(0,i.kt)("inlineCode",{parentName:"p"},"contains"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let fact = String::from("There must always be a lich king");\nprintln!("{:?}", fact.contains("lich king")); // output => true\nprintln!("{:?}", fact.contains("bolvar")); // output => false\n')),(0,i.kt)("p",null,"O iya, pengecekan string-nya adalah case sensitive ya."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let fact = String::from("There must always be a lich king");\nprintln!("{:?}", fact.contains("lich king")); // output => true\nprintln!("{:?}", fact.contains("Lich King")); // output => false\n')),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Lebih jelasnya mengenai tipe data string dan method yang tersedia pada tipe tersebut akan dibahas terpisah pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/string-slice-vs-string-literal"},"Tipe Data \u279c String Custom Type vs &str"),".")),(0,i.kt)("h2",{id:"a357-owner-dan-borrower-data-literal"},"A.35.7. Owner dan borrower data literal"),(0,i.kt)("p",null,"Perhatikan statement berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let number = 12;\nlet a = &number;\n\nlet text = String::from("hello");\nlet b = &text;\n')),(0,i.kt)("p",null,"Pada kode di atas, variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"text")," adalah ",(0,i.kt)("em",{parentName:"p"},"owner")," data masing-masing. Sedangkan variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"a")," dan ",(0,i.kt)("inlineCode",{parentName:"p"},"b")," adalah ",(0,i.kt)("em",{parentName:"p"},"borrower")," atau peminjam data (yang lebih jelasnya akan dibahas pada chapter ). Sampai sini penulis rasa cukup jelas."),(0,i.kt)("p",null,"Selanjutnya, bagaimana dengan contoh ini:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let c = &24;\nlet d = &false;\nlet e = &String::from("rust");\n')),(0,i.kt)("p",null,"Ketiga variabel, semuanya adalah ",(0,i.kt)("em",{parentName:"p"},"borrower")," atau peminjam data. Lalu siapa ",(0,i.kt)("em",{parentName:"p"},"owner"),"-nya? jawabannya adalah tidak ada, atau silakan juga simpulkan bawah data tersebut owner-nya adalah program."),(0,i.kt)("p",null,"Yang lebih penting untuk diurusi pada contoh di atas bukan siapa owner-nya, melainkan bagaimana caranya agar data pinjaman tersebut tidak di-dealokasi saat block kode selesai."),(0,i.kt)("p",null,"Untuk sekarang sampai sini dulu. Kita akan bahas topik ini lebih mendetail pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/static"},"Static item")," dan ",(0,i.kt)("a",{parentName:"p",href:"/basic/lifetime"},"Lifetime"),"."),(0,i.kt)("h2",{id:"a358-borrowing-pada-macro-println"},"A.35.8. Borrowing pada macro ",(0,i.kt)("inlineCode",{parentName:"h2"},"println")),(0,i.kt)("p",null,"Pada pemanggilan macro println untuk menampilkan data yang mengadopsi ",(0,i.kt)("em",{parentName:"p"},"move semantics"),", operasi borrowing tidak perlu dilakukan sewaktu pengisian argument. Karena macro tersebut secara cerdas akan melakukan opearsi peminjaman tanpa memindah owner-nya. Contoh:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let str1 = String::from("luwe");\nprintln!("{:?}", str1);\n')),(0,i.kt)("p",null,"... adalah ekuivalen dengan ..."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'let str2 = String::from("ngelak");\nprintln!("{:?}", &str2);\n')),(0,i.kt)("p",null,"Lebih jelasnya mengenai macro dibahas pada chapter ",(0,i.kt)("a",{parentName:"p",href:"#/wip/macro"},"Macro"),"."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/borrowing"},"github.com/novalagung/dasarpemrogramanrust-example/../borrowing")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("p",null,"Beberapa referensi terkait chapter ini:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html"},"https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://stackoverflow.com/questions/57225055/in-rust-can-you-own-a-string-literal"},"https://stackoverflow.com/questions/57225055/in-rust-can-you-own-a-string-literal"))))}p.isMDXComponent=!0},9470:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/borrowing-1-6abee77c6350f8a390a807adac852003.png"},5982:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/borrowing-2-cf66c8ef1c4b76c209f6d8c7d3339a3f.png"},8301:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/borrowing-3-55cc0f7a0b551f62c748a9bf0396a671.png"},6389:(a,e,n)=>{n.d(e,{Z:()=>t});const t=n.p+"assets/images/borrowing-4-c806f4e6787a069015fe56b40e97b3ca.png"},538:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcEAAABYCAIAAAACx9uAAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG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y89L0hK0yt294xDTKQWX2bvjPSLXuJhfZBGo3X7K4lYS+/ycPFxMXRGuLH2Qn3+fyv741hbWFDvIrQHgnbGutJo8KGaCljSGb1HfFi2l06Wy+z0NZG4xW7awdhrcOjLI2D++DfF4uwlbLgwI3QrgnbgthlhM38ppX3VBy7ibQ9HwuoE9Y4e8l/0Dz+clDh8JSwkfdrjbAyGzhwI7T7WYIGt+ylhE12tay+wx/KztZLLLSNs7uLEz3pmg4pHD6bsOY1woEbof0TNkTGDCvYFiRlqxDsKdfBdzuYHc1Dw2UW2sbZmwgr50TXIGzTNUII7ZCwM822ndOAKt4yrb7PH2R4iaYtM2frhRba+uxXJ2zg5Z2fIP9gDbxFaBeEleth/W7ZBWtqx3e2zWUHltV3vMxTO1svt9AWZ1+BsCpLirDRBRmWGBQdzSEsQnuLYRFCCEFYhBCCsAghBGERQghBWIQQgrAIIQRhEUIIQViEEIKwCCEEYRFCCEFYhBCCsAghdN/6P7tjVzmYr81GAAAAAElFTkSuQmCC"}}]); \ No newline at end of file diff --git a/assets/js/fef7d16c.3a854bb7.js b/assets/js/fef7d16c.3a854bb7.js new file mode 100644 index 00000000..8dd287e3 --- /dev/null +++ b/assets/js/fef7d16c.3a854bb7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[5673],{3905:(a,e,n)=>{n.d(e,{Zo:()=>A,kt:()=>u});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function d(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},r=Object.keys(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var b=t.createContext({}),p=function(a){var e=t.useContext(b),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},A=function(a){var e=p(a.components);return t.createElement(b.Provider,{value:e},a.children)},o={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},m=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,r=a.originalType,b=a.parentName,A=d(a,["components","mdxType","originalType","parentName"]),m=p(n),u=i,c=m["".concat(b,".").concat(u)]||m[u]||o[u]||r;return n?t.createElement(c,l(l({ref:e},A),{},{components:n})):t.createElement(c,l({ref:e},A))}));function u(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=n.length,l=new Array(r);l[0]=m;var d={};for(var b in e)hasOwnProperty.call(e,b)&&(d[b]=e[b]);d.originalType=a,d.mdxType="string"==typeof a?a:i,l[1]=d;for(var p=2;p<r;p++)l[p]=n[p];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}m.displayName="MDXCreateElement"},2043:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>b,contentTitle:()=>l,default:()=>o,frontMatter:()=>r,metadata:()=>d,toc:()=>p});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:31,title:"A.31. Shadowing",sidebar_label:"A.31. Shadowing"},l=void 0,d={unversionedId:"basic/shadowing",id:"basic/shadowing",title:"A.31. Shadowing",description:"Pada chapter ini kita akan belajar tentang shadowing pada variable dan apa perbedaannya dibanding variable mutable.",source:"@site/docs/basic/shadowing.md",sourceDirName:"basic",slug:"/basic/shadowing",permalink:"/basic/shadowing",draft:!1,tags:[],version:"current",sidebarPosition:31,frontMatter:{sidebar_position:31,title:"A.31. Shadowing",sidebar_label:"A.31. Shadowing"},sidebar:"tutorialSidebar",previous:{title:"A.30. Block Expression",permalink:"/basic/block-expression"},next:{title:"A.32. Basic Memory Management",permalink:"/basic/basic-memory-management"}},b={},p=[{value:"A.31.1 Konsep variable shadowing",id:"a311-konsep-variable-shadowing",level:2},{value:"A.31.2 Shadowing pada block berbeda",id:"a312-shadowing-pada-block-berbeda",level:2},{value:"\u25c9 Variable <code>name</code>",id:"-variable-name",level:3},{value:"\u25c9 Variable <code>race</code>",id:"-variable-race",level:3},{value:"\u25c9 Variable <code>number</code>",id:"-variable-number",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],A={toc:p};function o(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,t.Z)({},A,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan belajar tentang shadowing pada variable dan apa perbedaannya dibanding variable mutable."),(0,i.kt)("h2",{id:"a311-konsep-variable-shadowing"},"A.31.1 Konsep variable shadowing"),(0,i.kt)("p",null,"Variable shadowing adalah istilah untuk variable yang dideklarasikan dalam sebuah block, yang variabel tersebut memiliki nama sama persis dengan variable pendahulunya (baik dalam scope yang sama ataupun variable lain yang berada di luar current scope)."),(0,i.kt)("p",null,"Penulis tekankan di sini, meskipun namanya sama, variabel-variabel tersebut dianggap variabel yang benar-benar berbeda oleh Rust, tipe datanya bisa jadi juga berbeda."),(0,i.kt)("p",null,"Ciri khas variable shadowing adalah deklarasi selalu menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"let"),". Contoh penerapannya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let some_data = "Hello";\n println!("{}", some_data);\n // output => Hello\n\n let some_data = 12;\n println!("{}", some_data);\n // output => 12\n\n let some_data = "Rust!";\n println!("{}", some_data);\n // output => Rust!\n\n let mut some_data = false;\n some_data = true;\n println!("{}", some_data);\n // output => true\n\n let some_data = 3.14;\n println!("{}", some_data);\n // output => 3.14\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"eager",fetchpriority:"high",alt:"Shadowing",src:n(119).Z,width:"457",height:"163"})),(0,i.kt)("p",null,"Bisa dilihat ada banyak variabel dengan nama ",(0,i.kt)("inlineCode",{parentName:"p"},"some_data")," dideklarasikan dalam block fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),". Kesemuanya dideklarasikan menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"let"),", ada yang immutable ada juga yang mutable."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Variable shadowing BERBEDA dengan variable mutable"),". Pada variable mutable, saat deklarasinya, di belakang layar terjadi proses alokasi alamat memory untuk menampung data, kemudian saat ada perubahan nilai, maka data yang baru disimpan ke alamat memory yang sama menggantikan data sebelumnya."),(0,i.kt)("p",null,"Pada variable shadowing, yang terjadi di balik layar adalah: ketika ada deklarasi variabel baru menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"let")," dan namanya sama, maka dianggap sebagai variabel baru, dan Rust akan mengalokasikan alamat memory baru untuk menampung data variable baru tersebut."),(0,i.kt)("p",null,"Lebih jelasnya mengenai memory management akan dibahas secara terpisah pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/basic-memory-management"},"Memory Management"),". Untuk sekarang mari lanjut pembahasan tentang variable shadowing."),(0,i.kt)("h2",{id:"a312-shadowing-pada-block-berbeda"},"A.31.2 Shadowing pada block berbeda"),(0,i.kt)("p",null,"Variable shadowing bisa terjadi dalam satu scope yang sama, bisa juga terjadi pada scope yang berbeda. Pada case ke-2 (scope yang berbeda), variabel baru hanya akan valid pada block scope itu saja, dan tidak mempengaruhi data variable di luar block."),(0,i.kt)("p",null,"Agar lebih jelas silakan pelajari contoh berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let name = "Orgrim Doomhammer";\n let mut race = "Orc";\n let mut number = 27;\n\n println!("{}\\t {}\\t {}", name, race, number);\n\n {\n let name = "Sylvanas Windrunner";\n race = "Undead";\n let number = 24;\n \n println!("{}\\t {}\\t {}", name, race, number);\n }\n \n println!("{}\\t {}\\t {}", name, race, number);\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{loading:"lazy",alt:"Block",src:n(3305).Z,width:"454",height:"126"})),(0,i.kt)("p",null,"Pada contoh di atas, ada 3 variabel dideklarasikan kemudian di-print, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"race"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"number"),". Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"name")," adalah immutable, dan 2 variable lainnya adalah mutable. Ok, kita akan bahas variable tersebut satu per satu."),(0,i.kt)("h3",{id:"-variable-name"},"\u25c9 Variable ",(0,i.kt)("inlineCode",{parentName:"h3"},"name")),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"name")," dideklarasikan dengan nilai awal adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Orgrim Doomhammer"),", kemudian diikuti block statement yang isinya adalah variable shadowing bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"name")," dengan value ",(0,i.kt)("inlineCode",{parentName:"p"},"Sylvanas Windrunner"),". Variabel tersebut ketika di-print dalam block, nilainya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Sylvanas Windrunner"),"."),(0,i.kt)("p",null,"Setelah eksekusi block selesai, apapun yang ada di-dalam block tersebut dianggap selesai, dan tidak mempengaruhi nilai di scope atasnya. Pada contoh, nilai variable ",(0,i.kt)("inlineCode",{parentName:"p"},"name")," setelah eksekusi block adalah tetap ",(0,i.kt)("inlineCode",{parentName:"p"},"Orgrim Doomhammer")," (tidak berubah menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"Sylvanas Windrunner"),")."),(0,i.kt)("h3",{id:"-variable-race"},"\u25c9 Variable ",(0,i.kt)("inlineCode",{parentName:"h3"},"race")),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"race")," dideklarasikan mutable dengan nilai awal ",(0,i.kt)("inlineCode",{parentName:"p"},"Orc"),". Di dalam block baru, variabel tersebut diubah nilainya. Perhatikan baik-baik statement ",(0,i.kt)("inlineCode",{parentName:"p"},'race = "Undead"'),", statement ini adalah perubahan nilai, bukan deklarasi variable shadowing. Efeknya apa? setelah block selesai dieksekusi, nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"race")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Undead")," karena memang sengaja diubah nilainya dari dalam block."),(0,i.kt)("p",null,"Penulis tekankan, variabel shadowing ciri khasnya adalah pasti diawali keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"let"),". Jika tidak ada keyword tersebut, maka statement adalah operasi perubahan nilai, bukan deklarasi variable shadowing."),(0,i.kt)("h3",{id:"-variable-number"},"\u25c9 Variable ",(0,i.kt)("inlineCode",{parentName:"h3"},"number")),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," dideklarasikan mutable dengan nilai awal ",(0,i.kt)("inlineCode",{parentName:"p"},"27"),". Kemudian pada block terjadi deklarasi variable shadowing ",(0,i.kt)("inlineCode",{parentName:"p"},"let number = 24"),". Meskipun variabel ini adalah mutable, yang terjadi di dalam block adalah variable shadowing karena statement diawali dengan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"let"),"."),(0,i.kt)("p",null,"Setelah eksekusi block selesai, nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," pada scope tidak berubah, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"27"),"."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/shadowing"},"github.com/novalagung/dasarpemrogramanrust-example/../shadowing")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/variable_bindings/scope.html"},"https://doc.rust-lang.org/rust-by-example/variable_bindings/scope.html"))))}o.isMDXComponent=!0},119:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAACjCAIAAABuRXKuAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvI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BFIDXEz3WStGFL957gL5QikGkt+txbUmsMAQssi1X3j0+oAtVzHHnjxEKSeJ1ITFtS5eUeoLFKD5uy8wi25IwcvAjbOevGeggn08R38p+Z97ofke91qx3ZSF+0yutc8o4TaCzMYYIuHq5nfg7H0NKTuy4KauQS0MlKj4K1poKI7cuB14XFO8lGO/P+7M9d/K41esLx+UaJpaaOUUIYBtni4kvl9GEsXQOpOLKgZkqDVkRq15t7TL7JhFm2KUvZ8IVI9k1AzUnuohcbX6sYooQwDbPFw+Zw7MZYugdRdWFAToqJtRqn9cD7e14lShw3UyyC1jlKlCYr0RhNSY3dkO1L3Yiy9GFLXtaD22gtERZucSxV6XDT5NTdS624j93ZtoxWpUkCZh9Q9GEuPvsHuyoI6ObWK0GJI9Vq8N5wPW2s+QQogtTdiFfMpbcxEauiOnDHw34ux9LgwdZcW1ISoaHWketFnOvYU1vv1GbNXw4BaR6q4FOz8ELhfuxtzBv6CO7IZqfGYdrvG0pms2qsF9TYeAkQgddSokHgAIQRSywwKCQgQQiC1AFT5+iRCCKQihBACqQghBFIRQgikIoQQAqkIIQRSEUIIpCKEEEhFCCEEUhFCCKQihNAJ6H8eyTFEAr61xQAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/fef7d16c.7198ddd5.js b/assets/js/fef7d16c.7198ddd5.js deleted file mode 100644 index ab8a6b25..00000000 --- a/assets/js/fef7d16c.7198ddd5.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[5673],{3905:(a,e,n)=>{n.d(e,{Zo:()=>A,kt:()=>u});var t=n(7294);function i(a,e,n){return e in a?Object.defineProperty(a,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[e]=n,a}function r(a,e){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),n.push.apply(n,t)}return n}function l(a){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(a,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(n,e))}))}return a}function d(a,e){if(null==a)return{};var n,t,i=function(a,e){if(null==a)return{};var n,t,i={},r=Object.keys(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||(i[n]=a[n]);return i}(a,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(t=0;t<r.length;t++)n=r[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(a,n)&&(i[n]=a[n])}return i}var b=t.createContext({}),p=function(a){var e=t.useContext(b),n=e;return a&&(n="function"==typeof a?a(e):l(l({},e),a)),n},A=function(a){var e=p(a.components);return t.createElement(b.Provider,{value:e},a.children)},m={inlineCode:"code",wrapper:function(a){var e=a.children;return t.createElement(t.Fragment,{},e)}},o=t.forwardRef((function(a,e){var n=a.components,i=a.mdxType,r=a.originalType,b=a.parentName,A=d(a,["components","mdxType","originalType","parentName"]),o=p(n),u=i,c=o["".concat(b,".").concat(u)]||o[u]||m[u]||r;return n?t.createElement(c,l(l({ref:e},A),{},{components:n})):t.createElement(c,l({ref:e},A))}));function u(a,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof a||i){var r=n.length,l=new Array(r);l[0]=o;var d={};for(var b in e)hasOwnProperty.call(e,b)&&(d[b]=e[b]);d.originalType=a,d.mdxType="string"==typeof a?a:i,l[1]=d;for(var p=2;p<r;p++)l[p]=n[p];return t.createElement.apply(null,l)}return t.createElement.apply(null,n)}o.displayName="MDXCreateElement"},2043:(a,e,n)=>{n.r(e),n.d(e,{assets:()=>b,contentTitle:()=>l,default:()=>m,frontMatter:()=>r,metadata:()=>d,toc:()=>p});var t=n(7462),i=(n(7294),n(3905));const r={sidebar_position:31,title:"A.31. Shadowing",sidebar_label:"A.31. Shadowing"},l=void 0,d={unversionedId:"basic/shadowing",id:"basic/shadowing",title:"A.31. Shadowing",description:"Pada chapter ini kita akan belajar tentang shadowing pada variable dan apa perbedaannya dibanding variable mutable.",source:"@site/docs/basic/shadowing.md",sourceDirName:"basic",slug:"/basic/shadowing",permalink:"/basic/shadowing",draft:!1,tags:[],version:"current",sidebarPosition:31,frontMatter:{sidebar_position:31,title:"A.31. Shadowing",sidebar_label:"A.31. Shadowing"},sidebar:"tutorialSidebar",previous:{title:"A.30. Block Expression",permalink:"/basic/block-expression"},next:{title:"A.32. Basic Memory Management",permalink:"/basic/basic-memory-management"}},b={},p=[{value:"A.31.1 Konsep variable shadowing",id:"a311-konsep-variable-shadowing",level:2},{value:"A.31.2 Shadowing pada block berbeda",id:"a312-shadowing-pada-block-berbeda",level:2},{value:"\u25c9 Variable <code>name</code>",id:"-variable-name",level:3},{value:"\u25c9 Variable <code>race</code>",id:"-variable-race",level:3},{value:"\u25c9 Variable <code>number</code>",id:"-variable-number",level:3},{value:"Catatan chapter \ud83d\udcd1",id:"catatan-chapter-",level:2},{value:"\u25c9 Source code praktik",id:"-source-code-praktik",level:3},{value:"\u25c9 Referensi",id:"-referensi",level:3}],A={toc:p};function m(a){let{components:e,...r}=a;return(0,i.kt)("wrapper",(0,t.Z)({},A,r,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pada chapter ini kita akan belajar tentang shadowing pada variable dan apa perbedaannya dibanding variable mutable."),(0,i.kt)("h2",{id:"a311-konsep-variable-shadowing"},"A.31.1 Konsep variable shadowing"),(0,i.kt)("p",null,"Variable shadowing adalah istilah untuk variable yang dideklarasikan dalam sebuah block, yang variabel tersebut memiliki nama sama persis dengan variable pendahulunya (baik dalam scope yang sama ataupun variable lain yang berada di luar current scope)."),(0,i.kt)("p",null,"Penulis tekankan di sini, meskipun namanya sama, variabel-variabel tersebut dianggap variabel yang benar-benar berbeda oleh Rust, tipe datanya bisa jadi juga berbeda."),(0,i.kt)("p",null,"Ciri khas variable shadowing adalah deklarasi selalu menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"let"),". Contoh penerapannya:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let some_data = "Hello";\n println!("{}", some_data);\n // output => Hello\n\n let some_data = 12;\n println!("{}", some_data);\n // output => 12\n\n let some_data = "Rust!";\n println!("{}", some_data);\n // output => Rust!\n\n let mut some_data = false;\n some_data = true;\n println!("{}", some_data);\n // output => true\n\n let some_data = 3.14;\n println!("{}", some_data);\n // output => 3.14\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Shadowing",src:n(119).Z,width:"457",height:"163"})),(0,i.kt)("p",null,"Bisa dilihat ada banyak variabel dengan nama ",(0,i.kt)("inlineCode",{parentName:"p"},"some_data")," dideklarasikan dalam block fungsi ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),". Kesemuanya dideklarasikan menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"let"),", ada yang immutable ada juga yang mutable."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Variable shadowing BERBEDA dengan variable mutable"),". Pada variable mutable, saat deklarasinya, di belakang layar terjadi proses alokasi alamat memory untuk menampung data, kemudian saat ada perubahan nilai, maka data yang baru disimpan ke alamat memory yang sama menggantikan data sebelumnya."),(0,i.kt)("p",null,"Pada variable shadowing, yang terjadi di balik layar adalah: ketika ada deklarasi variabel baru menggunakan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"let")," dan namanya sama, maka dianggap sebagai variabel baru, dan Rust akan mengalokasikan alamat memory baru untuk menampung data variable baru tersebut."),(0,i.kt)("p",null,"Lebih jelasnya mengenai memory management akan dibahas secara terpisah pada chapter ",(0,i.kt)("a",{parentName:"p",href:"/basic/basic-memory-management"},"Memory Management"),". Untuk sekarang mari lanjut pembahasan tentang variable shadowing."),(0,i.kt)("h2",{id:"a312-shadowing-pada-block-berbeda"},"A.31.2 Shadowing pada block berbeda"),(0,i.kt)("p",null,"Variable shadowing bisa terjadi dalam satu scope yang sama, bisa juga terjadi pada scope yang berbeda. Pada case ke-2 (scope yang berbeda), variabel baru hanya akan valid pada block scope itu saja, dan tidak mempengaruhi data variable di luar block."),(0,i.kt)("p",null,"Agar lebih jelas silakan pelajari contoh berikut:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n let name = "Orgrim Doomhammer";\n let mut race = "Orc";\n let mut number = 27;\n\n println!("{}\\t {}\\t {}", name, race, number);\n\n {\n let name = "Sylvanas Windrunner";\n race = "Undead";\n let number = 24;\n \n println!("{}\\t {}\\t {}", name, race, number);\n }\n \n println!("{}\\t {}\\t {}", name, race, number);\n}\n')),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Block",src:n(3305).Z,width:"454",height:"126"})),(0,i.kt)("p",null,"Pada contoh di atas, ada 3 variabel dideklarasikan kemudian di-print, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"race"),", dan ",(0,i.kt)("inlineCode",{parentName:"p"},"number"),". Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"name")," adalah immutable, dan 2 variable lainnya adalah mutable. Ok, kita akan bahas variable tersebut satu per satu."),(0,i.kt)("h3",{id:"-variable-name"},"\u25c9 Variable ",(0,i.kt)("inlineCode",{parentName:"h3"},"name")),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"name")," dideklarasikan dengan nilai awal adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Orgrim Doomhammer"),", kemudian diikuti block statement yang isinya adalah variable shadowing bernama ",(0,i.kt)("inlineCode",{parentName:"p"},"name")," dengan value ",(0,i.kt)("inlineCode",{parentName:"p"},"Sylvanas Windrunner"),". Variabel tersebut ketika di-print dalam block, nilainya adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Sylvanas Windrunner"),"."),(0,i.kt)("p",null,"Setelah eksekusi block selesai, apapun yang ada di-dalam block tersebut dianggap selesai, dan tidak mempengaruhi nilai di scope atasnya. Pada contoh, nilai variable ",(0,i.kt)("inlineCode",{parentName:"p"},"name")," setelah eksekusi block adalah tetap ",(0,i.kt)("inlineCode",{parentName:"p"},"Orgrim Doomhammer")," (tidak berubah menjadi ",(0,i.kt)("inlineCode",{parentName:"p"},"Sylvanas Windrunner"),")."),(0,i.kt)("h3",{id:"-variable-race"},"\u25c9 Variable ",(0,i.kt)("inlineCode",{parentName:"h3"},"race")),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"race")," dideklarasikan mutable dengan nilai awal ",(0,i.kt)("inlineCode",{parentName:"p"},"Orc"),". Di dalam block baru, variabel tersebut diubah nilainya. Perhatikan baik-baik statement ",(0,i.kt)("inlineCode",{parentName:"p"},'race = "Undead"'),", statement ini adalah perubahan nilai, bukan deklarasi variable shadowing. Efeknya apa? setelah block selesai dieksekusi, nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"race")," adalah ",(0,i.kt)("inlineCode",{parentName:"p"},"Undead")," karena memang sengaja diubah nilainya dari dalam block."),(0,i.kt)("p",null,"Penulis tekankan, variabel shadowing ciri khasnya adalah pasti diawali keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"let"),". Jika tidak ada keyword tersebut, maka statement adalah operasi perubahan nilai, bukan deklarasi variable shadowing."),(0,i.kt)("h3",{id:"-variable-number"},"\u25c9 Variable ",(0,i.kt)("inlineCode",{parentName:"h3"},"number")),(0,i.kt)("p",null,"Variabel ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," dideklarasikan mutable dengan nilai awal ",(0,i.kt)("inlineCode",{parentName:"p"},"27"),". Kemudian pada block terjadi deklarasi variable shadowing ",(0,i.kt)("inlineCode",{parentName:"p"},"let number = 24"),". Meskipun variabel ini adalah mutable, yang terjadi di dalam block adalah variable shadowing karena statement diawali dengan keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"let"),"."),(0,i.kt)("p",null,"Setelah eksekusi block selesai, nilai ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," pada scope tidak berubah, yaitu ",(0,i.kt)("inlineCode",{parentName:"p"},"27"),"."),(0,i.kt)("hr",null),(0,i.kt)("h2",{id:"catatan-chapter-"},"Catatan chapter \ud83d\udcd1"),(0,i.kt)("h3",{id:"-source-code-praktik"},"\u25c9 Source code praktik"),(0,i.kt)("pre",null,(0,i.kt)("a",{href:"https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/shadowing"},"github.com/novalagung/dasarpemrogramanrust-example/../shadowing")),(0,i.kt)("h3",{id:"-referensi"},"\u25c9 Referensi"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://doc.rust-lang.org/rust-by-example/variable_bindings/scope.html"},"https://doc.rust-lang.org/rust-by-example/variable_bindings/scope.html"))))}m.isMDXComponent=!0},119:(a,e,n)=>{n.d(e,{Z:()=>t});const t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAACjCAIAAABuRXKuAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFk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rLqyAVbWHgz70eIYRmQSrfRUMIoQJIbYZVRKgIIYQTFUIIgVSEEAKpCCEEUhFCCO0IqdmOpXNqO5aEJygsqBFIDXEz3WStGFL957gL5QikGkt+txbUmsMAQssi1X3j0+oAtVzHHnjxEKSeJ1ITFtS5eUeoLFKD5uy8wi25IwcvAjbOevGeggn08R38p+Z97ofke91qx3ZSF+0yutc8o4TaCzMYYIuHq5nfg7H0NKTuy4KauQS0MlKj4K1poKI7cuB14XFO8lGO/P+7M9d/K41esLx+UaJpaaOUUIYBtni4kvl9GEsXQOpOLKgZkqDVkRq15t7TL7JhFm2KUvZ8IVI9k1AzUnuohcbX6sYooQwDbPFw+Zw7MZYugdRdWFAToqJtRqn9cD7e14lShw3UyyC1jlKlCYr0RhNSY3dkO1L3Yiy9GFLXtaD22gtERZucSxV6XDT5NTdS624j93ZtoxWpUkCZh9Q9GEuPvsHuyoI6ObWK0GJI9Vq8N5wPW2s+QQogtTdiFfMpbcxEauiOnDHw34ux9LgwdZcW1ISoaHWketFnOvYU1vv1GbNXw4BaR6q4FOz8ELhfuxtzBv6CO7IZqfGYdrvG0pms2qsF9TYeAkQgddSokHgAIQRSywwKCQgQQiC1AFT5+iRCCKQihBACqQghBFIRQgikIoQQAqkIIQRSEUIIpCKEEEhFCCEEUhFCCKQihNAJ6H8eyTFEAr61xQAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/main.8355e625.js b/assets/js/main.8355e625.js deleted file mode 100644 index 95cb8a9a..00000000 --- a/assets/js/main.8355e625.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see main.8355e625.js.LICENSE.txt */ -(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[179],{830:(e,t,n)=>{"use strict";n.d(t,{W:()=>a});var r=n(7294);function a(){return r.createElement("svg",{width:"20",height:"20",className:"DocSearch-Search-Icon",viewBox:"0 0 20 20"},r.createElement("path",{d:"M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"}))}},723:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(7294),a=n(7462),o=n(8356),i=n.n(o),l=n(6887);const s={"016a0787":[()=>n.e(274).then(n.bind(n,1854)),"@site/docs/basic/basic-memory-management.md",1854],"04da11da":[()=>n.e(3007).then(n.bind(n,7019)),"@site/docs/basic/perulangan-loop-break-continue-label.md",7019],"05cc1716":[()=>n.e(6477).then(n.bind(n,9810)),"@site/docs/basic/seleksi-kondisi-if.md",9810],"0ae704f7":[()=>n.e(2089).then(n.bind(n,5444)),"@site/docs/basic/pointer-references.md",5444],"0e6b6dd1":[()=>n.e(7949).then(n.t.bind(n,3769,19)),"/home/runner/work/dasarpemrogramanrust/dasarpemrogramanrust/.docusaurus/docusaurus-plugin-content-docs/default/plugin-route-context-module-100.json",3769],"164327b9":[()=>n.e(3306).then(n.t.bind(n,7085,19)),"/home/runner/work/dasarpemrogramanrust/dasarpemrogramanrust/.docusaurus/docusaurus-theme-search-algolia/default/plugin-route-context-module-100.json",7085],17896441:[()=>Promise.all([n.e(532),n.e(205),n.e(7918)]).then(n.bind(n,718)),"@theme/DocItem",718],"1a4e3797":[()=>Promise.all([n.e(532),n.e(7920)]).then(n.bind(n,6675)),"@theme/SearchPage",6675],"1be78505":[()=>Promise.all([n.e(532),n.e(9514)]).then(n.bind(n,2868)),"@theme/DocPage",2868],"2452d5f5":[()=>n.e(5989).then(n.bind(n,831)),"@site/docs/basic/type-alias-casting.md",831],"2bc2e36b":[()=>n.e(620).then(n.bind(n,8283)),"@site/docs/basic/pattern-matching.md",8283],"388041ab":[()=>n.e(1494).then(n.bind(n,395)),"@site/docs/basic/unrecoverable-panic-error.md",395],"3aa512bf":[()=>n.e(7386).then(n.bind(n,7495)),"@site/docs/basic/module-inline.md",7495],"3b1dfe68":[()=>n.e(6161).then(n.bind(n,4008)),"@site/docs/basic/visibility-privacy.md",4008],"3d2f5b0c":[()=>n.e(676).then(n.bind(n,5569)),"@site/docs/basic/operator-tanda-tanya.md",5569],"4232c3ed":[()=>n.e(8308).then(n.bind(n,1597)),"@site/docs/basic/enum.md",1597],"4513d9f5":[()=>n.e(5729).then(n.bind(n,2589)),"@site/docs/basic/slice-memory-management.md",2589],"475d163e":[()=>n.e(6403).then(n.bind(n,6889)),"@site/docs/basic/perulangan-while.md",6889],"48e2ebd6":[()=>n.e(2359).then(n.bind(n,611)),"@site/src/pages/intro.js",611],"496dcc30":[()=>n.e(4738).then(n.bind(n,4547)),"@site/docs/basic/hello-rust.md",4547],"4c7e7ada":[()=>n.e(2706).then(n.bind(n,5442)),"@site/docs/basic/module-basic.md",5442],"5925ce9f":[()=>n.e(9831).then(n.bind(n,3121)),"@site/docs/basic/generics.md",3121],"5e9f5e1a":[()=>Promise.resolve().then(n.bind(n,6809)),"@generated/docusaurus.config",6809],"5f289fb7":[()=>n.e(2870).then(n.bind(n,4950)),"@site/docs/basic/attributes.md",4950],"62b99870":[()=>n.e(1422).then(n.bind(n,1569)),"@site/docs/basic/slice.md",1569],"68e1906b":[()=>n.e(4758).then(n.bind(n,7630)),"@site/docs/basic/method.md",7630],"68ec37cc":[()=>n.e(2959).then(n.bind(n,3275)),"@site/docs/basic/static.md",3275],71880105:[()=>n.e(5758).then(n.bind(n,3548)),"@site/docs/basic/perulangan-for-in.md",3548],"7390b81e":[()=>n.e(4274).then(n.bind(n,6981)),"@site/docs/basic/package-crate.md",6981],"742a9bdc":[()=>n.e(7988).then(n.bind(n,8046)),"@site/docs/basic/advanced-traits.md",8046],"7794a932":[()=>n.e(8358).then(n.bind(n,6682)),"@site/docs/basic/result-type.md",6682],"7a2568c4":[()=>n.e(4197).then(n.bind(n,6425)),"@site/docs/basic/build-dan-run-program-rust.md",6425],"7d03ccaf":[()=>n.e(1059).then(n.bind(n,2409)),"@site/docs/pengelanan-rust-programming.md",2409],"82a9b669":[()=>n.e(3257).then(n.bind(n,1958)),"@site/docs/basic/trait-iterator.md",1958],"8333c691":[()=>n.e(4248).then(n.bind(n,9739)),"@site/docs/basic/ownership.md",9739],"8333ea4d":[()=>n.e(9323).then(n.bind(n,7485)),"@site/docs/basic/tuple.md",7485],"87499f15":[()=>n.e(7742).then(n.bind(n,67)),"@site/docs/basic/variabel.md",67],"8ad68633":[()=>n.e(2399).then(n.bind(n,1606)),"@site/docs/LICENSE.md",1606],"8b55bf27":[()=>n.e(9886).then(n.bind(n,5877)),"@site/docs/basic/tipe-data-custom-type-string-slice.md",5877],"8d193b98":[()=>n.e(7505).then(n.bind(n,676)),"@site/docs/CONTRIBUTING.md",676],"8e991452":[()=>n.e(2107).then(n.bind(n,9484)),"@site/docs/download-pdf.md",9484],"93422b31":[()=>n.e(8469).then(n.bind(n,1704)),"@site/docs/basic/struct.md",1704],"935f2afb":[()=>n.e(53).then(n.t.bind(n,1109,19)),"~docs/default/version-current-metadata-prop-751.json",1109],"9a3629a6":[()=>n.e(7865).then(n.bind(n,8472)),"@site/docs/basic/file-path-directory.md",8472],"9e6fe7cf":[()=>n.e(623).then(n.bind(n,2508)),"@site/docs/installation/instalasi-rust.md",2508],"9ed3ab78":[()=>n.e(1591).then(n.bind(n,7284)),"@site/docs/basic/recoverable-error-handling.md",7284],a2bea3ed:[()=>n.e(6345).then(n.bind(n,1099)),"@site/docs/basic/string-slice-vs-string-literal.md",1099],af6aab29:[()=>n.e(8794).then(n.bind(n,1468)),"@site/docs/basic/datetime.md",1468],b28a365a:[()=>n.e(6794).then(n.bind(n,7356)),"@site/docs/basic/block-expression.md",7356],b97d8256:[()=>n.e(4790).then(n.bind(n,232)),"@site/docs/basic/komentar.md",232],bc4edc5c:[()=>n.e(4452).then(n.bind(n,129)),"@site/docs/basic/closures.md",129],bd9b9d52:[()=>n.e(909).then(n.bind(n,5943)),"@site/docs/basic/tipe-data-primitive-scalar.md",5943],bdfc7662:[()=>n.e(7720).then(n.bind(n,2486)),"@site/docs/basic/associated-function.md",2486],be3f5c40:[()=>n.e(5572).then(n.bind(n,4387)),"@site/docs/basic/module-scope-item-access.md",4387],c01cce30:[()=>n.e(6531).then(n.bind(n,231)),"@site/docs/basic/konstanta.md",231],c377a04b:[()=>n.e(6971).then(n.bind(n,1269)),"@site/docs/index.md",1269],c526a898:[()=>n.e(9157).then(n.bind(n,3024)),"@site/docs/basic/function.md",3024],c76cc2e3:[()=>n.e(4729).then(n.bind(n,6556)),"@site/docs/basic/vector.md",6556],ca36df4d:[()=>n.e(917).then(n.bind(n,2197)),"@site/docs/CHANGELOG.md",2197],cb962766:[()=>n.e(6691).then(n.bind(n,2900)),"@site/docs/basic/trait-function.md",2900],d47a3664:[()=>n.e(8784).then(n.t.bind(n,5745,19)),"/home/runner/work/dasarpemrogramanrust/dasarpemrogramanrust/.docusaurus/docusaurus-plugin-content-pages/default/plugin-route-context-module-100.json",5745],d8837387:[()=>n.e(4622).then(n.bind(n,8007)),"@site/docs/basic/tipe-data-string-literal.md",8007],dabee7bd:[()=>n.e(4943).then(n.bind(n,3296)),"@site/docs/basic/operator.md",3296],dadaca00:[()=>n.e(8051).then(n.bind(n,375)),"@site/docs/basic/array.md",375],db8ccf76:[()=>n.e(4861).then(n.bind(n,5443)),"@site/docs/basic/traits.md",5443],e4904969:[()=>n.e(8732).then(n.bind(n,4510)),"@site/docs/basic/option-type.md",4510],e7bd9b37:[()=>n.e(7539).then(n.bind(n,2079)),"@site/docs/basic/path-item.md",2079],eb2a6637:[()=>n.e(6388).then(n.bind(n,164)),"@site/docs/basic/use.md",164],f8d4e457:[()=>n.e(740).then(n.bind(n,8514)),"@site/docs/basic/lifetime.md",8514],fb18633e:[()=>n.e(7310).then(n.bind(n,5555)),"@site/docs/basic/borrowing.md",5555],fd4f5a0c:[()=>n.e(5751).then(n.bind(n,5445)),"@site/docs/installation/rust-editor-plugin.md",5445],fef7d16c:[()=>n.e(5673).then(n.bind(n,2043)),"@site/docs/basic/shadowing.md",2043]};function c(e){let{error:t,retry:n,pastDelay:a}=e;return t?r.createElement("div",{style:{textAlign:"center",color:"#fff",backgroundColor:"#fa383e",borderColor:"#fa383e",borderStyle:"solid",borderRadius:"0.25rem",borderWidth:"1px",boxSizing:"border-box",display:"block",padding:"1rem",flex:"0 0 50%",marginLeft:"25%",marginRight:"25%",marginTop:"5rem",maxWidth:"50%",width:"100%"}},r.createElement("p",null,String(t)),r.createElement("div",null,r.createElement("button",{type:"button",onClick:n},"Retry"))):a?r.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"}},r.createElement("svg",{id:"loader",style:{width:128,height:110,position:"absolute",top:"calc(100vh - 64%)"},viewBox:"0 0 45 45",xmlns:"http://www.w3.org/2000/svg",stroke:"#61dafb"},r.createElement("g",{fill:"none",fillRule:"evenodd",transform:"translate(1 1)",strokeWidth:"2"},r.createElement("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0"},r.createElement("animate",{attributeName:"r",begin:"1.5s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-opacity",begin:"1.5s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-width",begin:"1.5s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})),r.createElement("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0"},r.createElement("animate",{attributeName:"r",begin:"3s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-opacity",begin:"3s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-width",begin:"3s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})),r.createElement("circle",{cx:"22",cy:"22",r:"8"},r.createElement("animate",{attributeName:"r",begin:"0s",dur:"1.5s",values:"6;1;2;3;4;5;6",calcMode:"linear",repeatCount:"indefinite"}))))):null}var u=n(9670),d=n(226);function f(e,t){if("*"===e)return i()({loading:c,loader:()=>n.e(4972).then(n.bind(n,4972)),modules:["@theme/NotFound"],webpack:()=>[4972],render(e,t){const n=e.default;return r.createElement(d.z,{value:{plugin:{name:"native",id:"default"}}},r.createElement(n,t))}});const o=l[`${e}-${t}`],f={},p=[],m=[],h=(0,u.Z)(o);return Object.entries(h).forEach((e=>{let[t,n]=e;const r=s[n];r&&(f[t]=r[0],p.push(r[1]),m.push(r[2]))})),i().Map({loading:c,loader:f,modules:p,webpack:()=>m,render(t,n){const i=JSON.parse(JSON.stringify(o));Object.entries(t).forEach((t=>{let[n,r]=t;const a=r.default;if(!a)throw new Error(`The page component at ${e} doesn't have a default export. This makes it impossible to render anything. Consider default-exporting a React component.`);"object"!=typeof a&&"function"!=typeof a||Object.keys(r).filter((e=>"default"!==e)).forEach((e=>{a[e]=r[e]}));let o=i;const l=n.split(".");l.slice(0,-1).forEach((e=>{o=o[e]})),o[l[l.length-1]]=a}));const l=i.__comp;delete i.__comp;const s=i.__context;return delete i.__context,r.createElement(d.z,{value:s},r.createElement(l,(0,a.Z)({},i,n)))}})}const p=[{path:"/intro",component:f("/intro","a5b"),exact:!0},{path:"/search",component:f("/search","fa3"),exact:!0},{path:"/",component:f("/","24f"),routes:[{path:"/",component:f("/","98e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/advanced-traits",component:f("/basic/advanced-traits","88d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/array",component:f("/basic/array","354"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/associated-function",component:f("/basic/associated-function","a80"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/attributes",component:f("/basic/attributes","7d4"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/basic-memory-management",component:f("/basic/basic-memory-management","24e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/block-expression",component:f("/basic/block-expression","22b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/borrowing",component:f("/basic/borrowing","85f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/build-dan-run-program-rust",component:f("/basic/build-dan-run-program-rust","1a9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/closures",component:f("/basic/closures","98c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/datetime",component:f("/basic/datetime","b5e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/enum",component:f("/basic/enum","a0e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/file-path-directory",component:f("/basic/file-path-directory","020"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/function",component:f("/basic/function","c21"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/generics",component:f("/basic/generics","3f9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/hello-rust",component:f("/basic/hello-rust","91f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/komentar",component:f("/basic/komentar","f72"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/konstanta",component:f("/basic/konstanta","758"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/lifetime",component:f("/basic/lifetime","ee9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/method",component:f("/basic/method","970"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/module-basic",component:f("/basic/module-basic","81c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/module-inline",component:f("/basic/module-inline","4f6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/module-scope-item-access",component:f("/basic/module-scope-item-access","b6b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/operator",component:f("/basic/operator","85d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/operator-tanda-tanya",component:f("/basic/operator-tanda-tanya","f6a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/option-type",component:f("/basic/option-type","c23"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/ownership",component:f("/basic/ownership","74d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/package-crate",component:f("/basic/package-crate","fce"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/path-item",component:f("/basic/path-item","e90"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/pattern-matching",component:f("/basic/pattern-matching","45d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/perulangan-for-in",component:f("/basic/perulangan-for-in","c5f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/perulangan-loop-break-continue-label",component:f("/basic/perulangan-loop-break-continue-label","b52"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/perulangan-while",component:f("/basic/perulangan-while","011"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/pointer-references",component:f("/basic/pointer-references","dfd"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/recoverable-error-handling",component:f("/basic/recoverable-error-handling","b06"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/result-type",component:f("/basic/result-type","c01"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/seleksi-kondisi-if",component:f("/basic/seleksi-kondisi-if","e3d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/shadowing",component:f("/basic/shadowing","5be"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/slice",component:f("/basic/slice","2c8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/slice-memory-management",component:f("/basic/slice-memory-management","6b3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/static",component:f("/basic/static","655"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/string-slice-vs-string-literal",component:f("/basic/string-slice-vs-string-literal","5e6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/struct",component:f("/basic/struct","392"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/tipe-data-custom-type-string-slice",component:f("/basic/tipe-data-custom-type-string-slice","384"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/tipe-data-primitive-scalar",component:f("/basic/tipe-data-primitive-scalar","18c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/tipe-data-string-literal",component:f("/basic/tipe-data-string-literal","788"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/trait-function",component:f("/basic/trait-function","ebd"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/trait-iterator",component:f("/basic/trait-iterator","2f7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/traits",component:f("/basic/traits","594"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/tuple",component:f("/basic/tuple","dfc"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/type-alias-casting",component:f("/basic/type-alias-casting","dbf"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/unrecoverable-panic-error",component:f("/basic/unrecoverable-panic-error","445"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/use",component:f("/basic/use","f71"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/variabel",component:f("/basic/variabel","21b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/vector",component:f("/basic/vector","4d7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/visibility-privacy",component:f("/basic/visibility-privacy","794"),exact:!0,sidebar:"tutorialSidebar"},{path:"/CHANGELOG",component:f("/CHANGELOG","c6e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/CONTRIBUTING",component:f("/CONTRIBUTING","93d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/download-pdf",component:f("/download-pdf","a82"),exact:!0,sidebar:"tutorialSidebar"},{path:"/installation/instalasi-rust",component:f("/installation/instalasi-rust","e6a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/installation/rust-editor-plugin",component:f("/installation/rust-editor-plugin","a9b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/LICENSE",component:f("/LICENSE","67b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/pengelanan-rust-programming",component:f("/pengelanan-rust-programming","aab"),exact:!0,sidebar:"tutorialSidebar"}]},{path:"*",component:f("*")}]},8934:(e,t,n)=>{"use strict";n.d(t,{_:()=>a,t:()=>o});var r=n(7294);const a=r.createContext(!1);function o(e){let{children:t}=e;const[n,o]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{o(!0)}),[]),r.createElement(a.Provider,{value:n},t)}},9383:(e,t,n)=>{"use strict";var r=n(7294),a=n(3935),o=n(3727),i=n(405),l=n(412);const s=[n(6657),n(2497),n(3310),n(8320),n(8049),n(6882)];var c=n(723),u=n(6775),d=n(8790);function f(e){let{children:t}=e;return r.createElement(r.Fragment,null,t)}var p=n(7462),m=n(5742),h=n(2263),g=n(4996),b=n(6668),v=n(833),y=n(4711),w=n(9727),E=n(3320),k=n(197);function S(){const{i18n:{defaultLocale:e,localeConfigs:t}}=(0,h.Z)(),n=(0,y.l)();return r.createElement(m.Z,null,Object.entries(t).map((e=>{let[t,{htmlLang:a}]=e;return r.createElement("link",{key:t,rel:"alternate",href:n.createUrl({locale:t,fullyQualified:!0}),hrefLang:a})})),r.createElement("link",{rel:"alternate",href:n.createUrl({locale:e,fullyQualified:!0}),hrefLang:"x-default"}))}function _(e){let{permalink:t}=e;const{siteConfig:{url:n}}=(0,h.Z)(),a=function(){const{siteConfig:{url:e}}=(0,h.Z)(),{pathname:t}=(0,u.TH)();return e+(0,g.Z)(t)}(),o=t?`${n}${t}`:a;return r.createElement(m.Z,null,r.createElement("meta",{property:"og:url",content:o}),r.createElement("link",{rel:"canonical",href:o}))}function x(){const{i18n:{currentLocale:e}}=(0,h.Z)(),{metadata:t,image:n}=(0,b.L)();return r.createElement(r.Fragment,null,r.createElement(m.Z,null,r.createElement("meta",{name:"twitter:card",content:"summary_large_image"}),r.createElement("body",{className:w.h})),n&&r.createElement(v.d,{image:n}),r.createElement(_,null),r.createElement(S,null),r.createElement(k.Z,{tag:E.HX,locale:e}),r.createElement(m.Z,null,t.map(((e,t)=>r.createElement("meta",(0,p.Z)({key:t},e))))))}const T=new Map;function C(e){if(T.has(e.pathname))return{...e,pathname:T.get(e.pathname)};if((0,d.f)(c.Z,e.pathname).some((e=>{let{route:t}=e;return!0===t.exact})))return T.set(e.pathname,e.pathname),e;const t=e.pathname.trim().replace(/(?:\/index)?\.html$/,"")||"/";return T.set(e.pathname,t),{...e,pathname:t}}var A=n(8934),N=n(8940);function O(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];const a=s.map((t=>{var r;const a=(null==(r=t.default)?void 0:r[e])??t[e];return null==a?void 0:a(...n)}));return()=>a.forEach((e=>null==e?void 0:e()))}const L=function(e){let{children:t,location:n,previousLocation:a}=e;return(0,r.useLayoutEffect)((()=>{a!==n&&(a&&function(e){const{hash:t}=e;if(t){const e=decodeURIComponent(t.substring(1)),n=document.getElementById(e);null==n||n.scrollIntoView()}else window.scrollTo(0,0)}(n),O("onRouteDidUpdate",{previousLocation:a,location:n}))}),[a,n]),t};function I(e){const t=Array.from(new Set([e,decodeURI(e)])).map((e=>(0,d.f)(c.Z,e))).flat();return Promise.all(t.map((e=>null==e.route.component.preload?void 0:e.route.component.preload())))}class P extends r.Component{constructor(e){super(e),this.previousLocation=void 0,this.routeUpdateCleanupCb=void 0,this.previousLocation=null,this.routeUpdateCleanupCb=l.Z.canUseDOM?O("onRouteUpdate",{previousLocation:null,location:this.props.location}):()=>{},this.state={nextRouteHasLoaded:!0}}shouldComponentUpdate(e,t){if(e.location===this.props.location)return t.nextRouteHasLoaded;const n=e.location;return this.previousLocation=this.props.location,this.setState({nextRouteHasLoaded:!1}),this.routeUpdateCleanupCb=O("onRouteUpdate",{previousLocation:this.previousLocation,location:n}),I(n.pathname).then((()=>{this.routeUpdateCleanupCb(),this.setState({nextRouteHasLoaded:!0})})).catch((e=>{console.warn(e),window.location.reload()})),!1}render(){const{children:e,location:t}=this.props;return r.createElement(L,{previousLocation:this.previousLocation,location:t},r.createElement(u.AW,{location:t,render:()=>e}))}}const R=P,M="docusaurus-base-url-issue-banner-container",D="docusaurus-base-url-issue-banner-suggestion-container",F="__DOCUSAURUS_INSERT_BASEURL_BANNER";function B(e){return`\nwindow['${F}'] = true;\n\ndocument.addEventListener('DOMContentLoaded', maybeInsertBanner);\n\nfunction maybeInsertBanner() {\n var shouldInsert = window['${F}'];\n shouldInsert && insertBanner();\n}\n\nfunction insertBanner() {\n var bannerContainer = document.getElementById('${M}');\n if (!bannerContainer) {\n return;\n }\n var bannerHtml = ${JSON.stringify(function(e){return`\n<div id="docusaurus-base-url-issue-banner" style="border: thick solid red; background-color: rgb(255, 230, 179); margin: 20px; padding: 20px; font-size: 20px;">\n <p style="font-weight: bold; font-size: 30px;">Your Docusaurus site did not load properly.</p>\n <p>A very common reason is a wrong site <a href="https://docusaurus.io/docs/docusaurus.config.js/#baseurl" style="font-weight: bold;">baseUrl configuration</a>.</p>\n <p>Current configured baseUrl = <span style="font-weight: bold; color: red;">${e}</span> ${"/"===e?" (default value)":""}</p>\n <p>We suggest trying baseUrl = <span id="${D}" style="font-weight: bold; color: green;"></span></p>\n</div>\n`}(e)).replace(/</g,"\\<")};\n bannerContainer.innerHTML = bannerHtml;\n var suggestionContainer = document.getElementById('${D}');\n var actualHomePagePath = window.location.pathname;\n var suggestedBaseUrl = actualHomePagePath.substr(-1) === '/'\n ? actualHomePagePath\n : actualHomePagePath + '/';\n suggestionContainer.innerHTML = suggestedBaseUrl;\n}\n`}function $(){const{siteConfig:{baseUrl:e}}=(0,h.Z)();return(0,r.useLayoutEffect)((()=>{window[F]=!1}),[]),r.createElement(r.Fragment,null,!l.Z.canUseDOM&&r.createElement(m.Z,null,r.createElement("script",null,B(e))),r.createElement("div",{id:M}))}function U(){const{siteConfig:{baseUrl:e,baseUrlIssueBanner:t}}=(0,h.Z)(),{pathname:n}=(0,u.TH)();return t&&n===e?r.createElement($,null):null}function z(){const{siteConfig:{favicon:e,title:t,noIndex:n},i18n:{currentLocale:a,localeConfigs:o}}=(0,h.Z)(),i=(0,g.Z)(e),{htmlLang:l,direction:s}=o[a];return r.createElement(m.Z,null,r.createElement("html",{lang:l,dir:s}),r.createElement("title",null,t),r.createElement("meta",{property:"og:title",content:t}),r.createElement("meta",{name:"viewport",content:"width=device-width, initial-scale=1.0"}),n&&r.createElement("meta",{name:"robots",content:"noindex, nofollow"}),e&&r.createElement("link",{rel:"icon",href:i}))}var j=n(4763);function H(){const e=(0,d.H)(c.Z),t=(0,u.TH)();return r.createElement(j.Z,null,r.createElement(N.M,null,r.createElement(A.t,null,r.createElement(f,null,r.createElement(z,null),r.createElement(x,null),r.createElement(U,null),r.createElement(R,{location:C(t)},e)))))}var Z=n(6887);const G=function(e){try{return document.createElement("link").relList.supports(e)}catch{return!1}}("prefetch")?function(e){return new Promise(((t,n)=>{var r;if("undefined"==typeof document)return void n();const a=document.createElement("link");a.setAttribute("rel","prefetch"),a.setAttribute("href",e),a.onload=()=>t(),a.onerror=()=>n();const o=document.getElementsByTagName("head")[0]??(null==(r=document.getElementsByName("script")[0])?void 0:r.parentNode);null==o||o.appendChild(a)}))}:function(e){return new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open("GET",e,!0),r.withCredentials=!0,r.onload=()=>{200===r.status?t():n()},r.send(null)}))};var V=n(9670);const W=new Set,q=new Set,Y=()=>{var e,t;return(null==(e=navigator.connection)?void 0:e.effectiveType.includes("2g"))||(null==(t=navigator.connection)?void 0:t.saveData)},K={prefetch(e){if(!(e=>!Y()&&!q.has(e)&&!W.has(e))(e))return!1;W.add(e);const t=(0,d.f)(c.Z,e).flatMap((e=>{return t=e.route.path,Object.entries(Z).filter((e=>{let[n]=e;return n.replace(/-[^-]+$/,"")===t})).flatMap((e=>{let[,t]=e;return Object.values((0,V.Z)(t))}));var t}));return Promise.all(t.map((e=>{const t=n.gca(e);return t&&!t.includes("undefined")?G(t).catch((()=>{})):Promise.resolve()})))},preload:e=>!!(e=>!Y()&&!q.has(e))(e)&&(q.add(e),I(e))},X=Object.freeze(K);if(l.Z.canUseDOM){window.docusaurus=X;const e=a.hydrate;I(window.location.pathname).then((()=>{e(r.createElement(i.B6,null,r.createElement(o.VK,null,r.createElement(H,null))),document.getElementById("__docusaurus"))}))}},8940:(e,t,n)=>{"use strict";n.d(t,{_:()=>u,M:()=>d});var r=n(7294),a=n(6809);const o=JSON.parse('{"docusaurus-plugin-google-gtag":{"default":{"trackingID":"G-HKPC8ZGM74","anonymizeIP":false,"id":"default"}},"docusaurus-plugin-content-docs":{"default":{"path":"/","versions":[{"name":"current","label":"Next","isLast":true,"path":"/","mainDocId":"index","docs":[{"id":"basic/advanced-traits","path":"/basic/advanced-traits","sidebar":"tutorialSidebar"},{"id":"basic/array","path":"/basic/array","sidebar":"tutorialSidebar"},{"id":"basic/associated-function","path":"/basic/associated-function","sidebar":"tutorialSidebar"},{"id":"basic/attributes","path":"/basic/attributes","sidebar":"tutorialSidebar"},{"id":"basic/basic-memory-management","path":"/basic/basic-memory-management","sidebar":"tutorialSidebar"},{"id":"basic/block-expression","path":"/basic/block-expression","sidebar":"tutorialSidebar"},{"id":"basic/borrowing","path":"/basic/borrowing","sidebar":"tutorialSidebar"},{"id":"basic/build-dan-run-program-rust","path":"/basic/build-dan-run-program-rust","sidebar":"tutorialSidebar"},{"id":"basic/closures","path":"/basic/closures","sidebar":"tutorialSidebar"},{"id":"basic/datetime","path":"/basic/datetime","sidebar":"tutorialSidebar"},{"id":"basic/enum","path":"/basic/enum","sidebar":"tutorialSidebar"},{"id":"basic/file-path-directory","path":"/basic/file-path-directory","sidebar":"tutorialSidebar"},{"id":"basic/function","path":"/basic/function","sidebar":"tutorialSidebar"},{"id":"basic/generics","path":"/basic/generics","sidebar":"tutorialSidebar"},{"id":"basic/hello-rust","path":"/basic/hello-rust","sidebar":"tutorialSidebar"},{"id":"basic/komentar","path":"/basic/komentar","sidebar":"tutorialSidebar"},{"id":"basic/konstanta","path":"/basic/konstanta","sidebar":"tutorialSidebar"},{"id":"basic/lifetime","path":"/basic/lifetime","sidebar":"tutorialSidebar"},{"id":"basic/method","path":"/basic/method","sidebar":"tutorialSidebar"},{"id":"basic/module-basic","path":"/basic/module-basic","sidebar":"tutorialSidebar"},{"id":"basic/module-inline","path":"/basic/module-inline","sidebar":"tutorialSidebar"},{"id":"basic/module-scope-item-access","path":"/basic/module-scope-item-access","sidebar":"tutorialSidebar"},{"id":"basic/operator","path":"/basic/operator","sidebar":"tutorialSidebar"},{"id":"basic/operator-tanda-tanya","path":"/basic/operator-tanda-tanya","sidebar":"tutorialSidebar"},{"id":"basic/option-type","path":"/basic/option-type","sidebar":"tutorialSidebar"},{"id":"basic/ownership","path":"/basic/ownership","sidebar":"tutorialSidebar"},{"id":"basic/package-crate","path":"/basic/package-crate","sidebar":"tutorialSidebar"},{"id":"basic/path-item","path":"/basic/path-item","sidebar":"tutorialSidebar"},{"id":"basic/pattern-matching","path":"/basic/pattern-matching","sidebar":"tutorialSidebar"},{"id":"basic/perulangan-for-in","path":"/basic/perulangan-for-in","sidebar":"tutorialSidebar"},{"id":"basic/perulangan-loop-break-continue-label","path":"/basic/perulangan-loop-break-continue-label","sidebar":"tutorialSidebar"},{"id":"basic/perulangan-while","path":"/basic/perulangan-while","sidebar":"tutorialSidebar"},{"id":"basic/pointer-references","path":"/basic/pointer-references","sidebar":"tutorialSidebar"},{"id":"basic/recoverable-error-handling","path":"/basic/recoverable-error-handling","sidebar":"tutorialSidebar"},{"id":"basic/result-type","path":"/basic/result-type","sidebar":"tutorialSidebar"},{"id":"basic/seleksi-kondisi-if","path":"/basic/seleksi-kondisi-if","sidebar":"tutorialSidebar"},{"id":"basic/shadowing","path":"/basic/shadowing","sidebar":"tutorialSidebar"},{"id":"basic/slice","path":"/basic/slice","sidebar":"tutorialSidebar"},{"id":"basic/slice-memory-management","path":"/basic/slice-memory-management","sidebar":"tutorialSidebar"},{"id":"basic/static","path":"/basic/static","sidebar":"tutorialSidebar"},{"id":"basic/string-slice-vs-string-literal","path":"/basic/string-slice-vs-string-literal","sidebar":"tutorialSidebar"},{"id":"basic/struct","path":"/basic/struct","sidebar":"tutorialSidebar"},{"id":"basic/tipe-data-custom-type-string-slice","path":"/basic/tipe-data-custom-type-string-slice","sidebar":"tutorialSidebar"},{"id":"basic/tipe-data-primitive-scalar","path":"/basic/tipe-data-primitive-scalar","sidebar":"tutorialSidebar"},{"id":"basic/tipe-data-string-literal","path":"/basic/tipe-data-string-literal","sidebar":"tutorialSidebar"},{"id":"basic/trait-function","path":"/basic/trait-function","sidebar":"tutorialSidebar"},{"id":"basic/trait-iterator","path":"/basic/trait-iterator","sidebar":"tutorialSidebar"},{"id":"basic/traits","path":"/basic/traits","sidebar":"tutorialSidebar"},{"id":"basic/tuple","path":"/basic/tuple","sidebar":"tutorialSidebar"},{"id":"basic/type-alias-casting","path":"/basic/type-alias-casting","sidebar":"tutorialSidebar"},{"id":"basic/unrecoverable-panic-error","path":"/basic/unrecoverable-panic-error","sidebar":"tutorialSidebar"},{"id":"basic/use","path":"/basic/use","sidebar":"tutorialSidebar"},{"id":"basic/variabel","path":"/basic/variabel","sidebar":"tutorialSidebar"},{"id":"basic/vector","path":"/basic/vector","sidebar":"tutorialSidebar"},{"id":"basic/visibility-privacy","path":"/basic/visibility-privacy","sidebar":"tutorialSidebar"},{"id":"CHANGELOG","path":"/CHANGELOG","sidebar":"tutorialSidebar"},{"id":"CONTRIBUTING","path":"/CONTRIBUTING","sidebar":"tutorialSidebar"},{"id":"download-pdf","path":"/download-pdf","sidebar":"tutorialSidebar"},{"id":"index","path":"/","sidebar":"tutorialSidebar"},{"id":"installation/instalasi-rust","path":"/installation/instalasi-rust","sidebar":"tutorialSidebar"},{"id":"installation/rust-editor-plugin","path":"/installation/rust-editor-plugin","sidebar":"tutorialSidebar"},{"id":"LICENSE","path":"/LICENSE","sidebar":"tutorialSidebar"},{"id":"pengelanan-rust-programming","path":"/pengelanan-rust-programming","sidebar":"tutorialSidebar"}],"draftIds":[],"sidebars":{"tutorialSidebar":{"link":{"path":"/","label":"Dasar Pemrograman Rust"}}}}],"breadcrumbs":true}}}'),i=JSON.parse('{"defaultLocale":"id","locales":["id"],"path":"i18n","currentLocale":"id","localeConfigs":{"id":{"label":"Indonesia","direction":"ltr","htmlLang":"id","calendar":"gregory","path":"id"}}}');var l=n(7529);const s=JSON.parse('{"docusaurusVersion":"2.2.0","siteVersion":"0.0.0","pluginVersions":{"docusaurus-plugin-content-docs":{"type":"package","name":"@docusaurus/plugin-content-docs","version":"2.2.0"},"docusaurus-plugin-content-pages":{"type":"package","name":"@docusaurus/plugin-content-pages","version":"2.2.0"},"docusaurus-plugin-google-gtag":{"type":"package","name":"@docusaurus/plugin-google-gtag","version":"2.2.0"},"docusaurus-plugin-sitemap":{"type":"package","name":"@docusaurus/plugin-sitemap","version":"2.2.0"},"docusaurus-theme-classic":{"type":"package","name":"@docusaurus/theme-classic","version":"2.2.0"},"docusaurus-theme-search-algolia":{"type":"package","name":"@docusaurus/theme-search-algolia","version":"2.2.0"},"docusaurus-plugin-structured-data":{"type":"package","name":"@stackql/docusaurus-plugin-structured-data","version":"1.3.1"}}}'),c={siteConfig:a.default,siteMetadata:s,globalData:o,i18n:i,codeTranslations:l},u=r.createContext(c);function d(e){let{children:t}=e;return r.createElement(u.Provider,{value:c},t)}},4763:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(7294),a=n(412),o=n(5742),i=n(5705);function l(e){let{error:t,tryAgain:n}=e;return r.createElement("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",height:"50vh",width:"100%",fontSize:"20px"}},r.createElement("h1",null,"This page crashed."),r.createElement("p",null,t.message),r.createElement("button",{type:"button",onClick:n},"Try again"))}function s(e){let{error:t,tryAgain:n}=e;return r.createElement(u,{fallback:()=>r.createElement(l,{error:t,tryAgain:n})},r.createElement(o.Z,null,r.createElement("title",null,"Page Error")),r.createElement(i.Z,null,r.createElement(l,{error:t,tryAgain:n})))}const c=e=>r.createElement(s,e);class u extends r.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){a.Z.canUseDOM&&this.setState({error:e})}render(){const{children:e}=this.props,{error:t}=this.state;if(t){const e={error:t,tryAgain:()=>this.setState({error:null})};return(this.props.fallback??c)(e)}return e??null}}},412:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});const r="undefined"!=typeof window&&"document"in window&&"createElement"in window.document,a={canUseDOM:r,canUseEventListeners:r&&("addEventListener"in window||"attachEvent"in window),canUseIntersectionObserver:r&&"IntersectionObserver"in window,canUseViewport:r&&"screen"in window}},5742:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(7294),a=n(405);function o(e){return r.createElement(a.ql,e)}},9960:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(7462),a=n(7294),o=n(3727),i=n(8780),l=n(2263),s=n(3919),c=n(412);const u=a.createContext({collectLink:()=>{}});var d=n(4996);function f(e,t){var n;let{isNavLink:f,to:p,href:m,activeClassName:h,isActive:g,"data-noBrokenLinkCheck":b,autoAddBaseUrl:v=!0,...y}=e;const{siteConfig:{trailingSlash:w,baseUrl:E}}=(0,l.Z)(),{withBaseUrl:k}=(0,d.C)(),S=(0,a.useContext)(u),_=(0,a.useRef)(null);(0,a.useImperativeHandle)(t,(()=>_.current));const x=p||m;const T=(0,s.Z)(x),C=null==x?void 0:x.replace("pathname://","");let A=void 0!==C?(N=C,v&&(e=>e.startsWith("/"))(N)?k(N):N):void 0;var N;A&&T&&(A=(0,i.applyTrailingSlash)(A,{trailingSlash:w,baseUrl:E}));const O=(0,a.useRef)(!1),L=f?o.OL:o.rU,I=c.Z.canUseIntersectionObserver,P=(0,a.useRef)(),R=()=>{O.current||null==A||(window.docusaurus.preload(A),O.current=!0)};(0,a.useEffect)((()=>(!I&&T&&null!=A&&window.docusaurus.prefetch(A),()=>{I&&P.current&&P.current.disconnect()})),[P,A,I,T]);const M=(null==(n=A)?void 0:n.startsWith("#"))??!1,D=!A||!T||M;return D||b||S.collectLink(A),D?a.createElement("a",(0,r.Z)({ref:_,href:A},x&&!T&&{target:"_blank",rel:"noopener noreferrer"},y)):a.createElement(L,(0,r.Z)({},y,{onMouseEnter:R,onTouchStart:R,innerRef:e=>{_.current=e,I&&e&&T&&(P.current=new window.IntersectionObserver((t=>{t.forEach((t=>{e===t.target&&(t.isIntersecting||t.intersectionRatio>0)&&(P.current.unobserve(e),P.current.disconnect(),null!=A&&window.docusaurus.prefetch(A))}))})),P.current.observe(e))},to:A},f&&{isActive:g,activeClassName:h}))}const p=a.forwardRef(f)},5999:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s,I:()=>l});var r=n(7294);function a(e,t){const n=e.split(/(\{\w+\})/).map(((e,n)=>{if(n%2==1){const n=null==t?void 0:t[e.slice(1,-1)];if(void 0!==n)return n}return e}));return n.some((e=>(0,r.isValidElement)(e)))?n.map(((e,t)=>(0,r.isValidElement)(e)?r.cloneElement(e,{key:t}):e)).filter((e=>""!==e)):n.join("")}var o=n(7529);function i(e){let{id:t,message:n}=e;if(void 0===t&&void 0===n)throw new Error("Docusaurus translation declarations must have at least a translation id or a default translation message");return o[t??n]??n??t}function l(e,t){let{message:n,id:r}=e;return a(i({message:n,id:r}),t)}function s(e){let{children:t,id:n,values:o}=e;if(t&&"string"!=typeof t)throw console.warn("Illegal <Translate> children",t),new Error("The Docusaurus <Translate> component only accept simple string values");const l=i({message:t,id:n});return r.createElement(r.Fragment,null,a(l,o))}},9935:(e,t,n)=>{"use strict";n.d(t,{m:()=>r});const r="default"},3919:(e,t,n)=>{"use strict";function r(e){return/^(?:\w*:|\/\/)/.test(e)}function a(e){return void 0!==e&&!r(e)}n.d(t,{Z:()=>a,b:()=>r})},4996:(e,t,n)=>{"use strict";n.d(t,{C:()=>o,Z:()=>i});var r=n(2263),a=n(3919);function o(){const{siteConfig:{baseUrl:e,url:t}}=(0,r.Z)();return{withBaseUrl:(n,r)=>function(e,t,n,r){let{forcePrependBaseUrl:o=!1,absolute:i=!1}=void 0===r?{}:r;if(!n||n.startsWith("#")||(0,a.b)(n))return n;if(o)return t+n.replace(/^\//,"");if(n===t.replace(/\/$/,""))return t;const l=n.startsWith(t)?n:t+n.replace(/^\//,"");return i?e+l:l}(t,e,n,r)}}function i(e,t){void 0===t&&(t={});const{withBaseUrl:n}=o();return n(e,t)}},2263:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(7294),a=n(8940);function o(){return(0,r.useContext)(a._)}},2389:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(7294),a=n(8934);function o(){return(0,r.useContext)(a._)}},9670:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});function r(e){const t={};return function e(n,r){Object.entries(n).forEach((n=>{let[a,o]=n;const i=r?`${r}.${a}`:a;var l;"object"==typeof(l=o)&&l&&Object.keys(l).length>0?e(o,i):t[i]=o}))}(e),t}},226:(e,t,n)=>{"use strict";n.d(t,{_:()=>a,z:()=>o});var r=n(7294);const a=r.createContext(null);function o(e){let{children:t,value:n}=e;const o=r.useContext(a),i=(0,r.useMemo)((()=>function(e){let{parent:t,value:n}=e;if(!t){if(!n)throw new Error("Unexpected: no Docusaurus route context found");if(!("plugin"in n))throw new Error("Unexpected: Docusaurus topmost route context has no `plugin` attribute");return n}const r={...t.data,...null==n?void 0:n.data};return{plugin:t.plugin,data:r}}({parent:o,value:n})),[o,n]);return r.createElement(a.Provider,{value:i},t)}},143:(e,t,n)=>{"use strict";n.d(t,{Iw:()=>b,gA:()=>p,WS:()=>m,_r:()=>d,Jo:()=>v,zh:()=>f,yW:()=>g,gB:()=>h});var r=n(6775),a=n(2263),o=n(9935);function i(e,t){void 0===t&&(t={});const n=function(){const{globalData:e}=(0,a.Z)();return e}()[e];if(!n&&t.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin.`);return n}const l=e=>e.versions.find((e=>e.isLast));function s(e,t){const n=l(e);return[...e.versions.filter((e=>e!==n)),n].find((e=>!!(0,r.LX)(t,{path:e.path,exact:!1,strict:!1})))}function c(e,t){const n=s(e,t),a=null==n?void 0:n.docs.find((e=>!!(0,r.LX)(t,{path:e.path,exact:!0,strict:!1})));return{activeVersion:n,activeDoc:a,alternateDocVersions:a?function(t){const n={};return e.versions.forEach((e=>{e.docs.forEach((r=>{r.id===t&&(n[e.name]=r)}))})),n}(a.id):{}}}const u={},d=()=>i("docusaurus-plugin-content-docs")??u,f=e=>function(e,t,n){void 0===t&&(t=o.m),void 0===n&&(n={});const r=i(e),a=null==r?void 0:r[t];if(!a&&n.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin with id "${t}".`);return a}("docusaurus-plugin-content-docs",e,{failfast:!0});function p(e){void 0===e&&(e={});const t=d(),{pathname:n}=(0,r.TH)();return function(e,t,n){void 0===n&&(n={});const a=Object.entries(e).sort(((e,t)=>t[1].path.localeCompare(e[1].path))).find((e=>{let[,n]=e;return!!(0,r.LX)(t,{path:n.path,exact:!1,strict:!1})})),o=a?{pluginId:a[0],pluginData:a[1]}:void 0;if(!o&&n.failfast)throw new Error(`Can't find active docs plugin for "${t}" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: ${Object.values(e).map((e=>e.path)).join(", ")}`);return o}(t,n,e)}function m(e){void 0===e&&(e={});const t=p(e),{pathname:n}=(0,r.TH)();if(!t)return;return{activePlugin:t,activeVersion:s(t.pluginData,n)}}function h(e){return f(e).versions}function g(e){const t=f(e);return l(t)}function b(e){const t=f(e),{pathname:n}=(0,r.TH)();return c(t,n)}function v(e){const t=f(e),{pathname:n}=(0,r.TH)();return function(e,t){const n=l(e);return{latestDocSuggestion:c(e,t).alternateDocVersions[n.name],latestVersionSuggestion:n}}(t,n)}},6657:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r});const r={onRouteDidUpdate(e){let{location:t,previousLocation:n}=e;!n||t.pathname===n.pathname&&t.search===n.search&&t.hash===n.hash||setTimeout((()=>{window.gtag("event","page_view",{page_title:document.title,page_location:window.location.href,page_path:t.pathname+t.search+t.hash})}))}}},8320:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>o});var r=n(4865),a=n.n(r);a().configure({showSpinner:!1});const o={onRouteUpdate(e){let{location:t,previousLocation:n}=e;if(n&&t.pathname!==n.pathname){const e=window.setTimeout((()=>{a().start()}),200);return()=>window.clearTimeout(e)}},onRouteDidUpdate(){a().done()}}},3310:(e,t,n)=>{"use strict";n.r(t);var r=n(7410),a=n(6809);!function(e){const{themeConfig:{prism:t}}=a.default,{additionalLanguages:r}=t;globalThis.Prism=e,r.forEach((e=>{n(6991)(`./prism-${e}`)})),delete globalThis.Prism}(r.Z)},9471:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(7294);const a="iconExternalLink_nPIU";function o(e){let{width:t=13.5,height:n=13.5}=e;return r.createElement("svg",{width:t,height:n,"aria-hidden":"true",viewBox:"0 0 24 24",className:a},r.createElement("path",{fill:"currentColor",d:"M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"}))}},5705:(e,t,n)=>{"use strict";n.d(t,{Z:()=>Nt});var r=n(7294),a=n(6010),o=n(4763),i=n(833),l=n(7462),s=n(6775),c=n(5999),u=n(5936);const d="docusaurus_skipToContent_fallback";function f(e){e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")}function p(){const e=(0,r.useRef)(null),{action:t}=(0,s.k6)(),n=(0,r.useCallback)((e=>{e.preventDefault();const t=document.querySelector("main:first-of-type")??document.getElementById(d);t&&f(t)}),[]);return(0,u.S)((n=>{let{location:r}=n;e.current&&!r.hash&&"PUSH"===t&&f(e.current)})),{containerRef:e,onClick:n}}const m=(0,c.I)({id:"theme.common.skipToMainContent",description:"The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation",message:"Skip to main content"});function h(e){const t=e.children??m,{containerRef:n,onClick:a}=p();return r.createElement("div",{ref:n,role:"region","aria-label":m},r.createElement("a",(0,l.Z)({},e,{href:`#${d}`,onClick:a}),t))}var g=n(5281),b=n(9727);const v="skipToContent_fXgn";function y(){return r.createElement(h,{className:v})}var w=n(6668),E=n(9689);function k(e){let{width:t=21,height:n=21,color:a="currentColor",strokeWidth:o=1.2,className:i,...s}=e;return r.createElement("svg",(0,l.Z)({viewBox:"0 0 15 15",width:t,height:n},s),r.createElement("g",{stroke:a,strokeWidth:o},r.createElement("path",{d:"M.75.75l13.5 13.5M14.25.75L.75 14.25"})))}const S="closeButton_CVFx";function _(e){return r.createElement("button",(0,l.Z)({type:"button","aria-label":(0,c.I)({id:"theme.AnnouncementBar.closeButtonAriaLabel",message:"Close",description:"The ARIA label for close button of announcement bar"})},e,{className:(0,a.Z)("clean-btn close",S,e.className)}),r.createElement(k,{width:14,height:14,strokeWidth:3.1}))}const x="content_knG7";function T(e){const{announcementBar:t}=(0,w.L)(),{content:n}=t;return r.createElement("div",(0,l.Z)({},e,{className:(0,a.Z)(x,e.className),dangerouslySetInnerHTML:{__html:n}}))}const C="announcementBar_mb4j",A="announcementBarPlaceholder_vyr4",N="announcementBarClose_gvF7",O="announcementBarContent_xLdY";function L(){const{announcementBar:e}=(0,w.L)(),{isActive:t,close:n}=(0,E.nT)();if(!t)return null;const{backgroundColor:a,textColor:o,isCloseable:i}=e;return r.createElement("div",{className:C,style:{backgroundColor:a,color:o},role:"banner"},i&&r.createElement("div",{className:A}),r.createElement(T,{className:O}),i&&r.createElement(_,{onClick:n,className:N}))}var I=n(2961),P=n(2466);var R=n(902),M=n(3102);const D=r.createContext(null);function F(e){let{children:t}=e;const n=function(){const e=(0,I.e)(),t=(0,M.HY)(),[n,a]=(0,r.useState)(!1),o=null!==t.component,i=(0,R.D9)(o);return(0,r.useEffect)((()=>{o&&!i&&a(!0)}),[o,i]),(0,r.useEffect)((()=>{o?e.shown||a(!0):a(!1)}),[e.shown,o]),(0,r.useMemo)((()=>[n,a]),[n])}();return r.createElement(D.Provider,{value:n},t)}function B(e){if(e.component){const t=e.component;return r.createElement(t,e.props)}}function $(){const e=(0,r.useContext)(D);if(!e)throw new R.i6("NavbarSecondaryMenuDisplayProvider");const[t,n]=e,a=(0,r.useCallback)((()=>n(!1)),[n]),o=(0,M.HY)();return(0,r.useMemo)((()=>({shown:t,hide:a,content:B(o)})),[a,o,t])}function U(e){let{header:t,primaryMenu:n,secondaryMenu:o}=e;const{shown:i}=$();return r.createElement("div",{className:"navbar-sidebar"},t,r.createElement("div",{className:(0,a.Z)("navbar-sidebar__items",{"navbar-sidebar__items--show-secondary":i})},r.createElement("div",{className:"navbar-sidebar__item menu"},n),r.createElement("div",{className:"navbar-sidebar__item menu"},o)))}var z=n(2949),j=n(2389);function H(e){return r.createElement("svg",(0,l.Z)({viewBox:"0 0 24 24",width:24,height:24},e),r.createElement("path",{fill:"currentColor",d:"M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"}))}function Z(e){return r.createElement("svg",(0,l.Z)({viewBox:"0 0 24 24",width:24,height:24},e),r.createElement("path",{fill:"currentColor",d:"M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"}))}const G={toggle:"toggle_vylO",toggleButton:"toggleButton_gllP",darkToggleIcon:"darkToggleIcon_wfgR",lightToggleIcon:"lightToggleIcon_pyhR",toggleButtonDisabled:"toggleButtonDisabled_aARS"};function V(e){let{className:t,value:n,onChange:o}=e;const i=(0,j.Z)(),l=(0,c.I)({message:"Switch between dark and light mode (currently {mode})",id:"theme.colorToggle.ariaLabel",description:"The ARIA label for the navbar color mode toggle"},{mode:"dark"===n?(0,c.I)({message:"dark mode",id:"theme.colorToggle.ariaLabel.mode.dark",description:"The name for the dark color mode"}):(0,c.I)({message:"light mode",id:"theme.colorToggle.ariaLabel.mode.light",description:"The name for the light color mode"})});return r.createElement("div",{className:(0,a.Z)(G.toggle,t)},r.createElement("button",{className:(0,a.Z)("clean-btn",G.toggleButton,!i&&G.toggleButtonDisabled),type:"button",onClick:()=>o("dark"===n?"light":"dark"),disabled:!i,title:l,"aria-label":l,"aria-live":"polite"},r.createElement(H,{className:(0,a.Z)(G.toggleIcon,G.lightToggleIcon)}),r.createElement(Z,{className:(0,a.Z)(G.toggleIcon,G.darkToggleIcon)})))}const W=r.memo(V);function q(e){let{className:t}=e;const n=(0,w.L)().colorMode.disableSwitch,{colorMode:a,setColorMode:o}=(0,z.I)();return n?null:r.createElement(W,{className:t,value:a,onChange:o})}var Y=n(1327);function K(){return r.createElement(Y.Z,{className:"navbar__brand",imageClassName:"navbar__logo",titleClassName:"navbar__title text--truncate"})}function X(){const e=(0,I.e)();return r.createElement("button",{type:"button","aria-label":(0,c.I)({id:"theme.docs.sidebar.closeSidebarButtonAriaLabel",message:"Close navigation bar",description:"The ARIA label for close button of mobile sidebar"}),className:"clean-btn navbar-sidebar__close",onClick:()=>e.toggle()},r.createElement(k,{color:"var(--ifm-color-emphasis-600)"}))}function Q(){return r.createElement("div",{className:"navbar-sidebar__brand"},r.createElement(K,null),r.createElement(q,{className:"margin-right--md"}),r.createElement(X,null))}var J=n(9960),ee=n(4996),te=n(3919),ne=n(8022),re=n(9471);function ae(e){let{activeBasePath:t,activeBaseRegex:n,to:a,href:o,label:i,html:s,isDropdownLink:c,prependBaseUrlToHref:u,...d}=e;const f=(0,ee.Z)(a),p=(0,ee.Z)(t),m=(0,ee.Z)(o,{forcePrependBaseUrl:!0}),h=i&&o&&!(0,te.Z)(o),g=s?{dangerouslySetInnerHTML:{__html:s}}:{children:r.createElement(r.Fragment,null,i,h&&r.createElement(re.Z,c&&{width:12,height:12}))};return o?r.createElement(J.Z,(0,l.Z)({href:u?m:o},d,g)):r.createElement(J.Z,(0,l.Z)({to:f,isNavLink:!0},(t||n)&&{isActive:(e,t)=>n?(0,ne.F)(n,t.pathname):t.pathname.startsWith(p)},d,g))}function oe(e){let{className:t,isDropdownItem:n=!1,...o}=e;const i=r.createElement(ae,(0,l.Z)({className:(0,a.Z)(n?"dropdown__link":"navbar__item navbar__link",t),isDropdownLink:n},o));return n?r.createElement("li",null,i):i}function ie(e){let{className:t,isDropdownItem:n,...o}=e;return r.createElement("li",{className:"menu__list-item"},r.createElement(ae,(0,l.Z)({className:(0,a.Z)("menu__link",t)},o)))}function le(e){let{mobile:t=!1,position:n,...a}=e;const o=t?ie:oe;return r.createElement(o,(0,l.Z)({},a,{activeClassName:a.activeClassName??(t?"menu__link--active":"navbar__link--active")}))}var se=n(6043),ce=n(8596),ue=n(2263);function de(e,t){return e.some((e=>function(e,t){return!!(0,ce.Mg)(e.to,t)||!!(0,ne.F)(e.activeBaseRegex,t)||!(!e.activeBasePath||!t.startsWith(e.activeBasePath))}(e,t)))}function fe(e){let{items:t,position:n,className:o,onClick:i,...s}=e;const c=(0,r.useRef)(null),[u,d]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{const e=e=>{c.current&&!c.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}}),[c]),r.createElement("div",{ref:c,className:(0,a.Z)("navbar__item","dropdown","dropdown--hoverable",{"dropdown--right":"right"===n,"dropdown--show":u})},r.createElement(ae,(0,l.Z)({"aria-haspopup":"true","aria-expanded":u,role:"button",href:s.to?void 0:"#",className:(0,a.Z)("navbar__link",o)},s,{onClick:s.to?void 0:e=>e.preventDefault(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),d(!u))}}),s.children??s.label),r.createElement("ul",{className:"dropdown__menu"},t.map(((e,n)=>r.createElement(Ze,(0,l.Z)({isDropdownItem:!0,onKeyDown:e=>{if(n===t.length-1&&"Tab"===e.key){e.preventDefault(),d(!1);const t=c.current.nextElementSibling;if(t){(t instanceof HTMLAnchorElement?t:t.querySelector("a")).focus()}}},activeClassName:"dropdown__link--active"},e,{key:n}))))))}function pe(e){let{items:t,className:n,position:o,onClick:i,...c}=e;const u=function(){const{siteConfig:{baseUrl:e}}=(0,ue.Z)(),{pathname:t}=(0,s.TH)();return t.replace(e,"/")}(),d=de(t,u),{collapsed:f,toggleCollapsed:p,setCollapsed:m}=(0,se.u)({initialState:()=>!d});return(0,r.useEffect)((()=>{d&&m(!d)}),[u,d,m]),r.createElement("li",{className:(0,a.Z)("menu__list-item",{"menu__list-item--collapsed":f})},r.createElement(ae,(0,l.Z)({role:"button",className:(0,a.Z)("menu__link menu__link--sublist menu__link--sublist-caret",n)},c,{onClick:e=>{e.preventDefault(),p()}}),c.children??c.label),r.createElement(se.z,{lazy:!0,as:"ul",className:"menu__list",collapsed:f},t.map(((e,t)=>r.createElement(Ze,(0,l.Z)({mobile:!0,isDropdownItem:!0,onClick:i,activeClassName:"menu__link--active"},e,{key:t}))))))}function me(e){let{mobile:t=!1,...n}=e;const a=t?pe:fe;return r.createElement(a,n)}var he=n(4711);function ge(e){let{width:t=20,height:n=20,...a}=e;return r.createElement("svg",(0,l.Z)({viewBox:"0 0 24 24",width:t,height:n,"aria-hidden":!0},a),r.createElement("path",{fill:"currentColor",d:"M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"}))}const be="iconLanguage_nlXk";var ve=n(3935),ye=n(5742),we=n(6177);function Ee(){return r.createElement("svg",{width:"15",height:"15",className:"DocSearch-Control-Key-Icon"},r.createElement("path",{d:"M4.505 4.496h2M5.505 5.496v5M8.216 4.496l.055 5.993M10 7.5c.333.333.5.667.5 1v2M12.326 4.5v5.996M8.384 4.496c1.674 0 2.116 0 2.116 1.5s-.442 1.5-2.116 1.5M3.205 9.303c-.09.448-.277 1.21-1.241 1.203C1 10.5.5 9.513.5 8V7c0-1.57.5-2.5 1.464-2.494.964.006 1.134.598 1.24 1.342M12.553 10.5h1.953",strokeWidth:"1.2",stroke:"currentColor",fill:"none",strokeLinecap:"square"}))}var ke=n(830),Se=["translations"];function _e(){return _e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_e.apply(this,arguments)}function xe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(s){l=!0,a=s}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Te(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ce(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var Ae="Ctrl";var Ne=r.forwardRef((function(e,t){var n=e.translations,a=void 0===n?{}:n,o=Ce(e,Se),i=a.buttonText,l=void 0===i?"Search":i,s=a.buttonAriaLabel,c=void 0===s?"Search":s,u=xe((0,r.useState)(null),2),d=u[0],f=u[1];return(0,r.useEffect)((function(){"undefined"!=typeof navigator&&(/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)?f("\u2318"):f(Ae))}),[]),r.createElement("button",_e({type:"button",className:"DocSearch DocSearch-Button","aria-label":c},o,{ref:t}),r.createElement("span",{className:"DocSearch-Button-Container"},r.createElement(ke.W,null),r.createElement("span",{className:"DocSearch-Button-Placeholder"},l)),r.createElement("span",{className:"DocSearch-Button-Keys"},null!==d&&r.createElement(r.Fragment,null,r.createElement("kbd",{className:"DocSearch-Button-Key"},d===Ae?r.createElement(Ee,null):d),r.createElement("kbd",{className:"DocSearch-Button-Key"},"K"))))})),Oe=n(3320);const Le={button:{buttonText:(0,c.I)({id:"theme.SearchBar.label",message:"Search",description:"The ARIA label and placeholder for search button"}),buttonAriaLabel:(0,c.I)({id:"theme.SearchBar.label",message:"Search",description:"The ARIA label and placeholder for search button"})},modal:{searchBox:{resetButtonTitle:(0,c.I)({id:"theme.SearchModal.searchBox.resetButtonTitle",message:"Clear the query",description:"The label and ARIA label for search box reset button"}),resetButtonAriaLabel:(0,c.I)({id:"theme.SearchModal.searchBox.resetButtonTitle",message:"Clear the query",description:"The label and ARIA label for search box reset button"}),cancelButtonText:(0,c.I)({id:"theme.SearchModal.searchBox.cancelButtonText",message:"Cancel",description:"The label and ARIA label for search box cancel button"}),cancelButtonAriaLabel:(0,c.I)({id:"theme.SearchModal.searchBox.cancelButtonText",message:"Cancel",description:"The label and ARIA label for search box cancel button"})},startScreen:{recentSearchesTitle:(0,c.I)({id:"theme.SearchModal.startScreen.recentSearchesTitle",message:"Recent",description:"The title for recent searches"}),noRecentSearchesText:(0,c.I)({id:"theme.SearchModal.startScreen.noRecentSearchesText",message:"No recent searches",description:"The text when no recent searches"}),saveRecentSearchButtonTitle:(0,c.I)({id:"theme.SearchModal.startScreen.saveRecentSearchButtonTitle",message:"Save this search",description:"The label for save recent search button"}),removeRecentSearchButtonTitle:(0,c.I)({id:"theme.SearchModal.startScreen.removeRecentSearchButtonTitle",message:"Remove this search from history",description:"The label for remove recent search button"}),favoriteSearchesTitle:(0,c.I)({id:"theme.SearchModal.startScreen.favoriteSearchesTitle",message:"Favorite",description:"The title for favorite searches"}),removeFavoriteSearchButtonTitle:(0,c.I)({id:"theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle",message:"Remove this search from favorites",description:"The label for remove favorite search button"})},errorScreen:{titleText:(0,c.I)({id:"theme.SearchModal.errorScreen.titleText",message:"Unable to fetch results",description:"The title for error screen of search modal"}),helpText:(0,c.I)({id:"theme.SearchModal.errorScreen.helpText",message:"You might want to check your network connection.",description:"The help text for error screen of search modal"})},footer:{selectText:(0,c.I)({id:"theme.SearchModal.footer.selectText",message:"to select",description:"The explanatory text of the action for the enter key"}),selectKeyAriaLabel:(0,c.I)({id:"theme.SearchModal.footer.selectKeyAriaLabel",message:"Enter key",description:"The ARIA label for the Enter key button that makes the selection"}),navigateText:(0,c.I)({id:"theme.SearchModal.footer.navigateText",message:"to navigate",description:"The explanatory text of the action for the Arrow up and Arrow down key"}),navigateUpKeyAriaLabel:(0,c.I)({id:"theme.SearchModal.footer.navigateUpKeyAriaLabel",message:"Arrow up",description:"The ARIA label for the Arrow up key button that makes the navigation"}),navigateDownKeyAriaLabel:(0,c.I)({id:"theme.SearchModal.footer.navigateDownKeyAriaLabel",message:"Arrow down",description:"The ARIA label for the Arrow down key button that makes the navigation"}),closeText:(0,c.I)({id:"theme.SearchModal.footer.closeText",message:"to close",description:"The explanatory text of the action for Escape key"}),closeKeyAriaLabel:(0,c.I)({id:"theme.SearchModal.footer.closeKeyAriaLabel",message:"Escape key",description:"The ARIA label for the Escape key button that close the modal"}),searchByText:(0,c.I)({id:"theme.SearchModal.footer.searchByText",message:"Search by",description:"The text explain that the search is making by Algolia"})},noResultsScreen:{noResultsText:(0,c.I)({id:"theme.SearchModal.noResultsScreen.noResultsText",message:"No results for",description:"The text explains that there are no results for the following search"}),suggestedQueryText:(0,c.I)({id:"theme.SearchModal.noResultsScreen.suggestedQueryText",message:"Try searching for",description:"The text for the suggested query when no results are found for the following search"}),reportMissingResultsText:(0,c.I)({id:"theme.SearchModal.noResultsScreen.reportMissingResultsText",message:"Believe this query should return results?",description:"The text for the question where the user thinks there are missing results"}),reportMissingResultsLinkText:(0,c.I)({id:"theme.SearchModal.noResultsScreen.reportMissingResultsLinkText",message:"Let us know.",description:"The text for the link to report missing results"})}},placeholder:(0,c.I)({id:"theme.SearchModal.placeholder",message:"Search docs",description:"The placeholder of the input of the DocSearch pop-up modal"})};let Ie=null;function Pe(e){let{hit:t,children:n}=e;return r.createElement(J.Z,{to:t.url},n)}function Re(e){let{state:t,onClose:n}=e;const{generateSearchPageLink:a}=(0,we.O)();return r.createElement(J.Z,{to:a(t.query),onClick:n},r.createElement(c.Z,{id:"theme.SearchBar.seeAll",values:{count:t.context.nbHits}},"See all {count} results"))}function Me(e){var t;let{contextualSearch:a,externalUrlRegex:o,...i}=e;const{siteMetadata:c}=(0,ue.Z)(),u=function(){const{locale:e,tags:t}=(0,Oe._q)();return[`language:${e}`,t.map((e=>`docusaurus_tag:${e}`))]}(),d=(null==(t=i.searchParameters)?void 0:t.facetFilters)??[],f=a?function(e,t){const n=e=>"string"==typeof e?[e]:e;return[...n(e),...n(t)]}(u,d):d,p={...i.searchParameters,facetFilters:f},{withBaseUrl:m}=(0,ee.C)(),h=(0,s.k6)(),g=(0,r.useRef)(null),b=(0,r.useRef)(null),[v,y]=(0,r.useState)(!1),[w,E]=(0,r.useState)(void 0),k=(0,r.useCallback)((()=>Ie?Promise.resolve():Promise.all([n.e(6780).then(n.bind(n,6780)),Promise.all([n.e(532),n.e(6945)]).then(n.bind(n,6945)),Promise.all([n.e(532),n.e(8894)]).then(n.bind(n,8894))]).then((e=>{let[{DocSearchModal:t}]=e;Ie=t}))),[]),S=(0,r.useCallback)((()=>{k().then((()=>{g.current=document.createElement("div"),document.body.insertBefore(g.current,document.body.firstChild),y(!0)}))}),[k,y]),_=(0,r.useCallback)((()=>{var e;y(!1),null==(e=g.current)||e.remove()}),[y]),x=(0,r.useCallback)((e=>{k().then((()=>{y(!0),E(e.key)}))}),[k,y,E]),T=(0,r.useRef)({navigate(e){let{itemUrl:t}=e;(0,ne.F)(o,t)?window.location.href=t:h.push(t)}}).current,C=(0,r.useRef)((e=>e.map((e=>{if((0,ne.F)(o,e.url))return e;const t=new URL(e.url);return{...e,url:m(`${t.pathname}${t.hash}`)}})))).current,A=(0,r.useMemo)((()=>e=>r.createElement(Re,(0,l.Z)({},e,{onClose:_}))),[_]),N=(0,r.useCallback)((e=>(e.addAlgoliaAgent("docusaurus",c.docusaurusVersion),e)),[c.docusaurusVersion]);return function(e){var t=e.isOpen,n=e.onOpen,a=e.onClose,o=e.onInput,i=e.searchButtonRef;r.useEffect((function(){function e(e){(27===e.keyCode&&t||"k"===e.key.toLowerCase()&&(e.metaKey||e.ctrlKey)||!function(e){var t=e.target,n=t.tagName;return t.isContentEditable||"INPUT"===n||"SELECT"===n||"TEXTAREA"===n}(e)&&"/"===e.key&&!t)&&(e.preventDefault(),t?a():document.body.classList.contains("DocSearch--active")||document.body.classList.contains("DocSearch--active")||n()),i&&i.current===document.activeElement&&o&&/[a-zA-Z0-9]/.test(String.fromCharCode(e.keyCode))&&o(e)}return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}}),[t,n,a,o,i])}({isOpen:v,onOpen:S,onClose:_,onInput:x,searchButtonRef:b}),r.createElement(r.Fragment,null,r.createElement(ye.Z,null,r.createElement("link",{rel:"preconnect",href:`https://${i.appId}-dsn.algolia.net`,crossOrigin:"anonymous"})),r.createElement(Ne,{onTouchStart:k,onFocus:k,onMouseOver:k,onClick:S,ref:b,translations:Le.button}),v&&Ie&&g.current&&(0,ve.createPortal)(r.createElement(Ie,(0,l.Z)({onClose:_,initialScrollY:window.scrollY,initialQuery:w,navigator:T,transformItems:C,hitComponent:Pe,transformSearchClient:N},i.searchPagePath&&{resultsFooterComponent:A},i,{searchParameters:p,placeholder:Le.placeholder,translations:Le.modal})),g.current))}function De(){const{siteConfig:e}=(0,ue.Z)();return r.createElement(Me,e.themeConfig.algolia)}const Fe="searchBox_ZlJk";function Be(e){let{children:t,className:n}=e;return r.createElement("div",{className:(0,a.Z)(n,Fe)},t)}var $e=n(143),Ue=n(2802);var ze=n(373);const je=e=>e.docs.find((t=>t.id===e.mainDocId));const He={default:le,localeDropdown:function(e){let{mobile:t,dropdownItemsBefore:n,dropdownItemsAfter:a,...o}=e;const{i18n:{currentLocale:i,locales:u,localeConfigs:d}}=(0,ue.Z)(),f=(0,he.l)(),{search:p,hash:m}=(0,s.TH)(),h=[...n,...u.map((e=>{const n=`${`pathname://${f.createUrl({locale:e,fullyQualified:!1})}`}${p}${m}`;return{label:d[e].label,lang:d[e].htmlLang,to:n,target:"_self",autoAddBaseUrl:!1,className:e===i?t?"menu__link--active":"dropdown__link--active":""}})),...a],g=t?(0,c.I)({message:"Languages",id:"theme.navbar.mobileLanguageDropdown.label",description:"The label for the mobile language switcher dropdown"}):d[i].label;return r.createElement(me,(0,l.Z)({},o,{mobile:t,label:r.createElement(r.Fragment,null,r.createElement(ge,{className:be}),g),items:h}))},search:function(e){let{mobile:t,className:n}=e;return t?null:r.createElement(Be,{className:n},r.createElement(De,null))},dropdown:me,html:function(e){let{value:t,className:n,mobile:o=!1,isDropdownItem:i=!1}=e;const l=i?"li":"div";return r.createElement(l,{className:(0,a.Z)({navbar__item:!o&&!i,"menu__list-item":o},n),dangerouslySetInnerHTML:{__html:t}})},doc:function(e){let{docId:t,label:n,docsPluginId:a,...o}=e;const{activeDoc:i}=(0,$e.Iw)(a),s=(0,Ue.vY)(t,a);return null===s?null:r.createElement(le,(0,l.Z)({exact:!0},o,{isActive:()=>(null==i?void 0:i.path)===s.path||!(null==i||!i.sidebar)&&i.sidebar===s.sidebar,label:n??s.id,to:s.path}))},docSidebar:function(e){let{sidebarId:t,label:n,docsPluginId:a,...o}=e;const{activeDoc:i}=(0,$e.Iw)(a),s=(0,Ue.oz)(t,a).link;if(!s)throw new Error(`DocSidebarNavbarItem: Sidebar with ID "${t}" doesn't have anything to be linked to.`);return r.createElement(le,(0,l.Z)({exact:!0},o,{isActive:()=>(null==i?void 0:i.sidebar)===t,label:n??s.label,to:s.path}))},docsVersion:function(e){let{label:t,to:n,docsPluginId:a,...o}=e;const i=(0,Ue.lO)(a)[0],s=t??i.label,c=n??(e=>e.docs.find((t=>t.id===e.mainDocId)))(i).path;return r.createElement(le,(0,l.Z)({},o,{label:s,to:c}))},docsVersionDropdown:function(e){let{mobile:t,docsPluginId:n,dropdownActiveClassDisabled:a,dropdownItemsBefore:o,dropdownItemsAfter:i,...u}=e;const{search:d,hash:f}=(0,s.TH)(),p=(0,$e.Iw)(n),m=(0,$e.gB)(n),{savePreferredVersionName:h}=(0,ze.J)(n),g=[...o,...m.map((e=>{const t=p.alternateDocVersions[e.name]??je(e);return{label:e.label,to:`${t.path}${d}${f}`,isActive:()=>e===p.activeVersion,onClick:()=>h(e.name)}})),...i],b=(0,Ue.lO)(n)[0],v=t&&g.length>1?(0,c.I)({id:"theme.navbar.mobileVersionsDropdown.label",message:"Versions",description:"The label for the navbar versions dropdown on mobile view"}):b.label,y=t&&g.length>1?void 0:je(b).path;return g.length<=1?r.createElement(le,(0,l.Z)({},u,{mobile:t,label:v,to:y,isActive:a?()=>!1:void 0})):r.createElement(me,(0,l.Z)({},u,{mobile:t,label:v,to:y,items:g,isActive:a?()=>!1:void 0}))}};function Ze(e){let{type:t,...n}=e;const a=function(e,t){return e&&"default"!==e?e:"items"in t?"dropdown":"default"}(t,n),o=He[a];if(!o)throw new Error(`No NavbarItem component found for type "${t}".`);return r.createElement(o,n)}function Ge(){const e=(0,I.e)(),t=(0,w.L)().navbar.items;return r.createElement("ul",{className:"menu__list"},t.map(((t,n)=>r.createElement(Ze,(0,l.Z)({mobile:!0},t,{onClick:()=>e.toggle(),key:n})))))}function Ve(e){return r.createElement("button",(0,l.Z)({},e,{type:"button",className:"clean-btn navbar-sidebar__back"}),r.createElement(c.Z,{id:"theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel",description:"The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)"},"\u2190 Back to main menu"))}function We(){const e=0===(0,w.L)().navbar.items.length,t=$();return r.createElement(r.Fragment,null,!e&&r.createElement(Ve,{onClick:()=>t.hide()}),t.content)}function qe(){const e=(0,I.e)();var t;return void 0===(t=e.shown)&&(t=!0),(0,r.useEffect)((()=>(document.body.style.overflow=t?"hidden":"visible",()=>{document.body.style.overflow="visible"})),[t]),e.shouldRender?r.createElement(U,{header:r.createElement(Q,null),primaryMenu:r.createElement(Ge,null),secondaryMenu:r.createElement(We,null)}):null}const Ye="navbarHideable_m1mJ",Ke="navbarHidden_jGov";function Xe(e){return r.createElement("div",(0,l.Z)({role:"presentation"},e,{className:(0,a.Z)("navbar-sidebar__backdrop",e.className)}))}function Qe(e){let{children:t}=e;const{navbar:{hideOnScroll:n,style:o}}=(0,w.L)(),i=(0,I.e)(),{navbarRef:l,isNavbarVisible:s}=function(e){const[t,n]=(0,r.useState)(e),a=(0,r.useRef)(!1),o=(0,r.useRef)(0),i=(0,r.useCallback)((e=>{null!==e&&(o.current=e.getBoundingClientRect().height)}),[]);return(0,P.RF)(((t,r)=>{let{scrollY:i}=t;if(!e)return;if(i<o.current)return void n(!0);if(a.current)return void(a.current=!1);const l=null==r?void 0:r.scrollY,s=document.documentElement.scrollHeight-o.current,c=window.innerHeight;l&&i>=l?n(!1):i+c<s&&n(!0)})),(0,u.S)((t=>{if(!e)return;const r=t.location.hash;if(r?document.getElementById(r.substring(1)):void 0)return a.current=!0,void n(!1);n(!0)})),{navbarRef:i,isNavbarVisible:t}}(n);return r.createElement("nav",{ref:l,className:(0,a.Z)("navbar","navbar--fixed-top",n&&[Ye,!s&&Ke],{"navbar--dark":"dark"===o,"navbar--primary":"primary"===o,"navbar-sidebar--show":i.shown})},t,r.createElement(Xe,{onClick:i.toggle}),r.createElement(qe,null))}function Je(e){let{width:t=30,height:n=30,className:a,...o}=e;return r.createElement("svg",(0,l.Z)({className:a,width:t,height:n,viewBox:"0 0 30 30","aria-hidden":"true"},o),r.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M4 7h22M4 15h22M4 23h22"}))}function et(){const{toggle:e,shown:t}=(0,I.e)();return r.createElement("button",{onClick:e,"aria-label":(0,c.I)({id:"theme.docs.sidebar.toggleSidebarButtonAriaLabel",message:"Toggle navigation bar",description:"The ARIA label for hamburger menu button of mobile navigation"}),"aria-expanded":t,className:"navbar__toggle clean-btn",type:"button"},r.createElement(Je,null))}const tt="colorModeToggle_x44X";function nt(e){let{items:t}=e;return r.createElement(r.Fragment,null,t.map(((e,t)=>r.createElement(Ze,(0,l.Z)({},e,{key:t})))))}function rt(e){let{left:t,right:n}=e;const{siteConfig:a}=(0,ue.Z)();return(0,r.useEffect)((()=>{var e=document.createElement("script");e.type="text/javascript",e.src="https://buttons.github.io/buttons.js",document.querySelector("head").append(e)})),r.createElement("div",{className:"navbar__inner"},r.createElement("div",{className:"navbar__items"},t),r.createElement("div",{className:"navbar__items navbar__items--right"},r.createElement("div",{style:{marginTop:"8px",marginRight:"15px"}},r.createElement("a",{className:"github-button",href:`https://github.com/sponsors/${a.organizationName}`,"data-color-scheme":"no-preference: light; light: light; dark: dark;","data-icon":"octicon-heart","data-size":"large","aria-label":`Sponsor @${a.organizationName} on GitHub`},"Sponsor"),"\xa0",r.createElement("a",{className:"github-button",href:`https://github.com/${a.organizationName}/${a.projectName}`,"data-icon":"octicon-star","data-size":"large","data-show-count":"true","aria-label":`Star ${a.organizationName}/${a.projectName} on GitHub`},"Star"),"\xa0",r.createElement("a",{className:"github-button",href:`https://github.com/${a.organizationName}`,"data-size":"large","aria-label":`Follow @${a.organizationName} on GitHub`},`Follow @${a.organizationName}`)),n))}function at(){const e=(0,I.e)(),t=(0,w.L)().navbar.items,[n,a]=function(e){function t(e){return"left"===(e.position??"right")}return[e.filter(t),e.filter((e=>!t(e)))]}(t),o=t.find((e=>"search"===e.type));return r.createElement(rt,{left:r.createElement(r.Fragment,null,!e.disabled&&r.createElement(et,null),r.createElement(K,null),r.createElement(nt,{items:n})),right:r.createElement(r.Fragment,null,r.createElement(nt,{items:a}),r.createElement(q,{className:tt}),!o&&r.createElement(Be,null,r.createElement(De,null)))})}function ot(){return r.createElement(Qe,null,r.createElement(at,null))}function it(e){let{item:t}=e;const{to:n,href:a,label:o,prependBaseUrlToHref:i,...s}=t,c=(0,ee.Z)(n),u=(0,ee.Z)(a,{forcePrependBaseUrl:!0});return r.createElement(J.Z,(0,l.Z)({className:"footer__link-item"},a?{href:i?u:a}:{to:c},s),o,a&&!(0,te.Z)(a)&&r.createElement(re.Z,null))}function lt(e){let{item:t}=e;return t.html?r.createElement("li",{className:"footer__item",dangerouslySetInnerHTML:{__html:t.html}}):r.createElement("li",{key:t.href??t.to,className:"footer__item"},r.createElement(it,{item:t}))}function st(e){let{column:t}=e;return r.createElement("div",{className:"col footer__col"},r.createElement("div",{className:"footer__title"},t.title),r.createElement("ul",{className:"footer__items clean-list"},t.items.map(((e,t)=>r.createElement(lt,{key:t,item:e})))))}function ct(e){let{columns:t}=e;return r.createElement("div",{className:"row footer__links"},t.map(((e,t)=>r.createElement(st,{key:t,column:e}))))}function ut(){return r.createElement("span",{className:"footer__link-separator"},"\xb7")}function dt(e){let{item:t}=e;return t.html?r.createElement("span",{className:"footer__link-item",dangerouslySetInnerHTML:{__html:t.html}}):r.createElement(it,{item:t})}function ft(e){let{links:t}=e;return r.createElement("div",{className:"footer__links text--center"},r.createElement("div",{className:"footer__links"},t.map(((e,n)=>r.createElement(r.Fragment,{key:n},r.createElement(dt,{item:e}),t.length!==n+1&&r.createElement(ut,null))))))}function pt(e){let{links:t}=e;return function(e){return"title"in e[0]}(t)?r.createElement(ct,{columns:t}):r.createElement(ft,{links:t})}var mt=n(941);const ht="footerLogoLink_BH7S";function gt(e){let{logo:t}=e;const{withBaseUrl:n}=(0,ee.C)(),o={light:n(t.src),dark:n(t.srcDark??t.src)};return r.createElement(mt.Z,{className:(0,a.Z)("footer__logo",t.className),alt:t.alt,sources:o,width:t.width,height:t.height,style:t.style})}function bt(e){let{logo:t}=e;return t.href?r.createElement(J.Z,{href:t.href,className:ht,target:t.target},r.createElement(gt,{logo:t})):r.createElement(gt,{logo:t})}function vt(e){let{copyright:t}=e;return r.createElement("div",{className:"footer__copyright",dangerouslySetInnerHTML:{__html:t}})}function yt(e){let{style:t,links:n,logo:o,copyright:i}=e;return r.createElement("footer",{className:(0,a.Z)("footer",{"footer--dark":"dark"===t})},r.createElement("div",{className:"container container-fluid"},n,(o||i)&&r.createElement("div",{className:"footer__bottom text--center"},o&&r.createElement("div",{className:"margin-bottom--sm"},o),i)))}function wt(){const{footer:e}=(0,w.L)();if(!e)return null;const{copyright:t,links:n,logo:a,style:o}=e;return r.createElement(yt,{style:o,links:n&&n.length>0&&r.createElement(pt,{links:n}),logo:a&&r.createElement(bt,{logo:a}),copyright:t&&r.createElement(vt,{copyright:t})})}const Et=r.memo(wt);var kt=n(12);const St="docusaurus.tab.",_t=r.createContext(void 0);const xt=(0,R.Qc)([z.S,E.pl,function(e){let{children:t}=e;const n=function(){const[e,t]=(0,r.useState)({}),n=(0,r.useCallback)(((e,t)=>{(0,kt.W)(`docusaurus.tab.${e}`).set(t)}),[]);(0,r.useEffect)((()=>{try{const e={};(0,kt._)().forEach((t=>{if(t.startsWith(St)){const n=t.substring(St.length);e[n]=(0,kt.W)(t).get()}})),t(e)}catch(e){console.error(e)}}),[]);const a=(0,r.useCallback)(((e,r)=>{t((t=>({...t,[e]:r}))),n(e,r)}),[n]);return(0,r.useMemo)((()=>({tabGroupChoices:e,setTabGroupChoices:a})),[e,a])}();return r.createElement(_t.Provider,{value:n},t)},P.OC,ze.L5,i.VC,function(e){let{children:t}=e;return r.createElement(M.n2,null,r.createElement(I.M,null,r.createElement(F,null,t)))}]);function Tt(e){let{children:t}=e;return r.createElement(xt,null,t)}function Ct(e){let{error:t,tryAgain:n}=e;return r.createElement("main",{className:"container margin-vert--xl"},r.createElement("div",{className:"row"},r.createElement("div",{className:"col col--6 col--offset-3"},r.createElement("h1",{className:"hero__title"},r.createElement(c.Z,{id:"theme.ErrorPageContent.title",description:"The title of the fallback page when the page crashed"},"This page crashed.")),r.createElement("p",null,t.message),r.createElement("div",null,r.createElement("button",{type:"button",onClick:n},r.createElement(c.Z,{id:"theme.ErrorPageContent.tryAgain",description:"The label of the button to try again when the page crashed"},"Try again"))))))}const At="mainWrapper_z2l0";function Nt(e){const{children:t,noFooter:n,wrapperClassName:l,title:s,description:c}=e;return(0,b.t)(),r.createElement(Tt,null,r.createElement(i.d,{title:s,description:c}),r.createElement(y,null),r.createElement(L,null),r.createElement(ot,null),r.createElement("div",{id:d,className:(0,a.Z)(g.k.wrapper.main,At,l)},r.createElement(o.Z,{fallback:e=>r.createElement(Ct,e)},t)),!n&&r.createElement(Et,null))}},1327:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(7462),a=n(7294),o=n(9960),i=n(4996),l=n(2263),s=n(6668),c=n(941);function u(e){let{logo:t,alt:n,imageClassName:r}=e;const o={light:(0,i.Z)(t.src),dark:(0,i.Z)(t.srcDark||t.src)},l=a.createElement(c.Z,{className:t.className,sources:o,height:t.height,width:t.width,alt:n,style:t.style});return r?a.createElement("div",{className:r},l):l}function d(e){const{siteConfig:{title:t}}=(0,l.Z)(),{navbar:{title:n,logo:c}}=(0,s.L)(),{imageClassName:d,titleClassName:f,...p}=e,m=(0,i.Z)((null==c?void 0:c.href)||"/"),h=n?"":t,g=(null==c?void 0:c.alt)??h;return a.createElement(o.Z,(0,r.Z)({to:m},p,(null==c?void 0:c.target)&&{target:c.target}),c&&a.createElement(u,{logo:c,alt:g,imageClassName:d}),null!=n&&a.createElement("b",{className:f},n))}},197:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(7294),a=n(5742);function o(e){let{locale:t,version:n,tag:o}=e;const i=t;return r.createElement(a.Z,null,t&&r.createElement("meta",{name:"docusaurus_locale",content:t}),n&&r.createElement("meta",{name:"docusaurus_version",content:n}),o&&r.createElement("meta",{name:"docusaurus_tag",content:o}),i&&r.createElement("meta",{name:"docsearch:language",content:i}),n&&r.createElement("meta",{name:"docsearch:version",content:n}),o&&r.createElement("meta",{name:"docsearch:docusaurus_tag",content:o}))}},941:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(7462),a=n(7294),o=n(6010),i=n(2389),l=n(2949);const s={themedImage:"themedImage_ToTc","themedImage--light":"themedImage--light_HNdA","themedImage--dark":"themedImage--dark_i4oU"};function c(e){const t=(0,i.Z)(),{colorMode:n}=(0,l.I)(),{sources:c,className:u,alt:d,...f}=e,p=t?"dark"===n?["dark"]:["light"]:["light","dark"];return a.createElement(a.Fragment,null,p.map((e=>a.createElement("img",(0,r.Z)({key:e,src:c[e],alt:d,className:(0,o.Z)(s.themedImage,s[`themedImage--${e}`],u)},f)))))}},6043:(e,t,n)=>{"use strict";n.d(t,{u:()=>i,z:()=>m});var r=n(7462),a=n(7294),o=n(412);function i(e){let{initialState:t}=e;const[n,r]=(0,a.useState)(t??!1),o=(0,a.useCallback)((()=>{r((e=>!e))}),[]);return{collapsed:n,setCollapsed:r,toggleCollapsed:o}}const l={display:"none",overflow:"hidden",height:"0px"},s={display:"block",overflow:"visible",height:"auto"};function c(e,t){const n=t?l:s;e.style.display=n.display,e.style.overflow=n.overflow,e.style.height=n.height}function u(e){let{collapsibleRef:t,collapsed:n,animation:r}=e;const o=(0,a.useRef)(!1);(0,a.useEffect)((()=>{const e=t.current;function a(){const t=e.scrollHeight,n=(null==r?void 0:r.duration)??function(e){const t=e/36;return Math.round(10*(4+15*t**.25+t/5))}(t);return{transition:`height ${n}ms ${(null==r?void 0:r.easing)??"ease-in-out"}`,height:`${t}px`}}function i(){const t=a();e.style.transition=t.transition,e.style.height=t.height}if(!o.current)return c(e,n),void(o.current=!0);return e.style.willChange="height",function(){const t=requestAnimationFrame((()=>{n?(i(),requestAnimationFrame((()=>{e.style.height=l.height,e.style.overflow=l.overflow}))):(e.style.display="block",requestAnimationFrame((()=>{i()})))}));return()=>cancelAnimationFrame(t)}()}),[t,n,r])}function d(e){if(!o.Z.canUseDOM)return e?l:s}function f(e){let{as:t="div",collapsed:n,children:r,animation:o,onCollapseTransitionEnd:i,className:l,disableSSRStyle:s}=e;const f=(0,a.useRef)(null);return u({collapsibleRef:f,collapsed:n,animation:o}),a.createElement(t,{ref:f,style:s?void 0:d(n),onTransitionEnd:e=>{"height"===e.propertyName&&(c(f.current,n),null==i||i(n))},className:l},r)}function p(e){let{collapsed:t,...n}=e;const[o,i]=(0,a.useState)(!t),[l,s]=(0,a.useState)(t);return(0,a.useLayoutEffect)((()=>{t||i(!0)}),[t]),(0,a.useLayoutEffect)((()=>{o&&s(t)}),[o,t]),o?a.createElement(f,(0,r.Z)({},n,{collapsed:l})):null}function m(e){let{lazy:t,...n}=e;const r=t?p:f;return a.createElement(r,n)}},9689:(e,t,n)=>{"use strict";n.d(t,{nT:()=>m,pl:()=>p});var r=n(7294),a=n(2389),o=n(12),i=n(902),l=n(6668);const s=(0,o.W)("docusaurus.announcement.dismiss"),c=(0,o.W)("docusaurus.announcement.id"),u=()=>"true"===s.get(),d=e=>s.set(String(e)),f=r.createContext(null);function p(e){let{children:t}=e;const n=function(){const{announcementBar:e}=(0,l.L)(),t=(0,a.Z)(),[n,o]=(0,r.useState)((()=>!!t&&u()));(0,r.useEffect)((()=>{o(u())}),[]);const i=(0,r.useCallback)((()=>{d(!0),o(!0)}),[]);return(0,r.useEffect)((()=>{if(!e)return;const{id:t}=e;let n=c.get();"annoucement-bar"===n&&(n="announcement-bar");const r=t!==n;c.set(t),r&&d(!1),!r&&u()||o(!1)}),[e]),(0,r.useMemo)((()=>({isActive:!!e&&!n,close:i})),[e,n,i])}();return r.createElement(f.Provider,{value:n},t)}function m(){const e=(0,r.useContext)(f);if(!e)throw new i.i6("AnnouncementBarProvider");return e}},2949:(e,t,n)=>{"use strict";n.d(t,{I:()=>g,S:()=>h});var r=n(7294),a=n(412),o=n(902),i=n(12),l=n(6668);const s=r.createContext(void 0),c="theme",u=(0,i.W)(c),d="light",f="dark",p=e=>e===f?f:d;function m(){const{colorMode:{defaultMode:e,disableSwitch:t,respectPrefersColorScheme:n}}=(0,l.L)(),[o,i]=(0,r.useState)((e=>a.Z.canUseDOM?p(document.documentElement.getAttribute("data-theme")):p(e))(e));(0,r.useEffect)((()=>{t&&u.del()}),[t]);const s=(0,r.useCallback)((function(t,r){void 0===r&&(r={});const{persist:a=!0}=r;t?(i(t),a&&(e=>{u.set(p(e))})(t)):(i(n?window.matchMedia("(prefers-color-scheme: dark)").matches?f:d:e),u.del())}),[n,e]);(0,r.useEffect)((()=>{document.documentElement.setAttribute("data-theme",p(o))}),[o]),(0,r.useEffect)((()=>{if(t)return;const e=e=>{if(e.key!==c)return;const t=u.get();null!==t&&s(p(t))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}),[t,s]);const m=(0,r.useRef)(!1);return(0,r.useEffect)((()=>{if(t&&!n)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{window.matchMedia("print").matches||m.current?m.current=window.matchMedia("print").matches:s(null)};return e.addListener(r),()=>e.removeListener(r)}),[s,t,n]),(0,r.useMemo)((()=>({colorMode:o,setColorMode:s,get isDarkTheme(){return o===f},setLightTheme(){s(d)},setDarkTheme(){s(f)}})),[o,s])}function h(e){let{children:t}=e;const n=m();return r.createElement(s.Provider,{value:n},t)}function g(){const e=(0,r.useContext)(s);if(null==e)throw new o.i6("ColorModeProvider","Please see https://docusaurus.io/docs/api/themes/configuration#use-color-mode.");return e}},373:(e,t,n)=>{"use strict";n.d(t,{J:()=>y,L5:()=>b,Oh:()=>w});var r=n(7294),a=n(143),o=n(9935),i=n(6668),l=n(2802),s=n(902),c=n(12);const u=e=>`docs-preferred-version-${e}`,d=(e,t,n)=>{(0,c.W)(u(e),{persistence:t}).set(n)},f=(e,t)=>(0,c.W)(u(e),{persistence:t}).get(),p=(e,t)=>{(0,c.W)(u(e),{persistence:t}).del()};const m=r.createContext(null);function h(){const e=(0,a._r)(),t=(0,i.L)().docs.versionPersistence,n=(0,r.useMemo)((()=>Object.keys(e)),[e]),[o,l]=(0,r.useState)((()=>(e=>Object.fromEntries(e.map((e=>[e,{preferredVersionName:null}]))))(n)));(0,r.useEffect)((()=>{l(function(e){let{pluginIds:t,versionPersistence:n,allDocsData:r}=e;function a(e){const t=f(e,n);return r[e].versions.some((e=>e.name===t))?{preferredVersionName:t}:(p(e,n),{preferredVersionName:null})}return Object.fromEntries(t.map((e=>[e,a(e)])))}({allDocsData:e,versionPersistence:t,pluginIds:n}))}),[e,t,n]);return[o,(0,r.useMemo)((()=>({savePreferredVersion:function(e,n){d(e,t,n),l((t=>({...t,[e]:{preferredVersionName:n}})))}})),[t])]}function g(e){let{children:t}=e;const n=h();return r.createElement(m.Provider,{value:n},t)}function b(e){let{children:t}=e;return l.cE?r.createElement(g,null,t):r.createElement(r.Fragment,null,t)}function v(){const e=(0,r.useContext)(m);if(!e)throw new s.i6("DocsPreferredVersionContextProvider");return e}function y(e){void 0===e&&(e=o.m);const t=(0,a.zh)(e),[n,i]=v(),{preferredVersionName:l}=n[e];return{preferredVersion:t.versions.find((e=>e.name===l))??null,savePreferredVersionName:(0,r.useCallback)((t=>{i.savePreferredVersion(e,t)}),[i,e])}}function w(){const e=(0,a._r)(),[t]=v();function n(n){const r=e[n],{preferredVersionName:a}=t[n];return r.versions.find((e=>e.name===a))??null}const r=Object.keys(e);return Object.fromEntries(r.map((e=>[e,n(e)])))}},1116:(e,t,n)=>{"use strict";n.d(t,{V:()=>s,b:()=>l});var r=n(7294),a=n(902);const o=Symbol("EmptyContext"),i=r.createContext(o);function l(e){let{children:t,name:n,items:a}=e;const o=(0,r.useMemo)((()=>n&&a?{name:n,items:a}:null),[n,a]);return r.createElement(i.Provider,{value:o},t)}function s(){const e=(0,r.useContext)(i);if(e===o)throw new a.i6("DocsSidebarProvider");return e}},2961:(e,t,n)=>{"use strict";n.d(t,{M:()=>f,e:()=>p});var r=n(7294),a=n(3102),o=n(7524),i=n(6775),l=n(902);function s(e){!function(e){const t=(0,i.k6)(),n=(0,l.zX)(e);(0,r.useEffect)((()=>t.block(((e,t)=>n(e,t)))),[t,n])}(((t,n)=>{if("POP"===n)return e(t,n)}))}var c=n(6668);const u=r.createContext(void 0);function d(){const e=function(){const e=(0,a.HY)(),{items:t}=(0,c.L)().navbar;return 0===t.length&&!e.component}(),t=(0,o.i)(),n=!e&&"mobile"===t,[i,l]=(0,r.useState)(!1);s((()=>{if(i)return l(!1),!1}));const u=(0,r.useCallback)((()=>{l((e=>!e))}),[]);return(0,r.useEffect)((()=>{"desktop"===t&&l(!1)}),[t]),(0,r.useMemo)((()=>({disabled:e,shouldRender:n,toggle:u,shown:i})),[e,n,u,i])}function f(e){let{children:t}=e;const n=d();return r.createElement(u.Provider,{value:n},t)}function p(){const e=r.useContext(u);if(void 0===e)throw new l.i6("NavbarMobileSidebarProvider");return e}},3102:(e,t,n)=>{"use strict";n.d(t,{HY:()=>l,Zo:()=>s,n2:()=>i});var r=n(7294),a=n(902);const o=r.createContext(null);function i(e){let{children:t}=e;const n=(0,r.useState)({component:null,props:null});return r.createElement(o.Provider,{value:n},t)}function l(){const e=(0,r.useContext)(o);if(!e)throw new a.i6("NavbarSecondaryMenuContentProvider");return e[0]}function s(e){let{component:t,props:n}=e;const i=(0,r.useContext)(o);if(!i)throw new a.i6("NavbarSecondaryMenuContentProvider");const[,l]=i,s=(0,a.Ql)(n);return(0,r.useEffect)((()=>{l({component:t,props:s})}),[l,t,s]),(0,r.useEffect)((()=>()=>l({component:null,props:null})),[l]),null}},9727:(e,t,n)=>{"use strict";n.d(t,{h:()=>a,t:()=>o});var r=n(7294);const a="navigation-with-keyboard";function o(){(0,r.useEffect)((()=>{function e(e){"keydown"===e.type&&"Tab"===e.key&&document.body.classList.add(a),"mousedown"===e.type&&document.body.classList.remove(a)}return document.addEventListener("keydown",e),document.addEventListener("mousedown",e),()=>{document.body.classList.remove(a),document.removeEventListener("keydown",e),document.removeEventListener("mousedown",e)}}),[])}},6177:(e,t,n)=>{"use strict";n.d(t,{O:()=>l});var r=n(7294),a=n(6775),o=n(2263);const i="q";function l(){const e=(0,a.k6)(),{siteConfig:{baseUrl:t}}=(0,o.Z)(),[n,l]=(0,r.useState)("");(0,r.useEffect)((()=>{const e=new URLSearchParams(window.location.search).get(i)??"";l(e)}),[]);return{searchQuery:n,setSearchQuery:(0,r.useCallback)((t=>{const n=new URLSearchParams(window.location.search);t?n.set(i,t):n.delete(i),e.replace({search:n.toString()}),l(t)}),[e]),generateSearchPageLink:(0,r.useCallback)((e=>`${t}search?q=${encodeURIComponent(e)}`),[t])}}},7524:(e,t,n)=>{"use strict";n.d(t,{i:()=>c});var r=n(7294),a=n(412);const o="desktop",i="mobile",l="ssr";function s(){return a.Z.canUseDOM?window.innerWidth>996?o:i:l}function c(){const[e,t]=(0,r.useState)((()=>s()));return(0,r.useEffect)((()=>{function e(){t(s())}return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e),clearTimeout(undefined)}}),[]),e}},5281:(e,t,n)=>{"use strict";n.d(t,{k:()=>r});const r={page:{blogListPage:"blog-list-page",blogPostPage:"blog-post-page",blogTagsListPage:"blog-tags-list-page",blogTagPostListPage:"blog-tags-post-list-page",docsDocPage:"docs-doc-page",docsTagsListPage:"docs-tags-list-page",docsTagDocListPage:"docs-tags-doc-list-page",mdxPage:"mdx-page"},wrapper:{main:"main-wrapper",blogPages:"blog-wrapper",docsPages:"docs-wrapper",mdxPages:"mdx-wrapper"},common:{editThisPage:"theme-edit-this-page",lastUpdated:"theme-last-updated",backToTopButton:"theme-back-to-top-button",codeBlock:"theme-code-block",admonition:"theme-admonition",admonitionType:e=>`theme-admonition-${e}`},layout:{},docs:{docVersionBanner:"theme-doc-version-banner",docVersionBadge:"theme-doc-version-badge",docBreadcrumbs:"theme-doc-breadcrumbs",docMarkdown:"theme-doc-markdown",docTocMobile:"theme-doc-toc-mobile",docTocDesktop:"theme-doc-toc-desktop",docFooter:"theme-doc-footer",docFooterTagsRow:"theme-doc-footer-tags-row",docFooterEditMetaRow:"theme-doc-footer-edit-meta-row",docSidebarContainer:"theme-doc-sidebar-container",docSidebarMenu:"theme-doc-sidebar-menu",docSidebarItemCategory:"theme-doc-sidebar-item-category",docSidebarItemLink:"theme-doc-sidebar-item-link",docSidebarItemCategoryLevel:e=>`theme-doc-sidebar-item-category-level-${e}`,docSidebarItemLinkLevel:e=>`theme-doc-sidebar-item-link-level-${e}`},blog:{}}},2802:(e,t,n)=>{"use strict";n.d(t,{Wl:()=>f,_F:()=>m,cE:()=>d,hI:()=>w,lO:()=>b,vY:()=>y,oz:()=>v,s1:()=>g});var r=n(7294),a=n(6775),o=n(8790),i=n(143),l=n(373),s=n(1116);function c(e){return Array.from(new Set(e))}var u=n(8596);const d=!!i._r;function f(e){if(e.href)return e.href;for(const t of e.items){if("link"===t.type)return t.href;if("category"===t.type){const e=f(t);if(e)return e}}}const p=(e,t)=>void 0!==e&&(0,u.Mg)(e,t);function m(e,t){return"link"===e.type?p(e.href,t):"category"===e.type&&(p(e.href,t)||((e,t)=>e.some((e=>m(e,t))))(e.items,t))}function h(e){let{sidebarItems:t,pathname:n,onlyCategories:r=!1}=e;const a=[];return function e(t){for(const o of t)if("category"===o.type&&((0,u.Mg)(o.href,n)||e(o.items))||"link"===o.type&&(0,u.Mg)(o.href,n)){return r&&"category"!==o.type||a.unshift(o),!0}return!1}(t),a}function g(){var e;const t=(0,s.V)(),{pathname:n}=(0,a.TH)();return!1!==(null==(e=(0,i.gA)())?void 0:e.pluginData.breadcrumbs)&&t?h({sidebarItems:t.items,pathname:n}):null}function b(e){const{activeVersion:t}=(0,i.Iw)(e),{preferredVersion:n}=(0,l.J)(e),a=(0,i.yW)(e);return(0,r.useMemo)((()=>c([t,n,a].filter(Boolean))),[t,n,a])}function v(e,t){const n=b(t);return(0,r.useMemo)((()=>{const t=n.flatMap((e=>e.sidebars?Object.entries(e.sidebars):[])),r=t.find((t=>t[0]===e));if(!r)throw new Error(`Can't find any sidebar with id "${e}" in version${n.length>1?"s":""} ${n.map((e=>e.name)).join(", ")}".\n Available sidebar ids are:\n - ${Object.keys(t).join("\n- ")}`);return r[1]}),[e,n])}function y(e,t){const n=b(t);return(0,r.useMemo)((()=>{const t=n.flatMap((e=>e.docs)),r=t.find((t=>t.id===e));if(!r){if(n.flatMap((e=>e.draftIds)).includes(e))return null;throw new Error(`DocNavbarItem: couldn't find any doc with id "${e}" in version${n.length>1?"s":""} ${n.map((e=>e.name)).join(", ")}".\nAvailable doc ids are:\n- ${c(t.map((e=>e.id))).join("\n- ")}`)}return r}),[e,n])}function w(e){let{route:t,versionMetadata:n}=e;const r=(0,a.TH)(),i=t.routes,l=i.find((e=>(0,a.LX)(r.pathname,e)));if(!l)return null;const s=l.sidebar,c=s?n.docsSidebars[s]:void 0;return{docElement:(0,o.H)(i),sidebarName:s,sidebarItems:c}}},2128:(e,t,n)=>{"use strict";n.d(t,{p:()=>a});var r=n(2263);function a(e){const{siteConfig:t}=(0,r.Z)(),{title:n,titleDelimiter:a}=t;return null!=e&&e.trim().length?`${e.trim()} ${a} ${n}`:n}},833:(e,t,n)=>{"use strict";n.d(t,{FG:()=>f,d:()=>u,VC:()=>p});var r=n(7294),a=n(6010),o=n(5742),i=n(226);function l(){const e=r.useContext(i._);if(!e)throw new Error("Unexpected: no Docusaurus route context found");return e}var s=n(4996),c=n(2128);function u(e){let{title:t,description:n,keywords:a,image:i,children:l}=e;const u=(0,c.p)(t),{withBaseUrl:d}=(0,s.C)(),f=i?d(i,{absolute:!0}):void 0;return r.createElement(o.Z,null,t&&r.createElement("title",null,u),t&&r.createElement("meta",{property:"og:title",content:u}),n&&r.createElement("meta",{name:"description",content:n}),n&&r.createElement("meta",{property:"og:description",content:n}),a&&r.createElement("meta",{name:"keywords",content:Array.isArray(a)?a.join(","):a}),f&&r.createElement("meta",{property:"og:image",content:f}),f&&r.createElement("meta",{name:"twitter:image",content:f}),l)}const d=r.createContext(void 0);function f(e){let{className:t,children:n}=e;const i=r.useContext(d),l=(0,a.Z)(i,t);return r.createElement(d.Provider,{value:l},r.createElement(o.Z,null,r.createElement("html",{className:l})),n)}function p(e){let{children:t}=e;const n=l(),o=`plugin-${n.plugin.name.replace(/docusaurus-(?:plugin|theme)-(?:content-)?/gi,"")}`;const i=`plugin-id-${n.plugin.id}`;return r.createElement(f,{className:(0,a.Z)(o,i)},t)}},902:(e,t,n)=>{"use strict";n.d(t,{D9:()=>i,Qc:()=>c,Ql:()=>s,i6:()=>l,zX:()=>o});var r=n(7294);const a=n(412).Z.canUseDOM?r.useLayoutEffect:r.useEffect;function o(e){const t=(0,r.useRef)(e);return a((()=>{t.current=e}),[e]),(0,r.useCallback)((function(){return t.current(...arguments)}),[])}function i(e){const t=(0,r.useRef)();return a((()=>{t.current=e})),t.current}class l extends Error{constructor(e,t){var n,r,a;super(),this.name="ReactContextError",this.message=`Hook ${(null==(n=this.stack)||null==(r=n.split("\n")[1])||null==(a=r.match(/at (?:\w+\.)?(?<name>\w+)/))?void 0:a.groups.name)??""} is called outside the <${e}>. ${t??""}`}}function s(e){const t=Object.entries(e);return t.sort(((e,t)=>e[0].localeCompare(t[0]))),(0,r.useMemo)((()=>e),t.flat())}function c(e){return t=>{let{children:n}=t;return r.createElement(r.Fragment,null,e.reduceRight(((e,t)=>r.createElement(t,null,e)),n))}}},8022:(e,t,n)=>{"use strict";function r(e,t){return void 0!==e&&void 0!==t&&new RegExp(e,"gi").test(t)}n.d(t,{F:()=>r})},8596:(e,t,n)=>{"use strict";n.d(t,{Mg:()=>i,Ns:()=>l});var r=n(7294),a=n(723),o=n(2263);function i(e,t){const n=e=>{var t;return null==(t=!e||e.endsWith("/")?e:`${e}/`)?void 0:t.toLowerCase()};return n(e)===n(t)}function l(){const{baseUrl:e}=(0,o.Z)().siteConfig;return(0,r.useMemo)((()=>function(e){let{baseUrl:t,routes:n}=e;function r(e){return e.path===t&&!0===e.exact}function a(e){return e.path===t&&!e.exact}return function e(t){if(0===t.length)return;return t.find(r)||e(t.filter(a).flatMap((e=>e.routes??[])))}(n)}({routes:a.Z,baseUrl:e})),[e])}},2466:(e,t,n)=>{"use strict";n.d(t,{Ct:()=>f,OC:()=>s,RF:()=>d});var r=n(7294),a=n(412),o=n(2389),i=n(902);const l=r.createContext(void 0);function s(e){let{children:t}=e;const n=function(){const e=(0,r.useRef)(!0);return(0,r.useMemo)((()=>({scrollEventsEnabledRef:e,enableScrollEvents:()=>{e.current=!0},disableScrollEvents:()=>{e.current=!1}})),[])}();return r.createElement(l.Provider,{value:n},t)}function c(){const e=(0,r.useContext)(l);if(null==e)throw new i.i6("ScrollControllerProvider");return e}const u=()=>a.Z.canUseDOM?{scrollX:window.pageXOffset,scrollY:window.pageYOffset}:null;function d(e,t){void 0===t&&(t=[]);const{scrollEventsEnabledRef:n}=c(),a=(0,r.useRef)(u()),o=(0,i.zX)(e);(0,r.useEffect)((()=>{const e=()=>{if(!n.current)return;const e=u();o(e,a.current),a.current=e},t={passive:!0};return e(),window.addEventListener("scroll",e,t),()=>window.removeEventListener("scroll",e,t)}),[o,n,...t])}function f(){const e=(0,r.useRef)(null),t=(0,o.Z)()&&"smooth"===getComputedStyle(document.documentElement).scrollBehavior;return{startScroll:n=>{e.current=t?function(e){return window.scrollTo({top:e,behavior:"smooth"}),()=>{}}(n):function(e){let t=null;const n=document.documentElement.scrollTop>e;return function r(){const a=document.documentElement.scrollTop;(n&&a>e||!n&&a<e)&&(t=requestAnimationFrame(r),window.scrollTo(0,Math.floor(.85*(a-e))+e))}(),()=>t&&cancelAnimationFrame(t)}(n)},cancelScroll:()=>null==e.current?void 0:e.current()}}},3320:(e,t,n)=>{"use strict";n.d(t,{HX:()=>i,_q:()=>s,os:()=>l});var r=n(143),a=n(2263),o=n(373);const i="default";function l(e,t){return`docs-${e}-${t}`}function s(){const{i18n:e}=(0,a.Z)(),t=(0,r._r)(),n=(0,r.WS)(),s=(0,o.Oh)();const c=[i,...Object.keys(t).map((function(e){const r=(null==n?void 0:n.activePlugin.pluginId)===e?n.activeVersion:void 0,a=s[e],o=t[e].versions.find((e=>e.isLast));return l(e,(r??a??o).name)}))];return{locale:e.currentLocale,tags:c}}},12:(e,t,n)=>{"use strict";n.d(t,{W:()=>l,_:()=>s});const r="localStorage";function a(e){if(void 0===e&&(e=r),"undefined"==typeof window)throw new Error("Browser storage is not available on Node.js/Docusaurus SSR process.");if("none"===e)return null;try{return window[e]}catch(n){return t=n,o||(console.warn("Docusaurus browser storage is not available.\nPossible reasons: running Docusaurus in an iframe, in an incognito browser session, or using too strict browser privacy settings.",t),o=!0),null}var t}let o=!1;const i={get:()=>null,set:()=>{},del:()=>{}};function l(e,t){if("undefined"==typeof window)return function(e){function t(){throw new Error(`Illegal storage API usage for storage key "${e}".\nDocusaurus storage APIs are not supposed to be called on the server-rendering process.\nPlease only call storage APIs in effects and event handlers.`)}return{get:t,set:t,del:t}}(e);const n=a(null==t?void 0:t.persistence);return null===n?i:{get:()=>{try{return n.getItem(e)}catch(t){return console.error(`Docusaurus storage error, can't get key=${e}`,t),null}},set:t=>{try{n.setItem(e,t)}catch(r){console.error(`Docusaurus storage error, can't set ${e}=${t}`,r)}},del:()=>{try{n.removeItem(e)}catch(t){console.error(`Docusaurus storage error, can't delete key=${e}`,t)}}}}function s(e){void 0===e&&(e=r);const t=a(e);if(!t)return[];const n=[];for(let r=0;r<t.length;r+=1){const e=t.key(r);null!==e&&n.push(e)}return n}},4711:(e,t,n)=>{"use strict";n.d(t,{l:()=>o});var r=n(2263),a=n(6775);function o(){const{siteConfig:{baseUrl:e,url:t},i18n:{defaultLocale:n,currentLocale:o}}=(0,r.Z)(),{pathname:i}=(0,a.TH)(),l=o===n?e:e.replace(`/${o}/`,"/"),s=i.replace(e,"");return{createUrl:function(e){let{locale:r,fullyQualified:a}=e;return`${a?t:""}${function(e){return e===n?`${l}`:`${l}${e}/`}(r)}${s}`}}}},5936:(e,t,n)=>{"use strict";n.d(t,{S:()=>i});var r=n(7294),a=n(6775),o=n(902);function i(e){const t=(0,a.TH)(),n=(0,o.D9)(t),i=(0,o.zX)(e);(0,r.useEffect)((()=>{n&&t!==n&&i({location:t,previousLocation:n})}),[i,t,n])}},6668:(e,t,n)=>{"use strict";n.d(t,{L:()=>a});var r=n(2263);function a(){return(0,r.Z)().siteConfig.themeConfig}},8802:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){const{trailingSlash:n,baseUrl:r}=t;if(e.startsWith("#"))return e;if(void 0===n)return e;const[a]=e.split(/[#?]/),o="/"===a||a===r?a:(i=a,n?function(e){return e.endsWith("/")?e:`${e}/`}(i):function(e){return e.endsWith("/")?e.slice(0,-1):e}(i));var i;return e.replace(a,o)}},8780:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.applyTrailingSlash=t.blogPostContainerID=void 0,t.blogPostContainerID="post-content";var a=n(8802);Object.defineProperty(t,"applyTrailingSlash",{enumerable:!0,get:function(){return r(a).default}})},6010:(e,t,n)=>{"use strict";function r(e){var t,n,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=r(e[t]))&&(a&&(a+=" "),a+=n);else for(t in e)e[t]&&(a&&(a+=" "),a+=t);return a}n.d(t,{Z:()=>a});const a=function(){for(var e,t,n=0,a="";n<arguments.length;)(e=arguments[n++])&&(t=r(e))&&(a&&(a+=" "),a+=t);return a}},2358:(e,t,n)=>{"use strict";n.d(t,{lX:()=>S,q_:()=>N,ob:()=>h,PP:()=>L,Ep:()=>m,Hp:()=>g});var r=n(7462);function a(e){return"/"===e.charAt(0)}function o(e,t){for(var n=t,r=n+1,a=e.length;r<a;n+=1,r+=1)e[n]=e[r];e.pop()}const i=function(e,t){void 0===t&&(t="");var n,r=e&&e.split("/")||[],i=t&&t.split("/")||[],l=e&&a(e),s=t&&a(t),c=l||s;if(e&&a(e)?i=r:r.length&&(i.pop(),i=i.concat(r)),!i.length)return"/";if(i.length){var u=i[i.length-1];n="."===u||".."===u||""===u}else n=!1;for(var d=0,f=i.length;f>=0;f--){var p=i[f];"."===p?o(i,f):".."===p?(o(i,f),d++):d&&(o(i,f),d--)}if(!c)for(;d--;d)i.unshift("..");!c||""===i[0]||i[0]&&a(i[0])||i.unshift("");var m=i.join("/");return n&&"/"!==m.substr(-1)&&(m+="/"),m};function l(e){return e.valueOf?e.valueOf():Object.prototype.valueOf.call(e)}const s=function e(t,n){if(t===n)return!0;if(null==t||null==n)return!1;if(Array.isArray(t))return Array.isArray(n)&&t.length===n.length&&t.every((function(t,r){return e(t,n[r])}));if("object"==typeof t||"object"==typeof n){var r=l(t),a=l(n);return r!==t||a!==n?e(r,a):Object.keys(Object.assign({},t,n)).every((function(r){return e(t[r],n[r])}))}return!1};var c=n(2177);function u(e){return"/"===e.charAt(0)?e:"/"+e}function d(e){return"/"===e.charAt(0)?e.substr(1):e}function f(e,t){return function(e,t){return 0===e.toLowerCase().indexOf(t.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(t.length))}(e,t)?e.substr(t.length):e}function p(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function m(e){var t=e.pathname,n=e.search,r=e.hash,a=t||"/";return n&&"?"!==n&&(a+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(a+="#"===r.charAt(0)?r:"#"+r),a}function h(e,t,n,a){var o;"string"==typeof e?(o=function(e){var t=e||"/",n="",r="",a=t.indexOf("#");-1!==a&&(r=t.substr(a),t=t.substr(0,a));var o=t.indexOf("?");return-1!==o&&(n=t.substr(o),t=t.substr(0,o)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}}(e),o.state=t):(void 0===(o=(0,r.Z)({},e)).pathname&&(o.pathname=""),o.search?"?"!==o.search.charAt(0)&&(o.search="?"+o.search):o.search="",o.hash?"#"!==o.hash.charAt(0)&&(o.hash="#"+o.hash):o.hash="",void 0!==t&&void 0===o.state&&(o.state=t));try{o.pathname=decodeURI(o.pathname)}catch(l){throw l instanceof URIError?new URIError('Pathname "'+o.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):l}return n&&(o.key=n),a?o.pathname?"/"!==o.pathname.charAt(0)&&(o.pathname=i(o.pathname,a.pathname)):o.pathname=a.pathname:o.pathname||(o.pathname="/"),o}function g(e,t){return e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash&&e.key===t.key&&s(e.state,t.state)}function b(){var e=null;var t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,a){if(null!=e){var o="function"==typeof e?e(t,n):e;"string"==typeof o?"function"==typeof r?r(o,a):a(!0):a(!1!==o)}else a(!0)},appendListener:function(e){var n=!0;function r(){n&&e.apply(void 0,arguments)}return t.push(r),function(){n=!1,t=t.filter((function(e){return e!==r}))}},notifyListeners:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.forEach((function(e){return e.apply(void 0,n)}))}}}var v=!("undefined"==typeof window||!window.document||!window.document.createElement);function y(e,t){t(window.confirm(e))}var w="popstate",E="hashchange";function k(){try{return window.history.state||{}}catch(e){return{}}}function S(e){void 0===e&&(e={}),v||(0,c.Z)(!1);var t,n=window.history,a=(-1===(t=window.navigator.userAgent).indexOf("Android 2.")&&-1===t.indexOf("Android 4.0")||-1===t.indexOf("Mobile Safari")||-1!==t.indexOf("Chrome")||-1!==t.indexOf("Windows Phone"))&&window.history&&"pushState"in window.history,o=!(-1===window.navigator.userAgent.indexOf("Trident")),i=e,l=i.forceRefresh,s=void 0!==l&&l,d=i.getUserConfirmation,g=void 0===d?y:d,S=i.keyLength,_=void 0===S?6:S,x=e.basename?p(u(e.basename)):"";function T(e){var t=e||{},n=t.key,r=t.state,a=window.location,o=a.pathname+a.search+a.hash;return x&&(o=f(o,x)),h(o,r,n)}function C(){return Math.random().toString(36).substr(2,_)}var A=b();function N(e){(0,r.Z)(z,e),z.length=n.length,A.notifyListeners(z.location,z.action)}function O(e){(function(e){return void 0===e.state&&-1===navigator.userAgent.indexOf("CriOS")})(e)||P(T(e.state))}function L(){P(T(k()))}var I=!1;function P(e){if(I)I=!1,N();else{A.confirmTransitionTo(e,"POP",g,(function(t){t?N({action:"POP",location:e}):function(e){var t=z.location,n=M.indexOf(t.key);-1===n&&(n=0);var r=M.indexOf(e.key);-1===r&&(r=0);var a=n-r;a&&(I=!0,F(a))}(e)}))}}var R=T(k()),M=[R.key];function D(e){return x+m(e)}function F(e){n.go(e)}var B=0;function $(e){1===(B+=e)&&1===e?(window.addEventListener(w,O),o&&window.addEventListener(E,L)):0===B&&(window.removeEventListener(w,O),o&&window.removeEventListener(E,L))}var U=!1;var z={length:n.length,action:"POP",location:R,createHref:D,push:function(e,t){var r="PUSH",o=h(e,t,C(),z.location);A.confirmTransitionTo(o,r,g,(function(e){if(e){var t=D(o),i=o.key,l=o.state;if(a)if(n.pushState({key:i,state:l},null,t),s)window.location.href=t;else{var c=M.indexOf(z.location.key),u=M.slice(0,c+1);u.push(o.key),M=u,N({action:r,location:o})}else window.location.href=t}}))},replace:function(e,t){var r="REPLACE",o=h(e,t,C(),z.location);A.confirmTransitionTo(o,r,g,(function(e){if(e){var t=D(o),i=o.key,l=o.state;if(a)if(n.replaceState({key:i,state:l},null,t),s)window.location.replace(t);else{var c=M.indexOf(z.location.key);-1!==c&&(M[c]=o.key),N({action:r,location:o})}else window.location.replace(t)}}))},go:F,goBack:function(){F(-1)},goForward:function(){F(1)},block:function(e){void 0===e&&(e=!1);var t=A.setPrompt(e);return U||($(1),U=!0),function(){return U&&(U=!1,$(-1)),t()}},listen:function(e){var t=A.appendListener(e);return $(1),function(){$(-1),t()}}};return z}var _="hashchange",x={hashbang:{encodePath:function(e){return"!"===e.charAt(0)?e:"!/"+d(e)},decodePath:function(e){return"!"===e.charAt(0)?e.substr(1):e}},noslash:{encodePath:d,decodePath:u},slash:{encodePath:u,decodePath:u}};function T(e){var t=e.indexOf("#");return-1===t?e:e.slice(0,t)}function C(){var e=window.location.href,t=e.indexOf("#");return-1===t?"":e.substring(t+1)}function A(e){window.location.replace(T(window.location.href)+"#"+e)}function N(e){void 0===e&&(e={}),v||(0,c.Z)(!1);var t=window.history,n=(window.navigator.userAgent.indexOf("Firefox"),e),a=n.getUserConfirmation,o=void 0===a?y:a,i=n.hashType,l=void 0===i?"slash":i,s=e.basename?p(u(e.basename)):"",d=x[l],g=d.encodePath,w=d.decodePath;function E(){var e=w(C());return s&&(e=f(e,s)),h(e)}var k=b();function S(e){(0,r.Z)(U,e),U.length=t.length,k.notifyListeners(U.location,U.action)}var N=!1,O=null;function L(){var e,t,n=C(),r=g(n);if(n!==r)A(r);else{var a=E(),i=U.location;if(!N&&(t=a,(e=i).pathname===t.pathname&&e.search===t.search&&e.hash===t.hash))return;if(O===m(a))return;O=null,function(e){if(N)N=!1,S();else{var t="POP";k.confirmTransitionTo(e,t,o,(function(n){n?S({action:t,location:e}):function(e){var t=U.location,n=M.lastIndexOf(m(t));-1===n&&(n=0);var r=M.lastIndexOf(m(e));-1===r&&(r=0);var a=n-r;a&&(N=!0,D(a))}(e)}))}}(a)}}var I=C(),P=g(I);I!==P&&A(P);var R=E(),M=[m(R)];function D(e){t.go(e)}var F=0;function B(e){1===(F+=e)&&1===e?window.addEventListener(_,L):0===F&&window.removeEventListener(_,L)}var $=!1;var U={length:t.length,action:"POP",location:R,createHref:function(e){var t=document.querySelector("base"),n="";return t&&t.getAttribute("href")&&(n=T(window.location.href)),n+"#"+g(s+m(e))},push:function(e,t){var n="PUSH",r=h(e,void 0,void 0,U.location);k.confirmTransitionTo(r,n,o,(function(e){if(e){var t=m(r),a=g(s+t);if(C()!==a){O=t,function(e){window.location.hash=e}(a);var o=M.lastIndexOf(m(U.location)),i=M.slice(0,o+1);i.push(t),M=i,S({action:n,location:r})}else S()}}))},replace:function(e,t){var n="REPLACE",r=h(e,void 0,void 0,U.location);k.confirmTransitionTo(r,n,o,(function(e){if(e){var t=m(r),a=g(s+t);C()!==a&&(O=t,A(a));var o=M.indexOf(m(U.location));-1!==o&&(M[o]=t),S({action:n,location:r})}}))},go:D,goBack:function(){D(-1)},goForward:function(){D(1)},block:function(e){void 0===e&&(e=!1);var t=k.setPrompt(e);return $||(B(1),$=!0),function(){return $&&($=!1,B(-1)),t()}},listen:function(e){var t=k.appendListener(e);return B(1),function(){B(-1),t()}}};return U}function O(e,t,n){return Math.min(Math.max(e,t),n)}function L(e){void 0===e&&(e={});var t=e,n=t.getUserConfirmation,a=t.initialEntries,o=void 0===a?["/"]:a,i=t.initialIndex,l=void 0===i?0:i,s=t.keyLength,c=void 0===s?6:s,u=b();function d(e){(0,r.Z)(w,e),w.length=w.entries.length,u.notifyListeners(w.location,w.action)}function f(){return Math.random().toString(36).substr(2,c)}var p=O(l,0,o.length-1),g=o.map((function(e){return h(e,void 0,"string"==typeof e?f():e.key||f())})),v=m;function y(e){var t=O(w.index+e,0,w.entries.length-1),r=w.entries[t];u.confirmTransitionTo(r,"POP",n,(function(e){e?d({action:"POP",location:r,index:t}):d()}))}var w={length:g.length,action:"POP",location:g[p],index:p,entries:g,createHref:v,push:function(e,t){var r="PUSH",a=h(e,t,f(),w.location);u.confirmTransitionTo(a,r,n,(function(e){if(e){var t=w.index+1,n=w.entries.slice(0);n.length>t?n.splice(t,n.length-t,a):n.push(a),d({action:r,location:a,index:t,entries:n})}}))},replace:function(e,t){var r="REPLACE",a=h(e,t,f(),w.location);u.confirmTransitionTo(a,r,n,(function(e){e&&(w.entries[w.index]=a,d({action:r,location:a}))}))},go:y,goBack:function(){y(-1)},goForward:function(){y(1)},canGo:function(e){var t=w.index+e;return t>=0&&t<w.entries.length},block:function(e){return void 0===e&&(e=!1),u.setPrompt(e)},listen:function(e){return u.appendListener(e)}};return w}},8679:(e,t,n)=>{"use strict";var r=n(9864),a={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function s(e){return r.isMemo(e)?i:l[e.$$typeof]||a}l[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[r.Memo]=i;var c=Object.defineProperty,u=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,m=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(m){var a=p(n);a&&a!==m&&e(t,a,r)}var i=u(n);d&&(i=i.concat(d(n)));for(var l=s(t),h=s(n),g=0;g<i.length;++g){var b=i[g];if(!(o[b]||r&&r[b]||h&&h[b]||l&&l[b])){var v=f(n,b);try{c(t,b,v)}catch(y){}}}}return t}},1143:e=>{"use strict";e.exports=function(e,t,n,r,a,o,i,l){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,a,o,i,l],u=0;(s=new Error(t.replace(/%s/g,(function(){return c[u++]})))).name="Invariant Violation"}throw s.framesToPop=1,s}}},5826:e=>{e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},2497:(e,t,n)=>{"use strict";n.r(t)},6882:(e,t,n)=>{"use strict";n.r(t)},8049:(e,t,n)=>{"use strict";n.r(t)},4865:function(e,t,n){var r,a;r=function(){var e,t,n={version:"0.2.0"},r=n.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};function a(e,t,n){return e<t?t:e>n?n:e}function o(e){return 100*(-1+e)}function i(e,t,n){var a;return(a="translate3d"===r.positionUsing?{transform:"translate3d("+o(e)+"%,0,0)"}:"translate"===r.positionUsing?{transform:"translate("+o(e)+"%,0)"}:{"margin-left":o(e)+"%"}).transition="all "+t+"ms "+n,a}n.configure=function(e){var t,n;for(t in e)void 0!==(n=e[t])&&e.hasOwnProperty(t)&&(r[t]=n);return this},n.status=null,n.set=function(e){var t=n.isStarted();e=a(e,r.minimum,1),n.status=1===e?null:e;var o=n.render(!t),c=o.querySelector(r.barSelector),u=r.speed,d=r.easing;return o.offsetWidth,l((function(t){""===r.positionUsing&&(r.positionUsing=n.getPositioningCSS()),s(c,i(e,u,d)),1===e?(s(o,{transition:"none",opacity:1}),o.offsetWidth,setTimeout((function(){s(o,{transition:"all "+u+"ms linear",opacity:0}),setTimeout((function(){n.remove(),t()}),u)}),u)):setTimeout(t,u)})),this},n.isStarted=function(){return"number"==typeof n.status},n.start=function(){n.status||n.set(0);var e=function(){setTimeout((function(){n.status&&(n.trickle(),e())}),r.trickleSpeed)};return r.trickle&&e(),this},n.done=function(e){return e||n.status?n.inc(.3+.5*Math.random()).set(1):this},n.inc=function(e){var t=n.status;return t?("number"!=typeof e&&(e=(1-t)*a(Math.random()*t,.1,.95)),t=a(t+e,0,.994),n.set(t)):n.start()},n.trickle=function(){return n.inc(Math.random()*r.trickleRate)},e=0,t=0,n.promise=function(r){return r&&"resolved"!==r.state()?(0===t&&n.start(),e++,t++,r.always((function(){0==--t?(e=0,n.done()):n.set((e-t)/e)})),this):this},n.render=function(e){if(n.isRendered())return document.getElementById("nprogress");u(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=r.template;var a,i=t.querySelector(r.barSelector),l=e?"-100":o(n.status||0),c=document.querySelector(r.parent);return s(i,{transition:"all 0 linear",transform:"translate3d("+l+"%,0,0)"}),r.showSpinner||(a=t.querySelector(r.spinnerSelector))&&p(a),c!=document.body&&u(c,"nprogress-custom-parent"),c.appendChild(t),t},n.remove=function(){d(document.documentElement,"nprogress-busy"),d(document.querySelector(r.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&p(e)},n.isRendered=function(){return!!document.getElementById("nprogress")},n.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective"in e?"translate3d":t+"Transform"in e?"translate":"margin"};var l=function(){var e=[];function t(){var n=e.shift();n&&n(t)}return function(n){e.push(n),1==e.length&&t()}}(),s=function(){var e=["Webkit","O","Moz","ms"],t={};function n(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,t){return t.toUpperCase()}))}function r(t){var n=document.body.style;if(t in n)return t;for(var r,a=e.length,o=t.charAt(0).toUpperCase()+t.slice(1);a--;)if((r=e[a]+o)in n)return r;return t}function a(e){return e=n(e),t[e]||(t[e]=r(e))}function o(e,t,n){t=a(t),e.style[t]=n}return function(e,t){var n,r,a=arguments;if(2==a.length)for(n in t)void 0!==(r=t[n])&&t.hasOwnProperty(n)&&o(e,n,r);else o(e,a[1],a[2])}}();function c(e,t){return("string"==typeof e?e:f(e)).indexOf(" "+t+" ")>=0}function u(e,t){var n=f(e),r=n+t;c(n,t)||(e.className=r.substring(1))}function d(e,t){var n,r=f(e);c(e,t)&&(n=r.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function f(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function p(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return n},void 0===(a="function"==typeof r?r.call(t,n,t,e):r)||(e.exports=a)},7418:e=>{"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function a(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(a){return!1}}()?Object.assign:function(e,o){for(var i,l,s=a(e),c=1;c<arguments.length;c++){for(var u in i=Object(arguments[c]))n.call(i,u)&&(s[u]=i[u]);if(t){l=t(i);for(var d=0;d<l.length;d++)r.call(i,l[d])&&(s[l[d]]=i[l[d]])}}return s}},4779:(e,t,n)=>{var r=n(5826);e.exports=p,e.exports.parse=o,e.exports.compile=function(e,t){return l(o(e,t),t)},e.exports.tokensToFunction=l,e.exports.tokensToRegExp=f;var a=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function o(e,t){for(var n,r=[],o=0,i=0,l="",u=t&&t.delimiter||"/";null!=(n=a.exec(e));){var d=n[0],f=n[1],p=n.index;if(l+=e.slice(i,p),i=p+d.length,f)l+=f[1];else{var m=e[i],h=n[2],g=n[3],b=n[4],v=n[5],y=n[6],w=n[7];l&&(r.push(l),l="");var E=null!=h&&null!=m&&m!==h,k="+"===y||"*"===y,S="?"===y||"*"===y,_=n[2]||u,x=b||v;r.push({name:g||o++,prefix:h||"",delimiter:_,optional:S,repeat:k,partial:E,asterisk:!!w,pattern:x?c(x):w?".*":"[^"+s(_)+"]+?"})}}return i<e.length&&(l+=e.substr(i)),l&&r.push(l),r}function i(e){return encodeURI(e).replace(/[\/?#]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))}function l(e,t){for(var n=new Array(e.length),a=0;a<e.length;a++)"object"==typeof e[a]&&(n[a]=new RegExp("^(?:"+e[a].pattern+")$",d(t)));return function(t,a){for(var o="",l=t||{},s=(a||{}).pretty?i:encodeURIComponent,c=0;c<e.length;c++){var u=e[c];if("string"!=typeof u){var d,f=l[u.name];if(null==f){if(u.optional){u.partial&&(o+=u.prefix);continue}throw new TypeError('Expected "'+u.name+'" to be defined')}if(r(f)){if(!u.repeat)throw new TypeError('Expected "'+u.name+'" to not repeat, but received `'+JSON.stringify(f)+"`");if(0===f.length){if(u.optional)continue;throw new TypeError('Expected "'+u.name+'" to not be empty')}for(var p=0;p<f.length;p++){if(d=s(f[p]),!n[c].test(d))throw new TypeError('Expected all "'+u.name+'" to match "'+u.pattern+'", but received `'+JSON.stringify(d)+"`");o+=(0===p?u.prefix:u.delimiter)+d}}else{if(d=u.asterisk?encodeURI(f).replace(/[?#]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})):s(f),!n[c].test(d))throw new TypeError('Expected "'+u.name+'" to match "'+u.pattern+'", but received "'+d+'"');o+=u.prefix+d}}else o+=u}return o}}function s(e){return e.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function c(e){return e.replace(/([=!:$\/()])/g,"\\$1")}function u(e,t){return e.keys=t,e}function d(e){return e&&e.sensitive?"":"i"}function f(e,t,n){r(t)||(n=t||n,t=[]);for(var a=(n=n||{}).strict,o=!1!==n.end,i="",l=0;l<e.length;l++){var c=e[l];if("string"==typeof c)i+=s(c);else{var f=s(c.prefix),p="(?:"+c.pattern+")";t.push(c),c.repeat&&(p+="(?:"+f+p+")*"),i+=p=c.optional?c.partial?f+"("+p+")?":"(?:"+f+"("+p+"))?":f+"("+p+")"}}var m=s(n.delimiter||"/"),h=i.slice(-m.length)===m;return a||(i=(h?i.slice(0,-m.length):i)+"(?:"+m+"(?=$))?"),i+=o?"$":a&&h?"":"(?="+m+"|$)",u(new RegExp("^"+i,d(n)),t)}function p(e,t,n){return r(t)||(n=t||n,t=[]),n=n||{},e instanceof RegExp?function(e,t){var n=e.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)t.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return u(e,t)}(e,t):r(e)?function(e,t,n){for(var r=[],a=0;a<e.length;a++)r.push(p(e[a],t,n).source);return u(new RegExp("(?:"+r.join("|")+")",d(n)),t)}(e,t,n):function(e,t,n){return f(o(e,n),t,n)}(e,t,n)}},7410:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=function(){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,n={},r={util:{encode:function e(t){return t instanceof a?new a(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function e(t,n){var a,o;switch(n=n||{},r.util.type(t)){case"Object":if(o=r.util.objId(t),n[o])return n[o];for(var i in a={},n[o]=a,t)t.hasOwnProperty(i)&&(a[i]=e(t[i],n));return a;case"Array":return o=r.util.objId(t),n[o]?n[o]:(a=[],n[o]=a,t.forEach((function(t,r){a[r]=e(t,n)})),a);default:return t}},getLanguage:function(t){for(;t;){var n=e.exec(t.className);if(n)return n[1].toLowerCase();t=t.parentElement}return"none"},setLanguage:function(t,n){t.className=t.className.replace(RegExp(e,"gi"),""),t.classList.add("language-"+n)},isActive:function(e,t,n){for(var r="no-"+t;e;){var a=e.classList;if(a.contains(t))return!0;if(a.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:n,plaintext:n,text:n,txt:n,extend:function(e,t){var n=r.util.clone(r.languages[e]);for(var a in t)n[a]=t[a];return n},insertBefore:function(e,t,n,a){var o=(a=a||r.languages)[e],i={};for(var l in o)if(o.hasOwnProperty(l)){if(l==t)for(var s in n)n.hasOwnProperty(s)&&(i[s]=n[s]);n.hasOwnProperty(l)||(i[l]=o[l])}var c=a[e];return a[e]=i,r.languages.DFS(r.languages,(function(t,n){n===c&&t!=e&&(this[t]=i)})),i},DFS:function e(t,n,a,o){o=o||{};var i=r.util.objId;for(var l in t)if(t.hasOwnProperty(l)){n.call(t,l,t[l],a||l);var s=t[l],c=r.util.type(s);"Object"!==c||o[i(s)]?"Array"!==c||o[i(s)]||(o[i(s)]=!0,e(s,n,l,o)):(o[i(s)]=!0,e(s,n,null,o))}}},plugins:{},highlight:function(e,t,n){var o={code:e,grammar:t,language:n};return r.hooks.run("before-tokenize",o),o.tokens=r.tokenize(o.code,o.grammar),r.hooks.run("after-tokenize",o),a.stringify(r.util.encode(o.tokens),o.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var a=new l;return s(a,a.head,e),i(e,a,t,a.head,0),function(e){var t=[],n=e.head.next;for(;n!==e.tail;)t.push(n.value),n=n.next;return t}(a)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var a,o=0;a=n[o++];)a(t)}},Token:a};function a(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length}function o(e,t,n,r){e.lastIndex=t;var a=e.exec(n);if(a&&r&&a[1]){var o=a[1].length;a.index+=o,a[0]=a[0].slice(o)}return a}function i(e,t,n,l,u,d){for(var f in n)if(n.hasOwnProperty(f)&&n[f]){var p=n[f];p=Array.isArray(p)?p:[p];for(var m=0;m<p.length;++m){if(d&&d.cause==f+","+m)return;var h=p[m],g=h.inside,b=!!h.lookbehind,v=!!h.greedy,y=h.alias;if(v&&!h.pattern.global){var w=h.pattern.toString().match(/[imsuy]*$/)[0];h.pattern=RegExp(h.pattern.source,w+"g")}for(var E=h.pattern||h,k=l.next,S=u;k!==t.tail&&!(d&&S>=d.reach);S+=k.value.length,k=k.next){var _=k.value;if(t.length>e.length)return;if(!(_ instanceof a)){var x,T=1;if(v){if(!(x=o(E,S,e,b))||x.index>=e.length)break;var C=x.index,A=x.index+x[0].length,N=S;for(N+=k.value.length;C>=N;)N+=(k=k.next).value.length;if(S=N-=k.value.length,k.value instanceof a)continue;for(var O=k;O!==t.tail&&(N<A||"string"==typeof O.value);O=O.next)T++,N+=O.value.length;T--,_=e.slice(S,N),x.index-=S}else if(!(x=o(E,0,_,b)))continue;C=x.index;var L=x[0],I=_.slice(0,C),P=_.slice(C+L.length),R=S+_.length;d&&R>d.reach&&(d.reach=R);var M=k.prev;if(I&&(M=s(t,M,I),S+=I.length),c(t,M,T),k=s(t,M,new a(f,g?r.tokenize(L,g):L,y,L)),P&&s(t,k,P),T>1){var D={cause:f+","+m,reach:R};i(e,t,n,k.prev,S,D),d&&D.reach>d.reach&&(d.reach=D.reach)}}}}}}function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function s(e,t,n){var r=t.next,a={value:n,prev:t,next:r};return t.next=a,r.prev=a,e.length++,a}function c(e,t,n){for(var r=t.next,a=0;a<n&&r!==e.tail;a++)r=r.next;t.next=r,r.prev=t,e.length-=a}return a.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var a="";return t.forEach((function(t){a+=e(t,n)})),a}var o={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},i=t.alias;i&&(Array.isArray(i)?Array.prototype.push.apply(o.classes,i):o.classes.push(i)),r.hooks.run("wrap",o);var l="";for(var s in o.attributes)l+=" "+s+'="'+(o.attributes[s]||"").replace(/"/g,""")+'"';return"<"+o.tag+' class="'+o.classes.join(" ")+'"'+l+">"+o.content+"</"+o.tag+">"},r}(),a=r;r.default=r,a.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},a.languages.markup.tag.inside["attr-value"].inside.entity=a.languages.markup.entity,a.languages.markup.doctype.inside["internal-subset"].inside=a.languages.markup,a.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(a.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:a.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:a.languages[t]};var o={};o[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},a.languages.insertBefore("markup","cdata",o)}}),Object.defineProperty(a.languages.markup.tag,"addAttribute",{value:function(e,t){a.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:a.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),a.languages.html=a.languages.markup,a.languages.mathml=a.languages.markup,a.languages.svg=a.languages.markup,a.languages.xml=a.languages.extend("markup",{}),a.languages.ssml=a.languages.xml,a.languages.atom=a.languages.xml,a.languages.rss=a.languages.xml,function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var a=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=r.variable[1].inside,i=0;i<a.length;i++)o[a[i]]=e.languages.bash[a[i]];e.languages.shell=e.languages.bash}(a),a.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},a.languages.c=a.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),a.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),a.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},a.languages.c.string],char:a.languages.c.char,comment:a.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:a.languages.c}}}}),a.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete a.languages.c.boolean,function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,(function(){return t.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,(function(){return n}))+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(a),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(a),function(e){var t,n=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css.selector={pattern:e.languages.css.selector.pattern,lookbehind:!0,inside:t={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+n.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[n,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=t,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}});var r={pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0},a={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:"color"},color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:r,number:a,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:r,number:a})}(a),a.languages.javascript=a.languages.extend("clike",{"class-name":[a.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),a.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,a.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:a.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:a.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:a.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:a.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:a.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),a.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:a.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),a.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),a.languages.markup&&(a.languages.markup.tag.addInlined("script","javascript"),a.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),a.languages.js=a.languages.javascript,function(e){var t=/#(?!\{).+/,n={pattern:/#\{[^}]+\}/,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:n}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:t,interpolation:n}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},script:{pattern:/[\s\S]+/,alias:"language-javascript",inside:e.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:"string"},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string",inside:{interpolation:n}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript["template-string"],e.languages.coffee=e.languages.coffeescript}(a),function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+n.source+"(?:[ \t]+"+t.source+")?|"+t.source+"(?:[ \t]+"+n.source+")?)",a=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,(function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source})),o=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function i(e,t){t=(t||"").replace(/m/g,"")+"m";var n=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,(function(){return r})).replace(/<<value>>/g,(function(){return e}));return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,(function(){return r}))),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,(function(){return r})).replace(/<<key>>/g,(function(){return"(?:"+a+"|"+o+")"}))),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:i(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:i(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:i(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:i(o),lookbehind:!0,greedy:!0},number:{pattern:i(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(a),function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(/<inner>/g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,a=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return r})),o=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+a+o+"(?:"+a+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+a+o+")(?:"+a+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+a+")"+o+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+a+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n<r;n++){var a=t[n];if("code"===a.type){var o=a.content[1],i=a.content[3];if(o&&i&&"code-language"===o.type&&"code-block"===i.type&&"string"==typeof o.content){var l=o.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),s="language-"+(l=(/[a-z][\w-]*/i.exec(l)||[""])[0].toLowerCase());i.alias?"string"==typeof i.alias?i.alias=[i.alias,s]:i.alias.push(s):i.alias=[s]}}else e(a.content)}}(e.tokens)})),e.hooks.add("wrap",(function(t){if("code-block"===t.type){for(var n="",r=0,a=t.classes.length;r<a;r++){var o=t.classes[r],c=/language-(.+)/.exec(o);if(c){n=c[1];break}}var u,d=e.languages[n];if(d)t.content=e.highlight((u=t.content,u.replace(i,"").replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,(function(e,t){var n;if("#"===(t=t.toLowerCase())[0])return n="x"===t[1]?parseInt(t.slice(2),16):Number(t.slice(1)),s(n);var r=l[t];return r||e}))),d,n);else if(n&&"none"!==n&&e.plugins.autoloader){var f="md-"+(new Date).valueOf()+"-"+Math.floor(1e16*Math.random());t.attributes.id=f,e.plugins.autoloader.loadLanguages(n,(function(){var t=document.getElementById(f);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))}))}}}));var i=RegExp(e.languages.markup.tag.pattern.source,"gi"),l={amp:"&",lt:"<",gt:">",quot:'"'},s=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(a),a.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:a.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},a.hooks.add("after-tokenize",(function(e){if("graphql"===e.language)for(var t=e.tokens.filter((function(e){return"string"!=typeof e&&"comment"!==e.type&&"scalar"!==e.type})),n=0;n<t.length;){var r=t[n++];if("keyword"===r.type&&"mutation"===r.content){var a=[];if(d(["definition-mutation","punctuation"])&&"("===u(1).content){n+=2;var o=f(/^\($/,/^\)$/);if(-1===o)continue;for(;n<o;n++){var i=u(0);"variable"===i.type&&(p(i,"variable-input"),a.push(i.content))}n=o+1}if(d(["punctuation","property-query"])&&"{"===u(0).content&&(n++,p(u(0),"property-mutation"),a.length>0)){var l=f(/^\{$/,/^\}$/);if(-1===l)continue;for(var s=n;s<l;s++){var c=t[s];"variable"===c.type&&a.indexOf(c.content)>=0&&p(c,"variable-input")}}}}function u(e){return t[n+e]}function d(e,t){t=t||0;for(var n=0;n<e.length;n++){var r=u(n+t);if(!r||r.type!==e[n])return!1}return!0}function f(e,r){for(var a=1,o=n;o<t.length;o++){var i=t[o],l=i.content;if("punctuation"===i.type&&"string"==typeof l)if(e.test(l))a++;else if(r.test(l)&&0===--a)return o}return-1}function p(e,t){var n=e.alias;n?Array.isArray(n)||(e.alias=n=[n]):e.alias=n=[],n.push(t)}})),a.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.javascript["template-string"],n=t.pattern.source,r=t.inside.interpolation,a=r.inside["interpolation-punctuation"],o=r.pattern.source;function i(t,r){if(e.languages[t])return{pattern:RegExp("((?:"+r+")\\s*)"+n),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},"embedded-code":{pattern:/[\s\S]+/,alias:t}}}}function l(e,t){return"___"+t.toUpperCase()+"_"+e+"___"}function s(t,n,r){var a={code:t,grammar:n,language:r};return e.hooks.run("before-tokenize",a),a.tokens=e.tokenize(a.code,a.grammar),e.hooks.run("after-tokenize",a),a.tokens}function c(t){var n={};n["interpolation-punctuation"]=a;var o=e.tokenize(t,n);if(3===o.length){var i=[1,1];i.push.apply(i,s(o[1],e.languages.javascript,"javascript")),o.splice.apply(o,i)}return new e.Token("interpolation",o,r.alias,t)}function u(t,n,r){var a=e.tokenize(t,{interpolation:{pattern:RegExp(o),lookbehind:!0}}),i=0,u={},d=s(a.map((function(e){if("string"==typeof e)return e;for(var n,a=e.content;-1!==t.indexOf(n=l(i++,r)););return u[n]=a,n})).join(""),n,r),f=Object.keys(u);return i=0,function e(t){for(var n=0;n<t.length;n++){if(i>=f.length)return;var r=t[n];if("string"==typeof r||"string"==typeof r.content){var a=f[i],o="string"==typeof r?r:r.content,l=o.indexOf(a);if(-1!==l){++i;var s=o.substring(0,l),d=c(u[a]),p=o.substring(l+a.length),m=[];if(s&&m.push(s),m.push(d),p){var h=[p];e(h),m.push.apply(m,h)}"string"==typeof r?(t.splice.apply(t,[n,1].concat(m)),n+=m.length-1):r.content=m}}else{var g=r.content;Array.isArray(g)?e(g):e([g])}}}(d),new e.Token(r,d,"language-"+r,t)}e.languages.javascript["template-string"]=[i("css",/\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source),i("html",/\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source),i("svg",/\bsvg/.source),i("markdown",/\b(?:markdown|md)/.source),i("graphql",/\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source),i("sql",/\bsql/.source),t].filter(Boolean);var d={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function f(e){return"string"==typeof e?e:Array.isArray(e)?e.map(f).join(""):f(e.content)}e.hooks.add("after-tokenize",(function(t){t.language in d&&function t(n){for(var r=0,a=n.length;r<a;r++){var o=n[r];if("string"!=typeof o){var i=o.content;if(Array.isArray(i))if("template-string"===o.type){var l=i[1];if(3===i.length&&"string"!=typeof l&&"embedded-code"===l.type){var s=f(l),c=l.alias,d=Array.isArray(c)?c[0]:c,p=e.languages[d];if(!p)continue;i[1]=u(s,p,d)}}else t(i);else"string"!=typeof i&&t([i])}}}(t.tokens)}))}(a),function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(a),function(e){function t(e,t){return RegExp(e.replace(/<ID>/g,(function(){return/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source})),t)}e.languages.insertBefore("javascript","function-variable",{"method-variable":{pattern:RegExp("(\\.\\s*)"+e.languages.javascript["function-variable"].pattern.source),lookbehind:!0,alias:["function-variable","method","function","property-access"]}}),e.languages.insertBefore("javascript","function",{method:{pattern:RegExp("(\\.\\s*)"+e.languages.javascript.function.source),lookbehind:!0,alias:["function","property-access"]}}),e.languages.insertBefore("javascript","constant",{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:"class-name"},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:"class-name"}]}),e.languages.insertBefore("javascript","keyword",{imports:{pattern:t(/(\bimport\b\s*)(?:<ID>(?:\s*,\s*(?:\*\s*as\s+<ID>|\{[^{}]*\}))?|\*\s*as\s+<ID>|\{[^{}]*\})(?=\s*\bfrom\b)/.source),lookbehind:!0,inside:e.languages.javascript},exports:{pattern:t(/(\bexport\b\s*)(?:\*(?:\s*as\s+<ID>)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),lookbehind:!0,inside:e.languages.javascript}}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:"module"},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:"control-flow"},{pattern:/\bnull\b/,alias:["null","nil"]},{pattern:/\bundefined\b/,alias:"nil"}),e.languages.insertBefore("javascript","operator",{spread:{pattern:/\.{3}/,alias:"operator"},arrow:{pattern:/=>/,alias:"operator"}}),e.languages.insertBefore("javascript","punctuation",{"property-access":{pattern:t(/(\.\s*)#?<ID>/.source),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:"variable"},console:{pattern:/\bconsole(?=\s*\.)/,alias:"class-name"}});for(var n=["function","function-variable","method","method-variable","property-access"],r=0;r<n.length;r++){var a=n[r],o=e.languages.javascript[a];"RegExp"===e.util.type(o)&&(o=e.languages.javascript[a]={pattern:o});var i=o.inside||{};o.inside=i,i["maybe-class-name"]=/^[A-Z][\s\S]*/}}(a),function(e){var t=e.util.clone(e.languages.javascript),n=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,r=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,a=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function o(e,t){return e=e.replace(/<S>/g,(function(){return n})).replace(/<BRACES>/g,(function(){return r})).replace(/<SPREAD>/g,(function(){return a})),RegExp(e,t)}a=o(a).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=o(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:o(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:o(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var i=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(i).join(""):""},l=function(t){for(var n=[],r=0;r<t.length;r++){var a=t[r],o=!1;if("string"!=typeof a&&("tag"===a.type&&a.content[0]&&"tag"===a.content[0].type?"</"===a.content[0].content[0].content?n.length>0&&n[n.length-1].tagName===i(a.content[0].content[1])&&n.pop():"/>"===a.content[a.content.length-1].content||n.push({tagName:i(a.content[0].content[1]),openedBraces:0}):n.length>0&&"punctuation"===a.type&&"{"===a.content?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&"punctuation"===a.type&&"}"===a.content?n[n.length-1].openedBraces--:o=!0),(o||"string"==typeof a)&&n.length>0&&0===n[n.length-1].openedBraces){var s=i(a);r<t.length-1&&("string"==typeof t[r+1]||"plain-text"===t[r+1].type)&&(s+=i(t[r+1]),t.splice(r+1,1)),r>0&&("string"==typeof t[r-1]||"plain-text"===t[r-1].type)&&(s=i(t[r-1])+s,t.splice(r-1,1),r--),t[r]=new e.Token("plain-text",s,null,s)}a.content&&"string"!=typeof a.content&&l(a.content)}};e.hooks.add("after-tokenize",(function(e){"jsx"!==e.language&&"tsx"!==e.language||l(e.tokens)}))}(a),function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach((function(n){var r=t[n],a=[];/^\w+$/.test(n)||a.push(/\w+/.exec(n)[0]),"diff"===n&&a.push("bold"),e.languages.diff[n]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:a,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})}(a),a.languages.git={comment:/^#.*/m,deleted:/^[-\u2013].*/m,inserted:/^\+.*/m,string:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s--?\w+/}},coord:/^@@.*@@$/m,"commit-sha1":/^commit \w{40}$/m},a.languages.go=a.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),a.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete a.languages.go["class-name"],function(e){function t(e,t){return"___"+e.toUpperCase()+t+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(n,r,a,o){if(n.language===r){var i=n.tokenStack=[];n.code=n.code.replace(a,(function(e){if("function"==typeof o&&!o(e))return e;for(var a,l=i.length;-1!==n.code.indexOf(a=t(r,l));)++l;return i[l]=e,a})),n.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(n,r){if(n.language===r&&n.tokenStack){n.grammar=e.languages[r];var a=0,o=Object.keys(n.tokenStack);!function i(l){for(var s=0;s<l.length&&!(a>=o.length);s++){var c=l[s];if("string"==typeof c||c.content&&"string"==typeof c.content){var u=o[a],d=n.tokenStack[u],f="string"==typeof c?c:c.content,p=t(r,u),m=f.indexOf(p);if(m>-1){++a;var h=f.substring(0,m),g=new e.Token(r,e.tokenize(d,n.grammar),"language-"+r,d),b=f.substring(m+p.length),v=[];h&&v.push.apply(v,i([h])),v.push(g),b&&v.push.apply(v,i([b])),"string"==typeof c?l.splice.apply(l,[s,1].concat(v)):c.content=v}}else c.content&&i(c.content)}return l}(n.tokens)}}}})}(a),function(e){e.languages.handlebars={comment:/\{\{![\s\S]*?\}\}/,delimiter:{pattern:/^\{\{\{?|\}\}\}?$/,alias:"punctuation"},string:/(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][+-]?\d+)?/,boolean:/\b(?:false|true)\b/,block:{pattern:/^(\s*(?:~\s*)?)[#\/]\S+?(?=\s*(?:~\s*)?$|\s)/,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/,variable:/[\s\S]+/}},punctuation:/[!"#%&':()*+,.\/;<=>@\[\\\]^`{|}~]/,variable:/[^!"#%&'()*+,\/;<=>@\[\\\]^`{|}~\s]+/},e.hooks.add("before-tokenize",(function(t){e.languages["markup-templating"].buildPlaceholders(t,"handlebars",/\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g)})),e.hooks.add("after-tokenize",(function(t){e.languages["markup-templating"].tokenizePlaceholders(t,"handlebars")})),e.languages.hbs=e.languages.handlebars}(a),a.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},a.languages.webmanifest=a.languages.json,a.languages.less=a.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),a.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}}),a.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"builtin-target":{pattern:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,alias:"builtin"},target:{pattern:/^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,alias:"symbol",inside:{variable:/\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,function:{pattern:/(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,lookbehind:!0},operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/},a.languages.objectivec=a.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete a.languages.objectivec["class-name"],a.languages.objc=a.languages.objectivec,a.languages.ocaml={comment:{pattern:/\(\*[\s\S]*?\*\)/,greedy:!0},char:{pattern:/'(?:[^\\\r\n']|\\(?:.|[ox]?[0-9a-f]{1,3}))'/i,greedy:!0},string:[{pattern:/"(?:\\(?:[\s\S]|\r\n)|[^\\\r\n"])*"/,greedy:!0},{pattern:/\{([a-z_]*)\|[\s\S]*?\|\1\}/,greedy:!0}],number:[/\b(?:0b[01][01_]*|0o[0-7][0-7_]*)\b/i,/\b0x[a-f0-9][a-f0-9_]*(?:\.[a-f0-9_]*)?(?:p[+-]?\d[\d_]*)?(?!\w)/i,/\b\d[\d_]*(?:\.[\d_]*)?(?:e[+-]?\d[\d_]*)?(?!\w)/i],directive:{pattern:/\B#\w+/,alias:"property"},label:{pattern:/\B~\w+/,alias:"property"},"type-variable":{pattern:/\B'\w+/,alias:"function"},variant:{pattern:/`\w+/,alias:"symbol"},keyword:/\b(?:as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|nonrec|object|of|open|private|rec|sig|struct|then|to|try|type|val|value|virtual|when|where|while|with)\b/,boolean:/\b(?:false|true)\b/,"operator-like-punctuation":{pattern:/\[[<>|]|[>|]\]|\{<|>\}/,alias:"punctuation"},operator:/\.[.~]|:[=>]|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lsl|lsr|lxor|mod|or)\b/,punctuation:/;;|::|[(){}\[\].,:;#]|\b_\b/},a.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},a.languages.python["string-interpolation"].inside.interpolation.inside.rest=a.languages.python,a.languages.py=a.languages.python,a.languages.reason=a.languages.extend("clike",{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),a.languages.insertBefore("reason","class-name",{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:"symbol"}}),delete a.languages.reason.function,function(e){e.languages.sass=e.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),e.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete e.languages.sass.atrule;var t=/\$[-\w]+|#\{\$[-\w]+\}/,n=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];e.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:t,operator:n}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:t,operator:n,important:e.languages.sass.important}}}),delete e.languages.sass.property,delete e.languages.sass.important,e.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})}(a),a.languages.scss=a.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),a.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),a.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),a.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),a.languages.scss.atrule.inside.rest=a.languages.scss,function(e){var t={pattern:/(\b\d+)(?:%|[a-z]+)/,lookbehind:!0},n={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0},r={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},url:{pattern:/\burl\((["']?).*?\1\)/i,greedy:!0},string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:else|for|if|return|unless)(?=\s|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:t,number:n,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:t,boolean:/\b(?:false|true)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],number:n,punctuation:/[{}()\[\];:,]/};r.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^\{|\}$/,alias:"punctuation"},rest:r}},r.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:r}},e.languages.stylus={"atrule-declaration":{pattern:/(^[ \t]*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:r}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:\{[^{}]*\}|\S.*|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:r}},statement:{pattern:/(^[ \t]*)(?:else|for|if|return|unless)[ \t].+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:r}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)(?!\s)[^{\r\n]*(?:;|[^{\r\n,]$(?!(?:\r?\n|\r)(?:\{|\2[ \t])))/m,lookbehind:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:r.interpolation}},rest:r}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t])))/m,lookbehind:!0,inside:{interpolation:r.interpolation,comment:r.comment,punctuation:/[{},]/}},func:r.func,string:r.string,comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0,greedy:!0},interpolation:r.interpolation,punctuation:/[{}()\[\];:.]/}}(a),function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"];var n=e.languages.tsx.tag;n.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+n.pattern.source+")",n.pattern.flags),n.lookbehind=!0}(a),a.languages.wasm={comment:[/\(;[\s\S]*?;\)/,{pattern:/;;.*/,greedy:!0}],string:{pattern:/"(?:\\[\s\S]|[^"\\])*"/,greedy:!0},keyword:[{pattern:/\b(?:align|offset)=/,inside:{operator:/=/}},{pattern:/\b(?:(?:f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|neg?|nearest|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|sqrt|store(?:8|16|32)?|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))?|memory\.(?:grow|size))\b/,inside:{punctuation:/\./}},/\b(?:anyfunc|block|br(?:_if|_table)?|call(?:_indirect)?|data|drop|elem|else|end|export|func|get_(?:global|local)|global|if|import|local|loop|memory|module|mut|nop|offset|param|result|return|select|set_(?:global|local)|start|table|tee_local|then|type|unreachable)\b/],variable:/\$[\w!#$%&'*+\-./:<=>?@\\^`|~]+/,number:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/,punctuation:/[()]/};const o=a},7874:()=>{!function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var a=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=r.variable[1].inside,i=0;i<a.length;i++)o[a[i]]=e.languages.bash[a[i]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash}(Prism)},4677:()=>{Prism.languages.hcl={comment:/(?:\/\/|#).*|\/\*[\s\S]*?(?:\*\/|$)/,heredoc:{pattern:/<<-?(\w+\b)[\s\S]*?^[ \t]*\1/m,greedy:!0,alias:"string"},keyword:[{pattern:/(?:data|resource)\s+(?:"(?:\\[\s\S]|[^\\"])*")(?=\s+"[\w-]+"\s+\{)/i,inside:{type:{pattern:/(resource|data|\s+)(?:"(?:\\[\s\S]|[^\\"])*")/i,lookbehind:!0,alias:"variable"}}},{pattern:/(?:backend|module|output|provider|provisioner|variable)\s+(?:[\w-]+|"(?:\\[\s\S]|[^\\"])*")\s+(?=\{)/i,inside:{type:{pattern:/(backend|module|output|provider|provisioner|variable)\s+(?:[\w-]+|"(?:\\[\s\S]|[^\\"])*")\s+/i,lookbehind:!0,alias:"variable"}}},/[\w-]+(?=\s+\{)/],property:[/[-\w\.]+(?=\s*=(?!=))/,/"(?:\\[\s\S]|[^\\"])+"(?=\s*[:=])/],string:{pattern:/"(?:[^\\$"]|\\[\s\S]|\$(?:(?=")|\$+(?!\$)|[^"${])|\$\{(?:[^{}"]|"(?:[^\\"]|\\[\s\S])*")*\})*"/,greedy:!0,inside:{interpolation:{pattern:/(^|[^$])\$\{(?:[^{}"]|"(?:[^\\"]|\\[\s\S])*")*\}/,lookbehind:!0,inside:{type:{pattern:/(\b(?:count|data|local|module|path|self|terraform|var)\b\.)[\w\*]+/i,lookbehind:!0,alias:"variable"},keyword:/\b(?:count|data|local|module|path|self|terraform|var)\b/i,function:/\w+(?=\()/,string:{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0},number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?(?:e[+-]?\d+)?/i,punctuation:/[!\$#%&'()*+,.\/;<=>@\[\\\]^`{|}~?:]/}}}},number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?(?:e[+-]?\d+)?/i,boolean:/\b(?:false|true)\b/i,punctuation:/[=\[\]{}]/}},3335:()=>{Prism.languages.log={string:{pattern:/"(?:[^"\\\r\n]|\\.)*"|'(?![st] | \w)(?:[^'\\\r\n]|\\.)*'/,greedy:!0},exception:{pattern:/(^|[^\w.])[a-z][\w.]*(?:Error|Exception):.*(?:(?:\r\n?|\n)[ \t]*(?:at[ \t].+|\.{3}.*|Caused by:.*))+(?:(?:\r\n?|\n)[ \t]*\.\.\. .*)?/,lookbehind:!0,greedy:!0,alias:["javastacktrace","language-javastacktrace"],inside:Prism.languages.javastacktrace||{keyword:/\bat\b/,function:/[a-z_][\w$]*(?=\()/,punctuation:/[.:()]/}},level:[{pattern:/\b(?:ALERT|CRIT|CRITICAL|EMERG|EMERGENCY|ERR|ERROR|FAILURE|FATAL|SEVERE)\b/,alias:["error","important"]},{pattern:/\b(?:WARN|WARNING|WRN)\b/,alias:["warning","important"]},{pattern:/\b(?:DISPLAY|INF|INFO|NOTICE|STATUS)\b/,alias:["info","keyword"]},{pattern:/\b(?:DBG|DEBUG|FINE)\b/,alias:["debug","keyword"]},{pattern:/\b(?:FINER|FINEST|TRACE|TRC|VERBOSE|VRB)\b/,alias:["trace","comment"]}],property:{pattern:/((?:^|[\]|])[ \t]*)[a-z_](?:[\w-]|\b\/\b)*(?:[. ]\(?\w(?:[\w-]|\b\/\b)*\)?)*:(?=\s)/im,lookbehind:!0},separator:{pattern:/(^|[^-+])-{3,}|={3,}|\*{3,}|- - /m,lookbehind:!0,alias:"comment"},url:/\b(?:file|ftp|https?):\/\/[^\s|,;'"]*[^\s|,;'">.]/,email:{pattern:/(^|\s)[-\w+.]+@[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)+(?=\s)/,lookbehind:!0,alias:"url"},"ip-address":{pattern:/\b(?:\d{1,3}(?:\.\d{1,3}){3})\b/,alias:"constant"},"mac-address":{pattern:/\b[a-f0-9]{2}(?::[a-f0-9]{2}){5}\b/i,alias:"constant"},domain:{pattern:/(^|\s)[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)*\.[a-z][a-z0-9-]+(?=\s)/,lookbehind:!0,alias:"constant"},uuid:{pattern:/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/i,alias:"constant"},hash:{pattern:/\b(?:[a-f0-9]{32}){1,2}\b/i,alias:"constant"},"file-path":{pattern:/\b[a-z]:[\\/][^\s|,;:(){}\[\]"']+|(^|[\s:\[\](>|])\.{0,2}\/\w[^\s|,;:(){}\[\]"']*/i,lookbehind:!0,greedy:!0,alias:"string"},date:{pattern:RegExp(/\b\d{4}[-/]\d{2}[-/]\d{2}(?:T(?=\d{1,2}:)|(?=\s\d{1,2}:))/.source+"|"+/\b\d{1,4}[-/ ](?:\d{1,2}|Apr|Aug|Dec|Feb|Jan|Jul|Jun|Mar|May|Nov|Oct|Sep)[-/ ]\d{2,4}T?\b/.source+"|"+/\b(?:(?:Fri|Mon|Sat|Sun|Thu|Tue|Wed)(?:\s{1,2}(?:Apr|Aug|Dec|Feb|Jan|Jul|Jun|Mar|May|Nov|Oct|Sep))?|Apr|Aug|Dec|Feb|Jan|Jul|Jun|Mar|May|Nov|Oct|Sep)\s{1,2}\d{1,2}\b/.source,"i"),alias:"number"},time:{pattern:/\b\d{1,2}:\d{1,2}:\d{1,2}(?:[.,:]\d+)?(?:\s?[+-]\d{2}:?\d{2}|Z)?\b/,alias:"number"},boolean:/\b(?:false|null|true)\b/i,number:{pattern:/(^|[^.\w])(?:0x[a-f0-9]+|0o[0-7]+|0b[01]+|v?\d[\da-f]*(?:\.\d+)*(?:e[+-]?\d+)?[a-z]{0,3}\b)\b(?!\.\w)/i,lookbehind:!0},operator:/[;:?<=>~/@!$%&+\-|^(){}*#]/,punctuation:/[\[\].,]/}},366:()=>{Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python},767:()=>{!function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,n=0;n<2;n++)t=t.replace(/<self>/g,(function(){return t}));t=t.replace(/<self>/g,(function(){return/[^\s\S]/.source})),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(Prism)},9930:()=>{!function(e){var t=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function n(e){return e.replace(/__/g,(function(){return t}))}e.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(n(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(n(/(^[\t ]*|[{,]\s*)__(?:\s*\.\s*__)*(?=\s*=)/.source),"m"),lookbehind:!0,greedy:!0,alias:"property"},string:{pattern:/"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},date:[{pattern:/\b\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?\b/i,alias:"number"},{pattern:/\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b/,alias:"number"}],number:/(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\b\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?\b(?:inf|nan)\b/,boolean:/\b(?:false|true)\b/,punctuation:/[.,=[\]{}]/}}(Prism)},3358:()=>{!function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+n.source+"(?:[ \t]+"+t.source+")?|"+t.source+"(?:[ \t]+"+n.source+")?)",a=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,(function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source})),o=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function i(e,t){t=(t||"").replace(/m/g,"")+"m";var n=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,(function(){return r})).replace(/<<value>>/g,(function(){return e}));return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,(function(){return r}))),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,(function(){return r})).replace(/<<key>>/g,(function(){return"(?:"+a+"|"+o+")"}))),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:i(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:i(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:i(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:i(o),lookbehind:!0,greedy:!0},number:{pattern:i(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(Prism)},6991:(e,t,n)=>{var r={"./prism-bash":7874,"./prism-hcl":4677,"./prism-log":3335,"./prism-python":366,"./prism-rust":767,"./prism-toml":9930,"./prism-yaml":3358};function a(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}a.keys=function(){return Object.keys(r)},a.resolve=o,e.exports=a,a.id=6991},2703:(e,t,n)=>{"use strict";var r=n(414);function a(){}function o(){}o.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,o,i){if(i!==r){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:a};return n.PropTypes=n,n}},5697:(e,t,n)=>{e.exports=n(2703)()},414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},4448:(e,t,n)=>{"use strict";var r=n(7294),a=n(7418),o=n(3840);function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!r)throw Error(i(227));var l=new Set,s={};function c(e,t){u(e,t),u(e+"Capture",t)}function u(e,t){for(s[e]=t,e=0;e<t.length;e++)l.add(t[e])}var d=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),f=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p=Object.prototype.hasOwnProperty,m={},h={};function g(e,t,n,r,a,o,i){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){b[e]=new g(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];b[t]=new g(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){b[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){b[e]=new g(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){b[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){b[e]=new g(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){b[e]=new g(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){b[e]=new g(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){b[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)}));var v=/[\-:]([a-z])/g;function y(e){return e[1].toUpperCase()}function w(e,t,n,r){var a=b.hasOwnProperty(t)?b[t]:null;(null!==a?0===a.type:!r&&(2<t.length&&("o"===t[0]||"O"===t[0])&&("n"===t[1]||"N"===t[1])))||(function(e,t,n,r){if(null==t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,a,r)&&(n=null),r||null===a?function(e){return!!p.call(h,e)||!p.call(m,e)&&(f.test(e)?h[e]=!0:(m[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):a.mustUseProperty?e[a.propertyName]=null===n?3!==a.type&&"":n:(t=a.attributeName,r=a.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(a=a.type)||4===a&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(v,y);b[t]=new g(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(v,y);b[t]=new g(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(v,y);b[t]=new g(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){b[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)})),b.xlinkHref=new g("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){b[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)}));var E=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,k=60103,S=60106,_=60107,x=60108,T=60114,C=60109,A=60110,N=60112,O=60113,L=60120,I=60115,P=60116,R=60121,M=60128,D=60129,F=60130,B=60131;if("function"==typeof Symbol&&Symbol.for){var $=Symbol.for;k=$("react.element"),S=$("react.portal"),_=$("react.fragment"),x=$("react.strict_mode"),T=$("react.profiler"),C=$("react.provider"),A=$("react.context"),N=$("react.forward_ref"),O=$("react.suspense"),L=$("react.suspense_list"),I=$("react.memo"),P=$("react.lazy"),R=$("react.block"),$("react.scope"),M=$("react.opaque.id"),D=$("react.debug_trace_mode"),F=$("react.offscreen"),B=$("react.legacy_hidden")}var U,z="function"==typeof Symbol&&Symbol.iterator;function j(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=z&&e[z]||e["@@iterator"])?e:null}function H(e){if(void 0===U)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);U=t&&t[1]||""}return"\n"+U+e}var Z=!1;function G(e,t){if(!e||Z)return"";Z=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(s){var r=s}Reflect.construct(e,[],t)}else{try{t.call()}catch(s){r=s}e.call(t.prototype)}else{try{throw Error()}catch(s){r=s}e()}}catch(s){if(s&&r&&"string"==typeof s.stack){for(var a=s.stack.split("\n"),o=r.stack.split("\n"),i=a.length-1,l=o.length-1;1<=i&&0<=l&&a[i]!==o[l];)l--;for(;1<=i&&0<=l;i--,l--)if(a[i]!==o[l]){if(1!==i||1!==l)do{if(i--,0>--l||a[i]!==o[l])return"\n"+a[i].replace(" at new "," at ")}while(1<=i&&0<=l);break}}}finally{Z=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?H(e):""}function V(e){switch(e.tag){case 5:return H(e.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return e=G(e.type,!1);case 11:return e=G(e.type.render,!1);case 22:return e=G(e.type._render,!1);case 1:return e=G(e.type,!0);default:return""}}function W(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case _:return"Fragment";case S:return"Portal";case T:return"Profiler";case x:return"StrictMode";case O:return"Suspense";case L:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case A:return(e.displayName||"Context")+".Consumer";case C:return(e._context.displayName||"Context")+".Provider";case N:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case I:return W(e.type);case R:return W(e._render);case P:t=e._payload,e=e._init;try{return W(e(t))}catch(n){}}return null}function q(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function Y(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function K(e){e._valueTracker||(e._valueTracker=function(e){var t=Y(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var a=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(e){r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function X(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Y(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function Q(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function J(e,t){var n=t.checked;return a({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function ee(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=q(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function te(e,t){null!=(t=t.checked)&&w(e,"checked",t,!1)}function ne(e,t){te(e,t);var n=q(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?ae(e,t.type,n):t.hasOwnProperty("defaultValue")&&ae(e,t.type,q(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function re(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function ae(e,t,n){"number"===t&&Q(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}function oe(e,t){return e=a({children:void 0},t),(t=function(e){var t="";return r.Children.forEach(e,(function(e){null!=e&&(t+=e)})),t}(t.children))&&(e.children=t),e}function ie(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+q(n),t=null,a=0;a<e.length;a++){if(e[a].value===n)return e[a].selected=!0,void(r&&(e[a].defaultSelected=!0));null!==t||e[a].disabled||(t=e[a])}null!==t&&(t.selected=!0)}}function le(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(i(91));return a({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function se(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(i(92));if(Array.isArray(n)){if(!(1>=n.length))throw Error(i(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:q(n)}}function ce(e,t){var n=q(t.value),r=q(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function ue(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}var de="http://www.w3.org/1999/xhtml",fe="http://www.w3.org/2000/svg";function pe(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function me(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?pe(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var he,ge,be=(ge=function(e,t){if(e.namespaceURI!==fe||"innerHTML"in e)e.innerHTML=t;else{for((he=he||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=he.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction((function(){return ge(e,t)}))}:ge);function ve(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var ye={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},we=["Webkit","ms","Moz","O"];function Ee(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||ye.hasOwnProperty(e)&&ye[e]?(""+t).trim():t+"px"}function ke(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),a=Ee(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}Object.keys(ye).forEach((function(e){we.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ye[t]=ye[e]}))}));var Se=a({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function _e(e,t){if(t){if(Se[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(i(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(i(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(i(62))}}function xe(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function Te(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Ce=null,Ae=null,Ne=null;function Oe(e){if(e=ra(e)){if("function"!=typeof Ce)throw Error(i(280));var t=e.stateNode;t&&(t=oa(t),Ce(e.stateNode,e.type,t))}}function Le(e){Ae?Ne?Ne.push(e):Ne=[e]:Ae=e}function Ie(){if(Ae){var e=Ae,t=Ne;if(Ne=Ae=null,Oe(e),t)for(e=0;e<t.length;e++)Oe(t[e])}}function Pe(e,t){return e(t)}function Re(e,t,n,r,a){return e(t,n,r,a)}function Me(){}var De=Pe,Fe=!1,Be=!1;function $e(){null===Ae&&null===Ne||(Me(),Ie())}function Ue(e,t){var n=e.stateNode;if(null===n)return null;var r=oa(n);if(null===r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(i(231,t,typeof n));return n}var ze=!1;if(d)try{var je={};Object.defineProperty(je,"passive",{get:function(){ze=!0}}),window.addEventListener("test",je,je),window.removeEventListener("test",je,je)}catch(ge){ze=!1}function He(e,t,n,r,a,o,i,l,s){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(u){this.onError(u)}}var Ze=!1,Ge=null,Ve=!1,We=null,qe={onError:function(e){Ze=!0,Ge=e}};function Ye(e,t,n,r,a,o,i,l,s){Ze=!1,Ge=null,He.apply(qe,arguments)}function Ke(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!=(1026&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function Xe(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function Qe(e){if(Ke(e)!==e)throw Error(i(188))}function Je(e){if(e=function(e){var t=e.alternate;if(!t){if(null===(t=Ke(e)))throw Error(i(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(null===a)break;var o=a.alternate;if(null===o){if(null!==(r=a.return)){n=r;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return Qe(a),e;if(o===r)return Qe(a),t;o=o.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=o;else{for(var l=!1,s=a.child;s;){if(s===n){l=!0,n=a,r=o;break}if(s===r){l=!0,r=a,n=o;break}s=s.sibling}if(!l){for(s=o.child;s;){if(s===n){l=!0,n=o,r=a;break}if(s===r){l=!0,r=o,n=a;break}s=s.sibling}if(!l)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(3!==n.tag)throw Error(i(188));return n.stateNode.current===n?e:t}(e),!e)return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function et(e,t){for(var n=e.alternate;null!==t;){if(t===e||t===n)return!0;t=t.return}return!1}var tt,nt,rt,at,ot=!1,it=[],lt=null,st=null,ct=null,ut=new Map,dt=new Map,ft=[],pt="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function mt(e,t,n,r,a){return{blockedOn:e,domEventName:t,eventSystemFlags:16|n,nativeEvent:a,targetContainers:[r]}}function ht(e,t){switch(e){case"focusin":case"focusout":lt=null;break;case"dragenter":case"dragleave":st=null;break;case"mouseover":case"mouseout":ct=null;break;case"pointerover":case"pointerout":ut.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":dt.delete(t.pointerId)}}function gt(e,t,n,r,a,o){return null===e||e.nativeEvent!==o?(e=mt(t,n,r,a,o),null!==t&&(null!==(t=ra(t))&&nt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==a&&-1===t.indexOf(a)&&t.push(a),e)}function bt(e){var t=na(e.target);if(null!==t){var n=Ke(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=Xe(n)))return e.blockedOn=t,void at(e.lanePriority,(function(){o.unstable_runWithPriority(e.priority,(function(){rt(n)}))}))}else if(3===t&&n.stateNode.hydrate)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function vt(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Jt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=ra(n))&&nt(t),e.blockedOn=n,!1;t.shift()}return!0}function yt(e,t,n){vt(e)&&n.delete(t)}function wt(){for(ot=!1;0<it.length;){var e=it[0];if(null!==e.blockedOn){null!==(e=ra(e.blockedOn))&&tt(e);break}for(var t=e.targetContainers;0<t.length;){var n=Jt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n){e.blockedOn=n;break}t.shift()}null===e.blockedOn&&it.shift()}null!==lt&&vt(lt)&&(lt=null),null!==st&&vt(st)&&(st=null),null!==ct&&vt(ct)&&(ct=null),ut.forEach(yt),dt.forEach(yt)}function Et(e,t){e.blockedOn===t&&(e.blockedOn=null,ot||(ot=!0,o.unstable_scheduleCallback(o.unstable_NormalPriority,wt)))}function kt(e){function t(t){return Et(t,e)}if(0<it.length){Et(it[0],e);for(var n=1;n<it.length;n++){var r=it[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==lt&&Et(lt,e),null!==st&&Et(st,e),null!==ct&&Et(ct,e),ut.forEach(t),dt.forEach(t),n=0;n<ft.length;n++)(r=ft[n]).blockedOn===e&&(r.blockedOn=null);for(;0<ft.length&&null===(n=ft[0]).blockedOn;)bt(n),null===n.blockedOn&&ft.shift()}function St(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var _t={animationend:St("Animation","AnimationEnd"),animationiteration:St("Animation","AnimationIteration"),animationstart:St("Animation","AnimationStart"),transitionend:St("Transition","TransitionEnd")},xt={},Tt={};function Ct(e){if(xt[e])return xt[e];if(!_t[e])return e;var t,n=_t[e];for(t in n)if(n.hasOwnProperty(t)&&t in Tt)return xt[e]=n[t];return e}d&&(Tt=document.createElement("div").style,"AnimationEvent"in window||(delete _t.animationend.animation,delete _t.animationiteration.animation,delete _t.animationstart.animation),"TransitionEvent"in window||delete _t.transitionend.transition);var At=Ct("animationend"),Nt=Ct("animationiteration"),Ot=Ct("animationstart"),Lt=Ct("transitionend"),It=new Map,Pt=new Map,Rt=["abort","abort",At,"animationEnd",Nt,"animationIteration",Ot,"animationStart","canplay","canPlay","canplaythrough","canPlayThrough","durationchange","durationChange","emptied","emptied","encrypted","encrypted","ended","ended","error","error","gotpointercapture","gotPointerCapture","load","load","loadeddata","loadedData","loadedmetadata","loadedMetadata","loadstart","loadStart","lostpointercapture","lostPointerCapture","playing","playing","progress","progress","seeking","seeking","stalled","stalled","suspend","suspend","timeupdate","timeUpdate",Lt,"transitionEnd","waiting","waiting"];function Mt(e,t){for(var n=0;n<e.length;n+=2){var r=e[n],a=e[n+1];a="on"+(a[0].toUpperCase()+a.slice(1)),Pt.set(r,t),It.set(r,a),c(a,[r])}}(0,o.unstable_now)();var Dt=8;function Ft(e){if(0!=(1&e))return Dt=15,1;if(0!=(2&e))return Dt=14,2;if(0!=(4&e))return Dt=13,4;var t=24&e;return 0!==t?(Dt=12,t):0!=(32&e)?(Dt=11,32):0!==(t=192&e)?(Dt=10,t):0!=(256&e)?(Dt=9,256):0!==(t=3584&e)?(Dt=8,t):0!=(4096&e)?(Dt=7,4096):0!==(t=4186112&e)?(Dt=6,t):0!==(t=62914560&e)?(Dt=5,t):67108864&e?(Dt=4,67108864):0!=(134217728&e)?(Dt=3,134217728):0!==(t=805306368&e)?(Dt=2,t):0!=(1073741824&e)?(Dt=1,1073741824):(Dt=8,e)}function Bt(e,t){var n=e.pendingLanes;if(0===n)return Dt=0;var r=0,a=0,o=e.expiredLanes,i=e.suspendedLanes,l=e.pingedLanes;if(0!==o)r=o,a=Dt=15;else if(0!==(o=134217727&n)){var s=o&~i;0!==s?(r=Ft(s),a=Dt):0!==(l&=o)&&(r=Ft(l),a=Dt)}else 0!==(o=n&~i)?(r=Ft(o),a=Dt):0!==l&&(r=Ft(l),a=Dt);if(0===r)return 0;if(r=n&((0>(r=31-Zt(r))?0:1<<r)<<1)-1,0!==t&&t!==r&&0==(t&i)){if(Ft(t),a<=Dt)return t;Dt=a}if(0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)a=1<<(n=31-Zt(t)),r|=e[n],t&=~a;return r}function $t(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function Ut(e,t){switch(e){case 15:return 1;case 14:return 2;case 12:return 0===(e=zt(24&~t))?Ut(10,t):e;case 10:return 0===(e=zt(192&~t))?Ut(8,t):e;case 8:return 0===(e=zt(3584&~t))&&(0===(e=zt(4186112&~t))&&(e=512)),e;case 2:return 0===(t=zt(805306368&~t))&&(t=268435456),t}throw Error(i(358,e))}function zt(e){return e&-e}function jt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ht(e,t,n){e.pendingLanes|=t;var r=t-1;e.suspendedLanes&=r,e.pingedLanes&=r,(e=e.eventTimes)[t=31-Zt(t)]=n}var Zt=Math.clz32?Math.clz32:function(e){return 0===e?32:31-(Gt(e)/Vt|0)|0},Gt=Math.log,Vt=Math.LN2;var Wt=o.unstable_UserBlockingPriority,qt=o.unstable_runWithPriority,Yt=!0;function Kt(e,t,n,r){Fe||Me();var a=Qt,o=Fe;Fe=!0;try{Re(a,e,t,n,r)}finally{(Fe=o)||$e()}}function Xt(e,t,n,r){qt(Wt,Qt.bind(null,e,t,n,r))}function Qt(e,t,n,r){var a;if(Yt)if((a=0==(4&t))&&0<it.length&&-1<pt.indexOf(e))e=mt(null,e,t,n,r),it.push(e);else{var o=Jt(e,t,n,r);if(null===o)a&&ht(e,r);else{if(a){if(-1<pt.indexOf(e))return e=mt(o,e,t,n,r),void it.push(e);if(function(e,t,n,r,a){switch(t){case"focusin":return lt=gt(lt,e,t,n,r,a),!0;case"dragenter":return st=gt(st,e,t,n,r,a),!0;case"mouseover":return ct=gt(ct,e,t,n,r,a),!0;case"pointerover":var o=a.pointerId;return ut.set(o,gt(ut.get(o)||null,e,t,n,r,a)),!0;case"gotpointercapture":return o=a.pointerId,dt.set(o,gt(dt.get(o)||null,e,t,n,r,a)),!0}return!1}(o,e,t,n,r))return;ht(e,r)}Mr(e,t,r,null,n)}}}function Jt(e,t,n,r){var a=Te(r);if(null!==(a=na(a))){var o=Ke(a);if(null===o)a=null;else{var i=o.tag;if(13===i){if(null!==(a=Xe(o)))return a;a=null}else if(3===i){if(o.stateNode.hydrate)return 3===o.tag?o.stateNode.containerInfo:null;a=null}else o!==a&&(a=null)}}return Mr(e,t,r,a,n),null}var en=null,tn=null,nn=null;function rn(){if(nn)return nn;var e,t,n=tn,r=n.length,a="value"in en?en.value:en.textContent,o=a.length;for(e=0;e<r&&n[e]===a[e];e++);var i=r-e;for(t=1;t<=i&&n[r-t]===a[o-t];t++);return nn=a.slice(e,1<t?1-t:void 0)}function an(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function on(){return!0}function ln(){return!1}function sn(e){function t(t,n,r,a,o){for(var i in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=a,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(i)&&(t=e[i],this[i]=t?t(a):a[i]);return this.isDefaultPrevented=(null!=a.defaultPrevented?a.defaultPrevented:!1===a.returnValue)?on:ln,this.isPropagationStopped=ln,this}return a(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=on)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=on)},persist:function(){},isPersistent:on}),t}var cn,un,dn,fn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pn=sn(fn),mn=a({},fn,{view:0,detail:0}),hn=sn(mn),gn=a({},mn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:An,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==dn&&(dn&&"mousemove"===e.type?(cn=e.screenX-dn.screenX,un=e.screenY-dn.screenY):un=cn=0,dn=e),cn)},movementY:function(e){return"movementY"in e?e.movementY:un}}),bn=sn(gn),vn=sn(a({},gn,{dataTransfer:0})),yn=sn(a({},mn,{relatedTarget:0})),wn=sn(a({},fn,{animationName:0,elapsedTime:0,pseudoElement:0})),En=a({},fn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),kn=sn(En),Sn=sn(a({},fn,{data:0})),_n={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},xn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Tn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Cn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Tn[e])&&!!t[e]}function An(){return Cn}var Nn=a({},mn,{key:function(e){if(e.key){var t=_n[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=an(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?xn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:An,charCode:function(e){return"keypress"===e.type?an(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?an(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),On=sn(Nn),Ln=sn(a({},gn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),In=sn(a({},mn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:An})),Pn=sn(a({},fn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Rn=a({},gn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Mn=sn(Rn),Dn=[9,13,27,32],Fn=d&&"CompositionEvent"in window,Bn=null;d&&"documentMode"in document&&(Bn=document.documentMode);var $n=d&&"TextEvent"in window&&!Bn,Un=d&&(!Fn||Bn&&8<Bn&&11>=Bn),zn=String.fromCharCode(32),jn=!1;function Hn(e,t){switch(e){case"keyup":return-1!==Dn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zn(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Gn=!1;var Vn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Wn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Vn[e.type]:"textarea"===t}function qn(e,t,n,r){Le(r),0<(t=Fr(t,"onChange")).length&&(n=new pn("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Yn=null,Kn=null;function Xn(e){Nr(e,0)}function Qn(e){if(X(aa(e)))return e}function Jn(e,t){if("change"===e)return t}var er=!1;if(d){var tr;if(d){var nr="oninput"in document;if(!nr){var rr=document.createElement("div");rr.setAttribute("oninput","return;"),nr="function"==typeof rr.oninput}tr=nr}else tr=!1;er=tr&&(!document.documentMode||9<document.documentMode)}function ar(){Yn&&(Yn.detachEvent("onpropertychange",or),Kn=Yn=null)}function or(e){if("value"===e.propertyName&&Qn(Kn)){var t=[];if(qn(t,Kn,e,Te(e)),e=Xn,Fe)e(t);else{Fe=!0;try{Pe(e,t)}finally{Fe=!1,$e()}}}}function ir(e,t,n){"focusin"===e?(ar(),Kn=n,(Yn=t).attachEvent("onpropertychange",or)):"focusout"===e&&ar()}function lr(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Qn(Kn)}function sr(e,t){if("click"===e)return Qn(t)}function cr(e,t){if("input"===e||"change"===e)return Qn(t)}var ur="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},dr=Object.prototype.hasOwnProperty;function fr(e,t){if(ur(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++)if(!dr.call(t,n[r])||!ur(e[n[r]],t[n[r]]))return!1;return!0}function pr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function mr(e,t){var n,r=pr(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=pr(r)}}function hr(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?hr(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function gr(){for(var e=window,t=Q();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(r){n=!1}if(!n)break;t=Q((e=t.contentWindow).document)}return t}function br(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var vr=d&&"documentMode"in document&&11>=document.documentMode,yr=null,wr=null,Er=null,kr=!1;function Sr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;kr||null==yr||yr!==Q(r)||("selectionStart"in(r=yr)&&br(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},Er&&fr(Er,r)||(Er=r,0<(r=Fr(wr,"onSelect")).length&&(t=new pn("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=yr)))}Mt("cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focusin focus focusout blur input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "),0),Mt("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "),1),Mt(Rt,2);for(var _r="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),xr=0;xr<_r.length;xr++)Pt.set(_r[xr],0);u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Tr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Cr=new Set("cancel close invalid load scroll toggle".split(" ").concat(Tr));function Ar(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,r,a,o,l,s,c){if(Ye.apply(this,arguments),Ze){if(!Ze)throw Error(i(198));var u=Ge;Ze=!1,Ge=null,Ve||(Ve=!0,We=u)}}(r,t,void 0,e),e.currentTarget=null}function Nr(e,t){t=0!=(4&t);for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var i=r.length-1;0<=i;i--){var l=r[i],s=l.instance,c=l.currentTarget;if(l=l.listener,s!==o&&a.isPropagationStopped())break e;Ar(a,l,c),o=s}else for(i=0;i<r.length;i++){if(s=(l=r[i]).instance,c=l.currentTarget,l=l.listener,s!==o&&a.isPropagationStopped())break e;Ar(a,l,c),o=s}}}if(Ve)throw e=We,Ve=!1,We=null,e}function Or(e,t){var n=ia(t),r=e+"__bubble";n.has(r)||(Rr(t,e,2,!1),n.add(r))}var Lr="_reactListening"+Math.random().toString(36).slice(2);function Ir(e){e[Lr]||(e[Lr]=!0,l.forEach((function(t){Cr.has(t)||Pr(t,!1,e,null),Pr(t,!0,e,null)})))}function Pr(e,t,n,r){var a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,o=n;if("selectionchange"===e&&9!==n.nodeType&&(o=n.ownerDocument),null!==r&&!t&&Cr.has(e)){if("scroll"!==e)return;a|=2,o=r}var i=ia(o),l=e+"__"+(t?"capture":"bubble");i.has(l)||(t&&(a|=4),Rr(o,e,a,t),i.add(l))}function Rr(e,t,n,r){var a=Pt.get(t);switch(void 0===a?2:a){case 0:a=Kt;break;case 1:a=Xt;break;default:a=Qt}n=a.bind(null,t,n,e),a=void 0,!ze||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(a=!0),r?void 0!==a?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):void 0!==a?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Mr(e,t,n,r,a){var o=r;if(0==(1&t)&&0==(2&t)&&null!==r)e:for(;;){if(null===r)return;var i=r.tag;if(3===i||4===i){var l=r.stateNode.containerInfo;if(l===a||8===l.nodeType&&l.parentNode===a)break;if(4===i)for(i=r.return;null!==i;){var s=i.tag;if((3===s||4===s)&&((s=i.stateNode.containerInfo)===a||8===s.nodeType&&s.parentNode===a))return;i=i.return}for(;null!==l;){if(null===(i=na(l)))return;if(5===(s=i.tag)||6===s){r=o=i;continue e}l=l.parentNode}}r=r.return}!function(e,t,n){if(Be)return e(t,n);Be=!0;try{De(e,t,n)}finally{Be=!1,$e()}}((function(){var r=o,a=Te(n),i=[];e:{var l=It.get(e);if(void 0!==l){var s=pn,c=e;switch(e){case"keypress":if(0===an(n))break e;case"keydown":case"keyup":s=On;break;case"focusin":c="focus",s=yn;break;case"focusout":c="blur",s=yn;break;case"beforeblur":case"afterblur":s=yn;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":s=bn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":s=vn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":s=In;break;case At:case Nt:case Ot:s=wn;break;case Lt:s=Pn;break;case"scroll":s=hn;break;case"wheel":s=Mn;break;case"copy":case"cut":case"paste":s=kn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":s=Ln}var u=0!=(4&t),d=!u&&"scroll"===e,f=u?null!==l?l+"Capture":null:l;u=[];for(var p,m=r;null!==m;){var h=(p=m).stateNode;if(5===p.tag&&null!==h&&(p=h,null!==f&&(null!=(h=Ue(m,f))&&u.push(Dr(m,h,p)))),d)break;m=m.return}0<u.length&&(l=new s(l,c,null,n,a),i.push({event:l,listeners:u}))}}if(0==(7&t)){if(s="mouseout"===e||"pointerout"===e,(!(l="mouseover"===e||"pointerover"===e)||0!=(16&t)||!(c=n.relatedTarget||n.fromElement)||!na(c)&&!c[ea])&&(s||l)&&(l=a.window===a?a:(l=a.ownerDocument)?l.defaultView||l.parentWindow:window,s?(s=r,null!==(c=(c=n.relatedTarget||n.toElement)?na(c):null)&&(c!==(d=Ke(c))||5!==c.tag&&6!==c.tag)&&(c=null)):(s=null,c=r),s!==c)){if(u=bn,h="onMouseLeave",f="onMouseEnter",m="mouse","pointerout"!==e&&"pointerover"!==e||(u=Ln,h="onPointerLeave",f="onPointerEnter",m="pointer"),d=null==s?l:aa(s),p=null==c?l:aa(c),(l=new u(h,m+"leave",s,n,a)).target=d,l.relatedTarget=p,h=null,na(a)===r&&((u=new u(f,m+"enter",c,n,a)).target=p,u.relatedTarget=d,h=u),d=h,s&&c)e:{for(f=c,m=0,p=u=s;p;p=Br(p))m++;for(p=0,h=f;h;h=Br(h))p++;for(;0<m-p;)u=Br(u),m--;for(;0<p-m;)f=Br(f),p--;for(;m--;){if(u===f||null!==f&&u===f.alternate)break e;u=Br(u),f=Br(f)}u=null}else u=null;null!==s&&$r(i,l,s,u,!1),null!==c&&null!==d&&$r(i,d,c,u,!0)}if("select"===(s=(l=r?aa(r):window).nodeName&&l.nodeName.toLowerCase())||"input"===s&&"file"===l.type)var g=Jn;else if(Wn(l))if(er)g=cr;else{g=lr;var b=ir}else(s=l.nodeName)&&"input"===s.toLowerCase()&&("checkbox"===l.type||"radio"===l.type)&&(g=sr);switch(g&&(g=g(e,r))?qn(i,g,n,a):(b&&b(e,l,r),"focusout"===e&&(b=l._wrapperState)&&b.controlled&&"number"===l.type&&ae(l,"number",l.value)),b=r?aa(r):window,e){case"focusin":(Wn(b)||"true"===b.contentEditable)&&(yr=b,wr=r,Er=null);break;case"focusout":Er=wr=yr=null;break;case"mousedown":kr=!0;break;case"contextmenu":case"mouseup":case"dragend":kr=!1,Sr(i,n,a);break;case"selectionchange":if(vr)break;case"keydown":case"keyup":Sr(i,n,a)}var v;if(Fn)e:{switch(e){case"compositionstart":var y="onCompositionStart";break e;case"compositionend":y="onCompositionEnd";break e;case"compositionupdate":y="onCompositionUpdate";break e}y=void 0}else Gn?Hn(e,n)&&(y="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(y="onCompositionStart");y&&(Un&&"ko"!==n.locale&&(Gn||"onCompositionStart"!==y?"onCompositionEnd"===y&&Gn&&(v=rn()):(tn="value"in(en=a)?en.value:en.textContent,Gn=!0)),0<(b=Fr(r,y)).length&&(y=new Sn(y,e,null,n,a),i.push({event:y,listeners:b}),v?y.data=v:null!==(v=Zn(n))&&(y.data=v))),(v=$n?function(e,t){switch(e){case"compositionend":return Zn(t);case"keypress":return 32!==t.which?null:(jn=!0,zn);case"textInput":return(e=t.data)===zn&&jn?null:e;default:return null}}(e,n):function(e,t){if(Gn)return"compositionend"===e||!Fn&&Hn(e,t)?(e=rn(),nn=tn=en=null,Gn=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Un&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(r=Fr(r,"onBeforeInput")).length&&(a=new Sn("onBeforeInput","beforeinput",null,n,a),i.push({event:a,listeners:r}),a.data=v))}Nr(i,t)}))}function Dr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Fr(e,t){for(var n=t+"Capture",r=[];null!==e;){var a=e,o=a.stateNode;5===a.tag&&null!==o&&(a=o,null!=(o=Ue(e,n))&&r.unshift(Dr(e,o,a)),null!=(o=Ue(e,t))&&r.push(Dr(e,o,a))),e=e.return}return r}function Br(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function $r(e,t,n,r,a){for(var o=t._reactName,i=[];null!==n&&n!==r;){var l=n,s=l.alternate,c=l.stateNode;if(null!==s&&s===r)break;5===l.tag&&null!==c&&(l=c,a?null!=(s=Ue(n,o))&&i.unshift(Dr(n,s,l)):a||null!=(s=Ue(n,o))&&i.push(Dr(n,s,l))),n=n.return}0!==i.length&&e.push({event:t,listeners:i})}function Ur(){}var zr=null,jr=null;function Hr(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function Zr(e,t){return"textarea"===e||"option"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Gr="function"==typeof setTimeout?setTimeout:void 0,Vr="function"==typeof clearTimeout?clearTimeout:void 0;function Wr(e){1===e.nodeType?e.textContent="":9===e.nodeType&&(null!=(e=e.body)&&(e.textContent=""))}function qr(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break}return e}function Yr(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var Kr=0;var Xr=Math.random().toString(36).slice(2),Qr="__reactFiber$"+Xr,Jr="__reactProps$"+Xr,ea="__reactContainer$"+Xr,ta="__reactEvents$"+Xr;function na(e){var t=e[Qr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ea]||n[Qr]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=Yr(e);null!==e;){if(n=e[Qr])return n;e=Yr(e)}return t}n=(e=n).parentNode}return null}function ra(e){return!(e=e[Qr]||e[ea])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function aa(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(i(33))}function oa(e){return e[Jr]||null}function ia(e){var t=e[ta];return void 0===t&&(t=e[ta]=new Set),t}var la=[],sa=-1;function ca(e){return{current:e}}function ua(e){0>sa||(e.current=la[sa],la[sa]=null,sa--)}function da(e,t){sa++,la[sa]=e.current,e.current=t}var fa={},pa=ca(fa),ma=ca(!1),ha=fa;function ga(e,t){var n=e.type.contextTypes;if(!n)return fa;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a,o={};for(a in n)o[a]=t[a];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function ba(e){return null!=(e=e.childContextTypes)}function va(){ua(ma),ua(pa)}function ya(e,t,n){if(pa.current!==fa)throw Error(i(168));da(pa,t),da(ma,n)}function wa(e,t,n){var r=e.stateNode;if(e=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var o in r=r.getChildContext())if(!(o in e))throw Error(i(108,W(t)||"Unknown",o));return a({},n,r)}function Ea(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||fa,ha=pa.current,da(pa,e),da(ma,ma.current),!0}function ka(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=wa(e,t,ha),r.__reactInternalMemoizedMergedChildContext=e,ua(ma),ua(pa),da(pa,e)):ua(ma),da(ma,n)}var Sa=null,_a=null,xa=o.unstable_runWithPriority,Ta=o.unstable_scheduleCallback,Ca=o.unstable_cancelCallback,Aa=o.unstable_shouldYield,Na=o.unstable_requestPaint,Oa=o.unstable_now,La=o.unstable_getCurrentPriorityLevel,Ia=o.unstable_ImmediatePriority,Pa=o.unstable_UserBlockingPriority,Ra=o.unstable_NormalPriority,Ma=o.unstable_LowPriority,Da=o.unstable_IdlePriority,Fa={},Ba=void 0!==Na?Na:function(){},$a=null,Ua=null,za=!1,ja=Oa(),Ha=1e4>ja?Oa:function(){return Oa()-ja};function Za(){switch(La()){case Ia:return 99;case Pa:return 98;case Ra:return 97;case Ma:return 96;case Da:return 95;default:throw Error(i(332))}}function Ga(e){switch(e){case 99:return Ia;case 98:return Pa;case 97:return Ra;case 96:return Ma;case 95:return Da;default:throw Error(i(332))}}function Va(e,t){return e=Ga(e),xa(e,t)}function Wa(e,t,n){return e=Ga(e),Ta(e,t,n)}function qa(){if(null!==Ua){var e=Ua;Ua=null,Ca(e)}Ya()}function Ya(){if(!za&&null!==$a){za=!0;var e=0;try{var t=$a;Va(99,(function(){for(;e<t.length;e++){var n=t[e];do{n=n(!0)}while(null!==n)}})),$a=null}catch(n){throw null!==$a&&($a=$a.slice(e+1)),Ta(Ia,qa),n}finally{za=!1}}}var Ka=E.ReactCurrentBatchConfig;function Xa(e,t){if(e&&e.defaultProps){for(var n in t=a({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}var Qa=ca(null),Ja=null,eo=null,to=null;function no(){to=eo=Ja=null}function ro(e){var t=Qa.current;ua(Qa),e.type._context._currentValue=t}function ao(e,t){for(;null!==e;){var n=e.alternate;if((e.childLanes&t)===t){if(null===n||(n.childLanes&t)===t)break;n.childLanes|=t}else e.childLanes|=t,null!==n&&(n.childLanes|=t);e=e.return}}function oo(e,t){Ja=e,to=eo=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!=(e.lanes&t)&&(Fi=!0),e.firstContext=null)}function io(e,t){if(to!==e&&!1!==t&&0!==t)if("number"==typeof t&&1073741823!==t||(to=e,t=1073741823),t={context:e,observedBits:t,next:null},null===eo){if(null===Ja)throw Error(i(308));eo=t,Ja.dependencies={lanes:0,firstContext:t,responders:null}}else eo=eo.next=t;return e._currentValue}var lo=!1;function so(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null},effects:null}}function co(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function uo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function fo(e,t){if(null!==(e=e.updateQueue)){var n=(e=e.shared).pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}}function po(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var a=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===o?a=o=i:o=o.next=i,n=n.next}while(null!==n);null===o?a=o=t:o=o.next=t}else a=o=t;return n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:o,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function mo(e,t,n,r){var o=e.updateQueue;lo=!1;var i=o.firstBaseUpdate,l=o.lastBaseUpdate,s=o.shared.pending;if(null!==s){o.shared.pending=null;var c=s,u=c.next;c.next=null,null===l?i=u:l.next=u,l=c;var d=e.alternate;if(null!==d){var f=(d=d.updateQueue).lastBaseUpdate;f!==l&&(null===f?d.firstBaseUpdate=u:f.next=u,d.lastBaseUpdate=c)}}if(null!==i){for(f=o.baseState,l=0,d=u=c=null;;){s=i.lane;var p=i.eventTime;if((r&s)===s){null!==d&&(d=d.next={eventTime:p,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var m=e,h=i;switch(s=t,p=n,h.tag){case 1:if("function"==typeof(m=h.payload)){f=m.call(p,f,s);break e}f=m;break e;case 3:m.flags=-4097&m.flags|64;case 0:if(null==(s="function"==typeof(m=h.payload)?m.call(p,f,s):m))break e;f=a({},f,s);break e;case 2:lo=!0}}null!==i.callback&&(e.flags|=32,null===(s=o.effects)?o.effects=[i]:s.push(i))}else p={eventTime:p,lane:s,tag:i.tag,payload:i.payload,callback:i.callback,next:null},null===d?(u=d=p,c=f):d=d.next=p,l|=s;if(null===(i=i.next)){if(null===(s=o.shared.pending))break;i=s.next,s.next=null,o.lastBaseUpdate=s,o.shared.pending=null}}null===d&&(c=f),o.baseState=c,o.firstBaseUpdate=u,o.lastBaseUpdate=d,zl|=l,e.lanes=l,e.memoizedState=f}}function ho(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],a=r.callback;if(null!==a){if(r.callback=null,r=n,"function"!=typeof a)throw Error(i(191,a));a.call(r)}}}var go=(new r.Component).refs;function bo(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:a({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var vo={isMounted:function(e){return!!(e=e._reactInternals)&&Ke(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=fs(),a=ps(e),o=uo(r,a);o.payload=t,null!=n&&(o.callback=n),fo(e,o),ms(e,a,r)},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=fs(),a=ps(e),o=uo(r,a);o.tag=1,o.payload=t,null!=n&&(o.callback=n),fo(e,o),ms(e,a,r)},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=fs(),r=ps(e),a=uo(n,r);a.tag=2,null!=t&&(a.callback=t),fo(e,a),ms(e,r,n)}};function yo(e,t,n,r,a,o,i){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,i):!t.prototype||!t.prototype.isPureReactComponent||(!fr(n,r)||!fr(a,o))}function wo(e,t,n){var r=!1,a=fa,o=t.contextType;return"object"==typeof o&&null!==o?o=io(o):(a=ba(t)?ha:pa.current,o=(r=null!=(r=t.contextTypes))?ga(e,a):fa),t=new t(n,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=vo,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=o),t}function Eo(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&vo.enqueueReplaceState(t,t.state,null)}function ko(e,t,n,r){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs=go,so(e);var o=t.contextType;"object"==typeof o&&null!==o?a.context=io(o):(o=ba(t)?ha:pa.current,a.context=ga(e,o)),mo(e,n,a,r),a.state=e.memoizedState,"function"==typeof(o=t.getDerivedStateFromProps)&&(bo(e,t,o,n),a.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof a.getSnapshotBeforeUpdate||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||(t=a.state,"function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount(),t!==a.state&&vo.enqueueReplaceState(a,a.state,null),mo(e,n,a,r),a.state=e.memoizedState),"function"==typeof a.componentDidMount&&(e.flags|=4)}var So=Array.isArray;function _o(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(i(309));var r=n.stateNode}if(!r)throw Error(i(147,e));var a=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===a?t.ref:(t=function(e){var t=r.refs;t===go&&(t=r.refs={}),null===e?delete t[a]:t[a]=e},t._stringRef=a,t)}if("string"!=typeof e)throw Error(i(284));if(!n._owner)throw Error(i(290,e))}return e}function xo(e,t){if("textarea"!==e.type)throw Error(i(31,"[object Object]"===Object.prototype.toString.call(t)?"object with keys {"+Object.keys(t).join(", ")+"}":t))}function To(e){function t(t,n){if(e){var r=t.lastEffect;null!==r?(r.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n,n.nextEffect=null,n.flags=8}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function a(e,t){return(e=Vs(e,t)).index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags=2,n):r:(t.flags=2,n):n}function l(t){return e&&null===t.alternate&&(t.flags=2),t}function s(e,t,n,r){return null===t||6!==t.tag?((t=Ks(n,e.mode,r)).return=e,t):((t=a(t,n)).return=e,t)}function c(e,t,n,r){return null!==t&&t.elementType===n.type?((r=a(t,n.props)).ref=_o(e,t,n),r.return=e,r):((r=Ws(n.type,n.key,n.props,null,e.mode,r)).ref=_o(e,t,n),r.return=e,r)}function u(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Xs(n,e.mode,r)).return=e,t):((t=a(t,n.children||[])).return=e,t)}function d(e,t,n,r,o){return null===t||7!==t.tag?((t=qs(n,e.mode,r,o)).return=e,t):((t=a(t,n)).return=e,t)}function f(e,t,n){if("string"==typeof t||"number"==typeof t)return(t=Ks(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case k:return(n=Ws(t.type,t.key,t.props,null,e.mode,n)).ref=_o(e,null,t),n.return=e,n;case S:return(t=Xs(t,e.mode,n)).return=e,t}if(So(t)||j(t))return(t=qs(t,e.mode,n,null)).return=e,t;xo(e,t)}return null}function p(e,t,n,r){var a=null!==t?t.key:null;if("string"==typeof n||"number"==typeof n)return null!==a?null:s(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case k:return n.key===a?n.type===_?d(e,t,n.props.children,r,a):c(e,t,n,r):null;case S:return n.key===a?u(e,t,n,r):null}if(So(n)||j(n))return null!==a?null:d(e,t,n,r,null);xo(e,n)}return null}function m(e,t,n,r,a){if("string"==typeof r||"number"==typeof r)return s(t,e=e.get(n)||null,""+r,a);if("object"==typeof r&&null!==r){switch(r.$$typeof){case k:return e=e.get(null===r.key?n:r.key)||null,r.type===_?d(t,e,r.props.children,a,r.key):c(t,e,r,a);case S:return u(t,e=e.get(null===r.key?n:r.key)||null,r,a)}if(So(r)||j(r))return d(t,e=e.get(n)||null,r,a,null);xo(t,r)}return null}function h(a,i,l,s){for(var c=null,u=null,d=i,h=i=0,g=null;null!==d&&h<l.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var b=p(a,d,l[h],s);if(null===b){null===d&&(d=g);break}e&&d&&null===b.alternate&&t(a,d),i=o(b,i,h),null===u?c=b:u.sibling=b,u=b,d=g}if(h===l.length)return n(a,d),c;if(null===d){for(;h<l.length;h++)null!==(d=f(a,l[h],s))&&(i=o(d,i,h),null===u?c=d:u.sibling=d,u=d);return c}for(d=r(a,d);h<l.length;h++)null!==(g=m(d,a,h,l[h],s))&&(e&&null!==g.alternate&&d.delete(null===g.key?h:g.key),i=o(g,i,h),null===u?c=g:u.sibling=g,u=g);return e&&d.forEach((function(e){return t(a,e)})),c}function g(a,l,s,c){var u=j(s);if("function"!=typeof u)throw Error(i(150));if(null==(s=u.call(s)))throw Error(i(151));for(var d=u=null,h=l,g=l=0,b=null,v=s.next();null!==h&&!v.done;g++,v=s.next()){h.index>g?(b=h,h=null):b=h.sibling;var y=p(a,h,v.value,c);if(null===y){null===h&&(h=b);break}e&&h&&null===y.alternate&&t(a,h),l=o(y,l,g),null===d?u=y:d.sibling=y,d=y,h=b}if(v.done)return n(a,h),u;if(null===h){for(;!v.done;g++,v=s.next())null!==(v=f(a,v.value,c))&&(l=o(v,l,g),null===d?u=v:d.sibling=v,d=v);return u}for(h=r(a,h);!v.done;g++,v=s.next())null!==(v=m(h,a,g,v.value,c))&&(e&&null!==v.alternate&&h.delete(null===v.key?g:v.key),l=o(v,l,g),null===d?u=v:d.sibling=v,d=v);return e&&h.forEach((function(e){return t(a,e)})),u}return function(e,r,o,s){var c="object"==typeof o&&null!==o&&o.type===_&&null===o.key;c&&(o=o.props.children);var u="object"==typeof o&&null!==o;if(u)switch(o.$$typeof){case k:e:{for(u=o.key,c=r;null!==c;){if(c.key===u){if(7===c.tag){if(o.type===_){n(e,c.sibling),(r=a(c,o.props.children)).return=e,e=r;break e}}else if(c.elementType===o.type){n(e,c.sibling),(r=a(c,o.props)).ref=_o(e,c,o),r.return=e,e=r;break e}n(e,c);break}t(e,c),c=c.sibling}o.type===_?((r=qs(o.props.children,e.mode,s,o.key)).return=e,e=r):((s=Ws(o.type,o.key,o.props,null,e.mode,s)).ref=_o(e,r,o),s.return=e,e=s)}return l(e);case S:e:{for(c=o.key;null!==r;){if(r.key===c){if(4===r.tag&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),(r=a(r,o.children||[])).return=e,e=r;break e}n(e,r);break}t(e,r),r=r.sibling}(r=Xs(o,e.mode,s)).return=e,e=r}return l(e)}if("string"==typeof o||"number"==typeof o)return o=""+o,null!==r&&6===r.tag?(n(e,r.sibling),(r=a(r,o)).return=e,e=r):(n(e,r),(r=Ks(o,e.mode,s)).return=e,e=r),l(e);if(So(o))return h(e,r,o,s);if(j(o))return g(e,r,o,s);if(u&&xo(e,o),void 0===o&&!c)switch(e.tag){case 1:case 22:case 0:case 11:case 15:throw Error(i(152,W(e.type)||"Component"))}return n(e,r)}}var Co=To(!0),Ao=To(!1),No={},Oo=ca(No),Lo=ca(No),Io=ca(No);function Po(e){if(e===No)throw Error(i(174));return e}function Ro(e,t){switch(da(Io,t),da(Lo,e),da(Oo,No),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:me(null,"");break;default:t=me(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}ua(Oo),da(Oo,t)}function Mo(){ua(Oo),ua(Lo),ua(Io)}function Do(e){Po(Io.current);var t=Po(Oo.current),n=me(t,e.type);t!==n&&(da(Lo,e),da(Oo,n))}function Fo(e){Lo.current===e&&(ua(Oo),ua(Lo))}var Bo=ca(0);function $o(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(64&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Uo=null,zo=null,jo=!1;function Ho(e,t){var n=Zs(5,null,null,0);n.elementType="DELETED",n.type="DELETED",n.stateNode=t,n.return=e,n.flags=8,null!==e.lastEffect?(e.lastEffect.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n}function Zo(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,!0);default:return!1}}function Go(e){if(jo){var t=zo;if(t){var n=t;if(!Zo(e,t)){if(!(t=qr(n.nextSibling))||!Zo(e,t))return e.flags=-1025&e.flags|2,jo=!1,void(Uo=e);Ho(Uo,n)}Uo=e,zo=qr(t.firstChild)}else e.flags=-1025&e.flags|2,jo=!1,Uo=e}}function Vo(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;Uo=e}function Wo(e){if(e!==Uo)return!1;if(!jo)return Vo(e),jo=!0,!1;var t=e.type;if(5!==e.tag||"head"!==t&&"body"!==t&&!Zr(t,e.memoizedProps))for(t=zo;t;)Ho(e,t),t=qr(t.nextSibling);if(Vo(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(i(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){zo=qr(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}zo=null}}else zo=Uo?qr(e.stateNode.nextSibling):null;return!0}function qo(){zo=Uo=null,jo=!1}var Yo=[];function Ko(){for(var e=0;e<Yo.length;e++)Yo[e]._workInProgressVersionPrimary=null;Yo.length=0}var Xo=E.ReactCurrentDispatcher,Qo=E.ReactCurrentBatchConfig,Jo=0,ei=null,ti=null,ni=null,ri=!1,ai=!1;function oi(){throw Error(i(321))}function ii(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ur(e[n],t[n]))return!1;return!0}function li(e,t,n,r,a,o){if(Jo=o,ei=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Xo.current=null===e||null===e.memoizedState?Pi:Ri,e=n(r,a),ai){o=0;do{if(ai=!1,!(25>o))throw Error(i(301));o+=1,ni=ti=null,t.updateQueue=null,Xo.current=Mi,e=n(r,a)}while(ai)}if(Xo.current=Ii,t=null!==ti&&null!==ti.next,Jo=0,ni=ti=ei=null,ri=!1,t)throw Error(i(300));return e}function si(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===ni?ei.memoizedState=ni=e:ni=ni.next=e,ni}function ci(){if(null===ti){var e=ei.alternate;e=null!==e?e.memoizedState:null}else e=ti.next;var t=null===ni?ei.memoizedState:ni.next;if(null!==t)ni=t,ti=e;else{if(null===e)throw Error(i(310));e={memoizedState:(ti=e).memoizedState,baseState:ti.baseState,baseQueue:ti.baseQueue,queue:ti.queue,next:null},null===ni?ei.memoizedState=ni=e:ni=ni.next=e}return ni}function ui(e,t){return"function"==typeof t?t(e):t}function di(e){var t=ci(),n=t.queue;if(null===n)throw Error(i(311));n.lastRenderedReducer=e;var r=ti,a=r.baseQueue,o=n.pending;if(null!==o){if(null!==a){var l=a.next;a.next=o.next,o.next=l}r.baseQueue=a=o,n.pending=null}if(null!==a){a=a.next,r=r.baseState;var s=l=o=null,c=a;do{var u=c.lane;if((Jo&u)===u)null!==s&&(s=s.next={lane:0,action:c.action,eagerReducer:c.eagerReducer,eagerState:c.eagerState,next:null}),r=c.eagerReducer===e?c.eagerState:e(r,c.action);else{var d={lane:u,action:c.action,eagerReducer:c.eagerReducer,eagerState:c.eagerState,next:null};null===s?(l=s=d,o=r):s=s.next=d,ei.lanes|=u,zl|=u}c=c.next}while(null!==c&&c!==a);null===s?o=r:s.next=l,ur(r,t.memoizedState)||(Fi=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=s,n.lastRenderedState=r}return[t.memoizedState,n.dispatch]}function fi(e){var t=ci(),n=t.queue;if(null===n)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(null!==a){n.pending=null;var l=a=a.next;do{o=e(o,l.action),l=l.next}while(l!==a);ur(o,t.memoizedState)||(Fi=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function pi(e,t,n){var r=t._getVersion;r=r(t._source);var a=t._workInProgressVersionPrimary;if(null!==a?e=a===r:(e=e.mutableReadLanes,(e=(Jo&e)===e)&&(t._workInProgressVersionPrimary=r,Yo.push(t))),e)return n(t._source);throw Yo.push(t),Error(i(350))}function mi(e,t,n,r){var a=Pl;if(null===a)throw Error(i(349));var o=t._getVersion,l=o(t._source),s=Xo.current,c=s.useState((function(){return pi(a,t,n)})),u=c[1],d=c[0];c=ni;var f=e.memoizedState,p=f.refs,m=p.getSnapshot,h=f.source;f=f.subscribe;var g=ei;return e.memoizedState={refs:p,source:t,subscribe:r},s.useEffect((function(){p.getSnapshot=n,p.setSnapshot=u;var e=o(t._source);if(!ur(l,e)){e=n(t._source),ur(d,e)||(u(e),e=ps(g),a.mutableReadLanes|=e&a.pendingLanes),e=a.mutableReadLanes,a.entangledLanes|=e;for(var r=a.entanglements,i=e;0<i;){var s=31-Zt(i),c=1<<s;r[s]|=e,i&=~c}}}),[n,t,r]),s.useEffect((function(){return r(t._source,(function(){var e=p.getSnapshot,n=p.setSnapshot;try{n(e(t._source));var r=ps(g);a.mutableReadLanes|=r&a.pendingLanes}catch(o){n((function(){throw o}))}}))}),[t,r]),ur(m,n)&&ur(h,t)&&ur(f,r)||((e={pending:null,dispatch:null,lastRenderedReducer:ui,lastRenderedState:d}).dispatch=u=Li.bind(null,ei,e),c.queue=e,c.baseQueue=null,d=pi(a,t,n),c.memoizedState=c.baseState=d),d}function hi(e,t,n){return mi(ci(),e,t,n)}function gi(e){var t=si();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=(e=t.queue={pending:null,dispatch:null,lastRenderedReducer:ui,lastRenderedState:e}).dispatch=Li.bind(null,ei,e),[t.memoizedState,e]}function bi(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=ei.updateQueue)?(t={lastEffect:null},ei.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function vi(e){return e={current:e},si().memoizedState=e}function yi(){return ci().memoizedState}function wi(e,t,n,r){var a=si();ei.flags|=e,a.memoizedState=bi(1|t,n,void 0,void 0===r?null:r)}function Ei(e,t,n,r){var a=ci();r=void 0===r?null:r;var o=void 0;if(null!==ti){var i=ti.memoizedState;if(o=i.destroy,null!==r&&ii(r,i.deps))return void bi(t,n,o,r)}ei.flags|=e,a.memoizedState=bi(1|t,n,o,r)}function ki(e,t){return wi(516,4,e,t)}function Si(e,t){return Ei(516,4,e,t)}function _i(e,t){return Ei(4,2,e,t)}function xi(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Ti(e,t,n){return n=null!=n?n.concat([e]):null,Ei(4,2,xi.bind(null,t,e),n)}function Ci(){}function Ai(e,t){var n=ci();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&ii(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ni(e,t){var n=ci();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&ii(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Oi(e,t){var n=Za();Va(98>n?98:n,(function(){e(!0)})),Va(97<n?97:n,(function(){var n=Qo.transition;Qo.transition=1;try{e(!1),t()}finally{Qo.transition=n}}))}function Li(e,t,n){var r=fs(),a=ps(e),o={lane:a,action:n,eagerReducer:null,eagerState:null,next:null},i=t.pending;if(null===i?o.next=o:(o.next=i.next,i.next=o),t.pending=o,i=e.alternate,e===ei||null!==i&&i===ei)ai=ri=!0;else{if(0===e.lanes&&(null===i||0===i.lanes)&&null!==(i=t.lastRenderedReducer))try{var l=t.lastRenderedState,s=i(l,n);if(o.eagerReducer=i,o.eagerState=s,ur(s,l))return}catch(c){}ms(e,a,r)}}var Ii={readContext:io,useCallback:oi,useContext:oi,useEffect:oi,useImperativeHandle:oi,useLayoutEffect:oi,useMemo:oi,useReducer:oi,useRef:oi,useState:oi,useDebugValue:oi,useDeferredValue:oi,useTransition:oi,useMutableSource:oi,useOpaqueIdentifier:oi,unstable_isNewReconciler:!1},Pi={readContext:io,useCallback:function(e,t){return si().memoizedState=[e,void 0===t?null:t],e},useContext:io,useEffect:ki,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,wi(4,2,xi.bind(null,t,e),n)},useLayoutEffect:function(e,t){return wi(4,2,e,t)},useMemo:function(e,t){var n=si();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=si();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e=(e=r.queue={pending:null,dispatch:null,lastRenderedReducer:e,lastRenderedState:t}).dispatch=Li.bind(null,ei,e),[r.memoizedState,e]},useRef:vi,useState:gi,useDebugValue:Ci,useDeferredValue:function(e){var t=gi(e),n=t[0],r=t[1];return ki((function(){var t=Qo.transition;Qo.transition=1;try{r(e)}finally{Qo.transition=t}}),[e]),n},useTransition:function(){var e=gi(!1),t=e[0];return vi(e=Oi.bind(null,e[1])),[e,t]},useMutableSource:function(e,t,n){var r=si();return r.memoizedState={refs:{getSnapshot:t,setSnapshot:null},source:e,subscribe:n},mi(r,e,t,n)},useOpaqueIdentifier:function(){if(jo){var e=!1,t=function(e){return{$$typeof:M,toString:e,valueOf:e}}((function(){throw e||(e=!0,n("r:"+(Kr++).toString(36))),Error(i(355))})),n=gi(t)[1];return 0==(2&ei.mode)&&(ei.flags|=516,bi(5,(function(){n("r:"+(Kr++).toString(36))}),void 0,null)),t}return gi(t="r:"+(Kr++).toString(36)),t},unstable_isNewReconciler:!1},Ri={readContext:io,useCallback:Ai,useContext:io,useEffect:Si,useImperativeHandle:Ti,useLayoutEffect:_i,useMemo:Ni,useReducer:di,useRef:yi,useState:function(){return di(ui)},useDebugValue:Ci,useDeferredValue:function(e){var t=di(ui),n=t[0],r=t[1];return Si((function(){var t=Qo.transition;Qo.transition=1;try{r(e)}finally{Qo.transition=t}}),[e]),n},useTransition:function(){var e=di(ui)[0];return[yi().current,e]},useMutableSource:hi,useOpaqueIdentifier:function(){return di(ui)[0]},unstable_isNewReconciler:!1},Mi={readContext:io,useCallback:Ai,useContext:io,useEffect:Si,useImperativeHandle:Ti,useLayoutEffect:_i,useMemo:Ni,useReducer:fi,useRef:yi,useState:function(){return fi(ui)},useDebugValue:Ci,useDeferredValue:function(e){var t=fi(ui),n=t[0],r=t[1];return Si((function(){var t=Qo.transition;Qo.transition=1;try{r(e)}finally{Qo.transition=t}}),[e]),n},useTransition:function(){var e=fi(ui)[0];return[yi().current,e]},useMutableSource:hi,useOpaqueIdentifier:function(){return fi(ui)[0]},unstable_isNewReconciler:!1},Di=E.ReactCurrentOwner,Fi=!1;function Bi(e,t,n,r){t.child=null===e?Ao(t,null,n,r):Co(t,e.child,n,r)}function $i(e,t,n,r,a){n=n.render;var o=t.ref;return oo(t,a),r=li(e,t,n,r,o,a),null===e||Fi?(t.flags|=1,Bi(e,t,r,a),t.child):(t.updateQueue=e.updateQueue,t.flags&=-517,e.lanes&=~a,ol(e,t,a))}function Ui(e,t,n,r,a,o){if(null===e){var i=n.type;return"function"!=typeof i||Gs(i)||void 0!==i.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Ws(n.type,null,r,t,t.mode,o)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=i,zi(e,t,i,r,a,o))}return i=e.child,0==(a&o)&&(a=i.memoizedProps,(n=null!==(n=n.compare)?n:fr)(a,r)&&e.ref===t.ref)?ol(e,t,o):(t.flags|=1,(e=Vs(i,r)).ref=t.ref,e.return=t,t.child=e)}function zi(e,t,n,r,a,o){if(null!==e&&fr(e.memoizedProps,r)&&e.ref===t.ref){if(Fi=!1,0==(o&a))return t.lanes=e.lanes,ol(e,t,o);0!=(16384&e.flags)&&(Fi=!0)}return Zi(e,t,n,r,o)}function ji(e,t,n){var r=t.pendingProps,a=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode||"unstable-defer-without-hiding"===r.mode)if(0==(4&t.mode))t.memoizedState={baseLanes:0},ks(t,n);else{if(0==(1073741824&n))return e=null!==o?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e},ks(t,e),null;t.memoizedState={baseLanes:0},ks(t,null!==o?o.baseLanes:n)}else null!==o?(r=o.baseLanes|n,t.memoizedState=null):r=n,ks(t,r);return Bi(e,t,a,n),t.child}function Hi(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=128)}function Zi(e,t,n,r,a){var o=ba(n)?ha:pa.current;return o=ga(t,o),oo(t,a),n=li(e,t,n,r,o,a),null===e||Fi?(t.flags|=1,Bi(e,t,n,a),t.child):(t.updateQueue=e.updateQueue,t.flags&=-517,e.lanes&=~a,ol(e,t,a))}function Gi(e,t,n,r,a){if(ba(n)){var o=!0;Ea(t)}else o=!1;if(oo(t,a),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),wo(t,n,r),ko(t,n,r,a),r=!0;else if(null===e){var i=t.stateNode,l=t.memoizedProps;i.props=l;var s=i.context,c=n.contextType;"object"==typeof c&&null!==c?c=io(c):c=ga(t,c=ba(n)?ha:pa.current);var u=n.getDerivedStateFromProps,d="function"==typeof u||"function"==typeof i.getSnapshotBeforeUpdate;d||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(l!==r||s!==c)&&Eo(t,i,r,c),lo=!1;var f=t.memoizedState;i.state=f,mo(t,r,i,a),s=t.memoizedState,l!==r||f!==s||ma.current||lo?("function"==typeof u&&(bo(t,n,u,r),s=t.memoizedState),(l=lo||yo(t,n,l,r,f,s,c))?(d||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||("function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount()),"function"==typeof i.componentDidMount&&(t.flags|=4)):("function"==typeof i.componentDidMount&&(t.flags|=4),t.memoizedProps=r,t.memoizedState=s),i.props=r,i.state=s,i.context=c,r=l):("function"==typeof i.componentDidMount&&(t.flags|=4),r=!1)}else{i=t.stateNode,co(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:Xa(t.type,l),i.props=c,d=t.pendingProps,f=i.context,"object"==typeof(s=n.contextType)&&null!==s?s=io(s):s=ga(t,s=ba(n)?ha:pa.current);var p=n.getDerivedStateFromProps;(u="function"==typeof p||"function"==typeof i.getSnapshotBeforeUpdate)||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(l!==d||f!==s)&&Eo(t,i,r,s),lo=!1,f=t.memoizedState,i.state=f,mo(t,r,i,a);var m=t.memoizedState;l!==d||f!==m||ma.current||lo?("function"==typeof p&&(bo(t,n,p,r),m=t.memoizedState),(c=lo||yo(t,n,c,r,f,m,s))?(u||"function"!=typeof i.UNSAFE_componentWillUpdate&&"function"!=typeof i.componentWillUpdate||("function"==typeof i.componentWillUpdate&&i.componentWillUpdate(r,m,s),"function"==typeof i.UNSAFE_componentWillUpdate&&i.UNSAFE_componentWillUpdate(r,m,s)),"function"==typeof i.componentDidUpdate&&(t.flags|=4),"function"==typeof i.getSnapshotBeforeUpdate&&(t.flags|=256)):("function"!=typeof i.componentDidUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=256),t.memoizedProps=r,t.memoizedState=m),i.props=r,i.state=m,i.context=s,r=c):("function"!=typeof i.componentDidUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=256),r=!1)}return Vi(e,t,n,r,o,a)}function Vi(e,t,n,r,a,o){Hi(e,t);var i=0!=(64&t.flags);if(!r&&!i)return a&&ka(t,n,!1),ol(e,t,o);r=t.stateNode,Di.current=t;var l=i&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&i?(t.child=Co(t,e.child,null,o),t.child=Co(t,null,l,o)):Bi(e,t,l,o),t.memoizedState=r.state,a&&ka(t,n,!0),t.child}function Wi(e){var t=e.stateNode;t.pendingContext?ya(0,t.pendingContext,t.pendingContext!==t.context):t.context&&ya(0,t.context,!1),Ro(e,t.containerInfo)}var qi,Yi,Ki,Xi={dehydrated:null,retryLane:0};function Qi(e,t,n){var r,a=t.pendingProps,o=Bo.current,i=!1;return(r=0!=(64&t.flags))||(r=(null===e||null!==e.memoizedState)&&0!=(2&o)),r?(i=!0,t.flags&=-65):null!==e&&null===e.memoizedState||void 0===a.fallback||!0===a.unstable_avoidThisFallback||(o|=1),da(Bo,1&o),null===e?(void 0!==a.fallback&&Go(t),e=a.children,o=a.fallback,i?(e=Ji(t,e,o,n),t.child.memoizedState={baseLanes:n},t.memoizedState=Xi,e):"number"==typeof a.unstable_expectedLoadTime?(e=Ji(t,e,o,n),t.child.memoizedState={baseLanes:n},t.memoizedState=Xi,t.lanes=33554432,e):((n=Ys({mode:"visible",children:e},t.mode,n,null)).return=t,t.child=n)):(e.memoizedState,i?(a=tl(e,t,a.children,a.fallback,n),i=t.child,o=e.child.memoizedState,i.memoizedState=null===o?{baseLanes:n}:{baseLanes:o.baseLanes|n},i.childLanes=e.childLanes&~n,t.memoizedState=Xi,a):(n=el(e,t,a.children,n),t.memoizedState=null,n))}function Ji(e,t,n,r){var a=e.mode,o=e.child;return t={mode:"hidden",children:t},0==(2&a)&&null!==o?(o.childLanes=0,o.pendingProps=t):o=Ys(t,a,0,null),n=qs(n,a,r,null),o.return=e,n.return=e,o.sibling=n,e.child=o,n}function el(e,t,n,r){var a=e.child;return e=a.sibling,n=Vs(a,{mode:"visible",children:n}),0==(2&t.mode)&&(n.lanes=r),n.return=t,n.sibling=null,null!==e&&(e.nextEffect=null,e.flags=8,t.firstEffect=t.lastEffect=e),t.child=n}function tl(e,t,n,r,a){var o=t.mode,i=e.child;e=i.sibling;var l={mode:"hidden",children:n};return 0==(2&o)&&t.child!==i?((n=t.child).childLanes=0,n.pendingProps=l,null!==(i=n.lastEffect)?(t.firstEffect=n.firstEffect,t.lastEffect=i,i.nextEffect=null):t.firstEffect=t.lastEffect=null):n=Vs(i,l),null!==e?r=Vs(e,r):(r=qs(r,o,a,null)).flags|=2,r.return=t,n.return=t,n.sibling=r,t.child=n,r}function nl(e,t){e.lanes|=t;var n=e.alternate;null!==n&&(n.lanes|=t),ao(e.return,t)}function rl(e,t,n,r,a,o){var i=e.memoizedState;null===i?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a,lastEffect:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=a,i.lastEffect=o)}function al(e,t,n){var r=t.pendingProps,a=r.revealOrder,o=r.tail;if(Bi(e,t,r.children,n),0!=(2&(r=Bo.current)))r=1&r|2,t.flags|=64;else{if(null!==e&&0!=(64&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&nl(e,n);else if(19===e.tag)nl(e,n);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(da(Bo,r),0==(2&t.mode))t.memoizedState=null;else switch(a){case"forwards":for(n=t.child,a=null;null!==n;)null!==(e=n.alternate)&&null===$o(e)&&(a=n),n=n.sibling;null===(n=a)?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),rl(t,!1,a,n,o,t.lastEffect);break;case"backwards":for(n=null,a=t.child,t.child=null;null!==a;){if(null!==(e=a.alternate)&&null===$o(e)){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}rl(t,!0,n,null,o,t.lastEffect);break;case"together":rl(t,!1,null,null,void 0,t.lastEffect);break;default:t.memoizedState=null}return t.child}function ol(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),zl|=t.lanes,0!=(n&t.childLanes)){if(null!==e&&t.child!==e.child)throw Error(i(153));if(null!==t.child){for(n=Vs(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Vs(e,e.pendingProps)).return=t;n.sibling=null}return t.child}return null}function il(e,t){if(!jo)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ll(e,t,n){var r=t.pendingProps;switch(t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:case 17:return ba(t.type)&&va(),null;case 3:return Mo(),ua(ma),ua(pa),Ko(),(r=t.stateNode).pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(Wo(t)?t.flags|=4:r.hydrate||(t.flags|=256)),null;case 5:Fo(t);var o=Po(Io.current);if(n=t.type,null!==e&&null!=t.stateNode)Yi(e,t,n,r),e.ref!==t.ref&&(t.flags|=128);else{if(!r){if(null===t.stateNode)throw Error(i(166));return null}if(e=Po(Oo.current),Wo(t)){r=t.stateNode,n=t.type;var l=t.memoizedProps;switch(r[Qr]=t,r[Jr]=l,n){case"dialog":Or("cancel",r),Or("close",r);break;case"iframe":case"object":case"embed":Or("load",r);break;case"video":case"audio":for(e=0;e<Tr.length;e++)Or(Tr[e],r);break;case"source":Or("error",r);break;case"img":case"image":case"link":Or("error",r),Or("load",r);break;case"details":Or("toggle",r);break;case"input":ee(r,l),Or("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!l.multiple},Or("invalid",r);break;case"textarea":se(r,l),Or("invalid",r)}for(var c in _e(n,l),e=null,l)l.hasOwnProperty(c)&&(o=l[c],"children"===c?"string"==typeof o?r.textContent!==o&&(e=["children",o]):"number"==typeof o&&r.textContent!==""+o&&(e=["children",""+o]):s.hasOwnProperty(c)&&null!=o&&"onScroll"===c&&Or("scroll",r));switch(n){case"input":K(r),re(r,l,!0);break;case"textarea":K(r),ue(r);break;case"select":case"option":break;default:"function"==typeof l.onClick&&(r.onclick=Ur)}r=e,t.updateQueue=r,null!==r&&(t.flags|=4)}else{switch(c=9===o.nodeType?o:o.ownerDocument,e===de&&(e=pe(n)),e===de?"script"===n?((e=c.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=c.createElement(n,{is:r.is}):(e=c.createElement(n),"select"===n&&(c=e,r.multiple?c.multiple=!0:r.size&&(c.size=r.size))):e=c.createElementNS(e,n),e[Qr]=t,e[Jr]=r,qi(e,t),t.stateNode=e,c=xe(n,r),n){case"dialog":Or("cancel",e),Or("close",e),o=r;break;case"iframe":case"object":case"embed":Or("load",e),o=r;break;case"video":case"audio":for(o=0;o<Tr.length;o++)Or(Tr[o],e);o=r;break;case"source":Or("error",e),o=r;break;case"img":case"image":case"link":Or("error",e),Or("load",e),o=r;break;case"details":Or("toggle",e),o=r;break;case"input":ee(e,r),o=J(e,r),Or("invalid",e);break;case"option":o=oe(e,r);break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=a({},r,{value:void 0}),Or("invalid",e);break;case"textarea":se(e,r),o=le(e,r),Or("invalid",e);break;default:o=r}_e(n,o);var u=o;for(l in u)if(u.hasOwnProperty(l)){var d=u[l];"style"===l?ke(e,d):"dangerouslySetInnerHTML"===l?null!=(d=d?d.__html:void 0)&&be(e,d):"children"===l?"string"==typeof d?("textarea"!==n||""!==d)&&ve(e,d):"number"==typeof d&&ve(e,""+d):"suppressContentEditableWarning"!==l&&"suppressHydrationWarning"!==l&&"autoFocus"!==l&&(s.hasOwnProperty(l)?null!=d&&"onScroll"===l&&Or("scroll",e):null!=d&&w(e,l,d,c))}switch(n){case"input":K(e),re(e,r,!1);break;case"textarea":K(e),ue(e);break;case"option":null!=r.value&&e.setAttribute("value",""+q(r.value));break;case"select":e.multiple=!!r.multiple,null!=(l=r.value)?ie(e,!!r.multiple,l,!1):null!=r.defaultValue&&ie(e,!!r.multiple,r.defaultValue,!0);break;default:"function"==typeof o.onClick&&(e.onclick=Ur)}Hr(n,r)&&(t.flags|=4)}null!==t.ref&&(t.flags|=128)}return null;case 6:if(e&&null!=t.stateNode)Ki(0,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(i(166));n=Po(Io.current),Po(Oo.current),Wo(t)?(r=t.stateNode,n=t.memoizedProps,r[Qr]=t,r.nodeValue!==n&&(t.flags|=4)):((r=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[Qr]=t,t.stateNode=r)}return null;case 13:return ua(Bo),r=t.memoizedState,0!=(64&t.flags)?(t.lanes=n,t):(r=null!==r,n=!1,null===e?void 0!==t.memoizedProps.fallback&&Wo(t):n=null!==e.memoizedState,r&&!n&&0!=(2&t.mode)&&(null===e&&!0!==t.memoizedProps.unstable_avoidThisFallback||0!=(1&Bo.current)?0===Bl&&(Bl=3):(0!==Bl&&3!==Bl||(Bl=4),null===Pl||0==(134217727&zl)&&0==(134217727&jl)||vs(Pl,Ml))),(r||n)&&(t.flags|=4),null);case 4:return Mo(),null===e&&Ir(t.stateNode.containerInfo),null;case 10:return ro(t),null;case 19:if(ua(Bo),null===(r=t.memoizedState))return null;if(l=0!=(64&t.flags),null===(c=r.rendering))if(l)il(r,!1);else{if(0!==Bl||null!==e&&0!=(64&e.flags))for(e=t.child;null!==e;){if(null!==(c=$o(e))){for(t.flags|=64,il(r,!1),null!==(l=c.updateQueue)&&(t.updateQueue=l,t.flags|=4),null===r.lastEffect&&(t.firstEffect=null),t.lastEffect=r.lastEffect,r=n,n=t.child;null!==n;)e=r,(l=n).flags&=2,l.nextEffect=null,l.firstEffect=null,l.lastEffect=null,null===(c=l.alternate)?(l.childLanes=0,l.lanes=e,l.child=null,l.memoizedProps=null,l.memoizedState=null,l.updateQueue=null,l.dependencies=null,l.stateNode=null):(l.childLanes=c.childLanes,l.lanes=c.lanes,l.child=c.child,l.memoizedProps=c.memoizedProps,l.memoizedState=c.memoizedState,l.updateQueue=c.updateQueue,l.type=c.type,e=c.dependencies,l.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return da(Bo,1&Bo.current|2),t.child}e=e.sibling}null!==r.tail&&Ha()>Vl&&(t.flags|=64,l=!0,il(r,!1),t.lanes=33554432)}else{if(!l)if(null!==(e=$o(c))){if(t.flags|=64,l=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),il(r,!0),null===r.tail&&"hidden"===r.tailMode&&!c.alternate&&!jo)return null!==(t=t.lastEffect=r.lastEffect)&&(t.nextEffect=null),null}else 2*Ha()-r.renderingStartTime>Vl&&1073741824!==n&&(t.flags|=64,l=!0,il(r,!1),t.lanes=33554432);r.isBackwards?(c.sibling=t.child,t.child=c):(null!==(n=r.last)?n.sibling=c:t.child=c,r.last=c)}return null!==r.tail?(n=r.tail,r.rendering=n,r.tail=n.sibling,r.lastEffect=t.lastEffect,r.renderingStartTime=Ha(),n.sibling=null,t=Bo.current,da(Bo,l?1&t|2:1&t),n):null;case 23:case 24:return Ss(),null!==e&&null!==e.memoizedState!=(null!==t.memoizedState)&&"unstable-defer-without-hiding"!==r.mode&&(t.flags|=4),null}throw Error(i(156,t.tag))}function sl(e){switch(e.tag){case 1:ba(e.type)&&va();var t=e.flags;return 4096&t?(e.flags=-4097&t|64,e):null;case 3:if(Mo(),ua(ma),ua(pa),Ko(),0!=(64&(t=e.flags)))throw Error(i(285));return e.flags=-4097&t|64,e;case 5:return Fo(e),null;case 13:return ua(Bo),4096&(t=e.flags)?(e.flags=-4097&t|64,e):null;case 19:return ua(Bo),null;case 4:return Mo(),null;case 10:return ro(e),null;case 23:case 24:return Ss(),null;default:return null}}function cl(e,t){try{var n="",r=t;do{n+=V(r),r=r.return}while(r);var a=n}catch(o){a="\nError generating stack: "+o.message+"\n"+o.stack}return{value:e,source:t,stack:a}}function ul(e,t){try{console.error(t.value)}catch(n){setTimeout((function(){throw n}))}}qi=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Yi=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Po(Oo.current);var i,l=null;switch(n){case"input":o=J(e,o),r=J(e,r),l=[];break;case"option":o=oe(e,o),r=oe(e,r),l=[];break;case"select":o=a({},o,{value:void 0}),r=a({},r,{value:void 0}),l=[];break;case"textarea":o=le(e,o),r=le(e,r),l=[];break;default:"function"!=typeof o.onClick&&"function"==typeof r.onClick&&(e.onclick=Ur)}for(d in _e(n,r),n=null,o)if(!r.hasOwnProperty(d)&&o.hasOwnProperty(d)&&null!=o[d])if("style"===d){var c=o[d];for(i in c)c.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else"dangerouslySetInnerHTML"!==d&&"children"!==d&&"suppressContentEditableWarning"!==d&&"suppressHydrationWarning"!==d&&"autoFocus"!==d&&(s.hasOwnProperty(d)?l||(l=[]):(l=l||[]).push(d,null));for(d in r){var u=r[d];if(c=null!=o?o[d]:void 0,r.hasOwnProperty(d)&&u!==c&&(null!=u||null!=c))if("style"===d)if(c){for(i in c)!c.hasOwnProperty(i)||u&&u.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in u)u.hasOwnProperty(i)&&c[i]!==u[i]&&(n||(n={}),n[i]=u[i])}else n||(l||(l=[]),l.push(d,n)),n=u;else"dangerouslySetInnerHTML"===d?(u=u?u.__html:void 0,c=c?c.__html:void 0,null!=u&&c!==u&&(l=l||[]).push(d,u)):"children"===d?"string"!=typeof u&&"number"!=typeof u||(l=l||[]).push(d,""+u):"suppressContentEditableWarning"!==d&&"suppressHydrationWarning"!==d&&(s.hasOwnProperty(d)?(null!=u&&"onScroll"===d&&Or("scroll",e),l||c===u||(l=[])):"object"==typeof u&&null!==u&&u.$$typeof===M?u.toString():(l=l||[]).push(d,u))}n&&(l=l||[]).push("style",n);var d=l;(t.updateQueue=d)&&(t.flags|=4)}},Ki=function(e,t,n,r){n!==r&&(t.flags|=4)};var dl="function"==typeof WeakMap?WeakMap:Map;function fl(e,t,n){(n=uo(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Kl||(Kl=!0,Xl=r),ul(0,t)},n}function pl(e,t,n){(n=uo(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var a=t.value;n.payload=function(){return ul(0,t),r(a)}}var o=e.stateNode;return null!==o&&"function"==typeof o.componentDidCatch&&(n.callback=function(){"function"!=typeof r&&(null===Ql?Ql=new Set([this]):Ql.add(this),ul(0,t));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}var ml="function"==typeof WeakSet?WeakSet:Set;function hl(e){var t=e.ref;if(null!==t)if("function"==typeof t)try{t(null)}catch(n){Us(e,n)}else t.current=null}function gl(e,t){switch(t.tag){case 0:case 11:case 15:case 22:case 5:case 6:case 4:case 17:return;case 1:if(256&t.flags&&null!==e){var n=e.memoizedProps,r=e.memoizedState;t=(e=t.stateNode).getSnapshotBeforeUpdate(t.elementType===t.type?n:Xa(t.type,n),r),e.__reactInternalSnapshotBeforeUpdate=t}return;case 3:return void(256&t.flags&&Wr(t.stateNode.containerInfo))}throw Error(i(163))}function bl(e,t,n){switch(n.tag){case 0:case 11:case 15:case 22:if(null!==(t=null!==(t=n.updateQueue)?t.lastEffect:null)){e=t=t.next;do{if(3==(3&e.tag)){var r=e.create;e.destroy=r()}e=e.next}while(e!==t)}if(null!==(t=null!==(t=n.updateQueue)?t.lastEffect:null)){e=t=t.next;do{var a=e;r=a.next,0!=(4&(a=a.tag))&&0!=(1&a)&&(Fs(n,e),Ds(n,e)),e=r}while(e!==t)}return;case 1:return e=n.stateNode,4&n.flags&&(null===t?e.componentDidMount():(r=n.elementType===n.type?t.memoizedProps:Xa(n.type,t.memoizedProps),e.componentDidUpdate(r,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate))),void(null!==(t=n.updateQueue)&&ho(n,t,e));case 3:if(null!==(t=n.updateQueue)){if(e=null,null!==n.child)switch(n.child.tag){case 5:case 1:e=n.child.stateNode}ho(n,t,e)}return;case 5:return e=n.stateNode,void(null===t&&4&n.flags&&Hr(n.type,n.memoizedProps)&&e.focus());case 6:case 4:case 12:case 19:case 17:case 20:case 21:case 23:case 24:return;case 13:return void(null===n.memoizedState&&(n=n.alternate,null!==n&&(n=n.memoizedState,null!==n&&(n=n.dehydrated,null!==n&&kt(n)))))}throw Error(i(163))}function vl(e,t){for(var n=e;;){if(5===n.tag){var r=n.stateNode;if(t)"function"==typeof(r=r.style).setProperty?r.setProperty("display","none","important"):r.display="none";else{r=n.stateNode;var a=n.memoizedProps.style;a=null!=a&&a.hasOwnProperty("display")?a.display:null,r.style.display=Ee("display",a)}}else if(6===n.tag)n.stateNode.nodeValue=t?"":n.memoizedProps;else if((23!==n.tag&&24!==n.tag||null===n.memoizedState||n===e)&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}}function yl(e,t){if(_a&&"function"==typeof _a.onCommitFiberUnmount)try{_a.onCommitFiberUnmount(Sa,t)}catch(o){}switch(t.tag){case 0:case 11:case 14:case 15:case 22:if(null!==(e=t.updateQueue)&&null!==(e=e.lastEffect)){var n=e=e.next;do{var r=n,a=r.destroy;if(r=r.tag,void 0!==a)if(0!=(4&r))Fs(t,n);else{r=t;try{a()}catch(o){Us(r,o)}}n=n.next}while(n!==e)}break;case 1:if(hl(t),"function"==typeof(e=t.stateNode).componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(o){Us(t,o)}break;case 5:hl(t);break;case 4:xl(e,t)}}function wl(e){e.alternate=null,e.child=null,e.dependencies=null,e.firstEffect=null,e.lastEffect=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.return=null,e.updateQueue=null}function El(e){return 5===e.tag||3===e.tag||4===e.tag}function kl(e){e:{for(var t=e.return;null!==t;){if(El(t))break e;t=t.return}throw Error(i(160))}var n=t;switch(t=n.stateNode,n.tag){case 5:var r=!1;break;case 3:case 4:t=t.containerInfo,r=!0;break;default:throw Error(i(161))}16&n.flags&&(ve(t,""),n.flags&=-17);e:t:for(n=e;;){for(;null===n.sibling;){if(null===n.return||El(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag&&18!==n.tag;){if(2&n.flags)continue t;if(null===n.child||4===n.tag)continue t;n.child.return=n,n=n.child}if(!(2&n.flags)){n=n.stateNode;break e}}r?Sl(e,n,t):_l(e,n,t)}function Sl(e,t,n){var r=e.tag,a=5===r||6===r;if(a)e=a?e.stateNode:e.stateNode.instance,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Ur));else if(4!==r&&null!==(e=e.child))for(Sl(e,t,n),e=e.sibling;null!==e;)Sl(e,t,n),e=e.sibling}function _l(e,t,n){var r=e.tag,a=5===r||6===r;if(a)e=a?e.stateNode:e.stateNode.instance,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(_l(e,t,n),e=e.sibling;null!==e;)_l(e,t,n),e=e.sibling}function xl(e,t){for(var n,r,a=t,o=!1;;){if(!o){o=a.return;e:for(;;){if(null===o)throw Error(i(160));switch(n=o.stateNode,o.tag){case 5:r=!1;break e;case 3:case 4:n=n.containerInfo,r=!0;break e}o=o.return}o=!0}if(5===a.tag||6===a.tag){e:for(var l=e,s=a,c=s;;)if(yl(l,c),null!==c.child&&4!==c.tag)c.child.return=c,c=c.child;else{if(c===s)break e;for(;null===c.sibling;){if(null===c.return||c.return===s)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}r?(l=n,s=a.stateNode,8===l.nodeType?l.parentNode.removeChild(s):l.removeChild(s)):n.removeChild(a.stateNode)}else if(4===a.tag){if(null!==a.child){n=a.stateNode.containerInfo,r=!0,a.child.return=a,a=a.child;continue}}else if(yl(e,a),null!==a.child){a.child.return=a,a=a.child;continue}if(a===t)break;for(;null===a.sibling;){if(null===a.return||a.return===t)return;4===(a=a.return).tag&&(o=!1)}a.sibling.return=a.return,a=a.sibling}}function Tl(e,t){switch(t.tag){case 0:case 11:case 14:case 15:case 22:var n=t.updateQueue;if(null!==(n=null!==n?n.lastEffect:null)){var r=n=n.next;do{3==(3&r.tag)&&(e=r.destroy,r.destroy=void 0,void 0!==e&&e()),r=r.next}while(r!==n)}return;case 1:case 12:case 17:return;case 5:if(null!=(n=t.stateNode)){r=t.memoizedProps;var a=null!==e?e.memoizedProps:r;e=t.type;var o=t.updateQueue;if(t.updateQueue=null,null!==o){for(n[Jr]=r,"input"===e&&"radio"===r.type&&null!=r.name&&te(n,r),xe(e,a),t=xe(e,r),a=0;a<o.length;a+=2){var l=o[a],s=o[a+1];"style"===l?ke(n,s):"dangerouslySetInnerHTML"===l?be(n,s):"children"===l?ve(n,s):w(n,l,s,t)}switch(e){case"input":ne(n,r);break;case"textarea":ce(n,r);break;case"select":e=n._wrapperState.wasMultiple,n._wrapperState.wasMultiple=!!r.multiple,null!=(o=r.value)?ie(n,!!r.multiple,o,!1):e!==!!r.multiple&&(null!=r.defaultValue?ie(n,!!r.multiple,r.defaultValue,!0):ie(n,!!r.multiple,r.multiple?[]:"",!1))}}}return;case 6:if(null===t.stateNode)throw Error(i(162));return void(t.stateNode.nodeValue=t.memoizedProps);case 3:return void((n=t.stateNode).hydrate&&(n.hydrate=!1,kt(n.containerInfo)));case 13:return null!==t.memoizedState&&(Gl=Ha(),vl(t.child,!0)),void Cl(t);case 19:return void Cl(t);case 23:case 24:return void vl(t,null!==t.memoizedState)}throw Error(i(163))}function Cl(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new ml),t.forEach((function(t){var r=js.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))}))}}function Al(e,t){return null!==e&&(null===(e=e.memoizedState)||null!==e.dehydrated)&&(null!==(t=t.memoizedState)&&null===t.dehydrated)}var Nl=Math.ceil,Ol=E.ReactCurrentDispatcher,Ll=E.ReactCurrentOwner,Il=0,Pl=null,Rl=null,Ml=0,Dl=0,Fl=ca(0),Bl=0,$l=null,Ul=0,zl=0,jl=0,Hl=0,Zl=null,Gl=0,Vl=1/0;function Wl(){Vl=Ha()+500}var ql,Yl=null,Kl=!1,Xl=null,Ql=null,Jl=!1,es=null,ts=90,ns=[],rs=[],as=null,os=0,is=null,ls=-1,ss=0,cs=0,us=null,ds=!1;function fs(){return 0!=(48&Il)?Ha():-1!==ls?ls:ls=Ha()}function ps(e){if(0==(2&(e=e.mode)))return 1;if(0==(4&e))return 99===Za()?1:2;if(0===ss&&(ss=Ul),0!==Ka.transition){0!==cs&&(cs=null!==Zl?Zl.pendingLanes:0),e=ss;var t=4186112&~cs;return 0===(t&=-t)&&(0===(t=(e=4186112&~e)&-e)&&(t=8192)),t}return e=Za(),0!=(4&Il)&&98===e?e=Ut(12,ss):e=Ut(e=function(e){switch(e){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}(e),ss),e}function ms(e,t,n){if(50<os)throw os=0,is=null,Error(i(185));if(null===(e=hs(e,t)))return null;Ht(e,t,n),e===Pl&&(jl|=t,4===Bl&&vs(e,Ml));var r=Za();1===t?0!=(8&Il)&&0==(48&Il)?ys(e):(gs(e,n),0===Il&&(Wl(),qa())):(0==(4&Il)||98!==r&&99!==r||(null===as?as=new Set([e]):as.add(e)),gs(e,n)),Zl=e}function hs(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}function gs(e,t){for(var n=e.callbackNode,r=e.suspendedLanes,a=e.pingedLanes,o=e.expirationTimes,l=e.pendingLanes;0<l;){var s=31-Zt(l),c=1<<s,u=o[s];if(-1===u){if(0==(c&r)||0!=(c&a)){u=t,Ft(c);var d=Dt;o[s]=10<=d?u+250:6<=d?u+5e3:-1}}else u<=t&&(e.expiredLanes|=c);l&=~c}if(r=Bt(e,e===Pl?Ml:0),t=Dt,0===r)null!==n&&(n!==Fa&&Ca(n),e.callbackNode=null,e.callbackPriority=0);else{if(null!==n){if(e.callbackPriority===t)return;n!==Fa&&Ca(n)}15===t?(n=ys.bind(null,e),null===$a?($a=[n],Ua=Ta(Ia,Ya)):$a.push(n),n=Fa):14===t?n=Wa(99,ys.bind(null,e)):(n=function(e){switch(e){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(i(358,e))}}(t),n=Wa(n,bs.bind(null,e))),e.callbackPriority=t,e.callbackNode=n}}function bs(e){if(ls=-1,cs=ss=0,0!=(48&Il))throw Error(i(327));var t=e.callbackNode;if(Ms()&&e.callbackNode!==t)return null;var n=Bt(e,e===Pl?Ml:0);if(0===n)return null;var r=n,a=Il;Il|=16;var o=Ts();for(Pl===e&&Ml===r||(Wl(),_s(e,r));;)try{Ns();break}catch(s){xs(e,s)}if(no(),Ol.current=o,Il=a,null!==Rl?r=0:(Pl=null,Ml=0,r=Bl),0!=(Ul&jl))_s(e,0);else if(0!==r){if(2===r&&(Il|=64,e.hydrate&&(e.hydrate=!1,Wr(e.containerInfo)),0!==(n=$t(e))&&(r=Cs(e,n))),1===r)throw t=$l,_s(e,0),vs(e,n),gs(e,Ha()),t;switch(e.finishedWork=e.current.alternate,e.finishedLanes=n,r){case 0:case 1:throw Error(i(345));case 2:case 5:Is(e);break;case 3:if(vs(e,n),(62914560&n)===n&&10<(r=Gl+500-Ha())){if(0!==Bt(e,0))break;if(((a=e.suspendedLanes)&n)!==n){fs(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Gr(Is.bind(null,e),r);break}Is(e);break;case 4:if(vs(e,n),(4186112&n)===n)break;for(r=e.eventTimes,a=-1;0<n;){var l=31-Zt(n);o=1<<l,(l=r[l])>a&&(a=l),n&=~o}if(n=a,10<(n=(120>(n=Ha()-n)?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Nl(n/1960))-n)){e.timeoutHandle=Gr(Is.bind(null,e),n);break}Is(e);break;default:throw Error(i(329))}}return gs(e,Ha()),e.callbackNode===t?bs.bind(null,e):null}function vs(e,t){for(t&=~Hl,t&=~jl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Zt(t),r=1<<n;e[n]=-1,t&=~r}}function ys(e){if(0!=(48&Il))throw Error(i(327));if(Ms(),e===Pl&&0!=(e.expiredLanes&Ml)){var t=Ml,n=Cs(e,t);0!=(Ul&jl)&&(n=Cs(e,t=Bt(e,t)))}else n=Cs(e,t=Bt(e,0));if(0!==e.tag&&2===n&&(Il|=64,e.hydrate&&(e.hydrate=!1,Wr(e.containerInfo)),0!==(t=$t(e))&&(n=Cs(e,t))),1===n)throw n=$l,_s(e,0),vs(e,t),gs(e,Ha()),n;return e.finishedWork=e.current.alternate,e.finishedLanes=t,Is(e),gs(e,Ha()),null}function ws(e,t){var n=Il;Il|=1;try{return e(t)}finally{0===(Il=n)&&(Wl(),qa())}}function Es(e,t){var n=Il;Il&=-2,Il|=8;try{return e(t)}finally{0===(Il=n)&&(Wl(),qa())}}function ks(e,t){da(Fl,Dl),Dl|=t,Ul|=t}function Ss(){Dl=Fl.current,ua(Fl)}function _s(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,Vr(n)),null!==Rl)for(n=Rl.return;null!==n;){var r=n;switch(r.tag){case 1:null!=(r=r.type.childContextTypes)&&va();break;case 3:Mo(),ua(ma),ua(pa),Ko();break;case 5:Fo(r);break;case 4:Mo();break;case 13:case 19:ua(Bo);break;case 10:ro(r);break;case 23:case 24:Ss()}n=n.return}Pl=e,Rl=Vs(e.current,null),Ml=Dl=Ul=t,Bl=0,$l=null,Hl=jl=zl=0}function xs(e,t){for(;;){var n=Rl;try{if(no(),Xo.current=Ii,ri){for(var r=ei.memoizedState;null!==r;){var a=r.queue;null!==a&&(a.pending=null),r=r.next}ri=!1}if(Jo=0,ni=ti=ei=null,ai=!1,Ll.current=null,null===n||null===n.return){Bl=1,$l=t,Rl=null;break}e:{var o=e,i=n.return,l=n,s=t;if(t=Ml,l.flags|=2048,l.firstEffect=l.lastEffect=null,null!==s&&"object"==typeof s&&"function"==typeof s.then){var c=s;if(0==(2&l.mode)){var u=l.alternate;u?(l.updateQueue=u.updateQueue,l.memoizedState=u.memoizedState,l.lanes=u.lanes):(l.updateQueue=null,l.memoizedState=null)}var d=0!=(1&Bo.current),f=i;do{var p;if(p=13===f.tag){var m=f.memoizedState;if(null!==m)p=null!==m.dehydrated;else{var h=f.memoizedProps;p=void 0!==h.fallback&&(!0!==h.unstable_avoidThisFallback||!d)}}if(p){var g=f.updateQueue;if(null===g){var b=new Set;b.add(c),f.updateQueue=b}else g.add(c);if(0==(2&f.mode)){if(f.flags|=64,l.flags|=16384,l.flags&=-2981,1===l.tag)if(null===l.alternate)l.tag=17;else{var v=uo(-1,1);v.tag=2,fo(l,v)}l.lanes|=1;break e}s=void 0,l=t;var y=o.pingCache;if(null===y?(y=o.pingCache=new dl,s=new Set,y.set(c,s)):void 0===(s=y.get(c))&&(s=new Set,y.set(c,s)),!s.has(l)){s.add(l);var w=zs.bind(null,o,c,l);c.then(w,w)}f.flags|=4096,f.lanes=t;break e}f=f.return}while(null!==f);s=Error((W(l.type)||"A React component")+" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.")}5!==Bl&&(Bl=2),s=cl(s,l),f=i;do{switch(f.tag){case 3:o=s,f.flags|=4096,t&=-t,f.lanes|=t,po(f,fl(0,o,t));break e;case 1:o=s;var E=f.type,k=f.stateNode;if(0==(64&f.flags)&&("function"==typeof E.getDerivedStateFromError||null!==k&&"function"==typeof k.componentDidCatch&&(null===Ql||!Ql.has(k)))){f.flags|=4096,t&=-t,f.lanes|=t,po(f,pl(f,o,t));break e}}f=f.return}while(null!==f)}Ls(n)}catch(S){t=S,Rl===n&&null!==n&&(Rl=n=n.return);continue}break}}function Ts(){var e=Ol.current;return Ol.current=Ii,null===e?Ii:e}function Cs(e,t){var n=Il;Il|=16;var r=Ts();for(Pl===e&&Ml===t||_s(e,t);;)try{As();break}catch(a){xs(e,a)}if(no(),Il=n,Ol.current=r,null!==Rl)throw Error(i(261));return Pl=null,Ml=0,Bl}function As(){for(;null!==Rl;)Os(Rl)}function Ns(){for(;null!==Rl&&!Aa();)Os(Rl)}function Os(e){var t=ql(e.alternate,e,Dl);e.memoizedProps=e.pendingProps,null===t?Ls(e):Rl=t,Ll.current=null}function Ls(e){var t=e;do{var n=t.alternate;if(e=t.return,0==(2048&t.flags)){if(null!==(n=ll(n,t,Dl)))return void(Rl=n);if(24!==(n=t).tag&&23!==n.tag||null===n.memoizedState||0!=(1073741824&Dl)||0==(4&n.mode)){for(var r=0,a=n.child;null!==a;)r|=a.lanes|a.childLanes,a=a.sibling;n.childLanes=r}null!==e&&0==(2048&e.flags)&&(null===e.firstEffect&&(e.firstEffect=t.firstEffect),null!==t.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=t.firstEffect),e.lastEffect=t.lastEffect),1<t.flags&&(null!==e.lastEffect?e.lastEffect.nextEffect=t:e.firstEffect=t,e.lastEffect=t))}else{if(null!==(n=sl(t)))return n.flags&=2047,void(Rl=n);null!==e&&(e.firstEffect=e.lastEffect=null,e.flags|=2048)}if(null!==(t=t.sibling))return void(Rl=t);Rl=t=e}while(null!==t);0===Bl&&(Bl=5)}function Is(e){var t=Za();return Va(99,Ps.bind(null,e,t)),null}function Ps(e,t){do{Ms()}while(null!==es);if(0!=(48&Il))throw Error(i(327));var n=e.finishedWork;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(i(177));e.callbackNode=null;var r=n.lanes|n.childLanes,a=r,o=e.pendingLanes&~a;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=a,e.mutableReadLanes&=a,e.entangledLanes&=a,a=e.entanglements;for(var l=e.eventTimes,s=e.expirationTimes;0<o;){var c=31-Zt(o),u=1<<c;a[c]=0,l[c]=-1,s[c]=-1,o&=~u}if(null!==as&&0==(24&r)&&as.has(e)&&as.delete(e),e===Pl&&(Rl=Pl=null,Ml=0),1<n.flags?null!==n.lastEffect?(n.lastEffect.nextEffect=n,r=n.firstEffect):r=n:r=n.firstEffect,null!==r){if(a=Il,Il|=32,Ll.current=null,zr=Yt,br(l=gr())){if("selectionStart"in l)s={start:l.selectionStart,end:l.selectionEnd};else e:if(s=(s=l.ownerDocument)&&s.defaultView||window,(u=s.getSelection&&s.getSelection())&&0!==u.rangeCount){s=u.anchorNode,o=u.anchorOffset,c=u.focusNode,u=u.focusOffset;try{s.nodeType,c.nodeType}catch(T){s=null;break e}var d=0,f=-1,p=-1,m=0,h=0,g=l,b=null;t:for(;;){for(var v;g!==s||0!==o&&3!==g.nodeType||(f=d+o),g!==c||0!==u&&3!==g.nodeType||(p=d+u),3===g.nodeType&&(d+=g.nodeValue.length),null!==(v=g.firstChild);)b=g,g=v;for(;;){if(g===l)break t;if(b===s&&++m===o&&(f=d),b===c&&++h===u&&(p=d),null!==(v=g.nextSibling))break;b=(g=b).parentNode}g=v}s=-1===f||-1===p?null:{start:f,end:p}}else s=null;s=s||{start:0,end:0}}else s=null;jr={focusedElem:l,selectionRange:s},Yt=!1,us=null,ds=!1,Yl=r;do{try{Rs()}catch(T){if(null===Yl)throw Error(i(330));Us(Yl,T),Yl=Yl.nextEffect}}while(null!==Yl);us=null,Yl=r;do{try{for(l=e;null!==Yl;){var y=Yl.flags;if(16&y&&ve(Yl.stateNode,""),128&y){var w=Yl.alternate;if(null!==w){var E=w.ref;null!==E&&("function"==typeof E?E(null):E.current=null)}}switch(1038&y){case 2:kl(Yl),Yl.flags&=-3;break;case 6:kl(Yl),Yl.flags&=-3,Tl(Yl.alternate,Yl);break;case 1024:Yl.flags&=-1025;break;case 1028:Yl.flags&=-1025,Tl(Yl.alternate,Yl);break;case 4:Tl(Yl.alternate,Yl);break;case 8:xl(l,s=Yl);var k=s.alternate;wl(s),null!==k&&wl(k)}Yl=Yl.nextEffect}}catch(T){if(null===Yl)throw Error(i(330));Us(Yl,T),Yl=Yl.nextEffect}}while(null!==Yl);if(E=jr,w=gr(),y=E.focusedElem,l=E.selectionRange,w!==y&&y&&y.ownerDocument&&hr(y.ownerDocument.documentElement,y)){null!==l&&br(y)&&(w=l.start,void 0===(E=l.end)&&(E=w),"selectionStart"in y?(y.selectionStart=w,y.selectionEnd=Math.min(E,y.value.length)):(E=(w=y.ownerDocument||document)&&w.defaultView||window).getSelection&&(E=E.getSelection(),s=y.textContent.length,k=Math.min(l.start,s),l=void 0===l.end?k:Math.min(l.end,s),!E.extend&&k>l&&(s=l,l=k,k=s),s=mr(y,k),o=mr(y,l),s&&o&&(1!==E.rangeCount||E.anchorNode!==s.node||E.anchorOffset!==s.offset||E.focusNode!==o.node||E.focusOffset!==o.offset)&&((w=w.createRange()).setStart(s.node,s.offset),E.removeAllRanges(),k>l?(E.addRange(w),E.extend(o.node,o.offset)):(w.setEnd(o.node,o.offset),E.addRange(w))))),w=[];for(E=y;E=E.parentNode;)1===E.nodeType&&w.push({element:E,left:E.scrollLeft,top:E.scrollTop});for("function"==typeof y.focus&&y.focus(),y=0;y<w.length;y++)(E=w[y]).element.scrollLeft=E.left,E.element.scrollTop=E.top}Yt=!!zr,jr=zr=null,e.current=n,Yl=r;do{try{for(y=e;null!==Yl;){var S=Yl.flags;if(36&S&&bl(y,Yl.alternate,Yl),128&S){w=void 0;var _=Yl.ref;if(null!==_){var x=Yl.stateNode;Yl.tag,w=x,"function"==typeof _?_(w):_.current=w}}Yl=Yl.nextEffect}}catch(T){if(null===Yl)throw Error(i(330));Us(Yl,T),Yl=Yl.nextEffect}}while(null!==Yl);Yl=null,Ba(),Il=a}else e.current=n;if(Jl)Jl=!1,es=e,ts=t;else for(Yl=r;null!==Yl;)t=Yl.nextEffect,Yl.nextEffect=null,8&Yl.flags&&((S=Yl).sibling=null,S.stateNode=null),Yl=t;if(0===(r=e.pendingLanes)&&(Ql=null),1===r?e===is?os++:(os=0,is=e):os=0,n=n.stateNode,_a&&"function"==typeof _a.onCommitFiberRoot)try{_a.onCommitFiberRoot(Sa,n,void 0,64==(64&n.current.flags))}catch(T){}if(gs(e,Ha()),Kl)throw Kl=!1,e=Xl,Xl=null,e;return 0!=(8&Il)||qa(),null}function Rs(){for(;null!==Yl;){var e=Yl.alternate;ds||null===us||(0!=(8&Yl.flags)?et(Yl,us)&&(ds=!0):13===Yl.tag&&Al(e,Yl)&&et(Yl,us)&&(ds=!0));var t=Yl.flags;0!=(256&t)&&gl(e,Yl),0==(512&t)||Jl||(Jl=!0,Wa(97,(function(){return Ms(),null}))),Yl=Yl.nextEffect}}function Ms(){if(90!==ts){var e=97<ts?97:ts;return ts=90,Va(e,Bs)}return!1}function Ds(e,t){ns.push(t,e),Jl||(Jl=!0,Wa(97,(function(){return Ms(),null})))}function Fs(e,t){rs.push(t,e),Jl||(Jl=!0,Wa(97,(function(){return Ms(),null})))}function Bs(){if(null===es)return!1;var e=es;if(es=null,0!=(48&Il))throw Error(i(331));var t=Il;Il|=32;var n=rs;rs=[];for(var r=0;r<n.length;r+=2){var a=n[r],o=n[r+1],l=a.destroy;if(a.destroy=void 0,"function"==typeof l)try{l()}catch(c){if(null===o)throw Error(i(330));Us(o,c)}}for(n=ns,ns=[],r=0;r<n.length;r+=2){a=n[r],o=n[r+1];try{var s=a.create;a.destroy=s()}catch(c){if(null===o)throw Error(i(330));Us(o,c)}}for(s=e.current.firstEffect;null!==s;)e=s.nextEffect,s.nextEffect=null,8&s.flags&&(s.sibling=null,s.stateNode=null),s=e;return Il=t,qa(),!0}function $s(e,t,n){fo(e,t=fl(0,t=cl(n,t),1)),t=fs(),null!==(e=hs(e,1))&&(Ht(e,1,t),gs(e,t))}function Us(e,t){if(3===e.tag)$s(e,e,t);else for(var n=e.return;null!==n;){if(3===n.tag){$s(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Ql||!Ql.has(r))){var a=pl(n,e=cl(t,e),1);if(fo(n,a),a=fs(),null!==(n=hs(n,1)))Ht(n,1,a),gs(n,a);else if("function"==typeof r.componentDidCatch&&(null===Ql||!Ql.has(r)))try{r.componentDidCatch(t,e)}catch(o){}break}}n=n.return}}function zs(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=fs(),e.pingedLanes|=e.suspendedLanes&n,Pl===e&&(Ml&n)===n&&(4===Bl||3===Bl&&(62914560&Ml)===Ml&&500>Ha()-Gl?_s(e,0):Hl|=n),gs(e,t)}function js(e,t){var n=e.stateNode;null!==n&&n.delete(t),0===(t=0)&&(0==(2&(t=e.mode))?t=1:0==(4&t)?t=99===Za()?1:2:(0===ss&&(ss=Ul),0===(t=zt(62914560&~ss))&&(t=4194304))),n=fs(),null!==(e=hs(e,t))&&(Ht(e,t,n),gs(e,n))}function Hs(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.flags=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childLanes=this.lanes=0,this.alternate=null}function Zs(e,t,n,r){return new Hs(e,t,n,r)}function Gs(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Vs(e,t){var n=e.alternate;return null===n?((n=Zs(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.nextEffect=null,n.firstEffect=null,n.lastEffect=null),n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ws(e,t,n,r,a,o){var l=2;if(r=e,"function"==typeof e)Gs(e)&&(l=1);else if("string"==typeof e)l=5;else e:switch(e){case _:return qs(n.children,a,o,t);case D:l=8,a|=16;break;case x:l=8,a|=1;break;case T:return(e=Zs(12,n,t,8|a)).elementType=T,e.type=T,e.lanes=o,e;case O:return(e=Zs(13,n,t,a)).type=O,e.elementType=O,e.lanes=o,e;case L:return(e=Zs(19,n,t,a)).elementType=L,e.lanes=o,e;case F:return Ys(n,a,o,t);case B:return(e=Zs(24,n,t,a)).elementType=B,e.lanes=o,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case C:l=10;break e;case A:l=9;break e;case N:l=11;break e;case I:l=14;break e;case P:l=16,r=null;break e;case R:l=22;break e}throw Error(i(130,null==e?e:typeof e,""))}return(t=Zs(l,n,t,a)).elementType=e,t.type=r,t.lanes=o,t}function qs(e,t,n,r){return(e=Zs(7,e,r,t)).lanes=n,e}function Ys(e,t,n,r){return(e=Zs(23,e,r,t)).elementType=F,e.lanes=n,e}function Ks(e,t,n){return(e=Zs(6,e,null,t)).lanes=n,e}function Xs(e,t,n){return(t=Zs(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Qs(e,t,n){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=n,this.callbackNode=null,this.callbackPriority=0,this.eventTimes=jt(0),this.expirationTimes=jt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jt(0),this.mutableSourceEagerHydrationData=null}function Js(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:S,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}function ec(e,t,n,r){var a=t.current,o=fs(),l=ps(a);e:if(n){t:{if(Ke(n=n._reactInternals)!==n||1!==n.tag)throw Error(i(170));var s=n;do{switch(s.tag){case 3:s=s.stateNode.context;break t;case 1:if(ba(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break t}}s=s.return}while(null!==s);throw Error(i(171))}if(1===n.tag){var c=n.type;if(ba(c)){n=wa(n,c,s);break e}}n=s}else n=fa;return null===t.context?t.context=n:t.pendingContext=n,(t=uo(o,l)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),fo(a,t),ms(a,l,o),l}function tc(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function nc(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function rc(e,t){nc(e,t),(e=e.alternate)&&nc(e,t)}function ac(e,t,n){var r=null!=n&&null!=n.hydrationOptions&&n.hydrationOptions.mutableSources||null;if(n=new Qs(e,t,null!=n&&!0===n.hydrate),t=Zs(3,null,null,2===t?7:1===t?3:0),n.current=t,t.stateNode=n,so(t),e[ea]=n.current,Ir(8===e.nodeType?e.parentNode:e),r)for(e=0;e<r.length;e++){var a=(t=r[e])._getVersion;a=a(t._source),null==n.mutableSourceEagerHydrationData?n.mutableSourceEagerHydrationData=[t,a]:n.mutableSourceEagerHydrationData.push(t,a)}this._internalRoot=n}function oc(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function ic(e,t,n,r,a){var o=n._reactRootContainer;if(o){var i=o._internalRoot;if("function"==typeof a){var l=a;a=function(){var e=tc(i);l.call(e)}}ec(t,i,e,a)}else{if(o=n._reactRootContainer=function(e,t){if(t||(t=!(!(t=e?9===e.nodeType?e.documentElement:e.firstChild:null)||1!==t.nodeType||!t.hasAttribute("data-reactroot"))),!t)for(var n;n=e.lastChild;)e.removeChild(n);return new ac(e,0,t?{hydrate:!0}:void 0)}(n,r),i=o._internalRoot,"function"==typeof a){var s=a;a=function(){var e=tc(i);s.call(e)}}Es((function(){ec(t,i,e,a)}))}return tc(i)}function lc(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!oc(t))throw Error(i(200));return Js(e,t,null,n)}ql=function(e,t,n){var r=t.lanes;if(null!==e)if(e.memoizedProps!==t.pendingProps||ma.current)Fi=!0;else{if(0==(n&r)){switch(Fi=!1,t.tag){case 3:Wi(t),qo();break;case 5:Do(t);break;case 1:ba(t.type)&&Ea(t);break;case 4:Ro(t,t.stateNode.containerInfo);break;case 10:r=t.memoizedProps.value;var a=t.type._context;da(Qa,a._currentValue),a._currentValue=r;break;case 13:if(null!==t.memoizedState)return 0!=(n&t.child.childLanes)?Qi(e,t,n):(da(Bo,1&Bo.current),null!==(t=ol(e,t,n))?t.sibling:null);da(Bo,1&Bo.current);break;case 19:if(r=0!=(n&t.childLanes),0!=(64&e.flags)){if(r)return al(e,t,n);t.flags|=64}if(null!==(a=t.memoizedState)&&(a.rendering=null,a.tail=null,a.lastEffect=null),da(Bo,Bo.current),r)break;return null;case 23:case 24:return t.lanes=0,ji(e,t,n)}return ol(e,t,n)}Fi=0!=(16384&e.flags)}else Fi=!1;switch(t.lanes=0,t.tag){case 2:if(r=t.type,null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,a=ga(t,pa.current),oo(t,n),a=li(null,t,r,e,a,n),t.flags|=1,"object"==typeof a&&null!==a&&"function"==typeof a.render&&void 0===a.$$typeof){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,ba(r)){var o=!0;Ea(t)}else o=!1;t.memoizedState=null!==a.state&&void 0!==a.state?a.state:null,so(t);var l=r.getDerivedStateFromProps;"function"==typeof l&&bo(t,r,l,e),a.updater=vo,t.stateNode=a,a._reactInternals=t,ko(t,r,e,n),t=Vi(null,t,r,!0,o,n)}else t.tag=0,Bi(null,t,a,n),t=t.child;return t;case 16:a=t.elementType;e:{switch(null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,a=(o=a._init)(a._payload),t.type=a,o=t.tag=function(e){if("function"==typeof e)return Gs(e)?1:0;if(null!=e){if((e=e.$$typeof)===N)return 11;if(e===I)return 14}return 2}(a),e=Xa(a,e),o){case 0:t=Zi(null,t,a,e,n);break e;case 1:t=Gi(null,t,a,e,n);break e;case 11:t=$i(null,t,a,e,n);break e;case 14:t=Ui(null,t,a,Xa(a.type,e),r,n);break e}throw Error(i(306,a,""))}return t;case 0:return r=t.type,a=t.pendingProps,Zi(e,t,r,a=t.elementType===r?a:Xa(r,a),n);case 1:return r=t.type,a=t.pendingProps,Gi(e,t,r,a=t.elementType===r?a:Xa(r,a),n);case 3:if(Wi(t),r=t.updateQueue,null===e||null===r)throw Error(i(282));if(r=t.pendingProps,a=null!==(a=t.memoizedState)?a.element:null,co(e,t),mo(t,r,null,n),(r=t.memoizedState.element)===a)qo(),t=ol(e,t,n);else{if((o=(a=t.stateNode).hydrate)&&(zo=qr(t.stateNode.containerInfo.firstChild),Uo=t,o=jo=!0),o){if(null!=(e=a.mutableSourceEagerHydrationData))for(a=0;a<e.length;a+=2)(o=e[a])._workInProgressVersionPrimary=e[a+1],Yo.push(o);for(n=Ao(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|1024,n=n.sibling}else Bi(e,t,r,n),qo();t=t.child}return t;case 5:return Do(t),null===e&&Go(t),r=t.type,a=t.pendingProps,o=null!==e?e.memoizedProps:null,l=a.children,Zr(r,a)?l=null:null!==o&&Zr(r,o)&&(t.flags|=16),Hi(e,t),Bi(e,t,l,n),t.child;case 6:return null===e&&Go(t),null;case 13:return Qi(e,t,n);case 4:return Ro(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=Co(t,null,r,n):Bi(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,$i(e,t,r,a=t.elementType===r?a:Xa(r,a),n);case 7:return Bi(e,t,t.pendingProps,n),t.child;case 8:case 12:return Bi(e,t,t.pendingProps.children,n),t.child;case 10:e:{r=t.type._context,a=t.pendingProps,l=t.memoizedProps,o=a.value;var s=t.type._context;if(da(Qa,s._currentValue),s._currentValue=o,null!==l)if(s=l.value,0===(o=ur(s,o)?0:0|("function"==typeof r._calculateChangedBits?r._calculateChangedBits(s,o):1073741823))){if(l.children===a.children&&!ma.current){t=ol(e,t,n);break e}}else for(null!==(s=t.child)&&(s.return=t);null!==s;){var c=s.dependencies;if(null!==c){l=s.child;for(var u=c.firstContext;null!==u;){if(u.context===r&&0!=(u.observedBits&o)){1===s.tag&&((u=uo(-1,n&-n)).tag=2,fo(s,u)),s.lanes|=n,null!==(u=s.alternate)&&(u.lanes|=n),ao(s.return,n),c.lanes|=n;break}u=u.next}}else l=10===s.tag&&s.type===t.type?null:s.child;if(null!==l)l.return=s;else for(l=s;null!==l;){if(l===t){l=null;break}if(null!==(s=l.sibling)){s.return=l.return,l=s;break}l=l.return}s=l}Bi(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=(o=t.pendingProps).children,oo(t,n),r=r(a=io(a,o.unstable_observedBits)),t.flags|=1,Bi(e,t,r,n),t.child;case 14:return o=Xa(a=t.type,t.pendingProps),Ui(e,t,a,o=Xa(a.type,o),r,n);case 15:return zi(e,t,t.type,t.pendingProps,r,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Xa(r,a),null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),t.tag=1,ba(r)?(e=!0,Ea(t)):e=!1,oo(t,n),wo(t,r,a),ko(t,r,a,n),Vi(null,t,r,!0,e,n);case 19:return al(e,t,n);case 23:case 24:return ji(e,t,n)}throw Error(i(156,t.tag))},ac.prototype.render=function(e){ec(e,this._internalRoot,null,null)},ac.prototype.unmount=function(){var e=this._internalRoot,t=e.containerInfo;ec(null,e,null,(function(){t[ea]=null}))},tt=function(e){13===e.tag&&(ms(e,4,fs()),rc(e,4))},nt=function(e){13===e.tag&&(ms(e,67108864,fs()),rc(e,67108864))},rt=function(e){if(13===e.tag){var t=fs(),n=ps(e);ms(e,n,t),rc(e,n)}},at=function(e,t){return t()},Ce=function(e,t,n){switch(t){case"input":if(ne(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=oa(r);if(!a)throw Error(i(90));X(r),ne(r,a)}}}break;case"textarea":ce(e,n);break;case"select":null!=(t=n.value)&&ie(e,!!n.multiple,t,!1)}},Pe=ws,Re=function(e,t,n,r,a){var o=Il;Il|=4;try{return Va(98,e.bind(null,t,n,r,a))}finally{0===(Il=o)&&(Wl(),qa())}},Me=function(){0==(49&Il)&&(function(){if(null!==as){var e=as;as=null,e.forEach((function(e){e.expiredLanes|=24&e.pendingLanes,gs(e,Ha())}))}qa()}(),Ms())},De=function(e,t){var n=Il;Il|=2;try{return e(t)}finally{0===(Il=n)&&(Wl(),qa())}};var sc={Events:[ra,aa,oa,Le,Ie,Ms,{current:!1}]},cc={findFiberByHostInstance:na,bundleType:0,version:"17.0.2",rendererPackageName:"react-dom"},uc={bundleType:cc.bundleType,version:cc.version,rendererPackageName:cc.rendererPackageName,rendererConfig:cc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:E.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=Je(e))?null:e.stateNode},findFiberByHostInstance:cc.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var dc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!dc.isDisabled&&dc.supportsFiber)try{Sa=dc.inject(uc),_a=dc}catch(ge){}}t.createPortal=lc,t.hydrate=function(e,t,n){if(!oc(t))throw Error(i(200));return ic(null,e,t,!0,n)}},3935:(e,t,n)=>{"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=n(4448)},9590:e=>{var t="undefined"!=typeof Element,n="function"==typeof Map,r="function"==typeof Set,a="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function o(e,i){if(e===i)return!0;if(e&&i&&"object"==typeof e&&"object"==typeof i){if(e.constructor!==i.constructor)return!1;var l,s,c,u;if(Array.isArray(e)){if((l=e.length)!=i.length)return!1;for(s=l;0!=s--;)if(!o(e[s],i[s]))return!1;return!0}if(n&&e instanceof Map&&i instanceof Map){if(e.size!==i.size)return!1;for(u=e.entries();!(s=u.next()).done;)if(!i.has(s.value[0]))return!1;for(u=e.entries();!(s=u.next()).done;)if(!o(s.value[1],i.get(s.value[0])))return!1;return!0}if(r&&e instanceof Set&&i instanceof Set){if(e.size!==i.size)return!1;for(u=e.entries();!(s=u.next()).done;)if(!i.has(s.value[0]))return!1;return!0}if(a&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(i)){if((l=e.length)!=i.length)return!1;for(s=l;0!=s--;)if(e[s]!==i[s])return!1;return!0}if(e.constructor===RegExp)return e.source===i.source&&e.flags===i.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===i.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===i.toString();if((l=(c=Object.keys(e)).length)!==Object.keys(i).length)return!1;for(s=l;0!=s--;)if(!Object.prototype.hasOwnProperty.call(i,c[s]))return!1;if(t&&e instanceof Element)return!1;for(s=l;0!=s--;)if(("_owner"!==c[s]&&"__v"!==c[s]&&"__o"!==c[s]||!e.$$typeof)&&!o(e[c[s]],i[c[s]]))return!1;return!0}return e!=e&&i!=i}e.exports=function(e,t){try{return o(e,t)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}}},405:(e,t,n)=>{"use strict";n.d(t,{B6:()=>G,ql:()=>J});var r=n(7294),a=n(5697),o=n.n(a),i=n(9590),l=n.n(i),s=n(1143),c=n.n(s),u=n(6774),d=n.n(u);function f(){return f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f.apply(this,arguments)}function p(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,m(e,t)}function m(e,t){return m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},m(e,t)}function h(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(a[n]=e[n]);return a}var g={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},b={rel:["amphtml","canonical","alternate"]},v={type:["application/ld+json"]},y={charset:"",name:["robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},w=Object.keys(g).map((function(e){return g[e]})),E={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},k=Object.keys(E).reduce((function(e,t){return e[E[t]]=t,e}),{}),S=function(e,t){for(var n=e.length-1;n>=0;n-=1){var r=e[n];if(Object.prototype.hasOwnProperty.call(r,t))return r[t]}return null},_=function(e){var t=S(e,g.TITLE),n=S(e,"titleTemplate");if(Array.isArray(t)&&(t=t.join("")),n&&t)return n.replace(/%s/g,(function(){return t}));var r=S(e,"defaultTitle");return t||r||void 0},x=function(e){return S(e,"onChangeClientState")||function(){}},T=function(e,t){return t.filter((function(t){return void 0!==t[e]})).map((function(t){return t[e]})).reduce((function(e,t){return f({},e,t)}),{})},C=function(e,t){return t.filter((function(e){return void 0!==e[g.BASE]})).map((function(e){return e[g.BASE]})).reverse().reduce((function(t,n){if(!t.length)for(var r=Object.keys(n),a=0;a<r.length;a+=1){var o=r[a].toLowerCase();if(-1!==e.indexOf(o)&&n[o])return t.concat(n)}return t}),[])},A=function(e,t,n){var r={};return n.filter((function(t){return!!Array.isArray(t[e])||(void 0!==t[e]&&console&&"function"==typeof console.warn&&console.warn("Helmet: "+e+' should be of type "Array". Instead found type "'+typeof t[e]+'"'),!1)})).map((function(t){return t[e]})).reverse().reduce((function(e,n){var a={};n.filter((function(e){for(var n,o=Object.keys(e),i=0;i<o.length;i+=1){var l=o[i],s=l.toLowerCase();-1===t.indexOf(s)||"rel"===n&&"canonical"===e[n].toLowerCase()||"rel"===s&&"stylesheet"===e[s].toLowerCase()||(n=s),-1===t.indexOf(l)||"innerHTML"!==l&&"cssText"!==l&&"itemprop"!==l||(n=l)}if(!n||!e[n])return!1;var c=e[n].toLowerCase();return r[n]||(r[n]={}),a[n]||(a[n]={}),!r[n][c]&&(a[n][c]=!0,!0)})).reverse().forEach((function(t){return e.push(t)}));for(var o=Object.keys(a),i=0;i<o.length;i+=1){var l=o[i],s=f({},r[l],a[l]);r[l]=s}return e}),[]).reverse()},N=function(e,t){if(Array.isArray(e)&&e.length)for(var n=0;n<e.length;n+=1)if(e[n][t])return!0;return!1},O=function(e){return Array.isArray(e)?e.join(""):e},L=function(e,t){return Array.isArray(e)?e.reduce((function(e,n){return function(e,t){for(var n=Object.keys(e),r=0;r<n.length;r+=1)if(t[n[r]]&&t[n[r]].includes(e[n[r]]))return!0;return!1}(n,t)?e.priority.push(n):e.default.push(n),e}),{priority:[],default:[]}):{default:e}},I=function(e,t){var n;return f({},e,((n={})[t]=void 0,n))},P=[g.NOSCRIPT,g.SCRIPT,g.STYLE],R=function(e,t){return void 0===t&&(t=!0),!1===t?String(e):String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},M=function(e){return Object.keys(e).reduce((function(t,n){var r=void 0!==e[n]?n+'="'+e[n]+'"':""+n;return t?t+" "+r:r}),"")},D=function(e,t){return void 0===t&&(t={}),Object.keys(e).reduce((function(t,n){return t[E[n]||n]=e[n],t}),t)},F=function(e,t){return t.map((function(t,n){var a,o=((a={key:n})["data-rh"]=!0,a);return Object.keys(t).forEach((function(e){var n=E[e]||e;"innerHTML"===n||"cssText"===n?o.dangerouslySetInnerHTML={__html:t.innerHTML||t.cssText}:o[n]=t[e]})),r.createElement(e,o)}))},B=function(e,t,n){switch(e){case g.TITLE:return{toComponent:function(){return n=t.titleAttributes,(a={key:e=t.title})["data-rh"]=!0,o=D(n,a),[r.createElement(g.TITLE,o,e)];var e,n,a,o},toString:function(){return function(e,t,n,r){var a=M(n),o=O(t);return a?"<"+e+' data-rh="true" '+a+">"+R(o,r)+"</"+e+">":"<"+e+' data-rh="true">'+R(o,r)+"</"+e+">"}(e,t.title,t.titleAttributes,n)}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function(){return D(t)},toString:function(){return M(t)}};default:return{toComponent:function(){return F(e,t)},toString:function(){return function(e,t,n){return t.reduce((function(t,r){var a=Object.keys(r).filter((function(e){return!("innerHTML"===e||"cssText"===e)})).reduce((function(e,t){var a=void 0===r[t]?t:t+'="'+R(r[t],n)+'"';return e?e+" "+a:a}),""),o=r.innerHTML||r.cssText||"",i=-1===P.indexOf(e);return t+"<"+e+' data-rh="true" '+a+(i?"/>":">"+o+"</"+e+">")}),"")}(e,t,n)}}}},$=function(e){var t=e.baseTag,n=e.bodyAttributes,r=e.encode,a=e.htmlAttributes,o=e.noscriptTags,i=e.styleTags,l=e.title,s=void 0===l?"":l,c=e.titleAttributes,u=e.linkTags,d=e.metaTags,f=e.scriptTags,p={toComponent:function(){},toString:function(){return""}};if(e.prioritizeSeoTags){var m=function(e){var t=e.linkTags,n=e.scriptTags,r=e.encode,a=L(e.metaTags,y),o=L(t,b),i=L(n,v);return{priorityMethods:{toComponent:function(){return[].concat(F(g.META,a.priority),F(g.LINK,o.priority),F(g.SCRIPT,i.priority))},toString:function(){return B(g.META,a.priority,r)+" "+B(g.LINK,o.priority,r)+" "+B(g.SCRIPT,i.priority,r)}},metaTags:a.default,linkTags:o.default,scriptTags:i.default}}(e);p=m.priorityMethods,u=m.linkTags,d=m.metaTags,f=m.scriptTags}return{priority:p,base:B(g.BASE,t,r),bodyAttributes:B("bodyAttributes",n,r),htmlAttributes:B("htmlAttributes",a,r),link:B(g.LINK,u,r),meta:B(g.META,d,r),noscript:B(g.NOSCRIPT,o,r),script:B(g.SCRIPT,f,r),style:B(g.STYLE,i,r),title:B(g.TITLE,{title:s,titleAttributes:c},r)}},U=[],z=function(e,t){var n=this;void 0===t&&(t="undefined"!=typeof document),this.instances=[],this.value={setHelmet:function(e){n.context.helmet=e},helmetInstances:{get:function(){return n.canUseDOM?U:n.instances},add:function(e){(n.canUseDOM?U:n.instances).push(e)},remove:function(e){var t=(n.canUseDOM?U:n.instances).indexOf(e);(n.canUseDOM?U:n.instances).splice(t,1)}}},this.context=e,this.canUseDOM=t,t||(e.helmet=$({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))},j=r.createContext({}),H=o().shape({setHelmet:o().func,helmetInstances:o().shape({get:o().func,add:o().func,remove:o().func})}),Z="undefined"!=typeof document,G=function(e){function t(n){var r;return(r=e.call(this,n)||this).helmetData=new z(r.props.context,t.canUseDOM),r}return p(t,e),t.prototype.render=function(){return r.createElement(j.Provider,{value:this.helmetData.value},this.props.children)},t}(r.Component);G.canUseDOM=Z,G.propTypes={context:o().shape({helmet:o().shape()}),children:o().node.isRequired},G.defaultProps={context:{}},G.displayName="HelmetProvider";var V=function(e,t){var n,r=document.head||document.querySelector(g.HEAD),a=r.querySelectorAll(e+"[data-rh]"),o=[].slice.call(a),i=[];return t&&t.length&&t.forEach((function(t){var r=document.createElement(e);for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&("innerHTML"===a?r.innerHTML=t.innerHTML:"cssText"===a?r.styleSheet?r.styleSheet.cssText=t.cssText:r.appendChild(document.createTextNode(t.cssText)):r.setAttribute(a,void 0===t[a]?"":t[a]));r.setAttribute("data-rh","true"),o.some((function(e,t){return n=t,r.isEqualNode(e)}))?o.splice(n,1):i.push(r)})),o.forEach((function(e){return e.parentNode.removeChild(e)})),i.forEach((function(e){return r.appendChild(e)})),{oldTags:o,newTags:i}},W=function(e,t){var n=document.getElementsByTagName(e)[0];if(n){for(var r=n.getAttribute("data-rh"),a=r?r.split(","):[],o=[].concat(a),i=Object.keys(t),l=0;l<i.length;l+=1){var s=i[l],c=t[s]||"";n.getAttribute(s)!==c&&n.setAttribute(s,c),-1===a.indexOf(s)&&a.push(s);var u=o.indexOf(s);-1!==u&&o.splice(u,1)}for(var d=o.length-1;d>=0;d-=1)n.removeAttribute(o[d]);a.length===o.length?n.removeAttribute("data-rh"):n.getAttribute("data-rh")!==i.join(",")&&n.setAttribute("data-rh",i.join(","))}},q=function(e,t){var n=e.baseTag,r=e.htmlAttributes,a=e.linkTags,o=e.metaTags,i=e.noscriptTags,l=e.onChangeClientState,s=e.scriptTags,c=e.styleTags,u=e.title,d=e.titleAttributes;W(g.BODY,e.bodyAttributes),W(g.HTML,r),function(e,t){void 0!==e&&document.title!==e&&(document.title=O(e)),W(g.TITLE,t)}(u,d);var f={baseTag:V(g.BASE,n),linkTags:V(g.LINK,a),metaTags:V(g.META,o),noscriptTags:V(g.NOSCRIPT,i),scriptTags:V(g.SCRIPT,s),styleTags:V(g.STYLE,c)},p={},m={};Object.keys(f).forEach((function(e){var t=f[e],n=t.newTags,r=t.oldTags;n.length&&(p[e]=n),r.length&&(m[e]=f[e].oldTags)})),t&&t(),l(e,p,m)},Y=null,K=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return(t=e.call.apply(e,[this].concat(r))||this).rendered=!1,t}p(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return!d()(e,this.props)},n.componentDidUpdate=function(){this.emitChange()},n.componentWillUnmount=function(){this.props.context.helmetInstances.remove(this),this.emitChange()},n.emitChange=function(){var e,t,n=this.props.context,r=n.setHelmet,a=null,o=(e=n.helmetInstances.get().map((function(e){var t=f({},e.props);return delete t.context,t})),{baseTag:C(["href"],e),bodyAttributes:T("bodyAttributes",e),defer:S(e,"defer"),encode:S(e,"encodeSpecialCharacters"),htmlAttributes:T("htmlAttributes",e),linkTags:A(g.LINK,["rel","href"],e),metaTags:A(g.META,["name","charset","http-equiv","property","itemprop"],e),noscriptTags:A(g.NOSCRIPT,["innerHTML"],e),onChangeClientState:x(e),scriptTags:A(g.SCRIPT,["src","innerHTML"],e),styleTags:A(g.STYLE,["cssText"],e),title:_(e),titleAttributes:T("titleAttributes",e),prioritizeSeoTags:N(e,"prioritizeSeoTags")});G.canUseDOM?(t=o,Y&&cancelAnimationFrame(Y),t.defer?Y=requestAnimationFrame((function(){q(t,(function(){Y=null}))})):(q(t),Y=null)):$&&(a=$(o)),r(a)},n.init=function(){this.rendered||(this.rendered=!0,this.props.context.helmetInstances.add(this),this.emitChange())},n.render=function(){return this.init(),null},t}(r.Component);K.propTypes={context:H.isRequired},K.displayName="HelmetDispatcher";var X=["children"],Q=["children"],J=function(e){function t(){return e.apply(this,arguments)||this}p(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return!l()(I(this.props,"helmetData"),I(e,"helmetData"))},n.mapNestedChildrenToProps=function(e,t){if(!t)return null;switch(e.type){case g.SCRIPT:case g.NOSCRIPT:return{innerHTML:t};case g.STYLE:return{cssText:t};default:throw new Error("<"+e.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")}},n.flattenArrayTypeChildren=function(e){var t,n=e.child,r=e.arrayTypeChildren;return f({},r,((t={})[n.type]=[].concat(r[n.type]||[],[f({},e.newChildProps,this.mapNestedChildrenToProps(n,e.nestedChildren))]),t))},n.mapObjectTypeChildren=function(e){var t,n,r=e.child,a=e.newProps,o=e.newChildProps,i=e.nestedChildren;switch(r.type){case g.TITLE:return f({},a,((t={})[r.type]=i,t.titleAttributes=f({},o),t));case g.BODY:return f({},a,{bodyAttributes:f({},o)});case g.HTML:return f({},a,{htmlAttributes:f({},o)});default:return f({},a,((n={})[r.type]=f({},o),n))}},n.mapArrayTypeChildrenToProps=function(e,t){var n=f({},t);return Object.keys(e).forEach((function(t){var r;n=f({},n,((r={})[t]=e[t],r))})),n},n.warnOnInvalidChildren=function(e,t){return c()(w.some((function(t){return e.type===t})),"function"==typeof e.type?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+w.join(", ")+" are allowed. Helmet does not support rendering <"+e.type+"> elements. Refer to our API for more information."),c()(!t||"string"==typeof t||Array.isArray(t)&&!t.some((function(e){return"string"!=typeof e})),"Helmet expects a string as a child of <"+e.type+">. Did you forget to wrap your children in braces? ( <"+e.type+">{``}</"+e.type+"> ) Refer to our API for more information."),!0},n.mapChildrenToProps=function(e,t){var n=this,a={};return r.Children.forEach(e,(function(e){if(e&&e.props){var r=e.props,o=r.children,i=h(r,X),l=Object.keys(i).reduce((function(e,t){return e[k[t]||t]=i[t],e}),{}),s=e.type;switch("symbol"==typeof s?s=s.toString():n.warnOnInvalidChildren(e,o),s){case g.FRAGMENT:t=n.mapChildrenToProps(o,t);break;case g.LINK:case g.META:case g.NOSCRIPT:case g.SCRIPT:case g.STYLE:a=n.flattenArrayTypeChildren({child:e,arrayTypeChildren:a,newChildProps:l,nestedChildren:o});break;default:t=n.mapObjectTypeChildren({child:e,newProps:t,newChildProps:l,nestedChildren:o})}}})),this.mapArrayTypeChildrenToProps(a,t)},n.render=function(){var e=this.props,t=e.children,n=h(e,Q),a=f({},n),o=n.helmetData;return t&&(a=this.mapChildrenToProps(t,a)),!o||o instanceof z||(o=new z(o.context,o.instances)),o?r.createElement(K,f({},a,{context:o.value,helmetData:void 0})):r.createElement(j.Consumer,null,(function(e){return r.createElement(K,f({},a,{context:e}))}))},t}(r.Component);J.propTypes={base:o().object,bodyAttributes:o().object,children:o().oneOfType([o().arrayOf(o().node),o().node]),defaultTitle:o().string,defer:o().bool,encodeSpecialCharacters:o().bool,htmlAttributes:o().object,link:o().arrayOf(o().object),meta:o().arrayOf(o().object),noscript:o().arrayOf(o().object),onChangeClientState:o().func,script:o().arrayOf(o().object),style:o().arrayOf(o().object),title:o().string,titleAttributes:o().object,titleTemplate:o().string,prioritizeSeoTags:o().bool,helmetData:o().object},J.defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1},J.displayName="Helmet"},9921:(e,t)=>{"use strict";var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,a=n?Symbol.for("react.portal"):60106,o=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,s=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,d=n?Symbol.for("react.concurrent_mode"):60111,f=n?Symbol.for("react.forward_ref"):60112,p=n?Symbol.for("react.suspense"):60113,m=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,g=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,y=n?Symbol.for("react.responder"):60118,w=n?Symbol.for("react.scope"):60119;function E(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case d:case o:case l:case i:case p:return e;default:switch(e=e&&e.$$typeof){case c:case f:case g:case h:case s:return e;default:return t}}case a:return t}}}function k(e){return E(e)===d}t.AsyncMode=u,t.ConcurrentMode=d,t.ContextConsumer=c,t.ContextProvider=s,t.Element=r,t.ForwardRef=f,t.Fragment=o,t.Lazy=g,t.Memo=h,t.Portal=a,t.Profiler=l,t.StrictMode=i,t.Suspense=p,t.isAsyncMode=function(e){return k(e)||E(e)===u},t.isConcurrentMode=k,t.isContextConsumer=function(e){return E(e)===c},t.isContextProvider=function(e){return E(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return E(e)===f},t.isFragment=function(e){return E(e)===o},t.isLazy=function(e){return E(e)===g},t.isMemo=function(e){return E(e)===h},t.isPortal=function(e){return E(e)===a},t.isProfiler=function(e){return E(e)===l},t.isStrictMode=function(e){return E(e)===i},t.isSuspense=function(e){return E(e)===p},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===d||e===l||e===i||e===p||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===h||e.$$typeof===s||e.$$typeof===c||e.$$typeof===f||e.$$typeof===v||e.$$typeof===y||e.$$typeof===w||e.$$typeof===b)},t.typeOf=E},9864:(e,t,n)=>{"use strict";e.exports=n(9921)},8356:(e,t,n)=>{"use strict";function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}var l=n(7294),s=n(5697),c=[],u=[];function d(e){var t=e(),n={loading:!0,loaded:null,error:null};return n.promise=t.then((function(e){return n.loading=!1,n.loaded=e,e})).catch((function(e){throw n.loading=!1,n.error=e,e})),n}function f(e){var t={loading:!1,loaded:{},error:null},n=[];try{Object.keys(e).forEach((function(r){var a=d(e[r]);a.loading?t.loading=!0:(t.loaded[r]=a.loaded,t.error=a.error),n.push(a.promise),a.promise.then((function(e){t.loaded[r]=e})).catch((function(e){t.error=e}))}))}catch(r){t.error=r}return t.promise=Promise.all(n).then((function(e){return t.loading=!1,e})).catch((function(e){throw t.loading=!1,e})),t}function p(e,t){return l.createElement((n=e)&&n.__esModule?n.default:n,t);var n}function m(e,t){var d,f;if(!t.loading)throw new Error("react-loadable requires a `loading` component");var m=i({loader:null,loading:null,delay:200,timeout:null,render:p,webpack:null,modules:null},t),h=null;function g(){return h||(h=e(m.loader)),h.promise}return c.push(g),"function"==typeof m.webpack&&u.push((function(){if((0,m.webpack)().every((function(e){return void 0!==e&&void 0!==n.m[e]})))return g()})),f=d=function(t){function n(n){var r;return o(a(a(r=t.call(this,n)||this)),"retry",(function(){r.setState({error:null,loading:!0,timedOut:!1}),h=e(m.loader),r._loadModule()})),g(),r.state={error:h.error,pastDelay:!1,timedOut:!1,loading:h.loading,loaded:h.loaded},r}r(n,t),n.preload=function(){return g()};var i=n.prototype;return i.UNSAFE_componentWillMount=function(){this._loadModule()},i.componentDidMount=function(){this._mounted=!0},i._loadModule=function(){var e=this;if(this.context.loadable&&Array.isArray(m.modules)&&m.modules.forEach((function(t){e.context.loadable.report(t)})),h.loading){var t=function(t){e._mounted&&e.setState(t)};"number"==typeof m.delay&&(0===m.delay?this.setState({pastDelay:!0}):this._delay=setTimeout((function(){t({pastDelay:!0})}),m.delay)),"number"==typeof m.timeout&&(this._timeout=setTimeout((function(){t({timedOut:!0})}),m.timeout));var n=function(){t({error:h.error,loaded:h.loaded,loading:h.loading}),e._clearTimeouts()};h.promise.then((function(){return n(),null})).catch((function(e){return n(),null}))}},i.componentWillUnmount=function(){this._mounted=!1,this._clearTimeouts()},i._clearTimeouts=function(){clearTimeout(this._delay),clearTimeout(this._timeout)},i.render=function(){return this.state.loading||this.state.error?l.createElement(m.loading,{isLoading:this.state.loading,pastDelay:this.state.pastDelay,timedOut:this.state.timedOut,error:this.state.error,retry:this.retry}):this.state.loaded?m.render(this.state.loaded,this.props):null},n}(l.Component),o(d,"contextTypes",{loadable:s.shape({report:s.func.isRequired})}),f}function h(e){return m(d,e)}h.Map=function(e){if("function"!=typeof e.render)throw new Error("LoadableMap requires a `render(loaded, props)` function");return m(f,e)};var g=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.getChildContext=function(){return{loadable:{report:this.props.report}}},n.render=function(){return l.Children.only(this.props.children)},t}(l.Component);function b(e){for(var t=[];e.length;){var n=e.pop();t.push(n())}return Promise.all(t).then((function(){if(e.length)return b(e)}))}o(g,"propTypes",{report:s.func.isRequired}),o(g,"childContextTypes",{loadable:s.shape({report:s.func.isRequired}).isRequired}),h.Capture=g,h.preloadAll=function(){return new Promise((function(e,t){b(c).then(e,t)}))},h.preloadReady=function(){return new Promise((function(e,t){b(u).then(e,e)}))},e.exports=h},8790:(e,t,n)=>{"use strict";n.d(t,{H:()=>l,f:()=>i});var r=n(6775),a=n(7462),o=n(7294);function i(e,t,n){return void 0===n&&(n=[]),e.some((function(e){var a=e.path?(0,r.LX)(t,e):n.length?n[n.length-1].match:r.F0.computeRootMatch(t);return a&&(n.push({route:e,match:a}),e.routes&&i(e.routes,t,n)),a})),n}function l(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e?o.createElement(r.rs,n,e.map((function(e,n){return o.createElement(r.AW,{key:e.key||n,path:e.path,exact:e.exact,strict:e.strict,render:function(n){return e.render?e.render((0,a.Z)({},n,{},t,{route:e})):o.createElement(e.component,(0,a.Z)({},n,t,{route:e}))}})}))):null}},3727:(e,t,n)=>{"use strict";n.d(t,{OL:()=>y,VK:()=>u,rU:()=>g});var r=n(6775),a=n(5068),o=n(7294),i=n(2358),l=n(7462),s=n(3366),c=n(2177),u=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return(t=e.call.apply(e,[this].concat(r))||this).history=(0,i.lX)(t.props),t}return(0,a.Z)(t,e),t.prototype.render=function(){return o.createElement(r.F0,{history:this.history,children:this.props.children})},t}(o.Component);o.Component;var d=function(e,t){return"function"==typeof e?e(t):e},f=function(e,t){return"string"==typeof e?(0,i.ob)(e,null,null,t):e},p=function(e){return e},m=o.forwardRef;void 0===m&&(m=p);var h=m((function(e,t){var n=e.innerRef,r=e.navigate,a=e.onClick,i=(0,s.Z)(e,["innerRef","navigate","onClick"]),c=i.target,u=(0,l.Z)({},i,{onClick:function(e){try{a&&a(e)}catch(t){throw e.preventDefault(),t}e.defaultPrevented||0!==e.button||c&&"_self"!==c||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e)||(e.preventDefault(),r())}});return u.ref=p!==m&&t||n,o.createElement("a",u)}));var g=m((function(e,t){var n=e.component,a=void 0===n?h:n,u=e.replace,g=e.to,b=e.innerRef,v=(0,s.Z)(e,["component","replace","to","innerRef"]);return o.createElement(r.s6.Consumer,null,(function(e){e||(0,c.Z)(!1);var n=e.history,r=f(d(g,e.location),e.location),s=r?n.createHref(r):"",h=(0,l.Z)({},v,{href:s,navigate:function(){var t=d(g,e.location),r=(0,i.Ep)(e.location)===(0,i.Ep)(f(t));(u||r?n.replace:n.push)(t)}});return p!==m?h.ref=t||b:h.innerRef=b,o.createElement(a,h)}))})),b=function(e){return e},v=o.forwardRef;void 0===v&&(v=b);var y=v((function(e,t){var n=e["aria-current"],a=void 0===n?"page":n,i=e.activeClassName,u=void 0===i?"active":i,p=e.activeStyle,m=e.className,h=e.exact,y=e.isActive,w=e.location,E=e.sensitive,k=e.strict,S=e.style,_=e.to,x=e.innerRef,T=(0,s.Z)(e,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return o.createElement(r.s6.Consumer,null,(function(e){e||(0,c.Z)(!1);var n=w||e.location,i=f(d(_,n),n),s=i.pathname,C=s&&s.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),A=C?(0,r.LX)(n.pathname,{path:C,exact:h,sensitive:E,strict:k}):null,N=!!(y?y(A,n):A),O="function"==typeof m?m(N):m,L="function"==typeof S?S(N):S;N&&(O=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter((function(e){return e})).join(" ")}(O,u),L=(0,l.Z)({},L,p));var I=(0,l.Z)({"aria-current":N&&a||null,className:O,style:L,to:i},T);return b!==v?I.ref=t||x:I.innerRef=x,o.createElement(g,I)}))}))},6775:(e,t,n)=>{"use strict";n.d(t,{l_:()=>T,AW:()=>O,F0:()=>E,rs:()=>D,s6:()=>w,LX:()=>N,k6:()=>B,TH:()=>$});var r=n(5068),a=n(7294),o=n(2358),i=n(5697),l=n.n(i),s=1073741823,c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:{};function u(e){var t=[];return{on:function(e){t.push(e)},off:function(e){t=t.filter((function(t){return t!==e}))},get:function(){return e},set:function(n,r){e=n,t.forEach((function(t){return t(e,r)}))}}}var d=a.createContext||function(e,t){var n,o,i="__create-react-context-"+function(){var e="__global_unique_id__";return c[e]=(c[e]||0)+1}()+"__",d=function(e){function n(){var t;return(t=e.apply(this,arguments)||this).emitter=u(t.props.value),t}(0,r.Z)(n,e);var a=n.prototype;return a.getChildContext=function(){var e;return(e={})[i]=this.emitter,e},a.componentWillReceiveProps=function(e){if(this.props.value!==e.value){var n,r=this.props.value,a=e.value;((o=r)===(i=a)?0!==o||1/o==1/i:o!=o&&i!=i)?n=0:(n="function"==typeof t?t(r,a):s,0!==(n|=0)&&this.emitter.set(e.value,n))}var o,i},a.render=function(){return this.props.children},n}(a.Component);d.childContextTypes=((n={})[i]=l().object.isRequired,n);var f=function(t){function n(){var e;return(e=t.apply(this,arguments)||this).state={value:e.getValue()},e.onUpdate=function(t,n){0!=((0|e.observedBits)&n)&&e.setState({value:e.getValue()})},e}(0,r.Z)(n,t);var a=n.prototype;return a.componentWillReceiveProps=function(e){var t=e.observedBits;this.observedBits=null==t?s:t},a.componentDidMount=function(){this.context[i]&&this.context[i].on(this.onUpdate);var e=this.props.observedBits;this.observedBits=null==e?s:e},a.componentWillUnmount=function(){this.context[i]&&this.context[i].off(this.onUpdate)},a.getValue=function(){return this.context[i]?this.context[i].get():e},a.render=function(){return(e=this.props.children,Array.isArray(e)?e[0]:e)(this.state.value);var e},n}(a.Component);return f.contextTypes=((o={})[i]=l().object,o),{Provider:d,Consumer:f}};const f=d;var p=n(2177),m=n(7462),h=n(4779),g=n.n(h),b=(n(9864),n(3366)),v=(n(8679),function(e){var t=f();return t.displayName=e,t}),y=v("Router-History"),w=v("Router"),E=function(e){function t(t){var n;return(n=e.call(this,t)||this).state={location:t.history.location},n._isMounted=!1,n._pendingLocation=null,t.staticContext||(n.unlisten=t.history.listen((function(e){n._pendingLocation=e}))),n}(0,r.Z)(t,e),t.computeRootMatch=function(e){return{path:"/",url:"/",params:{},isExact:"/"===e}};var n=t.prototype;return n.componentDidMount=function(){var e=this;this._isMounted=!0,this.unlisten&&this.unlisten(),this.props.staticContext||(this.unlisten=this.props.history.listen((function(t){e._isMounted&&e.setState({location:t})}))),this._pendingLocation&&this.setState({location:this._pendingLocation})},n.componentWillUnmount=function(){this.unlisten&&(this.unlisten(),this._isMounted=!1,this._pendingLocation=null)},n.render=function(){return a.createElement(w.Provider,{value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}},a.createElement(y.Provider,{children:this.props.children||null,value:this.props.history}))},t}(a.Component);a.Component;var k=function(e){function t(){return e.apply(this,arguments)||this}(0,r.Z)(t,e);var n=t.prototype;return n.componentDidMount=function(){this.props.onMount&&this.props.onMount.call(this,this)},n.componentDidUpdate=function(e){this.props.onUpdate&&this.props.onUpdate.call(this,this,e)},n.componentWillUnmount=function(){this.props.onUnmount&&this.props.onUnmount.call(this,this)},n.render=function(){return null},t}(a.Component);var S={},_=0;function x(e,t){return void 0===e&&(e="/"),void 0===t&&(t={}),"/"===e?e:function(e){if(S[e])return S[e];var t=g().compile(e);return _<1e4&&(S[e]=t,_++),t}(e)(t,{pretty:!0})}function T(e){var t=e.computedMatch,n=e.to,r=e.push,i=void 0!==r&&r;return a.createElement(w.Consumer,null,(function(e){e||(0,p.Z)(!1);var r=e.history,l=e.staticContext,s=i?r.push:r.replace,c=(0,o.ob)(t?"string"==typeof n?x(n,t.params):(0,m.Z)({},n,{pathname:x(n.pathname,t.params)}):n);return l?(s(c),null):a.createElement(k,{onMount:function(){s(c)},onUpdate:function(e,t){var n=(0,o.ob)(t.to);(0,o.Hp)(n,(0,m.Z)({},c,{key:n.key}))||s(c)},to:n})}))}var C={},A=0;function N(e,t){void 0===t&&(t={}),("string"==typeof t||Array.isArray(t))&&(t={path:t});var n=t,r=n.path,a=n.exact,o=void 0!==a&&a,i=n.strict,l=void 0!==i&&i,s=n.sensitive,c=void 0!==s&&s;return[].concat(r).reduce((function(t,n){if(!n&&""!==n)return null;if(t)return t;var r=function(e,t){var n=""+t.end+t.strict+t.sensitive,r=C[n]||(C[n]={});if(r[e])return r[e];var a=[],o={regexp:g()(e,a,t),keys:a};return A<1e4&&(r[e]=o,A++),o}(n,{end:o,strict:l,sensitive:c}),a=r.regexp,i=r.keys,s=a.exec(e);if(!s)return null;var u=s[0],d=s.slice(1),f=e===u;return o&&!f?null:{path:n,url:"/"===n&&""===u?"/":u,isExact:f,params:i.reduce((function(e,t,n){return e[t.name]=d[n],e}),{})}}),null)}var O=function(e){function t(){return e.apply(this,arguments)||this}return(0,r.Z)(t,e),t.prototype.render=function(){var e=this;return a.createElement(w.Consumer,null,(function(t){t||(0,p.Z)(!1);var n=e.props.location||t.location,r=e.props.computedMatch?e.props.computedMatch:e.props.path?N(n.pathname,e.props):t.match,o=(0,m.Z)({},t,{location:n,match:r}),i=e.props,l=i.children,s=i.component,c=i.render;return Array.isArray(l)&&function(e){return 0===a.Children.count(e)}(l)&&(l=null),a.createElement(w.Provider,{value:o},o.match?l?"function"==typeof l?l(o):l:s?a.createElement(s,o):c?c(o):null:"function"==typeof l?l(o):null)}))},t}(a.Component);function L(e){return"/"===e.charAt(0)?e:"/"+e}function I(e,t){if(!e)return t;var n=L(e);return 0!==t.pathname.indexOf(n)?t:(0,m.Z)({},t,{pathname:t.pathname.substr(n.length)})}function P(e){return"string"==typeof e?e:(0,o.Ep)(e)}function R(e){return function(){(0,p.Z)(!1)}}function M(){}a.Component;var D=function(e){function t(){return e.apply(this,arguments)||this}return(0,r.Z)(t,e),t.prototype.render=function(){var e=this;return a.createElement(w.Consumer,null,(function(t){t||(0,p.Z)(!1);var n,r,o=e.props.location||t.location;return a.Children.forEach(e.props.children,(function(e){if(null==r&&a.isValidElement(e)){n=e;var i=e.props.path||e.props.from;r=i?N(o.pathname,(0,m.Z)({},e.props,{path:i})):t.match}})),r?a.cloneElement(n,{location:o,computedMatch:r}):null}))},t}(a.Component);var F=a.useContext;function B(){return F(y)}function $(){return F(w).location}},2408:(e,t,n)=>{"use strict";var r=n(7418),a=60103,o=60106;t.Fragment=60107,t.StrictMode=60108,t.Profiler=60114;var i=60109,l=60110,s=60112;t.Suspense=60113;var c=60115,u=60116;if("function"==typeof Symbol&&Symbol.for){var d=Symbol.for;a=d("react.element"),o=d("react.portal"),t.Fragment=d("react.fragment"),t.StrictMode=d("react.strict_mode"),t.Profiler=d("react.profiler"),i=d("react.provider"),l=d("react.context"),s=d("react.forward_ref"),t.Suspense=d("react.suspense"),c=d("react.memo"),u=d("react.lazy")}var f="function"==typeof Symbol&&Symbol.iterator;function p(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h={};function g(e,t,n){this.props=e,this.context=t,this.refs=h,this.updater=n||m}function b(){}function v(e,t,n){this.props=e,this.context=t,this.refs=h,this.updater=n||m}g.prototype.isReactComponent={},g.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(p(85));this.updater.enqueueSetState(this,e,t,"setState")},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},b.prototype=g.prototype;var y=v.prototype=new b;y.constructor=v,r(y,g.prototype),y.isPureReactComponent=!0;var w={current:null},E=Object.prototype.hasOwnProperty,k={key:!0,ref:!0,__self:!0,__source:!0};function S(e,t,n){var r,o={},i=null,l=null;if(null!=t)for(r in void 0!==t.ref&&(l=t.ref),void 0!==t.key&&(i=""+t.key),t)E.call(t,r)&&!k.hasOwnProperty(r)&&(o[r]=t[r]);var s=arguments.length-2;if(1===s)o.children=n;else if(1<s){for(var c=Array(s),u=0;u<s;u++)c[u]=arguments[u+2];o.children=c}if(e&&e.defaultProps)for(r in s=e.defaultProps)void 0===o[r]&&(o[r]=s[r]);return{$$typeof:a,type:e,key:i,ref:l,props:o,_owner:w.current}}function _(e){return"object"==typeof e&&null!==e&&e.$$typeof===a}var x=/\/+/g;function T(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function C(e,t,n,r,i){var l=typeof e;"undefined"!==l&&"boolean"!==l||(e=null);var s=!1;if(null===e)s=!0;else switch(l){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case a:case o:s=!0}}if(s)return i=i(s=e),e=""===r?"."+T(s,0):r,Array.isArray(i)?(n="",null!=e&&(n=e.replace(x,"$&/")+"/"),C(i,t,n,"",(function(e){return e}))):null!=i&&(_(i)&&(i=function(e,t){return{$$typeof:a,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(i,n+(!i.key||s&&s.key===i.key?"":(""+i.key).replace(x,"$&/")+"/")+e)),t.push(i)),1;if(s=0,r=""===r?".":r+":",Array.isArray(e))for(var c=0;c<e.length;c++){var u=r+T(l=e[c],c);s+=C(l,t,n,u,i)}else if(u=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=f&&e[f]||e["@@iterator"])?e:null}(e),"function"==typeof u)for(e=u.call(e),c=0;!(l=e.next()).done;)s+=C(l=l.value,t,n,u=r+T(l,c++),i);else if("object"===l)throw t=""+e,Error(p(31,"[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t));return s}function A(e,t,n){if(null==e)return e;var r=[],a=0;return C(e,r,"","",(function(e){return t.call(n,e,a++)})),r}function N(e){if(-1===e._status){var t=e._result;t=t(),e._status=0,e._result=t,t.then((function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)}),(function(t){0===e._status&&(e._status=2,e._result=t)}))}if(1===e._status)return e._result;throw e._result}var O={current:null};function L(){var e=O.current;if(null===e)throw Error(p(321));return e}var I={ReactCurrentDispatcher:O,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:w,IsSomeRendererActing:{current:!1},assign:r};t.Children={map:A,forEach:function(e,t,n){A(e,(function(){t.apply(this,arguments)}),n)},count:function(e){var t=0;return A(e,(function(){t++})),t},toArray:function(e){return A(e,(function(e){return e}))||[]},only:function(e){if(!_(e))throw Error(p(143));return e}},t.Component=g,t.PureComponent=v,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,t.cloneElement=function(e,t,n){if(null==e)throw Error(p(267,e));var o=r({},e.props),i=e.key,l=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(l=t.ref,s=w.current),void 0!==t.key&&(i=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(u in t)E.call(t,u)&&!k.hasOwnProperty(u)&&(o[u]=void 0===t[u]&&void 0!==c?c[u]:t[u])}var u=arguments.length-2;if(1===u)o.children=n;else if(1<u){c=Array(u);for(var d=0;d<u;d++)c[d]=arguments[d+2];o.children=c}return{$$typeof:a,type:e.type,key:i,ref:l,props:o,_owner:s}},t.createContext=function(e,t){return void 0===t&&(t=null),(e={$$typeof:l,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:i,_context:e},e.Consumer=e},t.createElement=S,t.createFactory=function(e){var t=S.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:s,render:e}},t.isValidElement=_,t.lazy=function(e){return{$$typeof:u,_payload:{_status:-1,_result:e},_init:N}},t.memo=function(e,t){return{$$typeof:c,type:e,compare:void 0===t?null:t}},t.useCallback=function(e,t){return L().useCallback(e,t)},t.useContext=function(e,t){return L().useContext(e,t)},t.useDebugValue=function(){},t.useEffect=function(e,t){return L().useEffect(e,t)},t.useImperativeHandle=function(e,t,n){return L().useImperativeHandle(e,t,n)},t.useLayoutEffect=function(e,t){return L().useLayoutEffect(e,t)},t.useMemo=function(e,t){return L().useMemo(e,t)},t.useReducer=function(e,t,n){return L().useReducer(e,t,n)},t.useRef=function(e){return L().useRef(e)},t.useState=function(e){return L().useState(e)},t.version="17.0.2"},7294:(e,t,n)=>{"use strict";e.exports=n(2408)},53:(e,t)=>{"use strict";var n,r,a,o;if("object"==typeof performance&&"function"==typeof performance.now){var i=performance;t.unstable_now=function(){return i.now()}}else{var l=Date,s=l.now();t.unstable_now=function(){return l.now()-s}}if("undefined"==typeof window||"function"!=typeof MessageChannel){var c=null,u=null,d=function(){if(null!==c)try{var e=t.unstable_now();c(!0,e),c=null}catch(n){throw setTimeout(d,0),n}};n=function(e){null!==c?setTimeout(n,0,e):(c=e,setTimeout(d,0))},r=function(e,t){u=setTimeout(e,t)},a=function(){clearTimeout(u)},t.unstable_shouldYield=function(){return!1},o=t.unstable_forceFrameRate=function(){}}else{var f=window.setTimeout,p=window.clearTimeout;if("undefined"!=typeof console){var m=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!=typeof m&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var h=!1,g=null,b=-1,v=5,y=0;t.unstable_shouldYield=function(){return t.unstable_now()>=y},o=function(){},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):v=0<e?Math.floor(1e3/e):5};var w=new MessageChannel,E=w.port2;w.port1.onmessage=function(){if(null!==g){var e=t.unstable_now();y=e+v;try{g(!0,e)?E.postMessage(null):(h=!1,g=null)}catch(n){throw E.postMessage(null),n}}else h=!1},n=function(e){g=e,h||(h=!0,E.postMessage(null))},r=function(e,n){b=f((function(){e(t.unstable_now())}),n)},a=function(){p(b),b=-1}}function k(e,t){var n=e.length;e.push(t);e:for(;;){var r=n-1>>>1,a=e[r];if(!(void 0!==a&&0<x(a,t)))break e;e[r]=t,e[n]=a,n=r}}function S(e){return void 0===(e=e[0])?null:e}function _(e){var t=e[0];if(void 0!==t){var n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,a=e.length;r<a;){var o=2*(r+1)-1,i=e[o],l=o+1,s=e[l];if(void 0!==i&&0>x(i,n))void 0!==s&&0>x(s,i)?(e[r]=s,e[l]=n,r=l):(e[r]=i,e[o]=n,r=o);else{if(!(void 0!==s&&0>x(s,n)))break e;e[r]=s,e[l]=n,r=l}}}return t}return null}function x(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var T=[],C=[],A=1,N=null,O=3,L=!1,I=!1,P=!1;function R(e){for(var t=S(C);null!==t;){if(null===t.callback)_(C);else{if(!(t.startTime<=e))break;_(C),t.sortIndex=t.expirationTime,k(T,t)}t=S(C)}}function M(e){if(P=!1,R(e),!I)if(null!==S(T))I=!0,n(D);else{var t=S(C);null!==t&&r(M,t.startTime-e)}}function D(e,n){I=!1,P&&(P=!1,a()),L=!0;var o=O;try{for(R(n),N=S(T);null!==N&&(!(N.expirationTime>n)||e&&!t.unstable_shouldYield());){var i=N.callback;if("function"==typeof i){N.callback=null,O=N.priorityLevel;var l=i(N.expirationTime<=n);n=t.unstable_now(),"function"==typeof l?N.callback=l:N===S(T)&&_(T),R(n)}else _(T);N=S(T)}if(null!==N)var s=!0;else{var c=S(C);null!==c&&r(M,c.startTime-n),s=!1}return s}finally{N=null,O=o,L=!1}}var F=o;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){I||L||(I=!0,n(D))},t.unstable_getCurrentPriorityLevel=function(){return O},t.unstable_getFirstCallbackNode=function(){return S(T)},t.unstable_next=function(e){switch(O){case 1:case 2:case 3:var t=3;break;default:t=O}var n=O;O=t;try{return e()}finally{O=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=F,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=O;O=e;try{return t()}finally{O=n}},t.unstable_scheduleCallback=function(e,o,i){var l=t.unstable_now();switch("object"==typeof i&&null!==i?i="number"==typeof(i=i.delay)&&0<i?l+i:l:i=l,e){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return e={id:A++,callback:o,priorityLevel:e,startTime:i,expirationTime:s=i+s,sortIndex:-1},i>l?(e.sortIndex=i,k(C,e),null===S(T)&&e===S(C)&&(P?a():P=!0,r(M,i-l))):(e.sortIndex=s,k(T,e),I||L||(I=!0,n(D))),e},t.unstable_wrapCallback=function(e){var t=O;return function(){var n=O;O=t;try{return e.apply(this,arguments)}finally{O=n}}}},3840:(e,t,n)=>{"use strict";e.exports=n(53)},6774:e=>{e.exports=function(e,t,n,r){var a=n?n.call(r,e,t):void 0;if(void 0!==a)return!!a;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var o=Object.keys(e),i=Object.keys(t);if(o.length!==i.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(t),s=0;s<o.length;s++){var c=o[s];if(!l(c))return!1;var u=e[c],d=t[c];if(!1===(a=n?n.call(r,u,d,c):void 0)||void 0===a&&u!==d)return!1}return!0}},2177:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r="Invariant failed";function a(e,t){if(!e)throw new Error(r)}},6809:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r});const r={title:"Dasar Pemrograman Rust",tagline:"Belajar Rust Mulai Dari 0, Gratis!",url:"https://dasarpemrogramanrust.novalagung.com",baseUrl:"/",trailingSlash:!1,onBrokenLinks:"throw",onBrokenMarkdownLinks:"warn",favicon:"img/favicon.png",organizationName:"novalagung",projectName:"dasarpemrogramanrust",deploymentBranch:"gh-pages",i18n:{defaultLocale:"id",locales:["id"],path:"i18n",localeConfigs:{}},presets:[["classic",{docs:{sidebarPath:"/home/runner/work/dasarpemrogramanrust/dasarpemrogramanrust/sidebars.js",sidebarCollapsible:!1,routeBasePath:"/"},blog:!1,theme:{customCss:["/home/runner/work/dasarpemrogramanrust/dasarpemrogramanrust/src/css/global.css","/home/runner/work/dasarpemrogramanrust/dasarpemrogramanrust/src-local/css/custom.css"]},gtag:{trackingID:"G-HKPC8ZGM74"},sitemap:{changefreq:"weekly",priority:.5,ignorePatterns:["/tags/**","/wip/**"],filename:"sitemap.xml"}}]],plugins:["@stackql/docusaurus-plugin-structured-data"],themeConfig:{metadata:[{name:"keywords",content:"rust, belajar rust, tutorial rust, belajar tutorial rust gratis, pemrograman rust, cargo, concurrent programming, noval agung"},{name:"author",content:"Noval Agung Prayogo"},{property:"og:image",content:"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png"},{property:"og:type",content:"article"},{property:"fb:app_id",content:"875100400724859"}],image:"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png",navbar:{title:"Dasar Pemrograman Rust",logo:{alt:"Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!",src:"https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png",srcDark:"https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png"},items:[{position:"left",label:"\ud83d\udcd6 Webbook/Ebook",items:[{label:"Dasar Pemrograman Golang ",href:"https://dasarpemrogramangolang.novalagung.com"},{label:"Dasar Pemrograman Python ",href:"https://dasarpemrogramanpython.novalagung.com"},{label:"How To ",href:"https://howto.novalagung.com"}]},{position:"left",label:"\u25b6\ufe0f Udemy courses",items:[{label:"Udemy Course: Praktis Belajar Docker dan Kubernetes ",href:"https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode="}]}],hideOnScroll:!1},footer:{style:"dark",links:[],copyright:"2024 | Maintained by Noval Agung Prayogo"},prism:{theme:{plain:{color:"#393A34",backgroundColor:"#f6f8fa"},styles:[{types:["comment","prolog","doctype","cdata"],style:{color:"#999988",fontStyle:"italic"}},{types:["namespace"],style:{opacity:.7}},{types:["string","attr-value"],style:{color:"#e3116c"}},{types:["punctuation","operator"],style:{color:"#393A34"}},{types:["entity","url","symbol","number","boolean","variable","constant","property","regex","inserted"],style:{color:"#36acaa"}},{types:["atrule","keyword","attr-name","selector"],style:{color:"#00a4db"}},{types:["function","deleted","tag"],style:{color:"#d73a49"}},{types:["function-variable"],style:{color:"#6f42c1"}},{types:["tag","selector","keyword"],style:{color:"#00009f"}}]},darkTheme:{plain:{color:"#F8F8F2",backgroundColor:"#282A36"},styles:[{types:["prolog","constant","builtin"],style:{color:"rgb(189, 147, 249)"}},{types:["inserted","function"],style:{color:"rgb(80, 250, 123)"}},{types:["deleted"],style:{color:"rgb(255, 85, 85)"}},{types:["changed"],style:{color:"rgb(255, 184, 108)"}},{types:["punctuation","symbol"],style:{color:"rgb(248, 248, 242)"}},{types:["string","char","tag","selector"],style:{color:"rgb(255, 121, 198)"}},{types:["keyword","variable"],style:{color:"rgb(189, 147, 249)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(98, 114, 164)"}},{types:["attr-name"],style:{color:"rgb(241, 250, 140)"}}]},additionalLanguages:["bash","rust","python","toml","yaml","log","hcl"],magicComments:[{className:"theme-code-block-highlighted-line",line:"highlight-next-line",block:{start:"highlight-start",end:"highlight-end"}}]},showContentFooterEbookWrapper:!0,algolia:{appId:"65RXJ98QVA",apiKey:"be8c782c081c9e5a001dbbaa6ffdd859",indexName:"dasarpemrogramanrust-novalagung",contextualSearch:!0,searchPagePath:"search",searchParameters:{}},structuredData:{excludedRoutes:[],verbose:!0,featuredImageDimensions:{width:1200,height:627},authors:{"Noval Agung Prayogo":{authorId:"1",url:"https://www.linkedin.com/in/novalagung",imageUrl:"https://i.stack.imgur.com/99yxf.jpg",sameAs:["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"]}},organization:{sameAs:["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],contactPoint:{"@type":"ContactPoint",email:"hello@novalagung.com"},logo:{"@type":"ImageObject",inLanguage:"id","@id":"adamstudio",url:"https://avatars.githubusercontent.com/u/65223287",contentUrl:"https://avatars.githubusercontent.com/u/65223287",width:1440,height:900,caption:"Adam Studio"}},website:{inLanguage:"id"},webpage:{inLanguage:"id"},breadcrumbLabelMap:{}},colorMode:{defaultMode:"light",disableSwitch:!1,respectPrefersColorScheme:!1},docs:{versionPersistence:"localStorage",sidebar:{hideable:!1,autoCollapseCategories:!1}},tableOfContents:{minHeadingLevel:2,maxHeadingLevel:3}},baseUrlIssueBanner:!0,onDuplicateRoutes:"warn",staticDirectories:["static"],customFields:{},themes:[],scripts:[],headTags:[],stylesheets:[],clientModules:[],titleDelimiter:"|",noIndex:!1,markdown:{mermaid:!1}}},7462:(e,t,n)=>{"use strict";function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r.apply(this,arguments)}n.d(t,{Z:()=>r})},5068:(e,t,n)=>{"use strict";function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}function a(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}n.d(t,{Z:()=>a})},3366:(e,t,n)=>{"use strict";function r(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}n.d(t,{Z:()=>r})},7529:e=>{"use strict";e.exports={}},6887:e=>{"use strict";e.exports=JSON.parse('{"/intro-a5b":{"__comp":"48e2ebd6","__context":{"plugin":"d47a3664"},"config":"5e9f5e1a"},"/search-fa3":{"__comp":"1a4e3797","__context":{"plugin":"164327b9"}},"/-24f":{"__comp":"1be78505","__context":{"plugin":"0e6b6dd1"},"versionMetadata":"935f2afb"},"/-98e":{"__comp":"17896441","content":"c377a04b"},"/basic/advanced-traits-88d":{"__comp":"17896441","content":"742a9bdc"},"/basic/array-354":{"__comp":"17896441","content":"dadaca00"},"/basic/associated-function-a80":{"__comp":"17896441","content":"bdfc7662"},"/basic/attributes-7d4":{"__comp":"17896441","content":"5f289fb7"},"/basic/basic-memory-management-24e":{"__comp":"17896441","content":"016a0787"},"/basic/block-expression-22b":{"__comp":"17896441","content":"b28a365a"},"/basic/borrowing-85f":{"__comp":"17896441","content":"fb18633e"},"/basic/build-dan-run-program-rust-1a9":{"__comp":"17896441","content":"7a2568c4"},"/basic/closures-98c":{"__comp":"17896441","content":"bc4edc5c"},"/basic/datetime-b5e":{"__comp":"17896441","content":"af6aab29"},"/basic/enum-a0e":{"__comp":"17896441","content":"4232c3ed"},"/basic/file-path-directory-020":{"__comp":"17896441","content":"9a3629a6"},"/basic/function-c21":{"__comp":"17896441","content":"c526a898"},"/basic/generics-3f9":{"__comp":"17896441","content":"5925ce9f"},"/basic/hello-rust-91f":{"__comp":"17896441","content":"496dcc30"},"/basic/komentar-f72":{"__comp":"17896441","content":"b97d8256"},"/basic/konstanta-758":{"__comp":"17896441","content":"c01cce30"},"/basic/lifetime-ee9":{"__comp":"17896441","content":"f8d4e457"},"/basic/method-970":{"__comp":"17896441","content":"68e1906b"},"/basic/module-basic-81c":{"__comp":"17896441","content":"4c7e7ada"},"/basic/module-inline-4f6":{"__comp":"17896441","content":"3aa512bf"},"/basic/module-scope-item-access-b6b":{"__comp":"17896441","content":"be3f5c40"},"/basic/operator-85d":{"__comp":"17896441","content":"dabee7bd"},"/basic/operator-tanda-tanya-f6a":{"__comp":"17896441","content":"3d2f5b0c"},"/basic/option-type-c23":{"__comp":"17896441","content":"e4904969"},"/basic/ownership-74d":{"__comp":"17896441","content":"8333c691"},"/basic/package-crate-fce":{"__comp":"17896441","content":"7390b81e"},"/basic/path-item-e90":{"__comp":"17896441","content":"e7bd9b37"},"/basic/pattern-matching-45d":{"__comp":"17896441","content":"2bc2e36b"},"/basic/perulangan-for-in-c5f":{"__comp":"17896441","content":"71880105"},"/basic/perulangan-loop-break-continue-label-b52":{"__comp":"17896441","content":"04da11da"},"/basic/perulangan-while-011":{"__comp":"17896441","content":"475d163e"},"/basic/pointer-references-dfd":{"__comp":"17896441","content":"0ae704f7"},"/basic/recoverable-error-handling-b06":{"__comp":"17896441","content":"9ed3ab78"},"/basic/result-type-c01":{"__comp":"17896441","content":"7794a932"},"/basic/seleksi-kondisi-if-e3d":{"__comp":"17896441","content":"05cc1716"},"/basic/shadowing-5be":{"__comp":"17896441","content":"fef7d16c"},"/basic/slice-2c8":{"__comp":"17896441","content":"62b99870"},"/basic/slice-memory-management-6b3":{"__comp":"17896441","content":"4513d9f5"},"/basic/static-655":{"__comp":"17896441","content":"68ec37cc"},"/basic/string-slice-vs-string-literal-5e6":{"__comp":"17896441","content":"a2bea3ed"},"/basic/struct-392":{"__comp":"17896441","content":"93422b31"},"/basic/tipe-data-custom-type-string-slice-384":{"__comp":"17896441","content":"8b55bf27"},"/basic/tipe-data-primitive-scalar-18c":{"__comp":"17896441","content":"bd9b9d52"},"/basic/tipe-data-string-literal-788":{"__comp":"17896441","content":"d8837387"},"/basic/trait-function-ebd":{"__comp":"17896441","content":"cb962766"},"/basic/trait-iterator-2f7":{"__comp":"17896441","content":"82a9b669"},"/basic/traits-594":{"__comp":"17896441","content":"db8ccf76"},"/basic/tuple-dfc":{"__comp":"17896441","content":"8333ea4d"},"/basic/type-alias-casting-dbf":{"__comp":"17896441","content":"2452d5f5"},"/basic/unrecoverable-panic-error-445":{"__comp":"17896441","content":"388041ab"},"/basic/use-f71":{"__comp":"17896441","content":"eb2a6637"},"/basic/variabel-21b":{"__comp":"17896441","content":"87499f15"},"/basic/vector-4d7":{"__comp":"17896441","content":"c76cc2e3"},"/basic/visibility-privacy-794":{"__comp":"17896441","content":"3b1dfe68"},"/CHANGELOG-c6e":{"__comp":"17896441","content":"ca36df4d"},"/CONTRIBUTING-93d":{"__comp":"17896441","content":"8d193b98"},"/download-pdf-a82":{"__comp":"17896441","content":"8e991452"},"/installation/instalasi-rust-e6a":{"__comp":"17896441","content":"9e6fe7cf"},"/installation/rust-editor-plugin-a9b":{"__comp":"17896441","content":"fd4f5a0c"},"/LICENSE-67b":{"__comp":"17896441","content":"8ad68633"},"/pengelanan-rust-programming-aab":{"__comp":"17896441","content":"7d03ccaf"}}')}},e=>{e.O(0,[532],(()=>{return t=9383,e(e.s=t);var t}));e.O()}]); \ No newline at end of file diff --git a/assets/js/main.945e59e1.js b/assets/js/main.945e59e1.js new file mode 100644 index 00000000..428666b4 --- /dev/null +++ b/assets/js/main.945e59e1.js @@ -0,0 +1,2 @@ +/*! For license information please see main.945e59e1.js.LICENSE.txt */ +(self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[]).push([[179],{830:(e,t,n)=>{"use strict";n.d(t,{W:()=>a});var r=n(7294);function a(){return r.createElement("svg",{width:"20",height:"20",className:"DocSearch-Search-Icon",viewBox:"0 0 20 20"},r.createElement("path",{d:"M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"}))}},723:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(7294),a=n(7462),o=n(8356),i=n.n(o),l=n(6887);const s={"016a0787":[()=>n.e(274).then(n.bind(n,1854)),"@site/docs/basic/basic-memory-management.md",1854],"04da11da":[()=>n.e(3007).then(n.bind(n,7019)),"@site/docs/basic/perulangan-loop-break-continue-label.md",7019],"05cc1716":[()=>n.e(6477).then(n.bind(n,9810)),"@site/docs/basic/seleksi-kondisi-if.md",9810],"0ae704f7":[()=>n.e(2089).then(n.bind(n,5444)),"@site/docs/basic/pointer-references.md",5444],"0e6b6dd1":[()=>n.e(7949).then(n.t.bind(n,3769,19)),"/home/runner/work/dasarpemrogramanrust/dasarpemrogramanrust/.docusaurus/docusaurus-plugin-content-docs/default/plugin-route-context-module-100.json",3769],"164327b9":[()=>n.e(3306).then(n.t.bind(n,7085,19)),"/home/runner/work/dasarpemrogramanrust/dasarpemrogramanrust/.docusaurus/docusaurus-theme-search-algolia/default/plugin-route-context-module-100.json",7085],17896441:[()=>Promise.all([n.e(532),n.e(3373),n.e(7918)]).then(n.bind(n,718)),"@theme/DocItem",718],"1a4e3797":[()=>Promise.all([n.e(532),n.e(7920)]).then(n.bind(n,6675)),"@theme/SearchPage",6675],"1be78505":[()=>Promise.all([n.e(532),n.e(9514)]).then(n.bind(n,2868)),"@theme/DocPage",2868],"2452d5f5":[()=>n.e(5989).then(n.bind(n,831)),"@site/docs/basic/type-alias-casting.md",831],"2bc2e36b":[()=>n.e(620).then(n.bind(n,8283)),"@site/docs/basic/pattern-matching.md",8283],"388041ab":[()=>n.e(1494).then(n.bind(n,395)),"@site/docs/basic/unrecoverable-panic-error.md",395],"3aa512bf":[()=>n.e(7386).then(n.bind(n,7495)),"@site/docs/basic/module-inline.md",7495],"3b1dfe68":[()=>n.e(6161).then(n.bind(n,4008)),"@site/docs/basic/visibility-privacy.md",4008],"3d2f5b0c":[()=>n.e(676).then(n.bind(n,5569)),"@site/docs/basic/operator-tanda-tanya.md",5569],"4232c3ed":[()=>n.e(8308).then(n.bind(n,1597)),"@site/docs/basic/enum.md",1597],"4513d9f5":[()=>n.e(5729).then(n.bind(n,2589)),"@site/docs/basic/slice-memory-management.md",2589],"475d163e":[()=>n.e(6403).then(n.bind(n,6889)),"@site/docs/basic/perulangan-while.md",6889],"48e2ebd6":[()=>n.e(2359).then(n.bind(n,611)),"@site/src/pages/intro.js",611],"496dcc30":[()=>n.e(4738).then(n.bind(n,4547)),"@site/docs/basic/hello-rust.md",4547],"4c7e7ada":[()=>n.e(2706).then(n.bind(n,5442)),"@site/docs/basic/module-basic.md",5442],"5925ce9f":[()=>n.e(9831).then(n.bind(n,3121)),"@site/docs/basic/generics.md",3121],"5e9f5e1a":[()=>Promise.resolve().then(n.bind(n,6809)),"@generated/docusaurus.config",6809],"5f289fb7":[()=>n.e(2870).then(n.bind(n,4950)),"@site/docs/basic/attributes.md",4950],"62b99870":[()=>n.e(1422).then(n.bind(n,1569)),"@site/docs/basic/slice.md",1569],"68e1906b":[()=>n.e(4758).then(n.bind(n,7630)),"@site/docs/basic/method.md",7630],"68ec37cc":[()=>n.e(2959).then(n.bind(n,3275)),"@site/docs/basic/static.md",3275],71880105:[()=>n.e(5758).then(n.bind(n,3548)),"@site/docs/basic/perulangan-for-in.md",3548],"7390b81e":[()=>n.e(4274).then(n.bind(n,6981)),"@site/docs/basic/package-crate.md",6981],"742a9bdc":[()=>n.e(7988).then(n.bind(n,8046)),"@site/docs/basic/advanced-traits.md",8046],"7794a932":[()=>n.e(8358).then(n.bind(n,6682)),"@site/docs/basic/result-type.md",6682],"7a2568c4":[()=>n.e(4197).then(n.bind(n,6425)),"@site/docs/basic/build-dan-run-program-rust.md",6425],"7d03ccaf":[()=>n.e(1059).then(n.bind(n,2409)),"@site/docs/pengelanan-rust-programming.md",2409],"82a9b669":[()=>n.e(3257).then(n.bind(n,1958)),"@site/docs/basic/trait-iterator.md",1958],"8333c691":[()=>n.e(4248).then(n.bind(n,9739)),"@site/docs/basic/ownership.md",9739],"8333ea4d":[()=>n.e(9323).then(n.bind(n,7485)),"@site/docs/basic/tuple.md",7485],"87499f15":[()=>n.e(7742).then(n.bind(n,67)),"@site/docs/basic/variabel.md",67],"8ad68633":[()=>n.e(2399).then(n.bind(n,1606)),"@site/docs/LICENSE.md",1606],"8b55bf27":[()=>n.e(9886).then(n.bind(n,5877)),"@site/docs/basic/tipe-data-custom-type-string-slice.md",5877],"8d193b98":[()=>n.e(7505).then(n.bind(n,676)),"@site/docs/CONTRIBUTING.md",676],"8e991452":[()=>n.e(2107).then(n.bind(n,9484)),"@site/docs/download-pdf.md",9484],"93422b31":[()=>n.e(8469).then(n.bind(n,1704)),"@site/docs/basic/struct.md",1704],"935f2afb":[()=>n.e(53).then(n.t.bind(n,1109,19)),"~docs/default/version-current-metadata-prop-751.json",1109],"9a3629a6":[()=>n.e(7865).then(n.bind(n,8472)),"@site/docs/basic/file-path-directory.md",8472],"9e6fe7cf":[()=>n.e(623).then(n.bind(n,2508)),"@site/docs/installation/instalasi-rust.md",2508],"9ed3ab78":[()=>n.e(1591).then(n.bind(n,7284)),"@site/docs/basic/recoverable-error-handling.md",7284],a2bea3ed:[()=>n.e(6345).then(n.bind(n,1099)),"@site/docs/basic/string-slice-vs-string-literal.md",1099],af6aab29:[()=>n.e(8794).then(n.bind(n,1468)),"@site/docs/basic/datetime.md",1468],b28a365a:[()=>n.e(6794).then(n.bind(n,7356)),"@site/docs/basic/block-expression.md",7356],b97d8256:[()=>n.e(4790).then(n.bind(n,232)),"@site/docs/basic/komentar.md",232],bc4edc5c:[()=>n.e(4452).then(n.bind(n,129)),"@site/docs/basic/closures.md",129],bd9b9d52:[()=>n.e(909).then(n.bind(n,5943)),"@site/docs/basic/tipe-data-primitive-scalar.md",5943],bdfc7662:[()=>n.e(7720).then(n.bind(n,2486)),"@site/docs/basic/associated-function.md",2486],be3f5c40:[()=>n.e(5572).then(n.bind(n,4387)),"@site/docs/basic/module-scope-item-access.md",4387],c01cce30:[()=>n.e(6531).then(n.bind(n,231)),"@site/docs/basic/konstanta.md",231],c377a04b:[()=>n.e(6971).then(n.bind(n,1269)),"@site/docs/index.md",1269],c526a898:[()=>n.e(9157).then(n.bind(n,3024)),"@site/docs/basic/function.md",3024],c76cc2e3:[()=>n.e(4729).then(n.bind(n,6556)),"@site/docs/basic/vector.md",6556],ca36df4d:[()=>n.e(917).then(n.bind(n,2197)),"@site/docs/CHANGELOG.md",2197],cb962766:[()=>n.e(6691).then(n.bind(n,2900)),"@site/docs/basic/trait-function.md",2900],d47a3664:[()=>n.e(8784).then(n.t.bind(n,5745,19)),"/home/runner/work/dasarpemrogramanrust/dasarpemrogramanrust/.docusaurus/docusaurus-plugin-content-pages/default/plugin-route-context-module-100.json",5745],d8837387:[()=>n.e(4622).then(n.bind(n,8007)),"@site/docs/basic/tipe-data-string-literal.md",8007],dabee7bd:[()=>n.e(4943).then(n.bind(n,3296)),"@site/docs/basic/operator.md",3296],dadaca00:[()=>n.e(8051).then(n.bind(n,375)),"@site/docs/basic/array.md",375],db8ccf76:[()=>n.e(4861).then(n.bind(n,5443)),"@site/docs/basic/traits.md",5443],e4904969:[()=>n.e(8732).then(n.bind(n,4510)),"@site/docs/basic/option-type.md",4510],e7bd9b37:[()=>n.e(7539).then(n.bind(n,2079)),"@site/docs/basic/path-item.md",2079],eb2a6637:[()=>n.e(6388).then(n.bind(n,164)),"@site/docs/basic/use.md",164],f8d4e457:[()=>n.e(740).then(n.bind(n,8514)),"@site/docs/basic/lifetime.md",8514],fb18633e:[()=>n.e(7310).then(n.bind(n,5555)),"@site/docs/basic/borrowing.md",5555],fd4f5a0c:[()=>n.e(5751).then(n.bind(n,5445)),"@site/docs/installation/rust-editor-plugin.md",5445],fef7d16c:[()=>n.e(5673).then(n.bind(n,2043)),"@site/docs/basic/shadowing.md",2043]};function c(e){let{error:t,retry:n,pastDelay:a}=e;return t?r.createElement("div",{style:{textAlign:"center",color:"#fff",backgroundColor:"#fa383e",borderColor:"#fa383e",borderStyle:"solid",borderRadius:"0.25rem",borderWidth:"1px",boxSizing:"border-box",display:"block",padding:"1rem",flex:"0 0 50%",marginLeft:"25%",marginRight:"25%",marginTop:"5rem",maxWidth:"50%",width:"100%"}},r.createElement("p",null,String(t)),r.createElement("div",null,r.createElement("button",{type:"button",onClick:n},"Retry"))):a?r.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"}},r.createElement("svg",{id:"loader",style:{width:128,height:110,position:"absolute",top:"calc(100vh - 64%)"},viewBox:"0 0 45 45",xmlns:"http://www.w3.org/2000/svg",stroke:"#61dafb"},r.createElement("g",{fill:"none",fillRule:"evenodd",transform:"translate(1 1)",strokeWidth:"2"},r.createElement("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0"},r.createElement("animate",{attributeName:"r",begin:"1.5s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-opacity",begin:"1.5s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-width",begin:"1.5s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})),r.createElement("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0"},r.createElement("animate",{attributeName:"r",begin:"3s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-opacity",begin:"3s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-width",begin:"3s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})),r.createElement("circle",{cx:"22",cy:"22",r:"8"},r.createElement("animate",{attributeName:"r",begin:"0s",dur:"1.5s",values:"6;1;2;3;4;5;6",calcMode:"linear",repeatCount:"indefinite"}))))):null}var u=n(9670),d=n(226);function f(e,t){if("*"===e)return i()({loading:c,loader:()=>n.e(4972).then(n.bind(n,4972)),modules:["@theme/NotFound"],webpack:()=>[4972],render(e,t){const n=e.default;return r.createElement(d.z,{value:{plugin:{name:"native",id:"default"}}},r.createElement(n,t))}});const o=l[`${e}-${t}`],f={},p=[],m=[],h=(0,u.Z)(o);return Object.entries(h).forEach((e=>{let[t,n]=e;const r=s[n];r&&(f[t]=r[0],p.push(r[1]),m.push(r[2]))})),i().Map({loading:c,loader:f,modules:p,webpack:()=>m,render(t,n){const i=JSON.parse(JSON.stringify(o));Object.entries(t).forEach((t=>{let[n,r]=t;const a=r.default;if(!a)throw new Error(`The page component at ${e} doesn't have a default export. This makes it impossible to render anything. Consider default-exporting a React component.`);"object"!=typeof a&&"function"!=typeof a||Object.keys(r).filter((e=>"default"!==e)).forEach((e=>{a[e]=r[e]}));let o=i;const l=n.split(".");l.slice(0,-1).forEach((e=>{o=o[e]})),o[l[l.length-1]]=a}));const l=i.__comp;delete i.__comp;const s=i.__context;return delete i.__context,r.createElement(d.z,{value:s},r.createElement(l,(0,a.Z)({},i,n)))}})}const p=[{path:"/intro",component:f("/intro","a5b"),exact:!0},{path:"/search",component:f("/search","fa3"),exact:!0},{path:"/",component:f("/","24f"),routes:[{path:"/",component:f("/","98e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/advanced-traits",component:f("/basic/advanced-traits","88d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/array",component:f("/basic/array","354"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/associated-function",component:f("/basic/associated-function","a80"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/attributes",component:f("/basic/attributes","7d4"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/basic-memory-management",component:f("/basic/basic-memory-management","24e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/block-expression",component:f("/basic/block-expression","22b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/borrowing",component:f("/basic/borrowing","85f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/build-dan-run-program-rust",component:f("/basic/build-dan-run-program-rust","1a9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/closures",component:f("/basic/closures","98c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/datetime",component:f("/basic/datetime","b5e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/enum",component:f("/basic/enum","a0e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/file-path-directory",component:f("/basic/file-path-directory","020"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/function",component:f("/basic/function","c21"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/generics",component:f("/basic/generics","3f9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/hello-rust",component:f("/basic/hello-rust","91f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/komentar",component:f("/basic/komentar","f72"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/konstanta",component:f("/basic/konstanta","758"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/lifetime",component:f("/basic/lifetime","ee9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/method",component:f("/basic/method","970"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/module-basic",component:f("/basic/module-basic","81c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/module-inline",component:f("/basic/module-inline","4f6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/module-scope-item-access",component:f("/basic/module-scope-item-access","b6b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/operator",component:f("/basic/operator","85d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/operator-tanda-tanya",component:f("/basic/operator-tanda-tanya","f6a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/option-type",component:f("/basic/option-type","c23"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/ownership",component:f("/basic/ownership","74d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/package-crate",component:f("/basic/package-crate","fce"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/path-item",component:f("/basic/path-item","e90"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/pattern-matching",component:f("/basic/pattern-matching","45d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/perulangan-for-in",component:f("/basic/perulangan-for-in","c5f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/perulangan-loop-break-continue-label",component:f("/basic/perulangan-loop-break-continue-label","b52"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/perulangan-while",component:f("/basic/perulangan-while","011"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/pointer-references",component:f("/basic/pointer-references","dfd"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/recoverable-error-handling",component:f("/basic/recoverable-error-handling","b06"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/result-type",component:f("/basic/result-type","c01"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/seleksi-kondisi-if",component:f("/basic/seleksi-kondisi-if","e3d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/shadowing",component:f("/basic/shadowing","5be"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/slice",component:f("/basic/slice","2c8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/slice-memory-management",component:f("/basic/slice-memory-management","6b3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/static",component:f("/basic/static","655"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/string-slice-vs-string-literal",component:f("/basic/string-slice-vs-string-literal","5e6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/struct",component:f("/basic/struct","392"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/tipe-data-custom-type-string-slice",component:f("/basic/tipe-data-custom-type-string-slice","384"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/tipe-data-primitive-scalar",component:f("/basic/tipe-data-primitive-scalar","18c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/tipe-data-string-literal",component:f("/basic/tipe-data-string-literal","788"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/trait-function",component:f("/basic/trait-function","ebd"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/trait-iterator",component:f("/basic/trait-iterator","2f7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/traits",component:f("/basic/traits","594"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/tuple",component:f("/basic/tuple","dfc"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/type-alias-casting",component:f("/basic/type-alias-casting","dbf"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/unrecoverable-panic-error",component:f("/basic/unrecoverable-panic-error","445"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/use",component:f("/basic/use","f71"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/variabel",component:f("/basic/variabel","21b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/vector",component:f("/basic/vector","4d7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/basic/visibility-privacy",component:f("/basic/visibility-privacy","794"),exact:!0,sidebar:"tutorialSidebar"},{path:"/CHANGELOG",component:f("/CHANGELOG","c6e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/CONTRIBUTING",component:f("/CONTRIBUTING","93d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/download-pdf",component:f("/download-pdf","a82"),exact:!0,sidebar:"tutorialSidebar"},{path:"/installation/instalasi-rust",component:f("/installation/instalasi-rust","e6a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/installation/rust-editor-plugin",component:f("/installation/rust-editor-plugin","a9b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/LICENSE",component:f("/LICENSE","67b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/pengelanan-rust-programming",component:f("/pengelanan-rust-programming","aab"),exact:!0,sidebar:"tutorialSidebar"}]},{path:"*",component:f("*")}]},8934:(e,t,n)=>{"use strict";n.d(t,{_:()=>a,t:()=>o});var r=n(7294);const a=r.createContext(!1);function o(e){let{children:t}=e;const[n,o]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{o(!0)}),[]),r.createElement(a.Provider,{value:n},t)}},9383:(e,t,n)=>{"use strict";var r=n(7294),a=n(3935),o=n(3727),i=n(405),l=n(412);const s=[n(6657),n(2497),n(3310),n(8320),n(8049),n(6882)];var c=n(723),u=n(6775),d=n(8790);function f(e){let{children:t}=e;return r.createElement(r.Fragment,null,t)}var p=n(7462),m=n(5742),h=n(2263),g=n(4996),b=n(6668),v=n(833),y=n(4711),w=n(9727),E=n(3320),k=n(197);function S(){const{i18n:{defaultLocale:e,localeConfigs:t}}=(0,h.Z)(),n=(0,y.l)();return r.createElement(m.Z,null,Object.entries(t).map((e=>{let[t,{htmlLang:a}]=e;return r.createElement("link",{key:t,rel:"alternate",href:n.createUrl({locale:t,fullyQualified:!0}),hrefLang:a})})),r.createElement("link",{rel:"alternate",href:n.createUrl({locale:e,fullyQualified:!0}),hrefLang:"x-default"}))}function _(e){let{permalink:t}=e;const{siteConfig:{url:n}}=(0,h.Z)(),a=function(){const{siteConfig:{url:e}}=(0,h.Z)(),{pathname:t}=(0,u.TH)();return e+(0,g.Z)(t)}(),o=t?`${n}${t}`:a;return r.createElement(m.Z,null,r.createElement("meta",{property:"og:url",content:o}),r.createElement("link",{rel:"canonical",href:o}))}function x(){const{i18n:{currentLocale:e}}=(0,h.Z)(),{metadata:t,image:n}=(0,b.L)();return r.createElement(r.Fragment,null,r.createElement(m.Z,null,r.createElement("meta",{name:"twitter:card",content:"summary_large_image"}),r.createElement("body",{className:w.h})),n&&r.createElement(v.d,{image:n}),r.createElement(_,null),r.createElement(S,null),r.createElement(k.Z,{tag:E.HX,locale:e}),r.createElement(m.Z,null,t.map(((e,t)=>r.createElement("meta",(0,p.Z)({key:t},e))))))}const T=new Map;function C(e){if(T.has(e.pathname))return{...e,pathname:T.get(e.pathname)};if((0,d.f)(c.Z,e.pathname).some((e=>{let{route:t}=e;return!0===t.exact})))return T.set(e.pathname,e.pathname),e;const t=e.pathname.trim().replace(/(?:\/index)?\.html$/,"")||"/";return T.set(e.pathname,t),{...e,pathname:t}}var A=n(8934),N=n(8940);function O(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];const a=s.map((t=>{var r;const a=(null==(r=t.default)?void 0:r[e])??t[e];return null==a?void 0:a(...n)}));return()=>a.forEach((e=>null==e?void 0:e()))}const L=function(e){let{children:t,location:n,previousLocation:a}=e;return(0,r.useLayoutEffect)((()=>{a!==n&&(a&&function(e){const{hash:t}=e;if(t){const e=decodeURIComponent(t.substring(1)),n=document.getElementById(e);null==n||n.scrollIntoView()}else window.scrollTo(0,0)}(n),O("onRouteDidUpdate",{previousLocation:a,location:n}))}),[a,n]),t};function I(e){const t=Array.from(new Set([e,decodeURI(e)])).map((e=>(0,d.f)(c.Z,e))).flat();return Promise.all(t.map((e=>null==e.route.component.preload?void 0:e.route.component.preload())))}class P extends r.Component{constructor(e){super(e),this.previousLocation=void 0,this.routeUpdateCleanupCb=void 0,this.previousLocation=null,this.routeUpdateCleanupCb=l.Z.canUseDOM?O("onRouteUpdate",{previousLocation:null,location:this.props.location}):()=>{},this.state={nextRouteHasLoaded:!0}}shouldComponentUpdate(e,t){if(e.location===this.props.location)return t.nextRouteHasLoaded;const n=e.location;return this.previousLocation=this.props.location,this.setState({nextRouteHasLoaded:!1}),this.routeUpdateCleanupCb=O("onRouteUpdate",{previousLocation:this.previousLocation,location:n}),I(n.pathname).then((()=>{this.routeUpdateCleanupCb(),this.setState({nextRouteHasLoaded:!0})})).catch((e=>{console.warn(e),window.location.reload()})),!1}render(){const{children:e,location:t}=this.props;return r.createElement(L,{previousLocation:this.previousLocation,location:t},r.createElement(u.AW,{location:t,render:()=>e}))}}const R=P,M="docusaurus-base-url-issue-banner-container",D="docusaurus-base-url-issue-banner-suggestion-container",F="__DOCUSAURUS_INSERT_BASEURL_BANNER";function B(e){return`\nwindow['${F}'] = true;\n\ndocument.addEventListener('DOMContentLoaded', maybeInsertBanner);\n\nfunction maybeInsertBanner() {\n var shouldInsert = window['${F}'];\n shouldInsert && insertBanner();\n}\n\nfunction insertBanner() {\n var bannerContainer = document.getElementById('${M}');\n if (!bannerContainer) {\n return;\n }\n var bannerHtml = ${JSON.stringify(function(e){return`\n<div id="docusaurus-base-url-issue-banner" style="border: thick solid red; background-color: rgb(255, 230, 179); margin: 20px; padding: 20px; font-size: 20px;">\n <p style="font-weight: bold; font-size: 30px;">Your Docusaurus site did not load properly.</p>\n <p>A very common reason is a wrong site <a href="https://docusaurus.io/docs/docusaurus.config.js/#baseurl" style="font-weight: bold;">baseUrl configuration</a>.</p>\n <p>Current configured baseUrl = <span style="font-weight: bold; color: red;">${e}</span> ${"/"===e?" (default value)":""}</p>\n <p>We suggest trying baseUrl = <span id="${D}" style="font-weight: bold; color: green;"></span></p>\n</div>\n`}(e)).replace(/</g,"\\<")};\n bannerContainer.innerHTML = bannerHtml;\n var suggestionContainer = document.getElementById('${D}');\n var actualHomePagePath = window.location.pathname;\n var suggestedBaseUrl = actualHomePagePath.substr(-1) === '/'\n ? actualHomePagePath\n : actualHomePagePath + '/';\n suggestionContainer.innerHTML = suggestedBaseUrl;\n}\n`}function $(){const{siteConfig:{baseUrl:e}}=(0,h.Z)();return(0,r.useLayoutEffect)((()=>{window[F]=!1}),[]),r.createElement(r.Fragment,null,!l.Z.canUseDOM&&r.createElement(m.Z,null,r.createElement("script",null,B(e))),r.createElement("div",{id:M}))}function U(){const{siteConfig:{baseUrl:e,baseUrlIssueBanner:t}}=(0,h.Z)(),{pathname:n}=(0,u.TH)();return t&&n===e?r.createElement($,null):null}function z(){const{siteConfig:{favicon:e,title:t,noIndex:n},i18n:{currentLocale:a,localeConfigs:o}}=(0,h.Z)(),i=(0,g.Z)(e),{htmlLang:l,direction:s}=o[a];return r.createElement(m.Z,null,r.createElement("html",{lang:l,dir:s}),r.createElement("title",null,t),r.createElement("meta",{property:"og:title",content:t}),r.createElement("meta",{name:"viewport",content:"width=device-width, initial-scale=1.0"}),n&&r.createElement("meta",{name:"robots",content:"noindex, nofollow"}),e&&r.createElement("link",{rel:"icon",href:i}))}var j=n(4763);function H(){const e=(0,d.H)(c.Z),t=(0,u.TH)();return r.createElement(j.Z,null,r.createElement(N.M,null,r.createElement(A.t,null,r.createElement(f,null,r.createElement(z,null),r.createElement(x,null),r.createElement(U,null),r.createElement(R,{location:C(t)},e)))))}var Z=n(6887);const G=function(e){try{return document.createElement("link").relList.supports(e)}catch{return!1}}("prefetch")?function(e){return new Promise(((t,n)=>{var r;if("undefined"==typeof document)return void n();const a=document.createElement("link");a.setAttribute("rel","prefetch"),a.setAttribute("href",e),a.onload=()=>t(),a.onerror=()=>n();const o=document.getElementsByTagName("head")[0]??(null==(r=document.getElementsByName("script")[0])?void 0:r.parentNode);null==o||o.appendChild(a)}))}:function(e){return new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open("GET",e,!0),r.withCredentials=!0,r.onload=()=>{200===r.status?t():n()},r.send(null)}))};var V=n(9670);const W=new Set,q=new Set,Y=()=>{var e,t;return(null==(e=navigator.connection)?void 0:e.effectiveType.includes("2g"))||(null==(t=navigator.connection)?void 0:t.saveData)},K={prefetch(e){if(!(e=>!Y()&&!q.has(e)&&!W.has(e))(e))return!1;W.add(e);const t=(0,d.f)(c.Z,e).flatMap((e=>{return t=e.route.path,Object.entries(Z).filter((e=>{let[n]=e;return n.replace(/-[^-]+$/,"")===t})).flatMap((e=>{let[,t]=e;return Object.values((0,V.Z)(t))}));var t}));return Promise.all(t.map((e=>{const t=n.gca(e);return t&&!t.includes("undefined")?G(t).catch((()=>{})):Promise.resolve()})))},preload:e=>!!(e=>!Y()&&!q.has(e))(e)&&(q.add(e),I(e))},X=Object.freeze(K);if(l.Z.canUseDOM){window.docusaurus=X;const e=a.hydrate;I(window.location.pathname).then((()=>{e(r.createElement(i.B6,null,r.createElement(o.VK,null,r.createElement(H,null))),document.getElementById("__docusaurus"))}))}},8940:(e,t,n)=>{"use strict";n.d(t,{_:()=>u,M:()=>d});var r=n(7294),a=n(6809);const o=JSON.parse('{"docusaurus-plugin-google-gtag":{"default":{"trackingID":"G-HKPC8ZGM74","anonymizeIP":false,"id":"default"}},"docusaurus-plugin-content-docs":{"default":{"path":"/","versions":[{"name":"current","label":"Next","isLast":true,"path":"/","mainDocId":"index","docs":[{"id":"basic/advanced-traits","path":"/basic/advanced-traits","sidebar":"tutorialSidebar"},{"id":"basic/array","path":"/basic/array","sidebar":"tutorialSidebar"},{"id":"basic/associated-function","path":"/basic/associated-function","sidebar":"tutorialSidebar"},{"id":"basic/attributes","path":"/basic/attributes","sidebar":"tutorialSidebar"},{"id":"basic/basic-memory-management","path":"/basic/basic-memory-management","sidebar":"tutorialSidebar"},{"id":"basic/block-expression","path":"/basic/block-expression","sidebar":"tutorialSidebar"},{"id":"basic/borrowing","path":"/basic/borrowing","sidebar":"tutorialSidebar"},{"id":"basic/build-dan-run-program-rust","path":"/basic/build-dan-run-program-rust","sidebar":"tutorialSidebar"},{"id":"basic/closures","path":"/basic/closures","sidebar":"tutorialSidebar"},{"id":"basic/datetime","path":"/basic/datetime","sidebar":"tutorialSidebar"},{"id":"basic/enum","path":"/basic/enum","sidebar":"tutorialSidebar"},{"id":"basic/file-path-directory","path":"/basic/file-path-directory","sidebar":"tutorialSidebar"},{"id":"basic/function","path":"/basic/function","sidebar":"tutorialSidebar"},{"id":"basic/generics","path":"/basic/generics","sidebar":"tutorialSidebar"},{"id":"basic/hello-rust","path":"/basic/hello-rust","sidebar":"tutorialSidebar"},{"id":"basic/komentar","path":"/basic/komentar","sidebar":"tutorialSidebar"},{"id":"basic/konstanta","path":"/basic/konstanta","sidebar":"tutorialSidebar"},{"id":"basic/lifetime","path":"/basic/lifetime","sidebar":"tutorialSidebar"},{"id":"basic/method","path":"/basic/method","sidebar":"tutorialSidebar"},{"id":"basic/module-basic","path":"/basic/module-basic","sidebar":"tutorialSidebar"},{"id":"basic/module-inline","path":"/basic/module-inline","sidebar":"tutorialSidebar"},{"id":"basic/module-scope-item-access","path":"/basic/module-scope-item-access","sidebar":"tutorialSidebar"},{"id":"basic/operator","path":"/basic/operator","sidebar":"tutorialSidebar"},{"id":"basic/operator-tanda-tanya","path":"/basic/operator-tanda-tanya","sidebar":"tutorialSidebar"},{"id":"basic/option-type","path":"/basic/option-type","sidebar":"tutorialSidebar"},{"id":"basic/ownership","path":"/basic/ownership","sidebar":"tutorialSidebar"},{"id":"basic/package-crate","path":"/basic/package-crate","sidebar":"tutorialSidebar"},{"id":"basic/path-item","path":"/basic/path-item","sidebar":"tutorialSidebar"},{"id":"basic/pattern-matching","path":"/basic/pattern-matching","sidebar":"tutorialSidebar"},{"id":"basic/perulangan-for-in","path":"/basic/perulangan-for-in","sidebar":"tutorialSidebar"},{"id":"basic/perulangan-loop-break-continue-label","path":"/basic/perulangan-loop-break-continue-label","sidebar":"tutorialSidebar"},{"id":"basic/perulangan-while","path":"/basic/perulangan-while","sidebar":"tutorialSidebar"},{"id":"basic/pointer-references","path":"/basic/pointer-references","sidebar":"tutorialSidebar"},{"id":"basic/recoverable-error-handling","path":"/basic/recoverable-error-handling","sidebar":"tutorialSidebar"},{"id":"basic/result-type","path":"/basic/result-type","sidebar":"tutorialSidebar"},{"id":"basic/seleksi-kondisi-if","path":"/basic/seleksi-kondisi-if","sidebar":"tutorialSidebar"},{"id":"basic/shadowing","path":"/basic/shadowing","sidebar":"tutorialSidebar"},{"id":"basic/slice","path":"/basic/slice","sidebar":"tutorialSidebar"},{"id":"basic/slice-memory-management","path":"/basic/slice-memory-management","sidebar":"tutorialSidebar"},{"id":"basic/static","path":"/basic/static","sidebar":"tutorialSidebar"},{"id":"basic/string-slice-vs-string-literal","path":"/basic/string-slice-vs-string-literal","sidebar":"tutorialSidebar"},{"id":"basic/struct","path":"/basic/struct","sidebar":"tutorialSidebar"},{"id":"basic/tipe-data-custom-type-string-slice","path":"/basic/tipe-data-custom-type-string-slice","sidebar":"tutorialSidebar"},{"id":"basic/tipe-data-primitive-scalar","path":"/basic/tipe-data-primitive-scalar","sidebar":"tutorialSidebar"},{"id":"basic/tipe-data-string-literal","path":"/basic/tipe-data-string-literal","sidebar":"tutorialSidebar"},{"id":"basic/trait-function","path":"/basic/trait-function","sidebar":"tutorialSidebar"},{"id":"basic/trait-iterator","path":"/basic/trait-iterator","sidebar":"tutorialSidebar"},{"id":"basic/traits","path":"/basic/traits","sidebar":"tutorialSidebar"},{"id":"basic/tuple","path":"/basic/tuple","sidebar":"tutorialSidebar"},{"id":"basic/type-alias-casting","path":"/basic/type-alias-casting","sidebar":"tutorialSidebar"},{"id":"basic/unrecoverable-panic-error","path":"/basic/unrecoverable-panic-error","sidebar":"tutorialSidebar"},{"id":"basic/use","path":"/basic/use","sidebar":"tutorialSidebar"},{"id":"basic/variabel","path":"/basic/variabel","sidebar":"tutorialSidebar"},{"id":"basic/vector","path":"/basic/vector","sidebar":"tutorialSidebar"},{"id":"basic/visibility-privacy","path":"/basic/visibility-privacy","sidebar":"tutorialSidebar"},{"id":"CHANGELOG","path":"/CHANGELOG","sidebar":"tutorialSidebar"},{"id":"CONTRIBUTING","path":"/CONTRIBUTING","sidebar":"tutorialSidebar"},{"id":"download-pdf","path":"/download-pdf","sidebar":"tutorialSidebar"},{"id":"index","path":"/","sidebar":"tutorialSidebar"},{"id":"installation/instalasi-rust","path":"/installation/instalasi-rust","sidebar":"tutorialSidebar"},{"id":"installation/rust-editor-plugin","path":"/installation/rust-editor-plugin","sidebar":"tutorialSidebar"},{"id":"LICENSE","path":"/LICENSE","sidebar":"tutorialSidebar"},{"id":"pengelanan-rust-programming","path":"/pengelanan-rust-programming","sidebar":"tutorialSidebar"}],"draftIds":[],"sidebars":{"tutorialSidebar":{"link":{"path":"/","label":"Dasar Pemrograman Rust"}}}}],"breadcrumbs":true}}}'),i=JSON.parse('{"defaultLocale":"id","locales":["id"],"path":"i18n","currentLocale":"id","localeConfigs":{"id":{"label":"Indonesia","direction":"ltr","htmlLang":"id","calendar":"gregory","path":"id"}}}');var l=n(7529);const s=JSON.parse('{"docusaurusVersion":"2.2.0","siteVersion":"0.0.0","pluginVersions":{"docusaurus-plugin-content-docs":{"type":"package","name":"@docusaurus/plugin-content-docs","version":"2.2.0"},"docusaurus-plugin-content-pages":{"type":"package","name":"@docusaurus/plugin-content-pages","version":"2.2.0"},"docusaurus-plugin-google-gtag":{"type":"package","name":"@docusaurus/plugin-google-gtag","version":"2.2.0"},"docusaurus-plugin-sitemap":{"type":"package","name":"@docusaurus/plugin-sitemap","version":"2.2.0"},"docusaurus-theme-classic":{"type":"package","name":"@docusaurus/theme-classic","version":"2.2.0"},"docusaurus-theme-search-algolia":{"type":"package","name":"@docusaurus/theme-search-algolia","version":"2.2.0"},"docusaurus-plugin-structured-data":{"type":"package","name":"@stackql/docusaurus-plugin-structured-data","version":"1.3.1"}}}'),c={siteConfig:a.default,siteMetadata:s,globalData:o,i18n:i,codeTranslations:l},u=r.createContext(c);function d(e){let{children:t}=e;return r.createElement(u.Provider,{value:c},t)}},4763:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(7294),a=n(412),o=n(5742),i=n(5705);function l(e){let{error:t,tryAgain:n}=e;return r.createElement("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",height:"50vh",width:"100%",fontSize:"20px"}},r.createElement("h1",null,"This page crashed."),r.createElement("p",null,t.message),r.createElement("button",{type:"button",onClick:n},"Try again"))}function s(e){let{error:t,tryAgain:n}=e;return r.createElement(u,{fallback:()=>r.createElement(l,{error:t,tryAgain:n})},r.createElement(o.Z,null,r.createElement("title",null,"Page Error")),r.createElement(i.Z,null,r.createElement(l,{error:t,tryAgain:n})))}const c=e=>r.createElement(s,e);class u extends r.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){a.Z.canUseDOM&&this.setState({error:e})}render(){const{children:e}=this.props,{error:t}=this.state;if(t){const e={error:t,tryAgain:()=>this.setState({error:null})};return(this.props.fallback??c)(e)}return e??null}}},412:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});const r="undefined"!=typeof window&&"document"in window&&"createElement"in window.document,a={canUseDOM:r,canUseEventListeners:r&&("addEventListener"in window||"attachEvent"in window),canUseIntersectionObserver:r&&"IntersectionObserver"in window,canUseViewport:r&&"screen"in window}},5742:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(7294),a=n(405);function o(e){return r.createElement(a.ql,e)}},9960:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(7462),a=n(7294),o=n(3727),i=n(8780),l=n(2263),s=n(3919),c=n(412);const u=a.createContext({collectLink:()=>{}});var d=n(4996);function f(e,t){var n;let{isNavLink:f,to:p,href:m,activeClassName:h,isActive:g,"data-noBrokenLinkCheck":b,autoAddBaseUrl:v=!0,...y}=e;const{siteConfig:{trailingSlash:w,baseUrl:E}}=(0,l.Z)(),{withBaseUrl:k}=(0,d.C)(),S=(0,a.useContext)(u),_=(0,a.useRef)(null);(0,a.useImperativeHandle)(t,(()=>_.current));const x=p||m;const T=(0,s.Z)(x),C=null==x?void 0:x.replace("pathname://","");let A=void 0!==C?(N=C,v&&(e=>e.startsWith("/"))(N)?k(N):N):void 0;var N;A&&T&&(A=(0,i.applyTrailingSlash)(A,{trailingSlash:w,baseUrl:E}));const O=(0,a.useRef)(!1),L=f?o.OL:o.rU,I=c.Z.canUseIntersectionObserver,P=(0,a.useRef)(),R=()=>{O.current||null==A||(window.docusaurus.preload(A),O.current=!0)};(0,a.useEffect)((()=>(!I&&T&&null!=A&&window.docusaurus.prefetch(A),()=>{I&&P.current&&P.current.disconnect()})),[P,A,I,T]);const M=(null==(n=A)?void 0:n.startsWith("#"))??!1,D=!A||!T||M;return D||b||S.collectLink(A),D?a.createElement("a",(0,r.Z)({ref:_,href:A},x&&!T&&{target:"_blank",rel:"noopener noreferrer"},y)):a.createElement(L,(0,r.Z)({},y,{onMouseEnter:R,onTouchStart:R,innerRef:e=>{_.current=e,I&&e&&T&&(P.current=new window.IntersectionObserver((t=>{t.forEach((t=>{e===t.target&&(t.isIntersecting||t.intersectionRatio>0)&&(P.current.unobserve(e),P.current.disconnect(),null!=A&&window.docusaurus.prefetch(A))}))})),P.current.observe(e))},to:A},f&&{isActive:g,activeClassName:h}))}const p=a.forwardRef(f)},5999:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s,I:()=>l});var r=n(7294);function a(e,t){const n=e.split(/(\{\w+\})/).map(((e,n)=>{if(n%2==1){const n=null==t?void 0:t[e.slice(1,-1)];if(void 0!==n)return n}return e}));return n.some((e=>(0,r.isValidElement)(e)))?n.map(((e,t)=>(0,r.isValidElement)(e)?r.cloneElement(e,{key:t}):e)).filter((e=>""!==e)):n.join("")}var o=n(7529);function i(e){let{id:t,message:n}=e;if(void 0===t&&void 0===n)throw new Error("Docusaurus translation declarations must have at least a translation id or a default translation message");return o[t??n]??n??t}function l(e,t){let{message:n,id:r}=e;return a(i({message:n,id:r}),t)}function s(e){let{children:t,id:n,values:o}=e;if(t&&"string"!=typeof t)throw console.warn("Illegal <Translate> children",t),new Error("The Docusaurus <Translate> component only accept simple string values");const l=i({message:t,id:n});return r.createElement(r.Fragment,null,a(l,o))}},9935:(e,t,n)=>{"use strict";n.d(t,{m:()=>r});const r="default"},3919:(e,t,n)=>{"use strict";function r(e){return/^(?:\w*:|\/\/)/.test(e)}function a(e){return void 0!==e&&!r(e)}n.d(t,{Z:()=>a,b:()=>r})},4996:(e,t,n)=>{"use strict";n.d(t,{C:()=>o,Z:()=>i});var r=n(2263),a=n(3919);function o(){const{siteConfig:{baseUrl:e,url:t}}=(0,r.Z)();return{withBaseUrl:(n,r)=>function(e,t,n,r){let{forcePrependBaseUrl:o=!1,absolute:i=!1}=void 0===r?{}:r;if(!n||n.startsWith("#")||(0,a.b)(n))return n;if(o)return t+n.replace(/^\//,"");if(n===t.replace(/\/$/,""))return t;const l=n.startsWith(t)?n:t+n.replace(/^\//,"");return i?e+l:l}(t,e,n,r)}}function i(e,t){void 0===t&&(t={});const{withBaseUrl:n}=o();return n(e,t)}},2263:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(7294),a=n(8940);function o(){return(0,r.useContext)(a._)}},2389:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(7294),a=n(8934);function o(){return(0,r.useContext)(a._)}},9670:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});function r(e){const t={};return function e(n,r){Object.entries(n).forEach((n=>{let[a,o]=n;const i=r?`${r}.${a}`:a;var l;"object"==typeof(l=o)&&l&&Object.keys(l).length>0?e(o,i):t[i]=o}))}(e),t}},226:(e,t,n)=>{"use strict";n.d(t,{_:()=>a,z:()=>o});var r=n(7294);const a=r.createContext(null);function o(e){let{children:t,value:n}=e;const o=r.useContext(a),i=(0,r.useMemo)((()=>function(e){let{parent:t,value:n}=e;if(!t){if(!n)throw new Error("Unexpected: no Docusaurus route context found");if(!("plugin"in n))throw new Error("Unexpected: Docusaurus topmost route context has no `plugin` attribute");return n}const r={...t.data,...null==n?void 0:n.data};return{plugin:t.plugin,data:r}}({parent:o,value:n})),[o,n]);return r.createElement(a.Provider,{value:i},t)}},143:(e,t,n)=>{"use strict";n.d(t,{Iw:()=>b,gA:()=>p,WS:()=>m,_r:()=>d,Jo:()=>v,zh:()=>f,yW:()=>g,gB:()=>h});var r=n(6775),a=n(2263),o=n(9935);function i(e,t){void 0===t&&(t={});const n=function(){const{globalData:e}=(0,a.Z)();return e}()[e];if(!n&&t.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin.`);return n}const l=e=>e.versions.find((e=>e.isLast));function s(e,t){const n=l(e);return[...e.versions.filter((e=>e!==n)),n].find((e=>!!(0,r.LX)(t,{path:e.path,exact:!1,strict:!1})))}function c(e,t){const n=s(e,t),a=null==n?void 0:n.docs.find((e=>!!(0,r.LX)(t,{path:e.path,exact:!0,strict:!1})));return{activeVersion:n,activeDoc:a,alternateDocVersions:a?function(t){const n={};return e.versions.forEach((e=>{e.docs.forEach((r=>{r.id===t&&(n[e.name]=r)}))})),n}(a.id):{}}}const u={},d=()=>i("docusaurus-plugin-content-docs")??u,f=e=>function(e,t,n){void 0===t&&(t=o.m),void 0===n&&(n={});const r=i(e),a=null==r?void 0:r[t];if(!a&&n.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin with id "${t}".`);return a}("docusaurus-plugin-content-docs",e,{failfast:!0});function p(e){void 0===e&&(e={});const t=d(),{pathname:n}=(0,r.TH)();return function(e,t,n){void 0===n&&(n={});const a=Object.entries(e).sort(((e,t)=>t[1].path.localeCompare(e[1].path))).find((e=>{let[,n]=e;return!!(0,r.LX)(t,{path:n.path,exact:!1,strict:!1})})),o=a?{pluginId:a[0],pluginData:a[1]}:void 0;if(!o&&n.failfast)throw new Error(`Can't find active docs plugin for "${t}" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: ${Object.values(e).map((e=>e.path)).join(", ")}`);return o}(t,n,e)}function m(e){void 0===e&&(e={});const t=p(e),{pathname:n}=(0,r.TH)();if(!t)return;return{activePlugin:t,activeVersion:s(t.pluginData,n)}}function h(e){return f(e).versions}function g(e){const t=f(e);return l(t)}function b(e){const t=f(e),{pathname:n}=(0,r.TH)();return c(t,n)}function v(e){const t=f(e),{pathname:n}=(0,r.TH)();return function(e,t){const n=l(e);return{latestDocSuggestion:c(e,t).alternateDocVersions[n.name],latestVersionSuggestion:n}}(t,n)}},6657:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r});const r={onRouteDidUpdate(e){let{location:t,previousLocation:n}=e;!n||t.pathname===n.pathname&&t.search===n.search&&t.hash===n.hash||setTimeout((()=>{window.gtag("event","page_view",{page_title:document.title,page_location:window.location.href,page_path:t.pathname+t.search+t.hash})}))}}},8320:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>o});var r=n(4865),a=n.n(r);a().configure({showSpinner:!1});const o={onRouteUpdate(e){let{location:t,previousLocation:n}=e;if(n&&t.pathname!==n.pathname){const e=window.setTimeout((()=>{a().start()}),200);return()=>window.clearTimeout(e)}},onRouteDidUpdate(){a().done()}}},3310:(e,t,n)=>{"use strict";n.r(t);var r=n(7410),a=n(6809);!function(e){const{themeConfig:{prism:t}}=a.default,{additionalLanguages:r}=t;globalThis.Prism=e,r.forEach((e=>{n(6991)(`./prism-${e}`)})),delete globalThis.Prism}(r.Z)},9471:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(7294);const a="iconExternalLink_nPIU";function o(e){let{width:t=13.5,height:n=13.5}=e;return r.createElement("svg",{width:t,height:n,"aria-hidden":"true",viewBox:"0 0 24 24",className:a},r.createElement("path",{fill:"currentColor",d:"M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"}))}},5705:(e,t,n)=>{"use strict";n.d(t,{Z:()=>Nt});var r=n(7294),a=n(6010),o=n(4763),i=n(833),l=n(7462),s=n(6775),c=n(5999),u=n(5936);const d="docusaurus_skipToContent_fallback";function f(e){e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")}function p(){const e=(0,r.useRef)(null),{action:t}=(0,s.k6)(),n=(0,r.useCallback)((e=>{e.preventDefault();const t=document.querySelector("main:first-of-type")??document.getElementById(d);t&&f(t)}),[]);return(0,u.S)((n=>{let{location:r}=n;e.current&&!r.hash&&"PUSH"===t&&f(e.current)})),{containerRef:e,onClick:n}}const m=(0,c.I)({id:"theme.common.skipToMainContent",description:"The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation",message:"Skip to main content"});function h(e){const t=e.children??m,{containerRef:n,onClick:a}=p();return r.createElement("div",{ref:n,role:"region","aria-label":m},r.createElement("a",(0,l.Z)({},e,{href:`#${d}`,onClick:a}),t))}var g=n(5281),b=n(9727);const v="skipToContent_fXgn";function y(){return r.createElement(h,{className:v})}var w=n(6668),E=n(9689);function k(e){let{width:t=21,height:n=21,color:a="currentColor",strokeWidth:o=1.2,className:i,...s}=e;return r.createElement("svg",(0,l.Z)({viewBox:"0 0 15 15",width:t,height:n},s),r.createElement("g",{stroke:a,strokeWidth:o},r.createElement("path",{d:"M.75.75l13.5 13.5M14.25.75L.75 14.25"})))}const S="closeButton_CVFx";function _(e){return r.createElement("button",(0,l.Z)({type:"button","aria-label":(0,c.I)({id:"theme.AnnouncementBar.closeButtonAriaLabel",message:"Close",description:"The ARIA label for close button of announcement bar"})},e,{className:(0,a.Z)("clean-btn close",S,e.className)}),r.createElement(k,{width:14,height:14,strokeWidth:3.1}))}const x="content_knG7";function T(e){const{announcementBar:t}=(0,w.L)(),{content:n}=t;return r.createElement("div",(0,l.Z)({},e,{className:(0,a.Z)(x,e.className),dangerouslySetInnerHTML:{__html:n}}))}const C="announcementBar_mb4j",A="announcementBarPlaceholder_vyr4",N="announcementBarClose_gvF7",O="announcementBarContent_xLdY";function L(){const{announcementBar:e}=(0,w.L)(),{isActive:t,close:n}=(0,E.nT)();if(!t)return null;const{backgroundColor:a,textColor:o,isCloseable:i}=e;return r.createElement("div",{className:C,style:{backgroundColor:a,color:o},role:"banner"},i&&r.createElement("div",{className:A}),r.createElement(T,{className:O}),i&&r.createElement(_,{onClick:n,className:N}))}var I=n(2961),P=n(2466);var R=n(902),M=n(3102);const D=r.createContext(null);function F(e){let{children:t}=e;const n=function(){const e=(0,I.e)(),t=(0,M.HY)(),[n,a]=(0,r.useState)(!1),o=null!==t.component,i=(0,R.D9)(o);return(0,r.useEffect)((()=>{o&&!i&&a(!0)}),[o,i]),(0,r.useEffect)((()=>{o?e.shown||a(!0):a(!1)}),[e.shown,o]),(0,r.useMemo)((()=>[n,a]),[n])}();return r.createElement(D.Provider,{value:n},t)}function B(e){if(e.component){const t=e.component;return r.createElement(t,e.props)}}function $(){const e=(0,r.useContext)(D);if(!e)throw new R.i6("NavbarSecondaryMenuDisplayProvider");const[t,n]=e,a=(0,r.useCallback)((()=>n(!1)),[n]),o=(0,M.HY)();return(0,r.useMemo)((()=>({shown:t,hide:a,content:B(o)})),[a,o,t])}function U(e){let{header:t,primaryMenu:n,secondaryMenu:o}=e;const{shown:i}=$();return r.createElement("div",{className:"navbar-sidebar"},t,r.createElement("div",{className:(0,a.Z)("navbar-sidebar__items",{"navbar-sidebar__items--show-secondary":i})},r.createElement("div",{className:"navbar-sidebar__item menu"},n),r.createElement("div",{className:"navbar-sidebar__item menu"},o)))}var z=n(2949),j=n(2389);function H(e){return r.createElement("svg",(0,l.Z)({viewBox:"0 0 24 24",width:24,height:24},e),r.createElement("path",{fill:"currentColor",d:"M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"}))}function Z(e){return r.createElement("svg",(0,l.Z)({viewBox:"0 0 24 24",width:24,height:24},e),r.createElement("path",{fill:"currentColor",d:"M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"}))}const G={toggle:"toggle_vylO",toggleButton:"toggleButton_gllP",darkToggleIcon:"darkToggleIcon_wfgR",lightToggleIcon:"lightToggleIcon_pyhR",toggleButtonDisabled:"toggleButtonDisabled_aARS"};function V(e){let{className:t,value:n,onChange:o}=e;const i=(0,j.Z)(),l=(0,c.I)({message:"Switch between dark and light mode (currently {mode})",id:"theme.colorToggle.ariaLabel",description:"The ARIA label for the navbar color mode toggle"},{mode:"dark"===n?(0,c.I)({message:"dark mode",id:"theme.colorToggle.ariaLabel.mode.dark",description:"The name for the dark color mode"}):(0,c.I)({message:"light mode",id:"theme.colorToggle.ariaLabel.mode.light",description:"The name for the light color mode"})});return r.createElement("div",{className:(0,a.Z)(G.toggle,t)},r.createElement("button",{className:(0,a.Z)("clean-btn",G.toggleButton,!i&&G.toggleButtonDisabled),type:"button",onClick:()=>o("dark"===n?"light":"dark"),disabled:!i,title:l,"aria-label":l,"aria-live":"polite"},r.createElement(H,{className:(0,a.Z)(G.toggleIcon,G.lightToggleIcon)}),r.createElement(Z,{className:(0,a.Z)(G.toggleIcon,G.darkToggleIcon)})))}const W=r.memo(V);function q(e){let{className:t}=e;const n=(0,w.L)().colorMode.disableSwitch,{colorMode:a,setColorMode:o}=(0,z.I)();return n?null:r.createElement(W,{className:t,value:a,onChange:o})}var Y=n(1327);function K(){return r.createElement(Y.Z,{className:"navbar__brand",imageClassName:"navbar__logo",titleClassName:"navbar__title text--truncate"})}function X(){const e=(0,I.e)();return r.createElement("button",{type:"button","aria-label":(0,c.I)({id:"theme.docs.sidebar.closeSidebarButtonAriaLabel",message:"Close navigation bar",description:"The ARIA label for close button of mobile sidebar"}),className:"clean-btn navbar-sidebar__close",onClick:()=>e.toggle()},r.createElement(k,{color:"var(--ifm-color-emphasis-600)"}))}function Q(){return r.createElement("div",{className:"navbar-sidebar__brand"},r.createElement(K,null),r.createElement(q,{className:"margin-right--md"}),r.createElement(X,null))}var J=n(9960),ee=n(4996),te=n(3919),ne=n(8022),re=n(9471);function ae(e){let{activeBasePath:t,activeBaseRegex:n,to:a,href:o,label:i,html:s,isDropdownLink:c,prependBaseUrlToHref:u,...d}=e;const f=(0,ee.Z)(a),p=(0,ee.Z)(t),m=(0,ee.Z)(o,{forcePrependBaseUrl:!0}),h=i&&o&&!(0,te.Z)(o),g=s?{dangerouslySetInnerHTML:{__html:s}}:{children:r.createElement(r.Fragment,null,i,h&&r.createElement(re.Z,c&&{width:12,height:12}))};return o?r.createElement(J.Z,(0,l.Z)({href:u?m:o},d,g)):r.createElement(J.Z,(0,l.Z)({to:f,isNavLink:!0},(t||n)&&{isActive:(e,t)=>n?(0,ne.F)(n,t.pathname):t.pathname.startsWith(p)},d,g))}function oe(e){let{className:t,isDropdownItem:n=!1,...o}=e;const i=r.createElement(ae,(0,l.Z)({className:(0,a.Z)(n?"dropdown__link":"navbar__item navbar__link",t),isDropdownLink:n},o));return n?r.createElement("li",null,i):i}function ie(e){let{className:t,isDropdownItem:n,...o}=e;return r.createElement("li",{className:"menu__list-item"},r.createElement(ae,(0,l.Z)({className:(0,a.Z)("menu__link",t)},o)))}function le(e){let{mobile:t=!1,position:n,...a}=e;const o=t?ie:oe;return r.createElement(o,(0,l.Z)({},a,{activeClassName:a.activeClassName??(t?"menu__link--active":"navbar__link--active")}))}var se=n(6043),ce=n(8596),ue=n(2263);function de(e,t){return e.some((e=>function(e,t){return!!(0,ce.Mg)(e.to,t)||!!(0,ne.F)(e.activeBaseRegex,t)||!(!e.activeBasePath||!t.startsWith(e.activeBasePath))}(e,t)))}function fe(e){let{items:t,position:n,className:o,onClick:i,...s}=e;const c=(0,r.useRef)(null),[u,d]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{const e=e=>{c.current&&!c.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}}),[c]),r.createElement("div",{ref:c,className:(0,a.Z)("navbar__item","dropdown","dropdown--hoverable",{"dropdown--right":"right"===n,"dropdown--show":u})},r.createElement(ae,(0,l.Z)({"aria-haspopup":"true","aria-expanded":u,role:"button",href:s.to?void 0:"#",className:(0,a.Z)("navbar__link",o)},s,{onClick:s.to?void 0:e=>e.preventDefault(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),d(!u))}}),s.children??s.label),r.createElement("ul",{className:"dropdown__menu"},t.map(((e,n)=>r.createElement(Ze,(0,l.Z)({isDropdownItem:!0,onKeyDown:e=>{if(n===t.length-1&&"Tab"===e.key){e.preventDefault(),d(!1);const t=c.current.nextElementSibling;if(t){(t instanceof HTMLAnchorElement?t:t.querySelector("a")).focus()}}},activeClassName:"dropdown__link--active"},e,{key:n}))))))}function pe(e){let{items:t,className:n,position:o,onClick:i,...c}=e;const u=function(){const{siteConfig:{baseUrl:e}}=(0,ue.Z)(),{pathname:t}=(0,s.TH)();return t.replace(e,"/")}(),d=de(t,u),{collapsed:f,toggleCollapsed:p,setCollapsed:m}=(0,se.u)({initialState:()=>!d});return(0,r.useEffect)((()=>{d&&m(!d)}),[u,d,m]),r.createElement("li",{className:(0,a.Z)("menu__list-item",{"menu__list-item--collapsed":f})},r.createElement(ae,(0,l.Z)({role:"button",className:(0,a.Z)("menu__link menu__link--sublist menu__link--sublist-caret",n)},c,{onClick:e=>{e.preventDefault(),p()}}),c.children??c.label),r.createElement(se.z,{lazy:!0,as:"ul",className:"menu__list",collapsed:f},t.map(((e,t)=>r.createElement(Ze,(0,l.Z)({mobile:!0,isDropdownItem:!0,onClick:i,activeClassName:"menu__link--active"},e,{key:t}))))))}function me(e){let{mobile:t=!1,...n}=e;const a=t?pe:fe;return r.createElement(a,n)}var he=n(4711);function ge(e){let{width:t=20,height:n=20,...a}=e;return r.createElement("svg",(0,l.Z)({viewBox:"0 0 24 24",width:t,height:n,"aria-hidden":!0},a),r.createElement("path",{fill:"currentColor",d:"M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"}))}const be="iconLanguage_nlXk";var ve=n(3935),ye=n(5742),we=n(6177);function Ee(){return r.createElement("svg",{width:"15",height:"15",className:"DocSearch-Control-Key-Icon"},r.createElement("path",{d:"M4.505 4.496h2M5.505 5.496v5M8.216 4.496l.055 5.993M10 7.5c.333.333.5.667.5 1v2M12.326 4.5v5.996M8.384 4.496c1.674 0 2.116 0 2.116 1.5s-.442 1.5-2.116 1.5M3.205 9.303c-.09.448-.277 1.21-1.241 1.203C1 10.5.5 9.513.5 8V7c0-1.57.5-2.5 1.464-2.494.964.006 1.134.598 1.24 1.342M12.553 10.5h1.953",strokeWidth:"1.2",stroke:"currentColor",fill:"none",strokeLinecap:"square"}))}var ke=n(830),Se=["translations"];function _e(){return _e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_e.apply(this,arguments)}function xe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(s){l=!0,a=s}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Te(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ce(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var Ae="Ctrl";var Ne=r.forwardRef((function(e,t){var n=e.translations,a=void 0===n?{}:n,o=Ce(e,Se),i=a.buttonText,l=void 0===i?"Search":i,s=a.buttonAriaLabel,c=void 0===s?"Search":s,u=xe((0,r.useState)(null),2),d=u[0],f=u[1];return(0,r.useEffect)((function(){"undefined"!=typeof navigator&&(/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)?f("\u2318"):f(Ae))}),[]),r.createElement("button",_e({type:"button",className:"DocSearch DocSearch-Button","aria-label":c},o,{ref:t}),r.createElement("span",{className:"DocSearch-Button-Container"},r.createElement(ke.W,null),r.createElement("span",{className:"DocSearch-Button-Placeholder"},l)),r.createElement("span",{className:"DocSearch-Button-Keys"},null!==d&&r.createElement(r.Fragment,null,r.createElement("kbd",{className:"DocSearch-Button-Key"},d===Ae?r.createElement(Ee,null):d),r.createElement("kbd",{className:"DocSearch-Button-Key"},"K"))))})),Oe=n(3320);const Le={button:{buttonText:(0,c.I)({id:"theme.SearchBar.label",message:"Search",description:"The ARIA label and placeholder for search button"}),buttonAriaLabel:(0,c.I)({id:"theme.SearchBar.label",message:"Search",description:"The ARIA label and placeholder for search button"})},modal:{searchBox:{resetButtonTitle:(0,c.I)({id:"theme.SearchModal.searchBox.resetButtonTitle",message:"Clear the query",description:"The label and ARIA label for search box reset button"}),resetButtonAriaLabel:(0,c.I)({id:"theme.SearchModal.searchBox.resetButtonTitle",message:"Clear the query",description:"The label and ARIA label for search box reset button"}),cancelButtonText:(0,c.I)({id:"theme.SearchModal.searchBox.cancelButtonText",message:"Cancel",description:"The label and ARIA label for search box cancel button"}),cancelButtonAriaLabel:(0,c.I)({id:"theme.SearchModal.searchBox.cancelButtonText",message:"Cancel",description:"The label and ARIA label for search box cancel button"})},startScreen:{recentSearchesTitle:(0,c.I)({id:"theme.SearchModal.startScreen.recentSearchesTitle",message:"Recent",description:"The title for recent searches"}),noRecentSearchesText:(0,c.I)({id:"theme.SearchModal.startScreen.noRecentSearchesText",message:"No recent searches",description:"The text when no recent searches"}),saveRecentSearchButtonTitle:(0,c.I)({id:"theme.SearchModal.startScreen.saveRecentSearchButtonTitle",message:"Save this search",description:"The label for save recent search button"}),removeRecentSearchButtonTitle:(0,c.I)({id:"theme.SearchModal.startScreen.removeRecentSearchButtonTitle",message:"Remove this search from history",description:"The label for remove recent search button"}),favoriteSearchesTitle:(0,c.I)({id:"theme.SearchModal.startScreen.favoriteSearchesTitle",message:"Favorite",description:"The title for favorite searches"}),removeFavoriteSearchButtonTitle:(0,c.I)({id:"theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle",message:"Remove this search from favorites",description:"The label for remove favorite search button"})},errorScreen:{titleText:(0,c.I)({id:"theme.SearchModal.errorScreen.titleText",message:"Unable to fetch results",description:"The title for error screen of search modal"}),helpText:(0,c.I)({id:"theme.SearchModal.errorScreen.helpText",message:"You might want to check your network connection.",description:"The help text for error screen of search modal"})},footer:{selectText:(0,c.I)({id:"theme.SearchModal.footer.selectText",message:"to select",description:"The explanatory text of the action for the enter key"}),selectKeyAriaLabel:(0,c.I)({id:"theme.SearchModal.footer.selectKeyAriaLabel",message:"Enter key",description:"The ARIA label for the Enter key button that makes the selection"}),navigateText:(0,c.I)({id:"theme.SearchModal.footer.navigateText",message:"to navigate",description:"The explanatory text of the action for the Arrow up and Arrow down key"}),navigateUpKeyAriaLabel:(0,c.I)({id:"theme.SearchModal.footer.navigateUpKeyAriaLabel",message:"Arrow up",description:"The ARIA label for the Arrow up key button that makes the navigation"}),navigateDownKeyAriaLabel:(0,c.I)({id:"theme.SearchModal.footer.navigateDownKeyAriaLabel",message:"Arrow down",description:"The ARIA label for the Arrow down key button that makes the navigation"}),closeText:(0,c.I)({id:"theme.SearchModal.footer.closeText",message:"to close",description:"The explanatory text of the action for Escape key"}),closeKeyAriaLabel:(0,c.I)({id:"theme.SearchModal.footer.closeKeyAriaLabel",message:"Escape key",description:"The ARIA label for the Escape key button that close the modal"}),searchByText:(0,c.I)({id:"theme.SearchModal.footer.searchByText",message:"Search by",description:"The text explain that the search is making by Algolia"})},noResultsScreen:{noResultsText:(0,c.I)({id:"theme.SearchModal.noResultsScreen.noResultsText",message:"No results for",description:"The text explains that there are no results for the following search"}),suggestedQueryText:(0,c.I)({id:"theme.SearchModal.noResultsScreen.suggestedQueryText",message:"Try searching for",description:"The text for the suggested query when no results are found for the following search"}),reportMissingResultsText:(0,c.I)({id:"theme.SearchModal.noResultsScreen.reportMissingResultsText",message:"Believe this query should return results?",description:"The text for the question where the user thinks there are missing results"}),reportMissingResultsLinkText:(0,c.I)({id:"theme.SearchModal.noResultsScreen.reportMissingResultsLinkText",message:"Let us know.",description:"The text for the link to report missing results"})}},placeholder:(0,c.I)({id:"theme.SearchModal.placeholder",message:"Search docs",description:"The placeholder of the input of the DocSearch pop-up modal"})};let Ie=null;function Pe(e){let{hit:t,children:n}=e;return r.createElement(J.Z,{to:t.url},n)}function Re(e){let{state:t,onClose:n}=e;const{generateSearchPageLink:a}=(0,we.O)();return r.createElement(J.Z,{to:a(t.query),onClick:n},r.createElement(c.Z,{id:"theme.SearchBar.seeAll",values:{count:t.context.nbHits}},"See all {count} results"))}function Me(e){var t;let{contextualSearch:a,externalUrlRegex:o,...i}=e;const{siteMetadata:c}=(0,ue.Z)(),u=function(){const{locale:e,tags:t}=(0,Oe._q)();return[`language:${e}`,t.map((e=>`docusaurus_tag:${e}`))]}(),d=(null==(t=i.searchParameters)?void 0:t.facetFilters)??[],f=a?function(e,t){const n=e=>"string"==typeof e?[e]:e;return[...n(e),...n(t)]}(u,d):d,p={...i.searchParameters,facetFilters:f},{withBaseUrl:m}=(0,ee.C)(),h=(0,s.k6)(),g=(0,r.useRef)(null),b=(0,r.useRef)(null),[v,y]=(0,r.useState)(!1),[w,E]=(0,r.useState)(void 0),k=(0,r.useCallback)((()=>Ie?Promise.resolve():Promise.all([n.e(6780).then(n.bind(n,6780)),Promise.all([n.e(532),n.e(6945)]).then(n.bind(n,6945)),Promise.all([n.e(532),n.e(8894)]).then(n.bind(n,8894))]).then((e=>{let[{DocSearchModal:t}]=e;Ie=t}))),[]),S=(0,r.useCallback)((()=>{k().then((()=>{g.current=document.createElement("div"),document.body.insertBefore(g.current,document.body.firstChild),y(!0)}))}),[k,y]),_=(0,r.useCallback)((()=>{var e;y(!1),null==(e=g.current)||e.remove()}),[y]),x=(0,r.useCallback)((e=>{k().then((()=>{y(!0),E(e.key)}))}),[k,y,E]),T=(0,r.useRef)({navigate(e){let{itemUrl:t}=e;(0,ne.F)(o,t)?window.location.href=t:h.push(t)}}).current,C=(0,r.useRef)((e=>e.map((e=>{if((0,ne.F)(o,e.url))return e;const t=new URL(e.url);return{...e,url:m(`${t.pathname}${t.hash}`)}})))).current,A=(0,r.useMemo)((()=>e=>r.createElement(Re,(0,l.Z)({},e,{onClose:_}))),[_]),N=(0,r.useCallback)((e=>(e.addAlgoliaAgent("docusaurus",c.docusaurusVersion),e)),[c.docusaurusVersion]);return function(e){var t=e.isOpen,n=e.onOpen,a=e.onClose,o=e.onInput,i=e.searchButtonRef;r.useEffect((function(){function e(e){(27===e.keyCode&&t||"k"===e.key.toLowerCase()&&(e.metaKey||e.ctrlKey)||!function(e){var t=e.target,n=t.tagName;return t.isContentEditable||"INPUT"===n||"SELECT"===n||"TEXTAREA"===n}(e)&&"/"===e.key&&!t)&&(e.preventDefault(),t?a():document.body.classList.contains("DocSearch--active")||document.body.classList.contains("DocSearch--active")||n()),i&&i.current===document.activeElement&&o&&/[a-zA-Z0-9]/.test(String.fromCharCode(e.keyCode))&&o(e)}return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}}),[t,n,a,o,i])}({isOpen:v,onOpen:S,onClose:_,onInput:x,searchButtonRef:b}),r.createElement(r.Fragment,null,r.createElement(ye.Z,null,r.createElement("link",{rel:"preconnect",href:`https://${i.appId}-dsn.algolia.net`,crossOrigin:"anonymous"})),r.createElement(Ne,{onTouchStart:k,onFocus:k,onMouseOver:k,onClick:S,ref:b,translations:Le.button}),v&&Ie&&g.current&&(0,ve.createPortal)(r.createElement(Ie,(0,l.Z)({onClose:_,initialScrollY:window.scrollY,initialQuery:w,navigator:T,transformItems:C,hitComponent:Pe,transformSearchClient:N},i.searchPagePath&&{resultsFooterComponent:A},i,{searchParameters:p,placeholder:Le.placeholder,translations:Le.modal})),g.current))}function De(){const{siteConfig:e}=(0,ue.Z)();return r.createElement(Me,e.themeConfig.algolia)}const Fe="searchBox_ZlJk";function Be(e){let{children:t,className:n}=e;return r.createElement("div",{className:(0,a.Z)(n,Fe)},t)}var $e=n(143),Ue=n(2802);var ze=n(373);const je=e=>e.docs.find((t=>t.id===e.mainDocId));const He={default:le,localeDropdown:function(e){let{mobile:t,dropdownItemsBefore:n,dropdownItemsAfter:a,...o}=e;const{i18n:{currentLocale:i,locales:u,localeConfigs:d}}=(0,ue.Z)(),f=(0,he.l)(),{search:p,hash:m}=(0,s.TH)(),h=[...n,...u.map((e=>{const n=`${`pathname://${f.createUrl({locale:e,fullyQualified:!1})}`}${p}${m}`;return{label:d[e].label,lang:d[e].htmlLang,to:n,target:"_self",autoAddBaseUrl:!1,className:e===i?t?"menu__link--active":"dropdown__link--active":""}})),...a],g=t?(0,c.I)({message:"Languages",id:"theme.navbar.mobileLanguageDropdown.label",description:"The label for the mobile language switcher dropdown"}):d[i].label;return r.createElement(me,(0,l.Z)({},o,{mobile:t,label:r.createElement(r.Fragment,null,r.createElement(ge,{className:be}),g),items:h}))},search:function(e){let{mobile:t,className:n}=e;return t?null:r.createElement(Be,{className:n},r.createElement(De,null))},dropdown:me,html:function(e){let{value:t,className:n,mobile:o=!1,isDropdownItem:i=!1}=e;const l=i?"li":"div";return r.createElement(l,{className:(0,a.Z)({navbar__item:!o&&!i,"menu__list-item":o},n),dangerouslySetInnerHTML:{__html:t}})},doc:function(e){let{docId:t,label:n,docsPluginId:a,...o}=e;const{activeDoc:i}=(0,$e.Iw)(a),s=(0,Ue.vY)(t,a);return null===s?null:r.createElement(le,(0,l.Z)({exact:!0},o,{isActive:()=>(null==i?void 0:i.path)===s.path||!(null==i||!i.sidebar)&&i.sidebar===s.sidebar,label:n??s.id,to:s.path}))},docSidebar:function(e){let{sidebarId:t,label:n,docsPluginId:a,...o}=e;const{activeDoc:i}=(0,$e.Iw)(a),s=(0,Ue.oz)(t,a).link;if(!s)throw new Error(`DocSidebarNavbarItem: Sidebar with ID "${t}" doesn't have anything to be linked to.`);return r.createElement(le,(0,l.Z)({exact:!0},o,{isActive:()=>(null==i?void 0:i.sidebar)===t,label:n??s.label,to:s.path}))},docsVersion:function(e){let{label:t,to:n,docsPluginId:a,...o}=e;const i=(0,Ue.lO)(a)[0],s=t??i.label,c=n??(e=>e.docs.find((t=>t.id===e.mainDocId)))(i).path;return r.createElement(le,(0,l.Z)({},o,{label:s,to:c}))},docsVersionDropdown:function(e){let{mobile:t,docsPluginId:n,dropdownActiveClassDisabled:a,dropdownItemsBefore:o,dropdownItemsAfter:i,...u}=e;const{search:d,hash:f}=(0,s.TH)(),p=(0,$e.Iw)(n),m=(0,$e.gB)(n),{savePreferredVersionName:h}=(0,ze.J)(n),g=[...o,...m.map((e=>{const t=p.alternateDocVersions[e.name]??je(e);return{label:e.label,to:`${t.path}${d}${f}`,isActive:()=>e===p.activeVersion,onClick:()=>h(e.name)}})),...i],b=(0,Ue.lO)(n)[0],v=t&&g.length>1?(0,c.I)({id:"theme.navbar.mobileVersionsDropdown.label",message:"Versions",description:"The label for the navbar versions dropdown on mobile view"}):b.label,y=t&&g.length>1?void 0:je(b).path;return g.length<=1?r.createElement(le,(0,l.Z)({},u,{mobile:t,label:v,to:y,isActive:a?()=>!1:void 0})):r.createElement(me,(0,l.Z)({},u,{mobile:t,label:v,to:y,items:g,isActive:a?()=>!1:void 0}))}};function Ze(e){let{type:t,...n}=e;const a=function(e,t){return e&&"default"!==e?e:"items"in t?"dropdown":"default"}(t,n),o=He[a];if(!o)throw new Error(`No NavbarItem component found for type "${t}".`);return r.createElement(o,n)}function Ge(){const e=(0,I.e)(),t=(0,w.L)().navbar.items;return r.createElement("ul",{className:"menu__list"},t.map(((t,n)=>r.createElement(Ze,(0,l.Z)({mobile:!0},t,{onClick:()=>e.toggle(),key:n})))))}function Ve(e){return r.createElement("button",(0,l.Z)({},e,{type:"button",className:"clean-btn navbar-sidebar__back"}),r.createElement(c.Z,{id:"theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel",description:"The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)"},"\u2190 Back to main menu"))}function We(){const e=0===(0,w.L)().navbar.items.length,t=$();return r.createElement(r.Fragment,null,!e&&r.createElement(Ve,{onClick:()=>t.hide()}),t.content)}function qe(){const e=(0,I.e)();var t;return void 0===(t=e.shown)&&(t=!0),(0,r.useEffect)((()=>(document.body.style.overflow=t?"hidden":"visible",()=>{document.body.style.overflow="visible"})),[t]),e.shouldRender?r.createElement(U,{header:r.createElement(Q,null),primaryMenu:r.createElement(Ge,null),secondaryMenu:r.createElement(We,null)}):null}const Ye="navbarHideable_m1mJ",Ke="navbarHidden_jGov";function Xe(e){return r.createElement("div",(0,l.Z)({role:"presentation"},e,{className:(0,a.Z)("navbar-sidebar__backdrop",e.className)}))}function Qe(e){let{children:t}=e;const{navbar:{hideOnScroll:n,style:o}}=(0,w.L)(),i=(0,I.e)(),{navbarRef:l,isNavbarVisible:s}=function(e){const[t,n]=(0,r.useState)(e),a=(0,r.useRef)(!1),o=(0,r.useRef)(0),i=(0,r.useCallback)((e=>{null!==e&&(o.current=e.getBoundingClientRect().height)}),[]);return(0,P.RF)(((t,r)=>{let{scrollY:i}=t;if(!e)return;if(i<o.current)return void n(!0);if(a.current)return void(a.current=!1);const l=null==r?void 0:r.scrollY,s=document.documentElement.scrollHeight-o.current,c=window.innerHeight;l&&i>=l?n(!1):i+c<s&&n(!0)})),(0,u.S)((t=>{if(!e)return;const r=t.location.hash;if(r?document.getElementById(r.substring(1)):void 0)return a.current=!0,void n(!1);n(!0)})),{navbarRef:i,isNavbarVisible:t}}(n);return r.createElement("nav",{ref:l,className:(0,a.Z)("navbar","navbar--fixed-top",n&&[Ye,!s&&Ke],{"navbar--dark":"dark"===o,"navbar--primary":"primary"===o,"navbar-sidebar--show":i.shown})},t,r.createElement(Xe,{onClick:i.toggle}),r.createElement(qe,null))}function Je(e){let{width:t=30,height:n=30,className:a,...o}=e;return r.createElement("svg",(0,l.Z)({className:a,width:t,height:n,viewBox:"0 0 30 30","aria-hidden":"true"},o),r.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M4 7h22M4 15h22M4 23h22"}))}function et(){const{toggle:e,shown:t}=(0,I.e)();return r.createElement("button",{onClick:e,"aria-label":(0,c.I)({id:"theme.docs.sidebar.toggleSidebarButtonAriaLabel",message:"Toggle navigation bar",description:"The ARIA label for hamburger menu button of mobile navigation"}),"aria-expanded":t,className:"navbar__toggle clean-btn",type:"button"},r.createElement(Je,null))}const tt="colorModeToggle_x44X";function nt(e){let{items:t}=e;return r.createElement(r.Fragment,null,t.map(((e,t)=>r.createElement(Ze,(0,l.Z)({},e,{key:t})))))}function rt(e){let{left:t,right:n}=e;const{siteConfig:a}=(0,ue.Z)();return(0,r.useEffect)((()=>{var e=document.createElement("script");e.type="text/javascript",e.src="https://buttons.github.io/buttons.js",document.querySelector("head").append(e)})),r.createElement("div",{className:"navbar__inner"},r.createElement("div",{className:"navbar__items"},t),r.createElement("div",{className:"navbar__items navbar__items--right"},r.createElement("div",{style:{marginTop:"8px",marginRight:"15px"}},r.createElement("a",{className:"github-button",href:`https://github.com/sponsors/${a.organizationName}`,"data-color-scheme":"no-preference: light; light: light; dark: dark;","data-icon":"octicon-heart","data-size":"large","aria-label":`Sponsor @${a.organizationName} on GitHub`},"Sponsor"),"\xa0",r.createElement("a",{className:"github-button",href:`https://github.com/${a.organizationName}/${a.projectName}`,"data-icon":"octicon-star","data-size":"large","data-show-count":"true","aria-label":`Star ${a.organizationName}/${a.projectName} on GitHub`},"Star"),"\xa0",r.createElement("a",{className:"github-button",href:`https://github.com/${a.organizationName}`,"data-size":"large","aria-label":`Follow @${a.organizationName} on GitHub`},`Follow @${a.organizationName}`)),n))}function at(){const e=(0,I.e)(),t=(0,w.L)().navbar.items,[n,a]=function(e){function t(e){return"left"===(e.position??"right")}return[e.filter(t),e.filter((e=>!t(e)))]}(t),o=t.find((e=>"search"===e.type));return r.createElement(rt,{left:r.createElement(r.Fragment,null,!e.disabled&&r.createElement(et,null),r.createElement(K,null),r.createElement(nt,{items:n})),right:r.createElement(r.Fragment,null,r.createElement(nt,{items:a}),r.createElement(q,{className:tt}),!o&&r.createElement(Be,null,r.createElement(De,null)))})}function ot(){return r.createElement(Qe,null,r.createElement(at,null))}function it(e){let{item:t}=e;const{to:n,href:a,label:o,prependBaseUrlToHref:i,...s}=t,c=(0,ee.Z)(n),u=(0,ee.Z)(a,{forcePrependBaseUrl:!0});return r.createElement(J.Z,(0,l.Z)({className:"footer__link-item"},a?{href:i?u:a}:{to:c},s),o,a&&!(0,te.Z)(a)&&r.createElement(re.Z,null))}function lt(e){let{item:t}=e;return t.html?r.createElement("li",{className:"footer__item",dangerouslySetInnerHTML:{__html:t.html}}):r.createElement("li",{key:t.href??t.to,className:"footer__item"},r.createElement(it,{item:t}))}function st(e){let{column:t}=e;return r.createElement("div",{className:"col footer__col"},r.createElement("div",{className:"footer__title"},t.title),r.createElement("ul",{className:"footer__items clean-list"},t.items.map(((e,t)=>r.createElement(lt,{key:t,item:e})))))}function ct(e){let{columns:t}=e;return r.createElement("div",{className:"row footer__links"},t.map(((e,t)=>r.createElement(st,{key:t,column:e}))))}function ut(){return r.createElement("span",{className:"footer__link-separator"},"\xb7")}function dt(e){let{item:t}=e;return t.html?r.createElement("span",{className:"footer__link-item",dangerouslySetInnerHTML:{__html:t.html}}):r.createElement(it,{item:t})}function ft(e){let{links:t}=e;return r.createElement("div",{className:"footer__links text--center"},r.createElement("div",{className:"footer__links"},t.map(((e,n)=>r.createElement(r.Fragment,{key:n},r.createElement(dt,{item:e}),t.length!==n+1&&r.createElement(ut,null))))))}function pt(e){let{links:t}=e;return function(e){return"title"in e[0]}(t)?r.createElement(ct,{columns:t}):r.createElement(ft,{links:t})}var mt=n(941);const ht="footerLogoLink_BH7S";function gt(e){let{logo:t}=e;const{withBaseUrl:n}=(0,ee.C)(),o={light:n(t.src),dark:n(t.srcDark??t.src)};return r.createElement(mt.Z,{className:(0,a.Z)("footer__logo",t.className),alt:t.alt,sources:o,width:t.width,height:t.height,style:t.style})}function bt(e){let{logo:t}=e;return t.href?r.createElement(J.Z,{href:t.href,className:ht,target:t.target},r.createElement(gt,{logo:t})):r.createElement(gt,{logo:t})}function vt(e){let{copyright:t}=e;return r.createElement("div",{className:"footer__copyright",dangerouslySetInnerHTML:{__html:t}})}function yt(e){let{style:t,links:n,logo:o,copyright:i}=e;return r.createElement("footer",{className:(0,a.Z)("footer",{"footer--dark":"dark"===t})},r.createElement("div",{className:"container container-fluid"},n,(o||i)&&r.createElement("div",{className:"footer__bottom text--center"},o&&r.createElement("div",{className:"margin-bottom--sm"},o),i)))}function wt(){const{footer:e}=(0,w.L)();if(!e)return null;const{copyright:t,links:n,logo:a,style:o}=e;return r.createElement(yt,{style:o,links:n&&n.length>0&&r.createElement(pt,{links:n}),logo:a&&r.createElement(bt,{logo:a}),copyright:t&&r.createElement(vt,{copyright:t})})}const Et=r.memo(wt);var kt=n(12);const St="docusaurus.tab.",_t=r.createContext(void 0);const xt=(0,R.Qc)([z.S,E.pl,function(e){let{children:t}=e;const n=function(){const[e,t]=(0,r.useState)({}),n=(0,r.useCallback)(((e,t)=>{(0,kt.W)(`docusaurus.tab.${e}`).set(t)}),[]);(0,r.useEffect)((()=>{try{const e={};(0,kt._)().forEach((t=>{if(t.startsWith(St)){const n=t.substring(St.length);e[n]=(0,kt.W)(t).get()}})),t(e)}catch(e){console.error(e)}}),[]);const a=(0,r.useCallback)(((e,r)=>{t((t=>({...t,[e]:r}))),n(e,r)}),[n]);return(0,r.useMemo)((()=>({tabGroupChoices:e,setTabGroupChoices:a})),[e,a])}();return r.createElement(_t.Provider,{value:n},t)},P.OC,ze.L5,i.VC,function(e){let{children:t}=e;return r.createElement(M.n2,null,r.createElement(I.M,null,r.createElement(F,null,t)))}]);function Tt(e){let{children:t}=e;return r.createElement(xt,null,t)}function Ct(e){let{error:t,tryAgain:n}=e;return r.createElement("main",{className:"container margin-vert--xl"},r.createElement("div",{className:"row"},r.createElement("div",{className:"col col--6 col--offset-3"},r.createElement("h1",{className:"hero__title"},r.createElement(c.Z,{id:"theme.ErrorPageContent.title",description:"The title of the fallback page when the page crashed"},"This page crashed.")),r.createElement("p",null,t.message),r.createElement("div",null,r.createElement("button",{type:"button",onClick:n},r.createElement(c.Z,{id:"theme.ErrorPageContent.tryAgain",description:"The label of the button to try again when the page crashed"},"Try again"))))))}const At="mainWrapper_z2l0";function Nt(e){const{children:t,noFooter:n,wrapperClassName:l,title:s,description:c}=e;return(0,b.t)(),r.createElement(Tt,null,r.createElement(i.d,{title:s,description:c}),r.createElement(y,null),r.createElement(L,null),r.createElement(ot,null),r.createElement("div",{id:d,className:(0,a.Z)(g.k.wrapper.main,At,l)},r.createElement(o.Z,{fallback:e=>r.createElement(Ct,e)},t)),!n&&r.createElement(Et,null))}},1327:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(7462),a=n(7294),o=n(9960),i=n(4996),l=n(2263),s=n(6668),c=n(941);function u(e){let{logo:t,alt:n,imageClassName:r}=e;const o={light:(0,i.Z)(t.src),dark:(0,i.Z)(t.srcDark||t.src)},l=a.createElement(c.Z,{className:t.className,sources:o,height:t.height,width:t.width,alt:n,style:t.style});return r?a.createElement("div",{className:r},l):l}function d(e){const{siteConfig:{title:t}}=(0,l.Z)(),{navbar:{title:n,logo:c}}=(0,s.L)(),{imageClassName:d,titleClassName:f,...p}=e,m=(0,i.Z)((null==c?void 0:c.href)||"/"),h=n?"":t,g=(null==c?void 0:c.alt)??h;return a.createElement(o.Z,(0,r.Z)({to:m},p,(null==c?void 0:c.target)&&{target:c.target}),c&&a.createElement(u,{logo:c,alt:g,imageClassName:d}),null!=n&&a.createElement("b",{className:f},n))}},197:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(7294),a=n(5742);function o(e){let{locale:t,version:n,tag:o}=e;const i=t;return r.createElement(a.Z,null,t&&r.createElement("meta",{name:"docusaurus_locale",content:t}),n&&r.createElement("meta",{name:"docusaurus_version",content:n}),o&&r.createElement("meta",{name:"docusaurus_tag",content:o}),i&&r.createElement("meta",{name:"docsearch:language",content:i}),n&&r.createElement("meta",{name:"docsearch:version",content:n}),o&&r.createElement("meta",{name:"docsearch:docusaurus_tag",content:o}))}},941:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(7462),a=n(7294),o=n(6010),i=n(2389),l=n(2949);const s={themedImage:"themedImage_ToTc","themedImage--light":"themedImage--light_HNdA","themedImage--dark":"themedImage--dark_i4oU"};function c(e){const t=(0,i.Z)(),{colorMode:n}=(0,l.I)(),{sources:c,className:u,alt:d,...f}=e,p=t?"dark"===n?["dark"]:["light"]:["light","dark"];return a.createElement(a.Fragment,null,p.map((e=>a.createElement("img",(0,r.Z)({key:e,src:c[e],alt:d,className:(0,o.Z)(s.themedImage,s[`themedImage--${e}`],u)},f)))))}},6043:(e,t,n)=>{"use strict";n.d(t,{u:()=>i,z:()=>m});var r=n(7462),a=n(7294),o=n(412);function i(e){let{initialState:t}=e;const[n,r]=(0,a.useState)(t??!1),o=(0,a.useCallback)((()=>{r((e=>!e))}),[]);return{collapsed:n,setCollapsed:r,toggleCollapsed:o}}const l={display:"none",overflow:"hidden",height:"0px"},s={display:"block",overflow:"visible",height:"auto"};function c(e,t){const n=t?l:s;e.style.display=n.display,e.style.overflow=n.overflow,e.style.height=n.height}function u(e){let{collapsibleRef:t,collapsed:n,animation:r}=e;const o=(0,a.useRef)(!1);(0,a.useEffect)((()=>{const e=t.current;function a(){const t=e.scrollHeight,n=(null==r?void 0:r.duration)??function(e){const t=e/36;return Math.round(10*(4+15*t**.25+t/5))}(t);return{transition:`height ${n}ms ${(null==r?void 0:r.easing)??"ease-in-out"}`,height:`${t}px`}}function i(){const t=a();e.style.transition=t.transition,e.style.height=t.height}if(!o.current)return c(e,n),void(o.current=!0);return e.style.willChange="height",function(){const t=requestAnimationFrame((()=>{n?(i(),requestAnimationFrame((()=>{e.style.height=l.height,e.style.overflow=l.overflow}))):(e.style.display="block",requestAnimationFrame((()=>{i()})))}));return()=>cancelAnimationFrame(t)}()}),[t,n,r])}function d(e){if(!o.Z.canUseDOM)return e?l:s}function f(e){let{as:t="div",collapsed:n,children:r,animation:o,onCollapseTransitionEnd:i,className:l,disableSSRStyle:s}=e;const f=(0,a.useRef)(null);return u({collapsibleRef:f,collapsed:n,animation:o}),a.createElement(t,{ref:f,style:s?void 0:d(n),onTransitionEnd:e=>{"height"===e.propertyName&&(c(f.current,n),null==i||i(n))},className:l},r)}function p(e){let{collapsed:t,...n}=e;const[o,i]=(0,a.useState)(!t),[l,s]=(0,a.useState)(t);return(0,a.useLayoutEffect)((()=>{t||i(!0)}),[t]),(0,a.useLayoutEffect)((()=>{o&&s(t)}),[o,t]),o?a.createElement(f,(0,r.Z)({},n,{collapsed:l})):null}function m(e){let{lazy:t,...n}=e;const r=t?p:f;return a.createElement(r,n)}},9689:(e,t,n)=>{"use strict";n.d(t,{nT:()=>m,pl:()=>p});var r=n(7294),a=n(2389),o=n(12),i=n(902),l=n(6668);const s=(0,o.W)("docusaurus.announcement.dismiss"),c=(0,o.W)("docusaurus.announcement.id"),u=()=>"true"===s.get(),d=e=>s.set(String(e)),f=r.createContext(null);function p(e){let{children:t}=e;const n=function(){const{announcementBar:e}=(0,l.L)(),t=(0,a.Z)(),[n,o]=(0,r.useState)((()=>!!t&&u()));(0,r.useEffect)((()=>{o(u())}),[]);const i=(0,r.useCallback)((()=>{d(!0),o(!0)}),[]);return(0,r.useEffect)((()=>{if(!e)return;const{id:t}=e;let n=c.get();"annoucement-bar"===n&&(n="announcement-bar");const r=t!==n;c.set(t),r&&d(!1),!r&&u()||o(!1)}),[e]),(0,r.useMemo)((()=>({isActive:!!e&&!n,close:i})),[e,n,i])}();return r.createElement(f.Provider,{value:n},t)}function m(){const e=(0,r.useContext)(f);if(!e)throw new i.i6("AnnouncementBarProvider");return e}},2949:(e,t,n)=>{"use strict";n.d(t,{I:()=>g,S:()=>h});var r=n(7294),a=n(412),o=n(902),i=n(12),l=n(6668);const s=r.createContext(void 0),c="theme",u=(0,i.W)(c),d="light",f="dark",p=e=>e===f?f:d;function m(){const{colorMode:{defaultMode:e,disableSwitch:t,respectPrefersColorScheme:n}}=(0,l.L)(),[o,i]=(0,r.useState)((e=>a.Z.canUseDOM?p(document.documentElement.getAttribute("data-theme")):p(e))(e));(0,r.useEffect)((()=>{t&&u.del()}),[t]);const s=(0,r.useCallback)((function(t,r){void 0===r&&(r={});const{persist:a=!0}=r;t?(i(t),a&&(e=>{u.set(p(e))})(t)):(i(n?window.matchMedia("(prefers-color-scheme: dark)").matches?f:d:e),u.del())}),[n,e]);(0,r.useEffect)((()=>{document.documentElement.setAttribute("data-theme",p(o))}),[o]),(0,r.useEffect)((()=>{if(t)return;const e=e=>{if(e.key!==c)return;const t=u.get();null!==t&&s(p(t))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}),[t,s]);const m=(0,r.useRef)(!1);return(0,r.useEffect)((()=>{if(t&&!n)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{window.matchMedia("print").matches||m.current?m.current=window.matchMedia("print").matches:s(null)};return e.addListener(r),()=>e.removeListener(r)}),[s,t,n]),(0,r.useMemo)((()=>({colorMode:o,setColorMode:s,get isDarkTheme(){return o===f},setLightTheme(){s(d)},setDarkTheme(){s(f)}})),[o,s])}function h(e){let{children:t}=e;const n=m();return r.createElement(s.Provider,{value:n},t)}function g(){const e=(0,r.useContext)(s);if(null==e)throw new o.i6("ColorModeProvider","Please see https://docusaurus.io/docs/api/themes/configuration#use-color-mode.");return e}},373:(e,t,n)=>{"use strict";n.d(t,{J:()=>y,L5:()=>b,Oh:()=>w});var r=n(7294),a=n(143),o=n(9935),i=n(6668),l=n(2802),s=n(902),c=n(12);const u=e=>`docs-preferred-version-${e}`,d=(e,t,n)=>{(0,c.W)(u(e),{persistence:t}).set(n)},f=(e,t)=>(0,c.W)(u(e),{persistence:t}).get(),p=(e,t)=>{(0,c.W)(u(e),{persistence:t}).del()};const m=r.createContext(null);function h(){const e=(0,a._r)(),t=(0,i.L)().docs.versionPersistence,n=(0,r.useMemo)((()=>Object.keys(e)),[e]),[o,l]=(0,r.useState)((()=>(e=>Object.fromEntries(e.map((e=>[e,{preferredVersionName:null}]))))(n)));(0,r.useEffect)((()=>{l(function(e){let{pluginIds:t,versionPersistence:n,allDocsData:r}=e;function a(e){const t=f(e,n);return r[e].versions.some((e=>e.name===t))?{preferredVersionName:t}:(p(e,n),{preferredVersionName:null})}return Object.fromEntries(t.map((e=>[e,a(e)])))}({allDocsData:e,versionPersistence:t,pluginIds:n}))}),[e,t,n]);return[o,(0,r.useMemo)((()=>({savePreferredVersion:function(e,n){d(e,t,n),l((t=>({...t,[e]:{preferredVersionName:n}})))}})),[t])]}function g(e){let{children:t}=e;const n=h();return r.createElement(m.Provider,{value:n},t)}function b(e){let{children:t}=e;return l.cE?r.createElement(g,null,t):r.createElement(r.Fragment,null,t)}function v(){const e=(0,r.useContext)(m);if(!e)throw new s.i6("DocsPreferredVersionContextProvider");return e}function y(e){void 0===e&&(e=o.m);const t=(0,a.zh)(e),[n,i]=v(),{preferredVersionName:l}=n[e];return{preferredVersion:t.versions.find((e=>e.name===l))??null,savePreferredVersionName:(0,r.useCallback)((t=>{i.savePreferredVersion(e,t)}),[i,e])}}function w(){const e=(0,a._r)(),[t]=v();function n(n){const r=e[n],{preferredVersionName:a}=t[n];return r.versions.find((e=>e.name===a))??null}const r=Object.keys(e);return Object.fromEntries(r.map((e=>[e,n(e)])))}},1116:(e,t,n)=>{"use strict";n.d(t,{V:()=>s,b:()=>l});var r=n(7294),a=n(902);const o=Symbol("EmptyContext"),i=r.createContext(o);function l(e){let{children:t,name:n,items:a}=e;const o=(0,r.useMemo)((()=>n&&a?{name:n,items:a}:null),[n,a]);return r.createElement(i.Provider,{value:o},t)}function s(){const e=(0,r.useContext)(i);if(e===o)throw new a.i6("DocsSidebarProvider");return e}},2961:(e,t,n)=>{"use strict";n.d(t,{M:()=>f,e:()=>p});var r=n(7294),a=n(3102),o=n(7524),i=n(6775),l=n(902);function s(e){!function(e){const t=(0,i.k6)(),n=(0,l.zX)(e);(0,r.useEffect)((()=>t.block(((e,t)=>n(e,t)))),[t,n])}(((t,n)=>{if("POP"===n)return e(t,n)}))}var c=n(6668);const u=r.createContext(void 0);function d(){const e=function(){const e=(0,a.HY)(),{items:t}=(0,c.L)().navbar;return 0===t.length&&!e.component}(),t=(0,o.i)(),n=!e&&"mobile"===t,[i,l]=(0,r.useState)(!1);s((()=>{if(i)return l(!1),!1}));const u=(0,r.useCallback)((()=>{l((e=>!e))}),[]);return(0,r.useEffect)((()=>{"desktop"===t&&l(!1)}),[t]),(0,r.useMemo)((()=>({disabled:e,shouldRender:n,toggle:u,shown:i})),[e,n,u,i])}function f(e){let{children:t}=e;const n=d();return r.createElement(u.Provider,{value:n},t)}function p(){const e=r.useContext(u);if(void 0===e)throw new l.i6("NavbarMobileSidebarProvider");return e}},3102:(e,t,n)=>{"use strict";n.d(t,{HY:()=>l,Zo:()=>s,n2:()=>i});var r=n(7294),a=n(902);const o=r.createContext(null);function i(e){let{children:t}=e;const n=(0,r.useState)({component:null,props:null});return r.createElement(o.Provider,{value:n},t)}function l(){const e=(0,r.useContext)(o);if(!e)throw new a.i6("NavbarSecondaryMenuContentProvider");return e[0]}function s(e){let{component:t,props:n}=e;const i=(0,r.useContext)(o);if(!i)throw new a.i6("NavbarSecondaryMenuContentProvider");const[,l]=i,s=(0,a.Ql)(n);return(0,r.useEffect)((()=>{l({component:t,props:s})}),[l,t,s]),(0,r.useEffect)((()=>()=>l({component:null,props:null})),[l]),null}},9727:(e,t,n)=>{"use strict";n.d(t,{h:()=>a,t:()=>o});var r=n(7294);const a="navigation-with-keyboard";function o(){(0,r.useEffect)((()=>{function e(e){"keydown"===e.type&&"Tab"===e.key&&document.body.classList.add(a),"mousedown"===e.type&&document.body.classList.remove(a)}return document.addEventListener("keydown",e),document.addEventListener("mousedown",e),()=>{document.body.classList.remove(a),document.removeEventListener("keydown",e),document.removeEventListener("mousedown",e)}}),[])}},6177:(e,t,n)=>{"use strict";n.d(t,{O:()=>l});var r=n(7294),a=n(6775),o=n(2263);const i="q";function l(){const e=(0,a.k6)(),{siteConfig:{baseUrl:t}}=(0,o.Z)(),[n,l]=(0,r.useState)("");(0,r.useEffect)((()=>{const e=new URLSearchParams(window.location.search).get(i)??"";l(e)}),[]);return{searchQuery:n,setSearchQuery:(0,r.useCallback)((t=>{const n=new URLSearchParams(window.location.search);t?n.set(i,t):n.delete(i),e.replace({search:n.toString()}),l(t)}),[e]),generateSearchPageLink:(0,r.useCallback)((e=>`${t}search?q=${encodeURIComponent(e)}`),[t])}}},7524:(e,t,n)=>{"use strict";n.d(t,{i:()=>c});var r=n(7294),a=n(412);const o="desktop",i="mobile",l="ssr";function s(){return a.Z.canUseDOM?window.innerWidth>996?o:i:l}function c(){const[e,t]=(0,r.useState)((()=>s()));return(0,r.useEffect)((()=>{function e(){t(s())}return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e),clearTimeout(undefined)}}),[]),e}},5281:(e,t,n)=>{"use strict";n.d(t,{k:()=>r});const r={page:{blogListPage:"blog-list-page",blogPostPage:"blog-post-page",blogTagsListPage:"blog-tags-list-page",blogTagPostListPage:"blog-tags-post-list-page",docsDocPage:"docs-doc-page",docsTagsListPage:"docs-tags-list-page",docsTagDocListPage:"docs-tags-doc-list-page",mdxPage:"mdx-page"},wrapper:{main:"main-wrapper",blogPages:"blog-wrapper",docsPages:"docs-wrapper",mdxPages:"mdx-wrapper"},common:{editThisPage:"theme-edit-this-page",lastUpdated:"theme-last-updated",backToTopButton:"theme-back-to-top-button",codeBlock:"theme-code-block",admonition:"theme-admonition",admonitionType:e=>`theme-admonition-${e}`},layout:{},docs:{docVersionBanner:"theme-doc-version-banner",docVersionBadge:"theme-doc-version-badge",docBreadcrumbs:"theme-doc-breadcrumbs",docMarkdown:"theme-doc-markdown",docTocMobile:"theme-doc-toc-mobile",docTocDesktop:"theme-doc-toc-desktop",docFooter:"theme-doc-footer",docFooterTagsRow:"theme-doc-footer-tags-row",docFooterEditMetaRow:"theme-doc-footer-edit-meta-row",docSidebarContainer:"theme-doc-sidebar-container",docSidebarMenu:"theme-doc-sidebar-menu",docSidebarItemCategory:"theme-doc-sidebar-item-category",docSidebarItemLink:"theme-doc-sidebar-item-link",docSidebarItemCategoryLevel:e=>`theme-doc-sidebar-item-category-level-${e}`,docSidebarItemLinkLevel:e=>`theme-doc-sidebar-item-link-level-${e}`},blog:{}}},2802:(e,t,n)=>{"use strict";n.d(t,{Wl:()=>f,_F:()=>m,cE:()=>d,hI:()=>w,lO:()=>b,vY:()=>y,oz:()=>v,s1:()=>g});var r=n(7294),a=n(6775),o=n(8790),i=n(143),l=n(373),s=n(1116);function c(e){return Array.from(new Set(e))}var u=n(8596);const d=!!i._r;function f(e){if(e.href)return e.href;for(const t of e.items){if("link"===t.type)return t.href;if("category"===t.type){const e=f(t);if(e)return e}}}const p=(e,t)=>void 0!==e&&(0,u.Mg)(e,t);function m(e,t){return"link"===e.type?p(e.href,t):"category"===e.type&&(p(e.href,t)||((e,t)=>e.some((e=>m(e,t))))(e.items,t))}function h(e){let{sidebarItems:t,pathname:n,onlyCategories:r=!1}=e;const a=[];return function e(t){for(const o of t)if("category"===o.type&&((0,u.Mg)(o.href,n)||e(o.items))||"link"===o.type&&(0,u.Mg)(o.href,n)){return r&&"category"!==o.type||a.unshift(o),!0}return!1}(t),a}function g(){var e;const t=(0,s.V)(),{pathname:n}=(0,a.TH)();return!1!==(null==(e=(0,i.gA)())?void 0:e.pluginData.breadcrumbs)&&t?h({sidebarItems:t.items,pathname:n}):null}function b(e){const{activeVersion:t}=(0,i.Iw)(e),{preferredVersion:n}=(0,l.J)(e),a=(0,i.yW)(e);return(0,r.useMemo)((()=>c([t,n,a].filter(Boolean))),[t,n,a])}function v(e,t){const n=b(t);return(0,r.useMemo)((()=>{const t=n.flatMap((e=>e.sidebars?Object.entries(e.sidebars):[])),r=t.find((t=>t[0]===e));if(!r)throw new Error(`Can't find any sidebar with id "${e}" in version${n.length>1?"s":""} ${n.map((e=>e.name)).join(", ")}".\n Available sidebar ids are:\n - ${Object.keys(t).join("\n- ")}`);return r[1]}),[e,n])}function y(e,t){const n=b(t);return(0,r.useMemo)((()=>{const t=n.flatMap((e=>e.docs)),r=t.find((t=>t.id===e));if(!r){if(n.flatMap((e=>e.draftIds)).includes(e))return null;throw new Error(`DocNavbarItem: couldn't find any doc with id "${e}" in version${n.length>1?"s":""} ${n.map((e=>e.name)).join(", ")}".\nAvailable doc ids are:\n- ${c(t.map((e=>e.id))).join("\n- ")}`)}return r}),[e,n])}function w(e){let{route:t,versionMetadata:n}=e;const r=(0,a.TH)(),i=t.routes,l=i.find((e=>(0,a.LX)(r.pathname,e)));if(!l)return null;const s=l.sidebar,c=s?n.docsSidebars[s]:void 0;return{docElement:(0,o.H)(i),sidebarName:s,sidebarItems:c}}},2128:(e,t,n)=>{"use strict";n.d(t,{p:()=>a});var r=n(2263);function a(e){const{siteConfig:t}=(0,r.Z)(),{title:n,titleDelimiter:a}=t;return null!=e&&e.trim().length?`${e.trim()} ${a} ${n}`:n}},833:(e,t,n)=>{"use strict";n.d(t,{FG:()=>f,d:()=>u,VC:()=>p});var r=n(7294),a=n(6010),o=n(5742),i=n(226);function l(){const e=r.useContext(i._);if(!e)throw new Error("Unexpected: no Docusaurus route context found");return e}var s=n(4996),c=n(2128);function u(e){let{title:t,description:n,keywords:a,image:i,children:l}=e;const u=(0,c.p)(t),{withBaseUrl:d}=(0,s.C)(),f=i?d(i,{absolute:!0}):void 0;return r.createElement(o.Z,null,t&&r.createElement("title",null,u),t&&r.createElement("meta",{property:"og:title",content:u}),n&&r.createElement("meta",{name:"description",content:n}),n&&r.createElement("meta",{property:"og:description",content:n}),a&&r.createElement("meta",{name:"keywords",content:Array.isArray(a)?a.join(","):a}),f&&r.createElement("meta",{property:"og:image",content:f}),f&&r.createElement("meta",{name:"twitter:image",content:f}),l)}const d=r.createContext(void 0);function f(e){let{className:t,children:n}=e;const i=r.useContext(d),l=(0,a.Z)(i,t);return r.createElement(d.Provider,{value:l},r.createElement(o.Z,null,r.createElement("html",{className:l})),n)}function p(e){let{children:t}=e;const n=l(),o=`plugin-${n.plugin.name.replace(/docusaurus-(?:plugin|theme)-(?:content-)?/gi,"")}`;const i=`plugin-id-${n.plugin.id}`;return r.createElement(f,{className:(0,a.Z)(o,i)},t)}},902:(e,t,n)=>{"use strict";n.d(t,{D9:()=>i,Qc:()=>c,Ql:()=>s,i6:()=>l,zX:()=>o});var r=n(7294);const a=n(412).Z.canUseDOM?r.useLayoutEffect:r.useEffect;function o(e){const t=(0,r.useRef)(e);return a((()=>{t.current=e}),[e]),(0,r.useCallback)((function(){return t.current(...arguments)}),[])}function i(e){const t=(0,r.useRef)();return a((()=>{t.current=e})),t.current}class l extends Error{constructor(e,t){var n,r,a;super(),this.name="ReactContextError",this.message=`Hook ${(null==(n=this.stack)||null==(r=n.split("\n")[1])||null==(a=r.match(/at (?:\w+\.)?(?<name>\w+)/))?void 0:a.groups.name)??""} is called outside the <${e}>. ${t??""}`}}function s(e){const t=Object.entries(e);return t.sort(((e,t)=>e[0].localeCompare(t[0]))),(0,r.useMemo)((()=>e),t.flat())}function c(e){return t=>{let{children:n}=t;return r.createElement(r.Fragment,null,e.reduceRight(((e,t)=>r.createElement(t,null,e)),n))}}},8022:(e,t,n)=>{"use strict";function r(e,t){return void 0!==e&&void 0!==t&&new RegExp(e,"gi").test(t)}n.d(t,{F:()=>r})},8596:(e,t,n)=>{"use strict";n.d(t,{Mg:()=>i,Ns:()=>l});var r=n(7294),a=n(723),o=n(2263);function i(e,t){const n=e=>{var t;return null==(t=!e||e.endsWith("/")?e:`${e}/`)?void 0:t.toLowerCase()};return n(e)===n(t)}function l(){const{baseUrl:e}=(0,o.Z)().siteConfig;return(0,r.useMemo)((()=>function(e){let{baseUrl:t,routes:n}=e;function r(e){return e.path===t&&!0===e.exact}function a(e){return e.path===t&&!e.exact}return function e(t){if(0===t.length)return;return t.find(r)||e(t.filter(a).flatMap((e=>e.routes??[])))}(n)}({routes:a.Z,baseUrl:e})),[e])}},2466:(e,t,n)=>{"use strict";n.d(t,{Ct:()=>f,OC:()=>s,RF:()=>d});var r=n(7294),a=n(412),o=n(2389),i=n(902);const l=r.createContext(void 0);function s(e){let{children:t}=e;const n=function(){const e=(0,r.useRef)(!0);return(0,r.useMemo)((()=>({scrollEventsEnabledRef:e,enableScrollEvents:()=>{e.current=!0},disableScrollEvents:()=>{e.current=!1}})),[])}();return r.createElement(l.Provider,{value:n},t)}function c(){const e=(0,r.useContext)(l);if(null==e)throw new i.i6("ScrollControllerProvider");return e}const u=()=>a.Z.canUseDOM?{scrollX:window.pageXOffset,scrollY:window.pageYOffset}:null;function d(e,t){void 0===t&&(t=[]);const{scrollEventsEnabledRef:n}=c(),a=(0,r.useRef)(u()),o=(0,i.zX)(e);(0,r.useEffect)((()=>{const e=()=>{if(!n.current)return;const e=u();o(e,a.current),a.current=e},t={passive:!0};return e(),window.addEventListener("scroll",e,t),()=>window.removeEventListener("scroll",e,t)}),[o,n,...t])}function f(){const e=(0,r.useRef)(null),t=(0,o.Z)()&&"smooth"===getComputedStyle(document.documentElement).scrollBehavior;return{startScroll:n=>{e.current=t?function(e){return window.scrollTo({top:e,behavior:"smooth"}),()=>{}}(n):function(e){let t=null;const n=document.documentElement.scrollTop>e;return function r(){const a=document.documentElement.scrollTop;(n&&a>e||!n&&a<e)&&(t=requestAnimationFrame(r),window.scrollTo(0,Math.floor(.85*(a-e))+e))}(),()=>t&&cancelAnimationFrame(t)}(n)},cancelScroll:()=>null==e.current?void 0:e.current()}}},3320:(e,t,n)=>{"use strict";n.d(t,{HX:()=>i,_q:()=>s,os:()=>l});var r=n(143),a=n(2263),o=n(373);const i="default";function l(e,t){return`docs-${e}-${t}`}function s(){const{i18n:e}=(0,a.Z)(),t=(0,r._r)(),n=(0,r.WS)(),s=(0,o.Oh)();const c=[i,...Object.keys(t).map((function(e){const r=(null==n?void 0:n.activePlugin.pluginId)===e?n.activeVersion:void 0,a=s[e],o=t[e].versions.find((e=>e.isLast));return l(e,(r??a??o).name)}))];return{locale:e.currentLocale,tags:c}}},12:(e,t,n)=>{"use strict";n.d(t,{W:()=>l,_:()=>s});const r="localStorage";function a(e){if(void 0===e&&(e=r),"undefined"==typeof window)throw new Error("Browser storage is not available on Node.js/Docusaurus SSR process.");if("none"===e)return null;try{return window[e]}catch(n){return t=n,o||(console.warn("Docusaurus browser storage is not available.\nPossible reasons: running Docusaurus in an iframe, in an incognito browser session, or using too strict browser privacy settings.",t),o=!0),null}var t}let o=!1;const i={get:()=>null,set:()=>{},del:()=>{}};function l(e,t){if("undefined"==typeof window)return function(e){function t(){throw new Error(`Illegal storage API usage for storage key "${e}".\nDocusaurus storage APIs are not supposed to be called on the server-rendering process.\nPlease only call storage APIs in effects and event handlers.`)}return{get:t,set:t,del:t}}(e);const n=a(null==t?void 0:t.persistence);return null===n?i:{get:()=>{try{return n.getItem(e)}catch(t){return console.error(`Docusaurus storage error, can't get key=${e}`,t),null}},set:t=>{try{n.setItem(e,t)}catch(r){console.error(`Docusaurus storage error, can't set ${e}=${t}`,r)}},del:()=>{try{n.removeItem(e)}catch(t){console.error(`Docusaurus storage error, can't delete key=${e}`,t)}}}}function s(e){void 0===e&&(e=r);const t=a(e);if(!t)return[];const n=[];for(let r=0;r<t.length;r+=1){const e=t.key(r);null!==e&&n.push(e)}return n}},4711:(e,t,n)=>{"use strict";n.d(t,{l:()=>o});var r=n(2263),a=n(6775);function o(){const{siteConfig:{baseUrl:e,url:t},i18n:{defaultLocale:n,currentLocale:o}}=(0,r.Z)(),{pathname:i}=(0,a.TH)(),l=o===n?e:e.replace(`/${o}/`,"/"),s=i.replace(e,"");return{createUrl:function(e){let{locale:r,fullyQualified:a}=e;return`${a?t:""}${function(e){return e===n?`${l}`:`${l}${e}/`}(r)}${s}`}}}},5936:(e,t,n)=>{"use strict";n.d(t,{S:()=>i});var r=n(7294),a=n(6775),o=n(902);function i(e){const t=(0,a.TH)(),n=(0,o.D9)(t),i=(0,o.zX)(e);(0,r.useEffect)((()=>{n&&t!==n&&i({location:t,previousLocation:n})}),[i,t,n])}},6668:(e,t,n)=>{"use strict";n.d(t,{L:()=>a});var r=n(2263);function a(){return(0,r.Z)().siteConfig.themeConfig}},8802:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){const{trailingSlash:n,baseUrl:r}=t;if(e.startsWith("#"))return e;if(void 0===n)return e;const[a]=e.split(/[#?]/),o="/"===a||a===r?a:(i=a,n?function(e){return e.endsWith("/")?e:`${e}/`}(i):function(e){return e.endsWith("/")?e.slice(0,-1):e}(i));var i;return e.replace(a,o)}},8780:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.applyTrailingSlash=t.blogPostContainerID=void 0,t.blogPostContainerID="post-content";var a=n(8802);Object.defineProperty(t,"applyTrailingSlash",{enumerable:!0,get:function(){return r(a).default}})},6010:(e,t,n)=>{"use strict";function r(e){var t,n,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=r(e[t]))&&(a&&(a+=" "),a+=n);else for(t in e)e[t]&&(a&&(a+=" "),a+=t);return a}n.d(t,{Z:()=>a});const a=function(){for(var e,t,n=0,a="";n<arguments.length;)(e=arguments[n++])&&(t=r(e))&&(a&&(a+=" "),a+=t);return a}},2358:(e,t,n)=>{"use strict";n.d(t,{lX:()=>S,q_:()=>N,ob:()=>h,PP:()=>L,Ep:()=>m,Hp:()=>g});var r=n(7462);function a(e){return"/"===e.charAt(0)}function o(e,t){for(var n=t,r=n+1,a=e.length;r<a;n+=1,r+=1)e[n]=e[r];e.pop()}const i=function(e,t){void 0===t&&(t="");var n,r=e&&e.split("/")||[],i=t&&t.split("/")||[],l=e&&a(e),s=t&&a(t),c=l||s;if(e&&a(e)?i=r:r.length&&(i.pop(),i=i.concat(r)),!i.length)return"/";if(i.length){var u=i[i.length-1];n="."===u||".."===u||""===u}else n=!1;for(var d=0,f=i.length;f>=0;f--){var p=i[f];"."===p?o(i,f):".."===p?(o(i,f),d++):d&&(o(i,f),d--)}if(!c)for(;d--;d)i.unshift("..");!c||""===i[0]||i[0]&&a(i[0])||i.unshift("");var m=i.join("/");return n&&"/"!==m.substr(-1)&&(m+="/"),m};function l(e){return e.valueOf?e.valueOf():Object.prototype.valueOf.call(e)}const s=function e(t,n){if(t===n)return!0;if(null==t||null==n)return!1;if(Array.isArray(t))return Array.isArray(n)&&t.length===n.length&&t.every((function(t,r){return e(t,n[r])}));if("object"==typeof t||"object"==typeof n){var r=l(t),a=l(n);return r!==t||a!==n?e(r,a):Object.keys(Object.assign({},t,n)).every((function(r){return e(t[r],n[r])}))}return!1};var c=n(2177);function u(e){return"/"===e.charAt(0)?e:"/"+e}function d(e){return"/"===e.charAt(0)?e.substr(1):e}function f(e,t){return function(e,t){return 0===e.toLowerCase().indexOf(t.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(t.length))}(e,t)?e.substr(t.length):e}function p(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function m(e){var t=e.pathname,n=e.search,r=e.hash,a=t||"/";return n&&"?"!==n&&(a+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(a+="#"===r.charAt(0)?r:"#"+r),a}function h(e,t,n,a){var o;"string"==typeof e?(o=function(e){var t=e||"/",n="",r="",a=t.indexOf("#");-1!==a&&(r=t.substr(a),t=t.substr(0,a));var o=t.indexOf("?");return-1!==o&&(n=t.substr(o),t=t.substr(0,o)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}}(e),o.state=t):(void 0===(o=(0,r.Z)({},e)).pathname&&(o.pathname=""),o.search?"?"!==o.search.charAt(0)&&(o.search="?"+o.search):o.search="",o.hash?"#"!==o.hash.charAt(0)&&(o.hash="#"+o.hash):o.hash="",void 0!==t&&void 0===o.state&&(o.state=t));try{o.pathname=decodeURI(o.pathname)}catch(l){throw l instanceof URIError?new URIError('Pathname "'+o.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):l}return n&&(o.key=n),a?o.pathname?"/"!==o.pathname.charAt(0)&&(o.pathname=i(o.pathname,a.pathname)):o.pathname=a.pathname:o.pathname||(o.pathname="/"),o}function g(e,t){return e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash&&e.key===t.key&&s(e.state,t.state)}function b(){var e=null;var t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,a){if(null!=e){var o="function"==typeof e?e(t,n):e;"string"==typeof o?"function"==typeof r?r(o,a):a(!0):a(!1!==o)}else a(!0)},appendListener:function(e){var n=!0;function r(){n&&e.apply(void 0,arguments)}return t.push(r),function(){n=!1,t=t.filter((function(e){return e!==r}))}},notifyListeners:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.forEach((function(e){return e.apply(void 0,n)}))}}}var v=!("undefined"==typeof window||!window.document||!window.document.createElement);function y(e,t){t(window.confirm(e))}var w="popstate",E="hashchange";function k(){try{return window.history.state||{}}catch(e){return{}}}function S(e){void 0===e&&(e={}),v||(0,c.Z)(!1);var t,n=window.history,a=(-1===(t=window.navigator.userAgent).indexOf("Android 2.")&&-1===t.indexOf("Android 4.0")||-1===t.indexOf("Mobile Safari")||-1!==t.indexOf("Chrome")||-1!==t.indexOf("Windows Phone"))&&window.history&&"pushState"in window.history,o=!(-1===window.navigator.userAgent.indexOf("Trident")),i=e,l=i.forceRefresh,s=void 0!==l&&l,d=i.getUserConfirmation,g=void 0===d?y:d,S=i.keyLength,_=void 0===S?6:S,x=e.basename?p(u(e.basename)):"";function T(e){var t=e||{},n=t.key,r=t.state,a=window.location,o=a.pathname+a.search+a.hash;return x&&(o=f(o,x)),h(o,r,n)}function C(){return Math.random().toString(36).substr(2,_)}var A=b();function N(e){(0,r.Z)(z,e),z.length=n.length,A.notifyListeners(z.location,z.action)}function O(e){(function(e){return void 0===e.state&&-1===navigator.userAgent.indexOf("CriOS")})(e)||P(T(e.state))}function L(){P(T(k()))}var I=!1;function P(e){if(I)I=!1,N();else{A.confirmTransitionTo(e,"POP",g,(function(t){t?N({action:"POP",location:e}):function(e){var t=z.location,n=M.indexOf(t.key);-1===n&&(n=0);var r=M.indexOf(e.key);-1===r&&(r=0);var a=n-r;a&&(I=!0,F(a))}(e)}))}}var R=T(k()),M=[R.key];function D(e){return x+m(e)}function F(e){n.go(e)}var B=0;function $(e){1===(B+=e)&&1===e?(window.addEventListener(w,O),o&&window.addEventListener(E,L)):0===B&&(window.removeEventListener(w,O),o&&window.removeEventListener(E,L))}var U=!1;var z={length:n.length,action:"POP",location:R,createHref:D,push:function(e,t){var r="PUSH",o=h(e,t,C(),z.location);A.confirmTransitionTo(o,r,g,(function(e){if(e){var t=D(o),i=o.key,l=o.state;if(a)if(n.pushState({key:i,state:l},null,t),s)window.location.href=t;else{var c=M.indexOf(z.location.key),u=M.slice(0,c+1);u.push(o.key),M=u,N({action:r,location:o})}else window.location.href=t}}))},replace:function(e,t){var r="REPLACE",o=h(e,t,C(),z.location);A.confirmTransitionTo(o,r,g,(function(e){if(e){var t=D(o),i=o.key,l=o.state;if(a)if(n.replaceState({key:i,state:l},null,t),s)window.location.replace(t);else{var c=M.indexOf(z.location.key);-1!==c&&(M[c]=o.key),N({action:r,location:o})}else window.location.replace(t)}}))},go:F,goBack:function(){F(-1)},goForward:function(){F(1)},block:function(e){void 0===e&&(e=!1);var t=A.setPrompt(e);return U||($(1),U=!0),function(){return U&&(U=!1,$(-1)),t()}},listen:function(e){var t=A.appendListener(e);return $(1),function(){$(-1),t()}}};return z}var _="hashchange",x={hashbang:{encodePath:function(e){return"!"===e.charAt(0)?e:"!/"+d(e)},decodePath:function(e){return"!"===e.charAt(0)?e.substr(1):e}},noslash:{encodePath:d,decodePath:u},slash:{encodePath:u,decodePath:u}};function T(e){var t=e.indexOf("#");return-1===t?e:e.slice(0,t)}function C(){var e=window.location.href,t=e.indexOf("#");return-1===t?"":e.substring(t+1)}function A(e){window.location.replace(T(window.location.href)+"#"+e)}function N(e){void 0===e&&(e={}),v||(0,c.Z)(!1);var t=window.history,n=(window.navigator.userAgent.indexOf("Firefox"),e),a=n.getUserConfirmation,o=void 0===a?y:a,i=n.hashType,l=void 0===i?"slash":i,s=e.basename?p(u(e.basename)):"",d=x[l],g=d.encodePath,w=d.decodePath;function E(){var e=w(C());return s&&(e=f(e,s)),h(e)}var k=b();function S(e){(0,r.Z)(U,e),U.length=t.length,k.notifyListeners(U.location,U.action)}var N=!1,O=null;function L(){var e,t,n=C(),r=g(n);if(n!==r)A(r);else{var a=E(),i=U.location;if(!N&&(t=a,(e=i).pathname===t.pathname&&e.search===t.search&&e.hash===t.hash))return;if(O===m(a))return;O=null,function(e){if(N)N=!1,S();else{var t="POP";k.confirmTransitionTo(e,t,o,(function(n){n?S({action:t,location:e}):function(e){var t=U.location,n=M.lastIndexOf(m(t));-1===n&&(n=0);var r=M.lastIndexOf(m(e));-1===r&&(r=0);var a=n-r;a&&(N=!0,D(a))}(e)}))}}(a)}}var I=C(),P=g(I);I!==P&&A(P);var R=E(),M=[m(R)];function D(e){t.go(e)}var F=0;function B(e){1===(F+=e)&&1===e?window.addEventListener(_,L):0===F&&window.removeEventListener(_,L)}var $=!1;var U={length:t.length,action:"POP",location:R,createHref:function(e){var t=document.querySelector("base"),n="";return t&&t.getAttribute("href")&&(n=T(window.location.href)),n+"#"+g(s+m(e))},push:function(e,t){var n="PUSH",r=h(e,void 0,void 0,U.location);k.confirmTransitionTo(r,n,o,(function(e){if(e){var t=m(r),a=g(s+t);if(C()!==a){O=t,function(e){window.location.hash=e}(a);var o=M.lastIndexOf(m(U.location)),i=M.slice(0,o+1);i.push(t),M=i,S({action:n,location:r})}else S()}}))},replace:function(e,t){var n="REPLACE",r=h(e,void 0,void 0,U.location);k.confirmTransitionTo(r,n,o,(function(e){if(e){var t=m(r),a=g(s+t);C()!==a&&(O=t,A(a));var o=M.indexOf(m(U.location));-1!==o&&(M[o]=t),S({action:n,location:r})}}))},go:D,goBack:function(){D(-1)},goForward:function(){D(1)},block:function(e){void 0===e&&(e=!1);var t=k.setPrompt(e);return $||(B(1),$=!0),function(){return $&&($=!1,B(-1)),t()}},listen:function(e){var t=k.appendListener(e);return B(1),function(){B(-1),t()}}};return U}function O(e,t,n){return Math.min(Math.max(e,t),n)}function L(e){void 0===e&&(e={});var t=e,n=t.getUserConfirmation,a=t.initialEntries,o=void 0===a?["/"]:a,i=t.initialIndex,l=void 0===i?0:i,s=t.keyLength,c=void 0===s?6:s,u=b();function d(e){(0,r.Z)(w,e),w.length=w.entries.length,u.notifyListeners(w.location,w.action)}function f(){return Math.random().toString(36).substr(2,c)}var p=O(l,0,o.length-1),g=o.map((function(e){return h(e,void 0,"string"==typeof e?f():e.key||f())})),v=m;function y(e){var t=O(w.index+e,0,w.entries.length-1),r=w.entries[t];u.confirmTransitionTo(r,"POP",n,(function(e){e?d({action:"POP",location:r,index:t}):d()}))}var w={length:g.length,action:"POP",location:g[p],index:p,entries:g,createHref:v,push:function(e,t){var r="PUSH",a=h(e,t,f(),w.location);u.confirmTransitionTo(a,r,n,(function(e){if(e){var t=w.index+1,n=w.entries.slice(0);n.length>t?n.splice(t,n.length-t,a):n.push(a),d({action:r,location:a,index:t,entries:n})}}))},replace:function(e,t){var r="REPLACE",a=h(e,t,f(),w.location);u.confirmTransitionTo(a,r,n,(function(e){e&&(w.entries[w.index]=a,d({action:r,location:a}))}))},go:y,goBack:function(){y(-1)},goForward:function(){y(1)},canGo:function(e){var t=w.index+e;return t>=0&&t<w.entries.length},block:function(e){return void 0===e&&(e=!1),u.setPrompt(e)},listen:function(e){return u.appendListener(e)}};return w}},8679:(e,t,n)=>{"use strict";var r=n(9864),a={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function s(e){return r.isMemo(e)?i:l[e.$$typeof]||a}l[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[r.Memo]=i;var c=Object.defineProperty,u=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,m=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(m){var a=p(n);a&&a!==m&&e(t,a,r)}var i=u(n);d&&(i=i.concat(d(n)));for(var l=s(t),h=s(n),g=0;g<i.length;++g){var b=i[g];if(!(o[b]||r&&r[b]||h&&h[b]||l&&l[b])){var v=f(n,b);try{c(t,b,v)}catch(y){}}}}return t}},1143:e=>{"use strict";e.exports=function(e,t,n,r,a,o,i,l){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,a,o,i,l],u=0;(s=new Error(t.replace(/%s/g,(function(){return c[u++]})))).name="Invariant Violation"}throw s.framesToPop=1,s}}},5826:e=>{e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},2497:(e,t,n)=>{"use strict";n.r(t)},6882:(e,t,n)=>{"use strict";n.r(t)},8049:(e,t,n)=>{"use strict";n.r(t)},4865:function(e,t,n){var r,a;r=function(){var e,t,n={version:"0.2.0"},r=n.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};function a(e,t,n){return e<t?t:e>n?n:e}function o(e){return 100*(-1+e)}function i(e,t,n){var a;return(a="translate3d"===r.positionUsing?{transform:"translate3d("+o(e)+"%,0,0)"}:"translate"===r.positionUsing?{transform:"translate("+o(e)+"%,0)"}:{"margin-left":o(e)+"%"}).transition="all "+t+"ms "+n,a}n.configure=function(e){var t,n;for(t in e)void 0!==(n=e[t])&&e.hasOwnProperty(t)&&(r[t]=n);return this},n.status=null,n.set=function(e){var t=n.isStarted();e=a(e,r.minimum,1),n.status=1===e?null:e;var o=n.render(!t),c=o.querySelector(r.barSelector),u=r.speed,d=r.easing;return o.offsetWidth,l((function(t){""===r.positionUsing&&(r.positionUsing=n.getPositioningCSS()),s(c,i(e,u,d)),1===e?(s(o,{transition:"none",opacity:1}),o.offsetWidth,setTimeout((function(){s(o,{transition:"all "+u+"ms linear",opacity:0}),setTimeout((function(){n.remove(),t()}),u)}),u)):setTimeout(t,u)})),this},n.isStarted=function(){return"number"==typeof n.status},n.start=function(){n.status||n.set(0);var e=function(){setTimeout((function(){n.status&&(n.trickle(),e())}),r.trickleSpeed)};return r.trickle&&e(),this},n.done=function(e){return e||n.status?n.inc(.3+.5*Math.random()).set(1):this},n.inc=function(e){var t=n.status;return t?("number"!=typeof e&&(e=(1-t)*a(Math.random()*t,.1,.95)),t=a(t+e,0,.994),n.set(t)):n.start()},n.trickle=function(){return n.inc(Math.random()*r.trickleRate)},e=0,t=0,n.promise=function(r){return r&&"resolved"!==r.state()?(0===t&&n.start(),e++,t++,r.always((function(){0==--t?(e=0,n.done()):n.set((e-t)/e)})),this):this},n.render=function(e){if(n.isRendered())return document.getElementById("nprogress");u(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=r.template;var a,i=t.querySelector(r.barSelector),l=e?"-100":o(n.status||0),c=document.querySelector(r.parent);return s(i,{transition:"all 0 linear",transform:"translate3d("+l+"%,0,0)"}),r.showSpinner||(a=t.querySelector(r.spinnerSelector))&&p(a),c!=document.body&&u(c,"nprogress-custom-parent"),c.appendChild(t),t},n.remove=function(){d(document.documentElement,"nprogress-busy"),d(document.querySelector(r.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&p(e)},n.isRendered=function(){return!!document.getElementById("nprogress")},n.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective"in e?"translate3d":t+"Transform"in e?"translate":"margin"};var l=function(){var e=[];function t(){var n=e.shift();n&&n(t)}return function(n){e.push(n),1==e.length&&t()}}(),s=function(){var e=["Webkit","O","Moz","ms"],t={};function n(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,t){return t.toUpperCase()}))}function r(t){var n=document.body.style;if(t in n)return t;for(var r,a=e.length,o=t.charAt(0).toUpperCase()+t.slice(1);a--;)if((r=e[a]+o)in n)return r;return t}function a(e){return e=n(e),t[e]||(t[e]=r(e))}function o(e,t,n){t=a(t),e.style[t]=n}return function(e,t){var n,r,a=arguments;if(2==a.length)for(n in t)void 0!==(r=t[n])&&t.hasOwnProperty(n)&&o(e,n,r);else o(e,a[1],a[2])}}();function c(e,t){return("string"==typeof e?e:f(e)).indexOf(" "+t+" ")>=0}function u(e,t){var n=f(e),r=n+t;c(n,t)||(e.className=r.substring(1))}function d(e,t){var n,r=f(e);c(e,t)&&(n=r.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function f(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function p(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return n},void 0===(a="function"==typeof r?r.call(t,n,t,e):r)||(e.exports=a)},7418:e=>{"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function a(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(a){return!1}}()?Object.assign:function(e,o){for(var i,l,s=a(e),c=1;c<arguments.length;c++){for(var u in i=Object(arguments[c]))n.call(i,u)&&(s[u]=i[u]);if(t){l=t(i);for(var d=0;d<l.length;d++)r.call(i,l[d])&&(s[l[d]]=i[l[d]])}}return s}},4779:(e,t,n)=>{var r=n(5826);e.exports=p,e.exports.parse=o,e.exports.compile=function(e,t){return l(o(e,t),t)},e.exports.tokensToFunction=l,e.exports.tokensToRegExp=f;var a=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function o(e,t){for(var n,r=[],o=0,i=0,l="",u=t&&t.delimiter||"/";null!=(n=a.exec(e));){var d=n[0],f=n[1],p=n.index;if(l+=e.slice(i,p),i=p+d.length,f)l+=f[1];else{var m=e[i],h=n[2],g=n[3],b=n[4],v=n[5],y=n[6],w=n[7];l&&(r.push(l),l="");var E=null!=h&&null!=m&&m!==h,k="+"===y||"*"===y,S="?"===y||"*"===y,_=n[2]||u,x=b||v;r.push({name:g||o++,prefix:h||"",delimiter:_,optional:S,repeat:k,partial:E,asterisk:!!w,pattern:x?c(x):w?".*":"[^"+s(_)+"]+?"})}}return i<e.length&&(l+=e.substr(i)),l&&r.push(l),r}function i(e){return encodeURI(e).replace(/[\/?#]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))}function l(e,t){for(var n=new Array(e.length),a=0;a<e.length;a++)"object"==typeof e[a]&&(n[a]=new RegExp("^(?:"+e[a].pattern+")$",d(t)));return function(t,a){for(var o="",l=t||{},s=(a||{}).pretty?i:encodeURIComponent,c=0;c<e.length;c++){var u=e[c];if("string"!=typeof u){var d,f=l[u.name];if(null==f){if(u.optional){u.partial&&(o+=u.prefix);continue}throw new TypeError('Expected "'+u.name+'" to be defined')}if(r(f)){if(!u.repeat)throw new TypeError('Expected "'+u.name+'" to not repeat, but received `'+JSON.stringify(f)+"`");if(0===f.length){if(u.optional)continue;throw new TypeError('Expected "'+u.name+'" to not be empty')}for(var p=0;p<f.length;p++){if(d=s(f[p]),!n[c].test(d))throw new TypeError('Expected all "'+u.name+'" to match "'+u.pattern+'", but received `'+JSON.stringify(d)+"`");o+=(0===p?u.prefix:u.delimiter)+d}}else{if(d=u.asterisk?encodeURI(f).replace(/[?#]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})):s(f),!n[c].test(d))throw new TypeError('Expected "'+u.name+'" to match "'+u.pattern+'", but received "'+d+'"');o+=u.prefix+d}}else o+=u}return o}}function s(e){return e.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function c(e){return e.replace(/([=!:$\/()])/g,"\\$1")}function u(e,t){return e.keys=t,e}function d(e){return e&&e.sensitive?"":"i"}function f(e,t,n){r(t)||(n=t||n,t=[]);for(var a=(n=n||{}).strict,o=!1!==n.end,i="",l=0;l<e.length;l++){var c=e[l];if("string"==typeof c)i+=s(c);else{var f=s(c.prefix),p="(?:"+c.pattern+")";t.push(c),c.repeat&&(p+="(?:"+f+p+")*"),i+=p=c.optional?c.partial?f+"("+p+")?":"(?:"+f+"("+p+"))?":f+"("+p+")"}}var m=s(n.delimiter||"/"),h=i.slice(-m.length)===m;return a||(i=(h?i.slice(0,-m.length):i)+"(?:"+m+"(?=$))?"),i+=o?"$":a&&h?"":"(?="+m+"|$)",u(new RegExp("^"+i,d(n)),t)}function p(e,t,n){return r(t)||(n=t||n,t=[]),n=n||{},e instanceof RegExp?function(e,t){var n=e.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)t.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return u(e,t)}(e,t):r(e)?function(e,t,n){for(var r=[],a=0;a<e.length;a++)r.push(p(e[a],t,n).source);return u(new RegExp("(?:"+r.join("|")+")",d(n)),t)}(e,t,n):function(e,t,n){return f(o(e,n),t,n)}(e,t,n)}},7410:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=function(){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,n={},r={util:{encode:function e(t){return t instanceof a?new a(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function e(t,n){var a,o;switch(n=n||{},r.util.type(t)){case"Object":if(o=r.util.objId(t),n[o])return n[o];for(var i in a={},n[o]=a,t)t.hasOwnProperty(i)&&(a[i]=e(t[i],n));return a;case"Array":return o=r.util.objId(t),n[o]?n[o]:(a=[],n[o]=a,t.forEach((function(t,r){a[r]=e(t,n)})),a);default:return t}},getLanguage:function(t){for(;t;){var n=e.exec(t.className);if(n)return n[1].toLowerCase();t=t.parentElement}return"none"},setLanguage:function(t,n){t.className=t.className.replace(RegExp(e,"gi"),""),t.classList.add("language-"+n)},isActive:function(e,t,n){for(var r="no-"+t;e;){var a=e.classList;if(a.contains(t))return!0;if(a.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:n,plaintext:n,text:n,txt:n,extend:function(e,t){var n=r.util.clone(r.languages[e]);for(var a in t)n[a]=t[a];return n},insertBefore:function(e,t,n,a){var o=(a=a||r.languages)[e],i={};for(var l in o)if(o.hasOwnProperty(l)){if(l==t)for(var s in n)n.hasOwnProperty(s)&&(i[s]=n[s]);n.hasOwnProperty(l)||(i[l]=o[l])}var c=a[e];return a[e]=i,r.languages.DFS(r.languages,(function(t,n){n===c&&t!=e&&(this[t]=i)})),i},DFS:function e(t,n,a,o){o=o||{};var i=r.util.objId;for(var l in t)if(t.hasOwnProperty(l)){n.call(t,l,t[l],a||l);var s=t[l],c=r.util.type(s);"Object"!==c||o[i(s)]?"Array"!==c||o[i(s)]||(o[i(s)]=!0,e(s,n,l,o)):(o[i(s)]=!0,e(s,n,null,o))}}},plugins:{},highlight:function(e,t,n){var o={code:e,grammar:t,language:n};return r.hooks.run("before-tokenize",o),o.tokens=r.tokenize(o.code,o.grammar),r.hooks.run("after-tokenize",o),a.stringify(r.util.encode(o.tokens),o.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var a=new l;return s(a,a.head,e),i(e,a,t,a.head,0),function(e){var t=[],n=e.head.next;for(;n!==e.tail;)t.push(n.value),n=n.next;return t}(a)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var a,o=0;a=n[o++];)a(t)}},Token:a};function a(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length}function o(e,t,n,r){e.lastIndex=t;var a=e.exec(n);if(a&&r&&a[1]){var o=a[1].length;a.index+=o,a[0]=a[0].slice(o)}return a}function i(e,t,n,l,u,d){for(var f in n)if(n.hasOwnProperty(f)&&n[f]){var p=n[f];p=Array.isArray(p)?p:[p];for(var m=0;m<p.length;++m){if(d&&d.cause==f+","+m)return;var h=p[m],g=h.inside,b=!!h.lookbehind,v=!!h.greedy,y=h.alias;if(v&&!h.pattern.global){var w=h.pattern.toString().match(/[imsuy]*$/)[0];h.pattern=RegExp(h.pattern.source,w+"g")}for(var E=h.pattern||h,k=l.next,S=u;k!==t.tail&&!(d&&S>=d.reach);S+=k.value.length,k=k.next){var _=k.value;if(t.length>e.length)return;if(!(_ instanceof a)){var x,T=1;if(v){if(!(x=o(E,S,e,b))||x.index>=e.length)break;var C=x.index,A=x.index+x[0].length,N=S;for(N+=k.value.length;C>=N;)N+=(k=k.next).value.length;if(S=N-=k.value.length,k.value instanceof a)continue;for(var O=k;O!==t.tail&&(N<A||"string"==typeof O.value);O=O.next)T++,N+=O.value.length;T--,_=e.slice(S,N),x.index-=S}else if(!(x=o(E,0,_,b)))continue;C=x.index;var L=x[0],I=_.slice(0,C),P=_.slice(C+L.length),R=S+_.length;d&&R>d.reach&&(d.reach=R);var M=k.prev;if(I&&(M=s(t,M,I),S+=I.length),c(t,M,T),k=s(t,M,new a(f,g?r.tokenize(L,g):L,y,L)),P&&s(t,k,P),T>1){var D={cause:f+","+m,reach:R};i(e,t,n,k.prev,S,D),d&&D.reach>d.reach&&(d.reach=D.reach)}}}}}}function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function s(e,t,n){var r=t.next,a={value:n,prev:t,next:r};return t.next=a,r.prev=a,e.length++,a}function c(e,t,n){for(var r=t.next,a=0;a<n&&r!==e.tail;a++)r=r.next;t.next=r,r.prev=t,e.length-=a}return a.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var a="";return t.forEach((function(t){a+=e(t,n)})),a}var o={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},i=t.alias;i&&(Array.isArray(i)?Array.prototype.push.apply(o.classes,i):o.classes.push(i)),r.hooks.run("wrap",o);var l="";for(var s in o.attributes)l+=" "+s+'="'+(o.attributes[s]||"").replace(/"/g,""")+'"';return"<"+o.tag+' class="'+o.classes.join(" ")+'"'+l+">"+o.content+"</"+o.tag+">"},r}(),a=r;r.default=r,a.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},a.languages.markup.tag.inside["attr-value"].inside.entity=a.languages.markup.entity,a.languages.markup.doctype.inside["internal-subset"].inside=a.languages.markup,a.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(a.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:a.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:a.languages[t]};var o={};o[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},a.languages.insertBefore("markup","cdata",o)}}),Object.defineProperty(a.languages.markup.tag,"addAttribute",{value:function(e,t){a.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:a.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),a.languages.html=a.languages.markup,a.languages.mathml=a.languages.markup,a.languages.svg=a.languages.markup,a.languages.xml=a.languages.extend("markup",{}),a.languages.ssml=a.languages.xml,a.languages.atom=a.languages.xml,a.languages.rss=a.languages.xml,function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var a=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=r.variable[1].inside,i=0;i<a.length;i++)o[a[i]]=e.languages.bash[a[i]];e.languages.shell=e.languages.bash}(a),a.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},a.languages.c=a.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),a.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),a.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},a.languages.c.string],char:a.languages.c.char,comment:a.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:a.languages.c}}}}),a.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete a.languages.c.boolean,function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,(function(){return t.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,(function(){return n}))+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(a),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(a),function(e){var t,n=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css.selector={pattern:e.languages.css.selector.pattern,lookbehind:!0,inside:t={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+n.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[n,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=t,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}});var r={pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0},a={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:"color"},color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:r,number:a,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:r,number:a})}(a),a.languages.javascript=a.languages.extend("clike",{"class-name":[a.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),a.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,a.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:a.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:a.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:a.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:a.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:a.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),a.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:a.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),a.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),a.languages.markup&&(a.languages.markup.tag.addInlined("script","javascript"),a.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),a.languages.js=a.languages.javascript,function(e){var t=/#(?!\{).+/,n={pattern:/#\{[^}]+\}/,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:n}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:t,interpolation:n}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},script:{pattern:/[\s\S]+/,alias:"language-javascript",inside:e.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:"string"},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string",inside:{interpolation:n}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript["template-string"],e.languages.coffee=e.languages.coffeescript}(a),function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+n.source+"(?:[ \t]+"+t.source+")?|"+t.source+"(?:[ \t]+"+n.source+")?)",a=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,(function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source})),o=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function i(e,t){t=(t||"").replace(/m/g,"")+"m";var n=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,(function(){return r})).replace(/<<value>>/g,(function(){return e}));return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,(function(){return r}))),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,(function(){return r})).replace(/<<key>>/g,(function(){return"(?:"+a+"|"+o+")"}))),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:i(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:i(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:i(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:i(o),lookbehind:!0,greedy:!0},number:{pattern:i(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(a),function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(/<inner>/g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,a=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return r})),o=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+a+o+"(?:"+a+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+a+o+")(?:"+a+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+a+")"+o+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+a+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n<r;n++){var a=t[n];if("code"===a.type){var o=a.content[1],i=a.content[3];if(o&&i&&"code-language"===o.type&&"code-block"===i.type&&"string"==typeof o.content){var l=o.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),s="language-"+(l=(/[a-z][\w-]*/i.exec(l)||[""])[0].toLowerCase());i.alias?"string"==typeof i.alias?i.alias=[i.alias,s]:i.alias.push(s):i.alias=[s]}}else e(a.content)}}(e.tokens)})),e.hooks.add("wrap",(function(t){if("code-block"===t.type){for(var n="",r=0,a=t.classes.length;r<a;r++){var o=t.classes[r],c=/language-(.+)/.exec(o);if(c){n=c[1];break}}var u,d=e.languages[n];if(d)t.content=e.highlight((u=t.content,u.replace(i,"").replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,(function(e,t){var n;if("#"===(t=t.toLowerCase())[0])return n="x"===t[1]?parseInt(t.slice(2),16):Number(t.slice(1)),s(n);var r=l[t];return r||e}))),d,n);else if(n&&"none"!==n&&e.plugins.autoloader){var f="md-"+(new Date).valueOf()+"-"+Math.floor(1e16*Math.random());t.attributes.id=f,e.plugins.autoloader.loadLanguages(n,(function(){var t=document.getElementById(f);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))}))}}}));var i=RegExp(e.languages.markup.tag.pattern.source,"gi"),l={amp:"&",lt:"<",gt:">",quot:'"'},s=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(a),a.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:a.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},a.hooks.add("after-tokenize",(function(e){if("graphql"===e.language)for(var t=e.tokens.filter((function(e){return"string"!=typeof e&&"comment"!==e.type&&"scalar"!==e.type})),n=0;n<t.length;){var r=t[n++];if("keyword"===r.type&&"mutation"===r.content){var a=[];if(d(["definition-mutation","punctuation"])&&"("===u(1).content){n+=2;var o=f(/^\($/,/^\)$/);if(-1===o)continue;for(;n<o;n++){var i=u(0);"variable"===i.type&&(p(i,"variable-input"),a.push(i.content))}n=o+1}if(d(["punctuation","property-query"])&&"{"===u(0).content&&(n++,p(u(0),"property-mutation"),a.length>0)){var l=f(/^\{$/,/^\}$/);if(-1===l)continue;for(var s=n;s<l;s++){var c=t[s];"variable"===c.type&&a.indexOf(c.content)>=0&&p(c,"variable-input")}}}}function u(e){return t[n+e]}function d(e,t){t=t||0;for(var n=0;n<e.length;n++){var r=u(n+t);if(!r||r.type!==e[n])return!1}return!0}function f(e,r){for(var a=1,o=n;o<t.length;o++){var i=t[o],l=i.content;if("punctuation"===i.type&&"string"==typeof l)if(e.test(l))a++;else if(r.test(l)&&0===--a)return o}return-1}function p(e,t){var n=e.alias;n?Array.isArray(n)||(e.alias=n=[n]):e.alias=n=[],n.push(t)}})),a.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.javascript["template-string"],n=t.pattern.source,r=t.inside.interpolation,a=r.inside["interpolation-punctuation"],o=r.pattern.source;function i(t,r){if(e.languages[t])return{pattern:RegExp("((?:"+r+")\\s*)"+n),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},"embedded-code":{pattern:/[\s\S]+/,alias:t}}}}function l(e,t){return"___"+t.toUpperCase()+"_"+e+"___"}function s(t,n,r){var a={code:t,grammar:n,language:r};return e.hooks.run("before-tokenize",a),a.tokens=e.tokenize(a.code,a.grammar),e.hooks.run("after-tokenize",a),a.tokens}function c(t){var n={};n["interpolation-punctuation"]=a;var o=e.tokenize(t,n);if(3===o.length){var i=[1,1];i.push.apply(i,s(o[1],e.languages.javascript,"javascript")),o.splice.apply(o,i)}return new e.Token("interpolation",o,r.alias,t)}function u(t,n,r){var a=e.tokenize(t,{interpolation:{pattern:RegExp(o),lookbehind:!0}}),i=0,u={},d=s(a.map((function(e){if("string"==typeof e)return e;for(var n,a=e.content;-1!==t.indexOf(n=l(i++,r)););return u[n]=a,n})).join(""),n,r),f=Object.keys(u);return i=0,function e(t){for(var n=0;n<t.length;n++){if(i>=f.length)return;var r=t[n];if("string"==typeof r||"string"==typeof r.content){var a=f[i],o="string"==typeof r?r:r.content,l=o.indexOf(a);if(-1!==l){++i;var s=o.substring(0,l),d=c(u[a]),p=o.substring(l+a.length),m=[];if(s&&m.push(s),m.push(d),p){var h=[p];e(h),m.push.apply(m,h)}"string"==typeof r?(t.splice.apply(t,[n,1].concat(m)),n+=m.length-1):r.content=m}}else{var g=r.content;Array.isArray(g)?e(g):e([g])}}}(d),new e.Token(r,d,"language-"+r,t)}e.languages.javascript["template-string"]=[i("css",/\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source),i("html",/\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source),i("svg",/\bsvg/.source),i("markdown",/\b(?:markdown|md)/.source),i("graphql",/\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source),i("sql",/\bsql/.source),t].filter(Boolean);var d={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function f(e){return"string"==typeof e?e:Array.isArray(e)?e.map(f).join(""):f(e.content)}e.hooks.add("after-tokenize",(function(t){t.language in d&&function t(n){for(var r=0,a=n.length;r<a;r++){var o=n[r];if("string"!=typeof o){var i=o.content;if(Array.isArray(i))if("template-string"===o.type){var l=i[1];if(3===i.length&&"string"!=typeof l&&"embedded-code"===l.type){var s=f(l),c=l.alias,d=Array.isArray(c)?c[0]:c,p=e.languages[d];if(!p)continue;i[1]=u(s,p,d)}}else t(i);else"string"!=typeof i&&t([i])}}}(t.tokens)}))}(a),function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(a),function(e){function t(e,t){return RegExp(e.replace(/<ID>/g,(function(){return/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source})),t)}e.languages.insertBefore("javascript","function-variable",{"method-variable":{pattern:RegExp("(\\.\\s*)"+e.languages.javascript["function-variable"].pattern.source),lookbehind:!0,alias:["function-variable","method","function","property-access"]}}),e.languages.insertBefore("javascript","function",{method:{pattern:RegExp("(\\.\\s*)"+e.languages.javascript.function.source),lookbehind:!0,alias:["function","property-access"]}}),e.languages.insertBefore("javascript","constant",{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:"class-name"},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:"class-name"}]}),e.languages.insertBefore("javascript","keyword",{imports:{pattern:t(/(\bimport\b\s*)(?:<ID>(?:\s*,\s*(?:\*\s*as\s+<ID>|\{[^{}]*\}))?|\*\s*as\s+<ID>|\{[^{}]*\})(?=\s*\bfrom\b)/.source),lookbehind:!0,inside:e.languages.javascript},exports:{pattern:t(/(\bexport\b\s*)(?:\*(?:\s*as\s+<ID>)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),lookbehind:!0,inside:e.languages.javascript}}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:"module"},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:"control-flow"},{pattern:/\bnull\b/,alias:["null","nil"]},{pattern:/\bundefined\b/,alias:"nil"}),e.languages.insertBefore("javascript","operator",{spread:{pattern:/\.{3}/,alias:"operator"},arrow:{pattern:/=>/,alias:"operator"}}),e.languages.insertBefore("javascript","punctuation",{"property-access":{pattern:t(/(\.\s*)#?<ID>/.source),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:"variable"},console:{pattern:/\bconsole(?=\s*\.)/,alias:"class-name"}});for(var n=["function","function-variable","method","method-variable","property-access"],r=0;r<n.length;r++){var a=n[r],o=e.languages.javascript[a];"RegExp"===e.util.type(o)&&(o=e.languages.javascript[a]={pattern:o});var i=o.inside||{};o.inside=i,i["maybe-class-name"]=/^[A-Z][\s\S]*/}}(a),function(e){var t=e.util.clone(e.languages.javascript),n=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,r=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,a=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function o(e,t){return e=e.replace(/<S>/g,(function(){return n})).replace(/<BRACES>/g,(function(){return r})).replace(/<SPREAD>/g,(function(){return a})),RegExp(e,t)}a=o(a).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=o(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:o(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:o(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var i=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(i).join(""):""},l=function(t){for(var n=[],r=0;r<t.length;r++){var a=t[r],o=!1;if("string"!=typeof a&&("tag"===a.type&&a.content[0]&&"tag"===a.content[0].type?"</"===a.content[0].content[0].content?n.length>0&&n[n.length-1].tagName===i(a.content[0].content[1])&&n.pop():"/>"===a.content[a.content.length-1].content||n.push({tagName:i(a.content[0].content[1]),openedBraces:0}):n.length>0&&"punctuation"===a.type&&"{"===a.content?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&"punctuation"===a.type&&"}"===a.content?n[n.length-1].openedBraces--:o=!0),(o||"string"==typeof a)&&n.length>0&&0===n[n.length-1].openedBraces){var s=i(a);r<t.length-1&&("string"==typeof t[r+1]||"plain-text"===t[r+1].type)&&(s+=i(t[r+1]),t.splice(r+1,1)),r>0&&("string"==typeof t[r-1]||"plain-text"===t[r-1].type)&&(s=i(t[r-1])+s,t.splice(r-1,1),r--),t[r]=new e.Token("plain-text",s,null,s)}a.content&&"string"!=typeof a.content&&l(a.content)}};e.hooks.add("after-tokenize",(function(e){"jsx"!==e.language&&"tsx"!==e.language||l(e.tokens)}))}(a),function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach((function(n){var r=t[n],a=[];/^\w+$/.test(n)||a.push(/\w+/.exec(n)[0]),"diff"===n&&a.push("bold"),e.languages.diff[n]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:a,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})}(a),a.languages.git={comment:/^#.*/m,deleted:/^[-\u2013].*/m,inserted:/^\+.*/m,string:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s--?\w+/}},coord:/^@@.*@@$/m,"commit-sha1":/^commit \w{40}$/m},a.languages.go=a.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),a.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete a.languages.go["class-name"],function(e){function t(e,t){return"___"+e.toUpperCase()+t+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(n,r,a,o){if(n.language===r){var i=n.tokenStack=[];n.code=n.code.replace(a,(function(e){if("function"==typeof o&&!o(e))return e;for(var a,l=i.length;-1!==n.code.indexOf(a=t(r,l));)++l;return i[l]=e,a})),n.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(n,r){if(n.language===r&&n.tokenStack){n.grammar=e.languages[r];var a=0,o=Object.keys(n.tokenStack);!function i(l){for(var s=0;s<l.length&&!(a>=o.length);s++){var c=l[s];if("string"==typeof c||c.content&&"string"==typeof c.content){var u=o[a],d=n.tokenStack[u],f="string"==typeof c?c:c.content,p=t(r,u),m=f.indexOf(p);if(m>-1){++a;var h=f.substring(0,m),g=new e.Token(r,e.tokenize(d,n.grammar),"language-"+r,d),b=f.substring(m+p.length),v=[];h&&v.push.apply(v,i([h])),v.push(g),b&&v.push.apply(v,i([b])),"string"==typeof c?l.splice.apply(l,[s,1].concat(v)):c.content=v}}else c.content&&i(c.content)}return l}(n.tokens)}}}})}(a),function(e){e.languages.handlebars={comment:/\{\{![\s\S]*?\}\}/,delimiter:{pattern:/^\{\{\{?|\}\}\}?$/,alias:"punctuation"},string:/(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][+-]?\d+)?/,boolean:/\b(?:false|true)\b/,block:{pattern:/^(\s*(?:~\s*)?)[#\/]\S+?(?=\s*(?:~\s*)?$|\s)/,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/,variable:/[\s\S]+/}},punctuation:/[!"#%&':()*+,.\/;<=>@\[\\\]^`{|}~]/,variable:/[^!"#%&'()*+,\/;<=>@\[\\\]^`{|}~\s]+/},e.hooks.add("before-tokenize",(function(t){e.languages["markup-templating"].buildPlaceholders(t,"handlebars",/\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g)})),e.hooks.add("after-tokenize",(function(t){e.languages["markup-templating"].tokenizePlaceholders(t,"handlebars")})),e.languages.hbs=e.languages.handlebars}(a),a.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},a.languages.webmanifest=a.languages.json,a.languages.less=a.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),a.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}}),a.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"builtin-target":{pattern:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,alias:"builtin"},target:{pattern:/^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,alias:"symbol",inside:{variable:/\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,function:{pattern:/(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,lookbehind:!0},operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/},a.languages.objectivec=a.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete a.languages.objectivec["class-name"],a.languages.objc=a.languages.objectivec,a.languages.ocaml={comment:{pattern:/\(\*[\s\S]*?\*\)/,greedy:!0},char:{pattern:/'(?:[^\\\r\n']|\\(?:.|[ox]?[0-9a-f]{1,3}))'/i,greedy:!0},string:[{pattern:/"(?:\\(?:[\s\S]|\r\n)|[^\\\r\n"])*"/,greedy:!0},{pattern:/\{([a-z_]*)\|[\s\S]*?\|\1\}/,greedy:!0}],number:[/\b(?:0b[01][01_]*|0o[0-7][0-7_]*)\b/i,/\b0x[a-f0-9][a-f0-9_]*(?:\.[a-f0-9_]*)?(?:p[+-]?\d[\d_]*)?(?!\w)/i,/\b\d[\d_]*(?:\.[\d_]*)?(?:e[+-]?\d[\d_]*)?(?!\w)/i],directive:{pattern:/\B#\w+/,alias:"property"},label:{pattern:/\B~\w+/,alias:"property"},"type-variable":{pattern:/\B'\w+/,alias:"function"},variant:{pattern:/`\w+/,alias:"symbol"},keyword:/\b(?:as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|nonrec|object|of|open|private|rec|sig|struct|then|to|try|type|val|value|virtual|when|where|while|with)\b/,boolean:/\b(?:false|true)\b/,"operator-like-punctuation":{pattern:/\[[<>|]|[>|]\]|\{<|>\}/,alias:"punctuation"},operator:/\.[.~]|:[=>]|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lsl|lsr|lxor|mod|or)\b/,punctuation:/;;|::|[(){}\[\].,:;#]|\b_\b/},a.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},a.languages.python["string-interpolation"].inside.interpolation.inside.rest=a.languages.python,a.languages.py=a.languages.python,a.languages.reason=a.languages.extend("clike",{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),a.languages.insertBefore("reason","class-name",{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:"symbol"}}),delete a.languages.reason.function,function(e){e.languages.sass=e.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),e.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete e.languages.sass.atrule;var t=/\$[-\w]+|#\{\$[-\w]+\}/,n=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];e.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:t,operator:n}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:t,operator:n,important:e.languages.sass.important}}}),delete e.languages.sass.property,delete e.languages.sass.important,e.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})}(a),a.languages.scss=a.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),a.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),a.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),a.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),a.languages.scss.atrule.inside.rest=a.languages.scss,function(e){var t={pattern:/(\b\d+)(?:%|[a-z]+)/,lookbehind:!0},n={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0},r={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},url:{pattern:/\burl\((["']?).*?\1\)/i,greedy:!0},string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:else|for|if|return|unless)(?=\s|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:t,number:n,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:t,boolean:/\b(?:false|true)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],number:n,punctuation:/[{}()\[\];:,]/};r.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^\{|\}$/,alias:"punctuation"},rest:r}},r.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:r}},e.languages.stylus={"atrule-declaration":{pattern:/(^[ \t]*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:r}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:\{[^{}]*\}|\S.*|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:r}},statement:{pattern:/(^[ \t]*)(?:else|for|if|return|unless)[ \t].+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:r}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)(?!\s)[^{\r\n]*(?:;|[^{\r\n,]$(?!(?:\r?\n|\r)(?:\{|\2[ \t])))/m,lookbehind:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:r.interpolation}},rest:r}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t])))/m,lookbehind:!0,inside:{interpolation:r.interpolation,comment:r.comment,punctuation:/[{},]/}},func:r.func,string:r.string,comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0,greedy:!0},interpolation:r.interpolation,punctuation:/[{}()\[\];:.]/}}(a),function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"];var n=e.languages.tsx.tag;n.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+n.pattern.source+")",n.pattern.flags),n.lookbehind=!0}(a),a.languages.wasm={comment:[/\(;[\s\S]*?;\)/,{pattern:/;;.*/,greedy:!0}],string:{pattern:/"(?:\\[\s\S]|[^"\\])*"/,greedy:!0},keyword:[{pattern:/\b(?:align|offset)=/,inside:{operator:/=/}},{pattern:/\b(?:(?:f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|neg?|nearest|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|sqrt|store(?:8|16|32)?|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))?|memory\.(?:grow|size))\b/,inside:{punctuation:/\./}},/\b(?:anyfunc|block|br(?:_if|_table)?|call(?:_indirect)?|data|drop|elem|else|end|export|func|get_(?:global|local)|global|if|import|local|loop|memory|module|mut|nop|offset|param|result|return|select|set_(?:global|local)|start|table|tee_local|then|type|unreachable)\b/],variable:/\$[\w!#$%&'*+\-./:<=>?@\\^`|~]+/,number:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/,punctuation:/[()]/};const o=a},7874:()=>{!function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var a=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=r.variable[1].inside,i=0;i<a.length;i++)o[a[i]]=e.languages.bash[a[i]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash}(Prism)},4677:()=>{Prism.languages.hcl={comment:/(?:\/\/|#).*|\/\*[\s\S]*?(?:\*\/|$)/,heredoc:{pattern:/<<-?(\w+\b)[\s\S]*?^[ \t]*\1/m,greedy:!0,alias:"string"},keyword:[{pattern:/(?:data|resource)\s+(?:"(?:\\[\s\S]|[^\\"])*")(?=\s+"[\w-]+"\s+\{)/i,inside:{type:{pattern:/(resource|data|\s+)(?:"(?:\\[\s\S]|[^\\"])*")/i,lookbehind:!0,alias:"variable"}}},{pattern:/(?:backend|module|output|provider|provisioner|variable)\s+(?:[\w-]+|"(?:\\[\s\S]|[^\\"])*")\s+(?=\{)/i,inside:{type:{pattern:/(backend|module|output|provider|provisioner|variable)\s+(?:[\w-]+|"(?:\\[\s\S]|[^\\"])*")\s+/i,lookbehind:!0,alias:"variable"}}},/[\w-]+(?=\s+\{)/],property:[/[-\w\.]+(?=\s*=(?!=))/,/"(?:\\[\s\S]|[^\\"])+"(?=\s*[:=])/],string:{pattern:/"(?:[^\\$"]|\\[\s\S]|\$(?:(?=")|\$+(?!\$)|[^"${])|\$\{(?:[^{}"]|"(?:[^\\"]|\\[\s\S])*")*\})*"/,greedy:!0,inside:{interpolation:{pattern:/(^|[^$])\$\{(?:[^{}"]|"(?:[^\\"]|\\[\s\S])*")*\}/,lookbehind:!0,inside:{type:{pattern:/(\b(?:count|data|local|module|path|self|terraform|var)\b\.)[\w\*]+/i,lookbehind:!0,alias:"variable"},keyword:/\b(?:count|data|local|module|path|self|terraform|var)\b/i,function:/\w+(?=\()/,string:{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0},number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?(?:e[+-]?\d+)?/i,punctuation:/[!\$#%&'()*+,.\/;<=>@\[\\\]^`{|}~?:]/}}}},number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?(?:e[+-]?\d+)?/i,boolean:/\b(?:false|true)\b/i,punctuation:/[=\[\]{}]/}},3335:()=>{Prism.languages.log={string:{pattern:/"(?:[^"\\\r\n]|\\.)*"|'(?![st] | \w)(?:[^'\\\r\n]|\\.)*'/,greedy:!0},exception:{pattern:/(^|[^\w.])[a-z][\w.]*(?:Error|Exception):.*(?:(?:\r\n?|\n)[ \t]*(?:at[ \t].+|\.{3}.*|Caused by:.*))+(?:(?:\r\n?|\n)[ \t]*\.\.\. .*)?/,lookbehind:!0,greedy:!0,alias:["javastacktrace","language-javastacktrace"],inside:Prism.languages.javastacktrace||{keyword:/\bat\b/,function:/[a-z_][\w$]*(?=\()/,punctuation:/[.:()]/}},level:[{pattern:/\b(?:ALERT|CRIT|CRITICAL|EMERG|EMERGENCY|ERR|ERROR|FAILURE|FATAL|SEVERE)\b/,alias:["error","important"]},{pattern:/\b(?:WARN|WARNING|WRN)\b/,alias:["warning","important"]},{pattern:/\b(?:DISPLAY|INF|INFO|NOTICE|STATUS)\b/,alias:["info","keyword"]},{pattern:/\b(?:DBG|DEBUG|FINE)\b/,alias:["debug","keyword"]},{pattern:/\b(?:FINER|FINEST|TRACE|TRC|VERBOSE|VRB)\b/,alias:["trace","comment"]}],property:{pattern:/((?:^|[\]|])[ \t]*)[a-z_](?:[\w-]|\b\/\b)*(?:[. ]\(?\w(?:[\w-]|\b\/\b)*\)?)*:(?=\s)/im,lookbehind:!0},separator:{pattern:/(^|[^-+])-{3,}|={3,}|\*{3,}|- - /m,lookbehind:!0,alias:"comment"},url:/\b(?:file|ftp|https?):\/\/[^\s|,;'"]*[^\s|,;'">.]/,email:{pattern:/(^|\s)[-\w+.]+@[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)+(?=\s)/,lookbehind:!0,alias:"url"},"ip-address":{pattern:/\b(?:\d{1,3}(?:\.\d{1,3}){3})\b/,alias:"constant"},"mac-address":{pattern:/\b[a-f0-9]{2}(?::[a-f0-9]{2}){5}\b/i,alias:"constant"},domain:{pattern:/(^|\s)[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)*\.[a-z][a-z0-9-]+(?=\s)/,lookbehind:!0,alias:"constant"},uuid:{pattern:/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/i,alias:"constant"},hash:{pattern:/\b(?:[a-f0-9]{32}){1,2}\b/i,alias:"constant"},"file-path":{pattern:/\b[a-z]:[\\/][^\s|,;:(){}\[\]"']+|(^|[\s:\[\](>|])\.{0,2}\/\w[^\s|,;:(){}\[\]"']*/i,lookbehind:!0,greedy:!0,alias:"string"},date:{pattern:RegExp(/\b\d{4}[-/]\d{2}[-/]\d{2}(?:T(?=\d{1,2}:)|(?=\s\d{1,2}:))/.source+"|"+/\b\d{1,4}[-/ ](?:\d{1,2}|Apr|Aug|Dec|Feb|Jan|Jul|Jun|Mar|May|Nov|Oct|Sep)[-/ ]\d{2,4}T?\b/.source+"|"+/\b(?:(?:Fri|Mon|Sat|Sun|Thu|Tue|Wed)(?:\s{1,2}(?:Apr|Aug|Dec|Feb|Jan|Jul|Jun|Mar|May|Nov|Oct|Sep))?|Apr|Aug|Dec|Feb|Jan|Jul|Jun|Mar|May|Nov|Oct|Sep)\s{1,2}\d{1,2}\b/.source,"i"),alias:"number"},time:{pattern:/\b\d{1,2}:\d{1,2}:\d{1,2}(?:[.,:]\d+)?(?:\s?[+-]\d{2}:?\d{2}|Z)?\b/,alias:"number"},boolean:/\b(?:false|null|true)\b/i,number:{pattern:/(^|[^.\w])(?:0x[a-f0-9]+|0o[0-7]+|0b[01]+|v?\d[\da-f]*(?:\.\d+)*(?:e[+-]?\d+)?[a-z]{0,3}\b)\b(?!\.\w)/i,lookbehind:!0},operator:/[;:?<=>~/@!$%&+\-|^(){}*#]/,punctuation:/[\[\].,]/}},366:()=>{Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python},767:()=>{!function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,n=0;n<2;n++)t=t.replace(/<self>/g,(function(){return t}));t=t.replace(/<self>/g,(function(){return/[^\s\S]/.source})),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(Prism)},9930:()=>{!function(e){var t=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function n(e){return e.replace(/__/g,(function(){return t}))}e.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(n(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(n(/(^[\t ]*|[{,]\s*)__(?:\s*\.\s*__)*(?=\s*=)/.source),"m"),lookbehind:!0,greedy:!0,alias:"property"},string:{pattern:/"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},date:[{pattern:/\b\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?\b/i,alias:"number"},{pattern:/\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b/,alias:"number"}],number:/(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\b\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?\b(?:inf|nan)\b/,boolean:/\b(?:false|true)\b/,punctuation:/[.,=[\]{}]/}}(Prism)},3358:()=>{!function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+n.source+"(?:[ \t]+"+t.source+")?|"+t.source+"(?:[ \t]+"+n.source+")?)",a=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,(function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source})),o=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function i(e,t){t=(t||"").replace(/m/g,"")+"m";var n=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,(function(){return r})).replace(/<<value>>/g,(function(){return e}));return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,(function(){return r}))),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,(function(){return r})).replace(/<<key>>/g,(function(){return"(?:"+a+"|"+o+")"}))),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:i(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:i(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:i(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:i(o),lookbehind:!0,greedy:!0},number:{pattern:i(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(Prism)},6991:(e,t,n)=>{var r={"./prism-bash":7874,"./prism-hcl":4677,"./prism-log":3335,"./prism-python":366,"./prism-rust":767,"./prism-toml":9930,"./prism-yaml":3358};function a(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}a.keys=function(){return Object.keys(r)},a.resolve=o,e.exports=a,a.id=6991},2703:(e,t,n)=>{"use strict";var r=n(414);function a(){}function o(){}o.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,o,i){if(i!==r){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:a};return n.PropTypes=n,n}},5697:(e,t,n)=>{e.exports=n(2703)()},414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},4448:(e,t,n)=>{"use strict";var r=n(7294),a=n(7418),o=n(3840);function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!r)throw Error(i(227));var l=new Set,s={};function c(e,t){u(e,t),u(e+"Capture",t)}function u(e,t){for(s[e]=t,e=0;e<t.length;e++)l.add(t[e])}var d=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),f=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p=Object.prototype.hasOwnProperty,m={},h={};function g(e,t,n,r,a,o,i){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){b[e]=new g(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];b[t]=new g(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){b[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){b[e]=new g(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){b[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){b[e]=new g(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){b[e]=new g(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){b[e]=new g(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){b[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)}));var v=/[\-:]([a-z])/g;function y(e){return e[1].toUpperCase()}function w(e,t,n,r){var a=b.hasOwnProperty(t)?b[t]:null;(null!==a?0===a.type:!r&&(2<t.length&&("o"===t[0]||"O"===t[0])&&("n"===t[1]||"N"===t[1])))||(function(e,t,n,r){if(null==t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,a,r)&&(n=null),r||null===a?function(e){return!!p.call(h,e)||!p.call(m,e)&&(f.test(e)?h[e]=!0:(m[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):a.mustUseProperty?e[a.propertyName]=null===n?3!==a.type&&"":n:(t=a.attributeName,r=a.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(a=a.type)||4===a&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(v,y);b[t]=new g(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(v,y);b[t]=new g(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(v,y);b[t]=new g(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){b[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)})),b.xlinkHref=new g("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){b[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)}));var E=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,k=60103,S=60106,_=60107,x=60108,T=60114,C=60109,A=60110,N=60112,O=60113,L=60120,I=60115,P=60116,R=60121,M=60128,D=60129,F=60130,B=60131;if("function"==typeof Symbol&&Symbol.for){var $=Symbol.for;k=$("react.element"),S=$("react.portal"),_=$("react.fragment"),x=$("react.strict_mode"),T=$("react.profiler"),C=$("react.provider"),A=$("react.context"),N=$("react.forward_ref"),O=$("react.suspense"),L=$("react.suspense_list"),I=$("react.memo"),P=$("react.lazy"),R=$("react.block"),$("react.scope"),M=$("react.opaque.id"),D=$("react.debug_trace_mode"),F=$("react.offscreen"),B=$("react.legacy_hidden")}var U,z="function"==typeof Symbol&&Symbol.iterator;function j(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=z&&e[z]||e["@@iterator"])?e:null}function H(e){if(void 0===U)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);U=t&&t[1]||""}return"\n"+U+e}var Z=!1;function G(e,t){if(!e||Z)return"";Z=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(s){var r=s}Reflect.construct(e,[],t)}else{try{t.call()}catch(s){r=s}e.call(t.prototype)}else{try{throw Error()}catch(s){r=s}e()}}catch(s){if(s&&r&&"string"==typeof s.stack){for(var a=s.stack.split("\n"),o=r.stack.split("\n"),i=a.length-1,l=o.length-1;1<=i&&0<=l&&a[i]!==o[l];)l--;for(;1<=i&&0<=l;i--,l--)if(a[i]!==o[l]){if(1!==i||1!==l)do{if(i--,0>--l||a[i]!==o[l])return"\n"+a[i].replace(" at new "," at ")}while(1<=i&&0<=l);break}}}finally{Z=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?H(e):""}function V(e){switch(e.tag){case 5:return H(e.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return e=G(e.type,!1);case 11:return e=G(e.type.render,!1);case 22:return e=G(e.type._render,!1);case 1:return e=G(e.type,!0);default:return""}}function W(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case _:return"Fragment";case S:return"Portal";case T:return"Profiler";case x:return"StrictMode";case O:return"Suspense";case L:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case A:return(e.displayName||"Context")+".Consumer";case C:return(e._context.displayName||"Context")+".Provider";case N:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case I:return W(e.type);case R:return W(e._render);case P:t=e._payload,e=e._init;try{return W(e(t))}catch(n){}}return null}function q(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function Y(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function K(e){e._valueTracker||(e._valueTracker=function(e){var t=Y(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var a=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(e){r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function X(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Y(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function Q(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function J(e,t){var n=t.checked;return a({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function ee(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=q(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function te(e,t){null!=(t=t.checked)&&w(e,"checked",t,!1)}function ne(e,t){te(e,t);var n=q(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?ae(e,t.type,n):t.hasOwnProperty("defaultValue")&&ae(e,t.type,q(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function re(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function ae(e,t,n){"number"===t&&Q(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}function oe(e,t){return e=a({children:void 0},t),(t=function(e){var t="";return r.Children.forEach(e,(function(e){null!=e&&(t+=e)})),t}(t.children))&&(e.children=t),e}function ie(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+q(n),t=null,a=0;a<e.length;a++){if(e[a].value===n)return e[a].selected=!0,void(r&&(e[a].defaultSelected=!0));null!==t||e[a].disabled||(t=e[a])}null!==t&&(t.selected=!0)}}function le(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(i(91));return a({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function se(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(i(92));if(Array.isArray(n)){if(!(1>=n.length))throw Error(i(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:q(n)}}function ce(e,t){var n=q(t.value),r=q(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function ue(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}var de="http://www.w3.org/1999/xhtml",fe="http://www.w3.org/2000/svg";function pe(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function me(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?pe(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var he,ge,be=(ge=function(e,t){if(e.namespaceURI!==fe||"innerHTML"in e)e.innerHTML=t;else{for((he=he||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=he.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction((function(){return ge(e,t)}))}:ge);function ve(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var ye={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},we=["Webkit","ms","Moz","O"];function Ee(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||ye.hasOwnProperty(e)&&ye[e]?(""+t).trim():t+"px"}function ke(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),a=Ee(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}Object.keys(ye).forEach((function(e){we.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ye[t]=ye[e]}))}));var Se=a({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function _e(e,t){if(t){if(Se[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(i(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(i(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(i(62))}}function xe(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function Te(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Ce=null,Ae=null,Ne=null;function Oe(e){if(e=ra(e)){if("function"!=typeof Ce)throw Error(i(280));var t=e.stateNode;t&&(t=oa(t),Ce(e.stateNode,e.type,t))}}function Le(e){Ae?Ne?Ne.push(e):Ne=[e]:Ae=e}function Ie(){if(Ae){var e=Ae,t=Ne;if(Ne=Ae=null,Oe(e),t)for(e=0;e<t.length;e++)Oe(t[e])}}function Pe(e,t){return e(t)}function Re(e,t,n,r,a){return e(t,n,r,a)}function Me(){}var De=Pe,Fe=!1,Be=!1;function $e(){null===Ae&&null===Ne||(Me(),Ie())}function Ue(e,t){var n=e.stateNode;if(null===n)return null;var r=oa(n);if(null===r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(i(231,t,typeof n));return n}var ze=!1;if(d)try{var je={};Object.defineProperty(je,"passive",{get:function(){ze=!0}}),window.addEventListener("test",je,je),window.removeEventListener("test",je,je)}catch(ge){ze=!1}function He(e,t,n,r,a,o,i,l,s){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(u){this.onError(u)}}var Ze=!1,Ge=null,Ve=!1,We=null,qe={onError:function(e){Ze=!0,Ge=e}};function Ye(e,t,n,r,a,o,i,l,s){Ze=!1,Ge=null,He.apply(qe,arguments)}function Ke(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!=(1026&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function Xe(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function Qe(e){if(Ke(e)!==e)throw Error(i(188))}function Je(e){if(e=function(e){var t=e.alternate;if(!t){if(null===(t=Ke(e)))throw Error(i(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(null===a)break;var o=a.alternate;if(null===o){if(null!==(r=a.return)){n=r;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return Qe(a),e;if(o===r)return Qe(a),t;o=o.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=o;else{for(var l=!1,s=a.child;s;){if(s===n){l=!0,n=a,r=o;break}if(s===r){l=!0,r=a,n=o;break}s=s.sibling}if(!l){for(s=o.child;s;){if(s===n){l=!0,n=o,r=a;break}if(s===r){l=!0,r=o,n=a;break}s=s.sibling}if(!l)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(3!==n.tag)throw Error(i(188));return n.stateNode.current===n?e:t}(e),!e)return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function et(e,t){for(var n=e.alternate;null!==t;){if(t===e||t===n)return!0;t=t.return}return!1}var tt,nt,rt,at,ot=!1,it=[],lt=null,st=null,ct=null,ut=new Map,dt=new Map,ft=[],pt="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function mt(e,t,n,r,a){return{blockedOn:e,domEventName:t,eventSystemFlags:16|n,nativeEvent:a,targetContainers:[r]}}function ht(e,t){switch(e){case"focusin":case"focusout":lt=null;break;case"dragenter":case"dragleave":st=null;break;case"mouseover":case"mouseout":ct=null;break;case"pointerover":case"pointerout":ut.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":dt.delete(t.pointerId)}}function gt(e,t,n,r,a,o){return null===e||e.nativeEvent!==o?(e=mt(t,n,r,a,o),null!==t&&(null!==(t=ra(t))&&nt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==a&&-1===t.indexOf(a)&&t.push(a),e)}function bt(e){var t=na(e.target);if(null!==t){var n=Ke(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=Xe(n)))return e.blockedOn=t,void at(e.lanePriority,(function(){o.unstable_runWithPriority(e.priority,(function(){rt(n)}))}))}else if(3===t&&n.stateNode.hydrate)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function vt(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Jt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=ra(n))&&nt(t),e.blockedOn=n,!1;t.shift()}return!0}function yt(e,t,n){vt(e)&&n.delete(t)}function wt(){for(ot=!1;0<it.length;){var e=it[0];if(null!==e.blockedOn){null!==(e=ra(e.blockedOn))&&tt(e);break}for(var t=e.targetContainers;0<t.length;){var n=Jt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n){e.blockedOn=n;break}t.shift()}null===e.blockedOn&&it.shift()}null!==lt&&vt(lt)&&(lt=null),null!==st&&vt(st)&&(st=null),null!==ct&&vt(ct)&&(ct=null),ut.forEach(yt),dt.forEach(yt)}function Et(e,t){e.blockedOn===t&&(e.blockedOn=null,ot||(ot=!0,o.unstable_scheduleCallback(o.unstable_NormalPriority,wt)))}function kt(e){function t(t){return Et(t,e)}if(0<it.length){Et(it[0],e);for(var n=1;n<it.length;n++){var r=it[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==lt&&Et(lt,e),null!==st&&Et(st,e),null!==ct&&Et(ct,e),ut.forEach(t),dt.forEach(t),n=0;n<ft.length;n++)(r=ft[n]).blockedOn===e&&(r.blockedOn=null);for(;0<ft.length&&null===(n=ft[0]).blockedOn;)bt(n),null===n.blockedOn&&ft.shift()}function St(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var _t={animationend:St("Animation","AnimationEnd"),animationiteration:St("Animation","AnimationIteration"),animationstart:St("Animation","AnimationStart"),transitionend:St("Transition","TransitionEnd")},xt={},Tt={};function Ct(e){if(xt[e])return xt[e];if(!_t[e])return e;var t,n=_t[e];for(t in n)if(n.hasOwnProperty(t)&&t in Tt)return xt[e]=n[t];return e}d&&(Tt=document.createElement("div").style,"AnimationEvent"in window||(delete _t.animationend.animation,delete _t.animationiteration.animation,delete _t.animationstart.animation),"TransitionEvent"in window||delete _t.transitionend.transition);var At=Ct("animationend"),Nt=Ct("animationiteration"),Ot=Ct("animationstart"),Lt=Ct("transitionend"),It=new Map,Pt=new Map,Rt=["abort","abort",At,"animationEnd",Nt,"animationIteration",Ot,"animationStart","canplay","canPlay","canplaythrough","canPlayThrough","durationchange","durationChange","emptied","emptied","encrypted","encrypted","ended","ended","error","error","gotpointercapture","gotPointerCapture","load","load","loadeddata","loadedData","loadedmetadata","loadedMetadata","loadstart","loadStart","lostpointercapture","lostPointerCapture","playing","playing","progress","progress","seeking","seeking","stalled","stalled","suspend","suspend","timeupdate","timeUpdate",Lt,"transitionEnd","waiting","waiting"];function Mt(e,t){for(var n=0;n<e.length;n+=2){var r=e[n],a=e[n+1];a="on"+(a[0].toUpperCase()+a.slice(1)),Pt.set(r,t),It.set(r,a),c(a,[r])}}(0,o.unstable_now)();var Dt=8;function Ft(e){if(0!=(1&e))return Dt=15,1;if(0!=(2&e))return Dt=14,2;if(0!=(4&e))return Dt=13,4;var t=24&e;return 0!==t?(Dt=12,t):0!=(32&e)?(Dt=11,32):0!==(t=192&e)?(Dt=10,t):0!=(256&e)?(Dt=9,256):0!==(t=3584&e)?(Dt=8,t):0!=(4096&e)?(Dt=7,4096):0!==(t=4186112&e)?(Dt=6,t):0!==(t=62914560&e)?(Dt=5,t):67108864&e?(Dt=4,67108864):0!=(134217728&e)?(Dt=3,134217728):0!==(t=805306368&e)?(Dt=2,t):0!=(1073741824&e)?(Dt=1,1073741824):(Dt=8,e)}function Bt(e,t){var n=e.pendingLanes;if(0===n)return Dt=0;var r=0,a=0,o=e.expiredLanes,i=e.suspendedLanes,l=e.pingedLanes;if(0!==o)r=o,a=Dt=15;else if(0!==(o=134217727&n)){var s=o&~i;0!==s?(r=Ft(s),a=Dt):0!==(l&=o)&&(r=Ft(l),a=Dt)}else 0!==(o=n&~i)?(r=Ft(o),a=Dt):0!==l&&(r=Ft(l),a=Dt);if(0===r)return 0;if(r=n&((0>(r=31-Zt(r))?0:1<<r)<<1)-1,0!==t&&t!==r&&0==(t&i)){if(Ft(t),a<=Dt)return t;Dt=a}if(0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)a=1<<(n=31-Zt(t)),r|=e[n],t&=~a;return r}function $t(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function Ut(e,t){switch(e){case 15:return 1;case 14:return 2;case 12:return 0===(e=zt(24&~t))?Ut(10,t):e;case 10:return 0===(e=zt(192&~t))?Ut(8,t):e;case 8:return 0===(e=zt(3584&~t))&&(0===(e=zt(4186112&~t))&&(e=512)),e;case 2:return 0===(t=zt(805306368&~t))&&(t=268435456),t}throw Error(i(358,e))}function zt(e){return e&-e}function jt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ht(e,t,n){e.pendingLanes|=t;var r=t-1;e.suspendedLanes&=r,e.pingedLanes&=r,(e=e.eventTimes)[t=31-Zt(t)]=n}var Zt=Math.clz32?Math.clz32:function(e){return 0===e?32:31-(Gt(e)/Vt|0)|0},Gt=Math.log,Vt=Math.LN2;var Wt=o.unstable_UserBlockingPriority,qt=o.unstable_runWithPriority,Yt=!0;function Kt(e,t,n,r){Fe||Me();var a=Qt,o=Fe;Fe=!0;try{Re(a,e,t,n,r)}finally{(Fe=o)||$e()}}function Xt(e,t,n,r){qt(Wt,Qt.bind(null,e,t,n,r))}function Qt(e,t,n,r){var a;if(Yt)if((a=0==(4&t))&&0<it.length&&-1<pt.indexOf(e))e=mt(null,e,t,n,r),it.push(e);else{var o=Jt(e,t,n,r);if(null===o)a&&ht(e,r);else{if(a){if(-1<pt.indexOf(e))return e=mt(o,e,t,n,r),void it.push(e);if(function(e,t,n,r,a){switch(t){case"focusin":return lt=gt(lt,e,t,n,r,a),!0;case"dragenter":return st=gt(st,e,t,n,r,a),!0;case"mouseover":return ct=gt(ct,e,t,n,r,a),!0;case"pointerover":var o=a.pointerId;return ut.set(o,gt(ut.get(o)||null,e,t,n,r,a)),!0;case"gotpointercapture":return o=a.pointerId,dt.set(o,gt(dt.get(o)||null,e,t,n,r,a)),!0}return!1}(o,e,t,n,r))return;ht(e,r)}Mr(e,t,r,null,n)}}}function Jt(e,t,n,r){var a=Te(r);if(null!==(a=na(a))){var o=Ke(a);if(null===o)a=null;else{var i=o.tag;if(13===i){if(null!==(a=Xe(o)))return a;a=null}else if(3===i){if(o.stateNode.hydrate)return 3===o.tag?o.stateNode.containerInfo:null;a=null}else o!==a&&(a=null)}}return Mr(e,t,r,a,n),null}var en=null,tn=null,nn=null;function rn(){if(nn)return nn;var e,t,n=tn,r=n.length,a="value"in en?en.value:en.textContent,o=a.length;for(e=0;e<r&&n[e]===a[e];e++);var i=r-e;for(t=1;t<=i&&n[r-t]===a[o-t];t++);return nn=a.slice(e,1<t?1-t:void 0)}function an(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function on(){return!0}function ln(){return!1}function sn(e){function t(t,n,r,a,o){for(var i in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=a,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(i)&&(t=e[i],this[i]=t?t(a):a[i]);return this.isDefaultPrevented=(null!=a.defaultPrevented?a.defaultPrevented:!1===a.returnValue)?on:ln,this.isPropagationStopped=ln,this}return a(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=on)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=on)},persist:function(){},isPersistent:on}),t}var cn,un,dn,fn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pn=sn(fn),mn=a({},fn,{view:0,detail:0}),hn=sn(mn),gn=a({},mn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:An,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==dn&&(dn&&"mousemove"===e.type?(cn=e.screenX-dn.screenX,un=e.screenY-dn.screenY):un=cn=0,dn=e),cn)},movementY:function(e){return"movementY"in e?e.movementY:un}}),bn=sn(gn),vn=sn(a({},gn,{dataTransfer:0})),yn=sn(a({},mn,{relatedTarget:0})),wn=sn(a({},fn,{animationName:0,elapsedTime:0,pseudoElement:0})),En=a({},fn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),kn=sn(En),Sn=sn(a({},fn,{data:0})),_n={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},xn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Tn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Cn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Tn[e])&&!!t[e]}function An(){return Cn}var Nn=a({},mn,{key:function(e){if(e.key){var t=_n[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=an(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?xn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:An,charCode:function(e){return"keypress"===e.type?an(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?an(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),On=sn(Nn),Ln=sn(a({},gn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),In=sn(a({},mn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:An})),Pn=sn(a({},fn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Rn=a({},gn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Mn=sn(Rn),Dn=[9,13,27,32],Fn=d&&"CompositionEvent"in window,Bn=null;d&&"documentMode"in document&&(Bn=document.documentMode);var $n=d&&"TextEvent"in window&&!Bn,Un=d&&(!Fn||Bn&&8<Bn&&11>=Bn),zn=String.fromCharCode(32),jn=!1;function Hn(e,t){switch(e){case"keyup":return-1!==Dn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zn(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Gn=!1;var Vn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Wn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Vn[e.type]:"textarea"===t}function qn(e,t,n,r){Le(r),0<(t=Fr(t,"onChange")).length&&(n=new pn("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Yn=null,Kn=null;function Xn(e){Nr(e,0)}function Qn(e){if(X(aa(e)))return e}function Jn(e,t){if("change"===e)return t}var er=!1;if(d){var tr;if(d){var nr="oninput"in document;if(!nr){var rr=document.createElement("div");rr.setAttribute("oninput","return;"),nr="function"==typeof rr.oninput}tr=nr}else tr=!1;er=tr&&(!document.documentMode||9<document.documentMode)}function ar(){Yn&&(Yn.detachEvent("onpropertychange",or),Kn=Yn=null)}function or(e){if("value"===e.propertyName&&Qn(Kn)){var t=[];if(qn(t,Kn,e,Te(e)),e=Xn,Fe)e(t);else{Fe=!0;try{Pe(e,t)}finally{Fe=!1,$e()}}}}function ir(e,t,n){"focusin"===e?(ar(),Kn=n,(Yn=t).attachEvent("onpropertychange",or)):"focusout"===e&&ar()}function lr(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Qn(Kn)}function sr(e,t){if("click"===e)return Qn(t)}function cr(e,t){if("input"===e||"change"===e)return Qn(t)}var ur="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},dr=Object.prototype.hasOwnProperty;function fr(e,t){if(ur(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++)if(!dr.call(t,n[r])||!ur(e[n[r]],t[n[r]]))return!1;return!0}function pr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function mr(e,t){var n,r=pr(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=pr(r)}}function hr(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?hr(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function gr(){for(var e=window,t=Q();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(r){n=!1}if(!n)break;t=Q((e=t.contentWindow).document)}return t}function br(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var vr=d&&"documentMode"in document&&11>=document.documentMode,yr=null,wr=null,Er=null,kr=!1;function Sr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;kr||null==yr||yr!==Q(r)||("selectionStart"in(r=yr)&&br(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},Er&&fr(Er,r)||(Er=r,0<(r=Fr(wr,"onSelect")).length&&(t=new pn("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=yr)))}Mt("cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focusin focus focusout blur input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "),0),Mt("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "),1),Mt(Rt,2);for(var _r="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),xr=0;xr<_r.length;xr++)Pt.set(_r[xr],0);u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Tr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Cr=new Set("cancel close invalid load scroll toggle".split(" ").concat(Tr));function Ar(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,r,a,o,l,s,c){if(Ye.apply(this,arguments),Ze){if(!Ze)throw Error(i(198));var u=Ge;Ze=!1,Ge=null,Ve||(Ve=!0,We=u)}}(r,t,void 0,e),e.currentTarget=null}function Nr(e,t){t=0!=(4&t);for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var i=r.length-1;0<=i;i--){var l=r[i],s=l.instance,c=l.currentTarget;if(l=l.listener,s!==o&&a.isPropagationStopped())break e;Ar(a,l,c),o=s}else for(i=0;i<r.length;i++){if(s=(l=r[i]).instance,c=l.currentTarget,l=l.listener,s!==o&&a.isPropagationStopped())break e;Ar(a,l,c),o=s}}}if(Ve)throw e=We,Ve=!1,We=null,e}function Or(e,t){var n=ia(t),r=e+"__bubble";n.has(r)||(Rr(t,e,2,!1),n.add(r))}var Lr="_reactListening"+Math.random().toString(36).slice(2);function Ir(e){e[Lr]||(e[Lr]=!0,l.forEach((function(t){Cr.has(t)||Pr(t,!1,e,null),Pr(t,!0,e,null)})))}function Pr(e,t,n,r){var a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,o=n;if("selectionchange"===e&&9!==n.nodeType&&(o=n.ownerDocument),null!==r&&!t&&Cr.has(e)){if("scroll"!==e)return;a|=2,o=r}var i=ia(o),l=e+"__"+(t?"capture":"bubble");i.has(l)||(t&&(a|=4),Rr(o,e,a,t),i.add(l))}function Rr(e,t,n,r){var a=Pt.get(t);switch(void 0===a?2:a){case 0:a=Kt;break;case 1:a=Xt;break;default:a=Qt}n=a.bind(null,t,n,e),a=void 0,!ze||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(a=!0),r?void 0!==a?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):void 0!==a?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Mr(e,t,n,r,a){var o=r;if(0==(1&t)&&0==(2&t)&&null!==r)e:for(;;){if(null===r)return;var i=r.tag;if(3===i||4===i){var l=r.stateNode.containerInfo;if(l===a||8===l.nodeType&&l.parentNode===a)break;if(4===i)for(i=r.return;null!==i;){var s=i.tag;if((3===s||4===s)&&((s=i.stateNode.containerInfo)===a||8===s.nodeType&&s.parentNode===a))return;i=i.return}for(;null!==l;){if(null===(i=na(l)))return;if(5===(s=i.tag)||6===s){r=o=i;continue e}l=l.parentNode}}r=r.return}!function(e,t,n){if(Be)return e(t,n);Be=!0;try{De(e,t,n)}finally{Be=!1,$e()}}((function(){var r=o,a=Te(n),i=[];e:{var l=It.get(e);if(void 0!==l){var s=pn,c=e;switch(e){case"keypress":if(0===an(n))break e;case"keydown":case"keyup":s=On;break;case"focusin":c="focus",s=yn;break;case"focusout":c="blur",s=yn;break;case"beforeblur":case"afterblur":s=yn;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":s=bn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":s=vn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":s=In;break;case At:case Nt:case Ot:s=wn;break;case Lt:s=Pn;break;case"scroll":s=hn;break;case"wheel":s=Mn;break;case"copy":case"cut":case"paste":s=kn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":s=Ln}var u=0!=(4&t),d=!u&&"scroll"===e,f=u?null!==l?l+"Capture":null:l;u=[];for(var p,m=r;null!==m;){var h=(p=m).stateNode;if(5===p.tag&&null!==h&&(p=h,null!==f&&(null!=(h=Ue(m,f))&&u.push(Dr(m,h,p)))),d)break;m=m.return}0<u.length&&(l=new s(l,c,null,n,a),i.push({event:l,listeners:u}))}}if(0==(7&t)){if(s="mouseout"===e||"pointerout"===e,(!(l="mouseover"===e||"pointerover"===e)||0!=(16&t)||!(c=n.relatedTarget||n.fromElement)||!na(c)&&!c[ea])&&(s||l)&&(l=a.window===a?a:(l=a.ownerDocument)?l.defaultView||l.parentWindow:window,s?(s=r,null!==(c=(c=n.relatedTarget||n.toElement)?na(c):null)&&(c!==(d=Ke(c))||5!==c.tag&&6!==c.tag)&&(c=null)):(s=null,c=r),s!==c)){if(u=bn,h="onMouseLeave",f="onMouseEnter",m="mouse","pointerout"!==e&&"pointerover"!==e||(u=Ln,h="onPointerLeave",f="onPointerEnter",m="pointer"),d=null==s?l:aa(s),p=null==c?l:aa(c),(l=new u(h,m+"leave",s,n,a)).target=d,l.relatedTarget=p,h=null,na(a)===r&&((u=new u(f,m+"enter",c,n,a)).target=p,u.relatedTarget=d,h=u),d=h,s&&c)e:{for(f=c,m=0,p=u=s;p;p=Br(p))m++;for(p=0,h=f;h;h=Br(h))p++;for(;0<m-p;)u=Br(u),m--;for(;0<p-m;)f=Br(f),p--;for(;m--;){if(u===f||null!==f&&u===f.alternate)break e;u=Br(u),f=Br(f)}u=null}else u=null;null!==s&&$r(i,l,s,u,!1),null!==c&&null!==d&&$r(i,d,c,u,!0)}if("select"===(s=(l=r?aa(r):window).nodeName&&l.nodeName.toLowerCase())||"input"===s&&"file"===l.type)var g=Jn;else if(Wn(l))if(er)g=cr;else{g=lr;var b=ir}else(s=l.nodeName)&&"input"===s.toLowerCase()&&("checkbox"===l.type||"radio"===l.type)&&(g=sr);switch(g&&(g=g(e,r))?qn(i,g,n,a):(b&&b(e,l,r),"focusout"===e&&(b=l._wrapperState)&&b.controlled&&"number"===l.type&&ae(l,"number",l.value)),b=r?aa(r):window,e){case"focusin":(Wn(b)||"true"===b.contentEditable)&&(yr=b,wr=r,Er=null);break;case"focusout":Er=wr=yr=null;break;case"mousedown":kr=!0;break;case"contextmenu":case"mouseup":case"dragend":kr=!1,Sr(i,n,a);break;case"selectionchange":if(vr)break;case"keydown":case"keyup":Sr(i,n,a)}var v;if(Fn)e:{switch(e){case"compositionstart":var y="onCompositionStart";break e;case"compositionend":y="onCompositionEnd";break e;case"compositionupdate":y="onCompositionUpdate";break e}y=void 0}else Gn?Hn(e,n)&&(y="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(y="onCompositionStart");y&&(Un&&"ko"!==n.locale&&(Gn||"onCompositionStart"!==y?"onCompositionEnd"===y&&Gn&&(v=rn()):(tn="value"in(en=a)?en.value:en.textContent,Gn=!0)),0<(b=Fr(r,y)).length&&(y=new Sn(y,e,null,n,a),i.push({event:y,listeners:b}),v?y.data=v:null!==(v=Zn(n))&&(y.data=v))),(v=$n?function(e,t){switch(e){case"compositionend":return Zn(t);case"keypress":return 32!==t.which?null:(jn=!0,zn);case"textInput":return(e=t.data)===zn&&jn?null:e;default:return null}}(e,n):function(e,t){if(Gn)return"compositionend"===e||!Fn&&Hn(e,t)?(e=rn(),nn=tn=en=null,Gn=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Un&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(r=Fr(r,"onBeforeInput")).length&&(a=new Sn("onBeforeInput","beforeinput",null,n,a),i.push({event:a,listeners:r}),a.data=v))}Nr(i,t)}))}function Dr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Fr(e,t){for(var n=t+"Capture",r=[];null!==e;){var a=e,o=a.stateNode;5===a.tag&&null!==o&&(a=o,null!=(o=Ue(e,n))&&r.unshift(Dr(e,o,a)),null!=(o=Ue(e,t))&&r.push(Dr(e,o,a))),e=e.return}return r}function Br(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function $r(e,t,n,r,a){for(var o=t._reactName,i=[];null!==n&&n!==r;){var l=n,s=l.alternate,c=l.stateNode;if(null!==s&&s===r)break;5===l.tag&&null!==c&&(l=c,a?null!=(s=Ue(n,o))&&i.unshift(Dr(n,s,l)):a||null!=(s=Ue(n,o))&&i.push(Dr(n,s,l))),n=n.return}0!==i.length&&e.push({event:t,listeners:i})}function Ur(){}var zr=null,jr=null;function Hr(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function Zr(e,t){return"textarea"===e||"option"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Gr="function"==typeof setTimeout?setTimeout:void 0,Vr="function"==typeof clearTimeout?clearTimeout:void 0;function Wr(e){1===e.nodeType?e.textContent="":9===e.nodeType&&(null!=(e=e.body)&&(e.textContent=""))}function qr(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break}return e}function Yr(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var Kr=0;var Xr=Math.random().toString(36).slice(2),Qr="__reactFiber$"+Xr,Jr="__reactProps$"+Xr,ea="__reactContainer$"+Xr,ta="__reactEvents$"+Xr;function na(e){var t=e[Qr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ea]||n[Qr]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=Yr(e);null!==e;){if(n=e[Qr])return n;e=Yr(e)}return t}n=(e=n).parentNode}return null}function ra(e){return!(e=e[Qr]||e[ea])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function aa(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(i(33))}function oa(e){return e[Jr]||null}function ia(e){var t=e[ta];return void 0===t&&(t=e[ta]=new Set),t}var la=[],sa=-1;function ca(e){return{current:e}}function ua(e){0>sa||(e.current=la[sa],la[sa]=null,sa--)}function da(e,t){sa++,la[sa]=e.current,e.current=t}var fa={},pa=ca(fa),ma=ca(!1),ha=fa;function ga(e,t){var n=e.type.contextTypes;if(!n)return fa;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a,o={};for(a in n)o[a]=t[a];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function ba(e){return null!=(e=e.childContextTypes)}function va(){ua(ma),ua(pa)}function ya(e,t,n){if(pa.current!==fa)throw Error(i(168));da(pa,t),da(ma,n)}function wa(e,t,n){var r=e.stateNode;if(e=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var o in r=r.getChildContext())if(!(o in e))throw Error(i(108,W(t)||"Unknown",o));return a({},n,r)}function Ea(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||fa,ha=pa.current,da(pa,e),da(ma,ma.current),!0}function ka(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=wa(e,t,ha),r.__reactInternalMemoizedMergedChildContext=e,ua(ma),ua(pa),da(pa,e)):ua(ma),da(ma,n)}var Sa=null,_a=null,xa=o.unstable_runWithPriority,Ta=o.unstable_scheduleCallback,Ca=o.unstable_cancelCallback,Aa=o.unstable_shouldYield,Na=o.unstable_requestPaint,Oa=o.unstable_now,La=o.unstable_getCurrentPriorityLevel,Ia=o.unstable_ImmediatePriority,Pa=o.unstable_UserBlockingPriority,Ra=o.unstable_NormalPriority,Ma=o.unstable_LowPriority,Da=o.unstable_IdlePriority,Fa={},Ba=void 0!==Na?Na:function(){},$a=null,Ua=null,za=!1,ja=Oa(),Ha=1e4>ja?Oa:function(){return Oa()-ja};function Za(){switch(La()){case Ia:return 99;case Pa:return 98;case Ra:return 97;case Ma:return 96;case Da:return 95;default:throw Error(i(332))}}function Ga(e){switch(e){case 99:return Ia;case 98:return Pa;case 97:return Ra;case 96:return Ma;case 95:return Da;default:throw Error(i(332))}}function Va(e,t){return e=Ga(e),xa(e,t)}function Wa(e,t,n){return e=Ga(e),Ta(e,t,n)}function qa(){if(null!==Ua){var e=Ua;Ua=null,Ca(e)}Ya()}function Ya(){if(!za&&null!==$a){za=!0;var e=0;try{var t=$a;Va(99,(function(){for(;e<t.length;e++){var n=t[e];do{n=n(!0)}while(null!==n)}})),$a=null}catch(n){throw null!==$a&&($a=$a.slice(e+1)),Ta(Ia,qa),n}finally{za=!1}}}var Ka=E.ReactCurrentBatchConfig;function Xa(e,t){if(e&&e.defaultProps){for(var n in t=a({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}var Qa=ca(null),Ja=null,eo=null,to=null;function no(){to=eo=Ja=null}function ro(e){var t=Qa.current;ua(Qa),e.type._context._currentValue=t}function ao(e,t){for(;null!==e;){var n=e.alternate;if((e.childLanes&t)===t){if(null===n||(n.childLanes&t)===t)break;n.childLanes|=t}else e.childLanes|=t,null!==n&&(n.childLanes|=t);e=e.return}}function oo(e,t){Ja=e,to=eo=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!=(e.lanes&t)&&(Fi=!0),e.firstContext=null)}function io(e,t){if(to!==e&&!1!==t&&0!==t)if("number"==typeof t&&1073741823!==t||(to=e,t=1073741823),t={context:e,observedBits:t,next:null},null===eo){if(null===Ja)throw Error(i(308));eo=t,Ja.dependencies={lanes:0,firstContext:t,responders:null}}else eo=eo.next=t;return e._currentValue}var lo=!1;function so(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null},effects:null}}function co(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function uo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function fo(e,t){if(null!==(e=e.updateQueue)){var n=(e=e.shared).pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}}function po(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var a=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===o?a=o=i:o=o.next=i,n=n.next}while(null!==n);null===o?a=o=t:o=o.next=t}else a=o=t;return n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:o,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function mo(e,t,n,r){var o=e.updateQueue;lo=!1;var i=o.firstBaseUpdate,l=o.lastBaseUpdate,s=o.shared.pending;if(null!==s){o.shared.pending=null;var c=s,u=c.next;c.next=null,null===l?i=u:l.next=u,l=c;var d=e.alternate;if(null!==d){var f=(d=d.updateQueue).lastBaseUpdate;f!==l&&(null===f?d.firstBaseUpdate=u:f.next=u,d.lastBaseUpdate=c)}}if(null!==i){for(f=o.baseState,l=0,d=u=c=null;;){s=i.lane;var p=i.eventTime;if((r&s)===s){null!==d&&(d=d.next={eventTime:p,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var m=e,h=i;switch(s=t,p=n,h.tag){case 1:if("function"==typeof(m=h.payload)){f=m.call(p,f,s);break e}f=m;break e;case 3:m.flags=-4097&m.flags|64;case 0:if(null==(s="function"==typeof(m=h.payload)?m.call(p,f,s):m))break e;f=a({},f,s);break e;case 2:lo=!0}}null!==i.callback&&(e.flags|=32,null===(s=o.effects)?o.effects=[i]:s.push(i))}else p={eventTime:p,lane:s,tag:i.tag,payload:i.payload,callback:i.callback,next:null},null===d?(u=d=p,c=f):d=d.next=p,l|=s;if(null===(i=i.next)){if(null===(s=o.shared.pending))break;i=s.next,s.next=null,o.lastBaseUpdate=s,o.shared.pending=null}}null===d&&(c=f),o.baseState=c,o.firstBaseUpdate=u,o.lastBaseUpdate=d,zl|=l,e.lanes=l,e.memoizedState=f}}function ho(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],a=r.callback;if(null!==a){if(r.callback=null,r=n,"function"!=typeof a)throw Error(i(191,a));a.call(r)}}}var go=(new r.Component).refs;function bo(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:a({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var vo={isMounted:function(e){return!!(e=e._reactInternals)&&Ke(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=fs(),a=ps(e),o=uo(r,a);o.payload=t,null!=n&&(o.callback=n),fo(e,o),ms(e,a,r)},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=fs(),a=ps(e),o=uo(r,a);o.tag=1,o.payload=t,null!=n&&(o.callback=n),fo(e,o),ms(e,a,r)},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=fs(),r=ps(e),a=uo(n,r);a.tag=2,null!=t&&(a.callback=t),fo(e,a),ms(e,r,n)}};function yo(e,t,n,r,a,o,i){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,i):!t.prototype||!t.prototype.isPureReactComponent||(!fr(n,r)||!fr(a,o))}function wo(e,t,n){var r=!1,a=fa,o=t.contextType;return"object"==typeof o&&null!==o?o=io(o):(a=ba(t)?ha:pa.current,o=(r=null!=(r=t.contextTypes))?ga(e,a):fa),t=new t(n,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=vo,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=o),t}function Eo(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&vo.enqueueReplaceState(t,t.state,null)}function ko(e,t,n,r){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs=go,so(e);var o=t.contextType;"object"==typeof o&&null!==o?a.context=io(o):(o=ba(t)?ha:pa.current,a.context=ga(e,o)),mo(e,n,a,r),a.state=e.memoizedState,"function"==typeof(o=t.getDerivedStateFromProps)&&(bo(e,t,o,n),a.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof a.getSnapshotBeforeUpdate||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||(t=a.state,"function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount(),t!==a.state&&vo.enqueueReplaceState(a,a.state,null),mo(e,n,a,r),a.state=e.memoizedState),"function"==typeof a.componentDidMount&&(e.flags|=4)}var So=Array.isArray;function _o(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(i(309));var r=n.stateNode}if(!r)throw Error(i(147,e));var a=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===a?t.ref:(t=function(e){var t=r.refs;t===go&&(t=r.refs={}),null===e?delete t[a]:t[a]=e},t._stringRef=a,t)}if("string"!=typeof e)throw Error(i(284));if(!n._owner)throw Error(i(290,e))}return e}function xo(e,t){if("textarea"!==e.type)throw Error(i(31,"[object Object]"===Object.prototype.toString.call(t)?"object with keys {"+Object.keys(t).join(", ")+"}":t))}function To(e){function t(t,n){if(e){var r=t.lastEffect;null!==r?(r.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n,n.nextEffect=null,n.flags=8}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function a(e,t){return(e=Vs(e,t)).index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags=2,n):r:(t.flags=2,n):n}function l(t){return e&&null===t.alternate&&(t.flags=2),t}function s(e,t,n,r){return null===t||6!==t.tag?((t=Ks(n,e.mode,r)).return=e,t):((t=a(t,n)).return=e,t)}function c(e,t,n,r){return null!==t&&t.elementType===n.type?((r=a(t,n.props)).ref=_o(e,t,n),r.return=e,r):((r=Ws(n.type,n.key,n.props,null,e.mode,r)).ref=_o(e,t,n),r.return=e,r)}function u(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Xs(n,e.mode,r)).return=e,t):((t=a(t,n.children||[])).return=e,t)}function d(e,t,n,r,o){return null===t||7!==t.tag?((t=qs(n,e.mode,r,o)).return=e,t):((t=a(t,n)).return=e,t)}function f(e,t,n){if("string"==typeof t||"number"==typeof t)return(t=Ks(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case k:return(n=Ws(t.type,t.key,t.props,null,e.mode,n)).ref=_o(e,null,t),n.return=e,n;case S:return(t=Xs(t,e.mode,n)).return=e,t}if(So(t)||j(t))return(t=qs(t,e.mode,n,null)).return=e,t;xo(e,t)}return null}function p(e,t,n,r){var a=null!==t?t.key:null;if("string"==typeof n||"number"==typeof n)return null!==a?null:s(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case k:return n.key===a?n.type===_?d(e,t,n.props.children,r,a):c(e,t,n,r):null;case S:return n.key===a?u(e,t,n,r):null}if(So(n)||j(n))return null!==a?null:d(e,t,n,r,null);xo(e,n)}return null}function m(e,t,n,r,a){if("string"==typeof r||"number"==typeof r)return s(t,e=e.get(n)||null,""+r,a);if("object"==typeof r&&null!==r){switch(r.$$typeof){case k:return e=e.get(null===r.key?n:r.key)||null,r.type===_?d(t,e,r.props.children,a,r.key):c(t,e,r,a);case S:return u(t,e=e.get(null===r.key?n:r.key)||null,r,a)}if(So(r)||j(r))return d(t,e=e.get(n)||null,r,a,null);xo(t,r)}return null}function h(a,i,l,s){for(var c=null,u=null,d=i,h=i=0,g=null;null!==d&&h<l.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var b=p(a,d,l[h],s);if(null===b){null===d&&(d=g);break}e&&d&&null===b.alternate&&t(a,d),i=o(b,i,h),null===u?c=b:u.sibling=b,u=b,d=g}if(h===l.length)return n(a,d),c;if(null===d){for(;h<l.length;h++)null!==(d=f(a,l[h],s))&&(i=o(d,i,h),null===u?c=d:u.sibling=d,u=d);return c}for(d=r(a,d);h<l.length;h++)null!==(g=m(d,a,h,l[h],s))&&(e&&null!==g.alternate&&d.delete(null===g.key?h:g.key),i=o(g,i,h),null===u?c=g:u.sibling=g,u=g);return e&&d.forEach((function(e){return t(a,e)})),c}function g(a,l,s,c){var u=j(s);if("function"!=typeof u)throw Error(i(150));if(null==(s=u.call(s)))throw Error(i(151));for(var d=u=null,h=l,g=l=0,b=null,v=s.next();null!==h&&!v.done;g++,v=s.next()){h.index>g?(b=h,h=null):b=h.sibling;var y=p(a,h,v.value,c);if(null===y){null===h&&(h=b);break}e&&h&&null===y.alternate&&t(a,h),l=o(y,l,g),null===d?u=y:d.sibling=y,d=y,h=b}if(v.done)return n(a,h),u;if(null===h){for(;!v.done;g++,v=s.next())null!==(v=f(a,v.value,c))&&(l=o(v,l,g),null===d?u=v:d.sibling=v,d=v);return u}for(h=r(a,h);!v.done;g++,v=s.next())null!==(v=m(h,a,g,v.value,c))&&(e&&null!==v.alternate&&h.delete(null===v.key?g:v.key),l=o(v,l,g),null===d?u=v:d.sibling=v,d=v);return e&&h.forEach((function(e){return t(a,e)})),u}return function(e,r,o,s){var c="object"==typeof o&&null!==o&&o.type===_&&null===o.key;c&&(o=o.props.children);var u="object"==typeof o&&null!==o;if(u)switch(o.$$typeof){case k:e:{for(u=o.key,c=r;null!==c;){if(c.key===u){if(7===c.tag){if(o.type===_){n(e,c.sibling),(r=a(c,o.props.children)).return=e,e=r;break e}}else if(c.elementType===o.type){n(e,c.sibling),(r=a(c,o.props)).ref=_o(e,c,o),r.return=e,e=r;break e}n(e,c);break}t(e,c),c=c.sibling}o.type===_?((r=qs(o.props.children,e.mode,s,o.key)).return=e,e=r):((s=Ws(o.type,o.key,o.props,null,e.mode,s)).ref=_o(e,r,o),s.return=e,e=s)}return l(e);case S:e:{for(c=o.key;null!==r;){if(r.key===c){if(4===r.tag&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),(r=a(r,o.children||[])).return=e,e=r;break e}n(e,r);break}t(e,r),r=r.sibling}(r=Xs(o,e.mode,s)).return=e,e=r}return l(e)}if("string"==typeof o||"number"==typeof o)return o=""+o,null!==r&&6===r.tag?(n(e,r.sibling),(r=a(r,o)).return=e,e=r):(n(e,r),(r=Ks(o,e.mode,s)).return=e,e=r),l(e);if(So(o))return h(e,r,o,s);if(j(o))return g(e,r,o,s);if(u&&xo(e,o),void 0===o&&!c)switch(e.tag){case 1:case 22:case 0:case 11:case 15:throw Error(i(152,W(e.type)||"Component"))}return n(e,r)}}var Co=To(!0),Ao=To(!1),No={},Oo=ca(No),Lo=ca(No),Io=ca(No);function Po(e){if(e===No)throw Error(i(174));return e}function Ro(e,t){switch(da(Io,t),da(Lo,e),da(Oo,No),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:me(null,"");break;default:t=me(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}ua(Oo),da(Oo,t)}function Mo(){ua(Oo),ua(Lo),ua(Io)}function Do(e){Po(Io.current);var t=Po(Oo.current),n=me(t,e.type);t!==n&&(da(Lo,e),da(Oo,n))}function Fo(e){Lo.current===e&&(ua(Oo),ua(Lo))}var Bo=ca(0);function $o(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(64&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Uo=null,zo=null,jo=!1;function Ho(e,t){var n=Zs(5,null,null,0);n.elementType="DELETED",n.type="DELETED",n.stateNode=t,n.return=e,n.flags=8,null!==e.lastEffect?(e.lastEffect.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n}function Zo(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,!0);default:return!1}}function Go(e){if(jo){var t=zo;if(t){var n=t;if(!Zo(e,t)){if(!(t=qr(n.nextSibling))||!Zo(e,t))return e.flags=-1025&e.flags|2,jo=!1,void(Uo=e);Ho(Uo,n)}Uo=e,zo=qr(t.firstChild)}else e.flags=-1025&e.flags|2,jo=!1,Uo=e}}function Vo(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;Uo=e}function Wo(e){if(e!==Uo)return!1;if(!jo)return Vo(e),jo=!0,!1;var t=e.type;if(5!==e.tag||"head"!==t&&"body"!==t&&!Zr(t,e.memoizedProps))for(t=zo;t;)Ho(e,t),t=qr(t.nextSibling);if(Vo(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(i(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){zo=qr(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}zo=null}}else zo=Uo?qr(e.stateNode.nextSibling):null;return!0}function qo(){zo=Uo=null,jo=!1}var Yo=[];function Ko(){for(var e=0;e<Yo.length;e++)Yo[e]._workInProgressVersionPrimary=null;Yo.length=0}var Xo=E.ReactCurrentDispatcher,Qo=E.ReactCurrentBatchConfig,Jo=0,ei=null,ti=null,ni=null,ri=!1,ai=!1;function oi(){throw Error(i(321))}function ii(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ur(e[n],t[n]))return!1;return!0}function li(e,t,n,r,a,o){if(Jo=o,ei=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Xo.current=null===e||null===e.memoizedState?Pi:Ri,e=n(r,a),ai){o=0;do{if(ai=!1,!(25>o))throw Error(i(301));o+=1,ni=ti=null,t.updateQueue=null,Xo.current=Mi,e=n(r,a)}while(ai)}if(Xo.current=Ii,t=null!==ti&&null!==ti.next,Jo=0,ni=ti=ei=null,ri=!1,t)throw Error(i(300));return e}function si(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===ni?ei.memoizedState=ni=e:ni=ni.next=e,ni}function ci(){if(null===ti){var e=ei.alternate;e=null!==e?e.memoizedState:null}else e=ti.next;var t=null===ni?ei.memoizedState:ni.next;if(null!==t)ni=t,ti=e;else{if(null===e)throw Error(i(310));e={memoizedState:(ti=e).memoizedState,baseState:ti.baseState,baseQueue:ti.baseQueue,queue:ti.queue,next:null},null===ni?ei.memoizedState=ni=e:ni=ni.next=e}return ni}function ui(e,t){return"function"==typeof t?t(e):t}function di(e){var t=ci(),n=t.queue;if(null===n)throw Error(i(311));n.lastRenderedReducer=e;var r=ti,a=r.baseQueue,o=n.pending;if(null!==o){if(null!==a){var l=a.next;a.next=o.next,o.next=l}r.baseQueue=a=o,n.pending=null}if(null!==a){a=a.next,r=r.baseState;var s=l=o=null,c=a;do{var u=c.lane;if((Jo&u)===u)null!==s&&(s=s.next={lane:0,action:c.action,eagerReducer:c.eagerReducer,eagerState:c.eagerState,next:null}),r=c.eagerReducer===e?c.eagerState:e(r,c.action);else{var d={lane:u,action:c.action,eagerReducer:c.eagerReducer,eagerState:c.eagerState,next:null};null===s?(l=s=d,o=r):s=s.next=d,ei.lanes|=u,zl|=u}c=c.next}while(null!==c&&c!==a);null===s?o=r:s.next=l,ur(r,t.memoizedState)||(Fi=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=s,n.lastRenderedState=r}return[t.memoizedState,n.dispatch]}function fi(e){var t=ci(),n=t.queue;if(null===n)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(null!==a){n.pending=null;var l=a=a.next;do{o=e(o,l.action),l=l.next}while(l!==a);ur(o,t.memoizedState)||(Fi=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function pi(e,t,n){var r=t._getVersion;r=r(t._source);var a=t._workInProgressVersionPrimary;if(null!==a?e=a===r:(e=e.mutableReadLanes,(e=(Jo&e)===e)&&(t._workInProgressVersionPrimary=r,Yo.push(t))),e)return n(t._source);throw Yo.push(t),Error(i(350))}function mi(e,t,n,r){var a=Pl;if(null===a)throw Error(i(349));var o=t._getVersion,l=o(t._source),s=Xo.current,c=s.useState((function(){return pi(a,t,n)})),u=c[1],d=c[0];c=ni;var f=e.memoizedState,p=f.refs,m=p.getSnapshot,h=f.source;f=f.subscribe;var g=ei;return e.memoizedState={refs:p,source:t,subscribe:r},s.useEffect((function(){p.getSnapshot=n,p.setSnapshot=u;var e=o(t._source);if(!ur(l,e)){e=n(t._source),ur(d,e)||(u(e),e=ps(g),a.mutableReadLanes|=e&a.pendingLanes),e=a.mutableReadLanes,a.entangledLanes|=e;for(var r=a.entanglements,i=e;0<i;){var s=31-Zt(i),c=1<<s;r[s]|=e,i&=~c}}}),[n,t,r]),s.useEffect((function(){return r(t._source,(function(){var e=p.getSnapshot,n=p.setSnapshot;try{n(e(t._source));var r=ps(g);a.mutableReadLanes|=r&a.pendingLanes}catch(o){n((function(){throw o}))}}))}),[t,r]),ur(m,n)&&ur(h,t)&&ur(f,r)||((e={pending:null,dispatch:null,lastRenderedReducer:ui,lastRenderedState:d}).dispatch=u=Li.bind(null,ei,e),c.queue=e,c.baseQueue=null,d=pi(a,t,n),c.memoizedState=c.baseState=d),d}function hi(e,t,n){return mi(ci(),e,t,n)}function gi(e){var t=si();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=(e=t.queue={pending:null,dispatch:null,lastRenderedReducer:ui,lastRenderedState:e}).dispatch=Li.bind(null,ei,e),[t.memoizedState,e]}function bi(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=ei.updateQueue)?(t={lastEffect:null},ei.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function vi(e){return e={current:e},si().memoizedState=e}function yi(){return ci().memoizedState}function wi(e,t,n,r){var a=si();ei.flags|=e,a.memoizedState=bi(1|t,n,void 0,void 0===r?null:r)}function Ei(e,t,n,r){var a=ci();r=void 0===r?null:r;var o=void 0;if(null!==ti){var i=ti.memoizedState;if(o=i.destroy,null!==r&&ii(r,i.deps))return void bi(t,n,o,r)}ei.flags|=e,a.memoizedState=bi(1|t,n,o,r)}function ki(e,t){return wi(516,4,e,t)}function Si(e,t){return Ei(516,4,e,t)}function _i(e,t){return Ei(4,2,e,t)}function xi(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Ti(e,t,n){return n=null!=n?n.concat([e]):null,Ei(4,2,xi.bind(null,t,e),n)}function Ci(){}function Ai(e,t){var n=ci();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&ii(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ni(e,t){var n=ci();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&ii(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Oi(e,t){var n=Za();Va(98>n?98:n,(function(){e(!0)})),Va(97<n?97:n,(function(){var n=Qo.transition;Qo.transition=1;try{e(!1),t()}finally{Qo.transition=n}}))}function Li(e,t,n){var r=fs(),a=ps(e),o={lane:a,action:n,eagerReducer:null,eagerState:null,next:null},i=t.pending;if(null===i?o.next=o:(o.next=i.next,i.next=o),t.pending=o,i=e.alternate,e===ei||null!==i&&i===ei)ai=ri=!0;else{if(0===e.lanes&&(null===i||0===i.lanes)&&null!==(i=t.lastRenderedReducer))try{var l=t.lastRenderedState,s=i(l,n);if(o.eagerReducer=i,o.eagerState=s,ur(s,l))return}catch(c){}ms(e,a,r)}}var Ii={readContext:io,useCallback:oi,useContext:oi,useEffect:oi,useImperativeHandle:oi,useLayoutEffect:oi,useMemo:oi,useReducer:oi,useRef:oi,useState:oi,useDebugValue:oi,useDeferredValue:oi,useTransition:oi,useMutableSource:oi,useOpaqueIdentifier:oi,unstable_isNewReconciler:!1},Pi={readContext:io,useCallback:function(e,t){return si().memoizedState=[e,void 0===t?null:t],e},useContext:io,useEffect:ki,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,wi(4,2,xi.bind(null,t,e),n)},useLayoutEffect:function(e,t){return wi(4,2,e,t)},useMemo:function(e,t){var n=si();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=si();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e=(e=r.queue={pending:null,dispatch:null,lastRenderedReducer:e,lastRenderedState:t}).dispatch=Li.bind(null,ei,e),[r.memoizedState,e]},useRef:vi,useState:gi,useDebugValue:Ci,useDeferredValue:function(e){var t=gi(e),n=t[0],r=t[1];return ki((function(){var t=Qo.transition;Qo.transition=1;try{r(e)}finally{Qo.transition=t}}),[e]),n},useTransition:function(){var e=gi(!1),t=e[0];return vi(e=Oi.bind(null,e[1])),[e,t]},useMutableSource:function(e,t,n){var r=si();return r.memoizedState={refs:{getSnapshot:t,setSnapshot:null},source:e,subscribe:n},mi(r,e,t,n)},useOpaqueIdentifier:function(){if(jo){var e=!1,t=function(e){return{$$typeof:M,toString:e,valueOf:e}}((function(){throw e||(e=!0,n("r:"+(Kr++).toString(36))),Error(i(355))})),n=gi(t)[1];return 0==(2&ei.mode)&&(ei.flags|=516,bi(5,(function(){n("r:"+(Kr++).toString(36))}),void 0,null)),t}return gi(t="r:"+(Kr++).toString(36)),t},unstable_isNewReconciler:!1},Ri={readContext:io,useCallback:Ai,useContext:io,useEffect:Si,useImperativeHandle:Ti,useLayoutEffect:_i,useMemo:Ni,useReducer:di,useRef:yi,useState:function(){return di(ui)},useDebugValue:Ci,useDeferredValue:function(e){var t=di(ui),n=t[0],r=t[1];return Si((function(){var t=Qo.transition;Qo.transition=1;try{r(e)}finally{Qo.transition=t}}),[e]),n},useTransition:function(){var e=di(ui)[0];return[yi().current,e]},useMutableSource:hi,useOpaqueIdentifier:function(){return di(ui)[0]},unstable_isNewReconciler:!1},Mi={readContext:io,useCallback:Ai,useContext:io,useEffect:Si,useImperativeHandle:Ti,useLayoutEffect:_i,useMemo:Ni,useReducer:fi,useRef:yi,useState:function(){return fi(ui)},useDebugValue:Ci,useDeferredValue:function(e){var t=fi(ui),n=t[0],r=t[1];return Si((function(){var t=Qo.transition;Qo.transition=1;try{r(e)}finally{Qo.transition=t}}),[e]),n},useTransition:function(){var e=fi(ui)[0];return[yi().current,e]},useMutableSource:hi,useOpaqueIdentifier:function(){return fi(ui)[0]},unstable_isNewReconciler:!1},Di=E.ReactCurrentOwner,Fi=!1;function Bi(e,t,n,r){t.child=null===e?Ao(t,null,n,r):Co(t,e.child,n,r)}function $i(e,t,n,r,a){n=n.render;var o=t.ref;return oo(t,a),r=li(e,t,n,r,o,a),null===e||Fi?(t.flags|=1,Bi(e,t,r,a),t.child):(t.updateQueue=e.updateQueue,t.flags&=-517,e.lanes&=~a,ol(e,t,a))}function Ui(e,t,n,r,a,o){if(null===e){var i=n.type;return"function"!=typeof i||Gs(i)||void 0!==i.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Ws(n.type,null,r,t,t.mode,o)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=i,zi(e,t,i,r,a,o))}return i=e.child,0==(a&o)&&(a=i.memoizedProps,(n=null!==(n=n.compare)?n:fr)(a,r)&&e.ref===t.ref)?ol(e,t,o):(t.flags|=1,(e=Vs(i,r)).ref=t.ref,e.return=t,t.child=e)}function zi(e,t,n,r,a,o){if(null!==e&&fr(e.memoizedProps,r)&&e.ref===t.ref){if(Fi=!1,0==(o&a))return t.lanes=e.lanes,ol(e,t,o);0!=(16384&e.flags)&&(Fi=!0)}return Zi(e,t,n,r,o)}function ji(e,t,n){var r=t.pendingProps,a=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode||"unstable-defer-without-hiding"===r.mode)if(0==(4&t.mode))t.memoizedState={baseLanes:0},ks(t,n);else{if(0==(1073741824&n))return e=null!==o?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e},ks(t,e),null;t.memoizedState={baseLanes:0},ks(t,null!==o?o.baseLanes:n)}else null!==o?(r=o.baseLanes|n,t.memoizedState=null):r=n,ks(t,r);return Bi(e,t,a,n),t.child}function Hi(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=128)}function Zi(e,t,n,r,a){var o=ba(n)?ha:pa.current;return o=ga(t,o),oo(t,a),n=li(e,t,n,r,o,a),null===e||Fi?(t.flags|=1,Bi(e,t,n,a),t.child):(t.updateQueue=e.updateQueue,t.flags&=-517,e.lanes&=~a,ol(e,t,a))}function Gi(e,t,n,r,a){if(ba(n)){var o=!0;Ea(t)}else o=!1;if(oo(t,a),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),wo(t,n,r),ko(t,n,r,a),r=!0;else if(null===e){var i=t.stateNode,l=t.memoizedProps;i.props=l;var s=i.context,c=n.contextType;"object"==typeof c&&null!==c?c=io(c):c=ga(t,c=ba(n)?ha:pa.current);var u=n.getDerivedStateFromProps,d="function"==typeof u||"function"==typeof i.getSnapshotBeforeUpdate;d||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(l!==r||s!==c)&&Eo(t,i,r,c),lo=!1;var f=t.memoizedState;i.state=f,mo(t,r,i,a),s=t.memoizedState,l!==r||f!==s||ma.current||lo?("function"==typeof u&&(bo(t,n,u,r),s=t.memoizedState),(l=lo||yo(t,n,l,r,f,s,c))?(d||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||("function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount()),"function"==typeof i.componentDidMount&&(t.flags|=4)):("function"==typeof i.componentDidMount&&(t.flags|=4),t.memoizedProps=r,t.memoizedState=s),i.props=r,i.state=s,i.context=c,r=l):("function"==typeof i.componentDidMount&&(t.flags|=4),r=!1)}else{i=t.stateNode,co(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:Xa(t.type,l),i.props=c,d=t.pendingProps,f=i.context,"object"==typeof(s=n.contextType)&&null!==s?s=io(s):s=ga(t,s=ba(n)?ha:pa.current);var p=n.getDerivedStateFromProps;(u="function"==typeof p||"function"==typeof i.getSnapshotBeforeUpdate)||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(l!==d||f!==s)&&Eo(t,i,r,s),lo=!1,f=t.memoizedState,i.state=f,mo(t,r,i,a);var m=t.memoizedState;l!==d||f!==m||ma.current||lo?("function"==typeof p&&(bo(t,n,p,r),m=t.memoizedState),(c=lo||yo(t,n,c,r,f,m,s))?(u||"function"!=typeof i.UNSAFE_componentWillUpdate&&"function"!=typeof i.componentWillUpdate||("function"==typeof i.componentWillUpdate&&i.componentWillUpdate(r,m,s),"function"==typeof i.UNSAFE_componentWillUpdate&&i.UNSAFE_componentWillUpdate(r,m,s)),"function"==typeof i.componentDidUpdate&&(t.flags|=4),"function"==typeof i.getSnapshotBeforeUpdate&&(t.flags|=256)):("function"!=typeof i.componentDidUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=256),t.memoizedProps=r,t.memoizedState=m),i.props=r,i.state=m,i.context=s,r=c):("function"!=typeof i.componentDidUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=256),r=!1)}return Vi(e,t,n,r,o,a)}function Vi(e,t,n,r,a,o){Hi(e,t);var i=0!=(64&t.flags);if(!r&&!i)return a&&ka(t,n,!1),ol(e,t,o);r=t.stateNode,Di.current=t;var l=i&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&i?(t.child=Co(t,e.child,null,o),t.child=Co(t,null,l,o)):Bi(e,t,l,o),t.memoizedState=r.state,a&&ka(t,n,!0),t.child}function Wi(e){var t=e.stateNode;t.pendingContext?ya(0,t.pendingContext,t.pendingContext!==t.context):t.context&&ya(0,t.context,!1),Ro(e,t.containerInfo)}var qi,Yi,Ki,Xi={dehydrated:null,retryLane:0};function Qi(e,t,n){var r,a=t.pendingProps,o=Bo.current,i=!1;return(r=0!=(64&t.flags))||(r=(null===e||null!==e.memoizedState)&&0!=(2&o)),r?(i=!0,t.flags&=-65):null!==e&&null===e.memoizedState||void 0===a.fallback||!0===a.unstable_avoidThisFallback||(o|=1),da(Bo,1&o),null===e?(void 0!==a.fallback&&Go(t),e=a.children,o=a.fallback,i?(e=Ji(t,e,o,n),t.child.memoizedState={baseLanes:n},t.memoizedState=Xi,e):"number"==typeof a.unstable_expectedLoadTime?(e=Ji(t,e,o,n),t.child.memoizedState={baseLanes:n},t.memoizedState=Xi,t.lanes=33554432,e):((n=Ys({mode:"visible",children:e},t.mode,n,null)).return=t,t.child=n)):(e.memoizedState,i?(a=tl(e,t,a.children,a.fallback,n),i=t.child,o=e.child.memoizedState,i.memoizedState=null===o?{baseLanes:n}:{baseLanes:o.baseLanes|n},i.childLanes=e.childLanes&~n,t.memoizedState=Xi,a):(n=el(e,t,a.children,n),t.memoizedState=null,n))}function Ji(e,t,n,r){var a=e.mode,o=e.child;return t={mode:"hidden",children:t},0==(2&a)&&null!==o?(o.childLanes=0,o.pendingProps=t):o=Ys(t,a,0,null),n=qs(n,a,r,null),o.return=e,n.return=e,o.sibling=n,e.child=o,n}function el(e,t,n,r){var a=e.child;return e=a.sibling,n=Vs(a,{mode:"visible",children:n}),0==(2&t.mode)&&(n.lanes=r),n.return=t,n.sibling=null,null!==e&&(e.nextEffect=null,e.flags=8,t.firstEffect=t.lastEffect=e),t.child=n}function tl(e,t,n,r,a){var o=t.mode,i=e.child;e=i.sibling;var l={mode:"hidden",children:n};return 0==(2&o)&&t.child!==i?((n=t.child).childLanes=0,n.pendingProps=l,null!==(i=n.lastEffect)?(t.firstEffect=n.firstEffect,t.lastEffect=i,i.nextEffect=null):t.firstEffect=t.lastEffect=null):n=Vs(i,l),null!==e?r=Vs(e,r):(r=qs(r,o,a,null)).flags|=2,r.return=t,n.return=t,n.sibling=r,t.child=n,r}function nl(e,t){e.lanes|=t;var n=e.alternate;null!==n&&(n.lanes|=t),ao(e.return,t)}function rl(e,t,n,r,a,o){var i=e.memoizedState;null===i?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a,lastEffect:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=a,i.lastEffect=o)}function al(e,t,n){var r=t.pendingProps,a=r.revealOrder,o=r.tail;if(Bi(e,t,r.children,n),0!=(2&(r=Bo.current)))r=1&r|2,t.flags|=64;else{if(null!==e&&0!=(64&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&nl(e,n);else if(19===e.tag)nl(e,n);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(da(Bo,r),0==(2&t.mode))t.memoizedState=null;else switch(a){case"forwards":for(n=t.child,a=null;null!==n;)null!==(e=n.alternate)&&null===$o(e)&&(a=n),n=n.sibling;null===(n=a)?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),rl(t,!1,a,n,o,t.lastEffect);break;case"backwards":for(n=null,a=t.child,t.child=null;null!==a;){if(null!==(e=a.alternate)&&null===$o(e)){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}rl(t,!0,n,null,o,t.lastEffect);break;case"together":rl(t,!1,null,null,void 0,t.lastEffect);break;default:t.memoizedState=null}return t.child}function ol(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),zl|=t.lanes,0!=(n&t.childLanes)){if(null!==e&&t.child!==e.child)throw Error(i(153));if(null!==t.child){for(n=Vs(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Vs(e,e.pendingProps)).return=t;n.sibling=null}return t.child}return null}function il(e,t){if(!jo)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ll(e,t,n){var r=t.pendingProps;switch(t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:case 17:return ba(t.type)&&va(),null;case 3:return Mo(),ua(ma),ua(pa),Ko(),(r=t.stateNode).pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(Wo(t)?t.flags|=4:r.hydrate||(t.flags|=256)),null;case 5:Fo(t);var o=Po(Io.current);if(n=t.type,null!==e&&null!=t.stateNode)Yi(e,t,n,r),e.ref!==t.ref&&(t.flags|=128);else{if(!r){if(null===t.stateNode)throw Error(i(166));return null}if(e=Po(Oo.current),Wo(t)){r=t.stateNode,n=t.type;var l=t.memoizedProps;switch(r[Qr]=t,r[Jr]=l,n){case"dialog":Or("cancel",r),Or("close",r);break;case"iframe":case"object":case"embed":Or("load",r);break;case"video":case"audio":for(e=0;e<Tr.length;e++)Or(Tr[e],r);break;case"source":Or("error",r);break;case"img":case"image":case"link":Or("error",r),Or("load",r);break;case"details":Or("toggle",r);break;case"input":ee(r,l),Or("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!l.multiple},Or("invalid",r);break;case"textarea":se(r,l),Or("invalid",r)}for(var c in _e(n,l),e=null,l)l.hasOwnProperty(c)&&(o=l[c],"children"===c?"string"==typeof o?r.textContent!==o&&(e=["children",o]):"number"==typeof o&&r.textContent!==""+o&&(e=["children",""+o]):s.hasOwnProperty(c)&&null!=o&&"onScroll"===c&&Or("scroll",r));switch(n){case"input":K(r),re(r,l,!0);break;case"textarea":K(r),ue(r);break;case"select":case"option":break;default:"function"==typeof l.onClick&&(r.onclick=Ur)}r=e,t.updateQueue=r,null!==r&&(t.flags|=4)}else{switch(c=9===o.nodeType?o:o.ownerDocument,e===de&&(e=pe(n)),e===de?"script"===n?((e=c.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=c.createElement(n,{is:r.is}):(e=c.createElement(n),"select"===n&&(c=e,r.multiple?c.multiple=!0:r.size&&(c.size=r.size))):e=c.createElementNS(e,n),e[Qr]=t,e[Jr]=r,qi(e,t),t.stateNode=e,c=xe(n,r),n){case"dialog":Or("cancel",e),Or("close",e),o=r;break;case"iframe":case"object":case"embed":Or("load",e),o=r;break;case"video":case"audio":for(o=0;o<Tr.length;o++)Or(Tr[o],e);o=r;break;case"source":Or("error",e),o=r;break;case"img":case"image":case"link":Or("error",e),Or("load",e),o=r;break;case"details":Or("toggle",e),o=r;break;case"input":ee(e,r),o=J(e,r),Or("invalid",e);break;case"option":o=oe(e,r);break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=a({},r,{value:void 0}),Or("invalid",e);break;case"textarea":se(e,r),o=le(e,r),Or("invalid",e);break;default:o=r}_e(n,o);var u=o;for(l in u)if(u.hasOwnProperty(l)){var d=u[l];"style"===l?ke(e,d):"dangerouslySetInnerHTML"===l?null!=(d=d?d.__html:void 0)&&be(e,d):"children"===l?"string"==typeof d?("textarea"!==n||""!==d)&&ve(e,d):"number"==typeof d&&ve(e,""+d):"suppressContentEditableWarning"!==l&&"suppressHydrationWarning"!==l&&"autoFocus"!==l&&(s.hasOwnProperty(l)?null!=d&&"onScroll"===l&&Or("scroll",e):null!=d&&w(e,l,d,c))}switch(n){case"input":K(e),re(e,r,!1);break;case"textarea":K(e),ue(e);break;case"option":null!=r.value&&e.setAttribute("value",""+q(r.value));break;case"select":e.multiple=!!r.multiple,null!=(l=r.value)?ie(e,!!r.multiple,l,!1):null!=r.defaultValue&&ie(e,!!r.multiple,r.defaultValue,!0);break;default:"function"==typeof o.onClick&&(e.onclick=Ur)}Hr(n,r)&&(t.flags|=4)}null!==t.ref&&(t.flags|=128)}return null;case 6:if(e&&null!=t.stateNode)Ki(0,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(i(166));n=Po(Io.current),Po(Oo.current),Wo(t)?(r=t.stateNode,n=t.memoizedProps,r[Qr]=t,r.nodeValue!==n&&(t.flags|=4)):((r=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[Qr]=t,t.stateNode=r)}return null;case 13:return ua(Bo),r=t.memoizedState,0!=(64&t.flags)?(t.lanes=n,t):(r=null!==r,n=!1,null===e?void 0!==t.memoizedProps.fallback&&Wo(t):n=null!==e.memoizedState,r&&!n&&0!=(2&t.mode)&&(null===e&&!0!==t.memoizedProps.unstable_avoidThisFallback||0!=(1&Bo.current)?0===Bl&&(Bl=3):(0!==Bl&&3!==Bl||(Bl=4),null===Pl||0==(134217727&zl)&&0==(134217727&jl)||vs(Pl,Ml))),(r||n)&&(t.flags|=4),null);case 4:return Mo(),null===e&&Ir(t.stateNode.containerInfo),null;case 10:return ro(t),null;case 19:if(ua(Bo),null===(r=t.memoizedState))return null;if(l=0!=(64&t.flags),null===(c=r.rendering))if(l)il(r,!1);else{if(0!==Bl||null!==e&&0!=(64&e.flags))for(e=t.child;null!==e;){if(null!==(c=$o(e))){for(t.flags|=64,il(r,!1),null!==(l=c.updateQueue)&&(t.updateQueue=l,t.flags|=4),null===r.lastEffect&&(t.firstEffect=null),t.lastEffect=r.lastEffect,r=n,n=t.child;null!==n;)e=r,(l=n).flags&=2,l.nextEffect=null,l.firstEffect=null,l.lastEffect=null,null===(c=l.alternate)?(l.childLanes=0,l.lanes=e,l.child=null,l.memoizedProps=null,l.memoizedState=null,l.updateQueue=null,l.dependencies=null,l.stateNode=null):(l.childLanes=c.childLanes,l.lanes=c.lanes,l.child=c.child,l.memoizedProps=c.memoizedProps,l.memoizedState=c.memoizedState,l.updateQueue=c.updateQueue,l.type=c.type,e=c.dependencies,l.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return da(Bo,1&Bo.current|2),t.child}e=e.sibling}null!==r.tail&&Ha()>Vl&&(t.flags|=64,l=!0,il(r,!1),t.lanes=33554432)}else{if(!l)if(null!==(e=$o(c))){if(t.flags|=64,l=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),il(r,!0),null===r.tail&&"hidden"===r.tailMode&&!c.alternate&&!jo)return null!==(t=t.lastEffect=r.lastEffect)&&(t.nextEffect=null),null}else 2*Ha()-r.renderingStartTime>Vl&&1073741824!==n&&(t.flags|=64,l=!0,il(r,!1),t.lanes=33554432);r.isBackwards?(c.sibling=t.child,t.child=c):(null!==(n=r.last)?n.sibling=c:t.child=c,r.last=c)}return null!==r.tail?(n=r.tail,r.rendering=n,r.tail=n.sibling,r.lastEffect=t.lastEffect,r.renderingStartTime=Ha(),n.sibling=null,t=Bo.current,da(Bo,l?1&t|2:1&t),n):null;case 23:case 24:return Ss(),null!==e&&null!==e.memoizedState!=(null!==t.memoizedState)&&"unstable-defer-without-hiding"!==r.mode&&(t.flags|=4),null}throw Error(i(156,t.tag))}function sl(e){switch(e.tag){case 1:ba(e.type)&&va();var t=e.flags;return 4096&t?(e.flags=-4097&t|64,e):null;case 3:if(Mo(),ua(ma),ua(pa),Ko(),0!=(64&(t=e.flags)))throw Error(i(285));return e.flags=-4097&t|64,e;case 5:return Fo(e),null;case 13:return ua(Bo),4096&(t=e.flags)?(e.flags=-4097&t|64,e):null;case 19:return ua(Bo),null;case 4:return Mo(),null;case 10:return ro(e),null;case 23:case 24:return Ss(),null;default:return null}}function cl(e,t){try{var n="",r=t;do{n+=V(r),r=r.return}while(r);var a=n}catch(o){a="\nError generating stack: "+o.message+"\n"+o.stack}return{value:e,source:t,stack:a}}function ul(e,t){try{console.error(t.value)}catch(n){setTimeout((function(){throw n}))}}qi=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Yi=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Po(Oo.current);var i,l=null;switch(n){case"input":o=J(e,o),r=J(e,r),l=[];break;case"option":o=oe(e,o),r=oe(e,r),l=[];break;case"select":o=a({},o,{value:void 0}),r=a({},r,{value:void 0}),l=[];break;case"textarea":o=le(e,o),r=le(e,r),l=[];break;default:"function"!=typeof o.onClick&&"function"==typeof r.onClick&&(e.onclick=Ur)}for(d in _e(n,r),n=null,o)if(!r.hasOwnProperty(d)&&o.hasOwnProperty(d)&&null!=o[d])if("style"===d){var c=o[d];for(i in c)c.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else"dangerouslySetInnerHTML"!==d&&"children"!==d&&"suppressContentEditableWarning"!==d&&"suppressHydrationWarning"!==d&&"autoFocus"!==d&&(s.hasOwnProperty(d)?l||(l=[]):(l=l||[]).push(d,null));for(d in r){var u=r[d];if(c=null!=o?o[d]:void 0,r.hasOwnProperty(d)&&u!==c&&(null!=u||null!=c))if("style"===d)if(c){for(i in c)!c.hasOwnProperty(i)||u&&u.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in u)u.hasOwnProperty(i)&&c[i]!==u[i]&&(n||(n={}),n[i]=u[i])}else n||(l||(l=[]),l.push(d,n)),n=u;else"dangerouslySetInnerHTML"===d?(u=u?u.__html:void 0,c=c?c.__html:void 0,null!=u&&c!==u&&(l=l||[]).push(d,u)):"children"===d?"string"!=typeof u&&"number"!=typeof u||(l=l||[]).push(d,""+u):"suppressContentEditableWarning"!==d&&"suppressHydrationWarning"!==d&&(s.hasOwnProperty(d)?(null!=u&&"onScroll"===d&&Or("scroll",e),l||c===u||(l=[])):"object"==typeof u&&null!==u&&u.$$typeof===M?u.toString():(l=l||[]).push(d,u))}n&&(l=l||[]).push("style",n);var d=l;(t.updateQueue=d)&&(t.flags|=4)}},Ki=function(e,t,n,r){n!==r&&(t.flags|=4)};var dl="function"==typeof WeakMap?WeakMap:Map;function fl(e,t,n){(n=uo(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Kl||(Kl=!0,Xl=r),ul(0,t)},n}function pl(e,t,n){(n=uo(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var a=t.value;n.payload=function(){return ul(0,t),r(a)}}var o=e.stateNode;return null!==o&&"function"==typeof o.componentDidCatch&&(n.callback=function(){"function"!=typeof r&&(null===Ql?Ql=new Set([this]):Ql.add(this),ul(0,t));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}var ml="function"==typeof WeakSet?WeakSet:Set;function hl(e){var t=e.ref;if(null!==t)if("function"==typeof t)try{t(null)}catch(n){Us(e,n)}else t.current=null}function gl(e,t){switch(t.tag){case 0:case 11:case 15:case 22:case 5:case 6:case 4:case 17:return;case 1:if(256&t.flags&&null!==e){var n=e.memoizedProps,r=e.memoizedState;t=(e=t.stateNode).getSnapshotBeforeUpdate(t.elementType===t.type?n:Xa(t.type,n),r),e.__reactInternalSnapshotBeforeUpdate=t}return;case 3:return void(256&t.flags&&Wr(t.stateNode.containerInfo))}throw Error(i(163))}function bl(e,t,n){switch(n.tag){case 0:case 11:case 15:case 22:if(null!==(t=null!==(t=n.updateQueue)?t.lastEffect:null)){e=t=t.next;do{if(3==(3&e.tag)){var r=e.create;e.destroy=r()}e=e.next}while(e!==t)}if(null!==(t=null!==(t=n.updateQueue)?t.lastEffect:null)){e=t=t.next;do{var a=e;r=a.next,0!=(4&(a=a.tag))&&0!=(1&a)&&(Fs(n,e),Ds(n,e)),e=r}while(e!==t)}return;case 1:return e=n.stateNode,4&n.flags&&(null===t?e.componentDidMount():(r=n.elementType===n.type?t.memoizedProps:Xa(n.type,t.memoizedProps),e.componentDidUpdate(r,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate))),void(null!==(t=n.updateQueue)&&ho(n,t,e));case 3:if(null!==(t=n.updateQueue)){if(e=null,null!==n.child)switch(n.child.tag){case 5:case 1:e=n.child.stateNode}ho(n,t,e)}return;case 5:return e=n.stateNode,void(null===t&&4&n.flags&&Hr(n.type,n.memoizedProps)&&e.focus());case 6:case 4:case 12:case 19:case 17:case 20:case 21:case 23:case 24:return;case 13:return void(null===n.memoizedState&&(n=n.alternate,null!==n&&(n=n.memoizedState,null!==n&&(n=n.dehydrated,null!==n&&kt(n)))))}throw Error(i(163))}function vl(e,t){for(var n=e;;){if(5===n.tag){var r=n.stateNode;if(t)"function"==typeof(r=r.style).setProperty?r.setProperty("display","none","important"):r.display="none";else{r=n.stateNode;var a=n.memoizedProps.style;a=null!=a&&a.hasOwnProperty("display")?a.display:null,r.style.display=Ee("display",a)}}else if(6===n.tag)n.stateNode.nodeValue=t?"":n.memoizedProps;else if((23!==n.tag&&24!==n.tag||null===n.memoizedState||n===e)&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}}function yl(e,t){if(_a&&"function"==typeof _a.onCommitFiberUnmount)try{_a.onCommitFiberUnmount(Sa,t)}catch(o){}switch(t.tag){case 0:case 11:case 14:case 15:case 22:if(null!==(e=t.updateQueue)&&null!==(e=e.lastEffect)){var n=e=e.next;do{var r=n,a=r.destroy;if(r=r.tag,void 0!==a)if(0!=(4&r))Fs(t,n);else{r=t;try{a()}catch(o){Us(r,o)}}n=n.next}while(n!==e)}break;case 1:if(hl(t),"function"==typeof(e=t.stateNode).componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(o){Us(t,o)}break;case 5:hl(t);break;case 4:xl(e,t)}}function wl(e){e.alternate=null,e.child=null,e.dependencies=null,e.firstEffect=null,e.lastEffect=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.return=null,e.updateQueue=null}function El(e){return 5===e.tag||3===e.tag||4===e.tag}function kl(e){e:{for(var t=e.return;null!==t;){if(El(t))break e;t=t.return}throw Error(i(160))}var n=t;switch(t=n.stateNode,n.tag){case 5:var r=!1;break;case 3:case 4:t=t.containerInfo,r=!0;break;default:throw Error(i(161))}16&n.flags&&(ve(t,""),n.flags&=-17);e:t:for(n=e;;){for(;null===n.sibling;){if(null===n.return||El(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag&&18!==n.tag;){if(2&n.flags)continue t;if(null===n.child||4===n.tag)continue t;n.child.return=n,n=n.child}if(!(2&n.flags)){n=n.stateNode;break e}}r?Sl(e,n,t):_l(e,n,t)}function Sl(e,t,n){var r=e.tag,a=5===r||6===r;if(a)e=a?e.stateNode:e.stateNode.instance,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Ur));else if(4!==r&&null!==(e=e.child))for(Sl(e,t,n),e=e.sibling;null!==e;)Sl(e,t,n),e=e.sibling}function _l(e,t,n){var r=e.tag,a=5===r||6===r;if(a)e=a?e.stateNode:e.stateNode.instance,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(_l(e,t,n),e=e.sibling;null!==e;)_l(e,t,n),e=e.sibling}function xl(e,t){for(var n,r,a=t,o=!1;;){if(!o){o=a.return;e:for(;;){if(null===o)throw Error(i(160));switch(n=o.stateNode,o.tag){case 5:r=!1;break e;case 3:case 4:n=n.containerInfo,r=!0;break e}o=o.return}o=!0}if(5===a.tag||6===a.tag){e:for(var l=e,s=a,c=s;;)if(yl(l,c),null!==c.child&&4!==c.tag)c.child.return=c,c=c.child;else{if(c===s)break e;for(;null===c.sibling;){if(null===c.return||c.return===s)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}r?(l=n,s=a.stateNode,8===l.nodeType?l.parentNode.removeChild(s):l.removeChild(s)):n.removeChild(a.stateNode)}else if(4===a.tag){if(null!==a.child){n=a.stateNode.containerInfo,r=!0,a.child.return=a,a=a.child;continue}}else if(yl(e,a),null!==a.child){a.child.return=a,a=a.child;continue}if(a===t)break;for(;null===a.sibling;){if(null===a.return||a.return===t)return;4===(a=a.return).tag&&(o=!1)}a.sibling.return=a.return,a=a.sibling}}function Tl(e,t){switch(t.tag){case 0:case 11:case 14:case 15:case 22:var n=t.updateQueue;if(null!==(n=null!==n?n.lastEffect:null)){var r=n=n.next;do{3==(3&r.tag)&&(e=r.destroy,r.destroy=void 0,void 0!==e&&e()),r=r.next}while(r!==n)}return;case 1:case 12:case 17:return;case 5:if(null!=(n=t.stateNode)){r=t.memoizedProps;var a=null!==e?e.memoizedProps:r;e=t.type;var o=t.updateQueue;if(t.updateQueue=null,null!==o){for(n[Jr]=r,"input"===e&&"radio"===r.type&&null!=r.name&&te(n,r),xe(e,a),t=xe(e,r),a=0;a<o.length;a+=2){var l=o[a],s=o[a+1];"style"===l?ke(n,s):"dangerouslySetInnerHTML"===l?be(n,s):"children"===l?ve(n,s):w(n,l,s,t)}switch(e){case"input":ne(n,r);break;case"textarea":ce(n,r);break;case"select":e=n._wrapperState.wasMultiple,n._wrapperState.wasMultiple=!!r.multiple,null!=(o=r.value)?ie(n,!!r.multiple,o,!1):e!==!!r.multiple&&(null!=r.defaultValue?ie(n,!!r.multiple,r.defaultValue,!0):ie(n,!!r.multiple,r.multiple?[]:"",!1))}}}return;case 6:if(null===t.stateNode)throw Error(i(162));return void(t.stateNode.nodeValue=t.memoizedProps);case 3:return void((n=t.stateNode).hydrate&&(n.hydrate=!1,kt(n.containerInfo)));case 13:return null!==t.memoizedState&&(Gl=Ha(),vl(t.child,!0)),void Cl(t);case 19:return void Cl(t);case 23:case 24:return void vl(t,null!==t.memoizedState)}throw Error(i(163))}function Cl(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new ml),t.forEach((function(t){var r=js.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))}))}}function Al(e,t){return null!==e&&(null===(e=e.memoizedState)||null!==e.dehydrated)&&(null!==(t=t.memoizedState)&&null===t.dehydrated)}var Nl=Math.ceil,Ol=E.ReactCurrentDispatcher,Ll=E.ReactCurrentOwner,Il=0,Pl=null,Rl=null,Ml=0,Dl=0,Fl=ca(0),Bl=0,$l=null,Ul=0,zl=0,jl=0,Hl=0,Zl=null,Gl=0,Vl=1/0;function Wl(){Vl=Ha()+500}var ql,Yl=null,Kl=!1,Xl=null,Ql=null,Jl=!1,es=null,ts=90,ns=[],rs=[],as=null,os=0,is=null,ls=-1,ss=0,cs=0,us=null,ds=!1;function fs(){return 0!=(48&Il)?Ha():-1!==ls?ls:ls=Ha()}function ps(e){if(0==(2&(e=e.mode)))return 1;if(0==(4&e))return 99===Za()?1:2;if(0===ss&&(ss=Ul),0!==Ka.transition){0!==cs&&(cs=null!==Zl?Zl.pendingLanes:0),e=ss;var t=4186112&~cs;return 0===(t&=-t)&&(0===(t=(e=4186112&~e)&-e)&&(t=8192)),t}return e=Za(),0!=(4&Il)&&98===e?e=Ut(12,ss):e=Ut(e=function(e){switch(e){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}(e),ss),e}function ms(e,t,n){if(50<os)throw os=0,is=null,Error(i(185));if(null===(e=hs(e,t)))return null;Ht(e,t,n),e===Pl&&(jl|=t,4===Bl&&vs(e,Ml));var r=Za();1===t?0!=(8&Il)&&0==(48&Il)?ys(e):(gs(e,n),0===Il&&(Wl(),qa())):(0==(4&Il)||98!==r&&99!==r||(null===as?as=new Set([e]):as.add(e)),gs(e,n)),Zl=e}function hs(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}function gs(e,t){for(var n=e.callbackNode,r=e.suspendedLanes,a=e.pingedLanes,o=e.expirationTimes,l=e.pendingLanes;0<l;){var s=31-Zt(l),c=1<<s,u=o[s];if(-1===u){if(0==(c&r)||0!=(c&a)){u=t,Ft(c);var d=Dt;o[s]=10<=d?u+250:6<=d?u+5e3:-1}}else u<=t&&(e.expiredLanes|=c);l&=~c}if(r=Bt(e,e===Pl?Ml:0),t=Dt,0===r)null!==n&&(n!==Fa&&Ca(n),e.callbackNode=null,e.callbackPriority=0);else{if(null!==n){if(e.callbackPriority===t)return;n!==Fa&&Ca(n)}15===t?(n=ys.bind(null,e),null===$a?($a=[n],Ua=Ta(Ia,Ya)):$a.push(n),n=Fa):14===t?n=Wa(99,ys.bind(null,e)):(n=function(e){switch(e){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(i(358,e))}}(t),n=Wa(n,bs.bind(null,e))),e.callbackPriority=t,e.callbackNode=n}}function bs(e){if(ls=-1,cs=ss=0,0!=(48&Il))throw Error(i(327));var t=e.callbackNode;if(Ms()&&e.callbackNode!==t)return null;var n=Bt(e,e===Pl?Ml:0);if(0===n)return null;var r=n,a=Il;Il|=16;var o=Ts();for(Pl===e&&Ml===r||(Wl(),_s(e,r));;)try{Ns();break}catch(s){xs(e,s)}if(no(),Ol.current=o,Il=a,null!==Rl?r=0:(Pl=null,Ml=0,r=Bl),0!=(Ul&jl))_s(e,0);else if(0!==r){if(2===r&&(Il|=64,e.hydrate&&(e.hydrate=!1,Wr(e.containerInfo)),0!==(n=$t(e))&&(r=Cs(e,n))),1===r)throw t=$l,_s(e,0),vs(e,n),gs(e,Ha()),t;switch(e.finishedWork=e.current.alternate,e.finishedLanes=n,r){case 0:case 1:throw Error(i(345));case 2:case 5:Is(e);break;case 3:if(vs(e,n),(62914560&n)===n&&10<(r=Gl+500-Ha())){if(0!==Bt(e,0))break;if(((a=e.suspendedLanes)&n)!==n){fs(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Gr(Is.bind(null,e),r);break}Is(e);break;case 4:if(vs(e,n),(4186112&n)===n)break;for(r=e.eventTimes,a=-1;0<n;){var l=31-Zt(n);o=1<<l,(l=r[l])>a&&(a=l),n&=~o}if(n=a,10<(n=(120>(n=Ha()-n)?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Nl(n/1960))-n)){e.timeoutHandle=Gr(Is.bind(null,e),n);break}Is(e);break;default:throw Error(i(329))}}return gs(e,Ha()),e.callbackNode===t?bs.bind(null,e):null}function vs(e,t){for(t&=~Hl,t&=~jl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Zt(t),r=1<<n;e[n]=-1,t&=~r}}function ys(e){if(0!=(48&Il))throw Error(i(327));if(Ms(),e===Pl&&0!=(e.expiredLanes&Ml)){var t=Ml,n=Cs(e,t);0!=(Ul&jl)&&(n=Cs(e,t=Bt(e,t)))}else n=Cs(e,t=Bt(e,0));if(0!==e.tag&&2===n&&(Il|=64,e.hydrate&&(e.hydrate=!1,Wr(e.containerInfo)),0!==(t=$t(e))&&(n=Cs(e,t))),1===n)throw n=$l,_s(e,0),vs(e,t),gs(e,Ha()),n;return e.finishedWork=e.current.alternate,e.finishedLanes=t,Is(e),gs(e,Ha()),null}function ws(e,t){var n=Il;Il|=1;try{return e(t)}finally{0===(Il=n)&&(Wl(),qa())}}function Es(e,t){var n=Il;Il&=-2,Il|=8;try{return e(t)}finally{0===(Il=n)&&(Wl(),qa())}}function ks(e,t){da(Fl,Dl),Dl|=t,Ul|=t}function Ss(){Dl=Fl.current,ua(Fl)}function _s(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,Vr(n)),null!==Rl)for(n=Rl.return;null!==n;){var r=n;switch(r.tag){case 1:null!=(r=r.type.childContextTypes)&&va();break;case 3:Mo(),ua(ma),ua(pa),Ko();break;case 5:Fo(r);break;case 4:Mo();break;case 13:case 19:ua(Bo);break;case 10:ro(r);break;case 23:case 24:Ss()}n=n.return}Pl=e,Rl=Vs(e.current,null),Ml=Dl=Ul=t,Bl=0,$l=null,Hl=jl=zl=0}function xs(e,t){for(;;){var n=Rl;try{if(no(),Xo.current=Ii,ri){for(var r=ei.memoizedState;null!==r;){var a=r.queue;null!==a&&(a.pending=null),r=r.next}ri=!1}if(Jo=0,ni=ti=ei=null,ai=!1,Ll.current=null,null===n||null===n.return){Bl=1,$l=t,Rl=null;break}e:{var o=e,i=n.return,l=n,s=t;if(t=Ml,l.flags|=2048,l.firstEffect=l.lastEffect=null,null!==s&&"object"==typeof s&&"function"==typeof s.then){var c=s;if(0==(2&l.mode)){var u=l.alternate;u?(l.updateQueue=u.updateQueue,l.memoizedState=u.memoizedState,l.lanes=u.lanes):(l.updateQueue=null,l.memoizedState=null)}var d=0!=(1&Bo.current),f=i;do{var p;if(p=13===f.tag){var m=f.memoizedState;if(null!==m)p=null!==m.dehydrated;else{var h=f.memoizedProps;p=void 0!==h.fallback&&(!0!==h.unstable_avoidThisFallback||!d)}}if(p){var g=f.updateQueue;if(null===g){var b=new Set;b.add(c),f.updateQueue=b}else g.add(c);if(0==(2&f.mode)){if(f.flags|=64,l.flags|=16384,l.flags&=-2981,1===l.tag)if(null===l.alternate)l.tag=17;else{var v=uo(-1,1);v.tag=2,fo(l,v)}l.lanes|=1;break e}s=void 0,l=t;var y=o.pingCache;if(null===y?(y=o.pingCache=new dl,s=new Set,y.set(c,s)):void 0===(s=y.get(c))&&(s=new Set,y.set(c,s)),!s.has(l)){s.add(l);var w=zs.bind(null,o,c,l);c.then(w,w)}f.flags|=4096,f.lanes=t;break e}f=f.return}while(null!==f);s=Error((W(l.type)||"A React component")+" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.")}5!==Bl&&(Bl=2),s=cl(s,l),f=i;do{switch(f.tag){case 3:o=s,f.flags|=4096,t&=-t,f.lanes|=t,po(f,fl(0,o,t));break e;case 1:o=s;var E=f.type,k=f.stateNode;if(0==(64&f.flags)&&("function"==typeof E.getDerivedStateFromError||null!==k&&"function"==typeof k.componentDidCatch&&(null===Ql||!Ql.has(k)))){f.flags|=4096,t&=-t,f.lanes|=t,po(f,pl(f,o,t));break e}}f=f.return}while(null!==f)}Ls(n)}catch(S){t=S,Rl===n&&null!==n&&(Rl=n=n.return);continue}break}}function Ts(){var e=Ol.current;return Ol.current=Ii,null===e?Ii:e}function Cs(e,t){var n=Il;Il|=16;var r=Ts();for(Pl===e&&Ml===t||_s(e,t);;)try{As();break}catch(a){xs(e,a)}if(no(),Il=n,Ol.current=r,null!==Rl)throw Error(i(261));return Pl=null,Ml=0,Bl}function As(){for(;null!==Rl;)Os(Rl)}function Ns(){for(;null!==Rl&&!Aa();)Os(Rl)}function Os(e){var t=ql(e.alternate,e,Dl);e.memoizedProps=e.pendingProps,null===t?Ls(e):Rl=t,Ll.current=null}function Ls(e){var t=e;do{var n=t.alternate;if(e=t.return,0==(2048&t.flags)){if(null!==(n=ll(n,t,Dl)))return void(Rl=n);if(24!==(n=t).tag&&23!==n.tag||null===n.memoizedState||0!=(1073741824&Dl)||0==(4&n.mode)){for(var r=0,a=n.child;null!==a;)r|=a.lanes|a.childLanes,a=a.sibling;n.childLanes=r}null!==e&&0==(2048&e.flags)&&(null===e.firstEffect&&(e.firstEffect=t.firstEffect),null!==t.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=t.firstEffect),e.lastEffect=t.lastEffect),1<t.flags&&(null!==e.lastEffect?e.lastEffect.nextEffect=t:e.firstEffect=t,e.lastEffect=t))}else{if(null!==(n=sl(t)))return n.flags&=2047,void(Rl=n);null!==e&&(e.firstEffect=e.lastEffect=null,e.flags|=2048)}if(null!==(t=t.sibling))return void(Rl=t);Rl=t=e}while(null!==t);0===Bl&&(Bl=5)}function Is(e){var t=Za();return Va(99,Ps.bind(null,e,t)),null}function Ps(e,t){do{Ms()}while(null!==es);if(0!=(48&Il))throw Error(i(327));var n=e.finishedWork;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(i(177));e.callbackNode=null;var r=n.lanes|n.childLanes,a=r,o=e.pendingLanes&~a;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=a,e.mutableReadLanes&=a,e.entangledLanes&=a,a=e.entanglements;for(var l=e.eventTimes,s=e.expirationTimes;0<o;){var c=31-Zt(o),u=1<<c;a[c]=0,l[c]=-1,s[c]=-1,o&=~u}if(null!==as&&0==(24&r)&&as.has(e)&&as.delete(e),e===Pl&&(Rl=Pl=null,Ml=0),1<n.flags?null!==n.lastEffect?(n.lastEffect.nextEffect=n,r=n.firstEffect):r=n:r=n.firstEffect,null!==r){if(a=Il,Il|=32,Ll.current=null,zr=Yt,br(l=gr())){if("selectionStart"in l)s={start:l.selectionStart,end:l.selectionEnd};else e:if(s=(s=l.ownerDocument)&&s.defaultView||window,(u=s.getSelection&&s.getSelection())&&0!==u.rangeCount){s=u.anchorNode,o=u.anchorOffset,c=u.focusNode,u=u.focusOffset;try{s.nodeType,c.nodeType}catch(T){s=null;break e}var d=0,f=-1,p=-1,m=0,h=0,g=l,b=null;t:for(;;){for(var v;g!==s||0!==o&&3!==g.nodeType||(f=d+o),g!==c||0!==u&&3!==g.nodeType||(p=d+u),3===g.nodeType&&(d+=g.nodeValue.length),null!==(v=g.firstChild);)b=g,g=v;for(;;){if(g===l)break t;if(b===s&&++m===o&&(f=d),b===c&&++h===u&&(p=d),null!==(v=g.nextSibling))break;b=(g=b).parentNode}g=v}s=-1===f||-1===p?null:{start:f,end:p}}else s=null;s=s||{start:0,end:0}}else s=null;jr={focusedElem:l,selectionRange:s},Yt=!1,us=null,ds=!1,Yl=r;do{try{Rs()}catch(T){if(null===Yl)throw Error(i(330));Us(Yl,T),Yl=Yl.nextEffect}}while(null!==Yl);us=null,Yl=r;do{try{for(l=e;null!==Yl;){var y=Yl.flags;if(16&y&&ve(Yl.stateNode,""),128&y){var w=Yl.alternate;if(null!==w){var E=w.ref;null!==E&&("function"==typeof E?E(null):E.current=null)}}switch(1038&y){case 2:kl(Yl),Yl.flags&=-3;break;case 6:kl(Yl),Yl.flags&=-3,Tl(Yl.alternate,Yl);break;case 1024:Yl.flags&=-1025;break;case 1028:Yl.flags&=-1025,Tl(Yl.alternate,Yl);break;case 4:Tl(Yl.alternate,Yl);break;case 8:xl(l,s=Yl);var k=s.alternate;wl(s),null!==k&&wl(k)}Yl=Yl.nextEffect}}catch(T){if(null===Yl)throw Error(i(330));Us(Yl,T),Yl=Yl.nextEffect}}while(null!==Yl);if(E=jr,w=gr(),y=E.focusedElem,l=E.selectionRange,w!==y&&y&&y.ownerDocument&&hr(y.ownerDocument.documentElement,y)){null!==l&&br(y)&&(w=l.start,void 0===(E=l.end)&&(E=w),"selectionStart"in y?(y.selectionStart=w,y.selectionEnd=Math.min(E,y.value.length)):(E=(w=y.ownerDocument||document)&&w.defaultView||window).getSelection&&(E=E.getSelection(),s=y.textContent.length,k=Math.min(l.start,s),l=void 0===l.end?k:Math.min(l.end,s),!E.extend&&k>l&&(s=l,l=k,k=s),s=mr(y,k),o=mr(y,l),s&&o&&(1!==E.rangeCount||E.anchorNode!==s.node||E.anchorOffset!==s.offset||E.focusNode!==o.node||E.focusOffset!==o.offset)&&((w=w.createRange()).setStart(s.node,s.offset),E.removeAllRanges(),k>l?(E.addRange(w),E.extend(o.node,o.offset)):(w.setEnd(o.node,o.offset),E.addRange(w))))),w=[];for(E=y;E=E.parentNode;)1===E.nodeType&&w.push({element:E,left:E.scrollLeft,top:E.scrollTop});for("function"==typeof y.focus&&y.focus(),y=0;y<w.length;y++)(E=w[y]).element.scrollLeft=E.left,E.element.scrollTop=E.top}Yt=!!zr,jr=zr=null,e.current=n,Yl=r;do{try{for(y=e;null!==Yl;){var S=Yl.flags;if(36&S&&bl(y,Yl.alternate,Yl),128&S){w=void 0;var _=Yl.ref;if(null!==_){var x=Yl.stateNode;Yl.tag,w=x,"function"==typeof _?_(w):_.current=w}}Yl=Yl.nextEffect}}catch(T){if(null===Yl)throw Error(i(330));Us(Yl,T),Yl=Yl.nextEffect}}while(null!==Yl);Yl=null,Ba(),Il=a}else e.current=n;if(Jl)Jl=!1,es=e,ts=t;else for(Yl=r;null!==Yl;)t=Yl.nextEffect,Yl.nextEffect=null,8&Yl.flags&&((S=Yl).sibling=null,S.stateNode=null),Yl=t;if(0===(r=e.pendingLanes)&&(Ql=null),1===r?e===is?os++:(os=0,is=e):os=0,n=n.stateNode,_a&&"function"==typeof _a.onCommitFiberRoot)try{_a.onCommitFiberRoot(Sa,n,void 0,64==(64&n.current.flags))}catch(T){}if(gs(e,Ha()),Kl)throw Kl=!1,e=Xl,Xl=null,e;return 0!=(8&Il)||qa(),null}function Rs(){for(;null!==Yl;){var e=Yl.alternate;ds||null===us||(0!=(8&Yl.flags)?et(Yl,us)&&(ds=!0):13===Yl.tag&&Al(e,Yl)&&et(Yl,us)&&(ds=!0));var t=Yl.flags;0!=(256&t)&&gl(e,Yl),0==(512&t)||Jl||(Jl=!0,Wa(97,(function(){return Ms(),null}))),Yl=Yl.nextEffect}}function Ms(){if(90!==ts){var e=97<ts?97:ts;return ts=90,Va(e,Bs)}return!1}function Ds(e,t){ns.push(t,e),Jl||(Jl=!0,Wa(97,(function(){return Ms(),null})))}function Fs(e,t){rs.push(t,e),Jl||(Jl=!0,Wa(97,(function(){return Ms(),null})))}function Bs(){if(null===es)return!1;var e=es;if(es=null,0!=(48&Il))throw Error(i(331));var t=Il;Il|=32;var n=rs;rs=[];for(var r=0;r<n.length;r+=2){var a=n[r],o=n[r+1],l=a.destroy;if(a.destroy=void 0,"function"==typeof l)try{l()}catch(c){if(null===o)throw Error(i(330));Us(o,c)}}for(n=ns,ns=[],r=0;r<n.length;r+=2){a=n[r],o=n[r+1];try{var s=a.create;a.destroy=s()}catch(c){if(null===o)throw Error(i(330));Us(o,c)}}for(s=e.current.firstEffect;null!==s;)e=s.nextEffect,s.nextEffect=null,8&s.flags&&(s.sibling=null,s.stateNode=null),s=e;return Il=t,qa(),!0}function $s(e,t,n){fo(e,t=fl(0,t=cl(n,t),1)),t=fs(),null!==(e=hs(e,1))&&(Ht(e,1,t),gs(e,t))}function Us(e,t){if(3===e.tag)$s(e,e,t);else for(var n=e.return;null!==n;){if(3===n.tag){$s(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Ql||!Ql.has(r))){var a=pl(n,e=cl(t,e),1);if(fo(n,a),a=fs(),null!==(n=hs(n,1)))Ht(n,1,a),gs(n,a);else if("function"==typeof r.componentDidCatch&&(null===Ql||!Ql.has(r)))try{r.componentDidCatch(t,e)}catch(o){}break}}n=n.return}}function zs(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=fs(),e.pingedLanes|=e.suspendedLanes&n,Pl===e&&(Ml&n)===n&&(4===Bl||3===Bl&&(62914560&Ml)===Ml&&500>Ha()-Gl?_s(e,0):Hl|=n),gs(e,t)}function js(e,t){var n=e.stateNode;null!==n&&n.delete(t),0===(t=0)&&(0==(2&(t=e.mode))?t=1:0==(4&t)?t=99===Za()?1:2:(0===ss&&(ss=Ul),0===(t=zt(62914560&~ss))&&(t=4194304))),n=fs(),null!==(e=hs(e,t))&&(Ht(e,t,n),gs(e,n))}function Hs(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.flags=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childLanes=this.lanes=0,this.alternate=null}function Zs(e,t,n,r){return new Hs(e,t,n,r)}function Gs(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Vs(e,t){var n=e.alternate;return null===n?((n=Zs(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.nextEffect=null,n.firstEffect=null,n.lastEffect=null),n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ws(e,t,n,r,a,o){var l=2;if(r=e,"function"==typeof e)Gs(e)&&(l=1);else if("string"==typeof e)l=5;else e:switch(e){case _:return qs(n.children,a,o,t);case D:l=8,a|=16;break;case x:l=8,a|=1;break;case T:return(e=Zs(12,n,t,8|a)).elementType=T,e.type=T,e.lanes=o,e;case O:return(e=Zs(13,n,t,a)).type=O,e.elementType=O,e.lanes=o,e;case L:return(e=Zs(19,n,t,a)).elementType=L,e.lanes=o,e;case F:return Ys(n,a,o,t);case B:return(e=Zs(24,n,t,a)).elementType=B,e.lanes=o,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case C:l=10;break e;case A:l=9;break e;case N:l=11;break e;case I:l=14;break e;case P:l=16,r=null;break e;case R:l=22;break e}throw Error(i(130,null==e?e:typeof e,""))}return(t=Zs(l,n,t,a)).elementType=e,t.type=r,t.lanes=o,t}function qs(e,t,n,r){return(e=Zs(7,e,r,t)).lanes=n,e}function Ys(e,t,n,r){return(e=Zs(23,e,r,t)).elementType=F,e.lanes=n,e}function Ks(e,t,n){return(e=Zs(6,e,null,t)).lanes=n,e}function Xs(e,t,n){return(t=Zs(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Qs(e,t,n){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=n,this.callbackNode=null,this.callbackPriority=0,this.eventTimes=jt(0),this.expirationTimes=jt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jt(0),this.mutableSourceEagerHydrationData=null}function Js(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:S,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}function ec(e,t,n,r){var a=t.current,o=fs(),l=ps(a);e:if(n){t:{if(Ke(n=n._reactInternals)!==n||1!==n.tag)throw Error(i(170));var s=n;do{switch(s.tag){case 3:s=s.stateNode.context;break t;case 1:if(ba(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break t}}s=s.return}while(null!==s);throw Error(i(171))}if(1===n.tag){var c=n.type;if(ba(c)){n=wa(n,c,s);break e}}n=s}else n=fa;return null===t.context?t.context=n:t.pendingContext=n,(t=uo(o,l)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),fo(a,t),ms(a,l,o),l}function tc(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function nc(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function rc(e,t){nc(e,t),(e=e.alternate)&&nc(e,t)}function ac(e,t,n){var r=null!=n&&null!=n.hydrationOptions&&n.hydrationOptions.mutableSources||null;if(n=new Qs(e,t,null!=n&&!0===n.hydrate),t=Zs(3,null,null,2===t?7:1===t?3:0),n.current=t,t.stateNode=n,so(t),e[ea]=n.current,Ir(8===e.nodeType?e.parentNode:e),r)for(e=0;e<r.length;e++){var a=(t=r[e])._getVersion;a=a(t._source),null==n.mutableSourceEagerHydrationData?n.mutableSourceEagerHydrationData=[t,a]:n.mutableSourceEagerHydrationData.push(t,a)}this._internalRoot=n}function oc(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function ic(e,t,n,r,a){var o=n._reactRootContainer;if(o){var i=o._internalRoot;if("function"==typeof a){var l=a;a=function(){var e=tc(i);l.call(e)}}ec(t,i,e,a)}else{if(o=n._reactRootContainer=function(e,t){if(t||(t=!(!(t=e?9===e.nodeType?e.documentElement:e.firstChild:null)||1!==t.nodeType||!t.hasAttribute("data-reactroot"))),!t)for(var n;n=e.lastChild;)e.removeChild(n);return new ac(e,0,t?{hydrate:!0}:void 0)}(n,r),i=o._internalRoot,"function"==typeof a){var s=a;a=function(){var e=tc(i);s.call(e)}}Es((function(){ec(t,i,e,a)}))}return tc(i)}function lc(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!oc(t))throw Error(i(200));return Js(e,t,null,n)}ql=function(e,t,n){var r=t.lanes;if(null!==e)if(e.memoizedProps!==t.pendingProps||ma.current)Fi=!0;else{if(0==(n&r)){switch(Fi=!1,t.tag){case 3:Wi(t),qo();break;case 5:Do(t);break;case 1:ba(t.type)&&Ea(t);break;case 4:Ro(t,t.stateNode.containerInfo);break;case 10:r=t.memoizedProps.value;var a=t.type._context;da(Qa,a._currentValue),a._currentValue=r;break;case 13:if(null!==t.memoizedState)return 0!=(n&t.child.childLanes)?Qi(e,t,n):(da(Bo,1&Bo.current),null!==(t=ol(e,t,n))?t.sibling:null);da(Bo,1&Bo.current);break;case 19:if(r=0!=(n&t.childLanes),0!=(64&e.flags)){if(r)return al(e,t,n);t.flags|=64}if(null!==(a=t.memoizedState)&&(a.rendering=null,a.tail=null,a.lastEffect=null),da(Bo,Bo.current),r)break;return null;case 23:case 24:return t.lanes=0,ji(e,t,n)}return ol(e,t,n)}Fi=0!=(16384&e.flags)}else Fi=!1;switch(t.lanes=0,t.tag){case 2:if(r=t.type,null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,a=ga(t,pa.current),oo(t,n),a=li(null,t,r,e,a,n),t.flags|=1,"object"==typeof a&&null!==a&&"function"==typeof a.render&&void 0===a.$$typeof){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,ba(r)){var o=!0;Ea(t)}else o=!1;t.memoizedState=null!==a.state&&void 0!==a.state?a.state:null,so(t);var l=r.getDerivedStateFromProps;"function"==typeof l&&bo(t,r,l,e),a.updater=vo,t.stateNode=a,a._reactInternals=t,ko(t,r,e,n),t=Vi(null,t,r,!0,o,n)}else t.tag=0,Bi(null,t,a,n),t=t.child;return t;case 16:a=t.elementType;e:{switch(null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,a=(o=a._init)(a._payload),t.type=a,o=t.tag=function(e){if("function"==typeof e)return Gs(e)?1:0;if(null!=e){if((e=e.$$typeof)===N)return 11;if(e===I)return 14}return 2}(a),e=Xa(a,e),o){case 0:t=Zi(null,t,a,e,n);break e;case 1:t=Gi(null,t,a,e,n);break e;case 11:t=$i(null,t,a,e,n);break e;case 14:t=Ui(null,t,a,Xa(a.type,e),r,n);break e}throw Error(i(306,a,""))}return t;case 0:return r=t.type,a=t.pendingProps,Zi(e,t,r,a=t.elementType===r?a:Xa(r,a),n);case 1:return r=t.type,a=t.pendingProps,Gi(e,t,r,a=t.elementType===r?a:Xa(r,a),n);case 3:if(Wi(t),r=t.updateQueue,null===e||null===r)throw Error(i(282));if(r=t.pendingProps,a=null!==(a=t.memoizedState)?a.element:null,co(e,t),mo(t,r,null,n),(r=t.memoizedState.element)===a)qo(),t=ol(e,t,n);else{if((o=(a=t.stateNode).hydrate)&&(zo=qr(t.stateNode.containerInfo.firstChild),Uo=t,o=jo=!0),o){if(null!=(e=a.mutableSourceEagerHydrationData))for(a=0;a<e.length;a+=2)(o=e[a])._workInProgressVersionPrimary=e[a+1],Yo.push(o);for(n=Ao(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|1024,n=n.sibling}else Bi(e,t,r,n),qo();t=t.child}return t;case 5:return Do(t),null===e&&Go(t),r=t.type,a=t.pendingProps,o=null!==e?e.memoizedProps:null,l=a.children,Zr(r,a)?l=null:null!==o&&Zr(r,o)&&(t.flags|=16),Hi(e,t),Bi(e,t,l,n),t.child;case 6:return null===e&&Go(t),null;case 13:return Qi(e,t,n);case 4:return Ro(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=Co(t,null,r,n):Bi(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,$i(e,t,r,a=t.elementType===r?a:Xa(r,a),n);case 7:return Bi(e,t,t.pendingProps,n),t.child;case 8:case 12:return Bi(e,t,t.pendingProps.children,n),t.child;case 10:e:{r=t.type._context,a=t.pendingProps,l=t.memoizedProps,o=a.value;var s=t.type._context;if(da(Qa,s._currentValue),s._currentValue=o,null!==l)if(s=l.value,0===(o=ur(s,o)?0:0|("function"==typeof r._calculateChangedBits?r._calculateChangedBits(s,o):1073741823))){if(l.children===a.children&&!ma.current){t=ol(e,t,n);break e}}else for(null!==(s=t.child)&&(s.return=t);null!==s;){var c=s.dependencies;if(null!==c){l=s.child;for(var u=c.firstContext;null!==u;){if(u.context===r&&0!=(u.observedBits&o)){1===s.tag&&((u=uo(-1,n&-n)).tag=2,fo(s,u)),s.lanes|=n,null!==(u=s.alternate)&&(u.lanes|=n),ao(s.return,n),c.lanes|=n;break}u=u.next}}else l=10===s.tag&&s.type===t.type?null:s.child;if(null!==l)l.return=s;else for(l=s;null!==l;){if(l===t){l=null;break}if(null!==(s=l.sibling)){s.return=l.return,l=s;break}l=l.return}s=l}Bi(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=(o=t.pendingProps).children,oo(t,n),r=r(a=io(a,o.unstable_observedBits)),t.flags|=1,Bi(e,t,r,n),t.child;case 14:return o=Xa(a=t.type,t.pendingProps),Ui(e,t,a,o=Xa(a.type,o),r,n);case 15:return zi(e,t,t.type,t.pendingProps,r,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Xa(r,a),null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),t.tag=1,ba(r)?(e=!0,Ea(t)):e=!1,oo(t,n),wo(t,r,a),ko(t,r,a,n),Vi(null,t,r,!0,e,n);case 19:return al(e,t,n);case 23:case 24:return ji(e,t,n)}throw Error(i(156,t.tag))},ac.prototype.render=function(e){ec(e,this._internalRoot,null,null)},ac.prototype.unmount=function(){var e=this._internalRoot,t=e.containerInfo;ec(null,e,null,(function(){t[ea]=null}))},tt=function(e){13===e.tag&&(ms(e,4,fs()),rc(e,4))},nt=function(e){13===e.tag&&(ms(e,67108864,fs()),rc(e,67108864))},rt=function(e){if(13===e.tag){var t=fs(),n=ps(e);ms(e,n,t),rc(e,n)}},at=function(e,t){return t()},Ce=function(e,t,n){switch(t){case"input":if(ne(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=oa(r);if(!a)throw Error(i(90));X(r),ne(r,a)}}}break;case"textarea":ce(e,n);break;case"select":null!=(t=n.value)&&ie(e,!!n.multiple,t,!1)}},Pe=ws,Re=function(e,t,n,r,a){var o=Il;Il|=4;try{return Va(98,e.bind(null,t,n,r,a))}finally{0===(Il=o)&&(Wl(),qa())}},Me=function(){0==(49&Il)&&(function(){if(null!==as){var e=as;as=null,e.forEach((function(e){e.expiredLanes|=24&e.pendingLanes,gs(e,Ha())}))}qa()}(),Ms())},De=function(e,t){var n=Il;Il|=2;try{return e(t)}finally{0===(Il=n)&&(Wl(),qa())}};var sc={Events:[ra,aa,oa,Le,Ie,Ms,{current:!1}]},cc={findFiberByHostInstance:na,bundleType:0,version:"17.0.2",rendererPackageName:"react-dom"},uc={bundleType:cc.bundleType,version:cc.version,rendererPackageName:cc.rendererPackageName,rendererConfig:cc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:E.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=Je(e))?null:e.stateNode},findFiberByHostInstance:cc.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var dc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!dc.isDisabled&&dc.supportsFiber)try{Sa=dc.inject(uc),_a=dc}catch(ge){}}t.createPortal=lc,t.hydrate=function(e,t,n){if(!oc(t))throw Error(i(200));return ic(null,e,t,!0,n)}},3935:(e,t,n)=>{"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=n(4448)},9590:e=>{var t="undefined"!=typeof Element,n="function"==typeof Map,r="function"==typeof Set,a="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function o(e,i){if(e===i)return!0;if(e&&i&&"object"==typeof e&&"object"==typeof i){if(e.constructor!==i.constructor)return!1;var l,s,c,u;if(Array.isArray(e)){if((l=e.length)!=i.length)return!1;for(s=l;0!=s--;)if(!o(e[s],i[s]))return!1;return!0}if(n&&e instanceof Map&&i instanceof Map){if(e.size!==i.size)return!1;for(u=e.entries();!(s=u.next()).done;)if(!i.has(s.value[0]))return!1;for(u=e.entries();!(s=u.next()).done;)if(!o(s.value[1],i.get(s.value[0])))return!1;return!0}if(r&&e instanceof Set&&i instanceof Set){if(e.size!==i.size)return!1;for(u=e.entries();!(s=u.next()).done;)if(!i.has(s.value[0]))return!1;return!0}if(a&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(i)){if((l=e.length)!=i.length)return!1;for(s=l;0!=s--;)if(e[s]!==i[s])return!1;return!0}if(e.constructor===RegExp)return e.source===i.source&&e.flags===i.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===i.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===i.toString();if((l=(c=Object.keys(e)).length)!==Object.keys(i).length)return!1;for(s=l;0!=s--;)if(!Object.prototype.hasOwnProperty.call(i,c[s]))return!1;if(t&&e instanceof Element)return!1;for(s=l;0!=s--;)if(("_owner"!==c[s]&&"__v"!==c[s]&&"__o"!==c[s]||!e.$$typeof)&&!o(e[c[s]],i[c[s]]))return!1;return!0}return e!=e&&i!=i}e.exports=function(e,t){try{return o(e,t)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}}},405:(e,t,n)=>{"use strict";n.d(t,{B6:()=>G,ql:()=>J});var r=n(7294),a=n(5697),o=n.n(a),i=n(9590),l=n.n(i),s=n(1143),c=n.n(s),u=n(6774),d=n.n(u);function f(){return f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f.apply(this,arguments)}function p(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,m(e,t)}function m(e,t){return m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},m(e,t)}function h(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(a[n]=e[n]);return a}var g={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},b={rel:["amphtml","canonical","alternate"]},v={type:["application/ld+json"]},y={charset:"",name:["robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},w=Object.keys(g).map((function(e){return g[e]})),E={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},k=Object.keys(E).reduce((function(e,t){return e[E[t]]=t,e}),{}),S=function(e,t){for(var n=e.length-1;n>=0;n-=1){var r=e[n];if(Object.prototype.hasOwnProperty.call(r,t))return r[t]}return null},_=function(e){var t=S(e,g.TITLE),n=S(e,"titleTemplate");if(Array.isArray(t)&&(t=t.join("")),n&&t)return n.replace(/%s/g,(function(){return t}));var r=S(e,"defaultTitle");return t||r||void 0},x=function(e){return S(e,"onChangeClientState")||function(){}},T=function(e,t){return t.filter((function(t){return void 0!==t[e]})).map((function(t){return t[e]})).reduce((function(e,t){return f({},e,t)}),{})},C=function(e,t){return t.filter((function(e){return void 0!==e[g.BASE]})).map((function(e){return e[g.BASE]})).reverse().reduce((function(t,n){if(!t.length)for(var r=Object.keys(n),a=0;a<r.length;a+=1){var o=r[a].toLowerCase();if(-1!==e.indexOf(o)&&n[o])return t.concat(n)}return t}),[])},A=function(e,t,n){var r={};return n.filter((function(t){return!!Array.isArray(t[e])||(void 0!==t[e]&&console&&"function"==typeof console.warn&&console.warn("Helmet: "+e+' should be of type "Array". Instead found type "'+typeof t[e]+'"'),!1)})).map((function(t){return t[e]})).reverse().reduce((function(e,n){var a={};n.filter((function(e){for(var n,o=Object.keys(e),i=0;i<o.length;i+=1){var l=o[i],s=l.toLowerCase();-1===t.indexOf(s)||"rel"===n&&"canonical"===e[n].toLowerCase()||"rel"===s&&"stylesheet"===e[s].toLowerCase()||(n=s),-1===t.indexOf(l)||"innerHTML"!==l&&"cssText"!==l&&"itemprop"!==l||(n=l)}if(!n||!e[n])return!1;var c=e[n].toLowerCase();return r[n]||(r[n]={}),a[n]||(a[n]={}),!r[n][c]&&(a[n][c]=!0,!0)})).reverse().forEach((function(t){return e.push(t)}));for(var o=Object.keys(a),i=0;i<o.length;i+=1){var l=o[i],s=f({},r[l],a[l]);r[l]=s}return e}),[]).reverse()},N=function(e,t){if(Array.isArray(e)&&e.length)for(var n=0;n<e.length;n+=1)if(e[n][t])return!0;return!1},O=function(e){return Array.isArray(e)?e.join(""):e},L=function(e,t){return Array.isArray(e)?e.reduce((function(e,n){return function(e,t){for(var n=Object.keys(e),r=0;r<n.length;r+=1)if(t[n[r]]&&t[n[r]].includes(e[n[r]]))return!0;return!1}(n,t)?e.priority.push(n):e.default.push(n),e}),{priority:[],default:[]}):{default:e}},I=function(e,t){var n;return f({},e,((n={})[t]=void 0,n))},P=[g.NOSCRIPT,g.SCRIPT,g.STYLE],R=function(e,t){return void 0===t&&(t=!0),!1===t?String(e):String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},M=function(e){return Object.keys(e).reduce((function(t,n){var r=void 0!==e[n]?n+'="'+e[n]+'"':""+n;return t?t+" "+r:r}),"")},D=function(e,t){return void 0===t&&(t={}),Object.keys(e).reduce((function(t,n){return t[E[n]||n]=e[n],t}),t)},F=function(e,t){return t.map((function(t,n){var a,o=((a={key:n})["data-rh"]=!0,a);return Object.keys(t).forEach((function(e){var n=E[e]||e;"innerHTML"===n||"cssText"===n?o.dangerouslySetInnerHTML={__html:t.innerHTML||t.cssText}:o[n]=t[e]})),r.createElement(e,o)}))},B=function(e,t,n){switch(e){case g.TITLE:return{toComponent:function(){return n=t.titleAttributes,(a={key:e=t.title})["data-rh"]=!0,o=D(n,a),[r.createElement(g.TITLE,o,e)];var e,n,a,o},toString:function(){return function(e,t,n,r){var a=M(n),o=O(t);return a?"<"+e+' data-rh="true" '+a+">"+R(o,r)+"</"+e+">":"<"+e+' data-rh="true">'+R(o,r)+"</"+e+">"}(e,t.title,t.titleAttributes,n)}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function(){return D(t)},toString:function(){return M(t)}};default:return{toComponent:function(){return F(e,t)},toString:function(){return function(e,t,n){return t.reduce((function(t,r){var a=Object.keys(r).filter((function(e){return!("innerHTML"===e||"cssText"===e)})).reduce((function(e,t){var a=void 0===r[t]?t:t+'="'+R(r[t],n)+'"';return e?e+" "+a:a}),""),o=r.innerHTML||r.cssText||"",i=-1===P.indexOf(e);return t+"<"+e+' data-rh="true" '+a+(i?"/>":">"+o+"</"+e+">")}),"")}(e,t,n)}}}},$=function(e){var t=e.baseTag,n=e.bodyAttributes,r=e.encode,a=e.htmlAttributes,o=e.noscriptTags,i=e.styleTags,l=e.title,s=void 0===l?"":l,c=e.titleAttributes,u=e.linkTags,d=e.metaTags,f=e.scriptTags,p={toComponent:function(){},toString:function(){return""}};if(e.prioritizeSeoTags){var m=function(e){var t=e.linkTags,n=e.scriptTags,r=e.encode,a=L(e.metaTags,y),o=L(t,b),i=L(n,v);return{priorityMethods:{toComponent:function(){return[].concat(F(g.META,a.priority),F(g.LINK,o.priority),F(g.SCRIPT,i.priority))},toString:function(){return B(g.META,a.priority,r)+" "+B(g.LINK,o.priority,r)+" "+B(g.SCRIPT,i.priority,r)}},metaTags:a.default,linkTags:o.default,scriptTags:i.default}}(e);p=m.priorityMethods,u=m.linkTags,d=m.metaTags,f=m.scriptTags}return{priority:p,base:B(g.BASE,t,r),bodyAttributes:B("bodyAttributes",n,r),htmlAttributes:B("htmlAttributes",a,r),link:B(g.LINK,u,r),meta:B(g.META,d,r),noscript:B(g.NOSCRIPT,o,r),script:B(g.SCRIPT,f,r),style:B(g.STYLE,i,r),title:B(g.TITLE,{title:s,titleAttributes:c},r)}},U=[],z=function(e,t){var n=this;void 0===t&&(t="undefined"!=typeof document),this.instances=[],this.value={setHelmet:function(e){n.context.helmet=e},helmetInstances:{get:function(){return n.canUseDOM?U:n.instances},add:function(e){(n.canUseDOM?U:n.instances).push(e)},remove:function(e){var t=(n.canUseDOM?U:n.instances).indexOf(e);(n.canUseDOM?U:n.instances).splice(t,1)}}},this.context=e,this.canUseDOM=t,t||(e.helmet=$({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))},j=r.createContext({}),H=o().shape({setHelmet:o().func,helmetInstances:o().shape({get:o().func,add:o().func,remove:o().func})}),Z="undefined"!=typeof document,G=function(e){function t(n){var r;return(r=e.call(this,n)||this).helmetData=new z(r.props.context,t.canUseDOM),r}return p(t,e),t.prototype.render=function(){return r.createElement(j.Provider,{value:this.helmetData.value},this.props.children)},t}(r.Component);G.canUseDOM=Z,G.propTypes={context:o().shape({helmet:o().shape()}),children:o().node.isRequired},G.defaultProps={context:{}},G.displayName="HelmetProvider";var V=function(e,t){var n,r=document.head||document.querySelector(g.HEAD),a=r.querySelectorAll(e+"[data-rh]"),o=[].slice.call(a),i=[];return t&&t.length&&t.forEach((function(t){var r=document.createElement(e);for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&("innerHTML"===a?r.innerHTML=t.innerHTML:"cssText"===a?r.styleSheet?r.styleSheet.cssText=t.cssText:r.appendChild(document.createTextNode(t.cssText)):r.setAttribute(a,void 0===t[a]?"":t[a]));r.setAttribute("data-rh","true"),o.some((function(e,t){return n=t,r.isEqualNode(e)}))?o.splice(n,1):i.push(r)})),o.forEach((function(e){return e.parentNode.removeChild(e)})),i.forEach((function(e){return r.appendChild(e)})),{oldTags:o,newTags:i}},W=function(e,t){var n=document.getElementsByTagName(e)[0];if(n){for(var r=n.getAttribute("data-rh"),a=r?r.split(","):[],o=[].concat(a),i=Object.keys(t),l=0;l<i.length;l+=1){var s=i[l],c=t[s]||"";n.getAttribute(s)!==c&&n.setAttribute(s,c),-1===a.indexOf(s)&&a.push(s);var u=o.indexOf(s);-1!==u&&o.splice(u,1)}for(var d=o.length-1;d>=0;d-=1)n.removeAttribute(o[d]);a.length===o.length?n.removeAttribute("data-rh"):n.getAttribute("data-rh")!==i.join(",")&&n.setAttribute("data-rh",i.join(","))}},q=function(e,t){var n=e.baseTag,r=e.htmlAttributes,a=e.linkTags,o=e.metaTags,i=e.noscriptTags,l=e.onChangeClientState,s=e.scriptTags,c=e.styleTags,u=e.title,d=e.titleAttributes;W(g.BODY,e.bodyAttributes),W(g.HTML,r),function(e,t){void 0!==e&&document.title!==e&&(document.title=O(e)),W(g.TITLE,t)}(u,d);var f={baseTag:V(g.BASE,n),linkTags:V(g.LINK,a),metaTags:V(g.META,o),noscriptTags:V(g.NOSCRIPT,i),scriptTags:V(g.SCRIPT,s),styleTags:V(g.STYLE,c)},p={},m={};Object.keys(f).forEach((function(e){var t=f[e],n=t.newTags,r=t.oldTags;n.length&&(p[e]=n),r.length&&(m[e]=f[e].oldTags)})),t&&t(),l(e,p,m)},Y=null,K=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return(t=e.call.apply(e,[this].concat(r))||this).rendered=!1,t}p(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return!d()(e,this.props)},n.componentDidUpdate=function(){this.emitChange()},n.componentWillUnmount=function(){this.props.context.helmetInstances.remove(this),this.emitChange()},n.emitChange=function(){var e,t,n=this.props.context,r=n.setHelmet,a=null,o=(e=n.helmetInstances.get().map((function(e){var t=f({},e.props);return delete t.context,t})),{baseTag:C(["href"],e),bodyAttributes:T("bodyAttributes",e),defer:S(e,"defer"),encode:S(e,"encodeSpecialCharacters"),htmlAttributes:T("htmlAttributes",e),linkTags:A(g.LINK,["rel","href"],e),metaTags:A(g.META,["name","charset","http-equiv","property","itemprop"],e),noscriptTags:A(g.NOSCRIPT,["innerHTML"],e),onChangeClientState:x(e),scriptTags:A(g.SCRIPT,["src","innerHTML"],e),styleTags:A(g.STYLE,["cssText"],e),title:_(e),titleAttributes:T("titleAttributes",e),prioritizeSeoTags:N(e,"prioritizeSeoTags")});G.canUseDOM?(t=o,Y&&cancelAnimationFrame(Y),t.defer?Y=requestAnimationFrame((function(){q(t,(function(){Y=null}))})):(q(t),Y=null)):$&&(a=$(o)),r(a)},n.init=function(){this.rendered||(this.rendered=!0,this.props.context.helmetInstances.add(this),this.emitChange())},n.render=function(){return this.init(),null},t}(r.Component);K.propTypes={context:H.isRequired},K.displayName="HelmetDispatcher";var X=["children"],Q=["children"],J=function(e){function t(){return e.apply(this,arguments)||this}p(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return!l()(I(this.props,"helmetData"),I(e,"helmetData"))},n.mapNestedChildrenToProps=function(e,t){if(!t)return null;switch(e.type){case g.SCRIPT:case g.NOSCRIPT:return{innerHTML:t};case g.STYLE:return{cssText:t};default:throw new Error("<"+e.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")}},n.flattenArrayTypeChildren=function(e){var t,n=e.child,r=e.arrayTypeChildren;return f({},r,((t={})[n.type]=[].concat(r[n.type]||[],[f({},e.newChildProps,this.mapNestedChildrenToProps(n,e.nestedChildren))]),t))},n.mapObjectTypeChildren=function(e){var t,n,r=e.child,a=e.newProps,o=e.newChildProps,i=e.nestedChildren;switch(r.type){case g.TITLE:return f({},a,((t={})[r.type]=i,t.titleAttributes=f({},o),t));case g.BODY:return f({},a,{bodyAttributes:f({},o)});case g.HTML:return f({},a,{htmlAttributes:f({},o)});default:return f({},a,((n={})[r.type]=f({},o),n))}},n.mapArrayTypeChildrenToProps=function(e,t){var n=f({},t);return Object.keys(e).forEach((function(t){var r;n=f({},n,((r={})[t]=e[t],r))})),n},n.warnOnInvalidChildren=function(e,t){return c()(w.some((function(t){return e.type===t})),"function"==typeof e.type?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+w.join(", ")+" are allowed. Helmet does not support rendering <"+e.type+"> elements. Refer to our API for more information."),c()(!t||"string"==typeof t||Array.isArray(t)&&!t.some((function(e){return"string"!=typeof e})),"Helmet expects a string as a child of <"+e.type+">. Did you forget to wrap your children in braces? ( <"+e.type+">{``}</"+e.type+"> ) Refer to our API for more information."),!0},n.mapChildrenToProps=function(e,t){var n=this,a={};return r.Children.forEach(e,(function(e){if(e&&e.props){var r=e.props,o=r.children,i=h(r,X),l=Object.keys(i).reduce((function(e,t){return e[k[t]||t]=i[t],e}),{}),s=e.type;switch("symbol"==typeof s?s=s.toString():n.warnOnInvalidChildren(e,o),s){case g.FRAGMENT:t=n.mapChildrenToProps(o,t);break;case g.LINK:case g.META:case g.NOSCRIPT:case g.SCRIPT:case g.STYLE:a=n.flattenArrayTypeChildren({child:e,arrayTypeChildren:a,newChildProps:l,nestedChildren:o});break;default:t=n.mapObjectTypeChildren({child:e,newProps:t,newChildProps:l,nestedChildren:o})}}})),this.mapArrayTypeChildrenToProps(a,t)},n.render=function(){var e=this.props,t=e.children,n=h(e,Q),a=f({},n),o=n.helmetData;return t&&(a=this.mapChildrenToProps(t,a)),!o||o instanceof z||(o=new z(o.context,o.instances)),o?r.createElement(K,f({},a,{context:o.value,helmetData:void 0})):r.createElement(j.Consumer,null,(function(e){return r.createElement(K,f({},a,{context:e}))}))},t}(r.Component);J.propTypes={base:o().object,bodyAttributes:o().object,children:o().oneOfType([o().arrayOf(o().node),o().node]),defaultTitle:o().string,defer:o().bool,encodeSpecialCharacters:o().bool,htmlAttributes:o().object,link:o().arrayOf(o().object),meta:o().arrayOf(o().object),noscript:o().arrayOf(o().object),onChangeClientState:o().func,script:o().arrayOf(o().object),style:o().arrayOf(o().object),title:o().string,titleAttributes:o().object,titleTemplate:o().string,prioritizeSeoTags:o().bool,helmetData:o().object},J.defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1},J.displayName="Helmet"},9921:(e,t)=>{"use strict";var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,a=n?Symbol.for("react.portal"):60106,o=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,s=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,d=n?Symbol.for("react.concurrent_mode"):60111,f=n?Symbol.for("react.forward_ref"):60112,p=n?Symbol.for("react.suspense"):60113,m=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,g=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,y=n?Symbol.for("react.responder"):60118,w=n?Symbol.for("react.scope"):60119;function E(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case d:case o:case l:case i:case p:return e;default:switch(e=e&&e.$$typeof){case c:case f:case g:case h:case s:return e;default:return t}}case a:return t}}}function k(e){return E(e)===d}t.AsyncMode=u,t.ConcurrentMode=d,t.ContextConsumer=c,t.ContextProvider=s,t.Element=r,t.ForwardRef=f,t.Fragment=o,t.Lazy=g,t.Memo=h,t.Portal=a,t.Profiler=l,t.StrictMode=i,t.Suspense=p,t.isAsyncMode=function(e){return k(e)||E(e)===u},t.isConcurrentMode=k,t.isContextConsumer=function(e){return E(e)===c},t.isContextProvider=function(e){return E(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return E(e)===f},t.isFragment=function(e){return E(e)===o},t.isLazy=function(e){return E(e)===g},t.isMemo=function(e){return E(e)===h},t.isPortal=function(e){return E(e)===a},t.isProfiler=function(e){return E(e)===l},t.isStrictMode=function(e){return E(e)===i},t.isSuspense=function(e){return E(e)===p},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===d||e===l||e===i||e===p||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===h||e.$$typeof===s||e.$$typeof===c||e.$$typeof===f||e.$$typeof===v||e.$$typeof===y||e.$$typeof===w||e.$$typeof===b)},t.typeOf=E},9864:(e,t,n)=>{"use strict";e.exports=n(9921)},8356:(e,t,n)=>{"use strict";function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}var l=n(7294),s=n(5697),c=[],u=[];function d(e){var t=e(),n={loading:!0,loaded:null,error:null};return n.promise=t.then((function(e){return n.loading=!1,n.loaded=e,e})).catch((function(e){throw n.loading=!1,n.error=e,e})),n}function f(e){var t={loading:!1,loaded:{},error:null},n=[];try{Object.keys(e).forEach((function(r){var a=d(e[r]);a.loading?t.loading=!0:(t.loaded[r]=a.loaded,t.error=a.error),n.push(a.promise),a.promise.then((function(e){t.loaded[r]=e})).catch((function(e){t.error=e}))}))}catch(r){t.error=r}return t.promise=Promise.all(n).then((function(e){return t.loading=!1,e})).catch((function(e){throw t.loading=!1,e})),t}function p(e,t){return l.createElement((n=e)&&n.__esModule?n.default:n,t);var n}function m(e,t){var d,f;if(!t.loading)throw new Error("react-loadable requires a `loading` component");var m=i({loader:null,loading:null,delay:200,timeout:null,render:p,webpack:null,modules:null},t),h=null;function g(){return h||(h=e(m.loader)),h.promise}return c.push(g),"function"==typeof m.webpack&&u.push((function(){if((0,m.webpack)().every((function(e){return void 0!==e&&void 0!==n.m[e]})))return g()})),f=d=function(t){function n(n){var r;return o(a(a(r=t.call(this,n)||this)),"retry",(function(){r.setState({error:null,loading:!0,timedOut:!1}),h=e(m.loader),r._loadModule()})),g(),r.state={error:h.error,pastDelay:!1,timedOut:!1,loading:h.loading,loaded:h.loaded},r}r(n,t),n.preload=function(){return g()};var i=n.prototype;return i.UNSAFE_componentWillMount=function(){this._loadModule()},i.componentDidMount=function(){this._mounted=!0},i._loadModule=function(){var e=this;if(this.context.loadable&&Array.isArray(m.modules)&&m.modules.forEach((function(t){e.context.loadable.report(t)})),h.loading){var t=function(t){e._mounted&&e.setState(t)};"number"==typeof m.delay&&(0===m.delay?this.setState({pastDelay:!0}):this._delay=setTimeout((function(){t({pastDelay:!0})}),m.delay)),"number"==typeof m.timeout&&(this._timeout=setTimeout((function(){t({timedOut:!0})}),m.timeout));var n=function(){t({error:h.error,loaded:h.loaded,loading:h.loading}),e._clearTimeouts()};h.promise.then((function(){return n(),null})).catch((function(e){return n(),null}))}},i.componentWillUnmount=function(){this._mounted=!1,this._clearTimeouts()},i._clearTimeouts=function(){clearTimeout(this._delay),clearTimeout(this._timeout)},i.render=function(){return this.state.loading||this.state.error?l.createElement(m.loading,{isLoading:this.state.loading,pastDelay:this.state.pastDelay,timedOut:this.state.timedOut,error:this.state.error,retry:this.retry}):this.state.loaded?m.render(this.state.loaded,this.props):null},n}(l.Component),o(d,"contextTypes",{loadable:s.shape({report:s.func.isRequired})}),f}function h(e){return m(d,e)}h.Map=function(e){if("function"!=typeof e.render)throw new Error("LoadableMap requires a `render(loaded, props)` function");return m(f,e)};var g=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.getChildContext=function(){return{loadable:{report:this.props.report}}},n.render=function(){return l.Children.only(this.props.children)},t}(l.Component);function b(e){for(var t=[];e.length;){var n=e.pop();t.push(n())}return Promise.all(t).then((function(){if(e.length)return b(e)}))}o(g,"propTypes",{report:s.func.isRequired}),o(g,"childContextTypes",{loadable:s.shape({report:s.func.isRequired}).isRequired}),h.Capture=g,h.preloadAll=function(){return new Promise((function(e,t){b(c).then(e,t)}))},h.preloadReady=function(){return new Promise((function(e,t){b(u).then(e,e)}))},e.exports=h},8790:(e,t,n)=>{"use strict";n.d(t,{H:()=>l,f:()=>i});var r=n(6775),a=n(7462),o=n(7294);function i(e,t,n){return void 0===n&&(n=[]),e.some((function(e){var a=e.path?(0,r.LX)(t,e):n.length?n[n.length-1].match:r.F0.computeRootMatch(t);return a&&(n.push({route:e,match:a}),e.routes&&i(e.routes,t,n)),a})),n}function l(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e?o.createElement(r.rs,n,e.map((function(e,n){return o.createElement(r.AW,{key:e.key||n,path:e.path,exact:e.exact,strict:e.strict,render:function(n){return e.render?e.render((0,a.Z)({},n,{},t,{route:e})):o.createElement(e.component,(0,a.Z)({},n,t,{route:e}))}})}))):null}},3727:(e,t,n)=>{"use strict";n.d(t,{OL:()=>y,VK:()=>u,rU:()=>g});var r=n(6775),a=n(5068),o=n(7294),i=n(2358),l=n(7462),s=n(3366),c=n(2177),u=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return(t=e.call.apply(e,[this].concat(r))||this).history=(0,i.lX)(t.props),t}return(0,a.Z)(t,e),t.prototype.render=function(){return o.createElement(r.F0,{history:this.history,children:this.props.children})},t}(o.Component);o.Component;var d=function(e,t){return"function"==typeof e?e(t):e},f=function(e,t){return"string"==typeof e?(0,i.ob)(e,null,null,t):e},p=function(e){return e},m=o.forwardRef;void 0===m&&(m=p);var h=m((function(e,t){var n=e.innerRef,r=e.navigate,a=e.onClick,i=(0,s.Z)(e,["innerRef","navigate","onClick"]),c=i.target,u=(0,l.Z)({},i,{onClick:function(e){try{a&&a(e)}catch(t){throw e.preventDefault(),t}e.defaultPrevented||0!==e.button||c&&"_self"!==c||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e)||(e.preventDefault(),r())}});return u.ref=p!==m&&t||n,o.createElement("a",u)}));var g=m((function(e,t){var n=e.component,a=void 0===n?h:n,u=e.replace,g=e.to,b=e.innerRef,v=(0,s.Z)(e,["component","replace","to","innerRef"]);return o.createElement(r.s6.Consumer,null,(function(e){e||(0,c.Z)(!1);var n=e.history,r=f(d(g,e.location),e.location),s=r?n.createHref(r):"",h=(0,l.Z)({},v,{href:s,navigate:function(){var t=d(g,e.location),r=(0,i.Ep)(e.location)===(0,i.Ep)(f(t));(u||r?n.replace:n.push)(t)}});return p!==m?h.ref=t||b:h.innerRef=b,o.createElement(a,h)}))})),b=function(e){return e},v=o.forwardRef;void 0===v&&(v=b);var y=v((function(e,t){var n=e["aria-current"],a=void 0===n?"page":n,i=e.activeClassName,u=void 0===i?"active":i,p=e.activeStyle,m=e.className,h=e.exact,y=e.isActive,w=e.location,E=e.sensitive,k=e.strict,S=e.style,_=e.to,x=e.innerRef,T=(0,s.Z)(e,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return o.createElement(r.s6.Consumer,null,(function(e){e||(0,c.Z)(!1);var n=w||e.location,i=f(d(_,n),n),s=i.pathname,C=s&&s.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),A=C?(0,r.LX)(n.pathname,{path:C,exact:h,sensitive:E,strict:k}):null,N=!!(y?y(A,n):A),O="function"==typeof m?m(N):m,L="function"==typeof S?S(N):S;N&&(O=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter((function(e){return e})).join(" ")}(O,u),L=(0,l.Z)({},L,p));var I=(0,l.Z)({"aria-current":N&&a||null,className:O,style:L,to:i},T);return b!==v?I.ref=t||x:I.innerRef=x,o.createElement(g,I)}))}))},6775:(e,t,n)=>{"use strict";n.d(t,{l_:()=>T,AW:()=>O,F0:()=>E,rs:()=>D,s6:()=>w,LX:()=>N,k6:()=>B,TH:()=>$});var r=n(5068),a=n(7294),o=n(2358),i=n(5697),l=n.n(i),s=1073741823,c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:{};function u(e){var t=[];return{on:function(e){t.push(e)},off:function(e){t=t.filter((function(t){return t!==e}))},get:function(){return e},set:function(n,r){e=n,t.forEach((function(t){return t(e,r)}))}}}var d=a.createContext||function(e,t){var n,o,i="__create-react-context-"+function(){var e="__global_unique_id__";return c[e]=(c[e]||0)+1}()+"__",d=function(e){function n(){var t;return(t=e.apply(this,arguments)||this).emitter=u(t.props.value),t}(0,r.Z)(n,e);var a=n.prototype;return a.getChildContext=function(){var e;return(e={})[i]=this.emitter,e},a.componentWillReceiveProps=function(e){if(this.props.value!==e.value){var n,r=this.props.value,a=e.value;((o=r)===(i=a)?0!==o||1/o==1/i:o!=o&&i!=i)?n=0:(n="function"==typeof t?t(r,a):s,0!==(n|=0)&&this.emitter.set(e.value,n))}var o,i},a.render=function(){return this.props.children},n}(a.Component);d.childContextTypes=((n={})[i]=l().object.isRequired,n);var f=function(t){function n(){var e;return(e=t.apply(this,arguments)||this).state={value:e.getValue()},e.onUpdate=function(t,n){0!=((0|e.observedBits)&n)&&e.setState({value:e.getValue()})},e}(0,r.Z)(n,t);var a=n.prototype;return a.componentWillReceiveProps=function(e){var t=e.observedBits;this.observedBits=null==t?s:t},a.componentDidMount=function(){this.context[i]&&this.context[i].on(this.onUpdate);var e=this.props.observedBits;this.observedBits=null==e?s:e},a.componentWillUnmount=function(){this.context[i]&&this.context[i].off(this.onUpdate)},a.getValue=function(){return this.context[i]?this.context[i].get():e},a.render=function(){return(e=this.props.children,Array.isArray(e)?e[0]:e)(this.state.value);var e},n}(a.Component);return f.contextTypes=((o={})[i]=l().object,o),{Provider:d,Consumer:f}};const f=d;var p=n(2177),m=n(7462),h=n(4779),g=n.n(h),b=(n(9864),n(3366)),v=(n(8679),function(e){var t=f();return t.displayName=e,t}),y=v("Router-History"),w=v("Router"),E=function(e){function t(t){var n;return(n=e.call(this,t)||this).state={location:t.history.location},n._isMounted=!1,n._pendingLocation=null,t.staticContext||(n.unlisten=t.history.listen((function(e){n._pendingLocation=e}))),n}(0,r.Z)(t,e),t.computeRootMatch=function(e){return{path:"/",url:"/",params:{},isExact:"/"===e}};var n=t.prototype;return n.componentDidMount=function(){var e=this;this._isMounted=!0,this.unlisten&&this.unlisten(),this.props.staticContext||(this.unlisten=this.props.history.listen((function(t){e._isMounted&&e.setState({location:t})}))),this._pendingLocation&&this.setState({location:this._pendingLocation})},n.componentWillUnmount=function(){this.unlisten&&(this.unlisten(),this._isMounted=!1,this._pendingLocation=null)},n.render=function(){return a.createElement(w.Provider,{value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}},a.createElement(y.Provider,{children:this.props.children||null,value:this.props.history}))},t}(a.Component);a.Component;var k=function(e){function t(){return e.apply(this,arguments)||this}(0,r.Z)(t,e);var n=t.prototype;return n.componentDidMount=function(){this.props.onMount&&this.props.onMount.call(this,this)},n.componentDidUpdate=function(e){this.props.onUpdate&&this.props.onUpdate.call(this,this,e)},n.componentWillUnmount=function(){this.props.onUnmount&&this.props.onUnmount.call(this,this)},n.render=function(){return null},t}(a.Component);var S={},_=0;function x(e,t){return void 0===e&&(e="/"),void 0===t&&(t={}),"/"===e?e:function(e){if(S[e])return S[e];var t=g().compile(e);return _<1e4&&(S[e]=t,_++),t}(e)(t,{pretty:!0})}function T(e){var t=e.computedMatch,n=e.to,r=e.push,i=void 0!==r&&r;return a.createElement(w.Consumer,null,(function(e){e||(0,p.Z)(!1);var r=e.history,l=e.staticContext,s=i?r.push:r.replace,c=(0,o.ob)(t?"string"==typeof n?x(n,t.params):(0,m.Z)({},n,{pathname:x(n.pathname,t.params)}):n);return l?(s(c),null):a.createElement(k,{onMount:function(){s(c)},onUpdate:function(e,t){var n=(0,o.ob)(t.to);(0,o.Hp)(n,(0,m.Z)({},c,{key:n.key}))||s(c)},to:n})}))}var C={},A=0;function N(e,t){void 0===t&&(t={}),("string"==typeof t||Array.isArray(t))&&(t={path:t});var n=t,r=n.path,a=n.exact,o=void 0!==a&&a,i=n.strict,l=void 0!==i&&i,s=n.sensitive,c=void 0!==s&&s;return[].concat(r).reduce((function(t,n){if(!n&&""!==n)return null;if(t)return t;var r=function(e,t){var n=""+t.end+t.strict+t.sensitive,r=C[n]||(C[n]={});if(r[e])return r[e];var a=[],o={regexp:g()(e,a,t),keys:a};return A<1e4&&(r[e]=o,A++),o}(n,{end:o,strict:l,sensitive:c}),a=r.regexp,i=r.keys,s=a.exec(e);if(!s)return null;var u=s[0],d=s.slice(1),f=e===u;return o&&!f?null:{path:n,url:"/"===n&&""===u?"/":u,isExact:f,params:i.reduce((function(e,t,n){return e[t.name]=d[n],e}),{})}}),null)}var O=function(e){function t(){return e.apply(this,arguments)||this}return(0,r.Z)(t,e),t.prototype.render=function(){var e=this;return a.createElement(w.Consumer,null,(function(t){t||(0,p.Z)(!1);var n=e.props.location||t.location,r=e.props.computedMatch?e.props.computedMatch:e.props.path?N(n.pathname,e.props):t.match,o=(0,m.Z)({},t,{location:n,match:r}),i=e.props,l=i.children,s=i.component,c=i.render;return Array.isArray(l)&&function(e){return 0===a.Children.count(e)}(l)&&(l=null),a.createElement(w.Provider,{value:o},o.match?l?"function"==typeof l?l(o):l:s?a.createElement(s,o):c?c(o):null:"function"==typeof l?l(o):null)}))},t}(a.Component);function L(e){return"/"===e.charAt(0)?e:"/"+e}function I(e,t){if(!e)return t;var n=L(e);return 0!==t.pathname.indexOf(n)?t:(0,m.Z)({},t,{pathname:t.pathname.substr(n.length)})}function P(e){return"string"==typeof e?e:(0,o.Ep)(e)}function R(e){return function(){(0,p.Z)(!1)}}function M(){}a.Component;var D=function(e){function t(){return e.apply(this,arguments)||this}return(0,r.Z)(t,e),t.prototype.render=function(){var e=this;return a.createElement(w.Consumer,null,(function(t){t||(0,p.Z)(!1);var n,r,o=e.props.location||t.location;return a.Children.forEach(e.props.children,(function(e){if(null==r&&a.isValidElement(e)){n=e;var i=e.props.path||e.props.from;r=i?N(o.pathname,(0,m.Z)({},e.props,{path:i})):t.match}})),r?a.cloneElement(n,{location:o,computedMatch:r}):null}))},t}(a.Component);var F=a.useContext;function B(){return F(y)}function $(){return F(w).location}},2408:(e,t,n)=>{"use strict";var r=n(7418),a=60103,o=60106;t.Fragment=60107,t.StrictMode=60108,t.Profiler=60114;var i=60109,l=60110,s=60112;t.Suspense=60113;var c=60115,u=60116;if("function"==typeof Symbol&&Symbol.for){var d=Symbol.for;a=d("react.element"),o=d("react.portal"),t.Fragment=d("react.fragment"),t.StrictMode=d("react.strict_mode"),t.Profiler=d("react.profiler"),i=d("react.provider"),l=d("react.context"),s=d("react.forward_ref"),t.Suspense=d("react.suspense"),c=d("react.memo"),u=d("react.lazy")}var f="function"==typeof Symbol&&Symbol.iterator;function p(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h={};function g(e,t,n){this.props=e,this.context=t,this.refs=h,this.updater=n||m}function b(){}function v(e,t,n){this.props=e,this.context=t,this.refs=h,this.updater=n||m}g.prototype.isReactComponent={},g.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(p(85));this.updater.enqueueSetState(this,e,t,"setState")},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},b.prototype=g.prototype;var y=v.prototype=new b;y.constructor=v,r(y,g.prototype),y.isPureReactComponent=!0;var w={current:null},E=Object.prototype.hasOwnProperty,k={key:!0,ref:!0,__self:!0,__source:!0};function S(e,t,n){var r,o={},i=null,l=null;if(null!=t)for(r in void 0!==t.ref&&(l=t.ref),void 0!==t.key&&(i=""+t.key),t)E.call(t,r)&&!k.hasOwnProperty(r)&&(o[r]=t[r]);var s=arguments.length-2;if(1===s)o.children=n;else if(1<s){for(var c=Array(s),u=0;u<s;u++)c[u]=arguments[u+2];o.children=c}if(e&&e.defaultProps)for(r in s=e.defaultProps)void 0===o[r]&&(o[r]=s[r]);return{$$typeof:a,type:e,key:i,ref:l,props:o,_owner:w.current}}function _(e){return"object"==typeof e&&null!==e&&e.$$typeof===a}var x=/\/+/g;function T(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function C(e,t,n,r,i){var l=typeof e;"undefined"!==l&&"boolean"!==l||(e=null);var s=!1;if(null===e)s=!0;else switch(l){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case a:case o:s=!0}}if(s)return i=i(s=e),e=""===r?"."+T(s,0):r,Array.isArray(i)?(n="",null!=e&&(n=e.replace(x,"$&/")+"/"),C(i,t,n,"",(function(e){return e}))):null!=i&&(_(i)&&(i=function(e,t){return{$$typeof:a,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(i,n+(!i.key||s&&s.key===i.key?"":(""+i.key).replace(x,"$&/")+"/")+e)),t.push(i)),1;if(s=0,r=""===r?".":r+":",Array.isArray(e))for(var c=0;c<e.length;c++){var u=r+T(l=e[c],c);s+=C(l,t,n,u,i)}else if(u=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=f&&e[f]||e["@@iterator"])?e:null}(e),"function"==typeof u)for(e=u.call(e),c=0;!(l=e.next()).done;)s+=C(l=l.value,t,n,u=r+T(l,c++),i);else if("object"===l)throw t=""+e,Error(p(31,"[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t));return s}function A(e,t,n){if(null==e)return e;var r=[],a=0;return C(e,r,"","",(function(e){return t.call(n,e,a++)})),r}function N(e){if(-1===e._status){var t=e._result;t=t(),e._status=0,e._result=t,t.then((function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)}),(function(t){0===e._status&&(e._status=2,e._result=t)}))}if(1===e._status)return e._result;throw e._result}var O={current:null};function L(){var e=O.current;if(null===e)throw Error(p(321));return e}var I={ReactCurrentDispatcher:O,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:w,IsSomeRendererActing:{current:!1},assign:r};t.Children={map:A,forEach:function(e,t,n){A(e,(function(){t.apply(this,arguments)}),n)},count:function(e){var t=0;return A(e,(function(){t++})),t},toArray:function(e){return A(e,(function(e){return e}))||[]},only:function(e){if(!_(e))throw Error(p(143));return e}},t.Component=g,t.PureComponent=v,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,t.cloneElement=function(e,t,n){if(null==e)throw Error(p(267,e));var o=r({},e.props),i=e.key,l=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(l=t.ref,s=w.current),void 0!==t.key&&(i=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(u in t)E.call(t,u)&&!k.hasOwnProperty(u)&&(o[u]=void 0===t[u]&&void 0!==c?c[u]:t[u])}var u=arguments.length-2;if(1===u)o.children=n;else if(1<u){c=Array(u);for(var d=0;d<u;d++)c[d]=arguments[d+2];o.children=c}return{$$typeof:a,type:e.type,key:i,ref:l,props:o,_owner:s}},t.createContext=function(e,t){return void 0===t&&(t=null),(e={$$typeof:l,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:i,_context:e},e.Consumer=e},t.createElement=S,t.createFactory=function(e){var t=S.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:s,render:e}},t.isValidElement=_,t.lazy=function(e){return{$$typeof:u,_payload:{_status:-1,_result:e},_init:N}},t.memo=function(e,t){return{$$typeof:c,type:e,compare:void 0===t?null:t}},t.useCallback=function(e,t){return L().useCallback(e,t)},t.useContext=function(e,t){return L().useContext(e,t)},t.useDebugValue=function(){},t.useEffect=function(e,t){return L().useEffect(e,t)},t.useImperativeHandle=function(e,t,n){return L().useImperativeHandle(e,t,n)},t.useLayoutEffect=function(e,t){return L().useLayoutEffect(e,t)},t.useMemo=function(e,t){return L().useMemo(e,t)},t.useReducer=function(e,t,n){return L().useReducer(e,t,n)},t.useRef=function(e){return L().useRef(e)},t.useState=function(e){return L().useState(e)},t.version="17.0.2"},7294:(e,t,n)=>{"use strict";e.exports=n(2408)},53:(e,t)=>{"use strict";var n,r,a,o;if("object"==typeof performance&&"function"==typeof performance.now){var i=performance;t.unstable_now=function(){return i.now()}}else{var l=Date,s=l.now();t.unstable_now=function(){return l.now()-s}}if("undefined"==typeof window||"function"!=typeof MessageChannel){var c=null,u=null,d=function(){if(null!==c)try{var e=t.unstable_now();c(!0,e),c=null}catch(n){throw setTimeout(d,0),n}};n=function(e){null!==c?setTimeout(n,0,e):(c=e,setTimeout(d,0))},r=function(e,t){u=setTimeout(e,t)},a=function(){clearTimeout(u)},t.unstable_shouldYield=function(){return!1},o=t.unstable_forceFrameRate=function(){}}else{var f=window.setTimeout,p=window.clearTimeout;if("undefined"!=typeof console){var m=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!=typeof m&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var h=!1,g=null,b=-1,v=5,y=0;t.unstable_shouldYield=function(){return t.unstable_now()>=y},o=function(){},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):v=0<e?Math.floor(1e3/e):5};var w=new MessageChannel,E=w.port2;w.port1.onmessage=function(){if(null!==g){var e=t.unstable_now();y=e+v;try{g(!0,e)?E.postMessage(null):(h=!1,g=null)}catch(n){throw E.postMessage(null),n}}else h=!1},n=function(e){g=e,h||(h=!0,E.postMessage(null))},r=function(e,n){b=f((function(){e(t.unstable_now())}),n)},a=function(){p(b),b=-1}}function k(e,t){var n=e.length;e.push(t);e:for(;;){var r=n-1>>>1,a=e[r];if(!(void 0!==a&&0<x(a,t)))break e;e[r]=t,e[n]=a,n=r}}function S(e){return void 0===(e=e[0])?null:e}function _(e){var t=e[0];if(void 0!==t){var n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,a=e.length;r<a;){var o=2*(r+1)-1,i=e[o],l=o+1,s=e[l];if(void 0!==i&&0>x(i,n))void 0!==s&&0>x(s,i)?(e[r]=s,e[l]=n,r=l):(e[r]=i,e[o]=n,r=o);else{if(!(void 0!==s&&0>x(s,n)))break e;e[r]=s,e[l]=n,r=l}}}return t}return null}function x(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var T=[],C=[],A=1,N=null,O=3,L=!1,I=!1,P=!1;function R(e){for(var t=S(C);null!==t;){if(null===t.callback)_(C);else{if(!(t.startTime<=e))break;_(C),t.sortIndex=t.expirationTime,k(T,t)}t=S(C)}}function M(e){if(P=!1,R(e),!I)if(null!==S(T))I=!0,n(D);else{var t=S(C);null!==t&&r(M,t.startTime-e)}}function D(e,n){I=!1,P&&(P=!1,a()),L=!0;var o=O;try{for(R(n),N=S(T);null!==N&&(!(N.expirationTime>n)||e&&!t.unstable_shouldYield());){var i=N.callback;if("function"==typeof i){N.callback=null,O=N.priorityLevel;var l=i(N.expirationTime<=n);n=t.unstable_now(),"function"==typeof l?N.callback=l:N===S(T)&&_(T),R(n)}else _(T);N=S(T)}if(null!==N)var s=!0;else{var c=S(C);null!==c&&r(M,c.startTime-n),s=!1}return s}finally{N=null,O=o,L=!1}}var F=o;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){I||L||(I=!0,n(D))},t.unstable_getCurrentPriorityLevel=function(){return O},t.unstable_getFirstCallbackNode=function(){return S(T)},t.unstable_next=function(e){switch(O){case 1:case 2:case 3:var t=3;break;default:t=O}var n=O;O=t;try{return e()}finally{O=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=F,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=O;O=e;try{return t()}finally{O=n}},t.unstable_scheduleCallback=function(e,o,i){var l=t.unstable_now();switch("object"==typeof i&&null!==i?i="number"==typeof(i=i.delay)&&0<i?l+i:l:i=l,e){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return e={id:A++,callback:o,priorityLevel:e,startTime:i,expirationTime:s=i+s,sortIndex:-1},i>l?(e.sortIndex=i,k(C,e),null===S(T)&&e===S(C)&&(P?a():P=!0,r(M,i-l))):(e.sortIndex=s,k(T,e),I||L||(I=!0,n(D))),e},t.unstable_wrapCallback=function(e){var t=O;return function(){var n=O;O=t;try{return e.apply(this,arguments)}finally{O=n}}}},3840:(e,t,n)=>{"use strict";e.exports=n(53)},6774:e=>{e.exports=function(e,t,n,r){var a=n?n.call(r,e,t):void 0;if(void 0!==a)return!!a;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var o=Object.keys(e),i=Object.keys(t);if(o.length!==i.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(t),s=0;s<o.length;s++){var c=o[s];if(!l(c))return!1;var u=e[c],d=t[c];if(!1===(a=n?n.call(r,u,d,c):void 0)||void 0===a&&u!==d)return!1}return!0}},2177:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r="Invariant failed";function a(e,t){if(!e)throw new Error(r)}},6809:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r});const r={title:"Dasar Pemrograman Rust",tagline:"Belajar Rust Mulai Dari 0, Gratis!",url:"https://dasarpemrogramanrust.novalagung.com",baseUrl:"/",trailingSlash:!1,onBrokenLinks:"throw",onBrokenMarkdownLinks:"warn",favicon:"img/favicon.png",organizationName:"novalagung",projectName:"dasarpemrogramanrust",deploymentBranch:"gh-pages",i18n:{defaultLocale:"id",locales:["id"],path:"i18n",localeConfigs:{}},presets:[["classic",{docs:{sidebarPath:"/home/runner/work/dasarpemrogramanrust/dasarpemrogramanrust/sidebars.js",sidebarCollapsible:!1,routeBasePath:"/",rehypePlugins:[null]},blog:!1,theme:{customCss:["/home/runner/work/dasarpemrogramanrust/dasarpemrogramanrust/src/css/global.css","/home/runner/work/dasarpemrogramanrust/dasarpemrogramanrust/src-local/css/custom.css"]},gtag:{trackingID:"G-HKPC8ZGM74"},sitemap:{changefreq:"weekly",priority:.5,ignorePatterns:["/tags/**","/wip/**"],filename:"sitemap.xml"}}]],plugins:["@stackql/docusaurus-plugin-structured-data"],themeConfig:{metadata:[{name:"keywords",content:"rust, belajar rust, tutorial rust, belajar tutorial rust gratis, pemrograman rust, cargo, concurrent programming, noval agung"},{name:"author",content:"Noval Agung Prayogo"},{property:"og:image",content:"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png"},{property:"og:type",content:"article"},{property:"fb:app_id",content:"875100400724859"}],image:"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png",navbar:{title:"Dasar Pemrograman Rust",logo:{alt:"Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!",src:"https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png",srcDark:"https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png"},items:[{position:"left",label:"\ud83d\udcd6 Webbook/Ebook",items:[{label:"Dasar Pemrograman Golang ",href:"https://dasarpemrogramangolang.novalagung.com"},{label:"Dasar Pemrograman Python ",href:"https://dasarpemrogramanpython.novalagung.com"},{label:"How To ",href:"https://howto.novalagung.com"}]},{position:"left",label:"\u25b6\ufe0f Udemy courses",items:[{label:"Udemy Course: Praktis Belajar Docker dan Kubernetes ",href:"https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode="}]}],hideOnScroll:!1},footer:{style:"dark",links:[],copyright:"2024 | Maintained by Noval Agung Prayogo"},prism:{theme:{plain:{color:"#393A34",backgroundColor:"#f6f8fa"},styles:[{types:["comment","prolog","doctype","cdata"],style:{color:"#999988",fontStyle:"italic"}},{types:["namespace"],style:{opacity:.7}},{types:["string","attr-value"],style:{color:"#e3116c"}},{types:["punctuation","operator"],style:{color:"#393A34"}},{types:["entity","url","symbol","number","boolean","variable","constant","property","regex","inserted"],style:{color:"#36acaa"}},{types:["atrule","keyword","attr-name","selector"],style:{color:"#00a4db"}},{types:["function","deleted","tag"],style:{color:"#d73a49"}},{types:["function-variable"],style:{color:"#6f42c1"}},{types:["tag","selector","keyword"],style:{color:"#00009f"}}]},darkTheme:{plain:{color:"#F8F8F2",backgroundColor:"#282A36"},styles:[{types:["prolog","constant","builtin"],style:{color:"rgb(189, 147, 249)"}},{types:["inserted","function"],style:{color:"rgb(80, 250, 123)"}},{types:["deleted"],style:{color:"rgb(255, 85, 85)"}},{types:["changed"],style:{color:"rgb(255, 184, 108)"}},{types:["punctuation","symbol"],style:{color:"rgb(248, 248, 242)"}},{types:["string","char","tag","selector"],style:{color:"rgb(255, 121, 198)"}},{types:["keyword","variable"],style:{color:"rgb(189, 147, 249)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(98, 114, 164)"}},{types:["attr-name"],style:{color:"rgb(241, 250, 140)"}}]},additionalLanguages:["bash","rust","python","toml","yaml","log","hcl"],magicComments:[{className:"theme-code-block-highlighted-line",line:"highlight-next-line",block:{start:"highlight-start",end:"highlight-end"}}]},showContentFooterEbookWrapper:!0,algolia:{appId:"65RXJ98QVA",apiKey:"be8c782c081c9e5a001dbbaa6ffdd859",indexName:"dasarpemrogramanrust-novalagung",contextualSearch:!0,searchPagePath:"search",searchParameters:{}},structuredData:{excludedRoutes:[],verbose:!0,featuredImageDimensions:{width:1200,height:627},authors:{"Noval Agung Prayogo":{authorId:"1",url:"https://www.linkedin.com/in/novalagung",imageUrl:"https://i.stack.imgur.com/99yxf.jpg",sameAs:["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"]}},organization:{sameAs:["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],contactPoint:{"@type":"ContactPoint",email:"hello@novalagung.com"},logo:{"@type":"ImageObject",inLanguage:"id","@id":"adamstudio",url:"https://avatars.githubusercontent.com/u/65223287",contentUrl:"https://avatars.githubusercontent.com/u/65223287",width:1440,height:900,caption:"Adam Studio"}},website:{inLanguage:"id"},webpage:{inLanguage:"id"},breadcrumbLabelMap:{}},colorMode:{defaultMode:"light",disableSwitch:!1,respectPrefersColorScheme:!1},docs:{versionPersistence:"localStorage",sidebar:{hideable:!1,autoCollapseCategories:!1}},tableOfContents:{minHeadingLevel:2,maxHeadingLevel:3}},baseUrlIssueBanner:!0,onDuplicateRoutes:"warn",staticDirectories:["static"],customFields:{},themes:[],scripts:[],headTags:[],stylesheets:[],clientModules:[],titleDelimiter:"|",noIndex:!1,markdown:{mermaid:!1}}},7462:(e,t,n)=>{"use strict";function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r.apply(this,arguments)}n.d(t,{Z:()=>r})},5068:(e,t,n)=>{"use strict";function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}function a(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}n.d(t,{Z:()=>a})},3366:(e,t,n)=>{"use strict";function r(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}n.d(t,{Z:()=>r})},7529:e=>{"use strict";e.exports={}},6887:e=>{"use strict";e.exports=JSON.parse('{"/intro-a5b":{"__comp":"48e2ebd6","__context":{"plugin":"d47a3664"},"config":"5e9f5e1a"},"/search-fa3":{"__comp":"1a4e3797","__context":{"plugin":"164327b9"}},"/-24f":{"__comp":"1be78505","__context":{"plugin":"0e6b6dd1"},"versionMetadata":"935f2afb"},"/-98e":{"__comp":"17896441","content":"c377a04b"},"/basic/advanced-traits-88d":{"__comp":"17896441","content":"742a9bdc"},"/basic/array-354":{"__comp":"17896441","content":"dadaca00"},"/basic/associated-function-a80":{"__comp":"17896441","content":"bdfc7662"},"/basic/attributes-7d4":{"__comp":"17896441","content":"5f289fb7"},"/basic/basic-memory-management-24e":{"__comp":"17896441","content":"016a0787"},"/basic/block-expression-22b":{"__comp":"17896441","content":"b28a365a"},"/basic/borrowing-85f":{"__comp":"17896441","content":"fb18633e"},"/basic/build-dan-run-program-rust-1a9":{"__comp":"17896441","content":"7a2568c4"},"/basic/closures-98c":{"__comp":"17896441","content":"bc4edc5c"},"/basic/datetime-b5e":{"__comp":"17896441","content":"af6aab29"},"/basic/enum-a0e":{"__comp":"17896441","content":"4232c3ed"},"/basic/file-path-directory-020":{"__comp":"17896441","content":"9a3629a6"},"/basic/function-c21":{"__comp":"17896441","content":"c526a898"},"/basic/generics-3f9":{"__comp":"17896441","content":"5925ce9f"},"/basic/hello-rust-91f":{"__comp":"17896441","content":"496dcc30"},"/basic/komentar-f72":{"__comp":"17896441","content":"b97d8256"},"/basic/konstanta-758":{"__comp":"17896441","content":"c01cce30"},"/basic/lifetime-ee9":{"__comp":"17896441","content":"f8d4e457"},"/basic/method-970":{"__comp":"17896441","content":"68e1906b"},"/basic/module-basic-81c":{"__comp":"17896441","content":"4c7e7ada"},"/basic/module-inline-4f6":{"__comp":"17896441","content":"3aa512bf"},"/basic/module-scope-item-access-b6b":{"__comp":"17896441","content":"be3f5c40"},"/basic/operator-85d":{"__comp":"17896441","content":"dabee7bd"},"/basic/operator-tanda-tanya-f6a":{"__comp":"17896441","content":"3d2f5b0c"},"/basic/option-type-c23":{"__comp":"17896441","content":"e4904969"},"/basic/ownership-74d":{"__comp":"17896441","content":"8333c691"},"/basic/package-crate-fce":{"__comp":"17896441","content":"7390b81e"},"/basic/path-item-e90":{"__comp":"17896441","content":"e7bd9b37"},"/basic/pattern-matching-45d":{"__comp":"17896441","content":"2bc2e36b"},"/basic/perulangan-for-in-c5f":{"__comp":"17896441","content":"71880105"},"/basic/perulangan-loop-break-continue-label-b52":{"__comp":"17896441","content":"04da11da"},"/basic/perulangan-while-011":{"__comp":"17896441","content":"475d163e"},"/basic/pointer-references-dfd":{"__comp":"17896441","content":"0ae704f7"},"/basic/recoverable-error-handling-b06":{"__comp":"17896441","content":"9ed3ab78"},"/basic/result-type-c01":{"__comp":"17896441","content":"7794a932"},"/basic/seleksi-kondisi-if-e3d":{"__comp":"17896441","content":"05cc1716"},"/basic/shadowing-5be":{"__comp":"17896441","content":"fef7d16c"},"/basic/slice-2c8":{"__comp":"17896441","content":"62b99870"},"/basic/slice-memory-management-6b3":{"__comp":"17896441","content":"4513d9f5"},"/basic/static-655":{"__comp":"17896441","content":"68ec37cc"},"/basic/string-slice-vs-string-literal-5e6":{"__comp":"17896441","content":"a2bea3ed"},"/basic/struct-392":{"__comp":"17896441","content":"93422b31"},"/basic/tipe-data-custom-type-string-slice-384":{"__comp":"17896441","content":"8b55bf27"},"/basic/tipe-data-primitive-scalar-18c":{"__comp":"17896441","content":"bd9b9d52"},"/basic/tipe-data-string-literal-788":{"__comp":"17896441","content":"d8837387"},"/basic/trait-function-ebd":{"__comp":"17896441","content":"cb962766"},"/basic/trait-iterator-2f7":{"__comp":"17896441","content":"82a9b669"},"/basic/traits-594":{"__comp":"17896441","content":"db8ccf76"},"/basic/tuple-dfc":{"__comp":"17896441","content":"8333ea4d"},"/basic/type-alias-casting-dbf":{"__comp":"17896441","content":"2452d5f5"},"/basic/unrecoverable-panic-error-445":{"__comp":"17896441","content":"388041ab"},"/basic/use-f71":{"__comp":"17896441","content":"eb2a6637"},"/basic/variabel-21b":{"__comp":"17896441","content":"87499f15"},"/basic/vector-4d7":{"__comp":"17896441","content":"c76cc2e3"},"/basic/visibility-privacy-794":{"__comp":"17896441","content":"3b1dfe68"},"/CHANGELOG-c6e":{"__comp":"17896441","content":"ca36df4d"},"/CONTRIBUTING-93d":{"__comp":"17896441","content":"8d193b98"},"/download-pdf-a82":{"__comp":"17896441","content":"8e991452"},"/installation/instalasi-rust-e6a":{"__comp":"17896441","content":"9e6fe7cf"},"/installation/rust-editor-plugin-a9b":{"__comp":"17896441","content":"fd4f5a0c"},"/LICENSE-67b":{"__comp":"17896441","content":"8ad68633"},"/pengelanan-rust-programming-aab":{"__comp":"17896441","content":"7d03ccaf"}}')}},e=>{e.O(0,[532],(()=>{return t=9383,e(e.s=t);var t}));e.O()}]); \ No newline at end of file diff --git a/assets/js/main.8355e625.js.LICENSE.txt b/assets/js/main.945e59e1.js.LICENSE.txt similarity index 100% rename from assets/js/main.8355e625.js.LICENSE.txt rename to assets/js/main.945e59e1.js.LICENSE.txt diff --git a/assets/js/runtime~main.74e5229a.js b/assets/js/runtime~main.74e5229a.js deleted file mode 100644 index f77be39b..00000000 --- a/assets/js/runtime~main.74e5229a.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{"use strict";var e,a,f,c,d,b={},r={};function t(e){var a=r[e];if(void 0!==a)return a.exports;var f=r[e]={exports:{}};return b[e].call(f.exports,f,f.exports,t),f.exports}t.m=b,e=[],t.O=(a,f,c,d)=>{if(!f){var b=1/0;for(i=0;i<e.length;i++){f=e[i][0],c=e[i][1],d=e[i][2];for(var r=!0,o=0;o<f.length;o++)(!1&d||b>=d)&&Object.keys(t.O).every((e=>t.O[e](f[o])))?f.splice(o--,1):(r=!1,d<b&&(b=d));if(r){e.splice(i--,1);var n=c();void 0!==n&&(a=n)}}return a}d=d||0;for(var i=e.length;i>0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[f,c,d]},t.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return t.d(a,{a:a}),a},f=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,t.t=function(e,c){if(1&c&&(e=this(e)),8&c)return e;if("object"==typeof e&&e){if(4&c&&e.__esModule)return e;if(16&c&&"function"==typeof e.then)return e}var d=Object.create(null);t.r(d);var b={};a=a||[null,f({}),f([]),f(f)];for(var r=2&c&&e;"object"==typeof r&&!~a.indexOf(r);r=f(r))Object.getOwnPropertyNames(r).forEach((a=>b[a]=()=>e[a]));return b.default=()=>e,t.d(d,b),d},t.d=(e,a)=>{for(var f in a)t.o(a,f)&&!t.o(e,f)&&Object.defineProperty(e,f,{enumerable:!0,get:a[f]})},t.f={},t.e=e=>Promise.all(Object.keys(t.f).reduce(((a,f)=>(t.f[f](e,a),a)),[])),t.u=e=>"assets/js/"+({53:"935f2afb",274:"016a0787",620:"2bc2e36b",623:"9e6fe7cf",676:"3d2f5b0c",740:"f8d4e457",909:"bd9b9d52",917:"ca36df4d",1059:"7d03ccaf",1422:"62b99870",1494:"388041ab",1591:"9ed3ab78",2089:"0ae704f7",2107:"8e991452",2359:"48e2ebd6",2399:"8ad68633",2706:"4c7e7ada",2870:"5f289fb7",2959:"68ec37cc",3007:"04da11da",3257:"82a9b669",3306:"164327b9",4197:"7a2568c4",4248:"8333c691",4274:"7390b81e",4452:"bc4edc5c",4622:"d8837387",4729:"c76cc2e3",4738:"496dcc30",4758:"68e1906b",4790:"b97d8256",4861:"db8ccf76",4943:"dabee7bd",5572:"be3f5c40",5673:"fef7d16c",5729:"4513d9f5",5751:"fd4f5a0c",5758:"71880105",5989:"2452d5f5",6161:"3b1dfe68",6345:"a2bea3ed",6388:"eb2a6637",6403:"475d163e",6477:"05cc1716",6531:"c01cce30",6691:"cb962766",6794:"b28a365a",6971:"c377a04b",7310:"fb18633e",7386:"3aa512bf",7505:"8d193b98",7539:"e7bd9b37",7720:"bdfc7662",7742:"87499f15",7865:"9a3629a6",7918:"17896441",7920:"1a4e3797",7949:"0e6b6dd1",7988:"742a9bdc",8051:"dadaca00",8308:"4232c3ed",8358:"7794a932",8469:"93422b31",8732:"e4904969",8784:"d47a3664",8794:"af6aab29",9157:"c526a898",9323:"8333ea4d",9514:"1be78505",9831:"5925ce9f",9886:"8b55bf27"}[e]||e)+"."+{53:"cfcb5351",205:"e9ca4e1a",274:"ddd4552f",620:"da777af7",623:"c549f588",676:"1f148699",740:"b9fffacd",909:"c2ec587a",917:"008163ca",1059:"f4975a35",1422:"eac41936",1494:"64babc7e",1591:"bfc8ff35",2089:"12a11a9d",2107:"dfa38d18",2359:"0b6ce575",2399:"70fea1d8",2706:"14a0abb4",2870:"1391b360",2959:"eb57c627",3007:"d61e5604",3257:"fc893c5a",3306:"ce557677",4197:"cb80d87b",4248:"d59a9952",4274:"18c2ce22",4452:"d4905b46",4622:"31f2a62c",4729:"978efe66",4738:"2c33b3bd",4758:"57a9a7b8",4790:"7eff2a81",4861:"3fc0ba0e",4943:"7ac3877f",4972:"ea87a18a",5572:"3675591d",5673:"7198ddd5",5729:"f786dcf5",5751:"7de9809a",5758:"761a2054",5989:"c8d9088c",6161:"a3e9cea9",6345:"0e7c2791",6388:"570a9def",6403:"60520781",6477:"bb8cde02",6531:"1810b6cb",6691:"4f3c4b22",6780:"3e547342",6794:"28a71aca",6945:"19e06702",6971:"4292a80d",7310:"5c83c6b6",7386:"35e7bf91",7505:"19f369fd",7539:"6bffc9e2",7720:"5ed547e8",7742:"91f9bc09",7865:"8ffb3acb",7918:"0744e752",7920:"615c0dbb",7949:"a5062737",7988:"7a41a927",8051:"64b4e275",8308:"32b73572",8358:"1399478f",8469:"2fa67f2b",8732:"59f9cb8c",8784:"2e54129a",8794:"396c2ab9",8894:"7d968ee6",9157:"18163a59",9323:"79e6ada8",9514:"fa7071eb",9831:"4587ec2a",9886:"b92b9eb6"}[e]+".js",t.miniCssF=e=>{},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),c={},d="dasarpemrogramanrust:",t.l=(e,a,f,b)=>{if(c[e])c[e].push(a);else{var r,o;if(void 0!==f)for(var n=document.getElementsByTagName("script"),i=0;i<n.length;i++){var u=n[i];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==d+f){r=u;break}}r||(o=!0,(r=document.createElement("script")).charset="utf-8",r.timeout=120,t.nc&&r.setAttribute("nonce",t.nc),r.setAttribute("data-webpack",d+f),r.src=e),c[e]=[a];var l=(a,f)=>{r.onerror=r.onload=null,clearTimeout(s);var d=c[e];if(delete c[e],r.parentNode&&r.parentNode.removeChild(r),d&&d.forEach((e=>e(f))),a)return a(f)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=l.bind(null,r.onerror),r.onload=l.bind(null,r.onload),o&&document.head.appendChild(r)}},t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.p="/",t.gca=function(e){return e={17896441:"7918",71880105:"5758","935f2afb":"53","016a0787":"274","2bc2e36b":"620","9e6fe7cf":"623","3d2f5b0c":"676",f8d4e457:"740",bd9b9d52:"909",ca36df4d:"917","7d03ccaf":"1059","62b99870":"1422","388041ab":"1494","9ed3ab78":"1591","0ae704f7":"2089","8e991452":"2107","48e2ebd6":"2359","8ad68633":"2399","4c7e7ada":"2706","5f289fb7":"2870","68ec37cc":"2959","04da11da":"3007","82a9b669":"3257","164327b9":"3306","7a2568c4":"4197","8333c691":"4248","7390b81e":"4274",bc4edc5c:"4452",d8837387:"4622",c76cc2e3:"4729","496dcc30":"4738","68e1906b":"4758",b97d8256:"4790",db8ccf76:"4861",dabee7bd:"4943",be3f5c40:"5572",fef7d16c:"5673","4513d9f5":"5729",fd4f5a0c:"5751","2452d5f5":"5989","3b1dfe68":"6161",a2bea3ed:"6345",eb2a6637:"6388","475d163e":"6403","05cc1716":"6477",c01cce30:"6531",cb962766:"6691",b28a365a:"6794",c377a04b:"6971",fb18633e:"7310","3aa512bf":"7386","8d193b98":"7505",e7bd9b37:"7539",bdfc7662:"7720","87499f15":"7742","9a3629a6":"7865","1a4e3797":"7920","0e6b6dd1":"7949","742a9bdc":"7988",dadaca00:"8051","4232c3ed":"8308","7794a932":"8358","93422b31":"8469",e4904969:"8732",d47a3664:"8784",af6aab29:"8794",c526a898:"9157","8333ea4d":"9323","1be78505":"9514","5925ce9f":"9831","8b55bf27":"9886"}[e]||e,t.p+t.u(e)},(()=>{var e={1303:0,532:0};t.f.j=(a,f)=>{var c=t.o(e,a)?e[a]:void 0;if(0!==c)if(c)f.push(c[2]);else if(/^(1303|532)$/.test(a))e[a]=0;else{var d=new Promise(((f,d)=>c=e[a]=[f,d]));f.push(c[2]=d);var b=t.p+t.u(a),r=new Error;t.l(b,(f=>{if(t.o(e,a)&&(0!==(c=e[a])&&(e[a]=void 0),c)){var d=f&&("load"===f.type?"missing":f.type),b=f&&f.target&&f.target.src;r.message="Loading chunk "+a+" failed.\n("+d+": "+b+")",r.name="ChunkLoadError",r.type=d,r.request=b,c[1](r)}}),"chunk-"+a,a)}},t.O.j=a=>0===e[a];var a=(a,f)=>{var c,d,b=f[0],r=f[1],o=f[2],n=0;if(b.some((a=>0!==e[a]))){for(c in r)t.o(r,c)&&(t.m[c]=r[c]);if(o)var i=o(t)}for(a&&a(f);n<b.length;n++)d=b[n],t.o(e,d)&&e[d]&&e[d][0](),e[d]=0;return t.O(i)},f=self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[];f.forEach(a.bind(null,0)),f.push=a.bind(null,f.push.bind(f))})()})(); \ No newline at end of file diff --git a/assets/js/runtime~main.d29c3922.js b/assets/js/runtime~main.d29c3922.js new file mode 100644 index 00000000..5295f8c5 --- /dev/null +++ b/assets/js/runtime~main.d29c3922.js @@ -0,0 +1 @@ +(()=>{"use strict";var e,a,c,d,b,f={},r={};function t(e){var a=r[e];if(void 0!==a)return a.exports;var c=r[e]={exports:{}};return f[e].call(c.exports,c,c.exports,t),c.exports}t.m=f,e=[],t.O=(a,c,d,b)=>{if(!c){var f=1/0;for(i=0;i<e.length;i++){c=e[i][0],d=e[i][1],b=e[i][2];for(var r=!0,o=0;o<c.length;o++)(!1&b||f>=b)&&Object.keys(t.O).every((e=>t.O[e](c[o])))?c.splice(o--,1):(r=!1,b<f&&(f=b));if(r){e.splice(i--,1);var n=d();void 0!==n&&(a=n)}}return a}b=b||0;for(var i=e.length;i>0&&e[i-1][2]>b;i--)e[i]=e[i-1];e[i]=[c,d,b]},t.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return t.d(a,{a:a}),a},c=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,t.t=function(e,d){if(1&d&&(e=this(e)),8&d)return e;if("object"==typeof e&&e){if(4&d&&e.__esModule)return e;if(16&d&&"function"==typeof e.then)return e}var b=Object.create(null);t.r(b);var f={};a=a||[null,c({}),c([]),c(c)];for(var r=2&d&&e;"object"==typeof r&&!~a.indexOf(r);r=c(r))Object.getOwnPropertyNames(r).forEach((a=>f[a]=()=>e[a]));return f.default=()=>e,t.d(b,f),b},t.d=(e,a)=>{for(var c in a)t.o(a,c)&&!t.o(e,c)&&Object.defineProperty(e,c,{enumerable:!0,get:a[c]})},t.f={},t.e=e=>Promise.all(Object.keys(t.f).reduce(((a,c)=>(t.f[c](e,a),a)),[])),t.u=e=>"assets/js/"+({53:"935f2afb",274:"016a0787",620:"2bc2e36b",623:"9e6fe7cf",676:"3d2f5b0c",740:"f8d4e457",909:"bd9b9d52",917:"ca36df4d",1059:"7d03ccaf",1422:"62b99870",1494:"388041ab",1591:"9ed3ab78",2089:"0ae704f7",2107:"8e991452",2359:"48e2ebd6",2399:"8ad68633",2706:"4c7e7ada",2870:"5f289fb7",2959:"68ec37cc",3007:"04da11da",3257:"82a9b669",3306:"164327b9",4197:"7a2568c4",4248:"8333c691",4274:"7390b81e",4452:"bc4edc5c",4622:"d8837387",4729:"c76cc2e3",4738:"496dcc30",4758:"68e1906b",4790:"b97d8256",4861:"db8ccf76",4943:"dabee7bd",5572:"be3f5c40",5673:"fef7d16c",5729:"4513d9f5",5751:"fd4f5a0c",5758:"71880105",5989:"2452d5f5",6161:"3b1dfe68",6345:"a2bea3ed",6388:"eb2a6637",6403:"475d163e",6477:"05cc1716",6531:"c01cce30",6691:"cb962766",6794:"b28a365a",6971:"c377a04b",7310:"fb18633e",7386:"3aa512bf",7505:"8d193b98",7539:"e7bd9b37",7720:"bdfc7662",7742:"87499f15",7865:"9a3629a6",7918:"17896441",7920:"1a4e3797",7949:"0e6b6dd1",7988:"742a9bdc",8051:"dadaca00",8308:"4232c3ed",8358:"7794a932",8469:"93422b31",8732:"e4904969",8784:"d47a3664",8794:"af6aab29",9157:"c526a898",9323:"8333ea4d",9514:"1be78505",9831:"5925ce9f",9886:"8b55bf27"}[e]||e)+"."+{53:"20a4105a",274:"589d8079",620:"12a6b370",623:"c549f588",676:"e9f6457c",740:"cd004603",909:"1a1bfa13",917:"5c72c081",1059:"f4975a35",1422:"ede91e5e",1494:"a8d860d1",1591:"3b5f30f7",2089:"d05f7990",2107:"dfa38d18",2359:"0b6ce575",2399:"e365f7fa",2706:"33f8371a",2870:"118b786b",2959:"692a6380",3007:"4b3bbe99",3257:"9b40e2f4",3306:"ce557677",3373:"e9e6108d",4197:"9b5d7c19",4248:"c1d9f65e",4274:"1668d251",4452:"853a74c1",4622:"cbb6525d",4729:"5381dbe2",4738:"29121ef9",4758:"8899b955",4790:"adee9dc9",4861:"18592c1d",4943:"647618a7",4972:"ea87a18a",5572:"c88245c9",5673:"3a854bb7",5729:"6e9469f3",5751:"7de9809a",5758:"38008cd0",5989:"90d30d71",6161:"acf67d2c",6345:"7b70d96c",6388:"409557c9",6403:"ea0532e5",6477:"3b4c86e1",6531:"1810b6cb",6691:"d729d41c",6780:"3e547342",6794:"9d9c87da",6945:"19e06702",6971:"de18b94b",7310:"f01566da",7386:"f1ba8026",7505:"5fd9290f",7539:"76164cf5",7720:"8583c2cb",7742:"8912c8b7",7865:"7e9aa52d",7918:"881624b3",7920:"615c0dbb",7949:"a5062737",7988:"3d1914e6",8051:"ca5007fb",8308:"1e04009f",8358:"84b8d000",8469:"e6d20241",8732:"cad57b1a",8784:"2e54129a",8794:"81f5f011",8894:"7d968ee6",9157:"d1a213c9",9323:"a3dd6a75",9514:"fa7071eb",9831:"e1fc4851",9886:"b92b9eb6"}[e]+".js",t.miniCssF=e=>{},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),d={},b="dasarpemrogramanrust:",t.l=(e,a,c,f)=>{if(d[e])d[e].push(a);else{var r,o;if(void 0!==c)for(var n=document.getElementsByTagName("script"),i=0;i<n.length;i++){var u=n[i];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==b+c){r=u;break}}r||(o=!0,(r=document.createElement("script")).charset="utf-8",r.timeout=120,t.nc&&r.setAttribute("nonce",t.nc),r.setAttribute("data-webpack",b+c),r.src=e),d[e]=[a];var l=(a,c)=>{r.onerror=r.onload=null,clearTimeout(s);var b=d[e];if(delete d[e],r.parentNode&&r.parentNode.removeChild(r),b&&b.forEach((e=>e(c))),a)return a(c)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=l.bind(null,r.onerror),r.onload=l.bind(null,r.onload),o&&document.head.appendChild(r)}},t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.p="/",t.gca=function(e){return e={17896441:"7918",71880105:"5758","935f2afb":"53","016a0787":"274","2bc2e36b":"620","9e6fe7cf":"623","3d2f5b0c":"676",f8d4e457:"740",bd9b9d52:"909",ca36df4d:"917","7d03ccaf":"1059","62b99870":"1422","388041ab":"1494","9ed3ab78":"1591","0ae704f7":"2089","8e991452":"2107","48e2ebd6":"2359","8ad68633":"2399","4c7e7ada":"2706","5f289fb7":"2870","68ec37cc":"2959","04da11da":"3007","82a9b669":"3257","164327b9":"3306","7a2568c4":"4197","8333c691":"4248","7390b81e":"4274",bc4edc5c:"4452",d8837387:"4622",c76cc2e3:"4729","496dcc30":"4738","68e1906b":"4758",b97d8256:"4790",db8ccf76:"4861",dabee7bd:"4943",be3f5c40:"5572",fef7d16c:"5673","4513d9f5":"5729",fd4f5a0c:"5751","2452d5f5":"5989","3b1dfe68":"6161",a2bea3ed:"6345",eb2a6637:"6388","475d163e":"6403","05cc1716":"6477",c01cce30:"6531",cb962766:"6691",b28a365a:"6794",c377a04b:"6971",fb18633e:"7310","3aa512bf":"7386","8d193b98":"7505",e7bd9b37:"7539",bdfc7662:"7720","87499f15":"7742","9a3629a6":"7865","1a4e3797":"7920","0e6b6dd1":"7949","742a9bdc":"7988",dadaca00:"8051","4232c3ed":"8308","7794a932":"8358","93422b31":"8469",e4904969:"8732",d47a3664:"8784",af6aab29:"8794",c526a898:"9157","8333ea4d":"9323","1be78505":"9514","5925ce9f":"9831","8b55bf27":"9886"}[e]||e,t.p+t.u(e)},(()=>{var e={1303:0,532:0};t.f.j=(a,c)=>{var d=t.o(e,a)?e[a]:void 0;if(0!==d)if(d)c.push(d[2]);else if(/^(1303|532)$/.test(a))e[a]=0;else{var b=new Promise(((c,b)=>d=e[a]=[c,b]));c.push(d[2]=b);var f=t.p+t.u(a),r=new Error;t.l(f,(c=>{if(t.o(e,a)&&(0!==(d=e[a])&&(e[a]=void 0),d)){var b=c&&("load"===c.type?"missing":c.type),f=c&&c.target&&c.target.src;r.message="Loading chunk "+a+" failed.\n("+b+": "+f+")",r.name="ChunkLoadError",r.type=b,r.request=f,d[1](r)}}),"chunk-"+a,a)}},t.O.j=a=>0===e[a];var a=(a,c)=>{var d,b,f=c[0],r=c[1],o=c[2],n=0;if(f.some((a=>0!==e[a]))){for(d in r)t.o(r,d)&&(t.m[d]=r[d]);if(o)var i=o(t)}for(a&&a(c);n<f.length;n++)b=f[n],t.o(e,b)&&e[b]&&e[b][0](),e[b]=0;return t.O(i)},c=self.webpackChunkdasarpemrogramanrust=self.webpackChunkdasarpemrogramanrust||[];c.forEach(a.bind(null,0)),c.push=a.bind(null,c.push.bind(c))})()})(); \ No newline at end of file diff --git a/basic/advanced-traits.html b/basic/advanced-traits.html index 603f73c2..3469a544 100644 --- a/basic/advanced-traits.html +++ b/basic/advanced-traits.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/advanced-traits/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/advanced-traits/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.37. Traits ➜ Advanced","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/advanced-traits/#webpage"},"wordCount":1082,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/advanced-traits/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/advanced-traits/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/advanced-traits","name":"A.37. Traits ➜ Advanced","description":"Chapter ini merupakan kelanjutan dari chapter sebelumnya. Di sini kita fokus ke pembuatan local trait, macam-macam implementasi traits, traits bound syntax, associated types, dan topik yang masih relevan dengan traits lainnya.","datePublished":"2024-08-01T10:17:27.751Z","dateModified":"2024-08-01T10:17:27.751Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/advanced-traits/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/advanced-traits"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/advanced-traits/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.37. Traits ➜ Advanced","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/advanced-traits/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/advanced-traits/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.37. Traits ➜ Advanced","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/advanced-traits/#webpage"},"wordCount":1082,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/advanced-traits/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/advanced-traits/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/advanced-traits","name":"A.37. Traits ➜ Advanced","description":"Chapter ini merupakan kelanjutan dari chapter sebelumnya. Di sini kita fokus ke pembuatan local trait, macam-macam implementasi traits, traits bound syntax, associated types, dan topik yang masih relevan dengan traits lainnya.","datePublished":"2024-08-30T07:44:47.871Z","dateModified":"2024-08-30T07:44:47.871Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/advanced-traits/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/advanced-traits"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/advanced-traits/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.37. Traits ➜ Advanced","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.37. Traits ➜ Advanced</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.37. Traits ➜ Advanced</h1></header><p>Chapter ini merupakan kelanjutan dari chapter sebelumnya. Di sini kita fokus ke pembuatan local trait, macam-macam implementasi traits, traits bound syntax, associated types, dan topik yang masih relevan dengan traits lainnya.</p><p>Pembahasan lanjutan mengenai traits ini cukup panjang. Makin mendekati akhir pembahasan, makin berat topik yang dibahas. Penulis anjurkan jika diperlukan, silakan mengulang-ulang chapter ini, atau bisa lanjut ke chapter berikutnya dan nanti kembali lagi ke sini ketika sudah siap.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a371-membuat-custom-trait-local-trait">A.37.1. Membuat custom trait (local trait)<a class="hash-link" href="#a371-membuat-custom-trait-local-trait" title="Direct link to heading">​</a></h2><p>Pada bagian ini kita akan belajar tentang cara membuat definisi trait di local crate dalam project yang sedang dikerjakan.</p><p>Masih sama dengan sebelum-sebelumnya, pembelajaran dilakukan dengan praktik. Kita gunakan skenario praktik berikut pada program selanjutnya:</p><ol><li>Buat struct bernama <code>Circle</code>.</li><li>Buat struct bernama <code>Square</code>.</li><li>Buat trait bernama <code>Area</code> dengan isi satu buah method untuk menghitung luas bangun datar (method <code>calculate_area()</code>).</li><li>Implementasikan trait <code>Area</code> ke dua struct tersebut.</li></ol><p>Ok, mari mulai praktikkan skenario di atas. Pertama siapkan project dengan struktur berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── calculation_spec.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── two_dimensional.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── main.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Module <code>calculation_spec</code> berisi definisi trait <code>Area</code>. Trait ini punya visibility akses publik, isinya hanya satu buah definisi method header bernama <code>calculate_area()</code>. Trait ini nantinya diimplementasikan ke struct <code>Circle</code> dan juga <code>Square</code>, agar nantinya kedua struct tersebut memiliki method <code>calculate_area()</code> yang berguna untuk kalkulasi luas bangun datar 2d.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/calculation_spec.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">trait</span><span class="token plain"> </span><span class="token type-definition class-name">Area</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kemudian siapkan file <code>two_dimensional</code>, isinya dua buah struct: <code>Circle</code> dan <code>Square</code>. Pada file yang sama, siapkan juga block kode implementasi trait <code>Area</code>. Dengan ini maka kedua struct tersebut wajib untuk memiliki method bernama <code>calculate_area()</code> dengan isi adalah operasi perhitungan aritmatika untuk mencari luas bangun datar.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/two_dimensional.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> radius</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">calculation_spec</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// PI * (r ^ 2)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ada operasi casting ke tipe f64 karena self.radius bertipe i32</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">radius</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Square</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">calculation_spec</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Square</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// (s ^ 2)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ada operasi casting ke tipe f64 karena self.length bertipe i32</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">length</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat pada kode di atas, deklarasi struct beserta property memiliki visibility publik. Idealnya, saat sturct tersebut digunakan di fungsi <code>main</code> nantinya tidak akan ada error terkait visibility akses.</p><p>Selanjutnya, pada file <code>main.rs</code> siapkan kode yang isinya registrasi module <code>calculate_spec</code> dan <code>two_dimensional</code>, juga definisi fungsi <code>main</code> dengan isi statement pembuatan 2 variabel object untuk masing-masing tipe data struct <code>Circle</code> dan <code>Square</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">calculation_spec</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">two_dimensional</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> circle_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">two_dimensional</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Circle</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> radius</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"circle area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> circle_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> square_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">two_dimensional</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Square</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"square area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> square_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Method <code>calculate_area()</code> milik object bertipe <code>Circle</code> dan <code>Square</code> diakses untuk kemudian di-print.</p><p>Coba jalankan program.</p><p><img loading="lazy" alt="Trait" src="/assets/images/traits-5-29be804051729f23db8dd64e978e2398.png" width="655" height="756" class="img_ev3q"></p><p>Hmm, error. Padahal trait <code>Area</code> sudah publik, dan struct <code>Circle</code> & <code>Square</code> beserta property-nya juga sudah publik. Tapi masih error.</p><p>Error ini disebabkan oleh trait <code>Area</code> yang belum di-import di crate root (main). Meskipun kita tidak mengakses trait tersebut secara langsung (melainkan via method <code>calculate_area()</code> milik struct <code>Circle</code> dan <code>Square</code>), diharuskan untuk meng-import-nya juga.</p><blockquote><p>Detail error beserta solusi dari error ini sebenarnya bisa dilihat di error message. Bagaimana Rust menginformasikan error sangat luar biasa informatif.</p></blockquote><p>Ok, sekarang ubah isi file <code>main.rs</code> menjadi seperti ini, kemudian jalankan ulang program. Hasilnya tidak ada error.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">calculation_spec</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">two_dimensional</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">calculation_spec</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Area</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <------- tambahkan statement import module</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> circle_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">two_dimensional</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Circle</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> radius</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"circle area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> circle_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> square_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">two_dimensional</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Square</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"square area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> square_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>O iya, ada beberapa hal baru pada penerapan kode di atas, berikut adalah pembahasannya:</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-pow-untuk-operasi-pangkat">◉ Method <code>pow</code> untuk operasi pangkat<a class="hash-link" href="#-method-pow-untuk-operasi-pangkat" title="Direct link to heading">​</a></h3><p>Method <code>pow</code> adalah item milik tipe data numerik (<code>i8</code>, <code>i16</code>, <code>i32</code>, ...) yang fungsinya untuk operasi pangkat.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ===> 3 pangkat 2</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ===> 8 pangkat 5</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-keyword-as-untuk-casting-tipe-data">◉ Keyword <code>as</code> untuk casting tipe data<a class="hash-link" href="#-keyword-as-untuk-casting-tipe-data" title="Direct link to heading">​</a></h3><p>Keyword <code>as</code> digunakan untuk casting tipe data. Keyword ini bisa diterapkan pada beberapa jenis tipe data, salah satunya adalah semua tipe data numerik.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token number" style="color:#36acaa">1024</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ===> 1024 dikonversi ke tipe f32, hasinya adalah 1024.0</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token number" style="color:#36acaa">3.14</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ===> 3.14 dikonversi ke tipe i32, hasinya 3 karena ada pembulatan</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a372-trait-sebagai-tipe-parameter">A.37.2. Trait sebagai tipe parameter<a class="hash-link" href="#a372-trait-sebagai-tipe-parameter" title="Direct link to heading">​</a></h2><p>Trait bisa digunakan sebagai tipe data parameter sebuah fungsi, contoh notasi penulisannya bisa dilihat pada kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_and_print_result</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Manfaat penerapan trait sebagai tipe data parameter fungsi adalah saat pemanggilan fungsi, parameter tersebut bisa diisi dengan argument data bertipe apapun dengan catatan tipe dari data tersebut mengimplementasikan trait yang sama dengan yang digunakan pada parameter.</p><p>Contohnya seperti pada fungsi <code>calculate_and_print_result</code> di atas yang parameter ke-2 bertipe <code>&impl Area</code>, nantinya saat fungsi tersebut dipanggil, kita bisa sisipi parameter ke-2 dengan object <code>circle_one</code> ataupun <code>circle_two</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> circle_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">two_dimensional</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Circle</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> radius</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">calculate_and_print_result</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"circle"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">circle_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> square_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">two_dimensional</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Square</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">calculate_and_print_result</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"square"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">square_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p><code>&impl Area</code> ini tipe data pointer ya, tipe non-pointer-nya adalah <code>impl Area</code>. Di sini digunakan tipe data pointer untuk antisipasi <em>move semantics</em> pada tipe data custom type (borrowing).</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a373-parameter-bertipe-lebih-dari-1-trait">A.37.3. Parameter bertipe lebih dari 1 trait<a class="hash-link" href="#a373-parameter-bertipe-lebih-dari-1-trait" title="Direct link to heading">​</a></h2><p>Bagaimana jika, parameter fungsi <code>item</code> di atas tipenya bisa lebih dari 1 trait, misalnya trait <code>Area</code> dan <code>Circumference</code>, apakah bisa? Jawabannya bisa.</p><p>Mari praktekan. Lakukan modifikasi berikut pada beberapa kode yang telah di tulis.</p><ul><li><p>File <code>src/calculation_spec.rs</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// tambahkan ⬇️</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">trait</span><span class="token plain"> </span><span class="token type-definition class-name">Circumference</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_circumference</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>File <code>src/two_dimensional.rs</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// tambahkan ⬇️</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">calculation_spec</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Circumference</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_circumference</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">2.0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">radius</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">calculation_spec</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Circumference</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Square</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_circumference</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">4.0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">length</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>File <code>src/main.rs</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// tambahkan ⬇️</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">calculation_spec</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Circumference</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_and_print_result</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Circumference</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} circumference: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_circumference</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><p>Dengan perubahan kode yang telah dilakukan di atas, parameter <code>item</code> milik fungsi <code>calculate_and_print_result()</code> bisa diisi dengan nilai argument apapun asalkan memenuhi kriteria tipe yang ditentukan, yaitu: haruse meng-implement trait <code>Area</code> dan trait <code>Circumference</code>.</p><p>Notasi penulisan tipe-datanya <code>&(impl Trait1 + Trait2 + Trait3 + ...)</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a374-trait-bound-syntax">A.37.4. Trait bound syntax<a class="hash-link" href="#a374-trait-bound-syntax" title="Direct link to heading">​</a></h2><p>Penerapan trait sebagai parameter fungsi juga bisa dituliskan dalam notasi yang memanfaatkan generic. Teknik penulisan ini disebut dengan <em>trait bound syntax</em>.</p><p>Contohnya bisa dilihat pada kode berikut. Ada generic bernama <code>T</code> yang merepresentasikan trait <code>Area</code>, kemudian pada definisi parameter ke-2 fungsi (yaitu parameter <code>item</code>) tipenya menggunakan <code>&T</code>. Tipe <code>&T</code> di sini adalah ekuivalen dengan <code>&impl Area</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_and_print_result2</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jika ada lebih dari satu trait yang digunakan sebagai tipe data paramater, maka penulisannya seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_and_print_result3</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Circumference</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} circumference: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_circumference</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Satu tambahan contoh lagi untuk ilustrasi yang lebih kompleks:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">some_function</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Display</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Clone</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">U</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Clone</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Debug</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">t</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> u</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">U</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas fungsi <code>some_function()</code> memiliki 2 generics param, yaitu <code>T</code> dan <code>U</code>.</p><ul><li><code>T</code> merepresentasikan trait <code>Display</code> dan <code>Clone</code></li><li><code>U</code> merepresentasikan trait <code>Clone</code> dan <code>Debug</code></li></ul><blockquote><p>Lebih jelasnya mengenai generics dibahas pada chapter <a href="/basic/generics">Generics</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a375-trait-where-clause">A.37.5. Trait <code>where</code> clause<a class="hash-link" href="#a375-trait-where-clause" title="Direct link to heading">​</a></h2><p>Ada lagi alternatif penulisan trait bound syntax, yaitu menggunakan keyword <code>where</code>. Contoh pengaplikasiannya bisa dilihat pada kode berikut. Semua definisi fungsi di bawah ini adalah ekuivalen.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_and_print_result4</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Circumference</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_and_print_result5</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Circumference</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ... other generic params if exists</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Lebih jelasnya mengenai generics dibahas pada chapter <a href="/basic/generics">Generics</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a376-trait-sebagai-return-type">A.37.6. Trait sebagai return type<a class="hash-link" href="#a376-trait-sebagai-return-type" title="Direct link to heading">​</a></h2><p>Trait bisa juga digunakan sebagai tipe data return value. Caranya gunakan notasi penulisan <code>impl NamaTrait</code> sebagai tipe data.</p><p>Contohnya bisa dilihat pada kode berikut. Ada dua fungsi baru dideklarasikan:</p><ol><li>Fungsi <code>new_circle</code> dengan return type adalah <code>impl Area</code>, dan data yang dikembalikan adalah bertipe <code>two_dimensional::Circle</code>.</li><li>Fungsi <code>new_square</code> dengan return type adalah <code>impl Area + Circumference</code>, dan data yang dikembalikan adalah bertipe <code>two_dimensional::Square</code>.</li></ol><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> circle_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">new_circle</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">calculate_and_print_result6</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"circle"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">circle_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> square_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">new_square</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">calculate_and_print_result7</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"square"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">square_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new_circle</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">radius</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">two_dimensional</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Circle</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> radius</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> data</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new_square</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Circumference</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">two_dimensional</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Square</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> length</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_and_print_result6</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_and_print_result7</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Circumference</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} circumference: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_circumference</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Salah satu konsekuensi dalam penerapan trait sebagai return type adalah: tipe data milik nilai yang dikembalikan terdeteksi sebagai tipe trait. Contohnya variabel <code>circle_one</code> di atas, tipe data-nya bukan <code>Circle</code>, melainkan <code>impl Area</code>.</p><p>Tipe data aslinya tetap bisa diakses, tapi butuh tambahan effort. Lebih jelasnya dibahas pada chapter <a href="#/wip/trait-conversion-from-into">Trait ➜ Conversion (From & Into)</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a377-associated-types-pada-trait">A.37.7. <em>Associated types</em> pada trait<a class="hash-link" href="#a377-associated-types-pada-trait" title="Direct link to heading">​</a></h2><p>Associated types adalah tipe data yang didefinisikan di dalam suatu trait. Associated types tidak tidak memiliki tipe data konkret saat didefinisikan, namun ketika trait di-implementasikan maka tipe tersebut harus ditentukan tipe data konkritnya.</p><p>Lebih jelas silakan perhatikan kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">trait</span><span class="token plain"> </span><span class="token type-definition class-name">Shape</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">type</span><span class="token plain"> </span><span class="token type-definition class-name">Area</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Area</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada definisi trait <code>Shape</code> di atas, yang disebut dengan associated types adalah tipe <code>Area</code> yang definisinya berada dalam block trait. Tipe didefinisikan tanpa assignment operator, jadi tidak ada tipe data konkretnya.</p><p>Associated types ini sering digunakan pada Rust programming.</p><p>Lanjut skenario praktek berikutnya. Silakan siapkan package/project baru dengan struktur seperti ini:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── shape.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── circle.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── square.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── main.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Disiapkan suatu trait bernama <code>shape::Shape</code>.<ul><li>Trait ini memiliki satu associated types bernama <code>Area</code>.</li><li>Dan memiliki sebuah definisi method header <code>area</code> yang gunanya untuk menghitung luas bangun datar (<em>shape</em>).</li></ul></li><li>Disiapkan struct <code>circle::Circle</code> yang mengadopsi trait <code>shape::Shape</code>.</li><li>Disiapkan struct <code>square::Square</code> yang mengadopsi trait <code>shape::Shape</code>.</li></ul><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/shape.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">trait</span><span class="token plain"> </span><span class="token type-definition class-name">Shape</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">type</span><span class="token plain"> </span><span class="token type-definition class-name">Area</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Area</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Trait <code>Shape</code> di atas spesifikasinya mirip seperti pada contoh sebelumnya, hanya saja kali ini trait-nya di set public agar bisa diakses dari <code>main.rs</code> nantinya.</p><p>Trait <code>Shape</code> kemudian di-implementasikan ke struct <code>Circle</code> dan <code>Square</code>, kode-nya bisa dilihat berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/circle.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> radius</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">shape</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Shape</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">type</span><span class="token plain"> </span><span class="token type-definition class-name">Area</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">::</span><span class="token namespace" style="opacity:0.7">consts</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token constant" style="color:#36acaa">PI</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">radius </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">radius</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/square.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Square</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> side</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">shape</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Shape</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Square</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">type</span><span class="token plain"> </span><span class="token type-definition class-name">Area</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i64</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">side </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">side</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat pada kedua implementasi di atas, associated type <code>Area</code> diisi dengan tipe concrete, yaitu:</p><ul><li>Tipe data <code>f64</code> sebagai tipe concrete <code>circle:Circle:Area</code></li><li>Tipe data <code>i64</code> sebagai tipe concrete <code>square:Square:Area</code></li></ul><blockquote><p>Contoh di atas adalah cara pengaplikasian associated types.</p></blockquote><p>Lalu pada <code>main.rs</code>, tipe data struct <code>circle::Circle</code> dan <code>square::Square</code> digunakan untuk membuat variabel baru, yang kemudian dari variabel tersebut, method <code>.area()</code> milik diakses.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">shape</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">circle</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">square</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">shape</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Shape</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> obj1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">circle</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Circle</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> radius</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10.0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"area of circle: {:.2}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> obj1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> obj2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">square</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Square</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> side</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"area of square: {:}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> obj2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Silakan jalankan program dan lihat hasilnya.</p><p><img loading="lazy" alt="Trait" src="/assets/images/traits-6-8165525fc9f8604bf115634eeb974230.png" width="469" height="130" class="img_ev3q"></p><p>O iya, pada <code>main.rs</code>, module item <code>shape::Shape</code> perlu di-import meskipun kita tidak menggunakan <code>trait</code> tersebut secara langsung. Jika tidak di-import, maka method <code>.area()</code> milik <code>Circle</code> dan <code>Square</code> tidak bisa diakses.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a378-attribute-derive">A.37.8. Attribute <code>derive</code><a class="hash-link" href="#a378-attribute-derive" title="Direct link to heading">​</a></h2><p>Ada cara lain untuk mengimplementasikan suatu trait ke dalam tipe data selain dengan menuliskan implementasinya secara eksplist, caranya menggunakan attribute <code>derive</code>.</p><p>Lebih detailnya dibahas pada chapter <a href="/basic/attributes">Attributes</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/advanced_traits" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../advanced_traits</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-work-in-progress">◉ Work in progress<a class="hash-link" href="#-work-in-progress" title="Direct link to heading">​</a></h3><ul><li>Pembahasan tentang trait bounds untuk implementasi method kondisional</li><li>Pembahasan tentang trait overloading</li><li>orphan rules</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch10-02-traits.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch10-02-traits.html</a></li><li><a href="https://doc.rust-lang.org/std/primitive.i32.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/primitive.i32.html</a></li><li><a href="https://doc.rust-lang.org/std/fmt/trait.Debug.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/fmt/trait.Debug.html</a></li><li><a href="https://doc.rust-lang.org/std/fmt/trait.Display.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/fmt/trait.Display.html</a></li><li><a href="https://doc.rust-lang.org/std/string/struct.String.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/string/struct.String.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/traits"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.36. Traits</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/generics"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.38. Generics</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a371-membuat-custom-trait-local-trait" class="table-of-contents__link toc-highlight">A.37.1. Membuat custom trait (local trait)</a><ul><li><a href="#-method-pow-untuk-operasi-pangkat" class="table-of-contents__link toc-highlight">◉ Method <code>pow</code> untuk operasi pangkat</a></li><li><a href="#-keyword-as-untuk-casting-tipe-data" class="table-of-contents__link toc-highlight">◉ Keyword <code>as</code> untuk casting tipe data</a></li></ul></li><li><a href="#a372-trait-sebagai-tipe-parameter" class="table-of-contents__link toc-highlight">A.37.2. Trait sebagai tipe parameter</a></li><li><a href="#a373-parameter-bertipe-lebih-dari-1-trait" class="table-of-contents__link toc-highlight">A.37.3. Parameter bertipe lebih dari 1 trait</a></li><li><a href="#a374-trait-bound-syntax" class="table-of-contents__link toc-highlight">A.37.4. Trait bound syntax</a></li><li><a href="#a375-trait-where-clause" class="table-of-contents__link toc-highlight">A.37.5. Trait <code>where</code> clause</a></li><li><a href="#a376-trait-sebagai-return-type" class="table-of-contents__link toc-highlight">A.37.6. Trait sebagai return type</a></li><li><a href="#a377-associated-types-pada-trait" class="table-of-contents__link toc-highlight">A.37.7. <em>Associated types</em> pada trait</a></li><li><a href="#a378-attribute-derive" class="table-of-contents__link toc-highlight">A.37.8. Attribute <code>derive</code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-work-in-progress" class="table-of-contents__link toc-highlight">◉ Work in progress</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.37. Traits ➜ Advanced</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.37. Traits ➜ Advanced</h1></header><p>Chapter ini merupakan kelanjutan dari chapter sebelumnya. Di sini kita fokus ke pembuatan local trait, macam-macam implementasi traits, traits bound syntax, associated types, dan topik yang masih relevan dengan traits lainnya.</p><p>Pembahasan lanjutan mengenai traits ini cukup panjang. Makin mendekati akhir pembahasan, makin berat topik yang dibahas. Penulis anjurkan jika diperlukan, silakan mengulang-ulang chapter ini, atau bisa lanjut ke chapter berikutnya dan nanti kembali lagi ke sini ketika sudah siap.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a371-membuat-custom-trait-local-trait">A.37.1. Membuat custom trait (local trait)<a class="hash-link" href="#a371-membuat-custom-trait-local-trait" title="Direct link to heading">​</a></h2><p>Pada bagian ini kita akan belajar tentang cara membuat definisi trait di local crate dalam project yang sedang dikerjakan.</p><p>Masih sama dengan sebelum-sebelumnya, pembelajaran dilakukan dengan praktik. Kita gunakan skenario praktik berikut pada program selanjutnya:</p><ol><li>Buat struct bernama <code>Circle</code>.</li><li>Buat struct bernama <code>Square</code>.</li><li>Buat trait bernama <code>Area</code> dengan isi satu buah method untuk menghitung luas bangun datar (method <code>calculate_area()</code>).</li><li>Implementasikan trait <code>Area</code> ke dua struct tersebut.</li></ol><p>Ok, mari mulai praktikkan skenario di atas. Pertama siapkan project dengan struktur berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── calculation_spec.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── two_dimensional.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── main.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Module <code>calculation_spec</code> berisi definisi trait <code>Area</code>. Trait ini punya visibility akses publik, isinya hanya satu buah definisi method header bernama <code>calculate_area()</code>. Trait ini nantinya diimplementasikan ke struct <code>Circle</code> dan juga <code>Square</code>, agar nantinya kedua struct tersebut memiliki method <code>calculate_area()</code> yang berguna untuk kalkulasi luas bangun datar 2d.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/calculation_spec.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">trait</span><span class="token plain"> </span><span class="token type-definition class-name">Area</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kemudian siapkan file <code>two_dimensional</code>, isinya dua buah struct: <code>Circle</code> dan <code>Square</code>. Pada file yang sama, siapkan juga block kode implementasi trait <code>Area</code>. Dengan ini maka kedua struct tersebut wajib untuk memiliki method bernama <code>calculate_area()</code> dengan isi adalah operasi perhitungan aritmatika untuk mencari luas bangun datar.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/two_dimensional.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> radius</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">calculation_spec</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// PI * (r ^ 2)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ada operasi casting ke tipe f64 karena self.radius bertipe i32</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">radius</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Square</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">calculation_spec</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Square</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// (s ^ 2)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ada operasi casting ke tipe f64 karena self.length bertipe i32</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">length</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat pada kode di atas, deklarasi struct beserta property memiliki visibility publik. Idealnya, saat sturct tersebut digunakan di fungsi <code>main</code> nantinya tidak akan ada error terkait visibility akses.</p><p>Selanjutnya, pada file <code>main.rs</code> siapkan kode yang isinya registrasi module <code>calculate_spec</code> dan <code>two_dimensional</code>, juga definisi fungsi <code>main</code> dengan isi statement pembuatan 2 variabel object untuk masing-masing tipe data struct <code>Circle</code> dan <code>Square</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">calculation_spec</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">two_dimensional</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> circle_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">two_dimensional</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Circle</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> radius</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"circle area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> circle_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> square_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">two_dimensional</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Square</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"square area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> square_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Method <code>calculate_area()</code> milik object bertipe <code>Circle</code> dan <code>Square</code> diakses untuk kemudian di-print.</p><p>Coba jalankan program.</p><p><img loading="eager" fetchpriority="high" alt="Trait" src="/assets/images/traits-5-29be804051729f23db8dd64e978e2398.png" width="655" height="756" class="img_CujE"></p><p>Hmm, error. Padahal trait <code>Area</code> sudah publik, dan struct <code>Circle</code> & <code>Square</code> beserta property-nya juga sudah publik. Tapi masih error.</p><p>Error ini disebabkan oleh trait <code>Area</code> yang belum di-import di crate root (main). Meskipun kita tidak mengakses trait tersebut secara langsung (melainkan via method <code>calculate_area()</code> milik struct <code>Circle</code> dan <code>Square</code>), diharuskan untuk meng-import-nya juga.</p><blockquote><p>Detail error beserta solusi dari error ini sebenarnya bisa dilihat di error message. Bagaimana Rust menginformasikan error sangat luar biasa informatif.</p></blockquote><p>Ok, sekarang ubah isi file <code>main.rs</code> menjadi seperti ini, kemudian jalankan ulang program. Hasilnya tidak ada error.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">calculation_spec</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">two_dimensional</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">calculation_spec</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Area</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <------- tambahkan statement import module</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> circle_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">two_dimensional</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Circle</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> radius</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"circle area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> circle_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> square_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">two_dimensional</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Square</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"square area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> square_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>O iya, ada beberapa hal baru pada penerapan kode di atas, berikut adalah pembahasannya:</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-pow-untuk-operasi-pangkat">◉ Method <code>pow</code> untuk operasi pangkat<a class="hash-link" href="#-method-pow-untuk-operasi-pangkat" title="Direct link to heading">​</a></h3><p>Method <code>pow</code> adalah item milik tipe data numerik (<code>i8</code>, <code>i16</code>, <code>i32</code>, ...) yang fungsinya untuk operasi pangkat.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ===> 3 pangkat 2</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ===> 8 pangkat 5</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-keyword-as-untuk-casting-tipe-data">◉ Keyword <code>as</code> untuk casting tipe data<a class="hash-link" href="#-keyword-as-untuk-casting-tipe-data" title="Direct link to heading">​</a></h3><p>Keyword <code>as</code> digunakan untuk casting tipe data. Keyword ini bisa diterapkan pada beberapa jenis tipe data, salah satunya adalah semua tipe data numerik.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token number" style="color:#36acaa">1024</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ===> 1024 dikonversi ke tipe f32, hasinya adalah 1024.0</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token number" style="color:#36acaa">3.14</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ===> 3.14 dikonversi ke tipe i32, hasinya 3 karena ada pembulatan</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a372-trait-sebagai-tipe-parameter">A.37.2. Trait sebagai tipe parameter<a class="hash-link" href="#a372-trait-sebagai-tipe-parameter" title="Direct link to heading">​</a></h2><p>Trait bisa digunakan sebagai tipe data parameter sebuah fungsi, contoh notasi penulisannya bisa dilihat pada kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_and_print_result</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Manfaat penerapan trait sebagai tipe data parameter fungsi adalah saat pemanggilan fungsi, parameter tersebut bisa diisi dengan argument data bertipe apapun dengan catatan tipe dari data tersebut mengimplementasikan trait yang sama dengan yang digunakan pada parameter.</p><p>Contohnya seperti pada fungsi <code>calculate_and_print_result</code> di atas yang parameter ke-2 bertipe <code>&impl Area</code>, nantinya saat fungsi tersebut dipanggil, kita bisa sisipi parameter ke-2 dengan object <code>circle_one</code> ataupun <code>circle_two</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> circle_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">two_dimensional</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Circle</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> radius</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">calculate_and_print_result</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"circle"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">circle_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> square_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">two_dimensional</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Square</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">calculate_and_print_result</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"square"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">square_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p><code>&impl Area</code> ini tipe data pointer ya, tipe non-pointer-nya adalah <code>impl Area</code>. Di sini digunakan tipe data pointer untuk antisipasi <em>move semantics</em> pada tipe data custom type (borrowing).</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a373-parameter-bertipe-lebih-dari-1-trait">A.37.3. Parameter bertipe lebih dari 1 trait<a class="hash-link" href="#a373-parameter-bertipe-lebih-dari-1-trait" title="Direct link to heading">​</a></h2><p>Bagaimana jika, parameter fungsi <code>item</code> di atas tipenya bisa lebih dari 1 trait, misalnya trait <code>Area</code> dan <code>Circumference</code>, apakah bisa? Jawabannya bisa.</p><p>Mari praktekan. Lakukan modifikasi berikut pada beberapa kode yang telah di tulis.</p><ul><li><p>File <code>src/calculation_spec.rs</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// tambahkan ⬇️</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">trait</span><span class="token plain"> </span><span class="token type-definition class-name">Circumference</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_circumference</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>File <code>src/two_dimensional.rs</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// tambahkan ⬇️</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">calculation_spec</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Circumference</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_circumference</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">2.0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">radius</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">calculation_spec</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Circumference</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Square</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_circumference</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">4.0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">length</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>File <code>src/main.rs</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// tambahkan ⬇️</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">calculation_spec</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Circumference</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_and_print_result</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Circumference</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} circumference: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_circumference</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><p>Dengan perubahan kode yang telah dilakukan di atas, parameter <code>item</code> milik fungsi <code>calculate_and_print_result()</code> bisa diisi dengan nilai argument apapun asalkan memenuhi kriteria tipe yang ditentukan, yaitu: haruse meng-implement trait <code>Area</code> dan trait <code>Circumference</code>.</p><p>Notasi penulisan tipe-datanya <code>&(impl Trait1 + Trait2 + Trait3 + ...)</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a374-trait-bound-syntax">A.37.4. Trait bound syntax<a class="hash-link" href="#a374-trait-bound-syntax" title="Direct link to heading">​</a></h2><p>Penerapan trait sebagai parameter fungsi juga bisa dituliskan dalam notasi yang memanfaatkan generic. Teknik penulisan ini disebut dengan <em>trait bound syntax</em>.</p><p>Contohnya bisa dilihat pada kode berikut. Ada generic bernama <code>T</code> yang merepresentasikan trait <code>Area</code>, kemudian pada definisi parameter ke-2 fungsi (yaitu parameter <code>item</code>) tipenya menggunakan <code>&T</code>. Tipe <code>&T</code> di sini adalah ekuivalen dengan <code>&impl Area</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_and_print_result2</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jika ada lebih dari satu trait yang digunakan sebagai tipe data paramater, maka penulisannya seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_and_print_result3</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Circumference</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} circumference: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_circumference</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Satu tambahan contoh lagi untuk ilustrasi yang lebih kompleks:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">some_function</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Display</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Clone</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">U</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Clone</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Debug</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">t</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> u</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">U</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas fungsi <code>some_function()</code> memiliki 2 generics param, yaitu <code>T</code> dan <code>U</code>.</p><ul><li><code>T</code> merepresentasikan trait <code>Display</code> dan <code>Clone</code></li><li><code>U</code> merepresentasikan trait <code>Clone</code> dan <code>Debug</code></li></ul><blockquote><p>Lebih jelasnya mengenai generics dibahas pada chapter <a href="/basic/generics">Generics</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a375-trait-where-clause">A.37.5. Trait <code>where</code> clause<a class="hash-link" href="#a375-trait-where-clause" title="Direct link to heading">​</a></h2><p>Ada lagi alternatif penulisan trait bound syntax, yaitu menggunakan keyword <code>where</code>. Contoh pengaplikasiannya bisa dilihat pada kode berikut. Semua definisi fungsi di bawah ini adalah ekuivalen.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_and_print_result4</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Circumference</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_and_print_result5</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Circumference</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ... other generic params if exists</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Lebih jelasnya mengenai generics dibahas pada chapter <a href="/basic/generics">Generics</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a376-trait-sebagai-return-type">A.37.6. Trait sebagai return type<a class="hash-link" href="#a376-trait-sebagai-return-type" title="Direct link to heading">​</a></h2><p>Trait bisa juga digunakan sebagai tipe data return value. Caranya gunakan notasi penulisan <code>impl NamaTrait</code> sebagai tipe data.</p><p>Contohnya bisa dilihat pada kode berikut. Ada dua fungsi baru dideklarasikan:</p><ol><li>Fungsi <code>new_circle</code> dengan return type adalah <code>impl Area</code>, dan data yang dikembalikan adalah bertipe <code>two_dimensional::Circle</code>.</li><li>Fungsi <code>new_square</code> dengan return type adalah <code>impl Area + Circumference</code>, dan data yang dikembalikan adalah bertipe <code>two_dimensional::Square</code>.</li></ol><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> circle_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">new_circle</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">calculate_and_print_result6</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"circle"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">circle_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> square_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">new_square</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">calculate_and_print_result7</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"square"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">square_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new_circle</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">radius</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">two_dimensional</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Circle</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> radius</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> data</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new_square</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Circumference</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">two_dimensional</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Square</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> length</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_and_print_result6</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_and_print_result7</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Circumference</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} area: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} circumference: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">calculate_circumference</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Salah satu konsekuensi dalam penerapan trait sebagai return type adalah: tipe data milik nilai yang dikembalikan terdeteksi sebagai tipe trait. Contohnya variabel <code>circle_one</code> di atas, tipe data-nya bukan <code>Circle</code>, melainkan <code>impl Area</code>.</p><p>Tipe data aslinya tetap bisa diakses, tapi butuh tambahan effort. Lebih jelasnya dibahas pada chapter <a href="#/wip/trait-conversion-from-into">Trait ➜ Conversion (From & Into)</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a377-associated-types-pada-trait">A.37.7. <em>Associated types</em> pada trait<a class="hash-link" href="#a377-associated-types-pada-trait" title="Direct link to heading">​</a></h2><p>Associated types adalah tipe data yang didefinisikan di dalam suatu trait. Associated types tidak tidak memiliki tipe data konkret saat didefinisikan, namun ketika trait di-implementasikan maka tipe tersebut harus ditentukan tipe data konkritnya.</p><p>Lebih jelas silakan perhatikan kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">trait</span><span class="token plain"> </span><span class="token type-definition class-name">Shape</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">type</span><span class="token plain"> </span><span class="token type-definition class-name">Area</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Area</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada definisi trait <code>Shape</code> di atas, yang disebut dengan associated types adalah tipe <code>Area</code> yang definisinya berada dalam block trait. Tipe didefinisikan tanpa assignment operator, jadi tidak ada tipe data konkretnya.</p><p>Associated types ini sering digunakan pada Rust programming.</p><p>Lanjut skenario praktek berikutnya. Silakan siapkan package/project baru dengan struktur seperti ini:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── shape.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── circle.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── square.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── main.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Disiapkan suatu trait bernama <code>shape::Shape</code>.<ul><li>Trait ini memiliki satu associated types bernama <code>Area</code>.</li><li>Dan memiliki sebuah definisi method header <code>area</code> yang gunanya untuk menghitung luas bangun datar (<em>shape</em>).</li></ul></li><li>Disiapkan struct <code>circle::Circle</code> yang mengadopsi trait <code>shape::Shape</code>.</li><li>Disiapkan struct <code>square::Square</code> yang mengadopsi trait <code>shape::Shape</code>.</li></ul><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/shape.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">trait</span><span class="token plain"> </span><span class="token type-definition class-name">Shape</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">type</span><span class="token plain"> </span><span class="token type-definition class-name">Area</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Area</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Trait <code>Shape</code> di atas spesifikasinya mirip seperti pada contoh sebelumnya, hanya saja kali ini trait-nya di set public agar bisa diakses dari <code>main.rs</code> nantinya.</p><p>Trait <code>Shape</code> kemudian di-implementasikan ke struct <code>Circle</code> dan <code>Square</code>, kode-nya bisa dilihat berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/circle.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> radius</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">shape</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Shape</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">type</span><span class="token plain"> </span><span class="token type-definition class-name">Area</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">::</span><span class="token namespace" style="opacity:0.7">consts</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token constant" style="color:#36acaa">PI</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">radius </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">radius</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/square.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Square</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> side</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">shape</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Shape</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Square</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">type</span><span class="token plain"> </span><span class="token type-definition class-name">Area</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i64</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Area</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">side </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">side</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat pada kedua implementasi di atas, associated type <code>Area</code> diisi dengan tipe concrete, yaitu:</p><ul><li>Tipe data <code>f64</code> sebagai tipe concrete <code>circle:Circle:Area</code></li><li>Tipe data <code>i64</code> sebagai tipe concrete <code>square:Square:Area</code></li></ul><blockquote><p>Contoh di atas adalah cara pengaplikasian associated types.</p></blockquote><p>Lalu pada <code>main.rs</code>, tipe data struct <code>circle::Circle</code> dan <code>square::Square</code> digunakan untuk membuat variabel baru, yang kemudian dari variabel tersebut, method <code>.area()</code> milik diakses.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">shape</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">circle</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">square</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">shape</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Shape</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> obj1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">circle</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Circle</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> radius</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10.0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"area of circle: {:.2}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> obj1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> obj2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">square</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Square</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> side</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"area of square: {:}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> obj2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">area</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Silakan jalankan program dan lihat hasilnya.</p><p><img loading="lazy" alt="Trait" src="/assets/images/traits-6-8165525fc9f8604bf115634eeb974230.png" width="469" height="130" class="img_CujE"></p><p>O iya, pada <code>main.rs</code>, module item <code>shape::Shape</code> perlu di-import meskipun kita tidak menggunakan <code>trait</code> tersebut secara langsung. Jika tidak di-import, maka method <code>.area()</code> milik <code>Circle</code> dan <code>Square</code> tidak bisa diakses.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a378-attribute-derive">A.37.8. Attribute <code>derive</code><a class="hash-link" href="#a378-attribute-derive" title="Direct link to heading">​</a></h2><p>Ada cara lain untuk mengimplementasikan suatu trait ke dalam tipe data selain dengan menuliskan implementasinya secara eksplist, caranya menggunakan attribute <code>derive</code>.</p><p>Lebih detailnya dibahas pada chapter <a href="/basic/attributes">Attributes</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/advanced_traits" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../advanced_traits</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-work-in-progress">◉ Work in progress<a class="hash-link" href="#-work-in-progress" title="Direct link to heading">​</a></h3><ul><li>Pembahasan tentang trait bounds untuk implementasi method kondisional</li><li>Pembahasan tentang trait overloading</li><li>orphan rules</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch10-02-traits.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch10-02-traits.html</a></li><li><a href="https://doc.rust-lang.org/std/primitive.i32.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/primitive.i32.html</a></li><li><a href="https://doc.rust-lang.org/std/fmt/trait.Debug.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/fmt/trait.Debug.html</a></li><li><a href="https://doc.rust-lang.org/std/fmt/trait.Display.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/fmt/trait.Display.html</a></li><li><a href="https://doc.rust-lang.org/std/string/struct.String.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/string/struct.String.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/traits"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.36. Traits</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/generics"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.38. Generics</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a371-membuat-custom-trait-local-trait" class="table-of-contents__link toc-highlight">A.37.1. Membuat custom trait (local trait)</a><ul><li><a href="#-method-pow-untuk-operasi-pangkat" class="table-of-contents__link toc-highlight">◉ Method <code>pow</code> untuk operasi pangkat</a></li><li><a href="#-keyword-as-untuk-casting-tipe-data" class="table-of-contents__link toc-highlight">◉ Keyword <code>as</code> untuk casting tipe data</a></li></ul></li><li><a href="#a372-trait-sebagai-tipe-parameter" class="table-of-contents__link toc-highlight">A.37.2. Trait sebagai tipe parameter</a></li><li><a href="#a373-parameter-bertipe-lebih-dari-1-trait" class="table-of-contents__link toc-highlight">A.37.3. Parameter bertipe lebih dari 1 trait</a></li><li><a href="#a374-trait-bound-syntax" class="table-of-contents__link toc-highlight">A.37.4. Trait bound syntax</a></li><li><a href="#a375-trait-where-clause" class="table-of-contents__link toc-highlight">A.37.5. Trait <code>where</code> clause</a></li><li><a href="#a376-trait-sebagai-return-type" class="table-of-contents__link toc-highlight">A.37.6. Trait sebagai return type</a></li><li><a href="#a377-associated-types-pada-trait" class="table-of-contents__link toc-highlight">A.37.7. <em>Associated types</em> pada trait</a></li><li><a href="#a378-attribute-derive" class="table-of-contents__link toc-highlight">A.37.8. Attribute <code>derive</code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-work-in-progress" class="table-of-contents__link toc-highlight">◉ Work in progress</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/array.html b/basic/array.html index 9c81a842..23a9b6d7 100644 --- a/basic/array.html +++ b/basic/array.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/array/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/array/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.13. Tipe Data ➜ Array","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/array/#webpage"},"wordCount":1123,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/array/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust","belajar rust","array rust","slice rust"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/array/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/array","name":"A.13. Tipe Data ➜ Array","description":"Belajar array pada rust. Contoh penerapan array, iterasi array, dan operasi lainnya pada array","datePublished":"2024-08-01T10:17:27.911Z","dateModified":"2024-08-01T10:17:27.911Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/array/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/array"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/array/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.13. Tipe Data ➜ Array","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/array/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/array/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.13. Tipe Data ➜ Array","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/array/#webpage"},"wordCount":1123,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/array/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust","belajar rust","array rust","slice rust"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/array/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/array","name":"A.13. Tipe Data ➜ Array","description":"Belajar array pada rust. Contoh penerapan array, iterasi array, dan operasi lainnya pada array","datePublished":"2024-08-30T07:44:48.022Z","dateModified":"2024-08-30T07:44:48.022Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/array/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/array"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/array/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.13. Tipe Data ➜ Array","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.13. Array</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.13. Tipe Data ➜ Array</h1></header><p>Pada chapter awal kita sudah mempelajari tipe data primitif jenis scalar. Selain <em>scalar types</em> ada juga tipe data primitif lainnya yaitu <strong>compound types</strong>. Compound types sendiri adalah jenis tipe data kolektif yang isinya banyak data. Kesemua data tersebut memiliki tipe data yang sama dan di-group menjadi satu.</p><p>Array adalah salah satu tipe data compound yang tersedia di Rust, dan pada chapter ini kita akan mempelajarinya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a131-pengenalan-array">A.13.1. Pengenalan array<a class="hash-link" href="#a131-pengenalan-array" title="Direct link to heading">​</a></h2><p>Menurut dokumentasi official Rust, array adalah:</p><blockquote><p>An array is a collection of objects of the same type T, stored in contiguous memory.</p><p>A fixed-size array, denoted <!-- -->[T; N]<!-- -->, for the element type, T, and the non-negative compile-time constant size, N.</p></blockquote><p>Array (atau <em>fixed size array</em>) adalah kumpulan data dengan tipe sejenis, disimpan dalam 1 variabel. Array memiliki kapasitas yang nilainya ditentukan saat deklarasi/alokasi. Jumlah data dalam array pasti tidak boleh lebih dari kapasitas yang sudah ditentukan di awal. Data dalam array biasa disebut dengan <em>element</em> atau item.</p><p>Ada beberapa notasi deklarasi array yang bisa dipakai, kesemuanya akan dibahas pada chapter ini.</p><p>Ok, Sekarang kita mulai praktik dengan bermain-main terlebih dahulu dengan tipe data array ini. Silakan pelajari dan praktikkan contoh berikut, sebuah program yang isinya menampilkan data array.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> numbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">7</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data0 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"elemen array ke 0 {data0}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"elemen array ke 1 {data1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">16</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array {numbers:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Coba jalankan aplikasi, muncul dua baris output di console.</p><p><img loading="lazy" alt="array" src="/assets/images/array-1-919358da6705a5ced706fbcd108be794.png" width="448" height="164" class="img_ev3q"></p><p>Selanjutnya mari kita bahas dengan detail contoh di atas.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-deklarasi-variabel-array-type-inference">◉ Deklarasi variabel array (<em>type inference</em>)<a class="hash-link" href="#-deklarasi-variabel-array-type-inference" title="Direct link to heading">​</a></h3><p>Variabel <code>numbers</code> dideklarasikan sebagai array <em>mutable</em> dengan metode deklarasi type inference, yang tipe datanya didapat langsung dari nilai.</p><p>Value dari <code>numbers</code> adalah <code>[24, 12, 32, 7]</code>, yang mana artinya sebuah array dengan size 4, bertipe numerik, dengan isi <code>24</code>, <code>12</code>, <code>32</code>, <code>7</code>.</p><p>Sintaks <code>[24, 12, 32, 7]</code> adalah salah satu cara menulis literal array. Tulis saja data yang diinginkan dengan separator <code>,</code> dan diapit tanda kurung siku <code>[ ]</code>.</p><p>Contoh lain deklarasi array:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> alphabets </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"d"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> booleans </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> floatingNumbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">32.0000078</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.5</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>O iya, penulisan literal array juga bisa dituliskan dalam multi-baris, contohnya seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> alphabets </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"d"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> booleans </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-pengaksesan-elemen-array">◉ Pengaksesan elemen array<a class="hash-link" href="#-pengaksesan-elemen-array" title="Direct link to heading">​</a></h3><p>Pengaksesan elemen array dilakukan dengan menuliskan nama variabel array kemudian diikuti kurung siku yang mengapit angka indeks elemen yang diinginkan.</p><p>Indeks array dimulai dari 0. Pada contoh di atas, <code>numbers</code> size-nya adalah 4 elemen, berarti elemen array ada pada indeks ke 0, 1, 2, 3.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data0 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"elemen array ke 0 {data0}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"elemen array ke 1 {data1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Array hanya bisa diakses elemennya sesuai size saat deklarasi. Sebagai contoh, variabel <code>numbers</code> yang size nya 4, jika dipaksa mengakses elemen indeks ke-7 maka akan menghasilkan error.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-mengubah-isi-elemen-array">◉ Mengubah isi elemen array<a class="hash-link" href="#-mengubah-isi-elemen-array" title="Direct link to heading">​</a></h3><p>Array bisa diubah isi elemen-nya jika variabel tersebut adalah <code>mutable</code>. Pada contoh yang sudah dibuat, variabel <code>numbers</code> dideklarasikan mutable dengan tipe data elemen adalah numerik. Dengan ini kita bisa mengubah value elemen array dengan value baru bertipe data sama.</p><p>Bisa dilihat pada contoh yang sudah dipraktikkan, elemen indeks ke-1 diubah nilainya menjadi <code>16</code>, dan elemen indeks ke-3 value-nya menjadi <code>8</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">16</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Array hanya bisa diubah elemen-nya sesuai size saat deklarasi. Sebagai contoh, variabel <code>numbers</code> yang size nya 4, jika dipaksa mengakses dan/atau mengubah elemen indeks ke-7 maka akan menghasilkan error.</p><p>Selain itu, operasi assignment atau pengubahan nilai pada elemen array hanya bisa dilakukan dengan tipe data yang sama. Pada contoh di atas <code>numbers</code> adalah array bertipe numerik, karenanya tidak akan bisa diubah nilai elemen-nya dengan tipe lain, dan jika dipaksa akan menghasilkan error.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-formatted-print-">◉ Formatted print <code>{:?}</code><a class="hash-link" href="#-formatted-print-" title="Direct link to heading">​</a></h3><p>Formatted print <code>{:?}</code> berguna untuk memformat macam-macam tipe data ke bentuk string, yang salah satunya adalah tipe data array. Dengan menggunakan formatted print ini kita bisa menampilkan nilai elemen array dalam bentuk string.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-formatted-print-namavariabel">◉ Formatted print <code>{namaVariabel:?}</code><a class="hash-link" href="#-formatted-print-namavariabel" title="Direct link to heading">​</a></h3><p>Formatted print <code>{namaVariabel:?}</code> kegunaannya sama seperti <code>{:?}</code>, dengan perbedaan: pada penggunaan formatted print <code>{namaVariabel:?}</code> tidak perlu menuliskan variabel yang ingin di-format sebagai argumen. Cukup ganti <code>namaVariabel</code> dengan nama variabel yang ingin di-format.</p><p>Silakan lihat contoh berikut. Keduanya adalah ekuivalen, menghasilkan nilai yang sama.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array {numbers:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a132-notasi-penulisan-tipe-data-array">A.13.2. Notasi penulisan tipe data array<a class="hash-link" href="#a132-notasi-penulisan-tipe-data-array" title="Direct link to heading">​</a></h2><p>Pada contoh program yang sudah dipraktikkan, variabel <code>number</code> tipe datanya adalah array numerik, terlihat saat deklarasinya <em>predefined value</em> diisi dengan literal elemen array bertipe <code>i32</code>.</p><p>Tipe data <code>i32</code> di sini adalah milik elemen array, sedang array <code>numbers</code> itu sendiri tipe datanya adalah <code>[i32; 4]</code>, yang artinya adalah <strong>sebuah array dengan elemen bertipe <code>i32</code> dengan size <code>4</code></strong>.</p><p>Jika kawan-kawan menggunakan ekstensi VSCode <code>rust-analyzer</code>, akan terlihat informasi tipe data array-nya.</p><p><img loading="lazy" alt="array" src="/assets/images/array-2-bc70d4683afb247a4d30a6551aabec0a.png" width="445" height="336" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a133-macam-macam-deklarasi-array">A.13.3. Macam-macam deklarasi array<a class="hash-link" href="#a133-macam-macam-deklarasi-array" title="Direct link to heading">​</a></h2><p>Array lebih mudah dideklarasikan dengan metode <em>type inference</em>. Namun tak menutup kemungkinan ada kebutuhan di mana array harus dideklarasikan dengan menuliskan tipe datanya secara eksplisit. Berikut adalah macam-macam cara mendeklarasikan array.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-deklarasi-array-dengan-metode-type-inference">◉ Deklarasi array dengan metode <em>type inference</em><a class="hash-link" href="#-deklarasi-array-dengan-metode-type-inference" title="Direct link to heading">​</a></h3><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> angka_integer </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">7</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{angka_integer:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: [24, 12, 32, 7]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> angka_float </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">24.2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12.5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">32.00002</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">7.2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{angka_float:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: [24.2, 12.5, 32.00002, 7.2]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-deklarasi-array-dengan-metode-manifest-typing-disertai-predefined-value">◉ Deklarasi array dengan metode <em>manifest typing</em> disertai <em>predefined value</em><a class="hash-link" href="#-deklarasi-array-dengan-metode-manifest-typing-disertai-predefined-value" title="Direct link to heading">​</a></h3><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_boolean</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{data_boolean:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: [false, true]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> angka_unsigned_integer</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token keyword" style="color:#00009f">u32</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{angka_unsigned_integer:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: [24, 0, 12]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-deklarasi-array-dengan-notasi-penulisan-t-n">◉ Deklarasi array dengan notasi penulisan <code>[T; N]</code><a class="hash-link" href="#-deklarasi-array-dengan-notasi-penulisan-t-n" title="Direct link to heading">​</a></h3><p>Pada contoh berikut, <code>data_numerik1</code> dideklarasikan bertipe array dengan tipe data data elemen adalah <code>i32</code>, mempunyai size <code>10</code>, dengan <em>predefined value</em> untuk setiap elemen array adalah angka <code>0</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_numerik1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{data_numerik1:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh ke-dua ini, <code>data_numerik2</code> dideklarasikan dengan <em>predefined value</em> adalah array yang size-nya <code>5</code> dan nilai default tiap elemen adalah angka <code>4</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_numerik2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{data_numerik2:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: [4, 4, 4, 4, 4]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Tambahan penjelasan mengenai notasi penulisan <code>[T; N]</code>:</p><ul><li>Jika digunakan pada penulisan tipe data array saat deklarasi, <code>T</code> adalah tipe data elemen, dan <code>N</code> adalah lebar/size array. Contoh: <code>let data_numerik1: [i32; 10]</code>.</li><li>Jika digunakan pada penulisan <em>predefined value</em>, <code>T</code> adalah nilai setiap elemen array, dan <code>N</code> adalah lebar/size array. Contoh: <code>[4; 2]</code>, yang artinya semua elemen array diisi dengan angka <code>4</code>.</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a134-melihat-size-array-menggunakan-method-len">A.13.4. Melihat size array menggunakan method <code>len</code><a class="hash-link" href="#a134-melihat-size-array-menggunakan-method-len" title="Direct link to heading">​</a></h2><p>Array secara <em>default</em> properti tipe data <strong>slice</strong>, yang salah satunya adalah method bernama <code>len</code> yang berguna untuk melihat size dari sebuah array. Cara penggunaannya cukup dengan menuliskan <code>.len()</code> setelah variabel array. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> names </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"jason"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"grayon"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"drake"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> length </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array size is {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="array for in" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcEAAABxCAIAAAAiZI9+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMw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fy6k1I4iuLoo1NecWnUzxlofV9WXQIyisLopGNIXNu09KE8nPPe9U8llflTGCIsj7Bfda3rZK1r9XBrXiEyM23v1iEwBglZZIzb75pHh7bXEV4N7qolh6IrNDz+bdL5LrueVcbrm9keDG6voyPJL1kHx9Ng4iyWtU2ptkMK/11fXluLq+hhEUQd4jOGPo6vqaBOq6fHcT9JsmnqwwshtBdHVRLH275l7EvTVZX5fn1u7fAbcwaomghA6bmB3hsb66KMIErOVyrZas5XJyl4YRBBltPHxPaf/7TQCy5TfRmod2l33z7hM59/n9OKhf8gaaYrUGcZffr9+5b4ugm0+Kt9eW11fv9SCYuVk34iwAGLfb8L48gpx1OGPovZz6+Zq+Hi6pak2KerLCzn7v29Lyclx94hprrBsBpUfy3U1r4nIutwylR/Ja8c5taUL/2zh47d7dL+DO/bVWGns9ziiTYh1BEARgBJ4PxQkbgiCnmCF/G3l1fVksPXK5m4QgCDLKDC2Grq7nlkWyrsZ7LgiCnFaGvpZHEAQ5xaDmCIIgiH8whiIIgvgHYyiCIIh/MIYiCIL4B2MogiCIfzCGIgiC+AdjKIIgiH8whiIIgvgHYyiCIIh/MIYiCIL4B2MogiCIfzCGIgiC+Odf9QpC/DT4JYEAAAAASUVORK5CYII=" width="449" height="113" class="img_ev3q"></p><blockquote><p>Lebih jelasnya mengenai slice dibahas pada chapter <a href="/basic/slice">Slice</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a135-iterasi-array-menggunakan-for-in">A.13.5. Iterasi array menggunakan <code>for in</code><a class="hash-link" href="#a135-iterasi-array-menggunakan-for-in" title="Direct link to heading">​</a></h2><p>Pada contoh berikut, variabel <code>names</code> adalah array bertipe <code>[&str; 4]</code>, dideklarasikan dengan <em>predefined value</em>. Elemen array tersebut kemudian diiterasi menggunakan <code>for in</code> untuk di-print ke layar console value setiap elemennya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"jason"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"grayon"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"drake"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> name </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> names </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{name}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="array for in" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb0AAACVCAIAAABDxLP8AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIi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rC7FDtAAAAAElFTkSuQmCC" width="445" height="149" class="img_ev3q"></p><p>Bisa juga dengan memanfaatkan <em>range syntax</em> dalam perulangan array. Benefitnya adalah pengaksesan indeks array lebih mudah.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"jason"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"grayon"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"drake"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token plain">names</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array index ke-{}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> i</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">i</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="array for in" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAACUCAIAAACMbbBkAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6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vfybuQTAZgKEAdeYKxSSKvb+/lk1Xf7oKTAQiFcT4trz2Og7PaDeum5PpGMqqvzvmBkwEIifHMPU3qyJgSeWF9Vt7ffXw4GYBQgToyAAAEASohAAAQBERPAAAIAqInAAAEYVqiJ9SRA1g0QY0H4PVjWvQ9pxZOKTsAwLQxLdFzStWR17dvJ6vq2+e5Qqn/K/UAgKkB6sihqiObhEN279c2N036HJzVMizidfKgjQcAeAF15FDVkQeFaRFxOnncjQfg9QbqyCNSR84VNq1Wcqgjsy0iIk4nD63xAAAnUEcehTry+vbepqjJGQ0FTif7aDwAwCdQRw5dHVnfZQ11f9G1j3gbDwDwCdSRw1VHtt6gsragrzoy0yJ33PooBGlnAADUkcNVR87JUpQ0YeQ+SbktYqf07qNAjQcAeAF1ZAAACALUkQEAIAjjiZ4m4V7cvQAATCVQRwYAgCBMi8YSAABMFoieAAAQBERPAAAIwrRET6gjB7bIt+sAADxMi77ntGL+pDBekATgdWJaoueUqiOb2r2+vZcfizrytLoOgAkH6sihqiObqDw+zSdNfwdXR2b7c7WlLElStK3sV5ObUrStFG7tEMN1rOyu/gQAuAJ15FGpI+dWRUNXjhemRezuEKXYobxfi0qb6r/JjXW261x6k+FPAIAHUEcOWx15fXuvVCqVSpti7dC8ag+ujszuDt2FfV3p1pt2fwIAPIE6ctjqyGYvlPaWh6GJ4tIdI8oOACAiqCOPQB259/Nh9bZk+ixcUMLpDgCAT6COHK46srlKWYqadncHUkcOoTsAAP6AOnKo6sjunzrigmkRb3fsVJiuG7A3AQAaUEcGAIAgQB0ZAACCAHVkAAAIAtSRAQAgCNOisQQAAJMFoicAAAQB0RMAAIKA6AkAAEFA9AQAgCAgegIAQBAQPQEAIAiIngAAEARETwAACML/A7m5vVdPD4RSAAAAAElFTkSuQmCC" width="447" height="148" class="img_ev3q"></p><p>Statement <code>names.len()</code> mengembalikan informasi size sebuah array, nilainya bisa dimanfaatkan dalam perulangan <code>for in</code> untuk iterasi indeks ke-0 hingga terakhir.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a136-iterasi-array-menggunakan-while-dan-loop">A.13.6. Iterasi array menggunakan <code>while</code> dan <code>loop</code><a class="hash-link" href="#a136-iterasi-array-menggunakan-while-dan-loop" title="Direct link to heading">​</a></h2><p>Contoh iterasi array menggunakan keyword <code>while</code>:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"jason"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"grayon"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"drake"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">while</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array index ke-{}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> i</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">i</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh iterasi array menggunakan keyword <code>loop</code>:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"jason"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"grayon"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"drake"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">>=</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array index ke-{}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> i</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">i</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Iterasi array menggunakan <code>while</code> dan <code>loop</code> umumnya kurang praktis jika dibandingkan dengan <code>for in</code>. Tapi pastinya ada case di mana <code>while</code> dan/atau <code>loop</code> akan dibutuhkan.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a137-iterasi-array-menggunakan-for-in-dan-tuple">A.13.7. Iterasi array menggunakan <code>for in</code> dan <em>tuple</em><a class="hash-link" href="#a137-iterasi-array-menggunakan-for-in-dan-tuple" title="Direct link to heading">​</a></h2><p>Mengiterasi value sekaligus <em>counter</em> perulangan sebenarnya bisa juga dilakukan menggunakan <code>for in</code>, contohnya seperti yang sudah kita praktikkan di atas yaitu <code>for i in 0..names.len()</code>.</p><p>Ada juga bentuk lain pemanfaatan <code>for in</code> untuk mengiterasi sebuah array. Caranya dengan menggunakan teknik tuple untuk menampung data <em>counter</em> sekaligus value tiap elemen. Lebih jelasnya silakan lihat dan praktikkan contoh berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"jason"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"grayon"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"drake"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">i</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">enumerate</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array index ke-{i}: {name}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="array enumerate" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAACUCAIAAACMbbBkAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlL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4m4V7cvQAATCVQRwYAgCBMi8YSAABMFoieAAAQBERPAAAIwrRET6gjB7bIt+sAADxMi77ntGL+pDBekATgdWJaoueUqiOb2r2+vZcfizrytLoOgAkH6sihqiObqDw+zSdNfwdXR2b7c7WlLElStK3sV5ObUrStFG7tEMN1rOyu/gQAuAJ15FGpI+dWRUNXjhemRezuEKXYobxfi0qb6r/JjXW261x6k+FPAIAHUEcOWx15fXuvVCqVSpti7dC8ag+ujszuDt2FfV3p1pt2fwIAPIE6ctjqyGYvlPaWh6GJ4tIdI8oOACAiqCOPQB259/Nh9bZk+ixcUMLpDgCAT6COHK46srlKWYqadncHUkcOoTsAAP6AOnKo6sjunzrigmkRb3fsVJiuG7A3AQAaUEcGAIAgQB0ZAACCAHVkAAAIAtSRAQAgCNOisQQAAJMFoicAAAQB0RMAAIKA6AkAAEFA9AQAgCAgegIAQBAQPQEAIAiIngAAEARETwAACML/A7m5vVdPD4RSAAAAAElFTkSuQmCC" width="447" height="148" class="img_ev3q"></p><p>Variabel <code>names</code> yang notabene bertipe data <code>[&str; 4]</code> perlu dikonversi ke tipe <code>Iterator</code> terlebih dahulu caranya lewat pemanggilan method <code>.iter()</code>. Kemudian dari tipe tersebut perlu dikonversi lagi ke tipe <code>Enumerate</code> dengan cara memanggil method <code>.enumerate()</code>.</p><p>Setelah mendapatkan objek bertipe <code>Enumerate</code>, keyword <code>for in</code> digunakan untuk menampung tiap elemen array dalam bentuk <em>tuple</em> <code>(i, name)</code>. Variabel <code>i</code> di situ berisi counter iterasi, dan <code>name</code> adalah value-nya.</p><blockquote><ul><li>Lebih jelasnya mengenai traits dibahas pada chapter <a href="/basic/traits">Traits</a></li><li>Lebih jelasnya mengenai <code>Enumerate</code> dibahas pada chapter <a href="/basic/trait-iterator">Trait ➜ Iterator</a></li><li>Lebih jelasnya mengenai tuple dibahas pada chapter <a href="/basic/tuple">Tuple</a></li></ul></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a138-append-elemen-ke-array">A.13.8. Append elemen ke array<a class="hash-link" href="#a138-append-elemen-ke-array" title="Direct link to heading">​</a></h2><p>Operasi menambahkan sebuah elemen ke array yang hasilnya melebihi kapasitas ... adalah tidak bisa. Karena array memiliki size fixed, tidak dinamis. Solusinya adalah menggunakan tipe data Vector. Nantinya array perlu dikonversi ke bentu Vector terlebih dahulu kemudian di-append, lebih jelasnya kita bahas pada chapter <a href="/basic/vector">Vector</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a139-nested-array">A.13.9. Nested array<a class="hash-link" href="#a139-nested-array" title="Direct link to heading">​</a></h2><p>Data nested array bisa dibuat dengan level kedalaman tanpa batas, tetapi harus mengikuti aturan tipe data array yaitu: fixed size dan elemen bertipe data sejenis.</p><p>Pada contoh berikut variabel <code>data_arr</code> didefinisikan sebagai sebuah array bersarang atau nested dengan kedalaman 2 level.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_arr </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"salad"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"fried rice"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"apple"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"coconut"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"spinach"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"jalapeno"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> sub_arr </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> data_arr </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> el </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> sub_arr </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{el}, "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// salad, fried rice,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// apple, coconut,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// spinach, jalapeno,</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Variabel <code>data_arr</code> pada contoh di atas bertipe data<code>[[&str; 2]; 3]</code>, yang artinya adalah sebuah array dengan size 3, dengan isi elemen adalah juga array dengan size 2. Selalu ingat bahwa size array adalah fixed.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/array" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../array</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/slice">Slice (Basic)</a></li><li><a href="/basic/vector">Tipe Data ➜ Vector</a></li><li><a href="/basic/slice-memory-management">Slice Memory Management</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/std/primitive.array.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/primitive.array.html</a></li><li><a href="https://doc.rust-lang.org/std/primitive.slice.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/primitive.slice.html</a></li><li><a href="https://doc.rust-lang.org/std/iter/index.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/iter/index.html</a></li><li><a href="https://doc.rust-lang.org/std/iter/struct.Enumerate.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/iter/struct.Enumerate.html</a></li><li><a href="https://doc.rust-lang.org/std/iter/trait.Iterator.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/iter/trait.Iterator.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/trait/iter.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/trait/iter.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/flow_control/for.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/flow_control/for.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/perulangan-for-in"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.12. Perulangan ➜ for in</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/slice"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.14. Slice (Basic)</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a131-pengenalan-array" class="table-of-contents__link toc-highlight">A.13.1. Pengenalan array</a><ul><li><a href="#-deklarasi-variabel-array-type-inference" class="table-of-contents__link toc-highlight">◉ Deklarasi variabel array (<em>type inference</em>)</a></li><li><a href="#-pengaksesan-elemen-array" class="table-of-contents__link toc-highlight">◉ Pengaksesan elemen array</a></li><li><a href="#-mengubah-isi-elemen-array" class="table-of-contents__link toc-highlight">◉ Mengubah isi elemen array</a></li><li><a href="#-formatted-print-" class="table-of-contents__link toc-highlight">◉ Formatted print <code>{:?}</code></a></li><li><a href="#-formatted-print-namavariabel" class="table-of-contents__link toc-highlight">◉ Formatted print <code>{namaVariabel:?}</code></a></li></ul></li><li><a href="#a132-notasi-penulisan-tipe-data-array" class="table-of-contents__link toc-highlight">A.13.2. Notasi penulisan tipe data array</a></li><li><a href="#a133-macam-macam-deklarasi-array" class="table-of-contents__link toc-highlight">A.13.3. Macam-macam deklarasi array</a><ul><li><a href="#-deklarasi-array-dengan-metode-type-inference" class="table-of-contents__link toc-highlight">◉ Deklarasi array dengan metode <em>type inference</em></a></li><li><a href="#-deklarasi-array-dengan-metode-manifest-typing-disertai-predefined-value" class="table-of-contents__link toc-highlight">◉ Deklarasi array dengan metode <em>manifest typing</em> disertai <em>predefined value</em></a></li><li><a href="#-deklarasi-array-dengan-notasi-penulisan-t-n" class="table-of-contents__link toc-highlight">◉ Deklarasi array dengan notasi penulisan <code>[T; N]</code></a></li></ul></li><li><a href="#a134-melihat-size-array-menggunakan-method-len" class="table-of-contents__link toc-highlight">A.13.4. Melihat size array menggunakan method <code>len</code></a></li><li><a href="#a135-iterasi-array-menggunakan-for-in" class="table-of-contents__link toc-highlight">A.13.5. Iterasi array menggunakan <code>for in</code></a></li><li><a href="#a136-iterasi-array-menggunakan-while-dan-loop" class="table-of-contents__link toc-highlight">A.13.6. Iterasi array menggunakan <code>while</code> dan <code>loop</code></a></li><li><a href="#a137-iterasi-array-menggunakan-for-in-dan-tuple" class="table-of-contents__link toc-highlight">A.13.7. Iterasi array menggunakan <code>for in</code> dan <em>tuple</em></a></li><li><a href="#a138-append-elemen-ke-array" class="table-of-contents__link toc-highlight">A.13.8. Append elemen ke array</a></li><li><a href="#a139-nested-array" class="table-of-contents__link toc-highlight">A.13.9. Nested array</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.13. Array</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.13. Tipe Data ➜ Array</h1></header><p>Pada chapter awal kita sudah mempelajari tipe data primitif jenis scalar. Selain <em>scalar types</em> ada juga tipe data primitif lainnya yaitu <strong>compound types</strong>. Compound types sendiri adalah jenis tipe data kolektif yang isinya banyak data. Kesemua data tersebut memiliki tipe data yang sama dan di-group menjadi satu.</p><p>Array adalah salah satu tipe data compound yang tersedia di Rust, dan pada chapter ini kita akan mempelajarinya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a131-pengenalan-array">A.13.1. Pengenalan array<a class="hash-link" href="#a131-pengenalan-array" title="Direct link to heading">​</a></h2><p>Menurut dokumentasi official Rust, array adalah:</p><blockquote><p>An array is a collection of objects of the same type T, stored in contiguous memory.</p><p>A fixed-size array, denoted <!-- -->[T; N]<!-- -->, for the element type, T, and the non-negative compile-time constant size, N.</p></blockquote><p>Array (atau <em>fixed size array</em>) adalah kumpulan data dengan tipe sejenis, disimpan dalam 1 variabel. Array memiliki kapasitas yang nilainya ditentukan saat deklarasi/alokasi. Jumlah data dalam array pasti tidak boleh lebih dari kapasitas yang sudah ditentukan di awal. Data dalam array biasa disebut dengan <em>element</em> atau item.</p><p>Ada beberapa notasi deklarasi array yang bisa dipakai, kesemuanya akan dibahas pada chapter ini.</p><p>Ok, Sekarang kita mulai praktik dengan bermain-main terlebih dahulu dengan tipe data array ini. Silakan pelajari dan praktikkan contoh berikut, sebuah program yang isinya menampilkan data array.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> numbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">7</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data0 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"elemen array ke 0 {data0}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"elemen array ke 1 {data1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">16</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array {numbers:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Coba jalankan aplikasi, muncul dua baris output di console.</p><p><img loading="eager" fetchpriority="high" alt="array" src="/assets/images/array-1-919358da6705a5ced706fbcd108be794.png" width="448" height="164" class="img_CujE"></p><p>Selanjutnya mari kita bahas dengan detail contoh di atas.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-deklarasi-variabel-array-type-inference">◉ Deklarasi variabel array (<em>type inference</em>)<a class="hash-link" href="#-deklarasi-variabel-array-type-inference" title="Direct link to heading">​</a></h3><p>Variabel <code>numbers</code> dideklarasikan sebagai array <em>mutable</em> dengan metode deklarasi type inference, yang tipe datanya didapat langsung dari nilai.</p><p>Value dari <code>numbers</code> adalah <code>[24, 12, 32, 7]</code>, yang mana artinya sebuah array dengan size 4, bertipe numerik, dengan isi <code>24</code>, <code>12</code>, <code>32</code>, <code>7</code>.</p><p>Sintaks <code>[24, 12, 32, 7]</code> adalah salah satu cara menulis literal array. Tulis saja data yang diinginkan dengan separator <code>,</code> dan diapit tanda kurung siku <code>[ ]</code>.</p><p>Contoh lain deklarasi array:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> alphabets </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"d"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> booleans </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> floatingNumbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">32.0000078</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.5</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>O iya, penulisan literal array juga bisa dituliskan dalam multi-baris, contohnya seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> alphabets </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"d"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> booleans </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-pengaksesan-elemen-array">◉ Pengaksesan elemen array<a class="hash-link" href="#-pengaksesan-elemen-array" title="Direct link to heading">​</a></h3><p>Pengaksesan elemen array dilakukan dengan menuliskan nama variabel array kemudian diikuti kurung siku yang mengapit angka indeks elemen yang diinginkan.</p><p>Indeks array dimulai dari 0. Pada contoh di atas, <code>numbers</code> size-nya adalah 4 elemen, berarti elemen array ada pada indeks ke 0, 1, 2, 3.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data0 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"elemen array ke 0 {data0}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"elemen array ke 1 {data1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Array hanya bisa diakses elemennya sesuai size saat deklarasi. Sebagai contoh, variabel <code>numbers</code> yang size nya 4, jika dipaksa mengakses elemen indeks ke-7 maka akan menghasilkan error.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-mengubah-isi-elemen-array">◉ Mengubah isi elemen array<a class="hash-link" href="#-mengubah-isi-elemen-array" title="Direct link to heading">​</a></h3><p>Array bisa diubah isi elemen-nya jika variabel tersebut adalah <code>mutable</code>. Pada contoh yang sudah dibuat, variabel <code>numbers</code> dideklarasikan mutable dengan tipe data elemen adalah numerik. Dengan ini kita bisa mengubah value elemen array dengan value baru bertipe data sama.</p><p>Bisa dilihat pada contoh yang sudah dipraktikkan, elemen indeks ke-1 diubah nilainya menjadi <code>16</code>, dan elemen indeks ke-3 value-nya menjadi <code>8</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">16</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Array hanya bisa diubah elemen-nya sesuai size saat deklarasi. Sebagai contoh, variabel <code>numbers</code> yang size nya 4, jika dipaksa mengakses dan/atau mengubah elemen indeks ke-7 maka akan menghasilkan error.</p><p>Selain itu, operasi assignment atau pengubahan nilai pada elemen array hanya bisa dilakukan dengan tipe data yang sama. Pada contoh di atas <code>numbers</code> adalah array bertipe numerik, karenanya tidak akan bisa diubah nilai elemen-nya dengan tipe lain, dan jika dipaksa akan menghasilkan error.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-formatted-print-">◉ Formatted print <code>{:?}</code><a class="hash-link" href="#-formatted-print-" title="Direct link to heading">​</a></h3><p>Formatted print <code>{:?}</code> berguna untuk memformat macam-macam tipe data ke bentuk string, yang salah satunya adalah tipe data array. Dengan menggunakan formatted print ini kita bisa menampilkan nilai elemen array dalam bentuk string.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-formatted-print-namavariabel">◉ Formatted print <code>{namaVariabel:?}</code><a class="hash-link" href="#-formatted-print-namavariabel" title="Direct link to heading">​</a></h3><p>Formatted print <code>{namaVariabel:?}</code> kegunaannya sama seperti <code>{:?}</code>, dengan perbedaan: pada penggunaan formatted print <code>{namaVariabel:?}</code> tidak perlu menuliskan variabel yang ingin di-format sebagai argumen. Cukup ganti <code>namaVariabel</code> dengan nama variabel yang ingin di-format.</p><p>Silakan lihat contoh berikut. Keduanya adalah ekuivalen, menghasilkan nilai yang sama.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array {numbers:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a132-notasi-penulisan-tipe-data-array">A.13.2. Notasi penulisan tipe data array<a class="hash-link" href="#a132-notasi-penulisan-tipe-data-array" title="Direct link to heading">​</a></h2><p>Pada contoh program yang sudah dipraktikkan, variabel <code>number</code> tipe datanya adalah array numerik, terlihat saat deklarasinya <em>predefined value</em> diisi dengan literal elemen array bertipe <code>i32</code>.</p><p>Tipe data <code>i32</code> di sini adalah milik elemen array, sedang array <code>numbers</code> itu sendiri tipe datanya adalah <code>[i32; 4]</code>, yang artinya adalah <strong>sebuah array dengan elemen bertipe <code>i32</code> dengan size <code>4</code></strong>.</p><p>Jika kawan-kawan menggunakan ekstensi VSCode <code>rust-analyzer</code>, akan terlihat informasi tipe data array-nya.</p><p><img loading="lazy" alt="array" src="/assets/images/array-2-bc70d4683afb247a4d30a6551aabec0a.png" width="445" height="336" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a133-macam-macam-deklarasi-array">A.13.3. Macam-macam deklarasi array<a class="hash-link" href="#a133-macam-macam-deklarasi-array" title="Direct link to heading">​</a></h2><p>Array lebih mudah dideklarasikan dengan metode <em>type inference</em>. Namun tak menutup kemungkinan ada kebutuhan di mana array harus dideklarasikan dengan menuliskan tipe datanya secara eksplisit. Berikut adalah macam-macam cara mendeklarasikan array.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-deklarasi-array-dengan-metode-type-inference">◉ Deklarasi array dengan metode <em>type inference</em><a class="hash-link" href="#-deklarasi-array-dengan-metode-type-inference" title="Direct link to heading">​</a></h3><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> angka_integer </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">7</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{angka_integer:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: [24, 12, 32, 7]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> angka_float </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">24.2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12.5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">32.00002</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">7.2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{angka_float:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: [24.2, 12.5, 32.00002, 7.2]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-deklarasi-array-dengan-metode-manifest-typing-disertai-predefined-value">◉ Deklarasi array dengan metode <em>manifest typing</em> disertai <em>predefined value</em><a class="hash-link" href="#-deklarasi-array-dengan-metode-manifest-typing-disertai-predefined-value" title="Direct link to heading">​</a></h3><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_boolean</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{data_boolean:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: [false, true]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> angka_unsigned_integer</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token keyword" style="color:#00009f">u32</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{angka_unsigned_integer:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: [24, 0, 12]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-deklarasi-array-dengan-notasi-penulisan-t-n">◉ Deklarasi array dengan notasi penulisan <code>[T; N]</code><a class="hash-link" href="#-deklarasi-array-dengan-notasi-penulisan-t-n" title="Direct link to heading">​</a></h3><p>Pada contoh berikut, <code>data_numerik1</code> dideklarasikan bertipe array dengan tipe data data elemen adalah <code>i32</code>, mempunyai size <code>10</code>, dengan <em>predefined value</em> untuk setiap elemen array adalah angka <code>0</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_numerik1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{data_numerik1:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh ke-dua ini, <code>data_numerik2</code> dideklarasikan dengan <em>predefined value</em> adalah array yang size-nya <code>5</code> dan nilai default tiap elemen adalah angka <code>4</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_numerik2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{data_numerik2:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: [4, 4, 4, 4, 4]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Tambahan penjelasan mengenai notasi penulisan <code>[T; N]</code>:</p><ul><li>Jika digunakan pada penulisan tipe data array saat deklarasi, <code>T</code> adalah tipe data elemen, dan <code>N</code> adalah lebar/size array. Contoh: <code>let data_numerik1: [i32; 10]</code>.</li><li>Jika digunakan pada penulisan <em>predefined value</em>, <code>T</code> adalah nilai setiap elemen array, dan <code>N</code> adalah lebar/size array. Contoh: <code>[4; 2]</code>, yang artinya semua elemen array diisi dengan angka <code>4</code>.</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a134-melihat-size-array-menggunakan-method-len">A.13.4. Melihat size array menggunakan method <code>len</code><a class="hash-link" href="#a134-melihat-size-array-menggunakan-method-len" title="Direct link to heading">​</a></h2><p>Array secara <em>default</em> properti tipe data <strong>slice</strong>, yang salah satunya adalah method bernama <code>len</code> yang berguna untuk melihat size dari sebuah array. Cara penggunaannya cukup dengan menuliskan <code>.len()</code> setelah variabel array. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> names </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"jason"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"grayon"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"drake"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> length </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array size is {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="array for in" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcEAAABxCAIAAAAiZI9+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZ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IIgvgHYyiCIIh/MIYiCIL4B2MogiCIfzCGIgiC+Odf9QpC/DT4JYEAAAAASUVORK5CYII=" width="449" height="113" class="img_CujE"></p><blockquote><p>Lebih jelasnya mengenai slice dibahas pada chapter <a href="/basic/slice">Slice</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a135-iterasi-array-menggunakan-for-in">A.13.5. Iterasi array menggunakan <code>for in</code><a class="hash-link" href="#a135-iterasi-array-menggunakan-for-in" title="Direct link to heading">​</a></h2><p>Pada contoh berikut, variabel <code>names</code> adalah array bertipe <code>[&str; 4]</code>, dideklarasikan dengan <em>predefined value</em>. Elemen array tersebut kemudian diiterasi menggunakan <code>for in</code> untuk di-print ke layar console value setiap elemennya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"jason"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"grayon"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"drake"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> name </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> names </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{name}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="array for in" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb0AAACVCAIAAABDxLP8AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6Mj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hMAAMSA3wQAADHgNwEAQAz4TQAAEAN+EwAAxBiobnEnXhHyxQCAKwPGmwAAIEa/nk/3YTuXwcPoAICrQze6xQyJ4o18camhzilKpKnulhNrSqSp5u9vUSecTcrDrXC8srnzgB7uR3PaQ/AQ/gAAjC/d6BazJYplJbqf2a1ElDXt/8TqCh1s3de0ja1peigcR5TcaiNvlUIGAIBxpBvdYrZEcVMtblv/98RL4biyq+l7OGSPAQBgvOhqfdNDonhI0QEAYKR0sZ9uSBTrM+1mcIx+RgcAgBHTpW6xl0QxJz1GBwCAEdKFbnGARHGHrQPrhHytWFzT9sk5owMAwHgC3WIAABADzwsBAIAY8JsAACAG/CYAAIgBvwkAAGLAbwIAgBjwmwAAIAb8JgAAiAG/CQAAYsBvAgCAGPCbAAAgBvwmAACIAb8JAABiwG8CAIAY8JsAACAG/CYAAIgBvwkAAGL8P8WW/mrC7FDtAAAAAElFTkSuQmCC" width="445" height="149" class="img_CujE"></p><p>Bisa juga dengan memanfaatkan <em>range syntax</em> dalam perulangan array. Benefitnya adalah pengaksesan indeks array lebih mudah.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"jason"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"grayon"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"drake"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token plain">names</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array index ke-{}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> i</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">i</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="array for in" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAACUCAIAAACMbbBkAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMDktMjZUMjM6MTk6MTQrMDc6M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uAJ15FGpI+dWRUNXjhemRezuEKXYobxfi0qb6r/JjXW261x6k+FPAIAHUEcOWx15fXuvVCqVSpti7dC8ag+ujszuDt2FfV3p1pt2fwIAPIE6ctjqyGYvlPaWh6GJ4tIdI8oOACAiqCOPQB259/Nh9bZk+ixcUMLpDgCAT6COHK46srlKWYqadncHUkcOoTsAAP6AOnKo6sjunzrigmkRb3fsVJiuG7A3AQAaUEcGAIAgQB0ZAACCAHVkAAAIAtSRAQAgCNOisQQAAJMFoicAAAQB0RMAAIKA6AkAAEFA9AQAgCAgegIAQBAQPQEAIAiIngAAEARETwAACML/A7m5vVdPD4RSAAAAAElFTkSuQmCC" width="447" height="148" class="img_CujE"></p><p>Statement <code>names.len()</code> mengembalikan informasi size sebuah array, nilainya bisa dimanfaatkan dalam perulangan <code>for in</code> untuk iterasi indeks ke-0 hingga terakhir.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a136-iterasi-array-menggunakan-while-dan-loop">A.13.6. Iterasi array menggunakan <code>while</code> dan <code>loop</code><a class="hash-link" href="#a136-iterasi-array-menggunakan-while-dan-loop" title="Direct link to heading">​</a></h2><p>Contoh iterasi array menggunakan keyword <code>while</code>:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"jason"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"grayon"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"drake"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">while</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array index ke-{}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> i</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">i</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh iterasi array menggunakan keyword <code>loop</code>:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"jason"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"grayon"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"drake"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">>=</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array index ke-{}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> i</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">i</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Iterasi array menggunakan <code>while</code> dan <code>loop</code> umumnya kurang praktis jika dibandingkan dengan <code>for in</code>. Tapi pastinya ada case di mana <code>while</code> dan/atau <code>loop</code> akan dibutuhkan.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a137-iterasi-array-menggunakan-for-in-dan-tuple">A.13.7. Iterasi array menggunakan <code>for in</code> dan <em>tuple</em><a class="hash-link" href="#a137-iterasi-array-menggunakan-for-in-dan-tuple" title="Direct link to heading">​</a></h2><p>Mengiterasi value sekaligus <em>counter</em> perulangan sebenarnya bisa juga dilakukan menggunakan <code>for in</code>, contohnya seperti yang sudah kita praktikkan di atas yaitu <code>for i in 0..names.len()</code>.</p><p>Ada juga bentuk lain pemanfaatan <code>for in</code> untuk mengiterasi sebuah array. Caranya dengan menggunakan teknik tuple untuk menampung data <em>counter</em> sekaligus value tiap elemen. Lebih jelasnya silakan lihat dan praktikkan contoh berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"jason"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"grayon"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"drake"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">i</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> names</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">enumerate</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"array index ke-{i}: {name}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="array enumerate" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAACUCAIAAACMbbBkAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgM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ZBMBmBIQB05VHVkc+OlfKmU96WQrLbNtEXgnpvfybuQTAZgKEAdeYKxSSKvb+/lk1Xf7oKTAQiFcT4trz2Og7PaDeum5PpGMqqvzvmBkwEIifHMPU3qyJgSeWF9Vt7ffXw4GYBQgToyAAAEASohAAAQBERPAAAIAqInAAAEYVqiJ9SRA1g0QY0H4PVjWvQ9pxZOKTsAwLQxLdFzStWR17dvJ6vq2+e5Qqn/K/UAgKkB6sihqiObhEN279c2N036HJzVMizidfKgjQcAeAF15FDVkQeFaRFxOnncjQfg9QbqyCNSR84VNq1Wcqgjsy0iIk4nD63xAAAnUEcehTry+vbepqjJGQ0FTif7aDwAwCdQRw5dHVnfZQ11f9G1j3gbDwDwCdSRw1VHtt6gsragrzoy0yJ33PooBGlnAADUkcNVR87JUpQ0YeQ+SbktYqf07qNAjQcAeAF1ZAAACALUkQEAIAjjiZ4m4V7cvQAATCVQRwYAgCBMi8YSAABMFoieAAAQBERPAAAIwrRET6gjB7bIt+sAADxMi77ntGL+pDBekATgdWJaoueUqiOb2r2+vZcfizrytLoOgAkH6sihqiObqDw+zSdNfwdXR2b7c7WlLElStK3sV5ObUrStFG7tEMN1rOyu/gQAuAJ15FGpI+dWRUNXjhemRezuEKXYobxfi0qb6r/JjXW261x6k+FPAIAHUEcOWx15fXuvVCqVSpti7dC8ag+ujszuDt2FfV3p1pt2fwIAPIE6ctjqyGYvlPaWh6GJ4tIdI8oOACAiqCOPQB259/Nh9bZk+ixcUMLpDgCAT6COHK46srlKWYqadncHUkcOoTsAAP6AOnKo6sjunzrigmkRb3fsVJiuG7A3AQAaUEcGAIAgQB0ZAACCAHVkAAAIAtSRAQAgCNOisQQAAJMFoicAAAQB0RMAAIKA6AkAAEFA9AQAgCAgegIAQBAQPQEAIAiIngAAEARETwAACML/A7m5vVdPD4RSAAAAAElFTkSuQmCC" width="447" height="148" class="img_CujE"></p><p>Variabel <code>names</code> yang notabene bertipe data <code>[&str; 4]</code> perlu dikonversi ke tipe <code>Iterator</code> terlebih dahulu caranya lewat pemanggilan method <code>.iter()</code>. Kemudian dari tipe tersebut perlu dikonversi lagi ke tipe <code>Enumerate</code> dengan cara memanggil method <code>.enumerate()</code>.</p><p>Setelah mendapatkan objek bertipe <code>Enumerate</code>, keyword <code>for in</code> digunakan untuk menampung tiap elemen array dalam bentuk <em>tuple</em> <code>(i, name)</code>. Variabel <code>i</code> di situ berisi counter iterasi, dan <code>name</code> adalah value-nya.</p><blockquote><ul><li>Lebih jelasnya mengenai traits dibahas pada chapter <a href="/basic/traits">Traits</a></li><li>Lebih jelasnya mengenai <code>Enumerate</code> dibahas pada chapter <a href="/basic/trait-iterator">Trait ➜ Iterator</a></li><li>Lebih jelasnya mengenai tuple dibahas pada chapter <a href="/basic/tuple">Tuple</a></li></ul></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a138-append-elemen-ke-array">A.13.8. Append elemen ke array<a class="hash-link" href="#a138-append-elemen-ke-array" title="Direct link to heading">​</a></h2><p>Operasi menambahkan sebuah elemen ke array yang hasilnya melebihi kapasitas ... adalah tidak bisa. Karena array memiliki size fixed, tidak dinamis. Solusinya adalah menggunakan tipe data Vector. Nantinya array perlu dikonversi ke bentu Vector terlebih dahulu kemudian di-append, lebih jelasnya kita bahas pada chapter <a href="/basic/vector">Vector</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a139-nested-array">A.13.9. Nested array<a class="hash-link" href="#a139-nested-array" title="Direct link to heading">​</a></h2><p>Data nested array bisa dibuat dengan level kedalaman tanpa batas, tetapi harus mengikuti aturan tipe data array yaitu: fixed size dan elemen bertipe data sejenis.</p><p>Pada contoh berikut variabel <code>data_arr</code> didefinisikan sebagai sebuah array bersarang atau nested dengan kedalaman 2 level.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_arr </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"salad"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"fried rice"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"apple"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"coconut"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"spinach"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"jalapeno"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> sub_arr </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> data_arr </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> el </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> sub_arr </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{el}, "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// salad, fried rice,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// apple, coconut,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// spinach, jalapeno,</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Variabel <code>data_arr</code> pada contoh di atas bertipe data<code>[[&str; 2]; 3]</code>, yang artinya adalah sebuah array dengan size 3, dengan isi elemen adalah juga array dengan size 2. Selalu ingat bahwa size array adalah fixed.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/array" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../array</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/slice">Slice (Basic)</a></li><li><a href="/basic/vector">Tipe Data ➜ Vector</a></li><li><a href="/basic/slice-memory-management">Slice Memory Management</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/std/primitive.array.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/primitive.array.html</a></li><li><a href="https://doc.rust-lang.org/std/primitive.slice.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/primitive.slice.html</a></li><li><a href="https://doc.rust-lang.org/std/iter/index.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/iter/index.html</a></li><li><a href="https://doc.rust-lang.org/std/iter/struct.Enumerate.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/iter/struct.Enumerate.html</a></li><li><a href="https://doc.rust-lang.org/std/iter/trait.Iterator.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/iter/trait.Iterator.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/trait/iter.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/trait/iter.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/flow_control/for.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/flow_control/for.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/perulangan-for-in"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.12. Perulangan ➜ for in</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/slice"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.14. Slice (Basic)</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a131-pengenalan-array" class="table-of-contents__link toc-highlight">A.13.1. Pengenalan array</a><ul><li><a href="#-deklarasi-variabel-array-type-inference" class="table-of-contents__link toc-highlight">◉ Deklarasi variabel array (<em>type inference</em>)</a></li><li><a href="#-pengaksesan-elemen-array" class="table-of-contents__link toc-highlight">◉ Pengaksesan elemen array</a></li><li><a href="#-mengubah-isi-elemen-array" class="table-of-contents__link toc-highlight">◉ Mengubah isi elemen array</a></li><li><a href="#-formatted-print-" class="table-of-contents__link toc-highlight">◉ Formatted print <code>{:?}</code></a></li><li><a href="#-formatted-print-namavariabel" class="table-of-contents__link toc-highlight">◉ Formatted print <code>{namaVariabel:?}</code></a></li></ul></li><li><a href="#a132-notasi-penulisan-tipe-data-array" class="table-of-contents__link toc-highlight">A.13.2. Notasi penulisan tipe data array</a></li><li><a href="#a133-macam-macam-deklarasi-array" class="table-of-contents__link toc-highlight">A.13.3. Macam-macam deklarasi array</a><ul><li><a href="#-deklarasi-array-dengan-metode-type-inference" class="table-of-contents__link toc-highlight">◉ Deklarasi array dengan metode <em>type inference</em></a></li><li><a href="#-deklarasi-array-dengan-metode-manifest-typing-disertai-predefined-value" class="table-of-contents__link toc-highlight">◉ Deklarasi array dengan metode <em>manifest typing</em> disertai <em>predefined value</em></a></li><li><a href="#-deklarasi-array-dengan-notasi-penulisan-t-n" class="table-of-contents__link toc-highlight">◉ Deklarasi array dengan notasi penulisan <code>[T; N]</code></a></li></ul></li><li><a href="#a134-melihat-size-array-menggunakan-method-len" class="table-of-contents__link toc-highlight">A.13.4. Melihat size array menggunakan method <code>len</code></a></li><li><a href="#a135-iterasi-array-menggunakan-for-in" class="table-of-contents__link toc-highlight">A.13.5. Iterasi array menggunakan <code>for in</code></a></li><li><a href="#a136-iterasi-array-menggunakan-while-dan-loop" class="table-of-contents__link toc-highlight">A.13.6. Iterasi array menggunakan <code>while</code> dan <code>loop</code></a></li><li><a href="#a137-iterasi-array-menggunakan-for-in-dan-tuple" class="table-of-contents__link toc-highlight">A.13.7. Iterasi array menggunakan <code>for in</code> dan <em>tuple</em></a></li><li><a href="#a138-append-elemen-ke-array" class="table-of-contents__link toc-highlight">A.13.8. Append elemen ke array</a></li><li><a href="#a139-nested-array" class="table-of-contents__link toc-highlight">A.13.9. Nested array</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/associated-function.html b/basic/associated-function.html index eff92f74..7aeac5d4 100644 --- a/basic/associated-function.html +++ b/basic/associated-function.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/associated-function/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/associated-function/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.24. Associated Function","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/associated-function/#webpage"},"wordCount":785,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/associated-function/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/associated-function/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/associated-function","name":"A.24. Associated Function","description":"Chapter ini membahas tentang associated function. Kita akan belajar apa itu associated function dan apa perbedannya dengan fungsi biasa.","datePublished":"2024-08-01T10:17:28.050Z","dateModified":"2024-08-01T10:17:28.050Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/associated-function/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/associated-function"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/associated-function/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.24. Associated Function","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/associated-function/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/associated-function/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.24. Associated Function","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/associated-function/#webpage"},"wordCount":785,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/associated-function/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/associated-function/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/associated-function","name":"A.24. Associated Function","description":"Chapter ini membahas tentang associated function. Kita akan belajar apa itu associated function dan apa perbedannya dengan fungsi biasa.","datePublished":"2024-08-30T07:44:48.152Z","dateModified":"2024-08-30T07:44:48.152Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/associated-function/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/associated-function"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/associated-function/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.24. Associated Function","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.24. Associated Function</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.24. Associated Function</h1></header><p>Chapter ini membahas tentang <em>associated function</em>. Kita akan belajar apa itu associated function dan apa perbedannya dengan fungsi biasa.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a241-associated-item--associated-function">A.24.1. <em>Associated item</em> & <em>associated function</em><a class="hash-link" href="#a241-associated-item--associated-function" title="Direct link to heading">​</a></h2><p><em>Associated item</em> adalah item yang memiliki asosiasi/hubungan dengan struct atau trait. Item di sini bisa dalam banyak hal, bisa berupa fungsi atau lainnya.</p><p>Fungsi yang terhubung dengan suatu struct atau trait disebut dengan <em>associated function</em>. Fungsi jenis ini ekuivalen seperti fungsi biasa, perbedaannya adalah pada deklarasinya yang harus berada di dalam blok kode <code>impl</code>, dan pemanggilannya harus menggunakan notasi path <code>NamaStruct::nama_fungsi</code>.</p><blockquote><ul><li>Lebih jelasnya mengenai trait dibahas pada chapter <a href="/basic/traits">Traits</a></li><li>Lebih jelasnya mengenai macam-macam item dibahas pada chapter <a href="/basic/path-item#a183-rust-items">Path & Item</a></li></ul></blockquote><p>Ok, mari kita lanjut ke bagian praktik. Silakan tulis kode berikut terlebih dahulu.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> rough_terrain_crane </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">42082</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Rough Terrain Crane"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Technic"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:#?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> rough_terrain_crane</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sebuah struct bernama <code>LegoSet</code> didefinisikan memiliki 4 buah property. Di blok kode fungsi <code>main</code>, dibuat sebuah variabel bernama <code>rough_terrain_crane</code> yang merupakan object/instance dari struct <code>LegoSet</code>, kemudian object tersebut di-print.</p><blockquote><p>Object struct bisa di-print menggunakan macro <code>println</code> karena pada definisi struct ditambahkan attribute <code>#[derive(Debug)]</code>.</p><p>Lebih detailnya mengenai attribute dibahas pada chapter <a href="/basic/attributes">Attributes</a>.</p></blockquote><p>Selanjutnya kita siapkan dua buah fungsi yang berasosiasi dengan struct <code>LegoSet</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a242-keyword-impl">A.24.2. Keyword <code>impl</code><a class="hash-link" href="#a242-keyword-impl" title="Direct link to heading">​</a></h2><p>Keyword <code>impl</code> digunakan untuk membuat <em>associated item</em>.</p><p>Pada konteks ini keyword tersebut digunakan untuk membuat <em>associated function</em> untuk struct <code>LegoSet</code>, sebuah fungsi bernama <code>new</code> dengan tugas adalah untuk membantu pembuatan object <code>LegoSet</code>.</p><p>Silakan tambahkan blok kode <code>impl</code> berikut setelah definisi struct <code>LegoSet</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Notasi penulisan keyword <code>impl</code> bisa dilihat pada contoh di atas, cukup tulis saja keyword tersebut diikuti nama struct yang diinginkan, kemudian diikuti dengan blok kode berisi definisi fungsi.</p><p>Fungsi dalam blok kode <code>impl</code> adalah yang disebut dengan <em>associated function</em>. Pada contoh di atas, fungsi <code>new</code> memiliki asosiasi dengan struct <code>LegoSet</code>.</p><p>Lanjut, panggil fungsi <code>new</code> tersebut untuk membuat object baru bernama <code>xtreme_offroader</code> lalu print isinya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> rough_terrain_crane </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">42082</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Rough Terrain Crane"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Technic"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:#?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> rough_terrain_crane</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> xtreme_offroader </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">42099</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"4X4 X-treme Off-Roader"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Technic"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:#?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> xtreme_offroader</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Associated function" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAAEUCAIAAAA0qq8IAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB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G8N2cE9hRaCQcElxxujC2mN142yEx7VkUhAcDj1Z4y+Ey+YUG++FKm5NoxPmc0M5P8dk3FW1Q6qT3TxZffXTmt9sSeADuzp5fxm6bkyi6o+rR2hc79dXvm51/8/CkykBcc99R3ChV3qd2ejfckERsM8BD2fFKvDdMpuWbe9Jq7uLhuX0VWGApw6t917PnkhRYnDVJvz2Q4QAQPV779k2oVYPP2XHcwYOIlk0PfA8kleoBD2jMe4pz2IM1xr7MQGwxwXHvannubBbvPog8AOKA9AQCwJwAA9gQAwJ4AAHAce9YFX7bNCQDYE3tuxZ5y7QgdAHtCwZyXJ6ySMLsXspIAsGeADUIe66y3zAOcp5x9Lp45f+o0PrKtYoOrA4bVMvWzks7ax50q3H56eh22NvygmAgAx7anDEJW8cZOlrDT6716rP/XCzaqDhhWy3Tt6a694TF5N+YTewJgT60M+3KMMKHTZgl/8ewZRXoW7FkVU6SW6drTX3tbU2BPAOxZ2XHvO8sq3lhlCWNPADisPXUQsog3rk/4xZ4AcBB72iBkP3S9yp+3tWeQXf9WsucK454kGQMctucug5CdeGOdJVxjTyc2uDpg2HPiMO/1AvsC9kzWPrypSY9akGQMcFR7OgKZH298FEgyBsCeojf/NDXe+DDiRJ0A2DPRQunOeNO/n5aGDACwI3sCAGBPAADsCQAA2BMA4Eb27G475CIvAMCE2nPis4cAAEfvucdpRwAA2BN7AgBgTwCAbdmzPiwOAAB7JgLlmUgAwJ6tPXcuugMAMO4JAIA9AQCwJwDAnuzJsCcAQJs9+9frUHkCAEzouQMAAPYEAMCeAADYEwAAewIAYE8AAMCeAADYEwAAewIAYE8AAOwJAADYEwAAewIAYE8AAOwJALBb/g9Ev5BPF8iv7AAAAABJRU5ErkJggg==" width="447" height="276" class="img_ev3q"></p><p>Bisa dilihat pada blok kode <code>main</code>, cara pemanggilan associated function adalah dengan menuliskan nama struct diikuti nama fungsi dengan notasi penulisan path.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token class-name">NamaStruct</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">nama_fungsi</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token class-name">NamaStruct</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">nama_fungsi</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">arg1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token class-name">LegoSet</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">arg1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jadi seperti itu, semoga cukup jelas. Silakan berkreasi dengan menambahkan <em>associated function</em> lainnya agar makin terbiasa. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">what_is_lego</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Lego is a line of plastic construction toys"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">what_is_lego</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> xtreme_offroader </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">42099</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"4X4 X-treme Off-Roader"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Technic"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:#?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> xtreme_offroader</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-fungsi-legosetnew">◉ Fungsi <code>LegoSet::new</code><a class="hash-link" href="#-fungsi-legosetnew" title="Direct link to heading">​</a></h3><p>O iya, sedikit tambahan info saja, fungsi <code>new</code> di-atas didefinisikan menggunakan metode <a href="/basic/struct#-field-init-shorthand">field init shorthand</a>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... adalah ekuivalen dengan ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> age_minimum</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-naming-convention-associated-function">◉ <em>Naming convention</em> associated function<a class="hash-link" href="#-naming-convention-associated-function" title="Direct link to heading">​</a></h3><p>Sesuai anjuran di <a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">halaman dokumentasi Rust</a>, snake case digunakan dalam penamaan associated function. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">NamaStruct</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">nama_associated_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a243-tipe-data-self">A.24.3. Tipe data <code>Self</code><a class="hash-link" href="#a243-tipe-data-self" title="Direct link to heading">​</a></h2><p>Tipe data <code>Self</code> (perhatikan huruf <code>S</code>-nya adalah kapital) merupakan representasi untuk tipe data struct atau trait di mana blok kode <code>impl</code> dideklarasikan.</p><blockquote><p>Tipe data <code>Self</code> hanya bisa digunakan dalam blok kode <code>impl</code></p></blockquote><p>Sebagai contoh, pada kode yang sudah dipraktikkan, keyword <code>impl</code> diterapkan dalam pembuatan <em>associated items</em> untuk struct <code>LegoSet</code>. Dalam blok kode tersebut, tipe data <code>LegoSet</code> bisa diganti dengan <code>Self</code>.</p><p>Silakan lihat contoh di bawah ini, ada 4 buah cara deklarasi fungsi <code>new</code> yang kesemuanya adalah ekuivalen.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a244-associated-function-dalam-module">A.24.4. Associated function dalam module<a class="hash-link" href="#a244-associated-function-dalam-module" title="Direct link to heading">​</a></h2><p>Struct adalah salah satu dari beberapa item yang ada di Rust. Struct bisa saja berada dalam sebuah module, baik inline maupun <em>normal</em> module.</p><p>Sekarang, kode yang sudah dipraktikkan di atas akan kita refactor. Struct <code>LegoSet</code> beserta associated items-nya dipindah ke module file bernama <code>lego</code>, dengan itu maka pemanggilan struct tersebut harus menggunakan path <code>lego::LegoSet</code>.</p><p>Kurang lebih struktur package mendi seperti ini:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── lego.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── main.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Associated function" src="/assets/images/associated-function-2-a72ff54955e3f2afff46536bcf659087.png" width="918" height="814" class="img_ev3q"></p><p>Ada yang aneh, padahal pemanggilan struct <code>LegoSet</code> sudah diganti menjadi <code>lego::LegoSet</code>, tapi kenapa ada error di kode? Silakan <em>hover</em> baris kode yang ada highlight merah, atau jalankan saja program untuk melihat detail errornya.</p><p><img loading="lazy" alt="Associated function" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeEAAADYCAIAAABTKsyIAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOW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LCog/t8Pfvjd2QNXD31v2kr4MBEE8egy2mBRSQHRJLDTVsKHiSCIR5fRBEEQMJogCIKA0QRBEASMJgiCgNEEQRAEjCYIgoDRBEEQBIwmCIIgYDRBEASMJgiCIGA0QRAEjCYIgiCmIP4fuRW765zw4d0AAAAASUVORK5CYII=" width="481" height="216" class="img_ev3q"></p><p>Error muncul karena struct <code>LegoSet</code> adalah private. Solusinya cukup tambahkan keyword <code>pub</code> dalam definisi struct beserta <em>associated function</em>-nya.</p><blockquote><p>Untuk blok kode <code>impl</code> tidak perlu ditambahi keyword <code>pub</code></p></blockquote><p>Ok, setelah update diaplikasikan, coba lihat lagi. Sekarang error-nya berubah, bagian baris pengisian property struct yang jadi error.</p><p><img loading="lazy" alt="Associated function" src="/assets/images/associated-function-4-91b4741ed57bb3ce42997c90f9c0c58e.png" width="741" height="798" class="img_ev3q"></p><p>Error ini terjadi karena property dari struct terdeteksi sebagai <strong>private</strong>. Solusi yang bisa dipergunakan ada 2:</p><ul><li><p>Tambahkan saja keyword <code>pub</code> pada definisi property struct.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/lego.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Atau, tetap biarkan property struct sebagai <strong>private</strong>, namun pada semua statement pembuatan object menggunakan tipe tersebut harus selalu dilakukan via <code>lego::LegoSet::new()</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> object </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">lego</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">LegoSet</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">42099</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"4X4 X-treme Off-Roader"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Technic"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><p>Opsi mana yang paling pas? Pertanyaan ini jawabannya adalah tergantung kebutuhan dan <em>case</em>. Jika memang property struct di-desain agar private (tidak perlu diakses secara publik), maka gunakan saja associated function dalam pembuatan object-nya.</p><p>Namun jika memang ada kebutuhan salah satu property atau kesemuanya harus bisa diakses secara publik, maka tambahkan keyword <code>pub</code> sesuai kebutuhan.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a245-tuple-struct-associated-function">A.24.5. Tuple struct associated function<a class="hash-link" href="#a245-tuple-struct-associated-function" title="Direct link to heading">​</a></h2><p>Sama seperti struct, tuple struct juga bisa memiliki <em>associated items</em>. Cara deklarasi dan pemanggilan item-nya juga sama.</p><p>Pada contoh berikut, tuple struct <code>Color</code> memiliki 3 buah associated functions, yaitu <code>red</code>, <code>green</code>, dan <code>blue</code>.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── model.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── main.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/model.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Color</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">red</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">255</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">green</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">255</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">blue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">255</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">model</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> red </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">model</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">red</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> green </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">model</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">green</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> blue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">model</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">blue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:#?} {:#?} {:#?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> red</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> green</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> blue</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> random_color </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">model</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">25</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">47</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:#?} "</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> random_color</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Hmm, ada yang aneh, karena suatu alasan statement <code>model::Color</code> dianggap error.</p><p><img loading="lazy" alt="Associated function" src="/assets/images/associated-function-5-cb72a7e4944bd7b12502c0dc6e7acd7a.png" width="662" height="244" class="img_ev3q"></p><p>Error ini sebenarnya mirip dengan error praktik sebelumnya, ketika mencoba membuat object baru dari struct sedangkan property struct tersebut adalah private.</p><p>Pada kasus struct, solusinya cukup dengan tambahkan keyword <code>pub</code> atau siapkan <em>associated function</em> untuk pembuatan object. Pada tuple struct, solusinya juga mirip, ada dua opsi yang bisa dipilih.</p><ul><li><p>Tambahkan saja keyword <code>pub</code> pada definisi parameter tuple struct.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/model.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// before</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// after</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Atau, tetap biarkan parameter tuple struct sebagai <strong>private</strong>, namun siapkan <em>associated function</em> baru untuk pembuatan object struct tuple, seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/model.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Color</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> g</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> random_color </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">model</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">25</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">47</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:#?} "</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> random_color</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><blockquote><p>Lebih jelasnya mengenai visibility property dibahas pada chapter <a href="/basic/visibility-privacy">Module System ➜ Visibility & Privacy</a></p></blockquote><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/associated_function" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../associated_function</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/function">Function</a></li><li><a href="/basic/method">Method</a></li><li><a href="/basic/visibility-privacy">Module System ➜ Visibility & Privacy</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch05-03-method-syntax.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch05-03-method-syntax.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.impl.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.impl.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.SelfTy.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.SelfTy.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/fn/methods.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/fn/methods.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/struct"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.23. Struct</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/method"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.25. Method</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a241-associated-item--associated-function" class="table-of-contents__link toc-highlight">A.24.1. <em>Associated item</em> & <em>associated function</em></a></li><li><a href="#a242-keyword-impl" class="table-of-contents__link toc-highlight">A.24.2. Keyword <code>impl</code></a><ul><li><a href="#-fungsi-legosetnew" class="table-of-contents__link toc-highlight">◉ Fungsi <code>LegoSet::new</code></a></li><li><a href="#-naming-convention-associated-function" class="table-of-contents__link toc-highlight">◉ <em>Naming convention</em> associated function</a></li></ul></li><li><a href="#a243-tipe-data-self" class="table-of-contents__link toc-highlight">A.24.3. Tipe data <code>Self</code></a></li><li><a href="#a244-associated-function-dalam-module" class="table-of-contents__link toc-highlight">A.24.4. Associated function dalam module</a></li><li><a href="#a245-tuple-struct-associated-function" class="table-of-contents__link toc-highlight">A.24.5. Tuple struct associated function</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.24. Associated Function</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.24. Associated Function</h1></header><p>Chapter ini membahas tentang <em>associated function</em>. Kita akan belajar apa itu associated function dan apa perbedannya dengan fungsi biasa.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a241-associated-item--associated-function">A.24.1. <em>Associated item</em> & <em>associated function</em><a class="hash-link" href="#a241-associated-item--associated-function" title="Direct link to heading">​</a></h2><p><em>Associated item</em> adalah item yang memiliki asosiasi/hubungan dengan struct atau trait. Item di sini bisa dalam banyak hal, bisa berupa fungsi atau lainnya.</p><p>Fungsi yang terhubung dengan suatu struct atau trait disebut dengan <em>associated function</em>. Fungsi jenis ini ekuivalen seperti fungsi biasa, perbedaannya adalah pada deklarasinya yang harus berada di dalam blok kode <code>impl</code>, dan pemanggilannya harus menggunakan notasi path <code>NamaStruct::nama_fungsi</code>.</p><blockquote><ul><li>Lebih jelasnya mengenai trait dibahas pada chapter <a href="/basic/traits">Traits</a></li><li>Lebih jelasnya mengenai macam-macam item dibahas pada chapter <a href="/basic/path-item#a183-rust-items">Path & Item</a></li></ul></blockquote><p>Ok, mari kita lanjut ke bagian praktik. Silakan tulis kode berikut terlebih dahulu.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> rough_terrain_crane </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">42082</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Rough Terrain Crane"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Technic"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:#?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> rough_terrain_crane</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sebuah struct bernama <code>LegoSet</code> didefinisikan memiliki 4 buah property. Di blok kode fungsi <code>main</code>, dibuat sebuah variabel bernama <code>rough_terrain_crane</code> yang merupakan object/instance dari struct <code>LegoSet</code>, kemudian object tersebut di-print.</p><blockquote><p>Object struct bisa di-print menggunakan macro <code>println</code> karena pada definisi struct ditambahkan attribute <code>#[derive(Debug)]</code>.</p><p>Lebih detailnya mengenai attribute dibahas pada chapter <a href="/basic/attributes">Attributes</a>.</p></blockquote><p>Selanjutnya kita siapkan dua buah fungsi yang berasosiasi dengan struct <code>LegoSet</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a242-keyword-impl">A.24.2. Keyword <code>impl</code><a class="hash-link" href="#a242-keyword-impl" title="Direct link to heading">​</a></h2><p>Keyword <code>impl</code> digunakan untuk membuat <em>associated item</em>.</p><p>Pada konteks ini keyword tersebut digunakan untuk membuat <em>associated function</em> untuk struct <code>LegoSet</code>, sebuah fungsi bernama <code>new</code> dengan tugas adalah untuk membantu pembuatan object <code>LegoSet</code>.</p><p>Silakan tambahkan blok kode <code>impl</code> berikut setelah definisi struct <code>LegoSet</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Notasi penulisan keyword <code>impl</code> bisa dilihat pada contoh di atas, cukup tulis saja keyword tersebut diikuti nama struct yang diinginkan, kemudian diikuti dengan blok kode berisi definisi fungsi.</p><p>Fungsi dalam blok kode <code>impl</code> adalah yang disebut dengan <em>associated function</em>. Pada contoh di atas, fungsi <code>new</code> memiliki asosiasi dengan struct <code>LegoSet</code>.</p><p>Lanjut, panggil fungsi <code>new</code> tersebut untuk membuat object baru bernama <code>xtreme_offroader</code> lalu print isinya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> rough_terrain_crane </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">42082</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Rough Terrain Crane"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Technic"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:#?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> rough_terrain_crane</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> xtreme_offroader </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">42099</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"4X4 X-treme Off-Roader"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Technic"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:#?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> xtreme_offroader</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="Associated function" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAAEUCAIAAAA0qq8IAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL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1WeSQTYnT3LnVkTk5ZkDyUJwZHxwtB1Eccr83TjSLUFpZOm36cbLxtEZqnkgqXjH8lZB9ihPZ2UnjQlV8pMJgSHV0G8N2cE9hRaCQcElxxujC2mN142yEx7VkUhAcDj1Z4y+Ey+YUG++FKm5NoxPmc0M5P8dk3FW1Q6qT3TxZffXTmt9sSeADuzp5fxm6bkyi6o+rR2hc79dXvm51/8/CkykBcc99R3ChV3qd2ejfckERsM8BD2fFKvDdMpuWbe9Jq7uLhuX0VWGApw6t917PnkhRYnDVJvz2Q4QAQPV779k2oVYPP2XHcwYOIlk0PfA8kleoBD2jMe4pz2IM1xr7MQGwxwXHvannubBbvPog8AOKA9AQCwJwAA9gQAwJ4AAHAce9YFX7bNCQDYE3tuxZ5y7QgdAHtCwZyXJ6ySMLsXspIAsGeADUIe66y3zAOcp5x9Lp45f+o0PrKtYoOrA4bVMvWzks7ax50q3H56eh22NvygmAgAx7anDEJW8cZOlrDT6716rP/XCzaqDhhWy3Tt6a694TF5N+YTewJgT60M+3KMMKHTZgl/8ewZRXoW7FkVU6SW6drTX3tbU2BPAOxZ2XHvO8sq3lhlCWNPADisPXUQsog3rk/4xZ4AcBB72iBkP3S9yp+3tWeQXf9WsucK454kGQMctucug5CdeGOdJVxjTyc2uDpg2HPiMO/1AvsC9kzWPrypSY9akGQMcFR7OgKZH298FEgyBsCeojf/NDXe+DDiRJ0A2DPRQunOeNO/n5aGDACwI3sCAGBPAADsCQAA2BMA4Eb27G475CIvAMCE2nPis4cAAEfvucdpRwAA2BN7AgBgTwCAbdmzPiwOAAB7JgLlmUgAwJ6tPXcuugMAMO4JAIA9AQCwJwDAnuzJsCcAQJs9+9frUHkCAEzouQMAAPYEAMCeAADYEwAAewIAYE8AAMCeAADYEwAAewIAYE8AAOwJAADYEwAAewIAYE8AAOwJALBb/g9Ev5BPF8iv7AAAAABJRU5ErkJggg==" width="447" height="276" class="img_CujE"></p><p>Bisa dilihat pada blok kode <code>main</code>, cara pemanggilan associated function adalah dengan menuliskan nama struct diikuti nama fungsi dengan notasi penulisan path.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token class-name">NamaStruct</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">nama_fungsi</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token class-name">NamaStruct</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">nama_fungsi</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">arg1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token class-name">LegoSet</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">arg1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jadi seperti itu, semoga cukup jelas. Silakan berkreasi dengan menambahkan <em>associated function</em> lainnya agar makin terbiasa. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">what_is_lego</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Lego is a line of plastic construction toys"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">what_is_lego</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> xtreme_offroader </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">42099</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"4X4 X-treme Off-Roader"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Technic"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:#?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> xtreme_offroader</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-fungsi-legosetnew">◉ Fungsi <code>LegoSet::new</code><a class="hash-link" href="#-fungsi-legosetnew" title="Direct link to heading">​</a></h3><p>O iya, sedikit tambahan info saja, fungsi <code>new</code> di-atas didefinisikan menggunakan metode <a href="/basic/struct#-field-init-shorthand">field init shorthand</a>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... adalah ekuivalen dengan ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> age_minimum</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-naming-convention-associated-function">◉ <em>Naming convention</em> associated function<a class="hash-link" href="#-naming-convention-associated-function" title="Direct link to heading">​</a></h3><p>Sesuai anjuran di <a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">halaman dokumentasi Rust</a>, snake case digunakan dalam penamaan associated function. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">NamaStruct</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">nama_associated_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a243-tipe-data-self">A.24.3. Tipe data <code>Self</code><a class="hash-link" href="#a243-tipe-data-self" title="Direct link to heading">​</a></h2><p>Tipe data <code>Self</code> (perhatikan huruf <code>S</code>-nya adalah kapital) merupakan representasi untuk tipe data struct atau trait di mana blok kode <code>impl</code> dideklarasikan.</p><blockquote><p>Tipe data <code>Self</code> hanya bisa digunakan dalam blok kode <code>impl</code></p></blockquote><p>Sebagai contoh, pada kode yang sudah dipraktikkan, keyword <code>impl</code> diterapkan dalam pembuatan <em>associated items</em> untuk struct <code>LegoSet</code>. Dalam blok kode tersebut, tipe data <code>LegoSet</code> bisa diganti dengan <code>Self</code>.</p><p>Silakan lihat contoh di bawah ini, ada 4 buah cara deklarasi fungsi <code>new</code> yang kesemuanya adalah ekuivalen.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age_minimum </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a244-associated-function-dalam-module">A.24.4. Associated function dalam module<a class="hash-link" href="#a244-associated-function-dalam-module" title="Direct link to heading">​</a></h2><p>Struct adalah salah satu dari beberapa item yang ada di Rust. Struct bisa saja berada dalam sebuah module, baik inline maupun <em>normal</em> module.</p><p>Sekarang, kode yang sudah dipraktikkan di atas akan kita refactor. Struct <code>LegoSet</code> beserta associated items-nya dipindah ke module file bernama <code>lego</code>, dengan itu maka pemanggilan struct tersebut harus menggunakan path <code>lego::LegoSet</code>.</p><p>Kurang lebih struktur package mendi seperti ini:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── lego.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── main.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Associated function" src="/assets/images/associated-function-2-a72ff54955e3f2afff46536bcf659087.png" width="918" height="814" class="img_CujE"></p><p>Ada yang aneh, padahal pemanggilan struct <code>LegoSet</code> sudah diganti menjadi <code>lego::LegoSet</code>, tapi kenapa ada error di kode? Silakan <em>hover</em> baris kode yang ada highlight merah, atau jalankan saja program untuk melihat detail errornya.</p><p><img loading="lazy" alt="Associated function" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeEAAADYCAIAAABTKsyIAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw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Zg9H6e4YnLvPZIghi+vLowOvoCdAq9u6eNyj86cHv3v/Rj/732R80lbzyq/8WPfmvq+utlhq9RHSW3+sgCGJKGT1UKA4qLCog/t8Pfvjd2QNXD31v2kr4MBEE8egy2mBRSQHRJLDTVsKHiSCIR5fRBEEQMJogCIKA0QRBEASMJgiCgNEEQRAEjCYIgoDRBEEQBIwmCIIgYDRBEASMJgiCIGA0QRAEjCYIgiCmIP4fuRW765zw4d0AAAAASUVORK5CYII=" width="481" height="216" class="img_CujE"></p><p>Error muncul karena struct <code>LegoSet</code> adalah private. Solusinya cukup tambahkan keyword <code>pub</code> dalam definisi struct beserta <em>associated function</em>-nya.</p><blockquote><p>Untuk blok kode <code>impl</code> tidak perlu ditambahi keyword <code>pub</code></p></blockquote><p>Ok, setelah update diaplikasikan, coba lihat lagi. Sekarang error-nya berubah, bagian baris pengisian property struct yang jadi error.</p><p><img loading="lazy" alt="Associated function" src="/assets/images/associated-function-4-91b4741ed57bb3ce42997c90f9c0c58e.png" width="741" height="798" class="img_CujE"></p><p>Error ini terjadi karena property dari struct terdeteksi sebagai <strong>private</strong>. Solusi yang bisa dipergunakan ada 2:</p><ul><li><p>Tambahkan saja keyword <code>pub</code> pada definisi property struct.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/lego.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Atau, tetap biarkan property struct sebagai <strong>private</strong>, namun pada semua statement pembuatan object menggunakan tipe tersebut harus selalu dilakukan via <code>lego::LegoSet::new()</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> object </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">lego</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">LegoSet</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">42099</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"4X4 X-treme Off-Roader"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Technic"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><p>Opsi mana yang paling pas? Pertanyaan ini jawabannya adalah tergantung kebutuhan dan <em>case</em>. Jika memang property struct di-desain agar private (tidak perlu diakses secara publik), maka gunakan saja associated function dalam pembuatan object-nya.</p><p>Namun jika memang ada kebutuhan salah satu property atau kesemuanya harus bisa diakses secara publik, maka tambahkan keyword <code>pub</code> sesuai kebutuhan.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a245-tuple-struct-associated-function">A.24.5. Tuple struct associated function<a class="hash-link" href="#a245-tuple-struct-associated-function" title="Direct link to heading">​</a></h2><p>Sama seperti struct, tuple struct juga bisa memiliki <em>associated items</em>. Cara deklarasi dan pemanggilan item-nya juga sama.</p><p>Pada contoh berikut, tuple struct <code>Color</code> memiliki 3 buah associated functions, yaitu <code>red</code>, <code>green</code>, dan <code>blue</code>.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── model.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── main.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/model.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Color</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">red</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">255</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">green</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">255</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">blue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">255</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">model</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> red </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">model</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">red</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> green </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">model</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">green</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> blue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">model</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">blue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:#?} {:#?} {:#?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> red</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> green</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> blue</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> random_color </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">model</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">25</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">47</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:#?} "</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> random_color</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Hmm, ada yang aneh, karena suatu alasan statement <code>model::Color</code> dianggap error.</p><p><img loading="lazy" alt="Associated function" src="/assets/images/associated-function-5-cb72a7e4944bd7b12502c0dc6e7acd7a.png" width="662" height="244" class="img_CujE"></p><p>Error ini sebenarnya mirip dengan error praktik sebelumnya, ketika mencoba membuat object baru dari struct sedangkan property struct tersebut adalah private.</p><p>Pada kasus struct, solusinya cukup dengan tambahkan keyword <code>pub</code> atau siapkan <em>associated function</em> untuk pembuatan object. Pada tuple struct, solusinya juga mirip, ada dua opsi yang bisa dipilih.</p><ul><li><p>Tambahkan saja keyword <code>pub</code> pada definisi parameter tuple struct.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/model.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// before</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// after</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Atau, tetap biarkan parameter tuple struct sebagai <strong>private</strong>, namun siapkan <em>associated function</em> baru untuk pembuatan object struct tuple, seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/model.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Color</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> g</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> random_color </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">model</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">25</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">47</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:#?} "</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> random_color</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><blockquote><p>Lebih jelasnya mengenai visibility property dibahas pada chapter <a href="/basic/visibility-privacy">Module System ➜ Visibility & Privacy</a></p></blockquote><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/associated_function" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../associated_function</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/function">Function</a></li><li><a href="/basic/method">Method</a></li><li><a href="/basic/visibility-privacy">Module System ➜ Visibility & Privacy</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch05-03-method-syntax.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch05-03-method-syntax.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.impl.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.impl.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.SelfTy.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.SelfTy.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/fn/methods.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/fn/methods.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/struct"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.23. Struct</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/method"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.25. Method</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a241-associated-item--associated-function" class="table-of-contents__link toc-highlight">A.24.1. <em>Associated item</em> & <em>associated function</em></a></li><li><a href="#a242-keyword-impl" class="table-of-contents__link toc-highlight">A.24.2. Keyword <code>impl</code></a><ul><li><a href="#-fungsi-legosetnew" class="table-of-contents__link toc-highlight">◉ Fungsi <code>LegoSet::new</code></a></li><li><a href="#-naming-convention-associated-function" class="table-of-contents__link toc-highlight">◉ <em>Naming convention</em> associated function</a></li></ul></li><li><a href="#a243-tipe-data-self" class="table-of-contents__link toc-highlight">A.24.3. Tipe data <code>Self</code></a></li><li><a href="#a244-associated-function-dalam-module" class="table-of-contents__link toc-highlight">A.24.4. Associated function dalam module</a></li><li><a href="#a245-tuple-struct-associated-function" class="table-of-contents__link toc-highlight">A.24.5. Tuple struct associated function</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/attributes.html b/basic/attributes.html index dd5d1e4b..d6c038c5 100644 --- a/basic/attributes.html +++ b/basic/attributes.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/attributes/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/attributes/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.51. Attributes","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/attributes/#webpage"},"wordCount":1329,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/attributes/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/attributes/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/attributes","name":"A.51. Attributes","description":"Kita telah beberapa kali menggunakan attributes pada chapter-chapter sebelumnya, contohnya seperti #[derive(Debug)]. Pada chapter ini kita akan bahas tentang apa sebenarnya attributes, macam-macam jenisnya, beserta kegunaannya.","datePublished":"2024-08-01T10:17:28.261Z","dateModified":"2024-08-01T10:17:28.261Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/attributes/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/attributes"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/attributes/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.51. Attributes","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/attributes/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/attributes/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.51. Attributes","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/attributes/#webpage"},"wordCount":1329,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/attributes/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/attributes/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/attributes","name":"A.51. Attributes","description":"Kita telah beberapa kali menggunakan attributes pada chapter-chapter sebelumnya, contohnya seperti #[derive(Debug)]. Pada chapter ini kita akan bahas tentang apa sebenarnya attributes, macam-macam jenisnya, beserta kegunaannya.","datePublished":"2024-08-30T07:44:48.359Z","dateModified":"2024-08-30T07:44:48.359Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/attributes/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/attributes"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/attributes/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.51. Attributes","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.51. Attributes</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.51. Attributes</h1></header><p>Kita telah beberapa kali menggunakan attributes pada chapter-chapter sebelumnya, contohnya seperti <code>#[derive(Debug)]</code>. Pada chapter ini kita akan bahas tentang apa sebenarnya attributes, macam-macam jenisnya, beserta kegunaannya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a511-konsep-attributes">A.51.1. Konsep attributes<a class="hash-link" href="#a511-konsep-attributes" title="Direct link to heading">​</a></h2><p>Attributes adalah metadata yang didefinisikan untuk suatu crate, module, atau module item. Kegunaan dari attributes berbeda satu sama lain, tergantung attribute apa yang dipakai (kita akan bahas satu per satu).</p><p>Attribute dikategorikan menjadi 2:</p><ul><li>Outer attributes</li><li>Inner attributes</li></ul><p>Keduanya memiliki kegunaan yang sama, pembedanya adalah posisi di mana attribute harus dituliskan.</p><p>Outer attribute dituliskan tepat sebelum target (crate, module, module item, atau lainnya) dengan notasi penulisan seperti berikut:</p><ul><li><code>#[attribute = "value"]</code></li><li><code>#[attribute(key = "value")]</code></li><li><code>#[attribute(value)]</code></li><li><code>#[attribute(not(key = "value"))]</code> untuk operasi <strong>NOT</strong></li><li><code>#[attribute(not(value))]</code> untuk operasi <strong>NOT</strong></li></ul><p>Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sedikit berbeda dengan inner attribute, penulisannya berada di dalam target (crate, module, module item, atau lainnya). Notasi penulisannya:</p><ul><li><code>#![attribute = "value"]</code></li><li><code>#![attribute(key = "value")]</code></li><li><code>#![attribute(value)]</code></li><li><code>#![attribute(not(key = "value"))]</code> untuk operasi <strong>NOT</strong></li><li><code>#![attribute(not(value))]</code> untuk operasi <strong>NOT</strong></li></ul><p>Rust mengenal beberapa jenis attributes, dan kita akan membahasnya satu per satu.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a512-attribute-derive">A.51.2. Attribute <code>derive</code><a class="hash-link" href="#a512-attribute-derive" title="Direct link to heading">​</a></h2><p>Attribute <code>derive</code> digunakan untuk mempermudah implementasi suatu trait ke tipe data.</p><p>Kita telah mempelajari cara implementasi trait pada chapter <a href="/basic/traits">Traits</a> yaitu menggunakan keyword <code>impl</code> dan <code>for</code>, kemudian diikuti dengan method serta implementasinya.</p><p>Dengan memanfaatkan attribute <code>derive</code> kita tidak perlu menggunakan cara tersebut. Cukup tulis saja attribute <code>derive</code> beserta trait yang ingin diimplementasikan.</p><p>Agar lebih jelas, silakan pelajari contoh berikut terlebih dahulu:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token class-name">SuperheroSuperman</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"superman"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token class-name">SuperheroOmniMan</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"omniman"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token class-name">SuperheroHyperion</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hyperion"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Superhero</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Hyperion</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello superman!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Attribute" src="/assets/images/attribute-1-c3fd3abaf784b196c8b4da4512bb8abd.png" width="958" height="719" class="img_ev3q"></p><p>Kode di atas menghasilkan error karena enum <code>Superhero</code> tidak mengadopsi trait <code>PartialEq</code> yang mana trait ini diperlukan dalam seleksi kondisi menggunakan keyword <code>if</code> dan operator <code>==</code>.</p><p>Cara mengatasi error tersebut adalah dengan mengimplementasikan trait <code>PartialEq</code> secara eksplisit. Sekarang coba tambahkan kode berikut pada deklarasi enum <code>Superhero</code>, maka error akan hilang.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Superhero</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Hyperion</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">PartialEq</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">eq</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> other</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">Self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> other</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Hyperion</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Hyperion</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Cara lain untuk mengatasi error di atas, selain menggunakan teknik implementasi trait secara eksplisit, adalah dengan menggunakan attribute <code>derive</code> disertai trait <code>PartialEq</code>. Kurang lebih penulisan cara ini bisa dilihat di bawah ini. Cukup hapus block kode <code>impl</code> lalu tambahkan attribute pada deklarasi enum <code>Superhero</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(PartialEq)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Superhero</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Hyperion</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Cukup mudah bukan?</p><p>Contoh lainnya, misalnya variabel <code>value</code> ingin di-print seperti pada kode berikut ini, pasti hasilnya error.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello superman!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{value} (via `Display` trait)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{value:#?} (via `Debug` trait)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Attribute" src="/assets/images/attribute-2-935bd54d9113cbcfb6a5c07a7ebd9f68.png" width="900" height="461" class="img_ev3q"></p><p>Cara <em>resolve</em> error di atas adalah dengan mengimplementasikan trait <code>Display</code> dan <code>Debug</code> secara eksplisit. Atau, bisa juga menggunakan attribute <code>derive</code> yang pastinya lebih praktis.</p><p>Kabar buruknya, hanya trait <code>Debug</code> yang menyediakan fitur implementasi trait menggunakan attribute <code>derive</code>. Untuk trait <code>Display</code> kita perlu melakukan implementasi secara eksplisit.</p><blockquote><p>Untuk tau mana trait yang bisa di-<em>derive</em> atau tidak, cukup lihat saja <em>highlight</em> error yang muncul saat penulisan kode atau kompilasi.</p></blockquote><p>Ok, kita implementasikan saja keduanya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(PartialEq, Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Superhero</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Hyperion</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Display</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">fmt</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Formatter</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'_</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Result</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">write!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">f</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"{self:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Attribute" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhkAAAB/CAIAAADNSkeyAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAE72lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4wLWMwMDAgMTM3LmRhNGE3ZTUsIDIwMjIvMTEvMjctMDk6MzU6MDMgICAgICAgICI+IDxyZGY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nmY/SSXEg61h3i8BAMAPtLAAAAC4ZRTmuAAAAHQX5BIAAABuQS4BAADgFuQSAAAAbkEuAQAA4BbkEgAAAG5BLgEAAOAW5BIAAABuQS4BAADgFuQSAAAAbkEuAQAA4Jb/B9WPHPNCncoZAAAAAElFTkSuQmCC" width="537" height="127" class="img_ev3q"></p><p>Bisa dilihat, hasilnya program tereksekusi tanpa error. Enum <code>Superhero</code> kini mengadopsi 3 trait:</p><ul><li>Trait <code>PartialEq</code> via attribute <code>derive</code></li><li>Trait <code>Debug</code> via attribute <code>derive</code></li><li>Trait <code>Display</code> via implementasi eksplisit</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a513-attribute-cfg--configuration">A.51.3. Attribute <code>cfg</code> / <em>configuration</em><a class="hash-link" href="#a513-attribute-cfg--configuration" title="Direct link to heading">​</a></h2><p>Attribute <code>cfg</code> digunakan untuk operasi-operasi yang berhubungan dengan target arsitekture hardware/prosesor, misalnya seperti conditional compilation ketika OS adalah linux, dan lainnya.</p><p>Salah satu contoh penerapannya bisa dilihat pada kode berikut. Ada 2 buah module yang namanya sama persis, perbedaannya adalah satu didefinisikan khusus untuk platform <code>linux</code>, dan satunya lagi untuk platform <code>windows</code>. Hal seperti ini bisa dilakukan menggunakan attribute <code>cfg</code> dengan key <code>target_os</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[cfg(target_os = </span><span class="token attribute attr-name string" style="color:#e3116c">"linux"</span><span class="token attribute attr-name" style="color:#00a4db">)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">util</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello (from linux)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token attribute attr-name" style="color:#00a4db">#[cfg(target_os = </span><span class="token attribute attr-name string" style="color:#e3116c">"windows"</span><span class="token attribute attr-name" style="color:#00a4db">)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">util</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello (from windows)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"how are you"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat cara penulisannya adalah <code>cfg()</code> kemudian diisi key <code>target_os</code> dengan value adalah <code>windows</code> atau <code>linux</code>.</p><p>Dengan kondisi kode seperti di atas, ketika berada di sistem operasi <code>linux</code>, item <code>util::say_hello</code> bisa diakses. Sedangkan pada sistem operasi <code>windows</code>, item <code>util::say_hello</code> dan <code>util::say_something</code> bisa diakses.</p><p>Attribute <code>cfg(target_os)</code> juga bisa diterapkan pada block kode. Contohnya seperti pada kode berikut. Item <code>util::say_hello</code> dipanggil di fungsi <code>main</code>. Dan khusus untuk sistem operasi <code>windows</code>, block kode berisi pemanggilan <code>util::say_something</code> juga dipanggil.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">util</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[cfg(target_os = </span><span class="token attribute attr-name string" style="color:#e3116c">"windows"</span><span class="token attribute attr-name" style="color:#00a4db">)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">util</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ada beberapa key yang tersedia pada attribute <code>cfg</code>, di antaranya:</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-configuration-target_os">◉ Configuration <code>target_os</code><a class="hash-link" href="#-configuration-target_os" title="Direct link to heading">​</a></h3><p>Digunakan untuk menandai bahwa item atau statement di bawah definisi attribute ini dikhususkan untuk sistem operasi tertentu.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[cfg(target_os = </span><span class="token attribute attr-name string" style="color:#e3116c">"value"</span><span class="token attribute attr-name" style="color:#00a4db">)]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Opsi value yang tersedia:</p><ul><li><code>windows</code></li><li><code>macos</code></li><li><code>ios</code></li><li><code>linux</code></li><li><code>android</code></li><li><code>freebsd</code></li><li><code>dragonfly</code></li><li><code>openbsd</code></li><li><code>netbsd</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-configuration-target_arch">◉ Configuration <code>target_arch</code><a class="hash-link" href="#-configuration-target_arch" title="Direct link to heading">​</a></h3><p>Digunakan untuk menandai bahwa item atau statement di bawah definisi attribute ini dikhususkan untuk arsitektur CPU tertentu.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[cfg(target_arch = </span><span class="token attribute attr-name string" style="color:#e3116c">"value"</span><span class="token attribute attr-name" style="color:#00a4db">)]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Opsi value yang tersedia:</p><ul><li><code>x86</code></li><li><code>x86_64</code></li><li><code>mips</code></li><li><code>powerpc</code></li><li><code>powerpc64</code></li><li><code>arm</code></li><li><code>aarch64</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-macro-cfg-dan-conditional-compilation">◉ Macro <code>cfg!()</code> dan conditional compilation<a class="hash-link" href="#-macro-cfg-dan-conditional-compilation" title="Direct link to heading">​</a></h3><p>Attribute <code>cfg</code> juga tersedia versi macro-nya, yaitu <code>cfg!()</code>. Macro ini kegunaannya sama seperti attribute <code>cfg</code>, perbedaannya macro <code>cfg!()</code> mengembalikan nilai boolean, yang darinya bisa dikombinasikan dengan seleksi kondisi untuk keperluan conditional compilation. Contoh penggunaan macro <code>cfg!()</code>:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[cfg(target_os = </span><span class="token attribute attr-name string" style="color:#e3116c">"linux"</span><span class="token attribute attr-name" style="color:#00a4db">)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello linux. from attribute cfg"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[cfg(target_os = </span><span class="token attribute attr-name string" style="color:#e3116c">"windows"</span><span class="token attribute attr-name" style="color:#00a4db">)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello windows. from attribute cfg"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">cfg!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">target_os </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"linux"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello linux. from macro cfg!()"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">cfg!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">target_os </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"windows"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello windows. from macro cfg!()"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Penjelasan:</p><ul><li>Kode block <code>#[cfg(target_os = "linux")]</code> hanya dieksekusi ketika program dijalankan di Linux.</li><li>Kode block <code>#[cfg(target_os = "windows")]</code> hanya dieksekusi ketika program dijalankan di Windows.</li><li>Seleksi kondisi <code>cfg!(target_os = ...)</code> merupakan alternatif penulisan 2 kode sebelumnya yang digabung menjadi 1 rantai seleksi kondisi.<ul><li>Kondisi <code>cfg!(target_os = "linux")</code> terpenuhi ketika program dijalankan di Linux</li><li>Kondisi <code>cfg!(target_os = "windows")</code> terpenuhi ketika program dijalankan di Windows</li></ul></li></ul><p>Output program ketika dijalankan di komputer penulis yang menggunakan Windows:</p><p><img loading="lazy" alt="Attribute" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdMAAABsCAIAAAC+d8/uAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAE7mlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuY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piuPsLlHrwUkq5pw+/TsRHFWil4RpVEBHJgGojO7ZyuhUxHLpFhTHJ+ySk1TMSbZ9Er+29gwsDVcCnLbuH4K4MaiM7sHK6FR2HH9u13GhXDq74ji7S45SMX/7lVz2bGNnBgzcbWCyiiBuDCqjWzHk/sroVARy6eyK4+xt5BAVc7I723zHt4UlBQsLEQjiWaAyugcro1P5cdb7VLl0RsVxqktStpykYn6s9vpT6yh7GMLSn4pV3Pjkodyoh0wyUKsMcTq2qpiTO19EszA6C/YaIojn4nlvUiAeh60q5mRPxfTUH5q/drxmW1lGVE2JaJMvgngiOOZF5GACKubKjTvfzOoj73F4j27adTzldAFqnyOTBIy8CIIgcoOrDQiCIHKDkRdBEERuMPIiCILIDUZeBEEQucHIiyAIIjcYeREEQeQGIy+CIIjc/DecT72QQDsWUAAAAABJRU5ErkJggg==" width="467" height="108" class="img_ev3q"></p><blockquote><p>Lebih detailnya mengenai macro akan dibahas di chapter terpisah.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-configuration-debug_assertions">◉ Configuration <code>debug_assertions</code><a class="hash-link" href="#-configuration-debug_assertions" title="Direct link to heading">​</a></h3><p>By default, Rust menggunakan profil kompilasi <strong>debug</strong> saat eksekusi command <code>cargo run</code>. Di kode program, penanda apakah profil kompilasi debug digunakan atau tidak bisa dilihat dari nilai konfigurasi <code>#[cfg(debug_assertions)]</code> via attribute, dan <code>cfg!(debug_assertions)</code> via macro.</p><p>Nilai <code>cfg!(debug_assertions)</code> selalu bernilai <code>true</code> kecuali command yang digunakan saat eksekusi program adalah <code>cargo run --release</code>. Flag <code>--release</code> saat eksekusi program membuat nilai <code>debug_assertions</code> menjadi <code>false</code>.</p><p>Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[cfg(debug_assertions)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"debug mode. from attribute cfg"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[cfg(not(debug_assertions))]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"release mode. from attribute cfg"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">cfg!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">debug_assertions</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"debug mode. from macro cfg!()"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"release mode. from macro cfg!()"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Output eksekusi program menggunakan command <code>cargo run</code> vs <code>cargo run --release</code>.</p><p><img loading="lazy" alt="Attribute" src="/assets/images/attribute-5-b485867d9d43b989698d4f1a231cfb4b.png" width="499" height="200" class="img_ev3q"></p><p>Pada profil release, kode program dikompilasi sekaligus dioptimisasi. Penggunaan profil ini dianjurkan untuk distribusi production binary. </p><blockquote><p>Di beberapa bahasa pemrograman lain deteksi profile dilakukan mengunakan kombinasi keyword <code>if</code> dan nilai environment variable (<code>ENV</code>). Dari situ bisa dilihat apakah environment yang digunakan adalah production, staging, atau local.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-other-configuration">◉ Other configuration<a class="hash-link" href="#-other-configuration" title="Direct link to heading">​</a></h3><p>Ada beberapa key konfigurasi lainnya yang tersedia. Lebih detailnya silakan lihat di <a href="https://doc.rust-lang.org/reference/conditional-compilation.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/conditional-compilation.html</a></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a514-attribute-linting--diagnostic">A.51.4. Attribute <em>linting</em> & <em>diagnostic</em><a class="hash-link" href="#a514-attribute-linting--diagnostic" title="Direct link to heading">​</a></h2><p>Ada beberapa attribute name yang bisa digunakan untuk meng-override <em>default linting</em> milik Rust ataupun menandai indikator <em>diagnostic</em> lainnya, seperti warning yang muncul karena ada kode yang tidak digunakan, dll; Warning sejenis ini bisa di-override menggunakan attribute.</p><p>Contoh kasus yang berhubungan dengan <em>linting</em> bisa dilihat pada kode berikut.</p><p><img loading="lazy" alt="Attribute" src="/assets/images/attribute-6-0ae9faf44e5f0113b2599d985a7f331d.png" width="351" height="363" class="img_ev3q"></p><p>Kode di atas tidak menghasilkan error. Kode akan dieksekusi tanpa error. Namun ada 3 buah warning yang muncul karena beberapa baris kode tidak digunakan atau sia-sia.</p><p>Cara agar warning tidak muncul bisa dengan menggunakan attribute <code>#[allow(value)]</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[allow(unused_imports)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Display</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token attribute attr-name" style="color:#00a4db">#[allow(dead_code)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"how are you"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">m1</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[allow(missing_docs)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">undocumented_one</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[warn(missing_docs)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">undocumented_too</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// #[deny(missing_docs)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// pub fn undocumented_end() -> i32 { 3 }</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[allow(unused_variables)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> name </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"noval agung"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas, ada beberapa attribute yang digunakan:</p><ul><li><code>#[allow(unused_imports)]</code> digunakan untuk antisipasi error yang muncul ketika module item di-import namun tidak digunakan.</li><li><code>#[allow(dead_code)]</code> digunakan untuk membolehkan kode yang tidak digunakan.</li><li><code>#[allow(unused_variables)]</code> digunakan untuk membolehkan variabel yang didefinisikan tapi tidak dimanfaatkan.</li><li><code>#[allow(missing_docs)]</code> membolehkan kode di bawahnya untuk tidak memiliki komentar/dokumentasi.</li><li><code>#[warn(missing_docs)]</code> memunculkan warning jika kode di bawahnya tidak memiliki komentar/dokumentasi.</li><li><code>#[deny(missing_docs)]</code> memunculkan error jika kode di bawahnya tidak memiliki komentar/dokumentasi. Kode ini sengaja di-remark agar eksekusi program tidak menghasilkan error.</li></ul><p>Dengan penambahan 3 attribute di atas program akan tereksekusi tanpa warning.</p><p><img loading="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fhedxdqQP/hR9YI5nrH9B1Acgb5z3C9E+ydSPWeHeTFHObrWJX5s/Wx6sQjHy7FudE8MaweEhSb3u5PFjP3Jk3l3w9vJ9ZAeZ7JEMnXH11dCZnnnaSRxrlEgzlRLJI5rztZWB/527q5g2AD/HVHq6+OrpF6DztTN4S+ERw/QzlREBobGtin0lgvyA9GuyXmcm9J3BV2jkFjit+g6ljTVjqogqTYEG9LUEQRBwkdU0CQRDE9YJ6W4IgiDig3pYgCCIOqLclCIKIA+ptCYIg4oB6W4IgiDig3pYgCCIOqLclCIKIA54nd7ee/fA091P16fd8u0pzAADtV+MPoBsJgiA+KUIe2+4+/7Zarb5Q+r4bCYIgPiloJoEgCCIO+B1g372oPxYBLNMB5gzBRFME4wIB+sqLb5/vBvw8QRDEFYJ3bCs+/rr3QpsPEL9+tgUA3714Kh2/qlar1eoLZenxD8+2gtS79eyHx0vKC/3jID198V3wxhMEQVwZeHvb9itt8Ln7U6s/lysCfHdXbL/Sx7O7z39qzxW/DtDdfleV5to/6cPZ3ef/pvTFu9TdEgRxjZnUJr51awnEx/X64/GWfkAnZr/XmrBugiCIq8c0726Ybj3XXK4IoM/VFnNzU7SDIAgi+Uy6JmH3p1ZffDzxZOv3/9EGff4XYOvZ12JfqdNCXIIgrjETj213n38Lz354Op5L6Csvvn0O5ioFeFyvP4b2q+rTFrbx+6dVeFF/Wq8/BQBov6rSkgSCIK419KYcgiCIOKCnGwiCIOKAeluCIIg4oN6WIAgiDqi3JQiCiAPqbQmCIOKAeluCIIg4oN6WIAgiDqi3JQiCiAPqbQmCIOKAeluCIIg4oN6WIAgiDv4f9cqCOM6DZ8gAAAAASUVORK5CYII=" width="463" height="107" class="img_ev3q"></p><p>Ada beberapa attribute <em>key</em> yang bisa digunakan untuk override <em>lint</em> warning:</p><ul><li><p><code>#[allow(lint_rule)]</code> untuk membolehkan suatu <em>lint rule</em>.<br>List <code>lint_rule</code> bisa dilihat di <a href="https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html</a>.</p></li><li><p><code>#[warn(lint_rule)]</code> untuk memunculkan warning untuk suatu <em>lint rule</em> yang <em>default</em>-nya tidak memunculkan warning.<br>List <code>lint_rule</code> bisa dilihat di <a href="https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html</a>.</p></li><li><p><code>#[deny(lint_rule)]</code> untuk melarang suatu <em>lint rule</em> yang <em>default</em>-nya adalah diperbolehkan.<br>List <code>lint_rule</code> bisa dilihat di <a href="https://doc.rust-lang.org/rustc/lints/listing/deny-by-default.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rustc/lints/listing/deny-by-default.html</a>.</p></li><li><p><code>#[forbid(lint_rule)]</code> untuk melarang suatu <em>lint rule</em> yang <em>default</em>-nya adalah diperbolehkan <strong>dengan catatan kode beserta isi yang dituju lint tersebut tidak bisa diubah menjadi <em>lint rule</em>-nya menjadi <code>allow</code> lagi</strong>. Penjelasan detailnya ada di <a href="https://doc.rust-lang.org/reference/attributes/diagnostics.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/attributes/diagnostics.html</a></p><p> Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[forbid(missing_docs)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">m3</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[allow(missing_docs)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">undocumented_too</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p> Attribute <code>#[forbid(missing_docs)]</code> pada module <code>m3</code> menjadikan seluruh isi block module tersebut harus memiliki dokumentasi, mirip seperti penggunaan <code>#[deny(missing_docs)]</code>.</p><p> Penggunaan <code>allow</code> di dalam block tersebut membuat eksekusi program menghasilkan error, karena meskipun attribute tersebut ditujukan untuk fungsi <code>undocumented_too()</code> pada parent block (yaitu module <code>m3</code>) sudah ditentukan aturannya menggunakan <code>forbid</code>.</p></li></ul><p>Selain 3 attribute di atas, ada juga beberapa attribute lainnya untuk keperluan <em>diagnostic</em>, di antaranya:</p><ul><li><code>#[deprecated]</code> digunakan untuk menandai bahwa kode di bawahnya adalah <em>deprecated</em>.</li><li><code>#[must_use]</code> digunakan untuk mendandai bahwa kode di bawahnya harus digunakan, jika tidak maka akan muncul error.</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a515-attribute-type-system">A.51.5. Attribute <em>type system</em><a class="hash-link" href="#a515-attribute-type-system" title="Direct link to heading">​</a></h2><p>Ada sebuah attribute bernama <code>non_exhaustive</code> gunanya untuk mem-<em>bypass</em> error yang muncul karena ada pattern matching yang tidak meng-cover semua kondisi, atau untuk mengantisipasi error yang muncul saat deklarasi variabel bertipe struct tapi value property-nya tidak diisi.</p><p>Salah satu contoh error yang dimaksud bisa dilihat pada kode berikut. Error ini muncul karena enum <code>Superhero::Superhero</code> tidak ter-cover dalam pattern matching.</p><p><img loading="lazy" alt="Attribute" src="/assets/images/attribute-8-edad9c816a2c847561bcc988d0905b16.png" width="671" height="669" class="img_ev3q"></p><p>Solusi untuk mengatasi error di atas bisa dengan cukup menambahkan case kondisi yang belum ter-cover:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"stronk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">OmniMan</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"stronk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Hyperion</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"stronk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Atau dengan memanfaatkan kondisi <em>other</em> atau <code>_</code>:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"stronk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">OmniMan</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"stronk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"stronk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Atau, bisa dengan menggunakan attribute <code>non_exhaustive</code>:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[non_exhaustive]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Superhero</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Hyperion</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"stronk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">OmniMan</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"stronk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sayangnya dalam penggunaan attribute <code>non_exhaustive</code> ini, efeknya <strong>hanya bisa dirasakan jika digunakan pada enum atau struct yang berbeda crate</strong>.</p><p>Pada contoh di atas, tempat di mana enum dideklarasikan dan digunakan adalah masih dalam satu crate yang sama, jadi kode tetap menghasilkan error.</p><blockquote><p>Attribute <code>non_exhaustive</code> ini jika digunakan pada struct efeknya saat deklarasi variabel boleh tidak menuliskan value property.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a516-attribute-modules">A.51.6. Attribute <em>modules</em><a class="hash-link" href="#a516-attribute-modules" title="Direct link to heading">​</a></h2><p>Aturan manajemen di Rust cukup ketat, dan sudah dibahas secara mendetal pada chapter <a href="/basic/module-basic">Module System ➜ Module</a>, yang intinya adalah ada dua cara pembuatan module:</p><ul><li>Cara ke-1: dengan mendefinisikan module pada file bernama <code>nama_module.rs</code></li><li>Cara ke-2: dengan mendefinisikan module pada file bernama <code>nama_module/mod.rs</code></li></ul><p>Rust memiliki sebuah attribute bernama <code>path</code> yang berguna untuk meng-override 2 aturan di atas secara paksa. Dengan memanfaatkan attribute ini kita bisa menulis module dengan nama sesuka hati.</p><p>Mari kita praktekan agar lebih jelas. Silakan buat package baru dengan struktur seperti berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── util1.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── util2</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │ └─── mod.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── util3_mymodule.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">util1.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello (from util1)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">util2/mod.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello (from util2)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">util3_mymodule.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello (from util3_mymodule)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">util1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">util2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token attribute attr-name" style="color:#00a4db">#[path = </span><span class="token attribute attr-name string" style="color:#e3116c">"util3_mymodule.rs"</span><span class="token attribute attr-name" style="color:#00a4db">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">util3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">util1</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">util2</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">util3</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas bisa dilihat, module <code>util1</code> dan <code>util2</code> patuh mengikuti aturan deklarasi module system. Berbeda dengan <code>util3</code> yang sebenarnya dideklarasikan dengan nama <code>util3_mymodule</code> (karena filename-nya adalah <code>util3_mymodule.rs</code>). Nama module satu ini diubah menjadi <code>util3</code> lalu dengan memanfaatkan attribute <code>path</code> kita arahkan isi module <code>util3</code> adalah berada di <code>util3_mymodule.rs</code>.</p><p>Jialankan program, harusnya tidak ada error.</p><p><img loading="lazy" alt="Attribute" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcgAAACTCAIAAACF/R49AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFf2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4wLWMwMDAgMTM3LmRhNGE3ZTUsIDIwMjIvMTEvMjctMDk6MzU6MDMgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9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="anchor anchorWithStickyNavbar_LWe7" id="a517-attribute-testing">A.51.7. Attribute <em>testing</em><a class="hash-link" href="#a517-attribute-testing" title="Direct link to heading">​</a></h2><p>Lebih detailnya mengenai attribute testing dibahas pada chapter <a href="#/wip/testing">Testing</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a518-attribute-macros">A.51.8. Attribute <em>macros</em><a class="hash-link" href="#a518-attribute-macros" title="Direct link to heading">​</a></h2><p>Lebih detailnya mengenai attribute macros dibahas pada chapter <a href="#/wip/macro">Macro</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a519-attribute-lainnya">A.51.9 Attribute lainnya<a class="hash-link" href="#a519-attribute-lainnya" title="Direct link to heading">​</a></h2><p>Rust memiliki cukup banyak attribute yang list-nya bisa dilihat pada link ini <a href="https://doc.rust-lang.org/reference/attributes.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/attributes.html</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/attributes" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../attributes</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/module-basic">Module System ➜ Module</a></li><li><a href="/basic/enum">Enum</a></li><li><a href="/basic/pattern-matching">Pattern Matching</a></li><li><a href="/basic/traits">Traits</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/reference/attributes.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/attributes.html</a></li><li><a href="https://doc.rust-lang.org/reference/items/implementations.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/items/implementations.html</a></li><li><a href="https://doc.rust-lang.org/rustc/lints/index.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rustc/lints/index.html</a></li><li><a href="https://doc.rust-lang.org/reference/attributes/diagnostics.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/attributes/diagnostics.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/trait-iterator"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.50. Trait ➜ Iterator</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/datetime"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.52. Date Time</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a511-konsep-attributes" class="table-of-contents__link toc-highlight">A.51.1. Konsep attributes</a></li><li><a href="#a512-attribute-derive" class="table-of-contents__link toc-highlight">A.51.2. Attribute <code>derive</code></a></li><li><a href="#a513-attribute-cfg--configuration" class="table-of-contents__link toc-highlight">A.51.3. Attribute <code>cfg</code> / <em>configuration</em></a><ul><li><a href="#-configuration-target_os" class="table-of-contents__link toc-highlight">◉ Configuration <code>target_os</code></a></li><li><a href="#-configuration-target_arch" class="table-of-contents__link toc-highlight">◉ Configuration <code>target_arch</code></a></li><li><a href="#-macro-cfg-dan-conditional-compilation" class="table-of-contents__link toc-highlight">◉ Macro <code>cfg!()</code> dan conditional compilation</a></li><li><a href="#-configuration-debug_assertions" class="table-of-contents__link toc-highlight">◉ Configuration <code>debug_assertions</code></a></li><li><a href="#-other-configuration" class="table-of-contents__link toc-highlight">◉ Other configuration</a></li></ul></li><li><a href="#a514-attribute-linting--diagnostic" class="table-of-contents__link toc-highlight">A.51.4. Attribute <em>linting</em> & <em>diagnostic</em></a></li><li><a href="#a515-attribute-type-system" class="table-of-contents__link toc-highlight">A.51.5. Attribute <em>type system</em></a></li><li><a href="#a516-attribute-modules" class="table-of-contents__link toc-highlight">A.51.6. Attribute <em>modules</em></a></li><li><a href="#a517-attribute-testing" class="table-of-contents__link toc-highlight">A.51.7. Attribute <em>testing</em></a></li><li><a href="#a518-attribute-macros" class="table-of-contents__link toc-highlight">A.51.8. Attribute <em>macros</em></a></li><li><a href="#a519-attribute-lainnya" class="table-of-contents__link toc-highlight">A.51.9 Attribute lainnya</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.51. Attributes</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.51. Attributes</h1></header><p>Kita telah beberapa kali menggunakan attributes pada chapter-chapter sebelumnya, contohnya seperti <code>#[derive(Debug)]</code>. Pada chapter ini kita akan bahas tentang apa sebenarnya attributes, macam-macam jenisnya, beserta kegunaannya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a511-konsep-attributes">A.51.1. Konsep attributes<a class="hash-link" href="#a511-konsep-attributes" title="Direct link to heading">​</a></h2><p>Attributes adalah metadata yang didefinisikan untuk suatu crate, module, atau module item. Kegunaan dari attributes berbeda satu sama lain, tergantung attribute apa yang dipakai (kita akan bahas satu per satu).</p><p>Attribute dikategorikan menjadi 2:</p><ul><li>Outer attributes</li><li>Inner attributes</li></ul><p>Keduanya memiliki kegunaan yang sama, pembedanya adalah posisi di mana attribute harus dituliskan.</p><p>Outer attribute dituliskan tepat sebelum target (crate, module, module item, atau lainnya) dengan notasi penulisan seperti berikut:</p><ul><li><code>#[attribute = "value"]</code></li><li><code>#[attribute(key = "value")]</code></li><li><code>#[attribute(value)]</code></li><li><code>#[attribute(not(key = "value"))]</code> untuk operasi <strong>NOT</strong></li><li><code>#[attribute(not(value))]</code> untuk operasi <strong>NOT</strong></li></ul><p>Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">LegoSet</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> code</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> category</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> age_minimum</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sedikit berbeda dengan inner attribute, penulisannya berada di dalam target (crate, module, module item, atau lainnya). Notasi penulisannya:</p><ul><li><code>#![attribute = "value"]</code></li><li><code>#![attribute(key = "value")]</code></li><li><code>#![attribute(value)]</code></li><li><code>#![attribute(not(key = "value"))]</code> untuk operasi <strong>NOT</strong></li><li><code>#![attribute(not(value))]</code> untuk operasi <strong>NOT</strong></li></ul><p>Rust mengenal beberapa jenis attributes, dan kita akan membahasnya satu per satu.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a512-attribute-derive">A.51.2. Attribute <code>derive</code><a class="hash-link" href="#a512-attribute-derive" title="Direct link to heading">​</a></h2><p>Attribute <code>derive</code> digunakan untuk mempermudah implementasi suatu trait ke tipe data.</p><p>Kita telah mempelajari cara implementasi trait pada chapter <a href="/basic/traits">Traits</a> yaitu menggunakan keyword <code>impl</code> dan <code>for</code>, kemudian diikuti dengan method serta implementasinya.</p><p>Dengan memanfaatkan attribute <code>derive</code> kita tidak perlu menggunakan cara tersebut. Cukup tulis saja attribute <code>derive</code> beserta trait yang ingin diimplementasikan.</p><p>Agar lebih jelas, silakan pelajari contoh berikut terlebih dahulu:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token class-name">SuperheroSuperman</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"superman"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token class-name">SuperheroOmniMan</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"omniman"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token class-name">SuperheroHyperion</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hyperion"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Superhero</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Hyperion</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello superman!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="Attribute" src="/assets/images/attribute-1-c3fd3abaf784b196c8b4da4512bb8abd.png" width="958" height="719" class="img_CujE"></p><p>Kode di atas menghasilkan error karena enum <code>Superhero</code> tidak mengadopsi trait <code>PartialEq</code> yang mana trait ini diperlukan dalam seleksi kondisi menggunakan keyword <code>if</code> dan operator <code>==</code>.</p><p>Cara mengatasi error tersebut adalah dengan mengimplementasikan trait <code>PartialEq</code> secara eksplisit. Sekarang coba tambahkan kode berikut pada deklarasi enum <code>Superhero</code>, maka error akan hilang.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Superhero</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Hyperion</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">PartialEq</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">eq</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> other</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">Self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> other</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Hyperion</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Hyperion</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Cara lain untuk mengatasi error di atas, selain menggunakan teknik implementasi trait secara eksplisit, adalah dengan menggunakan attribute <code>derive</code> disertai trait <code>PartialEq</code>. Kurang lebih penulisan cara ini bisa dilihat di bawah ini. Cukup hapus block kode <code>impl</code> lalu tambahkan attribute pada deklarasi enum <code>Superhero</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(PartialEq)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Superhero</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Hyperion</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Cukup mudah bukan?</p><p>Contoh lainnya, misalnya variabel <code>value</code> ingin di-print seperti pada kode berikut ini, pasti hasilnya error.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello superman!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{value} (via `Display` trait)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{value:#?} (via `Debug` trait)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Attribute" src="/assets/images/attribute-2-935bd54d9113cbcfb6a5c07a7ebd9f68.png" width="900" height="461" class="img_CujE"></p><p>Cara <em>resolve</em> error di atas adalah dengan mengimplementasikan trait <code>Display</code> dan <code>Debug</code> secara eksplisit. Atau, bisa juga menggunakan attribute <code>derive</code> yang pastinya lebih praktis.</p><p>Kabar buruknya, hanya trait <code>Debug</code> yang menyediakan fitur implementasi trait menggunakan attribute <code>derive</code>. Untuk trait <code>Display</code> kita perlu melakukan implementasi secara eksplisit.</p><blockquote><p>Untuk tau mana trait yang bisa di-<em>derive</em> atau tidak, cukup lihat saja <em>highlight</em> error yang muncul saat penulisan kode atau kompilasi.</p></blockquote><p>Ok, kita implementasikan saja keduanya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(PartialEq, Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Superhero</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Hyperion</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Display</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">fmt</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Formatter</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'_</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Result</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">write!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">f</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"{self:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Attribute" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhkAAAB/CAIAAADNSkeyAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAE72lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4wLWMwMDAgMTM3LmRhNGE3ZTUsIDIwMjIvMTEvMjctMDk6MzU6MDMgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6Z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ilihat, hasilnya program tereksekusi tanpa error. Enum <code>Superhero</code> kini mengadopsi 3 trait:</p><ul><li>Trait <code>PartialEq</code> via attribute <code>derive</code></li><li>Trait <code>Debug</code> via attribute <code>derive</code></li><li>Trait <code>Display</code> via implementasi eksplisit</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a513-attribute-cfg--configuration">A.51.3. Attribute <code>cfg</code> / <em>configuration</em><a class="hash-link" href="#a513-attribute-cfg--configuration" title="Direct link to heading">​</a></h2><p>Attribute <code>cfg</code> digunakan untuk operasi-operasi yang berhubungan dengan target arsitekture hardware/prosesor, misalnya seperti conditional compilation ketika OS adalah linux, dan lainnya.</p><p>Salah satu contoh penerapannya bisa dilihat pada kode berikut. Ada 2 buah module yang namanya sama persis, perbedaannya adalah satu didefinisikan khusus untuk platform <code>linux</code>, dan satunya lagi untuk platform <code>windows</code>. Hal seperti ini bisa dilakukan menggunakan attribute <code>cfg</code> dengan key <code>target_os</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[cfg(target_os = </span><span class="token attribute attr-name string" style="color:#e3116c">"linux"</span><span class="token attribute attr-name" style="color:#00a4db">)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">util</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello (from linux)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token attribute attr-name" style="color:#00a4db">#[cfg(target_os = </span><span class="token attribute attr-name string" style="color:#e3116c">"windows"</span><span class="token attribute attr-name" style="color:#00a4db">)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">util</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello (from windows)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"how are you"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat cara penulisannya adalah <code>cfg()</code> kemudian diisi key <code>target_os</code> dengan value adalah <code>windows</code> atau <code>linux</code>.</p><p>Dengan kondisi kode seperti di atas, ketika berada di sistem operasi <code>linux</code>, item <code>util::say_hello</code> bisa diakses. Sedangkan pada sistem operasi <code>windows</code>, item <code>util::say_hello</code> dan <code>util::say_something</code> bisa diakses.</p><p>Attribute <code>cfg(target_os)</code> juga bisa diterapkan pada block kode. Contohnya seperti pada kode berikut. Item <code>util::say_hello</code> dipanggil di fungsi <code>main</code>. Dan khusus untuk sistem operasi <code>windows</code>, block kode berisi pemanggilan <code>util::say_something</code> juga dipanggil.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">util</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[cfg(target_os = </span><span class="token attribute attr-name string" style="color:#e3116c">"windows"</span><span class="token attribute attr-name" style="color:#00a4db">)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">util</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ada beberapa key yang tersedia pada attribute <code>cfg</code>, di antaranya:</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-configuration-target_os">◉ Configuration <code>target_os</code><a class="hash-link" href="#-configuration-target_os" title="Direct link to heading">​</a></h3><p>Digunakan untuk menandai bahwa item atau statement di bawah definisi attribute ini dikhususkan untuk sistem operasi tertentu.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[cfg(target_os = </span><span class="token attribute attr-name string" style="color:#e3116c">"value"</span><span class="token attribute attr-name" style="color:#00a4db">)]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Opsi value yang tersedia:</p><ul><li><code>windows</code></li><li><code>macos</code></li><li><code>ios</code></li><li><code>linux</code></li><li><code>android</code></li><li><code>freebsd</code></li><li><code>dragonfly</code></li><li><code>openbsd</code></li><li><code>netbsd</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-configuration-target_arch">◉ Configuration <code>target_arch</code><a class="hash-link" href="#-configuration-target_arch" title="Direct link to heading">​</a></h3><p>Digunakan untuk menandai bahwa item atau statement di bawah definisi attribute ini dikhususkan untuk arsitektur CPU tertentu.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[cfg(target_arch = </span><span class="token attribute attr-name string" style="color:#e3116c">"value"</span><span class="token attribute attr-name" style="color:#00a4db">)]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Opsi value yang tersedia:</p><ul><li><code>x86</code></li><li><code>x86_64</code></li><li><code>mips</code></li><li><code>powerpc</code></li><li><code>powerpc64</code></li><li><code>arm</code></li><li><code>aarch64</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-macro-cfg-dan-conditional-compilation">◉ Macro <code>cfg!()</code> dan conditional compilation<a class="hash-link" href="#-macro-cfg-dan-conditional-compilation" title="Direct link to heading">​</a></h3><p>Attribute <code>cfg</code> juga tersedia versi macro-nya, yaitu <code>cfg!()</code>. Macro ini kegunaannya sama seperti attribute <code>cfg</code>, perbedaannya macro <code>cfg!()</code> mengembalikan nilai boolean, yang darinya bisa dikombinasikan dengan seleksi kondisi untuk keperluan conditional compilation. Contoh penggunaan macro <code>cfg!()</code>:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[cfg(target_os = </span><span class="token attribute attr-name string" style="color:#e3116c">"linux"</span><span class="token attribute attr-name" style="color:#00a4db">)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello linux. from attribute cfg"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[cfg(target_os = </span><span class="token attribute attr-name string" style="color:#e3116c">"windows"</span><span class="token attribute attr-name" style="color:#00a4db">)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello windows. from attribute cfg"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">cfg!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">target_os </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"linux"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello linux. from macro cfg!()"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">cfg!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">target_os </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"windows"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello windows. from macro cfg!()"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Penjelasan:</p><ul><li>Kode block <code>#[cfg(target_os = "linux")]</code> hanya dieksekusi ketika program dijalankan di Linux.</li><li>Kode block <code>#[cfg(target_os = "windows")]</code> hanya dieksekusi ketika program dijalankan di Windows.</li><li>Seleksi kondisi <code>cfg!(target_os = ...)</code> merupakan alternatif penulisan 2 kode sebelumnya yang digabung menjadi 1 rantai seleksi kondisi.<ul><li>Kondisi <code>cfg!(target_os = "linux")</code> terpenuhi ketika program dijalankan di Linux</li><li>Kondisi <code>cfg!(target_os = "windows")</code> terpenuhi ketika program dijalankan di Windows</li></ul></li></ul><p>Output program ketika dijalankan di komputer penulis yang menggunakan Windows:</p><p><img loading="lazy" alt="Attribute" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdMAAABsCAIAAAC+d8/uAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAE7mlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5h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QjiWaAyugcro1P5cdb7VLl0RsVxqktStpykYn6s9vpT6yh7GMLSn4pV3Pjkodyoh0wyUKsMcTq2qpiTO19EszA6C/YaIojn4nlvUiAeh60q5mRPxfTUH5q/drxmW1lGVE2JaJMvgngiOOZF5GACKubKjTvfzOoj73F4j27adTzldAFqnyOTBIy8CIIgcoOrDQiCIHKDkRdBEERuMPIiCILIDUZeBEEQucHIiyAIIjcYeREEQeQGIy+CIIjc/DecT72QQDsWUAAAAABJRU5ErkJggg==" width="467" height="108" class="img_CujE"></p><blockquote><p>Lebih detailnya mengenai macro akan dibahas di chapter terpisah.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-configuration-debug_assertions">◉ Configuration <code>debug_assertions</code><a class="hash-link" href="#-configuration-debug_assertions" title="Direct link to heading">​</a></h3><p>By default, Rust menggunakan profil kompilasi <strong>debug</strong> saat eksekusi command <code>cargo run</code>. Di kode program, penanda apakah profil kompilasi debug digunakan atau tidak bisa dilihat dari nilai konfigurasi <code>#[cfg(debug_assertions)]</code> via attribute, dan <code>cfg!(debug_assertions)</code> via macro.</p><p>Nilai <code>cfg!(debug_assertions)</code> selalu bernilai <code>true</code> kecuali command yang digunakan saat eksekusi program adalah <code>cargo run --release</code>. Flag <code>--release</code> saat eksekusi program membuat nilai <code>debug_assertions</code> menjadi <code>false</code>.</p><p>Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[cfg(debug_assertions)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"debug mode. from attribute cfg"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[cfg(not(debug_assertions))]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"release mode. from attribute cfg"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">cfg!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">debug_assertions</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"debug mode. from macro cfg!()"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"release mode. from macro cfg!()"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Output eksekusi program menggunakan command <code>cargo run</code> vs <code>cargo run --release</code>.</p><p><img loading="lazy" alt="Attribute" src="/assets/images/attribute-5-b485867d9d43b989698d4f1a231cfb4b.png" width="499" height="200" class="img_CujE"></p><p>Pada profil release, kode program dikompilasi sekaligus dioptimisasi. Penggunaan profil ini dianjurkan untuk distribusi production binary. </p><blockquote><p>Di beberapa bahasa pemrograman lain deteksi profile dilakukan mengunakan kombinasi keyword <code>if</code> dan nilai environment variable (<code>ENV</code>). Dari situ bisa dilihat apakah environment yang digunakan adalah production, staging, atau local.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-other-configuration">◉ Other configuration<a class="hash-link" href="#-other-configuration" title="Direct link to heading">​</a></h3><p>Ada beberapa key konfigurasi lainnya yang tersedia. Lebih detailnya silakan lihat di <a href="https://doc.rust-lang.org/reference/conditional-compilation.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/conditional-compilation.html</a></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a514-attribute-linting--diagnostic">A.51.4. Attribute <em>linting</em> & <em>diagnostic</em><a class="hash-link" href="#a514-attribute-linting--diagnostic" title="Direct link to heading">​</a></h2><p>Ada beberapa attribute name yang bisa digunakan untuk meng-override <em>default linting</em> milik Rust ataupun menandai indikator <em>diagnostic</em> lainnya, seperti warning yang muncul karena ada kode yang tidak digunakan, dll; Warning sejenis ini bisa di-override menggunakan attribute.</p><p>Contoh kasus yang berhubungan dengan <em>linting</em> bisa dilihat pada kode berikut.</p><p><img loading="lazy" alt="Attribute" src="/assets/images/attribute-6-0ae9faf44e5f0113b2599d985a7f331d.png" width="351" height="363" class="img_CujE"></p><p>Kode di atas tidak menghasilkan error. Kode akan dieksekusi tanpa error. Namun ada 3 buah warning yang muncul karena beberapa baris kode tidak digunakan atau sia-sia.</p><p>Cara agar warning tidak muncul bisa dengan menggunakan attribute <code>#[allow(value)]</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[allow(unused_imports)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Display</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token attribute attr-name" style="color:#00a4db">#[allow(dead_code)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"how are you"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">m1</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[allow(missing_docs)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">undocumented_one</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[warn(missing_docs)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">undocumented_too</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// #[deny(missing_docs)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// pub fn undocumented_end() -> i32 { 3 }</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[allow(unused_variables)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> name </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"noval agung"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas, ada beberapa attribute yang digunakan:</p><ul><li><code>#[allow(unused_imports)]</code> digunakan untuk antisipasi error yang muncul ketika module item di-import namun tidak digunakan.</li><li><code>#[allow(dead_code)]</code> digunakan untuk membolehkan kode yang tidak digunakan.</li><li><code>#[allow(unused_variables)]</code> digunakan untuk membolehkan variabel yang didefinisikan tapi tidak dimanfaatkan.</li><li><code>#[allow(missing_docs)]</code> membolehkan kode di bawahnya untuk tidak memiliki komentar/dokumentasi.</li><li><code>#[warn(missing_docs)]</code> memunculkan warning jika kode di bawahnya tidak memiliki komentar/dokumentasi.</li><li><code>#[deny(missing_docs)]</code> memunculkan error jika kode di bawahnya tidak memiliki komentar/dokumentasi. Kode ini sengaja di-remark agar eksekusi program tidak menghasilkan error.</li></ul><p>Dengan penambahan 3 attribute di atas program akan tereksekusi tanpa warning.</p><p><img loading="lazy" alt="Attribute" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc8AAABrCAIAAACe4J4wAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAE72lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6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Xmcm9J3BV2jkFjit+g6ljTVjqogqTYEG9LUEQRBwkdU0CQRDE9YJ6W4IgiDig3pYgCCIOqLclCIKIA+ptCYIg4oB6W4IgiDig3pYgCCIOqLclCIKIA54nd7ee/fA091P16fd8u0pzAADtV+MPoBsJgiA+KUIe2+4+/7Zarb5Q+r4bCYIgPiloJoEgCCIO+B1g372oPxYBLNMB5gzBRFME4wIB+sqLb5/vBvw8QRDEFYJ3bCs+/rr3QpsPEL9+tgUA3714Kh2/qlar1eoLZenxD8+2gtS79eyHx0vKC/3jID198V3wxhMEQVwZeHvb9itt8Ln7U6s/lysCfHdXbL/Sx7O7z39qzxW/DtDdfleV5to/6cPZ3ef/pvTFu9TdEgRxjZnUJr51awnEx/X64/GWfkAnZr/XmrBugiCIq8c0726Ybj3XXK4IoM/VFnNzU7SDIAgi+Uy6JmH3p1ZffDzxZOv3/9EGff4XYOvZ12JfqdNCXIIgrjETj213n38Lz354Op5L6Csvvn0O5ioFeFyvP4b2q+rTFrbx+6dVeFF/Wq8/BQBov6rSkgSCIK419KYcgiCIOKCnGwiCIOKAeluCIIg4oN6WIAgiDqi3JQiCiAPqbQmCIOKAeluCIIg4oN6WIAgiDqi3JQiCiAPqbQmCIOKAeluCIIg4oN6WIAgiDv4f9cqCOM6DZ8gAAAAASUVORK5CYII=" width="463" height="107" class="img_CujE"></p><p>Ada beberapa attribute <em>key</em> yang bisa digunakan untuk override <em>lint</em> warning:</p><ul><li><p><code>#[allow(lint_rule)]</code> untuk membolehkan suatu <em>lint rule</em>.<br>List <code>lint_rule</code> bisa dilihat di <a href="https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html</a>.</p></li><li><p><code>#[warn(lint_rule)]</code> untuk memunculkan warning untuk suatu <em>lint rule</em> yang <em>default</em>-nya tidak memunculkan warning.<br>List <code>lint_rule</code> bisa dilihat di <a href="https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html</a>.</p></li><li><p><code>#[deny(lint_rule)]</code> untuk melarang suatu <em>lint rule</em> yang <em>default</em>-nya adalah diperbolehkan.<br>List <code>lint_rule</code> bisa dilihat di <a href="https://doc.rust-lang.org/rustc/lints/listing/deny-by-default.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rustc/lints/listing/deny-by-default.html</a>.</p></li><li><p><code>#[forbid(lint_rule)]</code> untuk melarang suatu <em>lint rule</em> yang <em>default</em>-nya adalah diperbolehkan <strong>dengan catatan kode beserta isi yang dituju lint tersebut tidak bisa diubah menjadi <em>lint rule</em>-nya menjadi <code>allow</code> lagi</strong>. Penjelasan detailnya ada di <a href="https://doc.rust-lang.org/reference/attributes/diagnostics.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/attributes/diagnostics.html</a></p><p> Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[forbid(missing_docs)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">m3</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[allow(missing_docs)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">undocumented_too</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p> Attribute <code>#[forbid(missing_docs)]</code> pada module <code>m3</code> menjadikan seluruh isi block module tersebut harus memiliki dokumentasi, mirip seperti penggunaan <code>#[deny(missing_docs)]</code>.</p><p> Penggunaan <code>allow</code> di dalam block tersebut membuat eksekusi program menghasilkan error, karena meskipun attribute tersebut ditujukan untuk fungsi <code>undocumented_too()</code> pada parent block (yaitu module <code>m3</code>) sudah ditentukan aturannya menggunakan <code>forbid</code>.</p></li></ul><p>Selain 3 attribute di atas, ada juga beberapa attribute lainnya untuk keperluan <em>diagnostic</em>, di antaranya:</p><ul><li><code>#[deprecated]</code> digunakan untuk menandai bahwa kode di bawahnya adalah <em>deprecated</em>.</li><li><code>#[must_use]</code> digunakan untuk mendandai bahwa kode di bawahnya harus digunakan, jika tidak maka akan muncul error.</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a515-attribute-type-system">A.51.5. Attribute <em>type system</em><a class="hash-link" href="#a515-attribute-type-system" title="Direct link to heading">​</a></h2><p>Ada sebuah attribute bernama <code>non_exhaustive</code> gunanya untuk mem-<em>bypass</em> error yang muncul karena ada pattern matching yang tidak meng-cover semua kondisi, atau untuk mengantisipasi error yang muncul saat deklarasi variabel bertipe struct tapi value property-nya tidak diisi.</p><p>Salah satu contoh error yang dimaksud bisa dilihat pada kode berikut. Error ini muncul karena enum <code>Superhero::Superhero</code> tidak ter-cover dalam pattern matching.</p><p><img loading="lazy" alt="Attribute" src="/assets/images/attribute-8-edad9c816a2c847561bcc988d0905b16.png" width="671" height="669" class="img_CujE"></p><p>Solusi untuk mengatasi error di atas bisa dengan cukup menambahkan case kondisi yang belum ter-cover:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"stronk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">OmniMan</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"stronk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Hyperion</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"stronk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Atau dengan memanfaatkan kondisi <em>other</em> atau <code>_</code>:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"stronk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">OmniMan</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"stronk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"stronk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Atau, bisa dengan menggunakan attribute <code>non_exhaustive</code>:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[non_exhaustive]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Superhero</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Hyperion</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"stronk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">OmniMan</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"stronk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sayangnya dalam penggunaan attribute <code>non_exhaustive</code> ini, efeknya <strong>hanya bisa dirasakan jika digunakan pada enum atau struct yang berbeda crate</strong>.</p><p>Pada contoh di atas, tempat di mana enum dideklarasikan dan digunakan adalah masih dalam satu crate yang sama, jadi kode tetap menghasilkan error.</p><blockquote><p>Attribute <code>non_exhaustive</code> ini jika digunakan pada struct efeknya saat deklarasi variabel boleh tidak menuliskan value property.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a516-attribute-modules">A.51.6. Attribute <em>modules</em><a class="hash-link" href="#a516-attribute-modules" title="Direct link to heading">​</a></h2><p>Aturan manajemen di Rust cukup ketat, dan sudah dibahas secara mendetal pada chapter <a href="/basic/module-basic">Module System ➜ Module</a>, yang intinya adalah ada dua cara pembuatan module:</p><ul><li>Cara ke-1: dengan mendefinisikan module pada file bernama <code>nama_module.rs</code></li><li>Cara ke-2: dengan mendefinisikan module pada file bernama <code>nama_module/mod.rs</code></li></ul><p>Rust memiliki sebuah attribute bernama <code>path</code> yang berguna untuk meng-override 2 aturan di atas secara paksa. Dengan memanfaatkan attribute ini kita bisa menulis module dengan nama sesuka hati.</p><p>Mari kita praktekan agar lebih jelas. Silakan buat package baru dengan struktur seperti berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── util1.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── util2</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │ └─── mod.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── util3_mymodule.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">util1.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello (from util1)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">util2/mod.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello (from util2)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">util3_mymodule.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello (from util3_mymodule)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">util1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">util2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token attribute attr-name" style="color:#00a4db">#[path = </span><span class="token attribute attr-name string" style="color:#e3116c">"util3_mymodule.rs"</span><span class="token attribute attr-name" style="color:#00a4db">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">util3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">util1</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">util2</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">util3</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas bisa dilihat, module <code>util1</code> dan <code>util2</code> patuh mengikuti aturan deklarasi module system. Berbeda dengan <code>util3</code> yang sebenarnya dideklarasikan dengan nama <code>util3_mymodule</code> (karena filename-nya adalah <code>util3_mymodule.rs</code>). Nama module satu ini diubah menjadi <code>util3</code> lalu dengan memanfaatkan attribute <code>path</code> kita arahkan isi module <code>util3</code> adalah berada di <code>util3_mymodule.rs</code>.</p><p>Jialankan program, harusnya tidak ada error.</p><p><img loading="lazy" alt="Attribute" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcgAAACTCAIAAACF/R49AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFf2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4wLWMwMDAgMTM3LmRhNGE3ZTUsIDIwMjIvMTEvMjctMDk6MzU6MDMgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQj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4omuQpQXQHdcAYL8pgkTXBDHjzJDdikTXBEHMBjP0gACJrgmCmA1mqGP9Eh5LItE1QVwHZmgpgCAIYjaYqRErQRDELEAdK0EQRMhQx0oQBBEyJLoOnVFE11PA++4usnQTxBCQ6Hp4RhFdWzyG0exvdYIcOLJ0E4RO+B3r2NBE1xW36DpiDyk9L8v+DTJ3yu1em96o9uxJpqI83c3VrkEwBDECJLqeiujaQu3H03KGHTXSTvkwqWyDWUGpomyDvA+MiNAkWw6cbiVDwmSHwDzuZOkmCCDR9fRF147A3LjaqWllBvLa0oYIjTfonjVG7JYDJ+83AjRWr9HjuJOlmyBIdA1TE13rPw3KtjhoHI6rnbu554qZrdKG6NzDjAiNPbe7ZR64IfA+7mTpJggSXU+NwWuvcrt7yt7dYDc01A7rT8sbJYDnpQ2xcSjXAFjLCaHH7nfcydJNECS6njq1w/pTKWhPZPSspQ2x8abstedYYvc67mTpJggSXXMRuujaQkmWFoK/wrv27LAhbu1tLXsuZKCx1348NZZoc7t7g7u+gBGmq2bv406WboIg0TVPmOGLrq0bhx32P3/T2N5eVr2ue+3m0CTXyvsbijaZb+xX1K2nzDBz6IHDjrvRCrJ0E8RM2a2+FNE1N1E0YkexTQQxcWbIFfBFiK75KVV87yeYNGTpJgiNGRqxAsA1HhFZn3G1gC0T6LtGRI1gQq4AgtCZtY6VIAgi8szQUgBBEMRsQB0rQRBEyFDHShAEETLUsRIEQYQMdawEQRAhQx0rQRBEyFDHShAEETLUsRIEQYQMdawEQRAhQx0rQRBEyFDHShAEETL/D9VV2vf3UVXEAAAAAElFTkSuQmCC" width="456" height="147" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a517-attribute-testing">A.51.7. Attribute <em>testing</em><a class="hash-link" href="#a517-attribute-testing" title="Direct link to heading">​</a></h2><p>Lebih detailnya mengenai attribute testing dibahas pada chapter <a href="#/wip/testing">Testing</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a518-attribute-macros">A.51.8. Attribute <em>macros</em><a class="hash-link" href="#a518-attribute-macros" title="Direct link to heading">​</a></h2><p>Lebih detailnya mengenai attribute macros dibahas pada chapter <a href="#/wip/macro">Macro</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a519-attribute-lainnya">A.51.9 Attribute lainnya<a class="hash-link" href="#a519-attribute-lainnya" title="Direct link to heading">​</a></h2><p>Rust memiliki cukup banyak attribute yang list-nya bisa dilihat pada link ini <a href="https://doc.rust-lang.org/reference/attributes.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/attributes.html</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/attributes" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../attributes</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/module-basic">Module System ➜ Module</a></li><li><a href="/basic/enum">Enum</a></li><li><a href="/basic/pattern-matching">Pattern Matching</a></li><li><a href="/basic/traits">Traits</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/reference/attributes.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/attributes.html</a></li><li><a href="https://doc.rust-lang.org/reference/items/implementations.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/items/implementations.html</a></li><li><a href="https://doc.rust-lang.org/rustc/lints/index.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rustc/lints/index.html</a></li><li><a href="https://doc.rust-lang.org/reference/attributes/diagnostics.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/attributes/diagnostics.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/trait-iterator"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.50. Trait ➜ Iterator</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/datetime"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.52. Date Time</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a511-konsep-attributes" class="table-of-contents__link toc-highlight">A.51.1. Konsep attributes</a></li><li><a href="#a512-attribute-derive" class="table-of-contents__link toc-highlight">A.51.2. Attribute <code>derive</code></a></li><li><a href="#a513-attribute-cfg--configuration" class="table-of-contents__link toc-highlight">A.51.3. Attribute <code>cfg</code> / <em>configuration</em></a><ul><li><a href="#-configuration-target_os" class="table-of-contents__link toc-highlight">◉ Configuration <code>target_os</code></a></li><li><a href="#-configuration-target_arch" class="table-of-contents__link toc-highlight">◉ Configuration <code>target_arch</code></a></li><li><a href="#-macro-cfg-dan-conditional-compilation" class="table-of-contents__link toc-highlight">◉ Macro <code>cfg!()</code> dan conditional compilation</a></li><li><a href="#-configuration-debug_assertions" class="table-of-contents__link toc-highlight">◉ Configuration <code>debug_assertions</code></a></li><li><a href="#-other-configuration" class="table-of-contents__link toc-highlight">◉ Other configuration</a></li></ul></li><li><a href="#a514-attribute-linting--diagnostic" class="table-of-contents__link toc-highlight">A.51.4. Attribute <em>linting</em> & <em>diagnostic</em></a></li><li><a href="#a515-attribute-type-system" class="table-of-contents__link toc-highlight">A.51.5. Attribute <em>type system</em></a></li><li><a href="#a516-attribute-modules" class="table-of-contents__link toc-highlight">A.51.6. Attribute <em>modules</em></a></li><li><a href="#a517-attribute-testing" class="table-of-contents__link toc-highlight">A.51.7. Attribute <em>testing</em></a></li><li><a href="#a518-attribute-macros" class="table-of-contents__link toc-highlight">A.51.8. Attribute <em>macros</em></a></li><li><a href="#a519-attribute-lainnya" class="table-of-contents__link toc-highlight">A.51.9 Attribute lainnya</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/basic-memory-management.html b/basic/basic-memory-management.html index ffcd940d..4f9f6dc5 100644 --- a/basic/basic-memory-management.html +++ b/basic/basic-memory-management.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/basic-memory-management/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/basic-memory-management/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.32. Basic Memory Management","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/basic-memory-management/#webpage"},"wordCount":1302,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/basic-memory-management/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/basic-memory-management/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/basic-memory-management","name":"A.32. Basic Memory Management","description":"Pada chapter ini kita akan belajar tentang salah satu hal penting dalam topik pemrograman secara general, yaitu memory management yang mencakup pembahasan tentang alamat memori, pointer, heap, stack, dan juga error-error yang terjadi karena kesalahan dalam manajemen memori.","datePublished":"2024-08-01T10:17:28.108Z","dateModified":"2024-08-01T10:17:28.108Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/basic-memory-management/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/basic-memory-management"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/basic-memory-management/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.32. Basic Memory Management","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/basic-memory-management/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/basic-memory-management/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.32. Basic Memory Management","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/basic-memory-management/#webpage"},"wordCount":1302,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/basic-memory-management/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/basic-memory-management/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/basic-memory-management","name":"A.32. Basic Memory Management","description":"Pada chapter ini kita akan belajar tentang salah satu hal penting dalam topik pemrograman secara general, yaitu memory management yang mencakup pembahasan tentang alamat memori, pointer, heap, stack, dan juga error-error yang terjadi karena kesalahan dalam manajemen memori.","datePublished":"2024-08-30T07:44:48.209Z","dateModified":"2024-08-30T07:44:48.209Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/basic-memory-management/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/basic-memory-management"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/basic-memory-management/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.32. Basic Memory Management","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.32. Basic Memory Management</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.32. Basic Memory Management</h1></header><p>Pada chapter ini kita akan belajar tentang salah satu hal penting dalam topik pemrograman secara general, yaitu <em>memory management</em> yang mencakup pembahasan tentang alamat memori, pointer, heap, stack, dan juga error-error yang terjadi karena kesalahan dalam manajemen memori.</p><p>Di bahasa pemrograman high-level biasanya topik tersebut jarang disentuh, tetapi di Rust yang notabene adalah system programming, hal di atas wajib untuk dipelajari.</p><blockquote><p>Penulis tekankan bahwa mungkin pembelajaran pada bagian ini akan terasa seperti <em>oversimplified</em> karena tujuannya adalah untuk para pembaca yang masih dalam proses belajar atau malah belum mengenal sama sekali tentang manajemen memori.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a321-memory-management">A.32.1. Memory management<a class="hash-link" href="#a321-memory-management" title="Direct link to heading">​</a></h2><p>Semua bahasa pemrograman memiliki caranya sendiri dalam melakukan pengelolaan memory atau memory management. Ada beberapa macam metode manajemen memori yang diterapkan pada bahasa pemrograman, di antaranya adalah berikut:</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-garbage-collection-gc">◉ Garbage collection (GC)<a class="hash-link" href="#-garbage-collection-gc" title="Direct link to heading">​</a></h3><p>GC adalah metode manajemen memori otomatis pada bahasa pemrograman. GC memiliki suatu unit yang disebut dengan <em>garbage collector</em>. Collector tersebut aktif memonitor program, dan pada periode atau event tertentu ia akan berusaha untuk mengambil kembali (reclaim) memory yang sebelumnya telah dialokasikan dengan catatan memori tersebut sudah tidak lagi digunakan. Proses ini disebut dengan dealokasi memory.</p><p>Proses dealokasi pada GC terjadi di belakang layar secara asynchronous.</p><p>Beberapa bahasa pemrograman yang menerapkan GC di antara adalah Java, C#, Go, Lisp, dan banyak bahasa lainnya.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-automatic-reference-counting-arc">◉ Automatic reference counting (ARC)<a class="hash-link" href="#-automatic-reference-counting-arc" title="Direct link to heading">​</a></h3><p>ARC adalah metode manajemen memori yang diterapkan pada bahasa Objective-C dan Swift. Cara ARC me-manage memory adalah dengan mencatat <em>reference</em> object dan segala aktifitas yang terjadi pada object tersebut.</p><p>Di ARC, ada satuan yang disebut dengan <em>retain count</em> yang merupakan representasi jumlah banyaknya variabel atau object yang memegang suatu <em>reference</em>. Ketika <em>reference</em> sudah pindah ke luar scope atau dihapus isinya dan dilihat pada catatan rupanya tidak ada variabel yang memegang <em>reference</em> tersebut, maka dilakukan proses dealokasi memory.</p><p>Dalam bahasa yang menerapkan ARC, programmer dianjurkan untuk perhatian dan bijak dalam pengalokasian variabel beserta nilainya. Mana data yang diperlukan untuk di-retain secara <em>strong</em> dan mana yang tidak, harus pas sesuai dengan kebutuhan. Jika tidak hati-hati maka program mempunyai resiko lebih tinggi untuk menemui error <em>deadlocks</em> ataupun <em>memory leaks</em> (yang juga akan dibahas pada chapter ini).</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-manual-memory-management">◉ Manual memory management<a class="hash-link" href="#-manual-memory-management" title="Direct link to heading">​</a></h3><p>Manual memory management berarti programmer dibebani secara penuh dalam hal manajemen memori, mengharuskan programmer untuk super hati-hati dalam pengalokasian memory, kapan waktunya, di mana alokasinya (apakah <em>heap</em> atau <em>stack</em>), dan kapan harus melakukan operasi dealokasi memory.</p><p>Metode manajemen memori ini dipakai dalam system programming contohnya bahasa C dan C++.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-ownership-rules">◉ Ownership rules<a class="hash-link" href="#-ownership-rules" title="Direct link to heading">​</a></h3><p>Manajemen memori yang dilakukan dengan menerapkan konsep <em>ownership</em> beserta aturan-aturannya. Metode manajemen memori ini adalah yang digunakan di Rust.</p><blockquote><p>Lebih jelasnya mengenai ownership rules pada Rust dibahas pada chapter selanjutnya, yaitu <a href="/basic/ownership">Ownership</a>. Untuk sekarang silakan selesaikan terlebih dahulu pembahasan chapter ini.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a322-memory-address">A.32.2. Memory Address<a class="hash-link" href="#a322-memory-address" title="Direct link to heading">​</a></h2><p>Memory address atau alamat memori adalah sebuah lokasi spesifik di memori yang digunakan oleh software maupun hardware untuk menyimpan suatu data.</p><p>Pembahasan mengenai memory address ini sangatlah luas. Pada chapter ini kita tidak akan membahasnya secara menyeluruh, melainkan hanya poin penting yang perlu diketahui dan dibutuhkan dalam proses pembelajaran.</p><p>Ok lanjut ke contoh agar lebih jelas. Dimisalkan ada sebuah variabel bertipe data numerik <code>i32</code>, variabel tersebut akan membutuhkan sejumlah bit alokasi alamat memori untuk bisa menyimpan value-nya yang pada contoh ini adalah <code>32 bits</code> (karena tipenya <code>i32</code>) atau jika dikonversi ke bentuk <em>bytes</em> adalah <code>4 bytes</code>.</p><p>Alokasi memory address mengacu ke tipe data (bukan value), sebagai contoh pada data bertipe <code>i32</code> maka berapapun value data tersebut (entah <code>1</code>, <code>2</code>, <code>1999999</code>, atau lainnya) tetap membutuhkan <code>32 bits</code> alokasi alamat memori untuk menyimpan data tersebut.</p><p>Silakan perhatikan ilustrasi berikut agar lebih jelas. Gambar diambil dari post <a href="https://medium.com/@luischaparroc/integer-numbers-storage-in-computer-memory-47af4b59009" target="_blank" rel="noopener noreferrer">medium.com/@luischaparroc</a>.</p><p><img loading="lazy" alt="Memory address" src="/assets/images/basic-memory-management-1-ac98989ab48847e58470100c02455dab.png" width="875" height="477" class="img_ev3q"></p><p>Pada contoh di atas, variabel adalah bertipe data <code>i32</code>, maka di memory dialokasikanlah alamat memory dengan lebar 32 bit.</p><p>Nilai variabel tersebut adalah <code>25</code>, yang jika dikonversi ke bentuk binary adalah <code>11001</code>. Dengan ini maka pada 32 bit yang sudah dialokasikan, akan terisi dengan nilai <code>11001</code>. Penulisannya dari kanan dan jika ada slot kosong sebelah kiri maka terisi dengan <code>0</code>.</p><p>Hasilnya adalah angka biner berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token number" style="color:#36acaa">00000000000000000000000000011001</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a323-stack-memory">A.32.3. Stack memory<a class="hash-link" href="#a323-stack-memory" title="Direct link to heading">​</a></h2><p>Masih dalam topik manajemen memori, ada dua hal lagi yang sangat penting untuk diketahui, yaitu <em>stack</em> dan <em>heap</em>. Keduanya adalah bagian dari memory, tempat di mana alokasi dilakukan.</p><p>Data disimpan dalam stack memory dalam bentuk stack. Karakteristik dari stack:</p><ul><li>Di Rust programming, stack digunakan sebagai default tempat alokasi memori</li><li>Data yang terakhir masuk adalah yang pertama akan keluar (LIFO)</li><li>Data yang disimpan diketahui size/ukurannya, dan memiliki batas</li><li>Alokasi bersifat lokal terhadap pemanggilan fungsi</li><li>Kecepatan pengaksesan data sangat tinggi</li></ul><p><img loading="lazy" alt="Stack memory" src="/assets/images/basic-memory-management-2-114833fdf1f1ac3114d03494e6603ff1.jpg" width="500" height="345" class="img_ev3q"></p><p>Data untuk tipe primitif (seperti <code>i32</code>, <code>bool</code>, dll) disimpan di stack.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-1">◉ Contoh ke-1<a class="hash-link" href="#-contoh-ke-1" title="Direct link to heading">​</a></h3><p>Selanjutnya kita akan pelajari secara garis besar tentang bagaimana sebuah data dialokasikan di stack. Silakan mulai dengan mempelajari kode sederhana berikut (tanpa perlu dipraktikkan), kemudian ikuti pembahasan setelahnya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>main</code> hanya berisi 1 buah data, yaitu variabel <code>x</code> dengan nilai <code>24</code>. Ketika fungsi tersebut dipanggil, maka data variabel <code>x</code> disimpan di stack (karena di Rust by default semua data disimpan di stack). Nilai <code>x</code> adalah numerik bertipe <code>i32</code>, maka compiler akan mengalokasikan 32 bits di stack memory untuk menyimpan nilai <code>24</code>.</p><p>Pada catatan karakteristik stack di atas, telah disinggung bahwa alokasi data di stack bersifat lokal terhadap pemanggilan fungsi, artinya apa? ➜ Semua data dalam suatu blok fungsi akan disimpan dalam sebuah group yang disebut dengan <em>stack frame</em>.</p><p>Pada contoh di atas, ketika fungsi <code>main</code> dipanggil, sebuah stack frame terbuat, dan data variabel <code>x</code> disimpan dalam stack frame tersebut.</p><table><thead><tr><th align="center">No.</th><th align="center">Variabel</th><th align="center">Nilai</th><th align="left"><em>Stack frame</em></th></tr></thead><tbody><tr><td align="center">0</td><td align="center">x</td><td align="center">24</td><td align="left">milik fungsi <code>main()</code></td></tr></tbody></table><blockquote><p>Kolom <code>No.</code> di atas merepresentasikan urutan data dalam stack agar lebih mudah dipahami</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-2">◉ Contoh ke-2<a class="hash-link" href="#-contoh-ke-2" title="Direct link to heading">​</a></h3><p>Ok, sekarang mari lanjut contoh ke-2 berikut ini agar makin jelas.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> y </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">13</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> z </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">18</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Program sederhana di atas memiliki dua buah fungsi, <code>main</code> dan <code>do_something</code>. Saat program dijalankan, lebih tepatnya saat fungsi <code>main</code> dipanggil maka sebuah stack frame dibuat dan data dalam fungsi tersebut dialokasikan pada stack frame.</p><p>Perlu diketahui bahwa eksekusi statement dalam fungsi adalah per baris, dimulai dari atas. Dengan ini maka data yang pertama dialokasikan ke memory adalah variabel <code>x</code>.</p><table><thead><tr><th align="center">No.</th><th align="center">Variabel</th><th align="center">Nilai</th><th align="left"><em>Stack frame</em></th></tr></thead><tbody><tr><td align="center">0</td><td align="center">x</td><td align="center">24</td><td align="left">milik fungsi <code>main()</code></td></tr></tbody></table><p>Setelah itu, lanjut ke statement ke-2 yaitu pemanggilan fungsi <code>do_something</code>.</p><p>Kembali ke teori, bahwa alokasi data stack adalah bersifat lokal terhadap pemanggilan fungsi. Maka dibuatlah stack frame baru untuk pemanggilan fungsi <code>do_something</code> dengan isi adalah alokasi data <code>y</code> dan <code>z</code>.</p><table><thead><tr><th align="center">No.</th><th align="center">Variabel</th><th align="center">Nilai</th><th align="left"><em>Stack frame</em></th></tr></thead><tbody><tr><td align="center"><span style="color:#2e8555"><strong>2</strong></span></td><td align="center"><span style="color:#2e8555"><strong>z</strong></span></td><td align="center"><span style="color:#2e8555"><strong>11</strong></span></td><td align="left"><span style="color:#2e8555"><strong>milik fungsi <code>do_something()</code></strong></span></td></tr><tr><td align="center"><span style="color:#2e8555"><strong>1</strong></span></td><td align="center"><span style="color:#2e8555"><strong>y</strong></span></td><td align="center"><span style="color:#2e8555"><strong>13</strong></span></td><td align="left"><span style="color:#2e8555"><strong>milik fungsi <code>do_something()</code></strong></span></td></tr><tr><td align="center">0</td><td align="center">x</td><td align="center">24</td><td align="left">milik fungsi <code>main()</code></td></tr></tbody></table><p>Setelah eksekusi blok kode do_something selesai maka stack frame pemanggilan fungsi <code>do_something</code> akan di-dealokasi, dikosongkan, dihapus.</p><blockquote><p>Sebenarnya tidak se-sederhana itu proses dealokasi memori, ada pengecekan ownership yang harus dilakukan terlebih dahulu. Namun agar makin tidak bingung, untuk sementara kita gunakan penjelasan di atas.</p><p>Silakan selesaikan dulu pembahasan chapter ini, kemudian pada chapter selanjutnya kita akan bahas tentang apa itu <a href="/basic/ownership">Ownership</a>.</p></blockquote><p>Ok, maka dari 2 stack yang sebelumnya ada, sekarang tinggal 1 stack frame saja yaitu milik pemanggilan fungsi <code>main</code>.</p><p>Dari yang sebelumnya ...</p><table><thead><tr><th align="center">No.</th><th align="center">Variabel</th><th align="center">Nilai</th><th align="left"><em>Stack frame</em></th></tr></thead><tbody><tr><td align="center"><span style="color:red"><del>2</del></span></td><td align="center"><span style="color:red"><del>z</del></span></td><td align="center"><span style="color:red"><del>11</del></span></td><td align="left"><span style="color:red"><del>milik fungsi <code>do_something()</code></del></span></td></tr><tr><td align="center"><span style="color:red"><del>1</del></span></td><td align="center"><span style="color:red"><del>y</del></span></td><td align="center"><span style="color:red"><del>13</del></span></td><td align="left"><span style="color:red"><del>milik fungsi <code>do_something()</code></del></span></td></tr><tr><td align="center">0</td><td align="center">x</td><td align="center">24</td><td align="left">milik fungsi <code>main()</code></td></tr></tbody></table><p>... sekarang menjadi ...</p><table><thead><tr><th align="center">No.</th><th align="center">Variabel</th><th align="center">Nilai</th><th align="left"><em>Stack frame</em></th></tr></thead><tbody><tr><td align="center">0</td><td align="center">x</td><td align="center">24</td><td align="left">milik fungsi <code>main()</code></td></tr></tbody></table><p>Ok, lanjut ke block fungsi <code>main</code> berikutnya, yaitu <code>let a = 4</code>. Saat dipanggil maka ada penambahan data baru pada stack frame pertama.</p><table><thead><tr><th align="center">No.</th><th align="center">Variabel</th><th align="center">Nilai</th><th align="left"><em>Stack frame</em></th></tr></thead><tbody><tr><td align="center"><span style="color:#2e8555"><strong>3</strong></span></td><td align="center"><span style="color:#2e8555"><strong>a</strong></span></td><td align="center"><span style="color:#2e8555"><strong>4</strong></span></td><td align="left"><span style="color:#2e8555"><strong>milik fungsi <code>main()</code></strong></span></td></tr><tr><td align="center">0</td><td align="center">x</td><td align="center">24</td><td align="left">milik fungsi <code>main()</code></td></tr></tbody></table><p>Kemudian sampai di statement terakhir fungsi <code>main</code>. Ketika <code>let b = 14</code> dipanggil maka ada penambahan data baru pada stack frame pertama.</p><table><thead><tr><th align="center">No.</th><th align="center">Variabel</th><th align="center">Nilai</th><th align="left"><em>Stack frame</em></th></tr></thead><tbody><tr><td align="center"><span style="color:#2e8555"><strong>4</strong></span></td><td align="center"><span style="color:#2e8555"><strong>b</strong></span></td><td align="center"><span style="color:#2e8555"><strong>18</strong></span></td><td align="left"><span style="color:#2e8555"><strong>milik fungsi <code>main()</code></strong></span></td></tr><tr><td align="center">3</td><td align="center">a</td><td align="center">4</td><td align="left">milik fungsi <code>main()</code></td></tr><tr><td align="center">0</td><td align="center">x</td><td align="center">24</td><td align="left">milik fungsi <code>main()</code></td></tr></tbody></table><p>Setelah fungsi selesai dieksekusi, stack frame di-dealokasi.</p><p>Kurang lebih seperti itu sekilas peran dari stack dalam Rust programming. Selanjutnya kita bahas tentang heap memory.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a324-heap-memory">A.32.4. Heap memory<a class="hash-link" href="#a324-heap-memory" title="Direct link to heading">​</a></h2><p>Heap adalah salah satu tempat alokasi memory selain stack. Karakteristik dari heap:</p><ul><li>Heap digunakan untuk alokasi data yang sifatnya dinamis, tidak diketahui size-nya, atau bisa berubah size-nya</li><li>Data di heap tidak memiliki pattern tertentu</li><li>Alokasi dan dealokasi data di heap bisa dilakukan kapanpun</li><li>Kecepatan pengaksesan data di heap lebih lambat dibanding stack</li></ul><p>Ilustrasi perbandingan stack dan heap:</p><p><img loading="lazy" alt="Heap memory" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZ4AAADsCAIAAADLg1cmAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9y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ODq6pqRkaE2OwhqA0B2kpOTbWxsrKysYmNj+Zj/HTt2WFpa0iYcOXJEzXYN1AaAvCQlJdnZ2XXr1i0qKqqiooL7GS4rK6PWtLGxsbOzs7q+zQtqA0AxpKWljRw5UldXd968eTK/kkbZnD9/ftq0aQ0aNJg0adKFCxfUeHdAbQAokjt37gQFBRkYGFAct2XLltLSUi7kKicnJzw8XCAQdOnSJSIi4vHjx2q/I6A2AJTCwYMHPTw8tLW1XVxcNm/enJeXx34eLl26FBoaamVlRaoNCAjg7/hbqA0AbvHu3bv9+/dPnjxZX1+fIiZ/f/+4uDil3tKQmZkZGRk5ZsyYFi1aWFhYUOv4z17iBbUBABQjnXXr1o0YMcLgM66urtR03blzJ8VWJSUlMqzw48ePFAweP36cXObr6ysUChs2bGhubj5t2jRabUFBgSaXNtQGgAp48ODBoUOHli1b5unpaW1traen17hx406dOvXv33/48OFTpkyZMWPG/PnzQ0JClnwmODh47ty5fn5+NL+zs3PPnj1bt25dt25dIyMjBwcHCgapzUvtTfUYbQu1AaA+kJVycnJIT4mJidu3b9+0adPKlSvDwsJCP7N8+fK1a9dGRUXFxsYmJydfuXLl4cOHKDSoDQAAtQEAANQGAABQGwAAQG0AAAC1AQAA1AYAgNoAAABqAwAAqA0AAKA2AACA2gAAUBsAAPCb/wGxfRYJOuC8igAAAABJRU5ErkJggg==" width="414" height="236" class="img_ev3q"></p><p>Tipe data non-primitive di Rust data-nya disimpan di heap, contohnya seperti Vector, <code>String</code>, dan beberapa lainnya. Penulis tekankan, bahwa <strong>yang disimpan di heap adalah data-nya saja, sedangkan atribut lainnya (seperti <code>length</code> dan <code>capacity</code>) tetap disimpan disimpan di stack</strong>. Lebih jelasnya silakan lihat ilustrasi berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">7</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Heap memory" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAaQAAAC4CAYAAACsL5hhAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vc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SF9f3yXe3t6FJpOp4P3332d5eXmyM6HU1FT2zjvvsLZt2xYGBARc5P/Xmx6128q7LTAkAICciQkNDf2aFm3t0aNH7ooVK26mpaVJ1oQOHjzIZsyYUdK+ffs8MtTg4OCPPBQyqRWGBAAAtei4/qLX6zcbDIaCsLCwwvHjx5cmJSUxV64CcfjwYZaYmMiGDh1awA2ojGd2tC0ErTfXF28ZDAkA4B6YuF4LCgr6jjIRf3//0kceeeTK5MmT8zZu3FhNmUpurn12Vr958yajrOzbb79lS5curRg5cmRux44dc728vKoCAwMzAgICNvF7Gc0VjrcFhgQAAG24hnPN4vrYaDSe0Gq1JRqNpjIkJKSgc+fOV3r27Hlp+PDhWWPGjMnhxlXw5ptvls+ZM+fWrFmzKqdNm1YyceLE/NjY2CuDBg3K6tat2+W2bdvmcqMr4eer5ue7wjOzH/jvq7gmedQ2w/mi2GFIAABwr5BpdKwzkKe4xnJN4XqDazbXW3WK55rqUbui9vNcQ7i6cYWhCCVmSBAEQRDkaKEQIAiCIBgSBEEQBMGQIAiCIBgSBEEQBMGQIAiCIBgSBEEQBMGQIAiCIBgSBEEQBDWm/wcTwEbwntl2lQAAAABJRU5ErkJggg==" width="420" height="184" class="img_ev3q"></p><p>Heap, selain digunakan sebagai penyimpanan data dinamis, kita juga bisa manfaatkan sebagai penyimpanan data jenis lainnya (secara eksplisit) menggunakan tipe data <code>Box</code>.</p><p>Pembahasan Lebih jelasnya mengenai heap allocation ada pada chapter <a href="/basic/string-slice-vs-string-literal">String Custom Type vs <code>&str</code></a> dan juga <a href="#/wip/box">Box</a>. Namun untuk sekarang, penulis anjurkan untuk lanjut ke pembahasan berikutnya terlebih dahulu.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a325-error-memory-management">A.32.5. Error memory management<a class="hash-link" href="#a325-error-memory-management" title="Direct link to heading">​</a></h2><p>Rust sangat disiplin dalam hal penulisan source code, terutama untuk kode-kode yang berhubungan dengan memory management. Hal ini dilakukan oleh Rust untuk meminimalisir munculnya error seperti memory leak dan sejenisnya.</p><p>Namun meski demikian, potensi error memory tetap ada, dan kita akan bahas itu nantinya setelah masuk chapter <a href="#/wip/safe-unsafe">Safe & Unsafe</a>.</p><p>Nantinya akan dibahas juga tentang beberapa error saat compile time yang error tersebut berhubungan dengan memory management, yaitu pada chapter <a href="/basic/ownership">Ownership</a> dan <a href="/basic/borrowing">Borrowing</a>. Untuk sekarang, mari lanjut ke chapter berikutnya terlebih dahulu.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/memory_management" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../memory_management</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/nomicon/ownership.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/nomicon/ownership.html</a></li><li><a href="https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html</a></li><li><a href="https://doc.rust-lang.org/1.22.0/book/first-edition/the-stack-and-the-heap.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/1.22.0/book/first-edition/the-stack-and-the-heap.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/std/box.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/std/box.html</a></li><li><a href="https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html" target="_blank" rel="noopener noreferrer">https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html</a></li><li><a href="https://docs.elementscompiler.com/Concepts/ARC/" target="_blank" rel="noopener noreferrer">https://docs.elementscompiler.com/Concepts/ARC/</a></li><li><a href="https://en.wikipedia.org/wiki/Memory_address" target="_blank" rel="noopener noreferrer">https://en.wikipedia.org/wiki/Memory_address</a></li><li><a href="https://en.wikipedia.org/wiki/Code_segment" target="_blank" rel="noopener noreferrer">https://en.wikipedia.org/wiki/Code_segment</a></li><li><a href="https://en.wikipedia.org/wiki/Automatic_Reference_Counting" target="_blank" rel="noopener noreferrer">https://en.wikipedia.org/wiki/Automatic_Reference_Counting</a></li><li><a href="https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)" target="_blank" rel="noopener noreferrer">https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)</a></li><li><a href="https://log2base2.com/C/pointer/computer-memory-address-basics.html" target="_blank" rel="noopener noreferrer">https://log2base2.com/C/pointer/computer-memory-address-basics.html</a></li><li><a href="https://quora.com/How-does-memory-management-work-in-Rust" target="_blank" rel="noopener noreferrer">https://quora.com/How-does-memory-management-work-in-Rust</a></li><li><a href="https://medium.com/the-legend/management-memori-pada-bahasa-pemrograman-a33772635aa5" target="_blank" rel="noopener noreferrer">https://medium.com/the-legend/management-memori-pada-bahasa-pemrograman-a33772635aa5</a></li><li><a href="https://imam.digmi.id/post/belajar-rust-memahami-stack-dan-heap/" target="_blank" rel="noopener noreferrer">https://imam.digmi.id/post/belajar-rust-memahami-stack-dan-heap/</a></li><li><a href="https://javatpoint.com/rust-ownership" target="_blank" rel="noopener noreferrer">https://javatpoint.com/rust-ownership</a></li><li><a href="https://stackoverflow.com/questions/24158114" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/24158114</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/shadowing"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.31. Shadowing</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/pointer-references"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.33. Pointer & References</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a321-memory-management" class="table-of-contents__link toc-highlight">A.32.1. Memory management</a><ul><li><a href="#-garbage-collection-gc" class="table-of-contents__link toc-highlight">◉ Garbage collection (GC)</a></li><li><a href="#-automatic-reference-counting-arc" class="table-of-contents__link toc-highlight">◉ Automatic reference counting (ARC)</a></li><li><a href="#-manual-memory-management" class="table-of-contents__link toc-highlight">◉ Manual memory management</a></li><li><a href="#-ownership-rules" class="table-of-contents__link toc-highlight">◉ Ownership rules</a></li></ul></li><li><a href="#a322-memory-address" class="table-of-contents__link toc-highlight">A.32.2. Memory Address</a></li><li><a href="#a323-stack-memory" class="table-of-contents__link toc-highlight">A.32.3. Stack memory</a><ul><li><a href="#-contoh-ke-1" class="table-of-contents__link toc-highlight">◉ Contoh ke-1</a></li><li><a href="#-contoh-ke-2" class="table-of-contents__link toc-highlight">◉ Contoh ke-2</a></li></ul></li><li><a href="#a324-heap-memory" class="table-of-contents__link toc-highlight">A.32.4. Heap memory</a></li><li><a href="#a325-error-memory-management" class="table-of-contents__link toc-highlight">A.32.5. Error memory management</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.32. Basic Memory Management</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.32. Basic Memory Management</h1></header><p>Pada chapter ini kita akan belajar tentang salah satu hal penting dalam topik pemrograman secara general, yaitu <em>memory management</em> yang mencakup pembahasan tentang alamat memori, pointer, heap, stack, dan juga error-error yang terjadi karena kesalahan dalam manajemen memori.</p><p>Di bahasa pemrograman high-level biasanya topik tersebut jarang disentuh, tetapi di Rust yang notabene adalah system programming, hal di atas wajib untuk dipelajari.</p><blockquote><p>Penulis tekankan bahwa mungkin pembelajaran pada bagian ini akan terasa seperti <em>oversimplified</em> karena tujuannya adalah untuk para pembaca yang masih dalam proses belajar atau malah belum mengenal sama sekali tentang manajemen memori.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a321-memory-management">A.32.1. Memory management<a class="hash-link" href="#a321-memory-management" title="Direct link to heading">​</a></h2><p>Semua bahasa pemrograman memiliki caranya sendiri dalam melakukan pengelolaan memory atau memory management. Ada beberapa macam metode manajemen memori yang diterapkan pada bahasa pemrograman, di antaranya adalah berikut:</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-garbage-collection-gc">◉ Garbage collection (GC)<a class="hash-link" href="#-garbage-collection-gc" title="Direct link to heading">​</a></h3><p>GC adalah metode manajemen memori otomatis pada bahasa pemrograman. GC memiliki suatu unit yang disebut dengan <em>garbage collector</em>. Collector tersebut aktif memonitor program, dan pada periode atau event tertentu ia akan berusaha untuk mengambil kembali (reclaim) memory yang sebelumnya telah dialokasikan dengan catatan memori tersebut sudah tidak lagi digunakan. Proses ini disebut dengan dealokasi memory.</p><p>Proses dealokasi pada GC terjadi di belakang layar secara asynchronous.</p><p>Beberapa bahasa pemrograman yang menerapkan GC di antara adalah Java, C#, Go, Lisp, dan banyak bahasa lainnya.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-automatic-reference-counting-arc">◉ Automatic reference counting (ARC)<a class="hash-link" href="#-automatic-reference-counting-arc" title="Direct link to heading">​</a></h3><p>ARC adalah metode manajemen memori yang diterapkan pada bahasa Objective-C dan Swift. Cara ARC me-manage memory adalah dengan mencatat <em>reference</em> object dan segala aktifitas yang terjadi pada object tersebut.</p><p>Di ARC, ada satuan yang disebut dengan <em>retain count</em> yang merupakan representasi jumlah banyaknya variabel atau object yang memegang suatu <em>reference</em>. Ketika <em>reference</em> sudah pindah ke luar scope atau dihapus isinya dan dilihat pada catatan rupanya tidak ada variabel yang memegang <em>reference</em> tersebut, maka dilakukan proses dealokasi memory.</p><p>Dalam bahasa yang menerapkan ARC, programmer dianjurkan untuk perhatian dan bijak dalam pengalokasian variabel beserta nilainya. Mana data yang diperlukan untuk di-retain secara <em>strong</em> dan mana yang tidak, harus pas sesuai dengan kebutuhan. Jika tidak hati-hati maka program mempunyai resiko lebih tinggi untuk menemui error <em>deadlocks</em> ataupun <em>memory leaks</em> (yang juga akan dibahas pada chapter ini).</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-manual-memory-management">◉ Manual memory management<a class="hash-link" href="#-manual-memory-management" title="Direct link to heading">​</a></h3><p>Manual memory management berarti programmer dibebani secara penuh dalam hal manajemen memori, mengharuskan programmer untuk super hati-hati dalam pengalokasian memory, kapan waktunya, di mana alokasinya (apakah <em>heap</em> atau <em>stack</em>), dan kapan harus melakukan operasi dealokasi memory.</p><p>Metode manajemen memori ini dipakai dalam system programming contohnya bahasa C dan C++.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-ownership-rules">◉ Ownership rules<a class="hash-link" href="#-ownership-rules" title="Direct link to heading">​</a></h3><p>Manajemen memori yang dilakukan dengan menerapkan konsep <em>ownership</em> beserta aturan-aturannya. Metode manajemen memori ini adalah yang digunakan di Rust.</p><blockquote><p>Lebih jelasnya mengenai ownership rules pada Rust dibahas pada chapter selanjutnya, yaitu <a href="/basic/ownership">Ownership</a>. Untuk sekarang silakan selesaikan terlebih dahulu pembahasan chapter ini.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a322-memory-address">A.32.2. Memory Address<a class="hash-link" href="#a322-memory-address" title="Direct link to heading">​</a></h2><p>Memory address atau alamat memori adalah sebuah lokasi spesifik di memori yang digunakan oleh software maupun hardware untuk menyimpan suatu data.</p><p>Pembahasan mengenai memory address ini sangatlah luas. Pada chapter ini kita tidak akan membahasnya secara menyeluruh, melainkan hanya poin penting yang perlu diketahui dan dibutuhkan dalam proses pembelajaran.</p><p>Ok lanjut ke contoh agar lebih jelas. Dimisalkan ada sebuah variabel bertipe data numerik <code>i32</code>, variabel tersebut akan membutuhkan sejumlah bit alokasi alamat memori untuk bisa menyimpan value-nya yang pada contoh ini adalah <code>32 bits</code> (karena tipenya <code>i32</code>) atau jika dikonversi ke bentuk <em>bytes</em> adalah <code>4 bytes</code>.</p><p>Alokasi memory address mengacu ke tipe data (bukan value), sebagai contoh pada data bertipe <code>i32</code> maka berapapun value data tersebut (entah <code>1</code>, <code>2</code>, <code>1999999</code>, atau lainnya) tetap membutuhkan <code>32 bits</code> alokasi alamat memori untuk menyimpan data tersebut.</p><p>Silakan perhatikan ilustrasi berikut agar lebih jelas. Gambar diambil dari post <a href="https://medium.com/@luischaparroc/integer-numbers-storage-in-computer-memory-47af4b59009" target="_blank" rel="noopener noreferrer">medium.com/@luischaparroc</a>.</p><p><img loading="eager" fetchpriority="high" alt="Memory address" src="/assets/images/basic-memory-management-1-ac98989ab48847e58470100c02455dab.png" width="875" height="477" class="img_CujE"></p><p>Pada contoh di atas, variabel adalah bertipe data <code>i32</code>, maka di memory dialokasikanlah alamat memory dengan lebar 32 bit.</p><p>Nilai variabel tersebut adalah <code>25</code>, yang jika dikonversi ke bentuk binary adalah <code>11001</code>. Dengan ini maka pada 32 bit yang sudah dialokasikan, akan terisi dengan nilai <code>11001</code>. Penulisannya dari kanan dan jika ada slot kosong sebelah kiri maka terisi dengan <code>0</code>.</p><p>Hasilnya adalah angka biner berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token number" style="color:#36acaa">00000000000000000000000000011001</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a323-stack-memory">A.32.3. Stack memory<a class="hash-link" href="#a323-stack-memory" title="Direct link to heading">​</a></h2><p>Masih dalam topik manajemen memori, ada dua hal lagi yang sangat penting untuk diketahui, yaitu <em>stack</em> dan <em>heap</em>. Keduanya adalah bagian dari memory, tempat di mana alokasi dilakukan.</p><p>Data disimpan dalam stack memory dalam bentuk stack. Karakteristik dari stack:</p><ul><li>Di Rust programming, stack digunakan sebagai default tempat alokasi memori</li><li>Data yang terakhir masuk adalah yang pertama akan keluar (LIFO)</li><li>Data yang disimpan diketahui size/ukurannya, dan memiliki batas</li><li>Alokasi bersifat lokal terhadap pemanggilan fungsi</li><li>Kecepatan pengaksesan data sangat tinggi</li></ul><p><img loading="lazy" alt="Stack memory" src="/assets/images/basic-memory-management-2-114833fdf1f1ac3114d03494e6603ff1.jpg" width="500" height="345" class="img_CujE"></p><p>Data untuk tipe primitif (seperti <code>i32</code>, <code>bool</code>, dll) disimpan di stack.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-1">◉ Contoh ke-1<a class="hash-link" href="#-contoh-ke-1" title="Direct link to heading">​</a></h3><p>Selanjutnya kita akan pelajari secara garis besar tentang bagaimana sebuah data dialokasikan di stack. Silakan mulai dengan mempelajari kode sederhana berikut (tanpa perlu dipraktikkan), kemudian ikuti pembahasan setelahnya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>main</code> hanya berisi 1 buah data, yaitu variabel <code>x</code> dengan nilai <code>24</code>. Ketika fungsi tersebut dipanggil, maka data variabel <code>x</code> disimpan di stack (karena di Rust by default semua data disimpan di stack). Nilai <code>x</code> adalah numerik bertipe <code>i32</code>, maka compiler akan mengalokasikan 32 bits di stack memory untuk menyimpan nilai <code>24</code>.</p><p>Pada catatan karakteristik stack di atas, telah disinggung bahwa alokasi data di stack bersifat lokal terhadap pemanggilan fungsi, artinya apa? ➜ Semua data dalam suatu blok fungsi akan disimpan dalam sebuah group yang disebut dengan <em>stack frame</em>.</p><p>Pada contoh di atas, ketika fungsi <code>main</code> dipanggil, sebuah stack frame terbuat, dan data variabel <code>x</code> disimpan dalam stack frame tersebut.</p><table><thead><tr><th align="center">No.</th><th align="center">Variabel</th><th align="center">Nilai</th><th align="left"><em>Stack frame</em></th></tr></thead><tbody><tr><td align="center">0</td><td align="center">x</td><td align="center">24</td><td align="left">milik fungsi <code>main()</code></td></tr></tbody></table><blockquote><p>Kolom <code>No.</code> di atas merepresentasikan urutan data dalam stack agar lebih mudah dipahami</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-2">◉ Contoh ke-2<a class="hash-link" href="#-contoh-ke-2" title="Direct link to heading">​</a></h3><p>Ok, sekarang mari lanjut contoh ke-2 berikut ini agar makin jelas.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> y </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">13</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> z </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">18</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Program sederhana di atas memiliki dua buah fungsi, <code>main</code> dan <code>do_something</code>. Saat program dijalankan, lebih tepatnya saat fungsi <code>main</code> dipanggil maka sebuah stack frame dibuat dan data dalam fungsi tersebut dialokasikan pada stack frame.</p><p>Perlu diketahui bahwa eksekusi statement dalam fungsi adalah per baris, dimulai dari atas. Dengan ini maka data yang pertama dialokasikan ke memory adalah variabel <code>x</code>.</p><table><thead><tr><th align="center">No.</th><th align="center">Variabel</th><th align="center">Nilai</th><th align="left"><em>Stack frame</em></th></tr></thead><tbody><tr><td align="center">0</td><td align="center">x</td><td align="center">24</td><td align="left">milik fungsi <code>main()</code></td></tr></tbody></table><p>Setelah itu, lanjut ke statement ke-2 yaitu pemanggilan fungsi <code>do_something</code>.</p><p>Kembali ke teori, bahwa alokasi data stack adalah bersifat lokal terhadap pemanggilan fungsi. Maka dibuatlah stack frame baru untuk pemanggilan fungsi <code>do_something</code> dengan isi adalah alokasi data <code>y</code> dan <code>z</code>.</p><table><thead><tr><th align="center">No.</th><th align="center">Variabel</th><th align="center">Nilai</th><th align="left"><em>Stack frame</em></th></tr></thead><tbody><tr><td align="center"><span style="color:#2e8555"><strong>2</strong></span></td><td align="center"><span style="color:#2e8555"><strong>z</strong></span></td><td align="center"><span style="color:#2e8555"><strong>11</strong></span></td><td align="left"><span style="color:#2e8555"><strong>milik fungsi <code>do_something()</code></strong></span></td></tr><tr><td align="center"><span style="color:#2e8555"><strong>1</strong></span></td><td align="center"><span style="color:#2e8555"><strong>y</strong></span></td><td align="center"><span style="color:#2e8555"><strong>13</strong></span></td><td align="left"><span style="color:#2e8555"><strong>milik fungsi <code>do_something()</code></strong></span></td></tr><tr><td align="center">0</td><td align="center">x</td><td align="center">24</td><td align="left">milik fungsi <code>main()</code></td></tr></tbody></table><p>Setelah eksekusi blok kode do_something selesai maka stack frame pemanggilan fungsi <code>do_something</code> akan di-dealokasi, dikosongkan, dihapus.</p><blockquote><p>Sebenarnya tidak se-sederhana itu proses dealokasi memori, ada pengecekan ownership yang harus dilakukan terlebih dahulu. Namun agar makin tidak bingung, untuk sementara kita gunakan penjelasan di atas.</p><p>Silakan selesaikan dulu pembahasan chapter ini, kemudian pada chapter selanjutnya kita akan bahas tentang apa itu <a href="/basic/ownership">Ownership</a>.</p></blockquote><p>Ok, maka dari 2 stack yang sebelumnya ada, sekarang tinggal 1 stack frame saja yaitu milik pemanggilan fungsi <code>main</code>.</p><p>Dari yang sebelumnya ...</p><table><thead><tr><th align="center">No.</th><th align="center">Variabel</th><th align="center">Nilai</th><th align="left"><em>Stack frame</em></th></tr></thead><tbody><tr><td align="center"><span style="color:red"><del>2</del></span></td><td align="center"><span style="color:red"><del>z</del></span></td><td align="center"><span style="color:red"><del>11</del></span></td><td align="left"><span style="color:red"><del>milik fungsi <code>do_something()</code></del></span></td></tr><tr><td align="center"><span style="color:red"><del>1</del></span></td><td align="center"><span style="color:red"><del>y</del></span></td><td align="center"><span style="color:red"><del>13</del></span></td><td align="left"><span style="color:red"><del>milik fungsi <code>do_something()</code></del></span></td></tr><tr><td align="center">0</td><td align="center">x</td><td align="center">24</td><td align="left">milik fungsi <code>main()</code></td></tr></tbody></table><p>... sekarang menjadi ...</p><table><thead><tr><th align="center">No.</th><th align="center">Variabel</th><th align="center">Nilai</th><th align="left"><em>Stack frame</em></th></tr></thead><tbody><tr><td align="center">0</td><td align="center">x</td><td align="center">24</td><td align="left">milik fungsi <code>main()</code></td></tr></tbody></table><p>Ok, lanjut ke block fungsi <code>main</code> berikutnya, yaitu <code>let a = 4</code>. Saat dipanggil maka ada penambahan data baru pada stack frame pertama.</p><table><thead><tr><th align="center">No.</th><th align="center">Variabel</th><th align="center">Nilai</th><th align="left"><em>Stack frame</em></th></tr></thead><tbody><tr><td align="center"><span style="color:#2e8555"><strong>3</strong></span></td><td align="center"><span style="color:#2e8555"><strong>a</strong></span></td><td align="center"><span style="color:#2e8555"><strong>4</strong></span></td><td align="left"><span style="color:#2e8555"><strong>milik fungsi <code>main()</code></strong></span></td></tr><tr><td align="center">0</td><td align="center">x</td><td align="center">24</td><td align="left">milik fungsi <code>main()</code></td></tr></tbody></table><p>Kemudian sampai di statement terakhir fungsi <code>main</code>. Ketika <code>let b = 14</code> dipanggil maka ada penambahan data baru pada stack frame pertama.</p><table><thead><tr><th align="center">No.</th><th align="center">Variabel</th><th align="center">Nilai</th><th align="left"><em>Stack frame</em></th></tr></thead><tbody><tr><td align="center"><span style="color:#2e8555"><strong>4</strong></span></td><td align="center"><span style="color:#2e8555"><strong>b</strong></span></td><td align="center"><span style="color:#2e8555"><strong>18</strong></span></td><td align="left"><span style="color:#2e8555"><strong>milik fungsi <code>main()</code></strong></span></td></tr><tr><td align="center">3</td><td align="center">a</td><td align="center">4</td><td align="left">milik fungsi <code>main()</code></td></tr><tr><td align="center">0</td><td align="center">x</td><td align="center">24</td><td align="left">milik fungsi <code>main()</code></td></tr></tbody></table><p>Setelah fungsi selesai dieksekusi, stack frame di-dealokasi.</p><p>Kurang lebih seperti itu sekilas peran dari stack dalam Rust programming. Selanjutnya kita bahas tentang heap memory.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a324-heap-memory">A.32.4. Heap memory<a class="hash-link" href="#a324-heap-memory" title="Direct link to heading">​</a></h2><p>Heap adalah salah satu tempat alokasi memory selain stack. Karakteristik dari heap:</p><ul><li>Heap digunakan untuk alokasi data yang sifatnya dinamis, tidak diketahui size-nya, atau bisa berubah size-nya</li><li>Data di heap tidak memiliki pattern tertentu</li><li>Alokasi dan dealokasi data di heap bisa dilakukan kapanpun</li><li>Kecepatan pengaksesan data di heap lebih lambat dibanding stack</li></ul><p>Ilustrasi perbandingan stack dan heap:</p><p><img loading="lazy" alt="Heap memory" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZ4AAADsCAIAAADLg1cmAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMu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d968eTK/kkbZnD9/ftq0aQ0aNJg0adKFCxfUeHdAbQAokjt37gQFBRkYGFAct2XLltLSUi7kKicnJzw8XCAQdOnSJSIi4vHjx2q/I6A2AJTCwYMHPTw8tLW1XVxcNm/enJeXx34eLl26FBoaamVlRaoNCAjg7/hbqA0AbvHu3bv9+/dPnjxZX1+fIiZ/f/+4uDil3tKQmZkZGRk5ZsyYFi1aWFhYUOv4z17iBbUBABQjnXXr1o0YMcLgM66urtR03blzJ8VWJSUlMqzw48ePFAweP36cXObr6ysUChs2bGhubj5t2jRabUFBgSaXNtQGgAp48ODBoUOHli1b5unpaW1traen17hx406dOvXv33/48OFTpkyZMWPG/PnzQ0JClnwmODh47ty5fn5+NL+zs3PPnj1bt25dt25dIyMjBwcHCgapzUvtTfUYbQu1AaA+kJVycnJIT4mJidu3b9+0adPKlSvDwsJCP7N8+fK1a9dGRUXFxsYmJydfuXLl4cOHKDSoDQAAtQEAANQGAABQGwAAQG0AAAC1AQAA1AYAgNoAAABqAwAAqA0AAKA2AACA2gAAUBsAAPCb/wGxfRYJOuC8igAAAABJRU5ErkJggg==" width="414" height="236" class="img_CujE"></p><p>Tipe data non-primitive di Rust data-nya disimpan di heap, contohnya seperti Vector, <code>String</code>, dan beberapa lainnya. Penulis tekankan, bahwa <strong>yang disimpan di heap adalah data-nya saja, sedangkan atribut lainnya (seperti <code>length</code> dan <code>capacity</code>) tetap disimpan disimpan di stack</strong>. Lebih jelasnya silakan lihat ilustrasi berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">7</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Heap memory" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAaQAAAC4CAYAAACsL5hhAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4w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yqRWGBAAAtei4/qLX6zcbDIaCsLCwwvHjx5cmJSUxV64CcfjwYZaYmMiGDh1awA2ojGd2tC0ErTfXF28ZDAkA4B6YuF4LCgr6jjIRf3//0kceeeTK5MmT8zZu3FhNmUpurn12Vr958yajrOzbb79lS5curRg5cmRux44dc728vKoCAwMzAgICNvF7Gc0VjrcFhgQAAG24hnPN4vrYaDSe0Gq1JRqNpjIkJKSgc+fOV3r27Hlp+PDhWWPGjMnhxlXw5ptvls+ZM+fWrFmzKqdNm1YyceLE/NjY2CuDBg3K6tat2+W2bdvmcqMr4eer5ue7wjOzH/jvq7gmedQ2w/mi2GFIAABwr5BpdKwzkKe4xnJN4XqDazbXW3WK55rqUbui9vNcQ7i6cYWhCCVmSBAEQRDkaKEQIAiCIBgSBEEQBMGQIAiCIBgSBEEQBMGQIAiCIBgSBEEQBMGQIAiCIBgSBEEQBDWm/wcTwEbwntl2lQAAAABJRU5ErkJggg==" width="420" height="184" class="img_CujE"></p><p>Heap, selain digunakan sebagai penyimpanan data dinamis, kita juga bisa manfaatkan sebagai penyimpanan data jenis lainnya (secara eksplisit) menggunakan tipe data <code>Box</code>.</p><p>Pembahasan Lebih jelasnya mengenai heap allocation ada pada chapter <a href="/basic/string-slice-vs-string-literal">String Custom Type vs <code>&str</code></a> dan juga <a href="#/wip/box">Box</a>. Namun untuk sekarang, penulis anjurkan untuk lanjut ke pembahasan berikutnya terlebih dahulu.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a325-error-memory-management">A.32.5. Error memory management<a class="hash-link" href="#a325-error-memory-management" title="Direct link to heading">​</a></h2><p>Rust sangat disiplin dalam hal penulisan source code, terutama untuk kode-kode yang berhubungan dengan memory management. Hal ini dilakukan oleh Rust untuk meminimalisir munculnya error seperti memory leak dan sejenisnya.</p><p>Namun meski demikian, potensi error memory tetap ada, dan kita akan bahas itu nantinya setelah masuk chapter <a href="#/wip/safe-unsafe">Safe & Unsafe</a>.</p><p>Nantinya akan dibahas juga tentang beberapa error saat compile time yang error tersebut berhubungan dengan memory management, yaitu pada chapter <a href="/basic/ownership">Ownership</a> dan <a href="/basic/borrowing">Borrowing</a>. Untuk sekarang, mari lanjut ke chapter berikutnya terlebih dahulu.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/memory_management" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../memory_management</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/nomicon/ownership.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/nomicon/ownership.html</a></li><li><a href="https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html</a></li><li><a href="https://doc.rust-lang.org/1.22.0/book/first-edition/the-stack-and-the-heap.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/1.22.0/book/first-edition/the-stack-and-the-heap.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/std/box.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/std/box.html</a></li><li><a href="https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html" target="_blank" rel="noopener noreferrer">https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html</a></li><li><a href="https://docs.elementscompiler.com/Concepts/ARC/" target="_blank" rel="noopener noreferrer">https://docs.elementscompiler.com/Concepts/ARC/</a></li><li><a href="https://en.wikipedia.org/wiki/Memory_address" target="_blank" rel="noopener noreferrer">https://en.wikipedia.org/wiki/Memory_address</a></li><li><a href="https://en.wikipedia.org/wiki/Code_segment" target="_blank" rel="noopener noreferrer">https://en.wikipedia.org/wiki/Code_segment</a></li><li><a href="https://en.wikipedia.org/wiki/Automatic_Reference_Counting" target="_blank" rel="noopener noreferrer">https://en.wikipedia.org/wiki/Automatic_Reference_Counting</a></li><li><a href="https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)" target="_blank" rel="noopener noreferrer">https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)</a></li><li><a href="https://log2base2.com/C/pointer/computer-memory-address-basics.html" target="_blank" rel="noopener noreferrer">https://log2base2.com/C/pointer/computer-memory-address-basics.html</a></li><li><a href="https://quora.com/How-does-memory-management-work-in-Rust" target="_blank" rel="noopener noreferrer">https://quora.com/How-does-memory-management-work-in-Rust</a></li><li><a href="https://medium.com/the-legend/management-memori-pada-bahasa-pemrograman-a33772635aa5" target="_blank" rel="noopener noreferrer">https://medium.com/the-legend/management-memori-pada-bahasa-pemrograman-a33772635aa5</a></li><li><a href="https://imam.digmi.id/post/belajar-rust-memahami-stack-dan-heap/" target="_blank" rel="noopener noreferrer">https://imam.digmi.id/post/belajar-rust-memahami-stack-dan-heap/</a></li><li><a href="https://javatpoint.com/rust-ownership" target="_blank" rel="noopener noreferrer">https://javatpoint.com/rust-ownership</a></li><li><a href="https://stackoverflow.com/questions/24158114" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/24158114</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/shadowing"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.31. Shadowing</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/pointer-references"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.33. Pointer & References</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a321-memory-management" class="table-of-contents__link toc-highlight">A.32.1. Memory management</a><ul><li><a href="#-garbage-collection-gc" class="table-of-contents__link toc-highlight">◉ Garbage collection (GC)</a></li><li><a href="#-automatic-reference-counting-arc" class="table-of-contents__link toc-highlight">◉ Automatic reference counting (ARC)</a></li><li><a href="#-manual-memory-management" class="table-of-contents__link toc-highlight">◉ Manual memory management</a></li><li><a href="#-ownership-rules" class="table-of-contents__link toc-highlight">◉ Ownership rules</a></li></ul></li><li><a href="#a322-memory-address" class="table-of-contents__link toc-highlight">A.32.2. Memory Address</a></li><li><a href="#a323-stack-memory" class="table-of-contents__link toc-highlight">A.32.3. Stack memory</a><ul><li><a href="#-contoh-ke-1" class="table-of-contents__link toc-highlight">◉ Contoh ke-1</a></li><li><a href="#-contoh-ke-2" class="table-of-contents__link toc-highlight">◉ Contoh ke-2</a></li></ul></li><li><a href="#a324-heap-memory" class="table-of-contents__link toc-highlight">A.32.4. Heap memory</a></li><li><a href="#a325-error-memory-management" class="table-of-contents__link toc-highlight">A.32.5. Error memory management</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/block-expression.html b/basic/block-expression.html index a264d65c..b5f36cb6 100644 --- a/basic/block-expression.html +++ b/basic/block-expression.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/block-expression/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/block-expression/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.30. Block Expression","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/block-expression/#webpage"},"wordCount":615,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/block-expression/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/block-expression/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/block-expression","name":"A.30. Block Expression","description":"Pada chapter ini kita akan belajar tentang block expression.","datePublished":"2024-08-01T10:17:28.321Z","dateModified":"2024-08-01T10:17:28.321Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/block-expression/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/block-expression"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/block-expression/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.30. Block Expression","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/block-expression/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/block-expression/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.30. Block Expression","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/block-expression/#webpage"},"wordCount":615,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/block-expression/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/block-expression/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/block-expression","name":"A.30. Block Expression","description":"Pada chapter ini kita akan belajar tentang block expression.","datePublished":"2024-08-30T07:44:48.416Z","dateModified":"2024-08-30T07:44:48.416Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/block-expression/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/block-expression"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/block-expression/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.30. Block Expression","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.30. Block Expression</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.30. Block Expression</h1></header><p>Pada chapter ini kita akan belajar tentang block expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a301-konsep-dan-penerapan-block">A.30.1. Konsep dan penerapan block<a class="hash-link" href="#a301-konsep-dan-penerapan-block" title="Direct link to heading">​</a></h2><p>Block expression (atau cukup block), adalah salah satu control flow yang ada di Rust yang berguna untuk isolasi items, variabel, ataupun proses dalam sebuah scope yang sifatnya <em>anonymous</em>.</p><p>Block expression berbeda jika dibandingkan block kode <code>if</code> (yang berarti dia adalah milik <code>if</code>) atau block kode fungsi (yang dia adalah milik fungsi), block expression tidak berasosiasi dengan keyword tertentu / <em>anonymous</em>.</p><blockquote><p>Pada ebook ini, penulis akan menggunakan istilah <strong>block fungsi</strong> untuk block fungsi, <strong>block kode if</strong> untuk block kode seleksi kondisi <code>if</code>, dan <strong>block kode X</strong> untuk X.</p><p>Untuk block expression, penulis akan gunakan istilah <strong>block expression</strong> atau cukup <strong>block</strong> saja.</p></blockquote><p>Cara penerapan block cukup dengan menuliskan kode program diapit di antara tanda <code>{</code> dan <code>}</code>. Contoh penerapannya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"x: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"(from block) x: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> y </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> z </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"(from block) y: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"(from block) z: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> z</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Block" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcwAAACQCAIAAAAKgszpAAAACXBIWX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mDRe2UB8WejUfX3irDc2cAcC2RFdKUunJtJrL176aIrP3F8sRPdZyK1uYAcAciq/TneaYt1+5E9rTNA2jNb9PPqBAFa3MAuAeRldqTBbJtqj4mC0y34kmF83X5z8ubZ36U30DTCml/hCi7TGSzjPTmUGTb74KjVJU7qXX00feccVaISrMCwOFFNtHY4NI2usS9qFlgJhOLSed32GlR8NdS2egtYIn8xHqoMtKBYWgYnmc8TmXjIo1wMUdkARDZmu6oSHYQjmYnqYu9qKZ/q1nHR4u+kxlpKWs3/rQuy6szBkG+02cXCnffmC0AuDeRNWIrY7qgFgPPENnCJ5mRLnkfiOtM61O9fYoZ6xFM+SeKBSCSHSey2QzmrEg2SFiKZNuMdMkv+mYpmiM6vRx2zpqvXGQrxrsAcFyRNXTHI7LR5W8nLBNFNtWlfCohzUjHhsO36trct2bhXOTfv9VPyrQ5WRQW4K5FVl92u0T2FN3d729GjRHZbMlAduNtmCEVa03D1NmN/ed0cYN3XZicO/WIbFb48+3BmrU5ABxcZLdcp39V3HeyeKMDACwpsnchs/4qsswKAJYW2eNHb677WJcLe6JYAFheZAEAAJEFAEBkAQAQWQAA2E5kMe0GAFhLZDHtXojwwYO4+MM3iD3AvYkspt0rVU64MwLA/Ykspt1qriIr0wjvgqRZmaoAuGuRxbTbbJdc5f1iGWls63DLbAHAPYospt0uiR01TRCpabshjPx5ogzgnkQW0+4lJVbE1EmWW0x2A8BtRrL3Ydq92BxqV75CxQDg+CKLabcz1p1w4yuYOg6nC9BYgLsSWUy7rSLFeY027dbFRGEB7k5kMe0GAFhTZDHtBgBYVWRPmHYDAKwqsgAAgMgCACCyAACILAAAILIAAIgsAAAiCwAAiCwAACILAACILADAmvwfJRJwiDVpEboAAAAASUVORK5CYII=" width="460" height="144" class="img_ev3q"></p><p>Pada contoh di atas, dalam fungsi <code>main</code> ada variabel <code>x</code> yang dideklarasikan kemudian di-print. Setelahnya diikuti statement block expression. Bisa dilihat seperti itu kurang lebih cara penulisannya.</p><p>Di dalam block, nilai <code>x</code> di-print. Operasi seperti ini bisa dilakukan, karena <em>by default</em> semua items pada scope di luar block adalah bisa diakses dari dalam block. Contohnya adalah variabel <code>x</code> yang deklarasinya berada di luar block, tapi diakses di dalam block.</p><p>Kemudian ada beberapa variabel baru yang didefinisikan di dalam block, yaitu <code>y</code> dan <code>z</code> yang variabel tersebut juga di-print. Variabel tersebut akan valid sampai eksekusi block selesai. Intinya semua statement dalam block expression ter-isolasi dalam anonymous scope tersebut. Setelah block kode selesai dieksekusi, jika kita berusaha memanggil items yang ada di dalam block dengan pemanggilan dari luar scope, hasilnya error.</p><p>Sebagai contoh, kode berikut menghasilkan error:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> y </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> z </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"z: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> z</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <------ error</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>O iya, dalam penulisannya, statement block harus diikuti tanda semicolon <code>;</code> sebagai penanda akhir statement, dengan beberapa pengecualian yang akan ikut dibahas pada section setelah ini.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a302-return-value-block">A.30.2. Return value block<a class="hash-link" href="#a302-return-value-block" title="Direct link to heading">​</a></h2><p>Sebuah block expression bisa memiliki return value, dengannya maka nilainya bisa ditampung dalam sebuah variabel. Cara penerapannya menggunakan notasi berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> varOne </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> returnValue</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> varTwo</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> tipeData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> returnValue</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dalam block expression, tidak perlu menuliskan keyword <code>return</code> dan tidak perlu juga menuliskan tanda semicolon di akhir statement return value.</p><p>Berikut adalah contoh praktik return value block. Ada sebuah block yang nilai baliknya ditampung ke variabel <code>a</code>. Isi block sendiri adalah generate data numerik random, yang kemudian dikalikan dengan angka <code>2</code>, lalu dijadikan return value.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">rand</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Rng</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> a</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> n </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">rand</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">thread_rng</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">gen_range</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">100</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> n </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"a: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> a</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a303-nested-block">A.30.3. Nested block<a class="hash-link" href="#a303-nested-block" title="Direct link to heading">​</a></h2><p>Block bisa berada di dalam block. Contohnya seperti kode berikut, nested block dengan kedalaman 3 layer.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> total </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> c </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">13</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> total </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> c </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> d</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{total}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Tidak ada yang istimewa tentang cara penulisan nested block. Langsung tulis saja block expression dalam block sesuai kebutuhan.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a304-labeled-block">A.30.4. Labeled block<a class="hash-link" href="#a304-labeled-block" title="Direct link to heading">​</a></h2><p>Tak hanya perulangan, sebuah block expression juga bisa memiliki label. Cara penerapannya dengan menuliskan nama label (diawaili dengan tanda <code>'</code>), kemudian diikuti tanda <code>:</code> dan block expression. Silakan lihat notasi penulisan berikut agar lebih jelas:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token lifetime-annotation symbol" style="color:#36acaa">'nama_label</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Mari coba terapkan. Pada kode berikut, ada block expression dengan nama <code>'append_with_even_number</code>.</p><p>Di dalam block itu, ada proses generate data numerik secara acak. Angka random tersebut kemudian di cek, jika ganjil maka block expression dihentikan secara paksa. Statement <code>break 'append_with_even_number</code> artinya menghentikan eksekusi block <code>'append_with_even_number</code>.</p><p>Jika angka genap, maka ditambahkan ke <code>total</code> kemudian di-print.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> total </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'append_with_even_number</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> n </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">rand</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">thread_rng</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">gen_range</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">100</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> n </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'append_with_even_number</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> total </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> n</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{total}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Block" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAABsCAIAAACO+97PAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50c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4DiEYDHaLMWm58GZhuvE8RjRkvO32U5BkQ/DJ+ckXNHVc93Ex1LBHXFm/NfUnIraGLOrdiX/hj4tguwK1wUq0jXWy5mreXFo0G71xqCiCJrKoiTXQIiL+ppuuyPxSCWNBMqI8U+XOovKKQa7DtMb2SeDPVlMRV+a1CsGoLbu3SJF5zPCBgjdjtpIvFRNxcNNriBOMvLOwNlZgTxSpfP0tT1i54Dz8D/K7Mu8OIZ1jyrwFRcy9uHWumlZK4qpjApFS9LbcWqoPncuuW0sXip81Fo4HnpOhguxrSxlJ7CIOaIUPHdI/FShz6rZVfC7xVIhXlxdq2z9sTLJtJbQly64nUkA+bSFavwK1diTN8VRgOVKJh60oXCxbbWjRap3Y7eoBFo1FF85i15XkpphtNguOlU67O2iLY/zPbrnNrqUxa10yyK7l1ZMMu6jp+3mqSrK50ZkN62wN3n+W6XlS6WE7GjUSjYeneEYVyWx40J02NP2frxbez23ON8v6gqdZ2ZWXgmA6KguOLVtvj3BptZnnmhCGB6+LWy6KIsR6DEuN+2vpYVox5vZ2KSD1f2T4JV8sEuXVVZN8i7H3YDbn1AmLMu64nuZUgt7aDPCawIbGCmEC7k72xesKPeFbVi9xKkFsJgiDIrQRBEORWgiAIgtxKEARBbiUIgiC3EgRBEORWgiAIcitBEAS5lSAIgiC3EgRBvBpu/evf//53wp/f6Kf//v2LtiQIgqjh1hf6HLjz95+cR4/M+ufPH3IrQRDEOTGBI7mOruuRWV9Y9Te5lSAIYiluPTFrd43cShAEMZtb05DAxKjkVoIgiNnc2u1aDfGAlE/JrQRBEPO4tSPWiUGPDqxAeYSAIAiC3BonVhApoN9KEARRya3CSS2YlNxKEAQxLyZAEARBkFsJgiDIrQRBEORWgiAIgtxKEARBbiUIgiC3EgRBEORWgiAIcitBEAS5lSAIgiC3EgRBkFsJgiDIrQRBENeM/wOwdHL7sTryCQAAAABJRU5ErkJggg==" width="457" height="108" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a305-async-block">A.30.5. Async block<a class="hash-link" href="#a305-async-block" title="Direct link to heading">​</a></h2><p>Pembahasan mengenai asynchronous block ada pada chapter <a href="#/wip/async">Async</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a306-unsafe-block">A.30.6. <em>Unsafe</em> block<a class="hash-link" href="#a306-unsafe-block" title="Direct link to heading">​</a></h2><p>Pembahasan mengenai unsafe block expression ada pada chapter <a href="#/wip/safe-unsafe">Safe & Unsafe</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a307-manfaat-penerapan-block">A.30.7 Manfaat penerapan block<a class="hash-link" href="#a307-manfaat-penerapan-block" title="Direct link to heading">​</a></h2><p>Block biasa diterapkan untuk isolasi sebuah proses yang tidak perlu di-reuse. Jika proses adalah di-reuse, dianjurkan untuk menggunakan fungsi dalam penerapannya.</p><p>Di bahasa pemrograman lain juga ada block yang penerapannya kurang lebih adalah sama. Namun perlu diketahui, di Rust block memiliki berbedaan yang bisa dibilang signifikan, yaitu dalam hal manajemen memory.</p><p>Rust menerapkan konsep memory management bernama <strong>ownership</strong>. Setiap kali Rust selesai mengeksekusi block kode, baik itu fungsi, block expression, atau jenis block lainnya; akan dilakukan evaluasi pengecekan ownership yang ada dalam block tersebut. Untuk data yang owner-nya tidak berpindah ke luar scope, maka akan dilakukan proses dealokasi memory untuk data tersebut. Dengan approach ini penggunaan memory menjadi efisien.</p><ul><li>Lebih jelasnya mengenai memory management dibahas pada chapter <a href="/basic/basic-memory-management">Memory Management</a></li><li>Lebih jelasnya mengenai ownership dibahas pada chapter <a href="/basic/ownership">Ownership</a></li></ul><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/block_expression" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../block_expression</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/reference/expressions/block-expr.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/expressions/block-expr.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/use"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.29. Module System ➜ Use, Import, Re-export</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/shadowing"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.31. Shadowing</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a301-konsep-dan-penerapan-block" class="table-of-contents__link toc-highlight">A.30.1. Konsep dan penerapan block</a></li><li><a href="#a302-return-value-block" class="table-of-contents__link toc-highlight">A.30.2. Return value block</a></li><li><a href="#a303-nested-block" class="table-of-contents__link toc-highlight">A.30.3. Nested block</a></li><li><a href="#a304-labeled-block" class="table-of-contents__link toc-highlight">A.30.4. Labeled block</a></li><li><a href="#a305-async-block" class="table-of-contents__link toc-highlight">A.30.5. Async block</a></li><li><a href="#a306-unsafe-block" class="table-of-contents__link toc-highlight">A.30.6. <em>Unsafe</em> block</a></li><li><a href="#a307-manfaat-penerapan-block" class="table-of-contents__link toc-highlight">A.30.7 Manfaat penerapan block</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.30. Block Expression</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.30. Block Expression</h1></header><p>Pada chapter ini kita akan belajar tentang block expression.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a301-konsep-dan-penerapan-block">A.30.1. Konsep dan penerapan block<a class="hash-link" href="#a301-konsep-dan-penerapan-block" title="Direct link to heading">​</a></h2><p>Block expression (atau cukup block), adalah salah satu control flow yang ada di Rust yang berguna untuk isolasi items, variabel, ataupun proses dalam sebuah scope yang sifatnya <em>anonymous</em>.</p><p>Block expression berbeda jika dibandingkan block kode <code>if</code> (yang berarti dia adalah milik <code>if</code>) atau block kode fungsi (yang dia adalah milik fungsi), block expression tidak berasosiasi dengan keyword tertentu / <em>anonymous</em>.</p><blockquote><p>Pada ebook ini, penulis akan menggunakan istilah <strong>block fungsi</strong> untuk block fungsi, <strong>block kode if</strong> untuk block kode seleksi kondisi <code>if</code>, dan <strong>block kode X</strong> untuk X.</p><p>Untuk block expression, penulis akan gunakan istilah <strong>block expression</strong> atau cukup <strong>block</strong> saja.</p></blockquote><p>Cara penerapan block cukup dengan menuliskan kode program diapit di antara tanda <code>{</code> dan <code>}</code>. Contoh penerapannya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"x: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"(from block) x: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> y </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> z </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"(from block) y: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"(from block) z: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> z</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="Block" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcwAAACQCAIAAAAKgszpAAA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dn2WhgmDRe2UB8WejUfX3irDc2cAcC2RFdKUunJtJrL176aIrP3F8sRPdZyK1uYAcAciq/TneaYt1+5E9rTNA2jNb9PPqBAFa3MAuAeRldqTBbJtqj4mC0y34kmF83X5z8ubZ36U30DTCml/hCi7TGSzjPTmUGTb74KjVJU7qXX00feccVaISrMCwOFFNtHY4NI2usS9qFlgJhOLSed32GlR8NdS2egtYIn8xHqoMtKBYWgYnmc8TmXjIo1wMUdkARDZmu6oSHYQjmYnqYu9qKZ/q1nHR4u+kxlpKWs3/rQuy6szBkG+02cXCnffmC0AuDeRNWIrY7qgFgPPENnCJ5mRLnkfiOtM61O9fYoZ6xFM+SeKBSCSHSey2QzmrEg2SFiKZNuMdMkv+mYpmiM6vRx2zpqvXGQrxrsAcFyRNXTHI7LR5W8nLBNFNtWlfCohzUjHhsO36trct2bhXOTfv9VPyrQ5WRQW4K5FVl92u0T2FN3d729GjRHZbMlAduNtmCEVa03D1NmN/ed0cYN3XZicO/WIbFb48+3BmrU5ABxcZLdcp39V3HeyeKMDACwpsnchs/4qsswKAJYW2eNHb677WJcLe6JYAFheZAEAAJEFAEBkAQAQWQAA2E5kMe0GAFhLZDHtXojwwYO4+MM3iD3AvYkspt0rVU64MwLA/Ykspt1qriIr0wjvgqRZmaoAuGuRxbTbbJdc5f1iGWls63DLbAHAPYospt0uiR01TRCpabshjPx5ogzgnkQW0+4lJVbE1EmWW0x2A8BtRrL3Ydq92BxqV75CxQDg+CKLabcz1p1w4yuYOg6nC9BYgLsSWUy7rSLFeY027dbFRGEB7k5kMe0GAFhTZDHtBgBYVWRPmHYDAKwqsgAAgMgCACCyAACILAAAILIAAIgsAAAiCwAAiCwAACILAACILADAmvwfJRJwiDVpEboAAAAASUVORK5CYII=" width="460" height="144" class="img_CujE"></p><p>Pada contoh di atas, dalam fungsi <code>main</code> ada variabel <code>x</code> yang dideklarasikan kemudian di-print. Setelahnya diikuti statement block expression. Bisa dilihat seperti itu kurang lebih cara penulisannya.</p><p>Di dalam block, nilai <code>x</code> di-print. Operasi seperti ini bisa dilakukan, karena <em>by default</em> semua items pada scope di luar block adalah bisa diakses dari dalam block. Contohnya adalah variabel <code>x</code> yang deklarasinya berada di luar block, tapi diakses di dalam block.</p><p>Kemudian ada beberapa variabel baru yang didefinisikan di dalam block, yaitu <code>y</code> dan <code>z</code> yang variabel tersebut juga di-print. Variabel tersebut akan valid sampai eksekusi block selesai. Intinya semua statement dalam block expression ter-isolasi dalam anonymous scope tersebut. Setelah block kode selesai dieksekusi, jika kita berusaha memanggil items yang ada di dalam block dengan pemanggilan dari luar scope, hasilnya error.</p><p>Sebagai contoh, kode berikut menghasilkan error:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> y </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> z </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"z: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> z</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <------ error</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>O iya, dalam penulisannya, statement block harus diikuti tanda semicolon <code>;</code> sebagai penanda akhir statement, dengan beberapa pengecualian yang akan ikut dibahas pada section setelah ini.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a302-return-value-block">A.30.2. Return value block<a class="hash-link" href="#a302-return-value-block" title="Direct link to heading">​</a></h2><p>Sebuah block expression bisa memiliki return value, dengannya maka nilainya bisa ditampung dalam sebuah variabel. Cara penerapannya menggunakan notasi berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> varOne </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> returnValue</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> varTwo</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> tipeData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> returnValue</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dalam block expression, tidak perlu menuliskan keyword <code>return</code> dan tidak perlu juga menuliskan tanda semicolon di akhir statement return value.</p><p>Berikut adalah contoh praktik return value block. Ada sebuah block yang nilai baliknya ditampung ke variabel <code>a</code>. Isi block sendiri adalah generate data numerik random, yang kemudian dikalikan dengan angka <code>2</code>, lalu dijadikan return value.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">rand</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Rng</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> a</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> n </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">rand</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">thread_rng</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">gen_range</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">100</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> n </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"a: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> a</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a303-nested-block">A.30.3. Nested block<a class="hash-link" href="#a303-nested-block" title="Direct link to heading">​</a></h2><p>Block bisa berada di dalam block. Contohnya seperti kode berikut, nested block dengan kedalaman 3 layer.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> total </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> c </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">13</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> total </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> c </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> d</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{total}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Tidak ada yang istimewa tentang cara penulisan nested block. Langsung tulis saja block expression dalam block sesuai kebutuhan.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a304-labeled-block">A.30.4. Labeled block<a class="hash-link" href="#a304-labeled-block" title="Direct link to heading">​</a></h2><p>Tak hanya perulangan, sebuah block expression juga bisa memiliki label. Cara penerapannya dengan menuliskan nama label (diawaili dengan tanda <code>'</code>), kemudian diikuti tanda <code>:</code> dan block expression. Silakan lihat notasi penulisan berikut agar lebih jelas:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token lifetime-annotation symbol" style="color:#36acaa">'nama_label</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Mari coba terapkan. Pada kode berikut, ada block expression dengan nama <code>'append_with_even_number</code>.</p><p>Di dalam block itu, ada proses generate data numerik secara acak. Angka random tersebut kemudian di cek, jika ganjil maka block expression dihentikan secara paksa. Statement <code>break 'append_with_even_number</code> artinya menghentikan eksekusi block <code>'append_with_even_number</code>.</p><p>Jika angka genap, maka ditambahkan ke <code>total</code> kemudian di-print.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> total </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'append_with_even_number</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> n </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">rand</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">thread_rng</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">gen_range</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">100</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> n </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'append_with_even_number</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> total </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> n</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{total}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Block" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAABsCAIAAACO+97PAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGV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ty3SJ4DiEYDHaLMWm58GZhuvE8RjRkvO32U5BkQ/DJ+ckXNHVc93Ex1LBHXFm/NfUnIraGLOrdiX/hj4tguwK1wUq0jXWy5mreXFo0G71xqCiCJrKoiTXQIiL+ppuuyPxSCWNBMqI8U+XOovKKQa7DtMb2SeDPVlMRV+a1CsGoLbu3SJF5zPCBgjdjtpIvFRNxcNNriBOMvLOwNlZgTxSpfP0tT1i54Dz8D/K7Mu8OIZ1jyrwFRcy9uHWumlZK4qpjApFS9LbcWqoPncuuW0sXip81Fo4HnpOhguxrSxlJ7CIOaIUPHdI/FShz6rZVfC7xVIhXlxdq2z9sTLJtJbQly64nUkA+bSFavwK1diTN8VRgOVKJh60oXCxbbWjRap3Y7eoBFo1FF85i15XkpphtNguOlU67O2iLY/zPbrnNrqUxa10yyK7l1ZMMu6jp+3mqSrK50ZkN62wN3n+W6XlS6WE7GjUSjYeneEYVyWx40J02NP2frxbez23ON8v6gqdZ2ZWXgmA6KguOLVtvj3BptZnnmhCGB6+LWy6KIsR6DEuN+2vpYVox5vZ2KSD1f2T4JV8sEuXVVZN8i7H3YDbn1AmLMu64nuZUgt7aDPCawIbGCmEC7k72xesKPeFbVi9xKkFsJgiDIrQRBEORWgiAIgtxKEARBbiUIgiC3EgRBEORWgiAIcitBEAS5lSAIgiC3EgRBvBpu/evf//53wp/f6Kf//v2LtiQIgqjh1hf6HLjz95+cR4/M+ufPH3IrQRDEOTGBI7mOruuRWV9Y9Te5lSAIYiluPTFrd43cShAEMZtb05DAxKjkVoIgiNnc2u1aDfGAlE/JrQRBEPO4tSPWiUGPDqxAeYSAIAiC3BonVhApoN9KEARRya3CSS2YlNxKEAQxLyZAEARBkFsJgiDIrQRBEORWgiAIgtxKEARBbiUIgiC3EgRBEORWgiAIcitBEAS5lSAIgiC3EgRBkFsJgiDIrQRBENeM/wOwdHL7sTryCQAAAABJRU5ErkJggg==" width="457" height="108" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a305-async-block">A.30.5. Async block<a class="hash-link" href="#a305-async-block" title="Direct link to heading">​</a></h2><p>Pembahasan mengenai asynchronous block ada pada chapter <a href="#/wip/async">Async</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a306-unsafe-block">A.30.6. <em>Unsafe</em> block<a class="hash-link" href="#a306-unsafe-block" title="Direct link to heading">​</a></h2><p>Pembahasan mengenai unsafe block expression ada pada chapter <a href="#/wip/safe-unsafe">Safe & Unsafe</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a307-manfaat-penerapan-block">A.30.7 Manfaat penerapan block<a class="hash-link" href="#a307-manfaat-penerapan-block" title="Direct link to heading">​</a></h2><p>Block biasa diterapkan untuk isolasi sebuah proses yang tidak perlu di-reuse. Jika proses adalah di-reuse, dianjurkan untuk menggunakan fungsi dalam penerapannya.</p><p>Di bahasa pemrograman lain juga ada block yang penerapannya kurang lebih adalah sama. Namun perlu diketahui, di Rust block memiliki berbedaan yang bisa dibilang signifikan, yaitu dalam hal manajemen memory.</p><p>Rust menerapkan konsep memory management bernama <strong>ownership</strong>. Setiap kali Rust selesai mengeksekusi block kode, baik itu fungsi, block expression, atau jenis block lainnya; akan dilakukan evaluasi pengecekan ownership yang ada dalam block tersebut. Untuk data yang owner-nya tidak berpindah ke luar scope, maka akan dilakukan proses dealokasi memory untuk data tersebut. Dengan approach ini penggunaan memory menjadi efisien.</p><ul><li>Lebih jelasnya mengenai memory management dibahas pada chapter <a href="/basic/basic-memory-management">Memory Management</a></li><li>Lebih jelasnya mengenai ownership dibahas pada chapter <a href="/basic/ownership">Ownership</a></li></ul><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/block_expression" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../block_expression</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/reference/expressions/block-expr.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/expressions/block-expr.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/use"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.29. Module System ➜ Use, Import, Re-export</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/shadowing"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.31. Shadowing</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a301-konsep-dan-penerapan-block" class="table-of-contents__link toc-highlight">A.30.1. Konsep dan penerapan block</a></li><li><a href="#a302-return-value-block" class="table-of-contents__link toc-highlight">A.30.2. Return value block</a></li><li><a href="#a303-nested-block" class="table-of-contents__link toc-highlight">A.30.3. Nested block</a></li><li><a href="#a304-labeled-block" class="table-of-contents__link toc-highlight">A.30.4. Labeled block</a></li><li><a href="#a305-async-block" class="table-of-contents__link toc-highlight">A.30.5. Async block</a></li><li><a href="#a306-unsafe-block" class="table-of-contents__link toc-highlight">A.30.6. <em>Unsafe</em> block</a></li><li><a href="#a307-manfaat-penerapan-block" class="table-of-contents__link toc-highlight">A.30.7 Manfaat penerapan block</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/borrowing.html b/basic/borrowing.html index 720b4a85..afbc8775 100644 --- a/basic/borrowing.html +++ b/basic/borrowing.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/borrowing/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/borrowing/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.35. Borrowing","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/borrowing/#webpage"},"wordCount":1306,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/borrowing/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/borrowing/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/borrowing","name":"A.35. Borrowing","description":"Pada chapter ini kita akan belajar tentang apa itu borrowing dalam Rust programming.","datePublished":"2024-08-01T10:17:28.409Z","dateModified":"2024-08-01T10:17:28.409Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/borrowing/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/borrowing"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/borrowing/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.35. Borrowing","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/borrowing/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/borrowing/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.35. Borrowing","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/borrowing/#webpage"},"wordCount":1306,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/borrowing/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/borrowing/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/borrowing","name":"A.35. Borrowing","description":"Pada chapter ini kita akan belajar tentang apa itu borrowing dalam Rust programming.","datePublished":"2024-08-30T07:44:48.502Z","dateModified":"2024-08-30T07:44:48.502Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/borrowing/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/borrowing"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/borrowing/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.35. Borrowing","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.35. Borrowing</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.35. Borrowing</h1></header><p>Pada chapter ini kita akan belajar tentang apa itu borrowing dalam Rust programming.</p><p>Sebelum masuk ke pembelajaran, penulis anjurkan untuk paham terlebih dahulu tentang <a href="/basic/basic-memory-management">Basic Memory Management</a>, <a href="/basic/pointer-references">Pointer & References</a>, dan juga konsep <a href="/basic/ownership">Ownership</a>. Ketiga topik tersebut dipelajari pada chapter sebelum ini.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a351-konsep-borrowing">A.35.1. Konsep borrowing<a class="hash-link" href="#a351-konsep-borrowing" title="Direct link to heading">​</a></h2><p>Pada chapter sebelumnya kita telah belajar bahwa tipe data yang mengadopsi <em>move semantics</em> (seperti <code>String</code>), ketika digunakan pada operasi assignment maka owner-nya berpindah. Variabel yang sebelumnya adalah owner, setelah proses assignment menjadi invalid, karena owner data tersebut telah berpindah ke variabel baru. Efeknya, semua operasi yang dilakukan pada variabel owner sebelumnya menghasilkan error.</p><p>Sekarang perhatikan kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> msg_1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, statement print <code>msg_1</code> menghasilkan error karena variabel tersebut telah invalid setelah statement <code>let msg_2 = msg_1</code>.</p><p>Programmer harus ekstra hati-hati dan bijak dalam pengelolaan owner data, agar memory ter-manage dengan baik. Tapi kalau dipikir-pikir, repot juga kalau owner harus dilempar-lempar setiap selesai digunakan agar tidak error.</p><p>Salah satu cara yang bisa digunakan agar tidak terlalu repot adalah dengan menerapkan cloning (seperti yang sudah dibahas pada chapter sebelumnya). Namun ini bukan opsi yang baik karena boros memory, sedangkan di sisi lain programmer dianjurkan untuk efisien dalam penggunaan memory.</p><p>Solusi yang paling pas adalah dengan menerapkan <strong>borrowing</strong>. Borrowing artinya adalah meminjam. Pada konteks Rust programming, borrowing berarti meminjam data milik owner, dipinjam agar bisa diakses tanpa perlu memindah owner-nya. Kemudian setelah peminjaman selesai, data dikembalikan.</p><p>Cara meminjam data di Rust sangat mudah, yaitu:</p><ul><li><p>Untuk borrowing dengan level akses immutable/read-only, gunakan operator reference <code>&</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">msg_3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <----- borrow operation</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => hello rust</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => hello rust</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Untuk borrowing dengan level akses mutable, gunakan operator reference <code>&mut</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg_3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg_3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <----- mutable borrow operation</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token operator" style="color:#393A34">*</span><span class="token plain">msg_4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => hello rust</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => hello rust</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><p>Di Rust, semua statement reference (baik mutable ataupun immutable) adalah operasi <em>borrowing</em>. Yang terjadi pada statement reference adalah data milik owner dipinjam dalam bentuk pointer. Pointer itu sendiri merupakan alamat memory yang mengarah ke data sebenarnya (milik owner).</p><p>Dari contoh di atas, bisa ditarik kesimpulan bahwa data string <code>hello rust</code> memiliki dua reference:</p><ul><li>Yang pertama adalah owner data, yaitu variabel <code>msg_3</code></li><li>Yang kedua adalah peminjam data, yaitu variabel pointer <code>msg_4</code></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a352-rust-borrow-checker">A.35.2. Rust Borrow Checker<a class="hash-link" href="#a352-rust-borrow-checker" title="Direct link to heading">​</a></h2><p>Rust compiler memiliki 1 bagian bernama <strong>borrow checker</strong>, tugasnya untuk melakukan pengecekan pada source code apakah ada kode yang berhubungan dengan ownership dan borrowing, dan apakah kode tersebut mengikuti aturan borrowing yang sudah ditetapkan oleh Rust, atau tidak. Jika ada yang menyalahi aturan, maka borrow checker memunculkan error.</p><blockquote><p>Borrow checker sangat galak, pastikan kode yang ditulis mengikuti aturan yang berlaku di pemrograman Rust.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a353-aturan-borrowing">A.35.3. Aturan borrowing<a class="hash-link" href="#a353-aturan-borrowing" title="Direct link to heading">​</a></h2><p>Aturan borrowing atau reference sempat disinggung pada chapter <a href="/basic/pointer-references">Pointer & References</a>, yang kurang lebih adalah:</p><ul><li>Dalam waktu yang sama, hanya boleh ada satu mutable reference atau banyak immutable reference (keduanya tidak bisa bersamaan, harus salah satu).</li><li>Reference harus selalu valid.</li></ul><p>Dua aturan tersebut wajib dipatuhi, jika tidak maka pasti muncul error.</p><p>Ok, selanjutnya mari kita test aturan tersebut.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a354-borrowing-mutableimmutable-reference">A.35.4. Borrowing mutable/immutable reference<a class="hash-link" href="#a354-borrowing-mutableimmutable-reference" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-1">◉ Contoh ke-1<a class="hash-link" href="#-contoh-ke-1" title="Direct link to heading">​</a></h3><p>Pada contoh berikut kita simulasikan 1 data memiliki banyak immutable reference. Jika mengacu ke aturan di atas, maka hal seperti ini adalah boleh dan tidak menghasilkan error.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_5 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_6 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">msg_5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_7 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">msg_5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_8 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">msg_5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?} {:?} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_6</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_7</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_8</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Borrowing" src="/assets/images/borrowing-1-6abee77c6350f8a390a807adac852003.png" width="470" height="301" class="img_ev3q"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-2">◉ Contoh ke-2<a class="hash-link" href="#-contoh-ke-2" title="Direct link to heading">​</a></h3><p>Pada contoh ke-2 ini, kita coba simulasikan 1 data memiliki 1 mutable reference. Harusnya tidak muncul error karena diperbolehkan di aturan yang tertulis.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg_9 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_10 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg_9</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Borrowing" src="/assets/images/borrowing-2-cf66c8ef1c4b76c209f6d8c7d3339a3f.png" width="497" height="272" class="img_ev3q"></p><p>Bagaimana jika ada lebih dari 1 mutable reference? mari kita test.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg_9 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_10 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg_9</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_11 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg_9</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_11</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Borrowing" src="/assets/images/borrowing-3-55cc0f7a0b551f62c748a9bf0396a671.png" width="652" height="613" class="img_ev3q"></p><p>Hasilnya error. Hal seperti ini tidak diperbolehkan. Sebuah data tidak boleh memiliki lebih dari 1 mutable reference.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-3">◉ Contoh ke-3<a class="hash-link" href="#-contoh-ke-3" title="Direct link to heading">​</a></h3><p>Sekarang mari kita coba test lagi aturan di atas dengan skenario: dalam waktu yang sama, 1 data memiliki 1 mutable reference dan 1 immutable reference. Hasilnya seperti apa, (jika mengacu ke aturan, hal seperti ini adalah tidak diperbolehkan).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg_12 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_13 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">msg_12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_14 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg_12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_13</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_14</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Borrowing" src="/assets/images/borrowing-4-c806f4e6787a069015fe56b40e97b3ca.png" width="652" height="486" class="img_ev3q"></p><p>Hasilnya error, kenapa? karena memang tidak boleh.</p><p>Jadi sampai sini cukup jelas ya. Sebuah data dalam waktu yang sama hanya diperbolehkan memiliki satu atau lebih immutable reference, atau hanya 1 mutable reference, dan keduanya tidak bisa bersamaan dalam satu waktu (harus pilih salah satu).</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a355-borrowing-validinvalid-reference">A.35.5. Borrowing valid/invalid reference<a class="hash-link" href="#a355-borrowing-validinvalid-reference" title="Direct link to heading">​</a></h2><p>Kita telah belajar tentang <a href="/basic/ownership#a333-variable-scope">valid/invalid variable dan juga variable scope</a> pada chapter sebelumnya. Sekarang kita akan coba gabungkan dua aspek tersebut dengan borrowing.</p><p>Silakan praktikkan kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> fact_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Arthas is the true lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">change_value</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> fact_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact_two</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">change_value</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">txt</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">txt </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Bolvar is better lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas, ada satu buah mutable string bernama <code>fact_one</code>. String tersebut dipinjam menggunakan <code>&mut</code> (yang berarti adalah mutable borrow) sebagai argumen pemanggilan fungsi <code>change_value</code> yang isinya kurang lebih adalah perubahan isi data string pada variabel pointer.</p><p>Kemudian, ada operasi peminjaman lagi (yang juga mutable borrow) dari variabel <code>fact_one</code> ke <code>fact_one</code>.</p><p>Ketika program di-run, hasilnya sukses. Kok bisa? padahal jelas di aturan tertulis bahwa dalam waktu yang sama tidak boleh ada lebih dari satu mutable borrow.</p><p><img loading="lazy" alt="Borrowing" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcEAAABYCAIAAAACx9uAAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb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EEQRDkUIIgCHIoQRAEQQ4lCIIghxIEQZBDCYIgbg7/A/2VpFwzyoJFAAAAAElFTkSuQmCC" width="449" height="88" class="img_ev3q"></p><p>Kata <strong>dalam waktu yang sama</strong> di sini adalah yang penting untuk dipahami. Arti <em>dalam waktu yang sama</em> adalah dalam 1 scope yang sama. Jika ada 2 scope, maka itu sudah bukan dalam waktu yang sama lagi.</p><p>Pada contoh di atas, statement <code>&mut fact_one</code> terjadi pada block fungsi <code>change_value</code>, lebih tepatnya pada parameter <code>txt</code> fungsi tersebut.</p><p>Kemudian setelah eksekusi fungsi tersebut selesai, yang terjadi adalah: reference yang tadinya dipinjam, sekarang dikembalikan. Tepat setelah eksekusi fungsi <code>change_value</code>, state data <code>fact_one</code> adalah tidak dipinjam siapapun. Tadinya memang ada yang meminjam (yaitu parameter <code>txt</code> di fungsi <code>change_value</code>), tapi setelah eksekusi fungsi <code>change_value</code> selesai, data dikembalikan lagi ke owner.</p><p>Proses dealokasi pada variable scope, jika terjadi pada variable reference maka yang sebenarnya terjadi adalah pengembalian data hasil operasi borrow ke pemilik aslinya.</p><p>Kemudian, ada operasi pinjam lagi, yaitu <code>let fact_two = &mut fact_one</code>. Statement borrow ini tidak menghasilkan error karena memang kondisi data <code>fact_one</code> sudah tidak ada yang meminjam. Bisa dibilang statement peminjaman ke-2 ini tidak terjadi dalam waktu yang sama dengan statement peminjaman pertama (pemanggilan fungsi <code>change_value</code>).</p><p>Pada fungsi <code>change_value</code>, variabel <code>txt</code> adalah valid saat fungsi dijalankan. Setelah pemanggilan fungsi selesai, variabel <code>txt</code> di-dealokasi. Namun karena variabel tersebut bukanlah owner, melainkan hanya borrower yang meminjam data dari owner <code>fact_one</code>, maka yang terjadi adalah: data yang dipinjam sekarang dikembalikan lagi ke pemilik aslinya.</p><p>Ok sampai sini semoga cukup jelas ya. Jika perlu silakan ulang-ulang penjelasan di atas.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a356-borrowing-pada-block">A.35.6. Borrowing pada block<a class="hash-link" href="#a356-borrowing-pada-block" title="Direct link to heading">​</a></h2><p>Kita sudah cukup paham kapan waktu terjadinya alokasi alamat memory dan juga kapan proses dealokasi terjadi, yaitu ketika variabel <strong>into scope</strong> dan ketika variabel <strong>out of scope</strong>.</p><p>Scope di sini adalah variable scope, yang maksudnya adalah block scope, bisa berupa block expression, fungsi, block seleksi kondisi <code>if</code>, dan juga jenis block lainnya.</p><p>Ok, sekarang mari kita praktikkan beberapa jenis block untuk isolasi operasi borrowing. Dengan ini maka klausul <strong>dalam satu waktu</strong> akan terpenuhi.</p><p>Silakan modifikasi program sebelumnya menjadi seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> fact_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Arthas is the true lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">change_value</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> fact_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">fact_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"There must always be a lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">contains</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> fact_three </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">fact_three </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Who is the real jailer?"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> _ </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> fact_four </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">fact_four </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Is it Zovaal or Primus?"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">change_value</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">txt</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">txt </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Bolvar is better lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Borrowing" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcsAAACvCAIAAAAdcmLoAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkN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i2l06Wy+z0NZG4xW7awdhrcOjLI2D++DfF4uwlbLgwI3QrgnbgthlhM38ppX3VBy7ibQ9HwuoE9Y4e8l/0Dz+clDh8JSwkfdrjbAyGzhwI7T7WYIGt+ylhE12tay+wx/KztZLLLSNs7uLEz3pmg4pHD6bsOY1woEbof0TNkTGDCvYFiRlqxDsKdfBdzuYHc1Dw2UW2sbZmwgr50TXIGzTNUII7ZCwM822ndOAKt4yrb7PH2R4iaYtM2frhRba+uxXJ2zg5Z2fIP9gDbxFaBeEleth/W7ZBWtqx3e2zWUHltV3vMxTO1svt9AWZ1+BsCpLirDRBRmWGBQdzSEsQnuLYRFCCEFYhBCCsAghBGERQghBWIQQgrAIIQRhEUIIQViEEIKwCCEEYRFCCEFYhBCCsAghdN/6P7tjVzmYr81GAAAAAElFTkSuQmCC" width="459" height="175" class="img_ev3q"></p><p>Bisa dilihat, hasilnya tidak error, meskipun terjadi beberapa kali operasi mutable borrow, tapi karena kesemuanya terjadi di waktu yang berbeda (di scope yang berbeda) maka tidak error.</p><p>Pada kode di atas, mutable borrow terjadi di banyak tempat, yaitu di block fungsi <code>change_value</code>, block expression, block seleksi kondisi <code>if</code>, dan juga block perulangan <code>for</code>. Variabel pointer yang menampung data pinjaman akan valid di masing-masing block, kemudian menjadi invalid setelah eksekusi block selesai, dan yang terjadi setelah itu adalah pengembalian data yang telah dipinjam.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-contains-milik-string">◉ Method <code>contains</code> milik <code>String</code><a class="hash-link" href="#-method-contains-milik-string" title="Direct link to heading">​</a></h3><p>Pada contoh di atas kita menerapkan method baru bernama <code>contains</code>. Method ini tersedia untuk tipe data <code>String</code>, gunanya adalah untuk mengecek apakah string memiliki substring <code>x</code>, yang mana <code>x</code> sendiri adalah argumen pemanggilan method. Method ini mengembalikan nilai <code>bool</code>.</p><p>Contoh penerapan method <code>contains</code>:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> fact </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"There must always be a lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">contains</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => true</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">contains</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"bolvar"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => false</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>O iya, pengecekan string-nya adalah case sensitive ya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> fact </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"There must always be a lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">contains</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => true</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">contains</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Lich King"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => false</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Lebih jelasnya mengenai tipe data string dan method yang tersedia pada tipe tersebut akan dibahas terpisah pada chapter <a href="/basic/string-slice-vs-string-literal">Tipe Data ➜ String Custom Type vs &str</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a357-owner-dan-borrower-data-literal">A.35.7. Owner dan borrower data literal<a class="hash-link" href="#a357-owner-dan-borrower-data-literal" title="Direct link to heading">​</a></h2><p>Perhatikan statement berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> text </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">text</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas, variabel <code>number</code> dan <code>text</code> adalah <em>owner</em> data masing-masing. Sedangkan variabel <code>a</code> dan <code>b</code> adalah <em>borrower</em> atau peminjam data (yang lebih jelasnya akan dibahas pada chapter ). Sampai sini penulis rasa cukup jelas.</p><p>Selanjutnya, bagaimana dengan contoh ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> c </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> e </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ketiga variabel, semuanya adalah <em>borrower</em> atau peminjam data. Lalu siapa <em>owner</em>-nya? jawabannya adalah tidak ada, atau silakan juga simpulkan bawah data tersebut owner-nya adalah program.</p><p>Yang lebih penting untuk diurusi pada contoh di atas bukan siapa owner-nya, melainkan bagaimana caranya agar data pinjaman tersebut tidak di-dealokasi saat block kode selesai.</p><p>Untuk sekarang sampai sini dulu. Kita akan bahas topik ini lebih mendetail pada chapter <a href="/basic/static">Static item</a> dan <a href="/basic/lifetime">Lifetime</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a358-borrowing-pada-macro-println">A.35.8. Borrowing pada macro <code>println</code><a class="hash-link" href="#a358-borrowing-pada-macro-println" title="Direct link to heading">​</a></h2><p>Pada pemanggilan macro println untuk menampilkan data yang mengadopsi <em>move semantics</em>, operasi borrowing tidak perlu dilakukan sewaktu pengisian argument. Karena macro tersebut secara cerdas akan melakukan opearsi peminjaman tanpa memindah owner-nya. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"luwe"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> str1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... adalah ekuivalen dengan ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ngelak"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">str2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Lebih jelasnya mengenai macro dibahas pada chapter <a href="#/wip/macro">Macro</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/borrowing" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../borrowing</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><p>Beberapa referensi terkait chapter ini:</p><ul><li><a href="https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html</a></li><li><a href="https://stackoverflow.com/questions/57225055/in-rust-can-you-own-a-string-literal" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/57225055/in-rust-can-you-own-a-string-literal</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/ownership"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.34. Ownership</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/traits"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.36. Traits</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a351-konsep-borrowing" class="table-of-contents__link toc-highlight">A.35.1. Konsep borrowing</a></li><li><a href="#a352-rust-borrow-checker" class="table-of-contents__link toc-highlight">A.35.2. Rust Borrow Checker</a></li><li><a href="#a353-aturan-borrowing" class="table-of-contents__link toc-highlight">A.35.3. Aturan borrowing</a></li><li><a href="#a354-borrowing-mutableimmutable-reference" class="table-of-contents__link toc-highlight">A.35.4. Borrowing mutable/immutable reference</a><ul><li><a href="#-contoh-ke-1" class="table-of-contents__link toc-highlight">◉ Contoh ke-1</a></li><li><a href="#-contoh-ke-2" class="table-of-contents__link toc-highlight">◉ Contoh ke-2</a></li><li><a href="#-contoh-ke-3" class="table-of-contents__link toc-highlight">◉ Contoh ke-3</a></li></ul></li><li><a href="#a355-borrowing-validinvalid-reference" class="table-of-contents__link toc-highlight">A.35.5. Borrowing valid/invalid reference</a></li><li><a href="#a356-borrowing-pada-block" class="table-of-contents__link toc-highlight">A.35.6. Borrowing pada block</a><ul><li><a href="#-method-contains-milik-string" class="table-of-contents__link toc-highlight">◉ Method <code>contains</code> milik <code>String</code></a></li></ul></li><li><a href="#a357-owner-dan-borrower-data-literal" class="table-of-contents__link toc-highlight">A.35.7. Owner dan borrower data literal</a></li><li><a href="#a358-borrowing-pada-macro-println" class="table-of-contents__link toc-highlight">A.35.8. Borrowing pada macro <code>println</code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.35. Borrowing</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.35. Borrowing</h1></header><p>Pada chapter ini kita akan belajar tentang apa itu borrowing dalam Rust programming.</p><p>Sebelum masuk ke pembelajaran, penulis anjurkan untuk paham terlebih dahulu tentang <a href="/basic/basic-memory-management">Basic Memory Management</a>, <a href="/basic/pointer-references">Pointer & References</a>, dan juga konsep <a href="/basic/ownership">Ownership</a>. Ketiga topik tersebut dipelajari pada chapter sebelum ini.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a351-konsep-borrowing">A.35.1. Konsep borrowing<a class="hash-link" href="#a351-konsep-borrowing" title="Direct link to heading">​</a></h2><p>Pada chapter sebelumnya kita telah belajar bahwa tipe data yang mengadopsi <em>move semantics</em> (seperti <code>String</code>), ketika digunakan pada operasi assignment maka owner-nya berpindah. Variabel yang sebelumnya adalah owner, setelah proses assignment menjadi invalid, karena owner data tersebut telah berpindah ke variabel baru. Efeknya, semua operasi yang dilakukan pada variabel owner sebelumnya menghasilkan error.</p><p>Sekarang perhatikan kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> msg_1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, statement print <code>msg_1</code> menghasilkan error karena variabel tersebut telah invalid setelah statement <code>let msg_2 = msg_1</code>.</p><p>Programmer harus ekstra hati-hati dan bijak dalam pengelolaan owner data, agar memory ter-manage dengan baik. Tapi kalau dipikir-pikir, repot juga kalau owner harus dilempar-lempar setiap selesai digunakan agar tidak error.</p><p>Salah satu cara yang bisa digunakan agar tidak terlalu repot adalah dengan menerapkan cloning (seperti yang sudah dibahas pada chapter sebelumnya). Namun ini bukan opsi yang baik karena boros memory, sedangkan di sisi lain programmer dianjurkan untuk efisien dalam penggunaan memory.</p><p>Solusi yang paling pas adalah dengan menerapkan <strong>borrowing</strong>. Borrowing artinya adalah meminjam. Pada konteks Rust programming, borrowing berarti meminjam data milik owner, dipinjam agar bisa diakses tanpa perlu memindah owner-nya. Kemudian setelah peminjaman selesai, data dikembalikan.</p><p>Cara meminjam data di Rust sangat mudah, yaitu:</p><ul><li><p>Untuk borrowing dengan level akses immutable/read-only, gunakan operator reference <code>&</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">msg_3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <----- borrow operation</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => hello rust</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => hello rust</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Untuk borrowing dengan level akses mutable, gunakan operator reference <code>&mut</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg_3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg_3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <----- mutable borrow operation</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token operator" style="color:#393A34">*</span><span class="token plain">msg_4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => hello rust</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => hello rust</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><p>Di Rust, semua statement reference (baik mutable ataupun immutable) adalah operasi <em>borrowing</em>. Yang terjadi pada statement reference adalah data milik owner dipinjam dalam bentuk pointer. Pointer itu sendiri merupakan alamat memory yang mengarah ke data sebenarnya (milik owner).</p><p>Dari contoh di atas, bisa ditarik kesimpulan bahwa data string <code>hello rust</code> memiliki dua reference:</p><ul><li>Yang pertama adalah owner data, yaitu variabel <code>msg_3</code></li><li>Yang kedua adalah peminjam data, yaitu variabel pointer <code>msg_4</code></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a352-rust-borrow-checker">A.35.2. Rust Borrow Checker<a class="hash-link" href="#a352-rust-borrow-checker" title="Direct link to heading">​</a></h2><p>Rust compiler memiliki 1 bagian bernama <strong>borrow checker</strong>, tugasnya untuk melakukan pengecekan pada source code apakah ada kode yang berhubungan dengan ownership dan borrowing, dan apakah kode tersebut mengikuti aturan borrowing yang sudah ditetapkan oleh Rust, atau tidak. Jika ada yang menyalahi aturan, maka borrow checker memunculkan error.</p><blockquote><p>Borrow checker sangat galak, pastikan kode yang ditulis mengikuti aturan yang berlaku di pemrograman Rust.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a353-aturan-borrowing">A.35.3. Aturan borrowing<a class="hash-link" href="#a353-aturan-borrowing" title="Direct link to heading">​</a></h2><p>Aturan borrowing atau reference sempat disinggung pada chapter <a href="/basic/pointer-references">Pointer & References</a>, yang kurang lebih adalah:</p><ul><li>Dalam waktu yang sama, hanya boleh ada satu mutable reference atau banyak immutable reference (keduanya tidak bisa bersamaan, harus salah satu).</li><li>Reference harus selalu valid.</li></ul><p>Dua aturan tersebut wajib dipatuhi, jika tidak maka pasti muncul error.</p><p>Ok, selanjutnya mari kita test aturan tersebut.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a354-borrowing-mutableimmutable-reference">A.35.4. Borrowing mutable/immutable reference<a class="hash-link" href="#a354-borrowing-mutableimmutable-reference" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-1">◉ Contoh ke-1<a class="hash-link" href="#-contoh-ke-1" title="Direct link to heading">​</a></h3><p>Pada contoh berikut kita simulasikan 1 data memiliki banyak immutable reference. Jika mengacu ke aturan di atas, maka hal seperti ini adalah boleh dan tidak menghasilkan error.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_5 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_6 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">msg_5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_7 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">msg_5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_8 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">msg_5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?} {:?} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_6</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_7</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_8</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="Borrowing" src="/assets/images/borrowing-1-6abee77c6350f8a390a807adac852003.png" width="470" height="301" class="img_CujE"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-2">◉ Contoh ke-2<a class="hash-link" href="#-contoh-ke-2" title="Direct link to heading">​</a></h3><p>Pada contoh ke-2 ini, kita coba simulasikan 1 data memiliki 1 mutable reference. Harusnya tidak muncul error karena diperbolehkan di aturan yang tertulis.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg_9 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_10 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg_9</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Borrowing" src="/assets/images/borrowing-2-cf66c8ef1c4b76c209f6d8c7d3339a3f.png" width="497" height="272" class="img_CujE"></p><p>Bagaimana jika ada lebih dari 1 mutable reference? mari kita test.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg_9 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_10 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg_9</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_11 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg_9</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_11</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Borrowing" src="/assets/images/borrowing-3-55cc0f7a0b551f62c748a9bf0396a671.png" width="652" height="613" class="img_CujE"></p><p>Hasilnya error. Hal seperti ini tidak diperbolehkan. Sebuah data tidak boleh memiliki lebih dari 1 mutable reference.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-3">◉ Contoh ke-3<a class="hash-link" href="#-contoh-ke-3" title="Direct link to heading">​</a></h3><p>Sekarang mari kita coba test lagi aturan di atas dengan skenario: dalam waktu yang sama, 1 data memiliki 1 mutable reference dan 1 immutable reference. Hasilnya seperti apa, (jika mengacu ke aturan, hal seperti ini adalah tidak diperbolehkan).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg_12 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_13 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">msg_12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg_14 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg_12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_13</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg_14</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Borrowing" src="/assets/images/borrowing-4-c806f4e6787a069015fe56b40e97b3ca.png" width="652" height="486" class="img_CujE"></p><p>Hasilnya error, kenapa? karena memang tidak boleh.</p><p>Jadi sampai sini cukup jelas ya. Sebuah data dalam waktu yang sama hanya diperbolehkan memiliki satu atau lebih immutable reference, atau hanya 1 mutable reference, dan keduanya tidak bisa bersamaan dalam satu waktu (harus pilih salah satu).</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a355-borrowing-validinvalid-reference">A.35.5. Borrowing valid/invalid reference<a class="hash-link" href="#a355-borrowing-validinvalid-reference" title="Direct link to heading">​</a></h2><p>Kita telah belajar tentang <a href="/basic/ownership#a333-variable-scope">valid/invalid variable dan juga variable scope</a> pada chapter sebelumnya. Sekarang kita akan coba gabungkan dua aspek tersebut dengan borrowing.</p><p>Silakan praktikkan kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> fact_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Arthas is the true lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">change_value</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> fact_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact_two</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">change_value</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">txt</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">txt </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Bolvar is better lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas, ada satu buah mutable string bernama <code>fact_one</code>. String tersebut dipinjam menggunakan <code>&mut</code> (yang berarti adalah mutable borrow) sebagai argumen pemanggilan fungsi <code>change_value</code> yang isinya kurang lebih adalah perubahan isi data string pada variabel pointer.</p><p>Kemudian, ada operasi peminjaman lagi (yang juga mutable borrow) dari variabel <code>fact_one</code> ke <code>fact_one</code>.</p><p>Ketika program di-run, hasilnya sukses. Kok bisa? padahal jelas di aturan tertulis bahwa dalam waktu yang sama tidak boleh ada lebih dari satu mutable borrow.</p><p><img loading="lazy" alt="Borrowing" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcEAAABYCAIAAAACx9uAAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTItMTBUMjM6MjU6MjArMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyL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y4mPO28roORC8gtE+TQm0T0Tbo+Jt2QQy8g+nvT7fzMFhHk0EshXstvSKBgobjfaXwt7VxsEViz8wF4ghxKEARBDiUIgiCHEgRBkEMJgiAIcihBEAQ5lCAIghxKEARBDiUIgiCHEgRBEHU49Of7x8evt2/3395+fXy8/yysoMvVoTjrApzb2jX2fkEzt2hgHdd5zPRbdE6pFLbYn2uHDUHcNod2U2uCY4JsRVEbceipGlkJvFiHScmhBHHFHDpNxpkkzvNjnBbhv68qzLtiDq2bz+DQGu1u5BeCuBoOVWKMaX4GcySIT+NpE03ohHXnP+fFa1ji6Z/TDwYpKCvfoMxc7vefU/unlEH27lpY3HQdXoTZiyyCXKgu8FPfaxbZHNqnPydGFZ2unRLKMuN1CSmTIIeWcOhEoeFUTBdwMRFEJDr99O3tfZx7c1HD7Jz4Kzc9AeO4grGeMdIwO2hoVLkzDoXZV1qEL44LZ8Uiu57pV6WUiENBmclNkOt2ghzq4tA06kiiSzn58I99aGMtBOdp7WBEFLV5JjUg+e5/cbwcR8c5DsXZV1qkeVe0J0pi1tNnf3tHAaTRjeMfYce32RYgiJuOQ0eaSijE5NAw+PwVEUq6HC7dTJNkMfG9WQ5oLli3F3Gokn29RXZcv4xDNQ85ODS4T5FCCXJoOYcOrKDvcsI5PFwIKBTHZ1UYR1vuWqR0ssgsy8ehIHsDDs0nccSh32DM7uDQaFVCBiXIoUviULFITQMSOYc79vz59gudNPWBUWUOze8JCovUnQB18SwDUZG9AYfCmoo5FN5n8hy6+0cuCGKnHIqeDw2uy4NpmBieOH+8vxXHobCi+KI106OUQY2O6+mRi2r+xFPVLPpItlTkuXwZh06nRkbtdhzKUJQghxJECUBITBYlyKEEsWBfh083EeRQgljCokVv/hIEOZQgCIIghxIEQZBDCYIgyKEEQRDkUIIgCHIoQRAEQQ4lCIIghxIEQZBDCYIgbg7/A/2VpFwzyoJFAAAAAElFTkSuQmCC" width="449" height="88" class="img_CujE"></p><p>Kata <strong>dalam waktu yang sama</strong> di sini adalah yang penting untuk dipahami. Arti <em>dalam waktu yang sama</em> adalah dalam 1 scope yang sama. Jika ada 2 scope, maka itu sudah bukan dalam waktu yang sama lagi.</p><p>Pada contoh di atas, statement <code>&mut fact_one</code> terjadi pada block fungsi <code>change_value</code>, lebih tepatnya pada parameter <code>txt</code> fungsi tersebut.</p><p>Kemudian setelah eksekusi fungsi tersebut selesai, yang terjadi adalah: reference yang tadinya dipinjam, sekarang dikembalikan. Tepat setelah eksekusi fungsi <code>change_value</code>, state data <code>fact_one</code> adalah tidak dipinjam siapapun. Tadinya memang ada yang meminjam (yaitu parameter <code>txt</code> di fungsi <code>change_value</code>), tapi setelah eksekusi fungsi <code>change_value</code> selesai, data dikembalikan lagi ke owner.</p><p>Proses dealokasi pada variable scope, jika terjadi pada variable reference maka yang sebenarnya terjadi adalah pengembalian data hasil operasi borrow ke pemilik aslinya.</p><p>Kemudian, ada operasi pinjam lagi, yaitu <code>let fact_two = &mut fact_one</code>. Statement borrow ini tidak menghasilkan error karena memang kondisi data <code>fact_one</code> sudah tidak ada yang meminjam. Bisa dibilang statement peminjaman ke-2 ini tidak terjadi dalam waktu yang sama dengan statement peminjaman pertama (pemanggilan fungsi <code>change_value</code>).</p><p>Pada fungsi <code>change_value</code>, variabel <code>txt</code> adalah valid saat fungsi dijalankan. Setelah pemanggilan fungsi selesai, variabel <code>txt</code> di-dealokasi. Namun karena variabel tersebut bukanlah owner, melainkan hanya borrower yang meminjam data dari owner <code>fact_one</code>, maka yang terjadi adalah: data yang dipinjam sekarang dikembalikan lagi ke pemilik aslinya.</p><p>Ok sampai sini semoga cukup jelas ya. Jika perlu silakan ulang-ulang penjelasan di atas.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a356-borrowing-pada-block">A.35.6. Borrowing pada block<a class="hash-link" href="#a356-borrowing-pada-block" title="Direct link to heading">​</a></h2><p>Kita sudah cukup paham kapan waktu terjadinya alokasi alamat memory dan juga kapan proses dealokasi terjadi, yaitu ketika variabel <strong>into scope</strong> dan ketika variabel <strong>out of scope</strong>.</p><p>Scope di sini adalah variable scope, yang maksudnya adalah block scope, bisa berupa block expression, fungsi, block seleksi kondisi <code>if</code>, dan juga jenis block lainnya.</p><p>Ok, sekarang mari kita praktikkan beberapa jenis block untuk isolasi operasi borrowing. Dengan ini maka klausul <strong>dalam satu waktu</strong> akan terpenuhi.</p><p>Silakan modifikasi program sebelumnya menjadi seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> fact_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Arthas is the true lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">change_value</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> fact_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">fact_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"There must always be a lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">contains</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> fact_three </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">fact_three </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Who is the real jailer?"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> _ </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> fact_four </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">fact_four </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Is it Zovaal or Primus?"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">change_value</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">txt</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">txt </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Bolvar is better lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Borrowing" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcsAAACvCAIAAAAdcmLoAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTItMTBUMjM6NTE6MjcrMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyLTEyLTEzVDE3OjA3OjIxKzA3OjAwIiB4bXA6TWV0YWRhd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+wx/KztZLLLSNs7uLEz3pmg4pHD6bsOY1woEbof0TNkTGDCvYFiRlqxDsKdfBdzuYHc1Dw2UW2sbZmwgr50TXIGzTNUII7ZCwM822ndOAKt4yrb7PH2R4iaYtM2frhRba+uxXJ2zg5Z2fIP9gDbxFaBeEleth/W7ZBWtqx3e2zWUHltV3vMxTO1svt9AWZ1+BsCpLirDRBRmWGBQdzSEsQnuLYRFCCEFYhBCCsAghBGERQghBWIQQgrAIIQRhEUIIQViEEIKwCCEEYRFCCEFYhBCCsAghdN/6P7tjVzmYr81GAAAAAElFTkSuQmCC" width="459" height="175" class="img_CujE"></p><p>Bisa dilihat, hasilnya tidak error, meskipun terjadi beberapa kali operasi mutable borrow, tapi karena kesemuanya terjadi di waktu yang berbeda (di scope yang berbeda) maka tidak error.</p><p>Pada kode di atas, mutable borrow terjadi di banyak tempat, yaitu di block fungsi <code>change_value</code>, block expression, block seleksi kondisi <code>if</code>, dan juga block perulangan <code>for</code>. Variabel pointer yang menampung data pinjaman akan valid di masing-masing block, kemudian menjadi invalid setelah eksekusi block selesai, dan yang terjadi setelah itu adalah pengembalian data yang telah dipinjam.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-contains-milik-string">◉ Method <code>contains</code> milik <code>String</code><a class="hash-link" href="#-method-contains-milik-string" title="Direct link to heading">​</a></h3><p>Pada contoh di atas kita menerapkan method baru bernama <code>contains</code>. Method ini tersedia untuk tipe data <code>String</code>, gunanya adalah untuk mengecek apakah string memiliki substring <code>x</code>, yang mana <code>x</code> sendiri adalah argumen pemanggilan method. Method ini mengembalikan nilai <code>bool</code>.</p><p>Contoh penerapan method <code>contains</code>:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> fact </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"There must always be a lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">contains</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => true</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">contains</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"bolvar"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => false</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>O iya, pengecekan string-nya adalah case sensitive ya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> fact </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"There must always be a lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">contains</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"lich king"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => true</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fact</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">contains</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Lich King"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => false</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Lebih jelasnya mengenai tipe data string dan method yang tersedia pada tipe tersebut akan dibahas terpisah pada chapter <a href="/basic/string-slice-vs-string-literal">Tipe Data ➜ String Custom Type vs &str</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a357-owner-dan-borrower-data-literal">A.35.7. Owner dan borrower data literal<a class="hash-link" href="#a357-owner-dan-borrower-data-literal" title="Direct link to heading">​</a></h2><p>Perhatikan statement berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> text </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">text</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas, variabel <code>number</code> dan <code>text</code> adalah <em>owner</em> data masing-masing. Sedangkan variabel <code>a</code> dan <code>b</code> adalah <em>borrower</em> atau peminjam data (yang lebih jelasnya akan dibahas pada chapter ). Sampai sini penulis rasa cukup jelas.</p><p>Selanjutnya, bagaimana dengan contoh ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> c </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> e </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ketiga variabel, semuanya adalah <em>borrower</em> atau peminjam data. Lalu siapa <em>owner</em>-nya? jawabannya adalah tidak ada, atau silakan juga simpulkan bawah data tersebut owner-nya adalah program.</p><p>Yang lebih penting untuk diurusi pada contoh di atas bukan siapa owner-nya, melainkan bagaimana caranya agar data pinjaman tersebut tidak di-dealokasi saat block kode selesai.</p><p>Untuk sekarang sampai sini dulu. Kita akan bahas topik ini lebih mendetail pada chapter <a href="/basic/static">Static item</a> dan <a href="/basic/lifetime">Lifetime</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a358-borrowing-pada-macro-println">A.35.8. Borrowing pada macro <code>println</code><a class="hash-link" href="#a358-borrowing-pada-macro-println" title="Direct link to heading">​</a></h2><p>Pada pemanggilan macro println untuk menampilkan data yang mengadopsi <em>move semantics</em>, operasi borrowing tidak perlu dilakukan sewaktu pengisian argument. Karena macro tersebut secara cerdas akan melakukan opearsi peminjaman tanpa memindah owner-nya. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"luwe"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> str1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... adalah ekuivalen dengan ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ngelak"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">str2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Lebih jelasnya mengenai macro dibahas pada chapter <a href="#/wip/macro">Macro</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/borrowing" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../borrowing</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><p>Beberapa referensi terkait chapter ini:</p><ul><li><a href="https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html</a></li><li><a href="https://stackoverflow.com/questions/57225055/in-rust-can-you-own-a-string-literal" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/57225055/in-rust-can-you-own-a-string-literal</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/ownership"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.34. Ownership</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/traits"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.36. Traits</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a351-konsep-borrowing" class="table-of-contents__link toc-highlight">A.35.1. Konsep borrowing</a></li><li><a href="#a352-rust-borrow-checker" class="table-of-contents__link toc-highlight">A.35.2. Rust Borrow Checker</a></li><li><a href="#a353-aturan-borrowing" class="table-of-contents__link toc-highlight">A.35.3. Aturan borrowing</a></li><li><a href="#a354-borrowing-mutableimmutable-reference" class="table-of-contents__link toc-highlight">A.35.4. Borrowing mutable/immutable reference</a><ul><li><a href="#-contoh-ke-1" class="table-of-contents__link toc-highlight">◉ Contoh ke-1</a></li><li><a href="#-contoh-ke-2" class="table-of-contents__link toc-highlight">◉ Contoh ke-2</a></li><li><a href="#-contoh-ke-3" class="table-of-contents__link toc-highlight">◉ Contoh ke-3</a></li></ul></li><li><a href="#a355-borrowing-validinvalid-reference" class="table-of-contents__link toc-highlight">A.35.5. Borrowing valid/invalid reference</a></li><li><a href="#a356-borrowing-pada-block" class="table-of-contents__link toc-highlight">A.35.6. Borrowing pada block</a><ul><li><a href="#-method-contains-milik-string" class="table-of-contents__link toc-highlight">◉ Method <code>contains</code> milik <code>String</code></a></li></ul></li><li><a href="#a357-owner-dan-borrower-data-literal" class="table-of-contents__link toc-highlight">A.35.7. Owner dan borrower data literal</a></li><li><a href="#a358-borrowing-pada-macro-println" class="table-of-contents__link toc-highlight">A.35.8. Borrowing pada macro <code>println</code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/build-dan-run-program-rust.html b/basic/build-dan-run-program-rust.html index 19db3099..82269ce5 100644 --- a/basic/build-dan-run-program-rust.html +++ b/basic/build-dan-run-program-rust.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/build-dan-run-program-rust/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/build-dan-run-program-rust/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.2. Build dan Run Program Rust","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/build-dan-run-program-rust/#webpage"},"wordCount":261,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/build-dan-run-program-rust/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust","belajar rust","hello world","hello rust","run program rust","cargo"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/build-dan-run-program-rust/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/build-dan-run-program-rust","name":"A.2. Build dan Run Program Rust","description":"Cara run program Rust menggunakan cargo. Pada chapter ini kita akan belajar lebih lanjut tentang command untuk proses build dan run dalam program Rust. Sebelumnya kita sudah belajar tentang cargo new dan cargo run, selain command tersebut ada juga command lain yaitu cargo build untuk proses kompilasi build kode program.","datePublished":"2024-08-01T10:17:28.443Z","dateModified":"2024-08-01T10:17:28.443Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/build-dan-run-program-rust/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/build-dan-run-program-rust"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/build-dan-run-program-rust/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.2. Build dan Run Program Rust","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/build-dan-run-program-rust/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/build-dan-run-program-rust/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.2. Build dan Run Program Rust","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/build-dan-run-program-rust/#webpage"},"wordCount":261,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/build-dan-run-program-rust/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust","belajar rust","hello world","hello rust","run program rust","cargo"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/build-dan-run-program-rust/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/build-dan-run-program-rust","name":"A.2. Build dan Run Program Rust","description":"Cara run program Rust menggunakan cargo. Pada chapter ini kita akan belajar lebih lanjut tentang command untuk proses build dan run dalam program Rust. Sebelumnya kita sudah belajar tentang cargo new dan cargo run, selain command tersebut ada juga command lain yaitu cargo build untuk proses kompilasi build kode program.","datePublished":"2024-08-30T07:44:48.535Z","dateModified":"2024-08-30T07:44:48.535Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/build-dan-run-program-rust/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/build-dan-run-program-rust"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/build-dan-run-program-rust/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.2. Build dan Run Program Rust","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.2. Build dan Run Program Rust</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.2. Build dan Run Program Rust</h1></header><p>Pada chapter ini kita akan belajar lebih lanjut tentang command untuk proses build dan run dalam program Rust. Sebelumnya kita sudah belajar tentang <code>cargo new</code> dan <code>cargo run</code>, selain command tersebut ada juga command lain yaitu <code>cargo build</code> untuk proses kompilasi build kode program.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a21-command-cargo-build">A.2.1. Command <code>cargo build</code><a class="hash-link" href="#a21-command-cargo-build" title="Direct link to heading">​</a></h2><p>Di atas sedikit disinggung bahwa command <code>cargo build</code> berguna untuk mem-build kode program, dan command ini menghasilkan file binary. <code>cargo build</code> lebih sering digunakan saat proses build untuk distribution/deployment, yang umumnya binary hasil build kemudian distribusikan pengguna program.</p><p>Command tersebut juga bisa digunakan di lokal environment, silakan dicoba.</p><ul><li><p>Untuk pengguna Windows:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">cargo</span><span class="token plain"> build</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin class-name">cd</span><span class="token plain"> target/debug</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">hello_rust.exe</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Untuk pengguna non-Windows:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">cargo</span><span class="token plain"> build</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin class-name">cd</span><span class="token plain"> target/debug</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">./hello_rust</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><p>Hasilnya:</p><p><img loading="lazy" alt="Unoptimized build" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdcAAAB2CAIAAAAV0U5pAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMD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EkEQxE/QCyMIgvgJemEEQRA/QS+MIAjiJ+iFEQRB/AS9MIIgiJ+gF0YQBPET9MIIgiB+gl4YQRDET9ALIwiC+Al6YQRBED8ZJledK32pV5NaCPGgv7g2ySoxiDqACIKMH+a5sChbkk8MfLSiJZqVq13Xg/4SwCYhCDJrYEQCQRDET0aPSJgyzQwTajDpnbIkzrXWtGYk6CUSIJxTK/wSNrW2UltqyZ0zkOIWNbERBBkvo86FRVlKtrR0gnI1wpeyjhkjSegpNfTqkJS8JJSst7uhcHzgoJR3PGcoKUnhihaC6OWepFoklBvmv6jNYbJcIwiC0PDkhWO8YsDHACAP4kqsl7lYzVWoiXvtiEIy1Kjok1k197La1XPOMtFziqKslLKclgGcds5uVZbyoOWxtftvDS1JbTB+PEQQZBbwFJEwreNFWeG1XPUxc0rXwQW8K9123VsFE/V2NxXlQFyBRkt3qi3KObv1Si8r7zrGFRAECQajx4VH23cWCscBdJdoTU3ojtpsSStxMRxpK5WwIHLtSLcNEB7pnFTykjC+kyEIggCMGhdWK/VujPcSzLWQP25AL0LLZVOxblXp7y5WFIUhzByNQr2i1tuRFSEcajVp52RBbbZAD2Fw2ZI1IaUoK5TteQiCIMMw0lxYBDW3DtmS1ItJdKvyeg5Mewx4ReGhURakOulgXhJAViRFkQAAGmWht+FBrdQ3k0nzrJZAvd3lk/GqnAMV6ptSsltVAFTHcw7CkZtUXlG0IEujLFdTm6N0EIIgiBvBzcEsygof8bZ3DUEQ5NoxkTeYR0Xb7+tx+zCCIMh1JLhzYQRBkFkA32BGEATxE/TCCIIgfoJeGEEQxE/QCyMIgvgJemEEQRA/QS+MIAjiJ+iFEQRB/AS9MIIgiJ+gF0YQBPET9MIIgiB+gl4YQRDET9ALIwiC+Al6YQRBED9BL4wgCOIn6IURBEH85P8BEvFUAZxQEiUAAAAASUVORK5CYII=" width="471" height="118" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a22-optimized-build">A.2.2. Optimized build<a class="hash-link" href="#a22-optimized-build" title="Direct link to heading">​</a></h2><p>Catatan tambahan saja, command <code>cargo build</code> dan juga <code>cargo run</code> menghasilkan file binary yang <em>unoptimized</em> dan berisi beberapa informasi tambahan untuk proses debugging. Untuk distribution/production dianjurkan untuk generate <em>optimized</em> binary. Caranya dengan cukup menambahkan flag <code>--release</code> pada saat eksekusi command <code>cargo build</code>.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">cargo</span><span class="token plain"> build </span><span class="token parameter variable" style="color:#36acaa">--release</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Optimized build" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAegAAAB5CAIAAAB9fyUJAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF5WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwM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QQQoAbIYQQ4EYIIcCNEEIIcCOEEALcCCEEuBFCCAFuhBBCgBshhAA3QgihVer/B9nCcnLs5PIAAAAASUVORK5CYII=" width="488" height="121" class="img_ev3q"></p><p>Untuk release, file binary berada dalam path <code>target/release</code>. File binary nya adalah optimized, size nya lebih kecil. Mungkin untuk program <code>hello world</code> tidak akan signifikan bedanya, tapi untuk project real sangat dianjurkan untuk menggunakan optimized build.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a23-command-rustc">A.2.3. Command <code>rustc</code><a class="hash-link" href="#a23-command-rustc" title="Direct link to heading">​</a></h2><p>Bagian ini merupakan tambahan informasi saja, bahwa selain command <code>cargo</code> ada juga command <code>rustc</code> yang bisa digunakan untuk kompilasi program.</p><p>Sebagai contoh, silakan buat file <code>hello.rs</code>, lalu tulis kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">hello.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Hello, world!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kemudian <em>compile</em> lalu jalankan file <em>executable</em>-nya, hasilnya adalah sama seperti eksekusi program menggunakan <code>cargo run</code>.</p><ul><li><p>MacOS, Linux, Unix, WSL</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">rustc hello.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">./hello</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Windows</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">rustc hello.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">.</span><span class="token punctuation" style="color:#393A34">\</span><span class="token plain">hello.exe</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><p>Pada ebook ini kita akan menggunakan <code>cargo</code> untuk manajemen dan juga eksekusi kode program Rust. Jadi tidak menggunakan <code>rustc</code> ya.</p><blockquote><p>Command <code>cargo run</code> dan <code>cargo build</code> dalam proses kompilasinya meng-<em>invoke</em> command <code>rustc</code></p></blockquote><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch01-03-hello-cargo.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch01-03-hello-cargo.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/hello-rust"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.1. Program Pertama ➜ Hello Rust</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/komentar"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.3. Komentar</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a21-command-cargo-build" class="table-of-contents__link toc-highlight">A.2.1. Command <code>cargo build</code></a></li><li><a href="#a22-optimized-build" class="table-of-contents__link toc-highlight">A.2.2. Optimized build</a></li><li><a href="#a23-command-rustc" class="table-of-contents__link toc-highlight">A.2.3. Command <code>rustc</code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.2. Build dan Run Program Rust</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.2. Build dan Run Program Rust</h1></header><p>Pada chapter ini kita akan belajar lebih lanjut tentang command untuk proses build dan run dalam program Rust. Sebelumnya kita sudah belajar tentang <code>cargo new</code> dan <code>cargo run</code>, selain command tersebut ada juga command lain yaitu <code>cargo build</code> untuk proses kompilasi build kode program.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a21-command-cargo-build">A.2.1. Command <code>cargo build</code><a class="hash-link" href="#a21-command-cargo-build" title="Direct link to heading">​</a></h2><p>Di atas sedikit disinggung bahwa command <code>cargo build</code> berguna untuk mem-build kode program, dan command ini menghasilkan file binary. <code>cargo build</code> lebih sering digunakan saat proses build untuk distribution/deployment, yang umumnya binary hasil build kemudian distribusikan pengguna program.</p><p>Command tersebut juga bisa digunakan di lokal environment, silakan dicoba.</p><ul><li><p>Untuk pengguna Windows:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">cargo</span><span class="token plain"> build</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin class-name">cd</span><span class="token plain"> target/debug</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">hello_rust.exe</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Untuk pengguna non-Windows:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">cargo</span><span class="token plain"> build</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin class-name">cd</span><span class="token plain"> target/debug</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">./hello_rust</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><p>Hasilnya:</p><p><img loading="eager" fetchpriority="high" alt="Unoptimized build" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdcAAAB2CAIAAAAV0U5pAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YX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ZxQEiUAAAAASUVORK5CYII=" width="471" height="118" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a22-optimized-build">A.2.2. Optimized build<a class="hash-link" href="#a22-optimized-build" title="Direct link to heading">​</a></h2><p>Catatan tambahan saja, command <code>cargo build</code> dan juga <code>cargo run</code> menghasilkan file binary yang <em>unoptimized</em> dan berisi beberapa informasi tambahan untuk proses debugging. Untuk distribution/production dianjurkan untuk generate <em>optimized</em> binary. Caranya dengan cukup menambahkan flag <code>--release</code> pada saat eksekusi command <code>cargo build</code>.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">cargo</span><span class="token plain"> build </span><span class="token parameter variable" style="color:#36acaa">--release</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Optimized build" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAegAAAB5CAIAAAB9fyUJAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF5WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZV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RAqRqKC3de7lyY2pHGZN2mIavzv+I2JXAru9Sv3QbxgBshtFFwzy7vdSJCCKFVg7uJeaE2QghtK+JGCCEEuBFCCHAjhBAC3AghhAA3QggBboQQQoAbIYQQ4EYIIcCNEEIIcCOEEALcCCEEuBFCCAFuhBBCgBshhAA3QgihVer/B9nCcnLs5PIAAAAASUVORK5CYII=" width="488" height="121" class="img_CujE"></p><p>Untuk release, file binary berada dalam path <code>target/release</code>. File binary nya adalah optimized, size nya lebih kecil. Mungkin untuk program <code>hello world</code> tidak akan signifikan bedanya, tapi untuk project real sangat dianjurkan untuk menggunakan optimized build.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a23-command-rustc">A.2.3. Command <code>rustc</code><a class="hash-link" href="#a23-command-rustc" title="Direct link to heading">​</a></h2><p>Bagian ini merupakan tambahan informasi saja, bahwa selain command <code>cargo</code> ada juga command <code>rustc</code> yang bisa digunakan untuk kompilasi program.</p><p>Sebagai contoh, silakan buat file <code>hello.rs</code>, lalu tulis kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">hello.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Hello, world!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kemudian <em>compile</em> lalu jalankan file <em>executable</em>-nya, hasilnya adalah sama seperti eksekusi program menggunakan <code>cargo run</code>.</p><ul><li><p>MacOS, Linux, Unix, WSL</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">rustc hello.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">./hello</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Windows</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">rustc hello.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">.</span><span class="token punctuation" style="color:#393A34">\</span><span class="token plain">hello.exe</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><p>Pada ebook ini kita akan menggunakan <code>cargo</code> untuk manajemen dan juga eksekusi kode program Rust. Jadi tidak menggunakan <code>rustc</code> ya.</p><blockquote><p>Command <code>cargo run</code> dan <code>cargo build</code> dalam proses kompilasinya meng-<em>invoke</em> command <code>rustc</code></p></blockquote><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch01-03-hello-cargo.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch01-03-hello-cargo.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/hello-rust"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.1. Program Pertama ➜ Hello Rust</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/komentar"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.3. Komentar</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a21-command-cargo-build" class="table-of-contents__link toc-highlight">A.2.1. Command <code>cargo build</code></a></li><li><a href="#a22-optimized-build" class="table-of-contents__link toc-highlight">A.2.2. Optimized build</a></li><li><a href="#a23-command-rustc" class="table-of-contents__link toc-highlight">A.2.3. Command <code>rustc</code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/closures.html b/basic/closures.html index 0a4b7f06..68a2bbee 100644 --- a/basic/closures.html +++ b/basic/closures.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/closures/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/closures/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.48. Closures","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/closures/#webpage"},"wordCount":1353,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/closures/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/closures/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/closures","name":"A.48. Closures","description":"Chapter ini membahas tentang closures. Closures sendiri merupakan block fungsi anonimus (anonymous function) yang memiliki kelebihan bisa mengakses item-tem yang posisinya berada di luar block closure tersebut tetapi masih dalam current block scope.","datePublished":"2024-08-01T10:17:28.554Z","dateModified":"2024-08-01T10:17:28.554Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/closures/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/closures"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/closures/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.48. Closures","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/closures/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/closures/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.48. Closures","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/closures/#webpage"},"wordCount":1353,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/closures/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/closures/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/closures","name":"A.48. Closures","description":"Chapter ini membahas tentang closures. Closures sendiri merupakan block fungsi anonimus (anonymous function) yang memiliki kelebihan bisa mengakses item-tem yang posisinya berada di luar block closure tersebut tetapi masih dalam current block scope.","datePublished":"2024-08-30T07:44:48.646Z","dateModified":"2024-08-30T07:44:48.646Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/closures/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/closures"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/closures/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.48. Closures","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.48. Closures</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.48. Closures</h1></header><p>Chapter ini membahas tentang closures. Closures sendiri merupakan block fungsi anonimus (anonymous function) yang memiliki kelebihan bisa mengakses item-tem yang posisinya berada di luar block closure tersebut tetapi masih dalam current block scope.</p><p>Topik closures sangat erat hubungannya dengan <a href="/basic/trait-function">Trait ➜ Function</a>, namun pada chapter ini pembahasan hanya difokuskan pada bagian penerapan closures saja. Penulis anjurkan untuk lanjut ke chapter berikutnya setelah selesai dengan chapter ini.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a481-konsep-closures">A.48.1. Konsep Closures<a class="hash-link" href="#a481-konsep-closures" title="Direct link to heading">​</a></h2><p>Cara penerapan closure sangat mirip seperti fungsi, perbedaannya ada pada notasi penulisan-nya. Agar lebih jelas silakan perhatikan program sederhana di bawah ini.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> volume </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">calculate_circle_volume_v1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{volume:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_circle_volume_v1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">e</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">PI</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> volume </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4.0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">/</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">PI</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> e</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">powi</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> volume</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>calculate_circle_volume_v1</code> akan kita refactor ke bentuk closure, hasilnya adalah berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> calculate_circle_volume_v2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">e</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">f64</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">PI</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> volume </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4.0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">/</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">PI</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> e</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">powi</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> volume</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> volume </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">calculate_circle_volume_v2</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:.2}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> volume</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Silakan pelajari perbedaan dan juga kemiripannya.</p><p>Fungsi dideklarasikan menggunakan keyword <code>fn</code> dan memiliki nama. Closure tidak memiliki nama, namun bisa disimpan dalam variabel (yang disimpan adalah block closure-nya, bukan return value-nya). Contohnya variabel <code>calculate_circle_volume_v2</code> di atas.</p><p>Perbedaan minor lainnya ada pada notasi penulisan parameter. Pada fungsi tanda <code>()</code> digunakan sebagai penanda parameter, sedangkan pada closure tanda <code>||</code> digunakan.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-formatted-print-n">◉ formatted print <code>{:.n}</code><a class="hash-link" href="#-formatted-print-n" title="Direct link to heading">​</a></h3><p>Notasi penulisan formatted print <code>{:.n}</code> digunakan untuk mem-format bilangan desimal di mana <code>n</code> adalah jumlah digit setelah tanda <code>.</code>.</p><p>Sebagai contoh, variabel <code>pi</code> berikut memiliki 0 digit angka dibelakang koma. Untuk menampilkan hanya 4 angka terdepan, bisa gunakan <code>{:.4}</code>. Perlu diketahui bahwa angka dibelakang koma yang muncul otomatis dibulatkan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pi </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.1415926535</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:.4}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> pi</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 3.1416</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{pi:.4}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 3.1416</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a482-notasi-penulisan-closure">A.48.2. Notasi penulisan closure<a class="hash-link" href="#a482-notasi-penulisan-closure" title="Direct link to heading">​</a></h2><p>Closure <code>calculate_circle_volume_v2</code> pada contoh di atas adalah salah satu contoh penulisan closure. Sebuah closure bisa memiliki parameter, bisa juga tidak, dan aturan tersebut juga berlaku pada return value.</p><p>Bebebrapa contoh lain penulisan closure bisa dilihat di bawah ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// closure dengan 2 parameter tanpa return value</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> do_something_v1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params"> a</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params punctuation" style="color:#393A34">,</span><span class="token closure-params"> b</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params class-name">String</span><span class="token closure-params"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// closure dengan 2 parameter dan return value bertipe tuple</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> do_something_v2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params"> a</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params punctuation" style="color:#393A34">,</span><span class="token closure-params"> b</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params class-name">String</span><span class="token closure-params"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// closure tanpa parameter dan return value bertipe Vec<String></span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> do_something_v3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// closure tanpa parameter dan tanpa return value</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> do_something_v4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jika tipe return value tidak dideklarasikan secara eksplist, maka Rust menganggap tipe return value adalah sesuai dengan tipe data pada statement terakhir.</p><p>Untuk closure yang isinya hanya 1 baris statement, boleh tidak dituliskan block kurung kurawal-nya (<code>{}</code>).</p><p>Tambahan contoh, satu fungsi dan tiga buah closures berikut adalah ekuivalen.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">pow_v1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pow_v2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pow_v3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pow_v4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ok, sekarang bagaimana dengan closure yang tidak memiliki parameter dengan isi hanya return value saja? Penulisannya seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> get_pi </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">get_pi</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a483-mutable-closure">A.48.3. Mutable closure<a class="hash-link" href="#a483-mutable-closure" title="Direct link to heading">​</a></h2><p>Tidak ada yang spesial mengenai cara mengakses item yang berada di luar block closure. Caranya cukup dengan panggil saja item seperti biasanya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> num </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> display </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{num}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{num}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 5</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">display</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 5</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Beda lagi jika data di luar block closure adalah diubah (di-mutate) nilainya dari dalam closure, jika seperti itu maka ada beberapa hal yang perlu diperhatikan.</p><p>Sebagai contoh, pelajari kode berikut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> num </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> increase_by </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">increase_by</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{num}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 15</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Closure" src="/assets/images/closures-1-2c7599bfed946d5bd1fb34a57acd9de7.png" width="765" height="176" class="img_ev3q"></p><p>Solusi untuk menghilangkan error di atas adalah dengan menambahkan keyword <code>mut</code> pada variabel closure <code>increase_by</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// before</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> increase_by </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// after</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> increase_by </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Keyword <code>mut</code> wajib ditambahkan ke variabel penampung closure ketika di dalamnya terdapat operasi perubahan data terhadap variabel yang posisinya di-luar closure. Contohnya bisa dilihat di atas, variabel <code>num</code> nilainya di-mutate atau diubah dari dalam closure, karena inilah variabel <code>increase_by</code> harus didefinisikan mutable.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a484-borrowing-pada-closure">A.48.4. Borrowing pada closure<a class="hash-link" href="#a484-borrowing-pada-closure" title="Direct link to heading">​</a></h2><p><strong>Semua variabel di luar block closure ketika digunakan di dalam closure maka terjadi operasi borrowing pada variabel tersebut</strong>. Variabel di luar block closure dipinjam agar bisa digunakan di dalam closure.</p><p>Sebagai contoh, kode sederhana berikut menghasilkan error, karena variabel <code>num</code> adalah dipinjam oleh closure <code>increase_by</code> untuk dipergunakan di dalam block-nya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> num </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> increase_by </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">increase_by</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{num}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 20</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Closure" src="/assets/images/closures-2-35b45e21715884c98b155c79b2d8f1c4.png" width="525" height="222" class="img_ev3q"></p><p>Error muncul di statement setelahnya, yaitu <code>num += 5</code> karena <code>num</code> statusnya masih dipinjam oleh closure <code>increase_by</code>.</p><p>Variabel <code>num</code> dipinjam dengan mode peminjaman adalah <em>mutable borrow</em> karena closure didefinisikan mutable. Salah satu aturan pada borrowing: bahwa dalam waktu yang sama, ketika sudah terjadi mutable borrow, maka tidak boleh ada borrowing lainnya. Itulah alasan kenapa statement <code>num += 5</code> menghasilkan error.</p><p>Solusi dari masalah di atas ada beberapa, yang pertama adalah menggunakan block expression untuk meng-isolasi closure, agar peminjaman pada closure tersebut dan statement <code>num += 5</code> tidak terjadi dalam waktu yang sama.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> num </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> increase_by </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">increase_by</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{num}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 20</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Solusi di atas efektif untuk menghilangkan error borrowing yang sebelumnya muncul, tapi setelah d-refactor kode menjadi tidak sesuai spesifikasi awal. Pada kode yang baru di atas, deklarasi closure <code>increase_by</code> terjadi di dalam block expression, artinya closure ini hanya akan bisa digunakan pada block kode tersebut saja, tidak bisa di-reuse di luar block.</p><p>Solusi yang lebih baik pada kasus di atas adalah dengan tidak menggunakan default borrowing (yang terjadi di dalam block closure ketika mengakses variabel yang posisinya berada di luar closure), melainkan gunakan saja borrowing pada parameter closure. Kita ubah lagi kodenya menjadi seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> num </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> increase_by </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">num</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params operator" style="color:#393A34">&</span><span class="token closure-params keyword" style="color:#00009f">mut</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params punctuation" style="color:#393A34">,</span><span class="token closure-params"> x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">increase_by</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> num</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{num}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 20</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, closure <code>increase_by</code> ditambahi parameter baru. Sekarang ada 2 parameter, yaitu <code>num</code> yang tipe-nya adalah pointer <code>&mut i32</code> dan parameter <code>x</code>. Di dalam block closure, <code>num</code> di-dereference (menggunakan operator <code>*</code>) kemudian diubah nilainya. Setelah eksekusi statement selesai, data pinjaman tersebut langsung dikembalikan ke pemilik. Inilah kenapa kode di atas tidak menghasilkan error.</p><blockquote><p>Pengaksesan variabel yang berada di luar scope closure tanpa via parameter berarti adalah borrowing, maka dalam penerapannya wajib untuk memperhatikan aturan yang berlaku pada ownership dan borrowing.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a485-keyword-move">A.48.5. Keyword <code>move</code><a class="hash-link" href="#a485-keyword-move" title="Direct link to heading">​</a></h2><p>Telah dijelaskan di atas bahwa variabel di luar closure, jika diakses dari dalam closure maka terjadi borrowing. Ada cara agar variabel tersebut ownership-nya berpindah ke dalam closure (<em>move semantics</em>), yaitu menggunakan keyword <code>move</code>.</p><p>Contohnya bisa dilihat berikut ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> num </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> increase_by </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">move</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{num} (from closure)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 15</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">increase_by</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{num}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 5</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Closure <code>increase_by</code> di atas memiliki keyword <code>move</code> dalam pendefinisiannya. Dengan ini maka semua variabel di luar scope closure jika diakses dari dalam closure, maka variabel tersebut berpindah owner-nya (<em>move semantics</em>).</p><p>Lalu bagaimana dengan nasib variabel <code>num</code> yang berada di luar closure setelah owner-nya berpindah? Pada kondisi normal jawaban pertanyaan ini adalah tergantung tipe data-nya, jika <em>by default</em> variabel adalah mengadopsi <em>move semantics</em> maka variabel tersebut menjadi invalid. Namun pada contoh di atas <code>num</code> bertipe data <code>i32</code> yang mengadopsi <em>copy semantics</em>, maka variabel <code>num</code> tersebut masih bisa digunakan di luar closure.</p><p><img loading="lazy" alt="Closure" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUQAAABpCAIAAADNzc3NAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53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QzQRAz7pm5YyaI6yVzzGvymSCun8z02yOIfZCZipkgrpnMhXEICIK4CjObIAiSmSAIkpkgCJKZIEhmgiBIZoIgSGaCIEhmgiCZCYIgmQmCIJkJgpgM/wO2kS/cvrb36AAAAABJRU5ErkJggg==" width="324" height="105" class="img_ev3q"></p><p>Bisa dilihat dari gambar di atas, statement <code>print</code> dari dalam block closure hasilnya adalah benar, yaitu <code>5 + 10 = 15</code>. Dan variabel <code>num</code> di luar block closure tidak berubah nilainya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a486-closure-sebagai-return-type">A.48.6. Closure sebagai return type<a class="hash-link" href="#a486-closure-sebagai-return-type" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-praktik-ke-1">◉ Praktik ke-1<a class="hash-link" href="#-praktik-ke-1" title="Direct link to heading">​</a></h3><p>Fungsi bisa memiliki nilai balik bertipe closure. Caranya dengan menggunakan <code>impl Fn()</code> sebagai tipe data nilai balik. Contoh penerapannya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Fn</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello (from do_something)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello (from closure)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Tipe <code>impl Fn()</code> adalah ekuvalen dengan closure <code>|| { }</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> my_closure </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello (from main)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">my_closure</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> my_closure </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something_v2</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">my_closure</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_owned</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{message} (from main)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Closure" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUEAAAB8CAIAAAB4/5WhAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF5WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTItMThUMDU6NDQ6MDYrMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyLTEyLTIxVDE1OjE3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CoKXIie087TGzPlz5GDgCdw0EM9UAO0wwTl+Tw6RA5AJSSckf+tTzgnhQmFubwGrDDMxF0pIlDcXhvLOY5LeJ4HN6V5eJ5aeKYHCYIghwmCHKYIAhymCCIBTnMHACubi4IbokRs3HYqLC/HAAXPKPBV1PE5ji8xhwAl22fR0SIUg4fMgeAKamvR/IMZv/1NfjFIyS8qmQe1STKOHzQHACnKEipuEdIFeZXy4Tw96aSSWJioC99rBwA5oOnp0dofdI5HAlvKpnuNDGOwwfJAWBumzl71HnY0kprvjRwgNRvitIQE2M5fIAcAGY/C3vUGdoiDlscpR0mxvjSx8gBYPazsEfdRfHX2kZrHM7sFNAME6M4fDpEDoCkn3o3YY/CkumOfr0vrnIYKpkUJoo5vAbwUAMdaWLbHCaLqQxi6xym6QkUQS+a2CKHCYIghwmCHCYIghwmCIIcJgiCHCYIcpggCHKYIAhymCDIYYIgNov/AX7dqv2FOqtHAAAAAElFTkSuQmCC" width="321" height="124" class="img_ev3q"></p><p>Bisa dilihat, fungsi <code>do_something</code> di atas mengembalikan closure yang menampilkan string <code>hello (from closure)</code>. String tersebut hanya muncul ketika closure dipanggil.</p><p>Sedangkan fungsi <code>do_something</code> sendiri juga menampilkan pesan string lainnya, yaitu <code>hello (from do_something)</code>, yang pesan ini adalah muncul langsung saat pemanggilan fungsi <code>do_something</code>. Berbeda dengan pesan <code>hello (from closure)</code> yang hanya muncul ketika closure dieksekusi.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-praktik-ke-2">◉ Praktik ke-2<a class="hash-link" href="#-praktik-ke-2" title="Direct link to heading">​</a></h3><p>Pada contoh di atas, closure yang dikembalikan fungsi memiliki skema sangat sederhana, tanpa parameter dan argument. Mari coba praktik dengan contoh yang lebih kompleks.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v2</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Fn</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello (from do_something_v2)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">a</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params punctuation" style="color:#393A34">,</span><span class="token closure-params"> b</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params class-name">String</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{b} {a}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> message</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas fungsi <code>do_something_v2</code> mengembalikan closure dengan skema <code>Fn(i32, String) -> String</code>, yang artinya:</p><ul><li>Parameter pertamanya bertipe <code>i32</code></li><li>Parameter keduanya bertipe <code>String</code></li><li>Mengembalikan nilai bertipe <code>String</code></li></ul><p>Di dalam closure tersebut, data parameter digabung menjadi sebuah pesan string yang kemudian dijadikan nilai balik.</p><p>Sekarang jalankan fungsi <code>do_something_v2</code> di atas, kemudian lihat hasilnya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> my_closure </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something_v2</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">my_closure</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_owned</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{message} (from main)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Closure" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUMAAABqCAIAAACphaQaAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTItMThUMDU6NTM6MTcrMDc6MDAiIHhtcDpNb2RpZnlEYXRl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WSa5IMw+W61TAN4qfattueysiOx7Ly+hJznMycQQ1+U9FfzVmkSlJKpLk71OQlI5OtlMjERB3yTgq41mUwuczQEmUwrtouR0K8mkwmCIJMJgiCTCYJMJgiCTCYIgkwmCIJMJggymSAIMpkgCDKZIIgY/gc17m08rSYldAAAAABJRU5ErkJggg==" width="323" height="106" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a487-closure-sebagai-parameter-fungsi">A.48.7. Closure sebagai parameter fungsi<a class="hash-link" href="#a487-closure-sebagai-parameter-fungsi" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-praktik-ke-1-1">◉ Praktik ke-1<a class="hash-link" href="#-praktik-ke-1-1" title="Direct link to heading">​</a></h3><p>Pengaplikasian closure sebagai parameter fungsi banyak dilakukan di Rust, hal ini bisa dilakukan dengan memanfaatkan generic parameter. Silakan perhatikan kode berikut untuk contoh penerapannya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">run_x_times</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">F</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> my_closure</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Fn</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token plain">x </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">my_closure</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">i</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>run_x_times</code> dibuat dengan tugas mengeksekusi closure <code>my_closure</code> sebanyak <code>x</code> kali. Parameter closure harus selalu memiliki tipe data generic, contohnya <code>my_closure</code> di atas yang tipe data-nya adalah <code>F</code>.</p><p>Fungsi yang memiliki parameter closure wajib menggunakan keyword <code>where</code> yang keyword ini digunakan untuk mendaftarkan skema closure yang nantiya bisa diterima saat pemanggilan fungsi. Tipe generic <code>F</code> di daftarkan dengan notasi <code>Fn(i32)</code>, artinya dalam pemanggilan fungsi <code>run_x_times</code>, parameter <code>my_closure</code> harus diisi dengan closure yang skema-nya adalah <code>Fn(i32)</code> yang jika di ilustrasikan dalam bentuk closure adalah <code>|param1: i32| { }</code>.</p><p>Sekarang mari kita test fungsi di atas. Panggil fungsi <code>run_x_times</code> kemudian pada bagian parameter closure isi dengan block closure yang memiliki skema sesuai requirement, contohnya <code>|i: i32| { println!("hello rust {i}") }</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">run_x_times</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">i</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust {i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Closure" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAToAAACTCAYAAAAeJtXOAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABjHSURBVHhe7Z1BkuS4rYZ9khlP+AY+hO/Q4Yi5wpzAURHe+ggVMReohc/QC+96805UTwRBEgRBkJSUqkz1v/iiK0USBEHwF5Upqf/yyy+/fAIAwJ2B0AEAbg+EDgBweyB0AIDbA6EDANweCB0A4PZA6AAAtwdCBwC4PRA6AMDtgdABAG4PhA4AcHuOCd3bx+eP7++f3+jzt8/37z8+P95UnYfy9vnx4+PzzSx7Dd4+fnx+f/9mlu1j/zyc5cv5Y7qedgwh136IfB+zLw6PWEfRZs+XFT9fdW73C92398/vP75/vn9Lx75C6H75/Pb+fSn5csJKPt7c8uGYguCrNtPJEOLY8786kcxyYB48XwI059v4Bj49fjH4c3RG/62NdaHz4hnsS/8Dsb/rhW4474KfTOiswH2N0AXWgh8TtvgZ/Y5iN0iIHiR0YmfJgjBnx4nb1UI3aBtOKt/f37Y68g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bAlewUOvlYk3zAfvx41LrQqUeoJh+dSoJENrltFOhWrOt+1Rh4fNJOxbIwh/FA6AC4kl1ChxdvHtjRWa+eAgA8lMOXrkUYwk7FeKWSWtSekDRl1iuZFt5HV/XN7aaEzrG/T+hYoHkXKPsGADye84ROvhFEclTo9O5nQehsQfKFLpB3gxvaxuEdHfd/zAYAYIWThW4sQMtCp21axwyOCF0hfj8o7RwXOj8GAIDzOfHSNZaNFvCS0DVCM78bGgldLiPh7Pnd9kc+HvqOLY5JxhAA8FhOFLpSni9bs0i1xwlq55UFm1EY2uM+7s5LXmZvovXYF2+2NiFyAFzLotABAMDrAaEDANweCB0A4PZA6AAAtwdCBwC4PRA6AMDtgdABAG7OL5//D8TBcipUeUY5AAAAAElFTkSuQmCC" width="314" height="147" class="img_ev3q"></p><p>O iya, closure di atas juga bisa dituliskan dalam bentuk seperti ini. Bebas, pilih sesuai preferensi dan/atau kesepakatan team perihal code convention.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">run_x_times</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">i</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust {i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-praktik-ke-2-1">◉ Praktik ke-2<a class="hash-link" href="#-praktik-ke-2-1" title="Direct link to heading">​</a></h3><p>Ok, sekarang mari kita coba praktikkan contoh yang lebih kompleks.</p><p>Pada praktik ini kita akan buat sebuah fungsi yang tugasnya melakukan pencarian indeks slice dengan kondisi pencarian didapat dari eksekusi closure.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">find_index</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">F</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token punctuation" style="color:#393A34">[</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> cond_fn</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Fn</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">cond_fn</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">i</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">-</span><span class="token number" style="color:#36acaa">1</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>find_index</code> memiliki 2 parameter generic, yaitu:</p><ul><li><code>T</code> yang digunakan sebagai tipe data element slice <code>data</code>.</li><li><code>F</code> yang digunakan sebagai tipe data closure <code>cond_fn</code> dengan skema <code>Fn(&T) -> bool</code>, yang jika diilustrasikan dalam bentuk closure adalah <code>|param1: &T| -> bool { }</code>.</li></ul><p>Di dalam fungsi tersebut, data slice di-loop, kemudian tiap elemen-nya digunakan sebagai parameter pemanggilan closure <code>cond_fn</code>.</p><p>Jika nilai balik pemanggilan closure adalah <code>true</code> maka <code>i</code> dikembalikan dalam bentuk <code>i32</code> (ada proses casting). Dan jika tidak diketemukan, maka indeks <code>-1</code> dikembalikan.</p><blockquote><p>Keyword <code>as</code> digunakan untuk casting tipe data. Lebih jelasnya dibahas pada chapter <a href="/basic/type-alias-casting">Type Alias & Casting</a> dan <a href="#/wip/trait-conversion-from-into">Trait ➜ Conversion (From & Into)</a></p></blockquote><p>Jalankan program tersebut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">13</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">53</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_to_find </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">53</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> index </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">find_index</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">numbers</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">e</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params operator" style="color:#393A34">&</span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">e </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> number_to_find </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number_to_find: {number_to_find}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"index: {index}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Closure" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUQAAABsCAIAAACdAFx+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvM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WCWGSU7BHzOTLWGmaIowkxRFGHW02bjsXDL0ymKMFMURZgpiiLMFEWYKYq6JpjptU9RhLmB6MpPUdtNszeyzPRKoKg4zIu99rP3LrsDadyt8QqVrzdzOk9RtZZ5ttc+jEMwuUXod6QrYSbLFLUc5phvII5DcDrrZa63H135KWpjmI04BBOQS1nkopmitoMZ89oleF6OIl35KWptmLHXvmF+x7Tass7YACPLFGGuXJ3O9drPtrjB/rWxtx0oEkmmKL7OSVGEmaIowkxRFGGmKIowUxRhpiiKMFMURZgpiiLMFEWYKYoizBRFEWaKoggzRVGD/geWHMKpfLG1lAAAAABJRU5ErkJggg==" width="324" height="108" class="img_ev3q"></p><p>Bisa dilihat program berjalan sesuai harapan.</p><blockquote><p>Keyword <code>Fn</code> merupakan salah satu trait function yang ada di Rust. Lebih jelasnya perihal keyword tersebut dibahas pada chapter selanjutnya, yaitu <a href="/basic/trait-function">Trait ➜ Function</a></p></blockquote><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/closures" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../closures</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/function">Function</a></li><li><a href="/basic/generics">Generics</a></li><li><a href="/basic/borrowing">Borrowing</a></li><li><a href="/basic/trait-function">Trait ➜ Function (Fn, FnMut, FnOnce)</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch13-01-closures.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch13-01-closures.html</a></li><li><a href="https://doc.rust-lang.org/beta/rust-by-example/fn/closures.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/beta/rust-by-example/fn/closures.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/tipe-data-custom-type-string-slice"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.47. Tipe Data ➜ String Custom Type</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/trait-function"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a481-konsep-closures" class="table-of-contents__link toc-highlight">A.48.1. Konsep Closures</a><ul><li><a href="#-formatted-print-n" class="table-of-contents__link toc-highlight">◉ formatted print <code>{:.n}</code></a></li></ul></li><li><a href="#a482-notasi-penulisan-closure" class="table-of-contents__link toc-highlight">A.48.2. Notasi penulisan closure</a></li><li><a href="#a483-mutable-closure" class="table-of-contents__link toc-highlight">A.48.3. Mutable closure</a></li><li><a href="#a484-borrowing-pada-closure" class="table-of-contents__link toc-highlight">A.48.4. Borrowing pada closure</a></li><li><a href="#a485-keyword-move" class="table-of-contents__link toc-highlight">A.48.5. Keyword <code>move</code></a></li><li><a href="#a486-closure-sebagai-return-type" class="table-of-contents__link toc-highlight">A.48.6. Closure sebagai return type</a><ul><li><a href="#-praktik-ke-1" class="table-of-contents__link toc-highlight">◉ Praktik ke-1</a></li><li><a href="#-praktik-ke-2" class="table-of-contents__link toc-highlight">◉ Praktik ke-2</a></li></ul></li><li><a href="#a487-closure-sebagai-parameter-fungsi" class="table-of-contents__link toc-highlight">A.48.7. Closure sebagai parameter fungsi</a><ul><li><a href="#-praktik-ke-1-1" class="table-of-contents__link toc-highlight">◉ Praktik ke-1</a></li><li><a href="#-praktik-ke-2-1" class="table-of-contents__link toc-highlight">◉ Praktik ke-2</a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.48. Closures</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.48. Closures</h1></header><p>Chapter ini membahas tentang closures. Closures sendiri merupakan block fungsi anonimus (anonymous function) yang memiliki kelebihan bisa mengakses item-tem yang posisinya berada di luar block closure tersebut tetapi masih dalam current block scope.</p><p>Topik closures sangat erat hubungannya dengan <a href="/basic/trait-function">Trait ➜ Function</a>, namun pada chapter ini pembahasan hanya difokuskan pada bagian penerapan closures saja. Penulis anjurkan untuk lanjut ke chapter berikutnya setelah selesai dengan chapter ini.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a481-konsep-closures">A.48.1. Konsep Closures<a class="hash-link" href="#a481-konsep-closures" title="Direct link to heading">​</a></h2><p>Cara penerapan closure sangat mirip seperti fungsi, perbedaannya ada pada notasi penulisan-nya. Agar lebih jelas silakan perhatikan program sederhana di bawah ini.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> volume </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">calculate_circle_volume_v1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{volume:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_circle_volume_v1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">e</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">PI</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> volume </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4.0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">/</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">PI</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> e</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">powi</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> volume</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>calculate_circle_volume_v1</code> akan kita refactor ke bentuk closure, hasilnya adalah berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> calculate_circle_volume_v2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">e</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">f64</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">PI</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> volume </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4.0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">/</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">PI</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> e</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">powi</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> volume</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> volume </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">calculate_circle_volume_v2</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:.2}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> volume</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Silakan pelajari perbedaan dan juga kemiripannya.</p><p>Fungsi dideklarasikan menggunakan keyword <code>fn</code> dan memiliki nama. Closure tidak memiliki nama, namun bisa disimpan dalam variabel (yang disimpan adalah block closure-nya, bukan return value-nya). Contohnya variabel <code>calculate_circle_volume_v2</code> di atas.</p><p>Perbedaan minor lainnya ada pada notasi penulisan parameter. Pada fungsi tanda <code>()</code> digunakan sebagai penanda parameter, sedangkan pada closure tanda <code>||</code> digunakan.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-formatted-print-n">◉ formatted print <code>{:.n}</code><a class="hash-link" href="#-formatted-print-n" title="Direct link to heading">​</a></h3><p>Notasi penulisan formatted print <code>{:.n}</code> digunakan untuk mem-format bilangan desimal di mana <code>n</code> adalah jumlah digit setelah tanda <code>.</code>.</p><p>Sebagai contoh, variabel <code>pi</code> berikut memiliki 0 digit angka dibelakang koma. Untuk menampilkan hanya 4 angka terdepan, bisa gunakan <code>{:.4}</code>. Perlu diketahui bahwa angka dibelakang koma yang muncul otomatis dibulatkan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pi </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.1415926535</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:.4}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> pi</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 3.1416</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{pi:.4}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 3.1416</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a482-notasi-penulisan-closure">A.48.2. Notasi penulisan closure<a class="hash-link" href="#a482-notasi-penulisan-closure" title="Direct link to heading">​</a></h2><p>Closure <code>calculate_circle_volume_v2</code> pada contoh di atas adalah salah satu contoh penulisan closure. Sebuah closure bisa memiliki parameter, bisa juga tidak, dan aturan tersebut juga berlaku pada return value.</p><p>Bebebrapa contoh lain penulisan closure bisa dilihat di bawah ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// closure dengan 2 parameter tanpa return value</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> do_something_v1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params"> a</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params punctuation" style="color:#393A34">,</span><span class="token closure-params"> b</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params class-name">String</span><span class="token closure-params"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// closure dengan 2 parameter dan return value bertipe tuple</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> do_something_v2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params"> a</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params punctuation" style="color:#393A34">,</span><span class="token closure-params"> b</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params class-name">String</span><span class="token closure-params"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// closure tanpa parameter dan return value bertipe Vec<String></span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> do_something_v3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// closure tanpa parameter dan tanpa return value</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> do_something_v4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jika tipe return value tidak dideklarasikan secara eksplist, maka Rust menganggap tipe return value adalah sesuai dengan tipe data pada statement terakhir.</p><p>Untuk closure yang isinya hanya 1 baris statement, boleh tidak dituliskan block kurung kurawal-nya (<code>{}</code>).</p><p>Tambahan contoh, satu fungsi dan tiga buah closures berikut adalah ekuivalen.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">pow_v1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pow_v2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pow_v3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pow_v4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ok, sekarang bagaimana dengan closure yang tidak memiliki parameter dengan isi hanya return value saja? Penulisannya seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> get_pi </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">get_pi</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a483-mutable-closure">A.48.3. Mutable closure<a class="hash-link" href="#a483-mutable-closure" title="Direct link to heading">​</a></h2><p>Tidak ada yang spesial mengenai cara mengakses item yang berada di luar block closure. Caranya cukup dengan panggil saja item seperti biasanya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> num </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> display </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{num}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{num}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 5</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">display</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 5</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Beda lagi jika data di luar block closure adalah diubah (di-mutate) nilainya dari dalam closure, jika seperti itu maka ada beberapa hal yang perlu diperhatikan.</p><p>Sebagai contoh, pelajari kode berikut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> num </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> increase_by </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">increase_by</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{num}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 15</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="Closure" src="/assets/images/closures-1-2c7599bfed946d5bd1fb34a57acd9de7.png" width="765" height="176" class="img_CujE"></p><p>Solusi untuk menghilangkan error di atas adalah dengan menambahkan keyword <code>mut</code> pada variabel closure <code>increase_by</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// before</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> increase_by </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// after</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> increase_by </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Keyword <code>mut</code> wajib ditambahkan ke variabel penampung closure ketika di dalamnya terdapat operasi perubahan data terhadap variabel yang posisinya di-luar closure. Contohnya bisa dilihat di atas, variabel <code>num</code> nilainya di-mutate atau diubah dari dalam closure, karena inilah variabel <code>increase_by</code> harus didefinisikan mutable.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a484-borrowing-pada-closure">A.48.4. Borrowing pada closure<a class="hash-link" href="#a484-borrowing-pada-closure" title="Direct link to heading">​</a></h2><p><strong>Semua variabel di luar block closure ketika digunakan di dalam closure maka terjadi operasi borrowing pada variabel tersebut</strong>. Variabel di luar block closure dipinjam agar bisa digunakan di dalam closure.</p><p>Sebagai contoh, kode sederhana berikut menghasilkan error, karena variabel <code>num</code> adalah dipinjam oleh closure <code>increase_by</code> untuk dipergunakan di dalam block-nya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> num </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> increase_by </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">increase_by</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{num}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 20</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Closure" src="/assets/images/closures-2-35b45e21715884c98b155c79b2d8f1c4.png" width="525" height="222" class="img_CujE"></p><p>Error muncul di statement setelahnya, yaitu <code>num += 5</code> karena <code>num</code> statusnya masih dipinjam oleh closure <code>increase_by</code>.</p><p>Variabel <code>num</code> dipinjam dengan mode peminjaman adalah <em>mutable borrow</em> karena closure didefinisikan mutable. Salah satu aturan pada borrowing: bahwa dalam waktu yang sama, ketika sudah terjadi mutable borrow, maka tidak boleh ada borrowing lainnya. Itulah alasan kenapa statement <code>num += 5</code> menghasilkan error.</p><p>Solusi dari masalah di atas ada beberapa, yang pertama adalah menggunakan block expression untuk meng-isolasi closure, agar peminjaman pada closure tersebut dan statement <code>num += 5</code> tidak terjadi dalam waktu yang sama.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> num </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> increase_by </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">increase_by</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{num}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 20</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Solusi di atas efektif untuk menghilangkan error borrowing yang sebelumnya muncul, tapi setelah d-refactor kode menjadi tidak sesuai spesifikasi awal. Pada kode yang baru di atas, deklarasi closure <code>increase_by</code> terjadi di dalam block expression, artinya closure ini hanya akan bisa digunakan pada block kode tersebut saja, tidak bisa di-reuse di luar block.</p><p>Solusi yang lebih baik pada kasus di atas adalah dengan tidak menggunakan default borrowing (yang terjadi di dalam block closure ketika mengakses variabel yang posisinya berada di luar closure), melainkan gunakan saja borrowing pada parameter closure. Kita ubah lagi kodenya menjadi seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> num </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> increase_by </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">num</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params operator" style="color:#393A34">&</span><span class="token closure-params keyword" style="color:#00009f">mut</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params punctuation" style="color:#393A34">,</span><span class="token closure-params"> x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">increase_by</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> num</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{num}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 20</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, closure <code>increase_by</code> ditambahi parameter baru. Sekarang ada 2 parameter, yaitu <code>num</code> yang tipe-nya adalah pointer <code>&mut i32</code> dan parameter <code>x</code>. Di dalam block closure, <code>num</code> di-dereference (menggunakan operator <code>*</code>) kemudian diubah nilainya. Setelah eksekusi statement selesai, data pinjaman tersebut langsung dikembalikan ke pemilik. Inilah kenapa kode di atas tidak menghasilkan error.</p><blockquote><p>Pengaksesan variabel yang berada di luar scope closure tanpa via parameter berarti adalah borrowing, maka dalam penerapannya wajib untuk memperhatikan aturan yang berlaku pada ownership dan borrowing.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a485-keyword-move">A.48.5. Keyword <code>move</code><a class="hash-link" href="#a485-keyword-move" title="Direct link to heading">​</a></h2><p>Telah dijelaskan di atas bahwa variabel di luar closure, jika diakses dari dalam closure maka terjadi borrowing. Ada cara agar variabel tersebut ownership-nya berpindah ke dalam closure (<em>move semantics</em>), yaitu menggunakan keyword <code>move</code>.</p><p>Contohnya bisa dilihat berikut ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> num </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> increase_by </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">move</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> num </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{num} (from closure)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 15</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">increase_by</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{num}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 5</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Closure <code>increase_by</code> di atas memiliki keyword <code>move</code> dalam pendefinisiannya. Dengan ini maka semua variabel di luar scope closure jika diakses dari dalam closure, maka variabel tersebut berpindah owner-nya (<em>move semantics</em>).</p><p>Lalu bagaimana dengan nasib variabel <code>num</code> yang berada di luar closure setelah owner-nya berpindah? Pada kondisi normal jawaban pertanyaan ini adalah tergantung tipe data-nya, jika <em>by default</em> variabel adalah mengadopsi <em>move semantics</em> maka variabel tersebut menjadi invalid. Namun pada contoh di atas <code>num</code> bertipe data <code>i32</code> yang mengadopsi <em>copy semantics</em>, maka variabel <code>num</code> tersebut masih bisa digunakan di luar closure.</p><p><img loading="lazy" alt="Closure" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUQAAABpCAIAAADNzc3NAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAy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QTITBEEyO/H2979/78/RlQbRjXnx/P6vqfbv2xqSP3d7nYoJkrmlXcC4ng9OUlwyACqvOKkvLVqpeiAMgliCzBXp3uX8O0/HktmIZu+KZNpA/amZQhBzk/ntbzXpnseQGc7cRDHXqTqd397rbfGmkIuV+l6l+vf+1vx9zlkVqTWfkBmmC02QOrXI1/1QGh9kjxaOtdcy4nb3zGPIHHE5MtG7id6Qqfp/XZ2stsp3vlulk3/1tlwS4buSTagizDiVzFHjn8V6ldomZDOxGTK7d8zKrEWaua+iyhSn6S62VBF/CzenolmooreQ1h4yR42PDrqSZtLSJjZB5uiOyWfloEsxs3M6vYjM1hlbTGbFBO+M71Bva2Z2KhgBqmZi22TOTsoCzQzIHCm3cs3sJXNS0Ru214vInFnkqJmJLZE5q5i1Weshs7Be2yYUkNlqneQaqggLILhba22NzBnRUDETS5M5MRbbc6mC9z2gtesi80EcMtfJS8h8AG1NehQb1OLUChwNdJfr03SVzHEJIgG5TKylmceBb0nQxiZ2QmbSmcIgdkNmKiMhCBrYxFWTmSAIkpkgCJKZIEhmgiBIZoIgtkjm4jgEBEFslsx8okQQJDNBECQzQRAz7pm5YyaI6yVzzGvymSCun8z02yOIfZCZipkgrpnMhXEICIK4CjObIAiSmSAIkpkgCJKZIEhmgiBIZoIgSGaCIEhmgiCZCYIgmQmCIJkJgpgM/wO2kS/cvrb36AAAAABJRU5ErkJggg==" width="324" height="105" class="img_CujE"></p><p>Bisa dilihat dari gambar di atas, statement <code>print</code> dari dalam block closure hasilnya adalah benar, yaitu <code>5 + 10 = 15</code>. Dan variabel <code>num</code> di luar block closure tidak berubah nilainya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a486-closure-sebagai-return-type">A.48.6. Closure sebagai return type<a class="hash-link" href="#a486-closure-sebagai-return-type" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-praktik-ke-1">◉ Praktik ke-1<a class="hash-link" href="#-praktik-ke-1" title="Direct link to heading">​</a></h3><p>Fungsi bisa memiliki nilai balik bertipe closure. Caranya dengan menggunakan <code>impl Fn()</code> sebagai tipe data nilai balik. Contoh penerapannya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Fn</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello (from do_something)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello (from closure)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Tipe <code>impl Fn()</code> adalah ekuvalen dengan closure <code>|| { }</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> my_closure </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello (from main)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">my_closure</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> my_closure </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something_v2</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">my_closure</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_owned</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{message} (from main)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Closure" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUEAAAB8CAIAAAB4/5WhAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF5WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZ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YIAhymCDIYYIgNov/AX7dqv2FOqtHAAAAAElFTkSuQmCC" width="321" height="124" class="img_CujE"></p><p>Bisa dilihat, fungsi <code>do_something</code> di atas mengembalikan closure yang menampilkan string <code>hello (from closure)</code>. String tersebut hanya muncul ketika closure dipanggil.</p><p>Sedangkan fungsi <code>do_something</code> sendiri juga menampilkan pesan string lainnya, yaitu <code>hello (from do_something)</code>, yang pesan ini adalah muncul langsung saat pemanggilan fungsi <code>do_something</code>. Berbeda dengan pesan <code>hello (from closure)</code> yang hanya muncul ketika closure dieksekusi.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-praktik-ke-2">◉ Praktik ke-2<a class="hash-link" href="#-praktik-ke-2" title="Direct link to heading">​</a></h3><p>Pada contoh di atas, closure yang dikembalikan fungsi memiliki skema sangat sederhana, tanpa parameter dan argument. Mari coba praktik dengan contoh yang lebih kompleks.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v2</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Fn</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello (from do_something_v2)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">a</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params punctuation" style="color:#393A34">,</span><span class="token closure-params"> b</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params class-name">String</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{b} {a}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> message</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas fungsi <code>do_something_v2</code> mengembalikan closure dengan skema <code>Fn(i32, String) -> String</code>, yang artinya:</p><ul><li>Parameter pertamanya bertipe <code>i32</code></li><li>Parameter keduanya bertipe <code>String</code></li><li>Mengembalikan nilai bertipe <code>String</code></li></ul><p>Di dalam closure tersebut, data parameter digabung menjadi sebuah pesan string yang kemudian dijadikan nilai balik.</p><p>Sekarang jalankan fungsi <code>do_something_v2</code> di atas, kemudian lihat hasilnya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> my_closure </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something_v2</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">my_closure</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_owned</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{message} (from main)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Closure" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUMAAABqCAIAAACphaQaAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+I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wUIkyGHcWZXN4/9uUrhBe3x1GRDCWLXqcxudJoNhx+Ob0VN9+aGmiSd81keKgr3MGe8+J0KjMD7jxDuxdiMuqogslJ7deX4mFLQPh87PlGFhMJnpzLM219t8Wn3JZNDpjly8EcPvf+XXX3QazG5D2Arxgsrd3CiM+mbLrWZDK5vBZy78Z/KshJI5MPur0L93KW98w3G8DrTCPie9dkMkEQZDJBkMkEQZDJBEHslcm7yTRw1dg6TUJMxIgsPMe6ASYbFTZ8QaDmzFusZhS7mR7shsa0gzQJ8zGZz5bI5J0zuSHXKVumVgx9eFHvIk3CdpsjsS8mb5ZpAOUPiLxACt9XNOzgy6sIPgZEf6lf0lulSYhkL8jipIM5CY6wE90ukzfMNKDlD5BM1lZXlQGpY3I9kddLk6CU/Hp6TWO4a3MSkMoH8a7XzzQA8gcYTFbCH6czOXeu46d426VJCJQcEf9IB/tYTF4x0wBaMeoiK8P6Z2Ky7ja4N8rbpUnQShZzN5bJNMqHYfJKmQaqmAwt3EQmm8G37oLeLk2CmlGosP20yTftXa+XaUBj8pBMB/i4WZtVT02KwjaNIw+TNkuToDM5Ox8cyWSa5IMw+W61TAN4qfattueysiOx7Ly+hJznMycQQ1+U9FfzVmkSlJKpLk71OQlI5OtlMjERB3yTgq41mUwuczQEmUwrtouR0K8mkwmCIJMJgiCTCYJMJgiCTCYIgkwmCIJMJggymSAIMpkgCDKZIIgY/gc17m08rSYldAAAAABJRU5ErkJggg==" width="323" height="106" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a487-closure-sebagai-parameter-fungsi">A.48.7. Closure sebagai parameter fungsi<a class="hash-link" href="#a487-closure-sebagai-parameter-fungsi" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-praktik-ke-1-1">◉ Praktik ke-1<a class="hash-link" href="#-praktik-ke-1-1" title="Direct link to heading">​</a></h3><p>Pengaplikasian closure sebagai parameter fungsi banyak dilakukan di Rust, hal ini bisa dilakukan dengan memanfaatkan generic parameter. Silakan perhatikan kode berikut untuk contoh penerapannya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">run_x_times</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">F</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> my_closure</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Fn</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token plain">x </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">my_closure</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">i</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>run_x_times</code> dibuat dengan tugas mengeksekusi closure <code>my_closure</code> sebanyak <code>x</code> kali. Parameter closure harus selalu memiliki tipe data generic, contohnya <code>my_closure</code> di atas yang tipe data-nya adalah <code>F</code>.</p><p>Fungsi yang memiliki parameter closure wajib menggunakan keyword <code>where</code> yang keyword ini digunakan untuk mendaftarkan skema closure yang nantiya bisa diterima saat pemanggilan fungsi. Tipe generic <code>F</code> di daftarkan dengan notasi <code>Fn(i32)</code>, artinya dalam pemanggilan fungsi <code>run_x_times</code>, parameter <code>my_closure</code> harus diisi dengan closure yang skema-nya adalah <code>Fn(i32)</code> yang jika di ilustrasikan dalam bentuk closure adalah <code>|param1: i32| { }</code>.</p><p>Sekarang mari kita test fungsi di atas. Panggil fungsi <code>run_x_times</code> kemudian pada bagian parameter closure isi dengan block closure yang memiliki skema sesuai requirement, contohnya <code>|i: i32| { println!("hello rust {i}") }</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">run_x_times</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">i</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust {i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div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ZHwQPgMtYFDoAAHg9IHQAgNsDoQMA3B4IHQDg9kDoAAC3B0IHALg9EDoAwO1ZFLp4T5i8j24Wut8u3UOm7j3zygAA4CiXCV2ivsF4vuxZ2PUImHoO+Ej8AADrQOgWWRe6ELP0WqsNeuRMfAYAPJydQicfy5IP2Mdy7zJ0XejUI2CTj04lQSKb3DYKdCvWdb9qDDw+aadiWZjjeLCrA+A6dgkdXry5eOlaAaED4GoOX7oWYQgL2HilktqBeULSlFmvZFp4H13VN7ebEjrH/lGha/wCADyc84ROfeGeOSp0WhQWhM4WJF/oAiRG7L+2cUToRiIKAHgMJwvdeBEvC522aR0zOCJ0hXiZKe3sFboocvgRAoCv4MRL11jWE7HEktA1QhP7mBGakdDlMhLOnt9tf+Tj4qUnRA6Ar+VEoSvl+bI1i1R7nKB2XlmwGcWuPe7j7rzkZfYmWo998abyP4Hv6QC4jEWhAwCA1wNCBwC4PRA6AMDtgdABAG4PhA4AcHsgdACA2wOhAwDcnkWhi/eQyfvoZok3zfI9ZOreM68MAACOcpnQJeobjOfLnoU9j4CFNlnIN47EDwCwDoRukb3PumboqQw8DgbAlewUOvlYk3zAfvx41LrQqUeoJh+dSoJENrltFOhWrOt+1Rh4fNJOxbIwh/FA6AC4kl1ChxdvHtjRWa+eAgA8lMOXrkUYwk7FeKWSWtSekDRl1iuZFt5HV/XN7aaEzrG/T+hYoHkXKPsGADye84ROvhFEclTo9O5nQehsQfKFLpB3gxvaxuEdHfd/zAYAYIWThW4sQMtCp21axwyOCF0hfj8o7RwXOj8GAIDzOfHSNZaNFvCS0DVCM78bGgldLiPh7Pnd9kc+HvqOLY5JxhAA8FhOFLpSni9bs0i1xwlq55UFm1EY2uM+7s5LXmZvovXYF2+2NiFyAFzLotABAMDrAaEDANweCB0A4PZA6AAAtwdCBwC4PRA6AMDtgdABAG7OL5//D8TBcipUeUY5AAAAAElFTkSuQmCC" width="314" height="147" class="img_CujE"></p><p>O iya, closure di atas juga bisa dituliskan dalam bentuk seperti ini. Bebas, pilih sesuai preferensi dan/atau kesepakatan team perihal code convention.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">run_x_times</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">i</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust {i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-praktik-ke-2-1">◉ Praktik ke-2<a class="hash-link" href="#-praktik-ke-2-1" title="Direct link to heading">​</a></h3><p>Ok, sekarang mari kita coba praktikkan contoh yang lebih kompleks.</p><p>Pada praktik ini kita akan buat sebuah fungsi yang tugasnya melakukan pencarian indeks slice dengan kondisi pencarian didapat dari eksekusi closure.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">find_index</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">F</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token punctuation" style="color:#393A34">[</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> cond_fn</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Fn</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">cond_fn</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">i</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">-</span><span class="token number" style="color:#36acaa">1</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>find_index</code> memiliki 2 parameter generic, yaitu:</p><ul><li><code>T</code> yang digunakan sebagai tipe data element slice <code>data</code>.</li><li><code>F</code> yang digunakan sebagai tipe data closure <code>cond_fn</code> dengan skema <code>Fn(&T) -> bool</code>, yang jika diilustrasikan dalam bentuk closure adalah <code>|param1: &T| -> bool { }</code>.</li></ul><p>Di dalam fungsi tersebut, data slice di-loop, kemudian tiap elemen-nya digunakan sebagai parameter pemanggilan closure <code>cond_fn</code>.</p><p>Jika nilai balik pemanggilan closure adalah <code>true</code> maka <code>i</code> dikembalikan dalam bentuk <code>i32</code> (ada proses casting). Dan jika tidak diketemukan, maka indeks <code>-1</code> dikembalikan.</p><blockquote><p>Keyword <code>as</code> digunakan untuk casting tipe data. Lebih jelasnya dibahas pada chapter <a href="/basic/type-alias-casting">Type Alias & Casting</a> dan <a href="#/wip/trait-conversion-from-into">Trait ➜ Conversion (From & Into)</a></p></blockquote><p>Jalankan program tersebut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">13</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">53</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_to_find </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">53</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> index </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">find_index</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">numbers</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">e</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params operator" style="color:#393A34">&</span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">e </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> number_to_find </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number_to_find: {number_to_find}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"index: {index}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Closure" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUQAAABsCAIAAACdAFx+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL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YmDzPX84Zv97w7Us6dhNi/MhFmoSSgX2+lN4T5HbzhL7qchPnKlU6zNyQZTLP3S8i5lHNObc65WoSZomiZKYoizBRFEWaKoggzRRFmiqIIM0VRhJmiKMJMUYSZoijCTFHUFcD87eXP6+/nXTbA8+/XQX9evolD46fYNWqSUxRhXp+iI7dZwbaA+dgiQn0ZphvL617vfRRh3inMK5VrHszeKceC0dhTTWDux95oOXoAEhSGD29Jfr90VufPy/Pw9/SlOj21T6djPRjjFxZqyrKJpMK8FXHIDPN02ekwrLsugsiqS1m6RRRg5sydagnzOGJHq2HA/Kr+/klPnwgSKE2WaICmO160T9mQl2d0mRpQ2feC3GDDuif3gbQYa8BMlqmmMGtuLZi7USj/ajo6Dro/YsiLE6ZxXJoG6zGvLG1xFg2XzAhmXc2sQovWzPrGwTUzdS4wd5+AcUxOnLVYVZ93DLPmWpeCi2bqXCzz20LaIG0pzMranwHMuCV2/DSPulCYxTr4NQZzsuSGz4XiYGT2S07SA8ZtNszizGQ/ILxmLhjm8n2IotaEWSzx+q1rF2a08QuOV1q5fD9c7GYXadDIZFN/awIi8/n9nO5mRWCWGSU7BHzOTLWGmaIowkxRFGHW02bjsXDL0ymKMFMURZgpiiLMFEWYKYq6JpjptU9RhLmB6MpPUdtNszeyzPRKoKg4zIu99rP3LrsDadyt8QqVrzdzOk9RtZZ5ttc+jEMwuUXod6QrYSbLFLUc5phvII5DcDrrZa63H135KWpjmI04BBOQS1nkopmitoMZ89oleF6OIl35KWptmLHXvmF+x7Tass7YACPLFGGuXJ3O9drPtrjB/rWxtx0oEkmmKL7OSVGEmaIowkxRFGGmKIowUxRhpiiKMFMURZgpiiLMFEWYKYoizBRFEWaKoggzRVGD/geWHMKpfLG1lAAAAABJRU5ErkJggg==" width="324" height="108" class="img_CujE"></p><p>Bisa dilihat program berjalan sesuai harapan.</p><blockquote><p>Keyword <code>Fn</code> merupakan salah satu trait function yang ada di Rust. Lebih jelasnya perihal keyword tersebut dibahas pada chapter selanjutnya, yaitu <a href="/basic/trait-function">Trait ➜ Function</a></p></blockquote><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/closures" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../closures</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/function">Function</a></li><li><a href="/basic/generics">Generics</a></li><li><a href="/basic/borrowing">Borrowing</a></li><li><a href="/basic/trait-function">Trait ➜ Function (Fn, FnMut, FnOnce)</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch13-01-closures.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch13-01-closures.html</a></li><li><a href="https://doc.rust-lang.org/beta/rust-by-example/fn/closures.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/beta/rust-by-example/fn/closures.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/tipe-data-custom-type-string-slice"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.47. Tipe Data ➜ String Custom Type</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/trait-function"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a481-konsep-closures" class="table-of-contents__link toc-highlight">A.48.1. Konsep Closures</a><ul><li><a href="#-formatted-print-n" class="table-of-contents__link toc-highlight">◉ formatted print <code>{:.n}</code></a></li></ul></li><li><a href="#a482-notasi-penulisan-closure" class="table-of-contents__link toc-highlight">A.48.2. Notasi penulisan closure</a></li><li><a href="#a483-mutable-closure" class="table-of-contents__link toc-highlight">A.48.3. Mutable closure</a></li><li><a href="#a484-borrowing-pada-closure" class="table-of-contents__link toc-highlight">A.48.4. Borrowing pada closure</a></li><li><a href="#a485-keyword-move" class="table-of-contents__link toc-highlight">A.48.5. Keyword <code>move</code></a></li><li><a href="#a486-closure-sebagai-return-type" class="table-of-contents__link toc-highlight">A.48.6. Closure sebagai return type</a><ul><li><a href="#-praktik-ke-1" class="table-of-contents__link toc-highlight">◉ Praktik ke-1</a></li><li><a href="#-praktik-ke-2" class="table-of-contents__link toc-highlight">◉ Praktik ke-2</a></li></ul></li><li><a href="#a487-closure-sebagai-parameter-fungsi" class="table-of-contents__link toc-highlight">A.48.7. Closure sebagai parameter fungsi</a><ul><li><a href="#-praktik-ke-1-1" class="table-of-contents__link toc-highlight">◉ Praktik ke-1</a></li><li><a href="#-praktik-ke-2-1" class="table-of-contents__link toc-highlight">◉ Praktik ke-2</a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/datetime.html b/basic/datetime.html index 3278cd96..9e5127a4 100644 --- a/basic/datetime.html +++ b/basic/datetime.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/datetime/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/datetime/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.52. Date Time","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/datetime/#webpage"},"wordCount":908,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/datetime/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/datetime/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/datetime","name":"A.52. Date Time","description":"Pada chapter ini kita akan mempelajari tentang tipe data datetime yang ada di Rust programming.","datePublished":"2024-08-01T10:17:28.659Z","dateModified":"2024-08-01T10:17:28.659Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/datetime/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/datetime"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/datetime/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.52. Date Time","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/datetime/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/datetime/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.52. Date Time","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/datetime/#webpage"},"wordCount":908,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/datetime/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/datetime/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/datetime","name":"A.52. Date Time","description":"Pada chapter ini kita akan mempelajari tentang tipe data datetime yang ada di Rust programming.","datePublished":"2024-08-30T07:44:48.749Z","dateModified":"2024-08-30T07:44:48.749Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/datetime/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/datetime"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/datetime/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.52. Date Time","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.52. Date Time</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.52. Date Time</h1></header><p>Pada chapter ini kita akan mempelajari tentang tipe data datetime yang ada di Rust programming.</p><p>Rust menyediakan cukup banyak API untuk keperluan pengolahan datetime, tersedia dalam Standard Library crate. Namun pada chapter ini kita tidak akan menggunakannya, karena yang akan dipakai adalah <a href="https://crates.io/crates/chrono" target="_blank" rel="noopener noreferrer"><code>chrono</code> crate</a> (dianjurkan untuk menggunakan crate ini karena fiturnya lebih banyak).</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a521-persiapan">A.52.1. Persiapan<a class="hash-link" href="#a521-persiapan" title="Direct link to heading">​</a></h2><p>Sebelum memulai pembelajaran, siapkan satu project baru, kemudian tambahkan care <code>crono</code> dalam <code>Cargo.toml</code>.</p><div class="language-toml codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-toml codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">[</span><span class="token table class-name">package</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">name</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"time_chrono"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">version</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.1.0"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">edition</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"2021"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">[</span><span class="token table class-name">dependencies</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">chrono</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.4.23"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a522-tipe-data-datetime">A.52.2. Tipe data <code>DateTime</code><a class="hash-link" href="#a522-tipe-data-datetime" title="Direct link to heading">​</a></h2><p><code>crono</code> menyediakan cukup banyak tipe data untuk merepresentasikan informasi tanggal dan waktu, tetapi yang paling penting untuk diketahui dan dipahami ada dua, yaitu:</p><ul><li><code>DateTime<Utc></code> dan <code>DateTime<Local></code></li><li><code>NaiveDateTime</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-tipe-datetimeutc">◉ Tipe <code>DateTime<Utc></code><a class="hash-link" href="#-tipe-datetimeutc" title="Direct link to heading">​</a></h3><p><code>DateTime<Utc></code> (gabungan dari tipe data <code>chrono::datetime::DateTime</code> dan generic <code>chrono::offset::utc::Utc</code>) adalah representasi untuk tipe data datetime dengan timezone offset <strong>UTC</strong> (atau <strong>GMT+0</strong>).</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-tipe-datetimelocal">◉ Tipe <code>DateTime<Local></code><a class="hash-link" href="#-tipe-datetimelocal" title="Direct link to heading">​</a></h3><p><code>DateTime<Local></code> (gabungan dari tipe data <code>chrono::datetime::DateTime</code> dan generic <code>chrono::offset::local::Local</code>) adalah representasi untuk tipe data datetime dengan <strong>timezone offset sesuai dengan di mana program dijalankan</strong>.</p><p>Sebagai contoh, penulis berlokasi di Jawa Timur, maka ketika ada suatu data bertipe <code>DateTime<Local></code> artinya timezone offset-nya adalah WIB (atau GMT+7).</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-tipe-naivedatetime">◉ Tipe <code>NaiveDateTime</code><a class="hash-link" href="#-tipe-naivedatetime" title="Direct link to heading">​</a></h3><p>Tipe <code>chrono::naive::datetime::NaiveDateTime</code> merupakan tipe data datetime yang tidak menyimpan informasi timezone. Nanti akan kita bahas apa kegunaan dari tipe ini.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a523-pembuatan-objek-datetime">A.52.3. Pembuatan objek <code>DateTime</code><a class="hash-link" href="#a523-pembuatan-objek-datetime" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-via-utcnow">◉ Via <code>Utc::now()</code><a class="hash-link" href="#-via-utcnow" title="Direct link to heading">​</a></h3><p>Ada banyak cara untuk membuat date time, dan kita akan bahas satu-per-satu.</p><p>Cara yang pertama, mari kita pelajari sambil praktek. Isi file program <code>main.rs</code> dengan kode berikut, lalu jalankan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">chrono</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">prelude</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token operator" style="color:#393A34">*</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">time</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">Duration</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sample_date1_in_utc</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Utc</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Utc</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">now</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 1 (in utc): {sample_date1_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="DateTime" src="/assets/images/datetime-1-c0119211ce2f1f5f14eaf24316a52b54.png" width="571" height="95" class="img_ev3q"></p><p>Contoh sederhana di atas adalah salah satu cara membuat object datetime dengan isi adalah informasi waktu sekarang (waktu ketika baris kode tersebut dieksekusi).</p><p>Statement <code>Utc::now()</code> mengembalikan informasi waktu sekarang dalam timezone UTC (representasi tipe data-nya adalah <code>DateTime<Utc></code>).</p><p>Module item <code>Utc</code> sendiri harus diimport terlebih dahulu agar bisa digunakan. Itulah kenapa ada statement <code>use chrono::prelude::*</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-via-utcwith_ymd_and_hms">◉ Via <code>Utc.with_ymd_and_hms()</code><a class="hash-link" href="#-via-utcwith_ymd_and_hms" title="Direct link to heading">​</a></h3><p>Pembuatan object datetime dengan isi informasi waktu spesifik bisa dilakukan menggunakan <code>Utc.with_ymd_and_hms()</code>. Fungsi ini mewajibkan developer untuk mengisi 6 parameternya dengan segment waktu (tahun, bulan, dan lainnya).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sample_date2_in_utc </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Utc</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">with_ymd_and_hms</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2023</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 2 (in utc): {sample_date2_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: sample date 2 (in utc): 2023-03-01 01:02:03 UTC</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Statement di atas menghasilkan data datetime dengan isi <code>2023-03-01 01:02:03 UTC</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-via-datetimeutcfrom">◉ Via <code>DateTime::<Utc>::from()</code><a class="hash-link" href="#-via-datetimeutcfrom" title="Direct link to heading">​</a></h3><p>Cara ini pas digunakan pada situasi di mana kita perlu membuat object datetime dari sebuah <a href="https://en.wikipedia.org/wiki/Unix_time" target="_blank" rel="noopener noreferrer">UNIX timestamp</a>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sample_date3_in_utc </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Utc</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Duration</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_secs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1524885322</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 3 (in utc): {sample_date3_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: sample date 3 (in utc): 2018-04-28 03:15:22 UTC</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Statement <code>DateTime::<Utc>::from()</code> di atas menghasilkan data datetime <code>2018-04-28 03:15:22 UTC</code>, karena nilai <code>1524885322</code> adalah representasi UNIX time untuk waktu tersebut.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-via-string-method-parse">◉ Via String method <code>parse()</code><a class="hash-link" href="#-via-string-method-parse" title="Direct link to heading">​</a></h3><p>Tipe data string bisa langsung dikonversi ke bentuk datetime menggunakan method <code>parse()</code> yang dikombinasikan dengan <code>DateTime<Utc></code> sebagai generic parameter.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sample_date4_in_utc </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"2023-03-01 01:02:03 UTC"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">DateTime</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Utc</span><span class="token operator" style="color:#393A34">>></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 4 (in utc): {sample_date4_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: sample date 4 (in utc): 2023-03-01 01:02:03 UTC</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Statement parsing di atas menghasilkan data datetime <code>2023-03-01 01:02:03 UTC</code>, sesuai dengan isi data string.</p><p>O iya, perlu diketahui bahwa tidak semua string bisa di-parse ke bentuk <code>DateTime</code>. Jika data string memiliki format yang tidak sesuai dengan aturan parsing di Rust, maka proses parsing menggunakan method <code>parse()</code> pasti menghasilkan error.</p><p>Penerapan method <code>parse::<DateTime<Utc>>()</code> sebenarnya mengembalikan tipe data <code>Result<DateTime<Utc>, ParseError></code>, itulah kenapa pada contoh perlu di chain lagi dengan method <code>unwrap</code>.</p><blockquote><p>Lebih detailnya mengenai tipe data <code>Result</code> dibahas pada chapter <a href="/basic/result-type">Tipe Data ➜ Result</a></p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-cara-lainnya">◉ Cara lainnya<a class="hash-link" href="#-cara-lainnya" title="Direct link to heading">​</a></h3><p>Ada beberapa cara lain yang bisa digunakan untuk pembuatan object datetime, dan kita akan bahas juga sebentar lagi.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a524-utc-vs-local">A.52.4. <code>Utc</code> vs <code>Local</code><a class="hash-link" href="#a524-utc-vs-local" title="Direct link to heading">​</a></h2><p>Kesemua cara yang sudah dipelajari di atas juga bisa diterapkan dalam pembuatan object date time dengan timezone offset <code>Local</code>. Penerapannya kurang lebih sama, cukup ganti <code>Utc</code> menjadi <code>Local</code>.</p><p>Jika disandingkan, akan seperti ini kodenya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date1_in_utc</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Utc</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Utc</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">now</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date2_in_utc </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Utc</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">with_ymd_and_hms</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2023</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date3_in_utc </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Utc</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Duration</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_secs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1524885322</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date4_in_utc </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"2023-03-01 01:02:03 UTC"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">DateTime</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Utc</span><span class="token operator" style="color:#393A34">>></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 1 (in utc): {date1_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 2 (in utc): {date2_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 3 (in utc): {date3_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 4 (in utc): {date4_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// vs</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date1_in_local_tz</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Local</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Local</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">now</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date2_in_local_tz </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Local</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">with_ymd_and_hms</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2023</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date3_in_local_tz </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Local</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Duration</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_secs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1524885322</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date4_in_local_tz </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"2023-03-01 01:02:03 UTC"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">DateTime</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Local</span><span class="token operator" style="color:#393A34">>></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 1 (in local_tz): {date1_in_local_tz}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 2 (in local_tz): {date2_in_local_tz}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 3 (in local_tz): {date3_in_local_tz}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 4 (in local_tz): {date4_in_local_tz}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="DateTime" src="/assets/images/datetime-2-998514b9bc7ad92870392305578f2a14.png" width="571" height="231" class="img_ev3q"></p><p>Semoga cukup jelas.</p><p>Dari contoh di atas, sebenarnya ada 2 variabel yang menarik untuk dibahas, yaitu <code>sample_date1_in_utc</code> dan <code>sample_date1_in_local_tz</code>. Dua variabel tersebut berisi informasi waktu sekarang, perbedaannya hanya pada timezone offset saja. Namun, meski timezone offset-nya berbeda, kedua datetime tersebut sejatinya adalah merepresentasikan waktu yang sama (ekuivalen).</p><p>Agar lebih jelas, silakan perhatikan contoh berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">sample </span><span class="token function" style="color:#d73a49">date</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">in utc</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain">: </span><span class="token number" style="color:#36acaa">2023</span><span class="token plain">-03-02 09:53:44.561519500 UTC</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">sample </span><span class="token function" style="color:#d73a49">date</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">in local_tz</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain">: </span><span class="token number" style="color:#36acaa">2023</span><span class="token plain">-03-02 </span><span class="token number" style="color:#36acaa">16</span><span class="token plain">:53:44.562389600 +07:00</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kedua datetime tersebut terpaku <strong>7 jam</strong> persis. Data <code>2023-03-02 09:53:44</code> UTC (atau GMT+0), jika dikonversi ke waktu lokal penulis (WIB atau GMT+7) maka akan menjadi <code>2023-03-02 16:53:44</code>. Selisihnya sesuai dengan timezone offset, yaitu 7 jam.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a525-tipe-naivedatetime">A.52.5. Tipe <code>NaiveDateTime</code><a class="hash-link" href="#a525-tipe-naivedatetime" title="Direct link to heading">​</a></h2><p>Rust memilik caranya sendiri dalam pengelolaan data datetime (yang menurut penulis cukup unik). Ada satu tipe data bernama <code>NaiveDateTime</code>, yang kegunaannya adalah untuk menampung tipe data datetime <strong>tanpa spesifik timezone offset</strong>.</p><p>Tipe data ini sangat berguna dibeberapa case yang kebanyakan adalah perihal konversi data ke bentuk <code>DateTime</code>.</p><p>Mari kita praktekan dengan contoh agar lebih jelas. Dimisalkan ada keperluan di mana data UNIX time perlu di konversi ke 2 bentuk <code>DateTime</code>, dengan timezone offset <code>Utc</code> dan <code>Local</code>. Pada kasus ini, cara ke-3 dari praktek sebelumnya bisa dilakukan untuk penyelesaian case ini.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> timestamp</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1524885322</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date2_in_utc </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Utc</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Duration</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_secs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">timestamp</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date2_in_local_tz </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Local</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Duration</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_secs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">timestamp</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Cara lain adalah dengan menggunakan <code>NaiveDateTime</code>, yang contoh penerapannnya kurang lebih seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> timestamp_in_ms</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1524885322000</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> naive_date_time</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">NaiveDateTime</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">NaiveDateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_timestamp_millis</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">timestamp_in_ms</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sample_date_in_utc </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Utc</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">from_utc_datetime</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">naive_date_time</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sample_date_in_local_tz </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Local</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">from_local_datetime</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">naive_date_time</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 1 (in utc): {sample_date_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 2 (in local_tz): {sample_date_in_local_tz}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// sample date 1 (in utc): 2018-04-28 03:15:22 UTC</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// sample date 2 (in local_tz): 2018-04-28 03:15:22 +07:00</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Statement <code>NaiveDateTime::from_timestamp_millis</code> berguna untuk mengkonversi data UNIX time (milisecond) ke bentuk <code>NaiveDateTime</code>. Kemudian, dari data tersebut dapat kita konversi lagi ke bentuk UTC dengan mudah menggunakan <code>Utc.from_utc_datetime()</code> dan local timezone menggunakan <code>Local.from_local_datetime()</code>.</p><p><img loading="lazy" alt="DateTime" src="/assets/images/datetime-3-52a5ccd1fb458c09958eafdba3f6c0d4.png" width="571" height="115" class="img_ev3q"></p><p>Bisa dilihat pada output di atas, bahwa hasil data datetime berbeda untuk timezone UTC dan local.</p><blockquote><p>Jangan sampai bingung, 2 data datetime di atas tidak sama dan tidak ekuivalen meskipun informasi jam menit detiknya sama persis. Hal ini dikarenakan timezone offset-nya berbeda.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a526-konversi-datetime-utc-ke-local-timezone-dan-sebaliknya">A.52.6. Konversi datetime UTC ke local timezone, dan sebaliknya<a class="hash-link" href="#a526-konversi-datetime-utc-ke-local-timezone-dan-sebaliknya" title="Direct link to heading">​</a></h2><p>Dalam bekerja dengan tipe data datetime, selalu memperhatikan timezone adalah hal yang sangat penting. Bisa saja dua buah datetime memiliki informasi tanggal dan waktu sama persis, tapi jika timezone-nya berbeda maka keduanya adalah berbeda!</p><p>Agar lebih jelas, silakan perhatikan kode berikut beserta outputnya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date1_in_local_tz</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Local</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Local</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">now</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date (in local): {date1_in_local_tz}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date_in_utc </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Utc</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">date1_in_local_tz</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date (in utc): {date_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date2_in_local_tz </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Local</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">date_in_utc</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date (in local): {date2_in_local_tz}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// date (in local): 2023-03-02 17:33:37.750279900 +07:00</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// date (in utc): 2023-03-02 10:33:37.750279900 UTC</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// date (in local): 2023-03-02 17:33:37.750279900 +07:00</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="DateTime" src="/assets/images/datetime-4-62b94d0c3e24bea70a3355c814ed8d79.png" width="571" height="129" class="img_ev3q"></p><p>Ketiga data datetime di atas adalah ekuivalen:</p><ul><li>Variabel <code>date1_in_local_tz</code> berisi informasi datetime waktu sekarang, dengan timezone GMT+7.</li><li>Variabel <code>date_in_utc</code> adalah datetime yang ekuivalen dengan <code>date1_in_local_tz</code>, hanya saja direpresentasikan dalam timezone UTC.</li><li>Variabel <code>date2_in_local_tz</code> juga ekuivalen dengan <code>date_in_utc</code> dan juga <code>date1_in_local_tz</code>.</li></ul><p>Data <code>2023-03-02 10 UTC</code> jika ditambah 7 jam offset, maka menjadi <code>2023-03-02 17 GMT+7</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a527-unix-time">A.52.7. UNIX time<a class="hash-link" href="#a527-unix-time" title="Direct link to heading">​</a></h2><p>Cara konversi data <code>DateTime</code> ke bentuk UNIX time bisa dilakukan lewat 3 cara:</p><ul><li>menggunakan method <code>timestamp</code>, nilai baliknya dalam bentuk detik/second</li><li>menggunakan method <code>timestamp_millis</code>, nilai baliknya dalam bentuk miliseconds</li><li>menggunakan method <code>timestamp_micros</code>, nilai baliknya dalam bentuk microseconds</li></ul><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date_in_local_tz</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Local</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Local</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">now</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date: {date_in_local_tz}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date (in second timestamp): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> date_in_local_tz</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">timestamp</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date (in milisecond timestamp): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> date_in_local_tz</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">timestamp_millis</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date (in microsecond timestamp): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> date_in_local_tz</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">timestamp_micros</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sedangkan cara untuk mengkonversi data timestamp ke bentuk <code>DateTime</code> bisa dilakukan via <code>NaiveDateTime</code> ataupun <code>DateTime::from</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// via NaiveDateTime</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> naive_date_time </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">NaiveDateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_timestamp_millis</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">date_in_local_tz</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">timestamp_millis</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> new_datetime1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Local</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">from_local_datetime</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">naive_date_time</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date1: {new_datetime1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// via DateTime::from</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> new_datetime2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Local</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Duration</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_millis</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">date_in_local_tz</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">timestamp_millis</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unsigned_abs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date2: {new_datetime2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Output program di atas:</p><p><img loading="lazy" alt="DateTime" src="/assets/images/datetime-5-eb678ecf97453409d153b4f9727e6347.png" width="571" height="182" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a528-date-formatting--parsing">A.52.8. Date formatting & parsing<a class="hash-link" href="#a528-date-formatting--parsing" title="Direct link to heading">​</a></h2><p>Konversi datetime ke string (atau biasa disebut dengan date formatting) dilakukan menggunakan method <code>format</code> yang dalam penerapannya membutuhkan argument <em>datetime formatting syntax</em>.</p><p>Sedangkan konversi dari string ke datetime dilakukan via <code>Local.datetime_from_str</code> atau <code>Utc.datetime_from_str</code>.</p><p>Contoh pengaplikasian keduanya bisa dilihat pada kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Local</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Local</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">now</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date1 (in local): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> date1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// date1 (in local): 2023-03-02 18:13:39.954831600 +07:00</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str_from_date1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> date1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">format</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"%Y-%m-%d %H:%M:%S %z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date1 (in string): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> str_from_date1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// date1 (in string): 2023-03-02 18:13:39 +0700</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date1_from_str </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Local</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">datetime_from_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">str_from_date1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"%Y-%m-%d %H:%M:%S %z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date1 (in local): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> date1_from_str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// date1 (in local): 2023-03-02 18:13:39 +07:00</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date2_from_str </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Utc</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">datetime_from_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"03/01/2023 13:04 +0000"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"%m/%d/%Y %H:%M %z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date2 (in utc): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> date2_from_str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// date2 (in utc): 2023-03-01 13:04:00 UTC</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str_from_date2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> date2_from_str</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">format</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"%Y-%m-%d %H:%M:%S %z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date2 (in string): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> str_from_date2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// date2 (in string): 2023-03-01 13:04:00 +0000</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a529-datetime-formatting-syntax">A.52.9. DateTime formatting syntax<a class="hash-link" href="#a529-datetime-formatting-syntax" title="Direct link to heading">​</a></h2><p>Berikut adalah tabel formatting syntax untuk tipe data datetime.</p><blockquote><p>Selengkapnya silakan cek <a href="https://docs.rs/chrono/latest/chrono/format/strftime/index.html" target="_blank" rel="noopener noreferrer">https://docs.rs/chrono/latest/chrono/format/strftime/index.html</a></p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-date-specifiers">◉ Date specifiers<a class="hash-link" href="#-date-specifiers" title="Direct link to heading">​</a></h3><table><thead><tr><th align="center">Spec</th><th align="center">Example</th><th align="left">Description</th></tr></thead><tbody><tr><td align="center">%Y</td><td align="center">2001</td><td align="left">The full proleptic Gregorian year, zero-padded to 4 digits. chrono supports years from -262144 to 262143.</td></tr><tr><td align="center">%C</td><td align="center">20</td><td align="left">The proleptic Gregorian year divided by 100, zero-padded to 2 digits. 1</td></tr><tr><td align="center">%y</td><td align="center">01</td><td align="left">The proleptic Gregorian year modulo 100, zero-padded to 2 digits. 1</td></tr><tr><td align="center">%m</td><td align="center">07</td><td align="left">Month number (01–12), zero-padded to 2 digits.</td></tr><tr><td align="center">%b</td><td align="center">Jul</td><td align="left">Abbreviated month name. Always 3 letters.</td></tr><tr><td align="center">%B</td><td align="center">July</td><td align="left">Full month name. Also accepts corresponding abbreviation in parsing.</td></tr><tr><td align="center">%h</td><td align="center">Jul</td><td align="left">Same as %b.</td></tr><tr><td align="center">%d</td><td align="center">08</td><td align="left">Day number (01–31), zero-padded to 2 digits.</td></tr><tr><td align="center">%e</td><td align="center">8</td><td align="left">Same as %d but space-padded. Same as %_d.</td></tr><tr><td align="center">%a</td><td align="center">Sun</td><td align="left">Abbreviated weekday name. Always 3 letters.</td></tr><tr><td align="center">%A</td><td align="center">Sunday</td><td align="left">Full weekday name. Also accepts corresponding abbreviation in parsing.</td></tr><tr><td align="center">%w</td><td align="center">0</td><td align="left">Sunday = 0, Monday = 1, …, Saturday = 6.</td></tr><tr><td align="center">%u</td><td align="center">7</td><td align="left">Monday = 1, Tuesday = 2, …, Sunday = 7. (ISO 8601)</td></tr><tr><td align="center">%U</td><td align="center">28</td><td align="left">Week number starting with Sunday (00–53), zero-padded to 2 digits. 2</td></tr><tr><td align="center">%W</td><td align="center">27</td><td align="left">Same as %U, but week 1 starts with the first Monday in that year instead.</td></tr><tr><td align="center">%G</td><td align="center">2001</td><td align="left">Same as %Y but uses the year number in ISO 8601 week date. 3</td></tr><tr><td align="center">%g</td><td align="center">01</td><td align="left">Same as %y but uses the year number in ISO 8601 week date. 3</td></tr><tr><td align="center">%V</td><td align="center">27</td><td align="left">Same as %U but uses the week number in ISO 8601 week date (01–53). 3</td></tr><tr><td align="center">%j</td><td align="center">189</td><td align="left">Day of the year (001–366), zero-padded to 3 digits.</td></tr><tr><td align="center">%D</td><td align="center">07/08/01</td><td align="left">Month-day-year format. Same as %m/%d/%y.</td></tr><tr><td align="center">%x</td><td align="center">07/08/01</td><td align="left">Locale’s date representation (e.g., 12/31/99).</td></tr><tr><td align="center">%F</td><td align="center">2001-07-08</td><td align="left">Year-month-day format (ISO 8601). Same as %Y-%m-%d.</td></tr><tr><td align="center">%v</td><td align="center">8-Jul-2001</td><td align="left">Day-month-year format. Same as %e-%b-%Y.</td></tr></tbody></table><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-time-specifiers">◉ Time specifiers<a class="hash-link" href="#-time-specifiers" title="Direct link to heading">​</a></h3><table><thead><tr><th align="center">Spec</th><th align="center">Example</th><th align="left">Description</th></tr></thead><tbody><tr><td align="center">%H</td><td align="center">00</td><td align="left">Hour number (00–23), zero-padded to 2 digits.</td></tr><tr><td align="center">%k</td><td align="center">0</td><td align="left">Same as %H but space-padded. Same as %_H.</td></tr><tr><td align="center">%I</td><td align="center">12</td><td align="left">Hour number in 12-hour clocks (01–12), zero-padded to 2 digits.</td></tr><tr><td align="center">%l</td><td align="center">12</td><td align="left">Same as %I but space-padded. Same as %_I.</td></tr><tr><td align="center">%P</td><td align="center">am</td><td align="left">am or pm in 12-hour clocks.</td></tr><tr><td align="center">%p</td><td align="center">AM</td><td align="left">AM or PM in 12-hour clocks.</td></tr><tr><td align="center">%M</td><td align="center">34</td><td align="left">Minute number (00–59), zero-padded to 2 digits.</td></tr><tr><td align="center">%S</td><td align="center">60</td><td align="left">Second number (00–60), zero-padded to 2 digits. 4</td></tr><tr><td align="center">%f</td><td align="center">026490000</td><td align="left">The fractional seconds (in nanoseconds) since last whole second. 5</td></tr><tr><td align="center">%.f</td><td align="center">.026490</td><td align="left">Similar to .%f but left-aligned. These all consume the leading dot. 5</td></tr><tr><td align="center">%.3f</td><td align="center">.026</td><td align="left">Similar to .%f but left-aligned but fixed to a length of 3. 5</td></tr><tr><td align="center">%.6f</td><td align="center">.026490</td><td align="left">Similar to .%f but left-aligned but fixed to a length of 6. 5</td></tr><tr><td align="center">%.9f</td><td align="center">.026490000</td><td align="left">Similar to .%f but left-aligned but fixed to a length of 9. 5</td></tr><tr><td align="center">%3f</td><td align="center">026</td><td align="left">Similar to %.3f but without the leading dot. 5</td></tr><tr><td align="center">%6f</td><td align="center">026490</td><td align="left">Similar to %.6f but without the leading dot. 5</td></tr><tr><td align="center">%9f</td><td align="center">026490000</td><td align="left">Similar to %.9f but without the leading dot. 5</td></tr><tr><td align="center">%R</td><td align="center">00:34</td><td align="left">Hour-minute format. Same as %H:%M.</td></tr><tr><td align="center">%T</td><td align="center">00:34:60</td><td align="left">Hour-minute-second format. Same as %H:%M:%S.</td></tr><tr><td align="center">%X</td><td align="center">00:34:60</td><td align="left">Locale’s time representation (e.g., 23:13:48).</td></tr><tr><td align="center">%r</td><td align="center">12:34:60 AM</td><td align="left">Hour-minute-second format in 12-hour clocks. Same as %I:%M:%S %p.</td></tr></tbody></table><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-timezone-specifiers">◉ Timezone specifiers<a class="hash-link" href="#-timezone-specifiers" title="Direct link to heading">​</a></h3><table><thead><tr><th align="center">Spec</th><th align="center">Example</th><th align="left">Description</th></tr></thead><tbody><tr><td align="center">%Z</td><td align="center">ACST</td><td align="left">Local time zone name. Skips all non-whitespace characters during parsing. 6</td></tr><tr><td align="center">%z</td><td align="center">+0930</td><td align="left">Offset from the local time to UTC (with UTC being +0000).</td></tr><tr><td align="center">%:z</td><td align="center">+09:30</td><td align="left">Same as %z but with a colon.</td></tr><tr><td align="center">%::z</td><td align="center">+09:30:00</td><td align="left">Offset from the local time to UTC with seconds.</td></tr><tr><td align="center">%:::z</td><td align="center">+09</td><td align="left">Offset from the local time to UTC without minutes.</td></tr><tr><td align="center">%#z</td><td align="center">+09</td><td align="left">Parsing only: Same as %z but allows minutes to be missing or present.</td></tr></tbody></table><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-date--time-specifiers">◉ Date & time specifiers<a class="hash-link" href="#-date--time-specifiers" title="Direct link to heading">​</a></h3><table><thead><tr><th align="center">Spec</th><th align="center">Example</th><th align="left">Description</th></tr></thead><tbody><tr><td align="center">%c</td><td align="center">Sun Jul 8 00:34:60 2001</td><td align="left">Locale’s date and time (e.g., Thu Mar 3 23:05:25 2005).</td></tr><tr><td align="center">%+</td><td align="center">2001-07-08T00:34:60.026490+09:30</td><td align="left">ISO 8601 / RFC 3339 date & time format. 7</td></tr><tr><td align="center">%s</td><td align="center">994518299</td><td align="left">UNIX timestamp, the number of seconds since 1970-01-01 00:00 UTC. 8</td></tr></tbody></table><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-special-specifiers">◉ Special specifiers<a class="hash-link" href="#-special-specifiers" title="Direct link to heading">​</a></h3><table><thead><tr><th align="center">Spec</th><th align="left">Description</th></tr></thead><tbody><tr><td align="center">%t</td><td align="left">Literal tab (\t).</td></tr><tr><td align="center">%n</td><td align="left">Literal newline (\n).</td></tr><tr><td align="center">%%</td><td align="left">Literal percent sign.</td></tr></tbody></table><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/datetime" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../datetime</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/result-type">Tipe Data ➜ Result</a></li><li><a href="/basic/generics">Generic</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/std/time/index.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/time/index.html</a></li><li><a href="https://docs.rs/time/latest/time/" target="_blank" rel="noopener noreferrer">https://docs.rs/time/latest/time/</a></li><li><a href="https://github.com/rust-lang/rust-wiki-backup/blob/master/Lib-datetime.md" target="_blank" rel="noopener noreferrer">https://github.com/rust-lang/rust-wiki-backup/blob/master/Lib-datetime.md</a></li><li><a href="https://docs.rs/chrono/latest/chrono/" target="_blank" rel="noopener noreferrer">https://docs.rs/chrono/latest/chrono/</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/attributes"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.51. Attributes</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/file-path-directory"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.53. File, Path, Directory</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a521-persiapan" class="table-of-contents__link toc-highlight">A.52.1. Persiapan</a></li><li><a href="#a522-tipe-data-datetime" class="table-of-contents__link toc-highlight">A.52.2. Tipe data <code>DateTime</code></a><ul><li><a href="#-tipe-datetimeutc" class="table-of-contents__link toc-highlight">◉ Tipe <code>DateTime<Utc></code></a></li><li><a href="#-tipe-datetimelocal" class="table-of-contents__link toc-highlight">◉ Tipe <code>DateTime<Local></code></a></li><li><a href="#-tipe-naivedatetime" class="table-of-contents__link toc-highlight">◉ Tipe <code>NaiveDateTime</code></a></li></ul></li><li><a href="#a523-pembuatan-objek-datetime" class="table-of-contents__link toc-highlight">A.52.3. Pembuatan objek <code>DateTime</code></a><ul><li><a href="#-via-utcnow" class="table-of-contents__link toc-highlight">◉ Via <code>Utc::now()</code></a></li><li><a href="#-via-utcwith_ymd_and_hms" class="table-of-contents__link toc-highlight">◉ Via <code>Utc.with_ymd_and_hms()</code></a></li><li><a href="#-via-datetimeutcfrom" class="table-of-contents__link toc-highlight">◉ Via <code>DateTime::<Utc>::from()</code></a></li><li><a href="#-via-string-method-parse" class="table-of-contents__link toc-highlight">◉ Via String method <code>parse()</code></a></li><li><a href="#-cara-lainnya" class="table-of-contents__link toc-highlight">◉ Cara lainnya</a></li></ul></li><li><a href="#a524-utc-vs-local" class="table-of-contents__link toc-highlight">A.52.4. <code>Utc</code> vs <code>Local</code></a></li><li><a href="#a525-tipe-naivedatetime" class="table-of-contents__link toc-highlight">A.52.5. Tipe <code>NaiveDateTime</code></a></li><li><a href="#a526-konversi-datetime-utc-ke-local-timezone-dan-sebaliknya" class="table-of-contents__link toc-highlight">A.52.6. Konversi datetime UTC ke local timezone, dan sebaliknya</a></li><li><a href="#a527-unix-time" class="table-of-contents__link toc-highlight">A.52.7. UNIX time</a></li><li><a href="#a528-date-formatting--parsing" class="table-of-contents__link toc-highlight">A.52.8. Date formatting & parsing</a></li><li><a href="#a529-datetime-formatting-syntax" class="table-of-contents__link toc-highlight">A.52.9. DateTime formatting syntax</a><ul><li><a href="#-date-specifiers" class="table-of-contents__link toc-highlight">◉ Date specifiers</a></li><li><a href="#-time-specifiers" class="table-of-contents__link toc-highlight">◉ Time specifiers</a></li><li><a href="#-timezone-specifiers" class="table-of-contents__link toc-highlight">◉ Timezone specifiers</a></li><li><a href="#-date--time-specifiers" class="table-of-contents__link toc-highlight">◉ Date & time specifiers</a></li><li><a href="#-special-specifiers" class="table-of-contents__link toc-highlight">◉ Special specifiers</a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.52. Date Time</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.52. Date Time</h1></header><p>Pada chapter ini kita akan mempelajari tentang tipe data datetime yang ada di Rust programming.</p><p>Rust menyediakan cukup banyak API untuk keperluan pengolahan datetime, tersedia dalam Standard Library crate. Namun pada chapter ini kita tidak akan menggunakannya, karena yang akan dipakai adalah <a href="https://crates.io/crates/chrono" target="_blank" rel="noopener noreferrer"><code>chrono</code> crate</a> (dianjurkan untuk menggunakan crate ini karena fiturnya lebih banyak).</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a521-persiapan">A.52.1. Persiapan<a class="hash-link" href="#a521-persiapan" title="Direct link to heading">​</a></h2><p>Sebelum memulai pembelajaran, siapkan satu project baru, kemudian tambahkan care <code>crono</code> dalam <code>Cargo.toml</code>.</p><div class="language-toml codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-toml codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">[</span><span class="token table class-name">package</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">name</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"time_chrono"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">version</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.1.0"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">edition</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"2021"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">[</span><span class="token table class-name">dependencies</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">chrono</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.4.23"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a522-tipe-data-datetime">A.52.2. Tipe data <code>DateTime</code><a class="hash-link" href="#a522-tipe-data-datetime" title="Direct link to heading">​</a></h2><p><code>crono</code> menyediakan cukup banyak tipe data untuk merepresentasikan informasi tanggal dan waktu, tetapi yang paling penting untuk diketahui dan dipahami ada dua, yaitu:</p><ul><li><code>DateTime<Utc></code> dan <code>DateTime<Local></code></li><li><code>NaiveDateTime</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-tipe-datetimeutc">◉ Tipe <code>DateTime<Utc></code><a class="hash-link" href="#-tipe-datetimeutc" title="Direct link to heading">​</a></h3><p><code>DateTime<Utc></code> (gabungan dari tipe data <code>chrono::datetime::DateTime</code> dan generic <code>chrono::offset::utc::Utc</code>) adalah representasi untuk tipe data datetime dengan timezone offset <strong>UTC</strong> (atau <strong>GMT+0</strong>).</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-tipe-datetimelocal">◉ Tipe <code>DateTime<Local></code><a class="hash-link" href="#-tipe-datetimelocal" title="Direct link to heading">​</a></h3><p><code>DateTime<Local></code> (gabungan dari tipe data <code>chrono::datetime::DateTime</code> dan generic <code>chrono::offset::local::Local</code>) adalah representasi untuk tipe data datetime dengan <strong>timezone offset sesuai dengan di mana program dijalankan</strong>.</p><p>Sebagai contoh, penulis berlokasi di Jawa Timur, maka ketika ada suatu data bertipe <code>DateTime<Local></code> artinya timezone offset-nya adalah WIB (atau GMT+7).</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-tipe-naivedatetime">◉ Tipe <code>NaiveDateTime</code><a class="hash-link" href="#-tipe-naivedatetime" title="Direct link to heading">​</a></h3><p>Tipe <code>chrono::naive::datetime::NaiveDateTime</code> merupakan tipe data datetime yang tidak menyimpan informasi timezone. Nanti akan kita bahas apa kegunaan dari tipe ini.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a523-pembuatan-objek-datetime">A.52.3. Pembuatan objek <code>DateTime</code><a class="hash-link" href="#a523-pembuatan-objek-datetime" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-via-utcnow">◉ Via <code>Utc::now()</code><a class="hash-link" href="#-via-utcnow" title="Direct link to heading">​</a></h3><p>Ada banyak cara untuk membuat date time, dan kita akan bahas satu-per-satu.</p><p>Cara yang pertama, mari kita pelajari sambil praktek. Isi file program <code>main.rs</code> dengan kode berikut, lalu jalankan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">chrono</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">prelude</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token operator" style="color:#393A34">*</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">time</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">Duration</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sample_date1_in_utc</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Utc</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Utc</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">now</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 1 (in utc): {sample_date1_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="DateTime" src="/assets/images/datetime-1-c0119211ce2f1f5f14eaf24316a52b54.png" width="571" height="95" class="img_CujE"></p><p>Contoh sederhana di atas adalah salah satu cara membuat object datetime dengan isi adalah informasi waktu sekarang (waktu ketika baris kode tersebut dieksekusi).</p><p>Statement <code>Utc::now()</code> mengembalikan informasi waktu sekarang dalam timezone UTC (representasi tipe data-nya adalah <code>DateTime<Utc></code>).</p><p>Module item <code>Utc</code> sendiri harus diimport terlebih dahulu agar bisa digunakan. Itulah kenapa ada statement <code>use chrono::prelude::*</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-via-utcwith_ymd_and_hms">◉ Via <code>Utc.with_ymd_and_hms()</code><a class="hash-link" href="#-via-utcwith_ymd_and_hms" title="Direct link to heading">​</a></h3><p>Pembuatan object datetime dengan isi informasi waktu spesifik bisa dilakukan menggunakan <code>Utc.with_ymd_and_hms()</code>. Fungsi ini mewajibkan developer untuk mengisi 6 parameternya dengan segment waktu (tahun, bulan, dan lainnya).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sample_date2_in_utc </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Utc</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">with_ymd_and_hms</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2023</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 2 (in utc): {sample_date2_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: sample date 2 (in utc): 2023-03-01 01:02:03 UTC</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Statement di atas menghasilkan data datetime dengan isi <code>2023-03-01 01:02:03 UTC</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-via-datetimeutcfrom">◉ Via <code>DateTime::<Utc>::from()</code><a class="hash-link" href="#-via-datetimeutcfrom" title="Direct link to heading">​</a></h3><p>Cara ini pas digunakan pada situasi di mana kita perlu membuat object datetime dari sebuah <a href="https://en.wikipedia.org/wiki/Unix_time" target="_blank" rel="noopener noreferrer">UNIX timestamp</a>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sample_date3_in_utc </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Utc</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Duration</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_secs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1524885322</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 3 (in utc): {sample_date3_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: sample date 3 (in utc): 2018-04-28 03:15:22 UTC</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Statement <code>DateTime::<Utc>::from()</code> di atas menghasilkan data datetime <code>2018-04-28 03:15:22 UTC</code>, karena nilai <code>1524885322</code> adalah representasi UNIX time untuk waktu tersebut.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-via-string-method-parse">◉ Via String method <code>parse()</code><a class="hash-link" href="#-via-string-method-parse" title="Direct link to heading">​</a></h3><p>Tipe data string bisa langsung dikonversi ke bentuk datetime menggunakan method <code>parse()</code> yang dikombinasikan dengan <code>DateTime<Utc></code> sebagai generic parameter.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sample_date4_in_utc </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"2023-03-01 01:02:03 UTC"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">DateTime</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Utc</span><span class="token operator" style="color:#393A34">>></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 4 (in utc): {sample_date4_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: sample date 4 (in utc): 2023-03-01 01:02:03 UTC</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Statement parsing di atas menghasilkan data datetime <code>2023-03-01 01:02:03 UTC</code>, sesuai dengan isi data string.</p><p>O iya, perlu diketahui bahwa tidak semua string bisa di-parse ke bentuk <code>DateTime</code>. Jika data string memiliki format yang tidak sesuai dengan aturan parsing di Rust, maka proses parsing menggunakan method <code>parse()</code> pasti menghasilkan error.</p><p>Penerapan method <code>parse::<DateTime<Utc>>()</code> sebenarnya mengembalikan tipe data <code>Result<DateTime<Utc>, ParseError></code>, itulah kenapa pada contoh perlu di chain lagi dengan method <code>unwrap</code>.</p><blockquote><p>Lebih detailnya mengenai tipe data <code>Result</code> dibahas pada chapter <a href="/basic/result-type">Tipe Data ➜ Result</a></p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-cara-lainnya">◉ Cara lainnya<a class="hash-link" href="#-cara-lainnya" title="Direct link to heading">​</a></h3><p>Ada beberapa cara lain yang bisa digunakan untuk pembuatan object datetime, dan kita akan bahas juga sebentar lagi.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a524-utc-vs-local">A.52.4. <code>Utc</code> vs <code>Local</code><a class="hash-link" href="#a524-utc-vs-local" title="Direct link to heading">​</a></h2><p>Kesemua cara yang sudah dipelajari di atas juga bisa diterapkan dalam pembuatan object date time dengan timezone offset <code>Local</code>. Penerapannya kurang lebih sama, cukup ganti <code>Utc</code> menjadi <code>Local</code>.</p><p>Jika disandingkan, akan seperti ini kodenya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date1_in_utc</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Utc</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Utc</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">now</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date2_in_utc </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Utc</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">with_ymd_and_hms</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2023</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date3_in_utc </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Utc</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Duration</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_secs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1524885322</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date4_in_utc </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"2023-03-01 01:02:03 UTC"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">DateTime</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Utc</span><span class="token operator" style="color:#393A34">>></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 1 (in utc): {date1_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 2 (in utc): {date2_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 3 (in utc): {date3_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 4 (in utc): {date4_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// vs</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date1_in_local_tz</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Local</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Local</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">now</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date2_in_local_tz </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Local</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">with_ymd_and_hms</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2023</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date3_in_local_tz </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Local</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Duration</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_secs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1524885322</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date4_in_local_tz </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"2023-03-01 01:02:03 UTC"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">DateTime</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Local</span><span class="token operator" style="color:#393A34">>></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 1 (in local_tz): {date1_in_local_tz}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 2 (in local_tz): {date2_in_local_tz}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 3 (in local_tz): {date3_in_local_tz}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 4 (in local_tz): {date4_in_local_tz}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="DateTime" src="/assets/images/datetime-2-998514b9bc7ad92870392305578f2a14.png" width="571" height="231" class="img_CujE"></p><p>Semoga cukup jelas.</p><p>Dari contoh di atas, sebenarnya ada 2 variabel yang menarik untuk dibahas, yaitu <code>sample_date1_in_utc</code> dan <code>sample_date1_in_local_tz</code>. Dua variabel tersebut berisi informasi waktu sekarang, perbedaannya hanya pada timezone offset saja. Namun, meski timezone offset-nya berbeda, kedua datetime tersebut sejatinya adalah merepresentasikan waktu yang sama (ekuivalen).</p><p>Agar lebih jelas, silakan perhatikan contoh berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">sample </span><span class="token function" style="color:#d73a49">date</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">in utc</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain">: </span><span class="token number" style="color:#36acaa">2023</span><span class="token plain">-03-02 09:53:44.561519500 UTC</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">sample </span><span class="token function" style="color:#d73a49">date</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">in local_tz</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain">: </span><span class="token number" style="color:#36acaa">2023</span><span class="token plain">-03-02 </span><span class="token number" style="color:#36acaa">16</span><span class="token plain">:53:44.562389600 +07:00</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kedua datetime tersebut terpaku <strong>7 jam</strong> persis. Data <code>2023-03-02 09:53:44</code> UTC (atau GMT+0), jika dikonversi ke waktu lokal penulis (WIB atau GMT+7) maka akan menjadi <code>2023-03-02 16:53:44</code>. Selisihnya sesuai dengan timezone offset, yaitu 7 jam.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a525-tipe-naivedatetime">A.52.5. Tipe <code>NaiveDateTime</code><a class="hash-link" href="#a525-tipe-naivedatetime" title="Direct link to heading">​</a></h2><p>Rust memilik caranya sendiri dalam pengelolaan data datetime (yang menurut penulis cukup unik). Ada satu tipe data bernama <code>NaiveDateTime</code>, yang kegunaannya adalah untuk menampung tipe data datetime <strong>tanpa spesifik timezone offset</strong>.</p><p>Tipe data ini sangat berguna dibeberapa case yang kebanyakan adalah perihal konversi data ke bentuk <code>DateTime</code>.</p><p>Mari kita praktekan dengan contoh agar lebih jelas. Dimisalkan ada keperluan di mana data UNIX time perlu di konversi ke 2 bentuk <code>DateTime</code>, dengan timezone offset <code>Utc</code> dan <code>Local</code>. Pada kasus ini, cara ke-3 dari praktek sebelumnya bisa dilakukan untuk penyelesaian case ini.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> timestamp</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1524885322</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date2_in_utc </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Utc</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Duration</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_secs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">timestamp</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date2_in_local_tz </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Local</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Duration</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_secs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">timestamp</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Cara lain adalah dengan menggunakan <code>NaiveDateTime</code>, yang contoh penerapannnya kurang lebih seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> timestamp_in_ms</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1524885322000</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> naive_date_time</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">NaiveDateTime</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">NaiveDateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_timestamp_millis</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">timestamp_in_ms</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sample_date_in_utc </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Utc</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">from_utc_datetime</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">naive_date_time</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sample_date_in_local_tz </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Local</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">from_local_datetime</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">naive_date_time</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 1 (in utc): {sample_date_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sample date 2 (in local_tz): {sample_date_in_local_tz}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// sample date 1 (in utc): 2018-04-28 03:15:22 UTC</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// sample date 2 (in local_tz): 2018-04-28 03:15:22 +07:00</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Statement <code>NaiveDateTime::from_timestamp_millis</code> berguna untuk mengkonversi data UNIX time (milisecond) ke bentuk <code>NaiveDateTime</code>. Kemudian, dari data tersebut dapat kita konversi lagi ke bentuk UTC dengan mudah menggunakan <code>Utc.from_utc_datetime()</code> dan local timezone menggunakan <code>Local.from_local_datetime()</code>.</p><p><img loading="lazy" alt="DateTime" src="/assets/images/datetime-3-52a5ccd1fb458c09958eafdba3f6c0d4.png" width="571" height="115" class="img_CujE"></p><p>Bisa dilihat pada output di atas, bahwa hasil data datetime berbeda untuk timezone UTC dan local.</p><blockquote><p>Jangan sampai bingung, 2 data datetime di atas tidak sama dan tidak ekuivalen meskipun informasi jam menit detiknya sama persis. Hal ini dikarenakan timezone offset-nya berbeda.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a526-konversi-datetime-utc-ke-local-timezone-dan-sebaliknya">A.52.6. Konversi datetime UTC ke local timezone, dan sebaliknya<a class="hash-link" href="#a526-konversi-datetime-utc-ke-local-timezone-dan-sebaliknya" title="Direct link to heading">​</a></h2><p>Dalam bekerja dengan tipe data datetime, selalu memperhatikan timezone adalah hal yang sangat penting. Bisa saja dua buah datetime memiliki informasi tanggal dan waktu sama persis, tapi jika timezone-nya berbeda maka keduanya adalah berbeda!</p><p>Agar lebih jelas, silakan perhatikan kode berikut beserta outputnya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date1_in_local_tz</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Local</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Local</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">now</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date (in local): {date1_in_local_tz}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date_in_utc </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Utc</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">date1_in_local_tz</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date (in utc): {date_in_utc}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date2_in_local_tz </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Local</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">date_in_utc</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date (in local): {date2_in_local_tz}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// date (in local): 2023-03-02 17:33:37.750279900 +07:00</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// date (in utc): 2023-03-02 10:33:37.750279900 UTC</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// date (in local): 2023-03-02 17:33:37.750279900 +07:00</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="DateTime" src="/assets/images/datetime-4-62b94d0c3e24bea70a3355c814ed8d79.png" width="571" height="129" class="img_CujE"></p><p>Ketiga data datetime di atas adalah ekuivalen:</p><ul><li>Variabel <code>date1_in_local_tz</code> berisi informasi datetime waktu sekarang, dengan timezone GMT+7.</li><li>Variabel <code>date_in_utc</code> adalah datetime yang ekuivalen dengan <code>date1_in_local_tz</code>, hanya saja direpresentasikan dalam timezone UTC.</li><li>Variabel <code>date2_in_local_tz</code> juga ekuivalen dengan <code>date_in_utc</code> dan juga <code>date1_in_local_tz</code>.</li></ul><p>Data <code>2023-03-02 10 UTC</code> jika ditambah 7 jam offset, maka menjadi <code>2023-03-02 17 GMT+7</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a527-unix-time">A.52.7. UNIX time<a class="hash-link" href="#a527-unix-time" title="Direct link to heading">​</a></h2><p>Cara konversi data <code>DateTime</code> ke bentuk UNIX time bisa dilakukan lewat 3 cara:</p><ul><li>menggunakan method <code>timestamp</code>, nilai baliknya dalam bentuk detik/second</li><li>menggunakan method <code>timestamp_millis</code>, nilai baliknya dalam bentuk miliseconds</li><li>menggunakan method <code>timestamp_micros</code>, nilai baliknya dalam bentuk microseconds</li></ul><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date_in_local_tz</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Local</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Local</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">now</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date: {date_in_local_tz}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date (in second timestamp): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> date_in_local_tz</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">timestamp</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date (in milisecond timestamp): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> date_in_local_tz</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">timestamp_millis</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date (in microsecond timestamp): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> date_in_local_tz</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">timestamp_micros</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sedangkan cara untuk mengkonversi data timestamp ke bentuk <code>DateTime</code> bisa dilakukan via <code>NaiveDateTime</code> ataupun <code>DateTime::from</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// via NaiveDateTime</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> naive_date_time </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">NaiveDateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_timestamp_millis</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">date_in_local_tz</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">timestamp_millis</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> new_datetime1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Local</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">from_local_datetime</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">naive_date_time</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date1: {new_datetime1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// via DateTime::from</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> new_datetime2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Local</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token class-name">Duration</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_millis</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">date_in_local_tz</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">timestamp_millis</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unsigned_abs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date2: {new_datetime2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Output program di atas:</p><p><img loading="lazy" alt="DateTime" src="/assets/images/datetime-5-eb678ecf97453409d153b4f9727e6347.png" width="571" height="182" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a528-date-formatting--parsing">A.52.8. Date formatting & parsing<a class="hash-link" href="#a528-date-formatting--parsing" title="Direct link to heading">​</a></h2><p>Konversi datetime ke string (atau biasa disebut dengan date formatting) dilakukan menggunakan method <code>format</code> yang dalam penerapannya membutuhkan argument <em>datetime formatting syntax</em>.</p><p>Sedangkan konversi dari string ke datetime dilakukan via <code>Local.datetime_from_str</code> atau <code>Utc.datetime_from_str</code>.</p><p>Contoh pengaplikasian keduanya bisa dilihat pada kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">DateTime</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Local</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Local</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">now</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date1 (in local): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> date1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// date1 (in local): 2023-03-02 18:13:39.954831600 +07:00</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str_from_date1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> date1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">format</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"%Y-%m-%d %H:%M:%S %z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date1 (in string): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> str_from_date1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// date1 (in string): 2023-03-02 18:13:39 +0700</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date1_from_str </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Local</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">datetime_from_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">str_from_date1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"%Y-%m-%d %H:%M:%S %z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date1 (in local): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> date1_from_str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// date1 (in local): 2023-03-02 18:13:39 +07:00</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> date2_from_str </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Utc</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">datetime_from_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"03/01/2023 13:04 +0000"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"%m/%d/%Y %H:%M %z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date2 (in utc): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> date2_from_str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// date2 (in utc): 2023-03-01 13:04:00 UTC</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str_from_date2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> date2_from_str</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">format</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"%Y-%m-%d %H:%M:%S %z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"date2 (in string): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> str_from_date2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// date2 (in string): 2023-03-01 13:04:00 +0000</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a529-datetime-formatting-syntax">A.52.9. DateTime formatting syntax<a class="hash-link" href="#a529-datetime-formatting-syntax" title="Direct link to heading">​</a></h2><p>Berikut adalah tabel formatting syntax untuk tipe data datetime.</p><blockquote><p>Selengkapnya silakan cek <a href="https://docs.rs/chrono/latest/chrono/format/strftime/index.html" target="_blank" rel="noopener noreferrer">https://docs.rs/chrono/latest/chrono/format/strftime/index.html</a></p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-date-specifiers">◉ Date specifiers<a class="hash-link" href="#-date-specifiers" title="Direct link to heading">​</a></h3><table><thead><tr><th align="center">Spec</th><th align="center">Example</th><th align="left">Description</th></tr></thead><tbody><tr><td align="center">%Y</td><td align="center">2001</td><td align="left">The full proleptic Gregorian year, zero-padded to 4 digits. chrono supports years from -262144 to 262143.</td></tr><tr><td align="center">%C</td><td align="center">20</td><td align="left">The proleptic Gregorian year divided by 100, zero-padded to 2 digits. 1</td></tr><tr><td align="center">%y</td><td align="center">01</td><td align="left">The proleptic Gregorian year modulo 100, zero-padded to 2 digits. 1</td></tr><tr><td align="center">%m</td><td align="center">07</td><td align="left">Month number (01–12), zero-padded to 2 digits.</td></tr><tr><td align="center">%b</td><td align="center">Jul</td><td align="left">Abbreviated month name. Always 3 letters.</td></tr><tr><td align="center">%B</td><td align="center">July</td><td align="left">Full month name. Also accepts corresponding abbreviation in parsing.</td></tr><tr><td align="center">%h</td><td align="center">Jul</td><td align="left">Same as %b.</td></tr><tr><td align="center">%d</td><td align="center">08</td><td align="left">Day number (01–31), zero-padded to 2 digits.</td></tr><tr><td align="center">%e</td><td align="center">8</td><td align="left">Same as %d but space-padded. Same as %_d.</td></tr><tr><td align="center">%a</td><td align="center">Sun</td><td align="left">Abbreviated weekday name. Always 3 letters.</td></tr><tr><td align="center">%A</td><td align="center">Sunday</td><td align="left">Full weekday name. Also accepts corresponding abbreviation in parsing.</td></tr><tr><td align="center">%w</td><td align="center">0</td><td align="left">Sunday = 0, Monday = 1, …, Saturday = 6.</td></tr><tr><td align="center">%u</td><td align="center">7</td><td align="left">Monday = 1, Tuesday = 2, …, Sunday = 7. (ISO 8601)</td></tr><tr><td align="center">%U</td><td align="center">28</td><td align="left">Week number starting with Sunday (00–53), zero-padded to 2 digits. 2</td></tr><tr><td align="center">%W</td><td align="center">27</td><td align="left">Same as %U, but week 1 starts with the first Monday in that year instead.</td></tr><tr><td align="center">%G</td><td align="center">2001</td><td align="left">Same as %Y but uses the year number in ISO 8601 week date. 3</td></tr><tr><td align="center">%g</td><td align="center">01</td><td align="left">Same as %y but uses the year number in ISO 8601 week date. 3</td></tr><tr><td align="center">%V</td><td align="center">27</td><td align="left">Same as %U but uses the week number in ISO 8601 week date (01–53). 3</td></tr><tr><td align="center">%j</td><td align="center">189</td><td align="left">Day of the year (001–366), zero-padded to 3 digits.</td></tr><tr><td align="center">%D</td><td align="center">07/08/01</td><td align="left">Month-day-year format. Same as %m/%d/%y.</td></tr><tr><td align="center">%x</td><td align="center">07/08/01</td><td align="left">Locale’s date representation (e.g., 12/31/99).</td></tr><tr><td align="center">%F</td><td align="center">2001-07-08</td><td align="left">Year-month-day format (ISO 8601). Same as %Y-%m-%d.</td></tr><tr><td align="center">%v</td><td align="center">8-Jul-2001</td><td align="left">Day-month-year format. Same as %e-%b-%Y.</td></tr></tbody></table><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-time-specifiers">◉ Time specifiers<a class="hash-link" href="#-time-specifiers" title="Direct link to heading">​</a></h3><table><thead><tr><th align="center">Spec</th><th align="center">Example</th><th align="left">Description</th></tr></thead><tbody><tr><td align="center">%H</td><td align="center">00</td><td align="left">Hour number (00–23), zero-padded to 2 digits.</td></tr><tr><td align="center">%k</td><td align="center">0</td><td align="left">Same as %H but space-padded. Same as %_H.</td></tr><tr><td align="center">%I</td><td align="center">12</td><td align="left">Hour number in 12-hour clocks (01–12), zero-padded to 2 digits.</td></tr><tr><td align="center">%l</td><td align="center">12</td><td align="left">Same as %I but space-padded. Same as %_I.</td></tr><tr><td align="center">%P</td><td align="center">am</td><td align="left">am or pm in 12-hour clocks.</td></tr><tr><td align="center">%p</td><td align="center">AM</td><td align="left">AM or PM in 12-hour clocks.</td></tr><tr><td align="center">%M</td><td align="center">34</td><td align="left">Minute number (00–59), zero-padded to 2 digits.</td></tr><tr><td align="center">%S</td><td align="center">60</td><td align="left">Second number (00–60), zero-padded to 2 digits. 4</td></tr><tr><td align="center">%f</td><td align="center">026490000</td><td align="left">The fractional seconds (in nanoseconds) since last whole second. 5</td></tr><tr><td align="center">%.f</td><td align="center">.026490</td><td align="left">Similar to .%f but left-aligned. These all consume the leading dot. 5</td></tr><tr><td align="center">%.3f</td><td align="center">.026</td><td align="left">Similar to .%f but left-aligned but fixed to a length of 3. 5</td></tr><tr><td align="center">%.6f</td><td align="center">.026490</td><td align="left">Similar to .%f but left-aligned but fixed to a length of 6. 5</td></tr><tr><td align="center">%.9f</td><td align="center">.026490000</td><td align="left">Similar to .%f but left-aligned but fixed to a length of 9. 5</td></tr><tr><td align="center">%3f</td><td align="center">026</td><td align="left">Similar to %.3f but without the leading dot. 5</td></tr><tr><td align="center">%6f</td><td align="center">026490</td><td align="left">Similar to %.6f but without the leading dot. 5</td></tr><tr><td align="center">%9f</td><td align="center">026490000</td><td align="left">Similar to %.9f but without the leading dot. 5</td></tr><tr><td align="center">%R</td><td align="center">00:34</td><td align="left">Hour-minute format. Same as %H:%M.</td></tr><tr><td align="center">%T</td><td align="center">00:34:60</td><td align="left">Hour-minute-second format. Same as %H:%M:%S.</td></tr><tr><td align="center">%X</td><td align="center">00:34:60</td><td align="left">Locale’s time representation (e.g., 23:13:48).</td></tr><tr><td align="center">%r</td><td align="center">12:34:60 AM</td><td align="left">Hour-minute-second format in 12-hour clocks. Same as %I:%M:%S %p.</td></tr></tbody></table><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-timezone-specifiers">◉ Timezone specifiers<a class="hash-link" href="#-timezone-specifiers" title="Direct link to heading">​</a></h3><table><thead><tr><th align="center">Spec</th><th align="center">Example</th><th align="left">Description</th></tr></thead><tbody><tr><td align="center">%Z</td><td align="center">ACST</td><td align="left">Local time zone name. Skips all non-whitespace characters during parsing. 6</td></tr><tr><td align="center">%z</td><td align="center">+0930</td><td align="left">Offset from the local time to UTC (with UTC being +0000).</td></tr><tr><td align="center">%:z</td><td align="center">+09:30</td><td align="left">Same as %z but with a colon.</td></tr><tr><td align="center">%::z</td><td align="center">+09:30:00</td><td align="left">Offset from the local time to UTC with seconds.</td></tr><tr><td align="center">%:::z</td><td align="center">+09</td><td align="left">Offset from the local time to UTC without minutes.</td></tr><tr><td align="center">%#z</td><td align="center">+09</td><td align="left">Parsing only: Same as %z but allows minutes to be missing or present.</td></tr></tbody></table><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-date--time-specifiers">◉ Date & time specifiers<a class="hash-link" href="#-date--time-specifiers" title="Direct link to heading">​</a></h3><table><thead><tr><th align="center">Spec</th><th align="center">Example</th><th align="left">Description</th></tr></thead><tbody><tr><td align="center">%c</td><td align="center">Sun Jul 8 00:34:60 2001</td><td align="left">Locale’s date and time (e.g., Thu Mar 3 23:05:25 2005).</td></tr><tr><td align="center">%+</td><td align="center">2001-07-08T00:34:60.026490+09:30</td><td align="left">ISO 8601 / RFC 3339 date & time format. 7</td></tr><tr><td align="center">%s</td><td align="center">994518299</td><td align="left">UNIX timestamp, the number of seconds since 1970-01-01 00:00 UTC. 8</td></tr></tbody></table><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-special-specifiers">◉ Special specifiers<a class="hash-link" href="#-special-specifiers" title="Direct link to heading">​</a></h3><table><thead><tr><th align="center">Spec</th><th align="left">Description</th></tr></thead><tbody><tr><td align="center">%t</td><td align="left">Literal tab (\t).</td></tr><tr><td align="center">%n</td><td align="left">Literal newline (\n).</td></tr><tr><td align="center">%%</td><td align="left">Literal percent sign.</td></tr></tbody></table><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/datetime" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../datetime</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/result-type">Tipe Data ➜ Result</a></li><li><a href="/basic/generics">Generic</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/std/time/index.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/time/index.html</a></li><li><a href="https://docs.rs/time/latest/time/" target="_blank" rel="noopener noreferrer">https://docs.rs/time/latest/time/</a></li><li><a href="https://github.com/rust-lang/rust-wiki-backup/blob/master/Lib-datetime.md" target="_blank" rel="noopener noreferrer">https://github.com/rust-lang/rust-wiki-backup/blob/master/Lib-datetime.md</a></li><li><a href="https://docs.rs/chrono/latest/chrono/" target="_blank" rel="noopener noreferrer">https://docs.rs/chrono/latest/chrono/</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/attributes"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.51. Attributes</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/file-path-directory"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.53. File, Path, Directory</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a521-persiapan" class="table-of-contents__link toc-highlight">A.52.1. Persiapan</a></li><li><a href="#a522-tipe-data-datetime" class="table-of-contents__link toc-highlight">A.52.2. Tipe data <code>DateTime</code></a><ul><li><a href="#-tipe-datetimeutc" class="table-of-contents__link toc-highlight">◉ Tipe <code>DateTime<Utc></code></a></li><li><a href="#-tipe-datetimelocal" class="table-of-contents__link toc-highlight">◉ Tipe <code>DateTime<Local></code></a></li><li><a href="#-tipe-naivedatetime" class="table-of-contents__link toc-highlight">◉ Tipe <code>NaiveDateTime</code></a></li></ul></li><li><a href="#a523-pembuatan-objek-datetime" class="table-of-contents__link toc-highlight">A.52.3. Pembuatan objek <code>DateTime</code></a><ul><li><a href="#-via-utcnow" class="table-of-contents__link toc-highlight">◉ Via <code>Utc::now()</code></a></li><li><a href="#-via-utcwith_ymd_and_hms" class="table-of-contents__link toc-highlight">◉ Via <code>Utc.with_ymd_and_hms()</code></a></li><li><a href="#-via-datetimeutcfrom" class="table-of-contents__link toc-highlight">◉ Via <code>DateTime::<Utc>::from()</code></a></li><li><a href="#-via-string-method-parse" class="table-of-contents__link toc-highlight">◉ Via String method <code>parse()</code></a></li><li><a href="#-cara-lainnya" class="table-of-contents__link toc-highlight">◉ Cara lainnya</a></li></ul></li><li><a href="#a524-utc-vs-local" class="table-of-contents__link toc-highlight">A.52.4. <code>Utc</code> vs <code>Local</code></a></li><li><a href="#a525-tipe-naivedatetime" class="table-of-contents__link toc-highlight">A.52.5. Tipe <code>NaiveDateTime</code></a></li><li><a href="#a526-konversi-datetime-utc-ke-local-timezone-dan-sebaliknya" class="table-of-contents__link toc-highlight">A.52.6. Konversi datetime UTC ke local timezone, dan sebaliknya</a></li><li><a href="#a527-unix-time" class="table-of-contents__link toc-highlight">A.52.7. UNIX time</a></li><li><a href="#a528-date-formatting--parsing" class="table-of-contents__link toc-highlight">A.52.8. Date formatting & parsing</a></li><li><a href="#a529-datetime-formatting-syntax" class="table-of-contents__link toc-highlight">A.52.9. DateTime formatting syntax</a><ul><li><a href="#-date-specifiers" class="table-of-contents__link toc-highlight">◉ Date specifiers</a></li><li><a href="#-time-specifiers" class="table-of-contents__link toc-highlight">◉ Time specifiers</a></li><li><a href="#-timezone-specifiers" class="table-of-contents__link toc-highlight">◉ Timezone specifiers</a></li><li><a href="#-date--time-specifiers" class="table-of-contents__link toc-highlight">◉ Date & time specifiers</a></li><li><a href="#-special-specifiers" class="table-of-contents__link toc-highlight">◉ Special specifiers</a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/enum.html b/basic/enum.html index 36c3d866..af289c97 100644 --- a/basic/enum.html +++ b/basic/enum.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/enum/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/enum/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.26. Enum","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/enum/#webpage"},"wordCount":957,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/enum/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/enum/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/enum","name":"A.26. Enum","description":"Enum atau enumerated type adalah sebuah tipe data yang digunakan untuk menampung nilai konstan. Pada chapter ini kita akan mempelajarinya.","datePublished":"2024-08-01T10:17:28.752Z","dateModified":"2024-08-01T10:17:28.752Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/enum/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/enum"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/enum/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.26. Enum","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/enum/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/enum/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.26. Enum","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/enum/#webpage"},"wordCount":957,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/enum/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/enum/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/enum","name":"A.26. Enum","description":"Enum atau enumerated type adalah sebuah tipe data yang digunakan untuk menampung nilai konstan. Pada chapter ini kita akan mempelajarinya.","datePublished":"2024-08-30T07:44:48.841Z","dateModified":"2024-08-30T07:44:48.841Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/enum/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/enum"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/enum/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.26. Enum","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.26. Enum</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.26. Enum</h1></header><p>Enum atau <em>enumerated type</em> adalah sebuah tipe data yang digunakan untuk menampung nilai konstan. Pada chapter ini kita akan mempelajarinya.</p><p>Enum ada sedikit kemiripan dengan konstanta, bedanya ada pada nilai atau <em>underlying value</em>-nya. Jika di konstanta, yang didefinisikan adalah nama beserta value-nya, di enum yang didefinisikan adalah tipe data enum dan enum value. Enum value ini bentuknya seperti variabel tanpa nilai (lebih tepatnya nama dari enum value tersebut adalah nilainya). Lebih jelasnya silakan ikut pembahasan chapter ini.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a261-keyword-enum">A.26.1. Keyword <code>enum</code><a class="hash-link" href="#a261-keyword-enum" title="Direct link to heading">​</a></h2><p>Keyword <code>enum</code> digunakan untuk membuat <em>enumerated type</em>. Cara penulisannya seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">NamaEnum</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">NilaiEnum1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Nilai2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">NilaiEnumKe3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><code>NamaEnum</code> di atas adalah tipe data custom yang didefinisikan bertipe enum. Sedangkan <code>NilaiEnum1</code>, <code>Nilai2</code>, dan <code>NilaiEnumKe3</code> adalah yang disebut dengan enum value. Dengan itu maka ketiga enum values tersebut tipe datanya adalah sama, yaitu <code>NamaEnum</code>.</p><p>Mari kita lanjut praktik. Berikut ini adalah definisi konstanta yang menggunakan tipe data string untuk menampung nilai konstan-nya. Lalu di bawahnya ada lagi definisi nilai konstan tetapi menggunakan enum sebagai tipe data yang digunakan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// definisi konstanta</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token class-name">SuperheroSuperman</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"superman"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token class-name">SuperheroOmniMan</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"omniman"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token class-name">SuperheroHomelander</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"homelander"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token class-name">SuperheroHyperion</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hyperion"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// definisi enum</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Superhero</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Homelander</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Hyperion</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Di contoh bisa dilihat, <code>Superhero</code> adalah tipe data enum baru. Dari tipe data tersebut dibuat 4 buah enum values, yaitu <code>Superman</code>, <code>OmniMan</code>, <code>Homelander</code>, dan <code>Hyperion</code>.</p><p>Pada pembuatan konstanta, tipe data beserta value-nya harus ditentukan di awal. Pada enum, yang perlu didefinisikan adalah tipe data enum-nya (sebagai contoh <code>Superhero</code>) kemudian diikut dengan enum value yang dituliskan tanpa pengisian nilai.</p><ul><li><p>Definisi variabel dengan isi konstanta:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">SuperheroSuperman</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">SuperheroOmniMan</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Definisi variabel bertipe data enum <code>Superhero</code>:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value3</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><p>Notasi path digunakan dalam penulisan enum value dengan format <code>NamaEnum::EnumValue</code></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a262-naming-convention-enum">A.26.2. <em>Naming convention</em> enum<a class="hash-link" href="#a262-naming-convention-enum" title="Direct link to heading">​</a></h2><p>Sesuai anjuran di <a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">halaman dokumentasi Rust</a>, upper camel case digunakan dalam penamaan Enum beserta value-nya.</p><p>Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Superhero</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Homelander</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Hyperion</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a263-seleksi-kondisi-enum">A.26.3. Seleksi kondisi enum<a class="hash-link" href="#a263-seleksi-kondisi-enum" title="Direct link to heading">​</a></h2><p>Tipe data enum biasa dipakai pada seleksi kondisi, namun caranya sedikit berbeda. Default-nya keyword <code>if</code> tidak bisa digunakan pada tipe data enum.</p><p>Pada contoh berikut, statement seleksi kondisi <code>value3</code> menghasilkan error:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// seleksi kondisi pada konstanta</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> value1 </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token class-name">SuperheroSuperman</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello superman!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// seleksi kondisi pada enum</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> value3 </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello superman!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Enum" src="/assets/images/enum-1-15c91a97fbd3c87f01a4c4c5060b5fd8.png" width="859" height="378" class="img_ev3q"></p><blockquote><p>Error tersebut muncul karena tipe data enum <code>Superhero</code> tidak memiliki trait <code>PartialEq</code>. Lebih jelasnya mengenai trait dibahas pada chapter <a href="/basic/traits">Traits</a>.</p></blockquote><p>Lalu bagaimana cara pengaplikasian seleksi kondisi pada tipe enum? Ada beberapa cara, namun yang paling praktis adalah keyword <code>match</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a264-keyword-match">A.26.4. Keyword <code>match</code><a class="hash-link" href="#a264-keyword-match" title="Direct link to heading">​</a></h2><p><code>match</code> adalah salah satu keyword untuk operasi seleksi kondisi di Rust. Penerapan keyword ini cukup luas, namun pada chapter ini hanya akan dibahas penerapannya yang relevan dengan topik enum.</p><p>Mari kita pelajarinya sembari praktik. Silakan buat package baru, lalu definisikan tipe enum <code>Food</code> berikut beserta 4 enum value-nya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Food</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">PenyetanTerangBulan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">PizzaNanas</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">EsKrimIkanMujaer</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">MiGorengKuah</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Lalu buat sebuah variabel bernama <code>makanan_favorit</code> untuk menampung salah satu nilai enum. Kemudian gunakan keyword <code>match</code> untuk menerapkan operasi seleksi kondisi dengan aksi menampilkan sebuah pesan sesuai dengan nilai yang cocok.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> makanan_favorit</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Food</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PenyetanTerangBulan</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> makanan_favorit </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PenyetanTerangBulan</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"your food taste is quite ... unique"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PizzaNanas</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"it's morally wrong to have pineaple on top of pizza"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">EsKrimIkanMujaer</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"I don't know what to say"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">MiGorengKuah</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sometimes people do eat this, but it's ok"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Di atas bisa dilihat bagaimana cara penggunaan keyword <code>match</code> untuk penerapan seleksi kondisi pada tipe data enum.</p><p>Notasi penulisannya kurang lebih seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> variabel_enum </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">TipeEnum</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">ValueEnum1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">TipeEnum</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">ValueEnum2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kembali ke contoh program, variabel <code>makanan_favorit</code> dicek nilainya menggunakan keyword <code>match</code>.</p><ul><li><p>Jika nilainya adalah <code>Food::PenyetanTerangBulan</code>, muncul pesan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c">"your food taste is quite ... unique"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Jika nilainya adalah <code>Food::PizzaNanas</code>, muncul pesan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c">"it is morally wrong to have pineaple on top of pizza"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Jika nilainya adalah <code>Food::EsKrimIkanMujaer</code>, muncul pesan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c">"I don't know what to say"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Jika nilainya adalah <code>Food::MiGorengKuah</code>, muncul pesan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c">"sometimes people do eat this, but it's ok"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><p>Jalankan program untuk melihat hasilnya:</p><p><img loading="lazy" alt="Enum" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAABSCAIAAABIa0PlAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY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2pVftlObqVveKmhp5VX7+g9m2jtW3n9j8Btkdh8BFJVRxUUK9srFeO+mS3+KeKNWQerBYF+33eh1iIHc/uo/v4iNjn8Tu8PpLnBOOpK55URBqom6ZKNtFcurBS2s/Boyalbe2HdKWuQ1yMxmAqwgo4y63UGvYBA4Gxkt82oRoBoYBC5QRrsJE2MT1cAgAMsm9QAAgIwCACCjAADIKAAAMgoAAMgoAAAyCgCAjAIAIKMAAMgoAAAgowAAyCgAADIKAHAp/AfIGLZmiMAg2wAAAABJRU5ErkJggg==" width="450" height="82" class="img_ev3q"></p><p>Keyword <code>match</code> ini sebenarnya tidak hanya digunakan untuk seleksi kondisi saja. Di Rust ada yang disebut dengan <em>pattern matching</em>. Metode <em>pattern matching</em> ini memahami <em>special syntax</em> yang kegunaanya lebih luas dibanding hanya sekedar seleksi kondisi biasa.</p><blockquote><p>Lebih jelasnya mengenai <em>pattern matching</em> dibahas pada chapter <a href="/basic/pattern-matching">Pattern Matching</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a265-enum-value--tuple-struct-like">A.26.5. Enum value ➜ <em>tuple struct</em>-like<a class="hash-link" href="#a265-enum-value--tuple-struct-like" title="Direct link to heading">​</a></h2><p>Enum value di struct bisa juga didesain seperti <em>tuple struct</em>. Sebagai contoh, enum <code>Food</code> di atas akan kita tambahi dengan satu enum value baru berbentuk <em>tuple struct</em>.</p><p>Silakan tambahkan enum value <code>MakananLainnya</code> berikut. Enum ini kita fungsikan untuk mengidentifikasi data makanan lainnya selain dari yang sudah ada di enum <code>Food</code>. Notasi penulisan <em>tuple struct</em> <code>MakananLainnya(String)</code> artinya enum value <code>MakananLainnya</code> didefinisikan untuk bisa menampung data property dalam bentuk <code>String</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Food</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">PenyetanTerangBulan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">PizzaNanas</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">EsKrimIkanMujaer</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">MiGorengKuah</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">MakananLainnya</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <---- enum value baru</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sekarang ubah isi variabel <code>makanan_favorit</code> dengan enum value baru yang sudah dibuat. Syntax <code>Food::MakananLainnya(nasi_goreng)</code> artinya enum value yang digunakan adalah <code>Food::MakananLainnya</code> dengan isi property didapat dari variabel <code>nasi_goreng</code>.</p><p>Tambahkan juga <code>Food::MakananLainnya</code> dalam blok kode <code>match</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// enum value MakananLainnya digunakan</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// dengan isi property adalah string "nasi goreng"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> nasi_goreng </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"nasi goreng"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> makanan_favorit </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">MakananLainnya</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">nasi_goreng</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> makanan_favorit </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PenyetanTerangBulan</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"your food taste is quite ... unique"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PizzaNanas</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"it's morally wrong to have pineaple on top of pizza"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">EsKrimIkanMujaer</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"I don't know what to say. this should be illegal"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">MiGorengKuah</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sometimes people do eat this, but it's ok"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">MakananLainnya</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <---- seleksi kondisi baru</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"do you like {m}? nice taste!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat ada keunikan dalam penulisan seleksi kondisi <code>Food::MakananLainnya</code> dalam blok kode <code>match</code>. Di situ ada parameter bernama <code>m</code> yang parameter tersebut akan berisi data property jika memang <em>match</em> dengan <code>makanan_favorit</code>.</p><p>Coba jalankan untuk melihat hasilnya:</p><p><img loading="lazy" alt="Enum" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc4AAABXCAIAAA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AFILAHC5/A/jZO0pFTUZWQAAAABJRU5ErkJggg==" width="462" height="87" class="img_ev3q"></p><p>O iya, jumlah property value enum berbentuk <em>tuple struct</em> ini tidak terbatas ya. Pada contoh di atas, <code>Food::MakananLainnya</code> hanya memiliki 1 property. Lebih dari satu juga bisa.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a266-enum-value--struct-like">A.26.6. Enum value ➜ <em>struct</em>-like<a class="hash-link" href="#a266-enum-value--struct-like" title="Direct link to heading">​</a></h2><p>Enum value bisa juga didesain memiliki property seperti <em>struct</em>.</p><p>Mari kita terapkan pada kode sebelumnya. Tambahkan 1 buah enum value lagi dengan nama <code>MieSetan</code> yang ditulis dalam bentuk <em>struct</em>-like, dan memiliki 2 buah property.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Food</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">PenyetanTerangBulan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">PizzaNanas</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">EsKrimIkanMujaer</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">MiGorengKuah</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">MakananLainnya</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">MieSetan</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> level_pedas</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> pakek_piring</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Setelah itu, isi variabel dengan nilai adalah enum value <code>Food::MieSetan</code>, level pedasnya 5, dan tanpa piring.</p><p>Tak lupa tambahkan seleksi kondisi untuk <code>Food::MieSetan</code> pada blok kode <code>match</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> makanan_favorit </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">MieSetan</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> level_pedas</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> pakek_piring</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> makanan_favorit </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PenyetanTerangBulan</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"your food taste is quite ... unique"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PizzaNanas</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"it's morally wrong to have pineaple on top of pizza"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">EsKrimIkanMujaer</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"I don't know what to say. this should be illegal"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">MiGorengKuah</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sometimes people do eat this, but it's ok"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">MakananLainnya</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"do you like {m}? nice taste!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">MieSetan</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> level_pedas</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> pakek_piring </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> level_pedas </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"mie setan lvl {} is too much!"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> level_pedas</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"mie setan lvl {} is perfect!"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> level_pedas</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">!</span><span class="token plain">pakek_piring </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"how are you going to eat the food without a plate, huh?"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dalam seleksi kondisi <code>Food::MieSetan</code> bisa dilihat ada beberapa statement. Kurang lebih jika nilai dari variabel <code>makanan_favorit</code> adalah <code>Food::MieSetan</code> maka:</p><ul><li>Akan memunculkan pesan yang berbeda tergantung level pedasnya</li><li>Dan jika terdeteksi tidak menggunakan piring, dimunculkan pesan tambahan</li></ul><p><img loading="lazy" alt="Enum" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcAAAABiCAIAAABI5JR1AAAACXBIWXMAAA7EA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LWe7" id="a267-aturan-pattern-matching-enum">A.26.7. Aturan <em>pattern matching</em> enum<a class="hash-link" href="#a267-aturan-pattern-matching-enum" title="Direct link to heading">​</a></h2><p>Dalam blok kode <code>match</code>, semua enum value harus dituliskan. Jika tidak, pasti muncul error. Contohnya bisa dilihat di gambar berikut, beberapa seleksi kondisi enum value di-remark, hasilnya ada error.</p><p><img loading="lazy" alt="Enum" src="/assets/images/enum-5-c9da1005565fda09175ddda67f9a16b5.png" width="1096" height="309" class="img_ev3q"></p><p>Error tersebut sebenarnya bisa diantisipasi dengan menambahkan seleksi kondisi dengan penulisan seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> makanan_favorit </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PenyetanTerangBulan</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"your food taste is quite ... unique"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PizzaNanas</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"it's morally wrong to have pineaple on top of pizza"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"never heard about that food"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Menggunakan blok kode <code>match</code> di atas, jika nilai <code>makanan_favorit</code> adalah selain <code>Food::PenyetanTerangBulan</code> dan <code>Food::PizzaNanas</code>, maka pesan <code>never heard about that food</code> adalah yang muncul di layar.</p><p>Selain variabel <code>_</code> bisa juga menggunakan nama variabel apapun, misalnya <code>some_var</code>. Namun jika variabel tersebut tidak digunakan dalam blok kode, akan muncul warning.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a268-enum-module--visibility">A.26.8. Enum module & visibility<a class="hash-link" href="#a268-enum-module--visibility" title="Direct link to heading">​</a></h2><p>Mari kita coba cek perihal visibility dari enum. Siapkan package baru dengan struktur seperti berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── constants.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── main.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada file <code>constants.rs</code>, tambahkan enum <code>Company</code> berikut. Pastikan enum adalah publik dengan menambahkan keyword <code>pub</code> pada deklarasinya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/constants.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Company</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Apple</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Microsoft</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Google</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Github</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kemudian tambahkan kode berikut di <code>main.rs</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">constants</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> company </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">constants</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Company</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Apple</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> company </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">constants</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Company</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Apple</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"apple"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"other than apple"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan, hasilnya tidak error, karena <code>Company</code> didefinisikan publik.</p><p><img loading="lazy" alt="Enum" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAABVCAIAAACtjoiqAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTAtMzBUMTc6NTQ6NTUrMDc6MDAiIHhtcDpNb2Rp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g1KlY1j6f+syTu5DdPWsHVurWxYTXr2v28VZ+yemAwa8q33bp7VOh61tTFob9mShq9sswLRG9bqRUNcKvXIu9KQU2bLAq6icubX6q7Xw38rW+AJbv1vHhzrMdJie5+2vSUTcY83b0XSzu58wO4lS7ocX6LsI5hZ3TrGZIxX3U7AXDrcnDnBGYUq3Jlu1xhna+dwbU/D/YDbgUAwK0AAIBbAQBwKwAAbgUAANwKAIBbAQBwKwAA4FYAANwKAIBbAQAAtwIAXJlbn94//9V8vNHpAIBbSxsWtwIAbsWtAACTurW/rP/3+f7ULDn87+3DudpXF8bcKraJcwHgBt369P5RC7UWYmXX2oyNaI82PfpRXai7VbzbbRMA4FbnBFpFuqo8mPLzXV34pLv18J4rWuQKADfnVnH53l7CB6r896EufFPd6m2wD3YBAG7FrUdHfspJgfFxKze2AAC3ulOjYdzayVddqOq02hB2BYBbnhOQd/TfRdwaXNDnF4qnAtTCAAA349aYb4O4k0t9AADcCgCAWwEArt6tAACAWwEAcCsAAG4FAADcCgCAWwEAcCsAAG4FAADcCgCAWwEAcCsAAOBWAADcCgBwK/wHIqOHFo62hqAAAAAASUVORK5CYII=" width="457" height="85" class="img_ev3q"></p><p>Coba lakukan modifikasi dengan menghilangkan keyword <code>pub</code> saat definisi enum, hasilnya pasti error.</p><blockquote><p>Pada tipe data enum, keyword <code>pub</code> cukup ditambahkan pada definisi enum type, tidak perlu ditambahkan satu persatu di tiap enum values.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a269-generic-pada-enum">A.26.9. Generic pada enum<a class="hash-link" href="#a269-generic-pada-enum" title="Direct link to heading">​</a></h2><p>Pembahasan mengenai generic pada enum ada pada chapter <a href="/basic/generics#a368-generics-enum">Generics</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a2610-pembahasan-lanjutan-pattern-matching">A.26.10. Pembahasan lanjutan <em>pattern matching</em><a class="hash-link" href="#a2610-pembahasan-lanjutan-pattern-matching" title="Direct link to heading">​</a></h2><p>Pembahasan yang lebih mendetail tentang keyword <code>match</code> dan <em>pattern matching</em> ada pada chapter <a href="/basic/pattern-matching">Pattern Matching</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/enum" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../enum</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-work-in-progress">◉ Work in progress<a class="hash-link" href="#-work-in-progress" title="Direct link to heading">​</a></h3><ul><li>Pembahasan tentang associated function dan method pada enum</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch06-01-defining-an-enum.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch06-01-defining-an-enum.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/custom_types/enum.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/custom_types/enum.html</a></li><li><a href="https://doc.rust-lang.org/reference/items/enumerations.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/items/enumerations.html</a></li><li><a href="https://doc.rust-lang.org/book/ch06-02-match.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch06-02-match.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.enum.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.enum.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/method"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.25. Method</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/type-alias-casting"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.27. Type Alias & Casting</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a261-keyword-enum" class="table-of-contents__link toc-highlight">A.26.1. Keyword <code>enum</code></a></li><li><a href="#a262-naming-convention-enum" class="table-of-contents__link toc-highlight">A.26.2. <em>Naming convention</em> enum</a></li><li><a href="#a263-seleksi-kondisi-enum" class="table-of-contents__link toc-highlight">A.26.3. Seleksi kondisi enum</a></li><li><a href="#a264-keyword-match" class="table-of-contents__link toc-highlight">A.26.4. Keyword <code>match</code></a></li><li><a href="#a265-enum-value--tuple-struct-like" class="table-of-contents__link toc-highlight">A.26.5. Enum value ➜ <em>tuple struct</em>-like</a></li><li><a href="#a266-enum-value--struct-like" class="table-of-contents__link toc-highlight">A.26.6. Enum value ➜ <em>struct</em>-like</a></li><li><a href="#a267-aturan-pattern-matching-enum" class="table-of-contents__link toc-highlight">A.26.7. Aturan <em>pattern matching</em> enum</a></li><li><a href="#a268-enum-module--visibility" class="table-of-contents__link toc-highlight">A.26.8. Enum module & visibility</a></li><li><a href="#a269-generic-pada-enum" class="table-of-contents__link toc-highlight">A.26.9. Generic pada enum</a></li><li><a href="#a2610-pembahasan-lanjutan-pattern-matching" class="table-of-contents__link toc-highlight">A.26.10. Pembahasan lanjutan <em>pattern matching</em></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-work-in-progress" class="table-of-contents__link toc-highlight">◉ Work in progress</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.26. Enum</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.26. Enum</h1></header><p>Enum atau <em>enumerated type</em> adalah sebuah tipe data yang digunakan untuk menampung nilai konstan. Pada chapter ini kita akan mempelajarinya.</p><p>Enum ada sedikit kemiripan dengan konstanta, bedanya ada pada nilai atau <em>underlying value</em>-nya. Jika di konstanta, yang didefinisikan adalah nama beserta value-nya, di enum yang didefinisikan adalah tipe data enum dan enum value. Enum value ini bentuknya seperti variabel tanpa nilai (lebih tepatnya nama dari enum value tersebut adalah nilainya). Lebih jelasnya silakan ikut pembahasan chapter ini.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a261-keyword-enum">A.26.1. Keyword <code>enum</code><a class="hash-link" href="#a261-keyword-enum" title="Direct link to heading">​</a></h2><p>Keyword <code>enum</code> digunakan untuk membuat <em>enumerated type</em>. Cara penulisannya seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">NamaEnum</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">NilaiEnum1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Nilai2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">NilaiEnumKe3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><code>NamaEnum</code> di atas adalah tipe data custom yang didefinisikan bertipe enum. Sedangkan <code>NilaiEnum1</code>, <code>Nilai2</code>, dan <code>NilaiEnumKe3</code> adalah yang disebut dengan enum value. Dengan itu maka ketiga enum values tersebut tipe datanya adalah sama, yaitu <code>NamaEnum</code>.</p><p>Mari kita lanjut praktik. Berikut ini adalah definisi konstanta yang menggunakan tipe data string untuk menampung nilai konstan-nya. Lalu di bawahnya ada lagi definisi nilai konstan tetapi menggunakan enum sebagai tipe data yang digunakan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// definisi konstanta</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token class-name">SuperheroSuperman</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"superman"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token class-name">SuperheroOmniMan</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"omniman"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token class-name">SuperheroHomelander</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"homelander"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token class-name">SuperheroHyperion</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hyperion"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// definisi enum</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Superhero</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Homelander</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Hyperion</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Di contoh bisa dilihat, <code>Superhero</code> adalah tipe data enum baru. Dari tipe data tersebut dibuat 4 buah enum values, yaitu <code>Superman</code>, <code>OmniMan</code>, <code>Homelander</code>, dan <code>Hyperion</code>.</p><p>Pada pembuatan konstanta, tipe data beserta value-nya harus ditentukan di awal. Pada enum, yang perlu didefinisikan adalah tipe data enum-nya (sebagai contoh <code>Superhero</code>) kemudian diikut dengan enum value yang dituliskan tanpa pengisian nilai.</p><ul><li><p>Definisi variabel dengan isi konstanta:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">SuperheroSuperman</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">SuperheroOmniMan</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Definisi variabel bertipe data enum <code>Superhero</code>:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value3</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><p>Notasi path digunakan dalam penulisan enum value dengan format <code>NamaEnum::EnumValue</code></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a262-naming-convention-enum">A.26.2. <em>Naming convention</em> enum<a class="hash-link" href="#a262-naming-convention-enum" title="Direct link to heading">​</a></h2><p>Sesuai anjuran di <a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">halaman dokumentasi Rust</a>, upper camel case digunakan dalam penamaan Enum beserta value-nya.</p><p>Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Superhero</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Superman</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">OmniMan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Homelander</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Hyperion</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a263-seleksi-kondisi-enum">A.26.3. Seleksi kondisi enum<a class="hash-link" href="#a263-seleksi-kondisi-enum" title="Direct link to heading">​</a></h2><p>Tipe data enum biasa dipakai pada seleksi kondisi, namun caranya sedikit berbeda. Default-nya keyword <code>if</code> tidak bisa digunakan pada tipe data enum.</p><p>Pada contoh berikut, statement seleksi kondisi <code>value3</code> menghasilkan error:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// seleksi kondisi pada konstanta</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> value1 </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token class-name">SuperheroSuperman</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello superman!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// seleksi kondisi pada enum</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> value3 </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token class-name">Superhero</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Superman</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello superman!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="Enum" src="/assets/images/enum-1-15c91a97fbd3c87f01a4c4c5060b5fd8.png" width="859" height="378" class="img_CujE"></p><blockquote><p>Error tersebut muncul karena tipe data enum <code>Superhero</code> tidak memiliki trait <code>PartialEq</code>. Lebih jelasnya mengenai trait dibahas pada chapter <a href="/basic/traits">Traits</a>.</p></blockquote><p>Lalu bagaimana cara pengaplikasian seleksi kondisi pada tipe enum? Ada beberapa cara, namun yang paling praktis adalah keyword <code>match</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a264-keyword-match">A.26.4. Keyword <code>match</code><a class="hash-link" href="#a264-keyword-match" title="Direct link to heading">​</a></h2><p><code>match</code> adalah salah satu keyword untuk operasi seleksi kondisi di Rust. Penerapan keyword ini cukup luas, namun pada chapter ini hanya akan dibahas penerapannya yang relevan dengan topik enum.</p><p>Mari kita pelajarinya sembari praktik. Silakan buat package baru, lalu definisikan tipe enum <code>Food</code> berikut beserta 4 enum value-nya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Food</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">PenyetanTerangBulan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">PizzaNanas</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">EsKrimIkanMujaer</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">MiGorengKuah</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Lalu buat sebuah variabel bernama <code>makanan_favorit</code> untuk menampung salah satu nilai enum. Kemudian gunakan keyword <code>match</code> untuk menerapkan operasi seleksi kondisi dengan aksi menampilkan sebuah pesan sesuai dengan nilai yang cocok.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> makanan_favorit</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Food</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PenyetanTerangBulan</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> makanan_favorit </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PenyetanTerangBulan</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"your food taste is quite ... unique"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PizzaNanas</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"it's morally wrong to have pineaple on top of pizza"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">EsKrimIkanMujaer</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"I don't know what to say"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">MiGorengKuah</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sometimes people do eat this, but it's ok"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Di atas bisa dilihat bagaimana cara penggunaan keyword <code>match</code> untuk penerapan seleksi kondisi pada tipe data enum.</p><p>Notasi penulisannya kurang lebih seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> variabel_enum </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">TipeEnum</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">ValueEnum1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">TipeEnum</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">ValueEnum2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kembali ke contoh program, variabel <code>makanan_favorit</code> dicek nilainya menggunakan keyword <code>match</code>.</p><ul><li><p>Jika nilainya adalah <code>Food::PenyetanTerangBulan</code>, muncul pesan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c">"your food taste is quite ... unique"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Jika nilainya adalah <code>Food::PizzaNanas</code>, muncul pesan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c">"it is morally wrong to have pineaple on top of pizza"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Jika nilainya adalah <code>Food::EsKrimIkanMujaer</code>, muncul pesan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c">"I don't know what to say"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Jika nilainya adalah <code>Food::MiGorengKuah</code>, muncul pesan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c">"sometimes people do eat this, but it's ok"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><p>Jalankan program untuk melihat hasilnya:</p><p><img loading="lazy" alt="Enum" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAABSCAIAAABIa0PlAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJl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Hi+Sv38KnCV/oS3U2cUyvaWM7v4eg4wCMrqE7y+vBVR0/zK6sQ6hQgAVZTTyDseP49y7vyiFBA4f2ov2+LFhQiMVZzQtyDo4FJJbERCJRJ2Cb/RzHtO5smcbOaYTyeKCPCfoa6pbPi1oeeXXvnP2Hw5/Dy0bejmppWm6nEE2bSZctDcqhK3/cByOvdQ0Q7M/qMroMGrDbD51MwtKDoqKnuCNfn/52x8Yz285x2n2oPRMK0232++Fa820VEM/8/LKV5HR4W4WVylqkd8gmzYTLntSHwzJfpRGPmOTIjd2X0OByqqF6fwGBakH5ZkXTuqlQ6dUOMl+OCCrPXWNKmLn0VG9mQtldHbl68ioq0UzDLJtM+GyZVQo4jChT9yD/KR+xrpdZqwPMpoeXC6jkT8cODjpKkGcPfWlZ8qoVVANGZ1f+bOU0Y2bCRcuo/04HO/mms+4loymBakHl8ropNMsEmhKNG+xzc4hCqoloxuuFNaUURZEYTMZbYfn66vc4QlXJ4ex2x1sPavlMqoXZB5sc4brarlrV6SI1s3SGbbIkWT3Tsod2pVftlObqVveKmhp5VX7+g9m2jtW3n9j8Btkdh8BFJVRxUUK9srFeO+mS3+KeKNWQerBYF+33eh1iIHc/uo/v4iNjn8Tu8PpLnBOOpK55URBqom6ZKNtFcurBS2s/Boyalbe2HdKWuQ1yMxmAqwgo4y63UGvYBA4Gxkt82oRoBoYBC5QRrsJE2MT1cAgAMsm9QAAgIwCACCjAADIKAAAMgoAAMgoAAAyCgCAjAIAIKMAAMgoAAAgowAAyCgAADIKAHAp/AfIGLZmiMAg2wAAAABJRU5ErkJggg==" width="450" height="82" class="img_CujE"></p><p>Keyword <code>match</code> ini sebenarnya tidak hanya digunakan untuk seleksi kondisi saja. Di Rust ada yang disebut dengan <em>pattern matching</em>. Metode <em>pattern matching</em> ini memahami <em>special syntax</em> yang kegunaanya lebih luas dibanding hanya sekedar seleksi kondisi biasa.</p><blockquote><p>Lebih jelasnya mengenai <em>pattern matching</em> dibahas pada chapter <a href="/basic/pattern-matching">Pattern Matching</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a265-enum-value--tuple-struct-like">A.26.5. Enum value ➜ <em>tuple struct</em>-like<a class="hash-link" href="#a265-enum-value--tuple-struct-like" title="Direct link to heading">​</a></h2><p>Enum value di struct bisa juga didesain seperti <em>tuple struct</em>. Sebagai contoh, enum <code>Food</code> di atas akan kita tambahi dengan satu enum value baru berbentuk <em>tuple struct</em>.</p><p>Silakan tambahkan enum value <code>MakananLainnya</code> berikut. Enum ini kita fungsikan untuk mengidentifikasi data makanan lainnya selain dari yang sudah ada di enum <code>Food</code>. Notasi penulisan <em>tuple struct</em> <code>MakananLainnya(String)</code> artinya enum value <code>MakananLainnya</code> didefinisikan untuk bisa menampung data property dalam bentuk <code>String</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Food</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">PenyetanTerangBulan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">PizzaNanas</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">EsKrimIkanMujaer</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">MiGorengKuah</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">MakananLainnya</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <---- enum value baru</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sekarang ubah isi variabel <code>makanan_favorit</code> dengan enum value baru yang sudah dibuat. Syntax <code>Food::MakananLainnya(nasi_goreng)</code> artinya enum value yang digunakan adalah <code>Food::MakananLainnya</code> dengan isi property didapat dari variabel <code>nasi_goreng</code>.</p><p>Tambahkan juga <code>Food::MakananLainnya</code> dalam blok kode <code>match</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// enum value MakananLainnya digunakan</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// dengan isi property adalah string "nasi goreng"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> nasi_goreng </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"nasi goreng"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> makanan_favorit </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">MakananLainnya</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">nasi_goreng</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> makanan_favorit </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PenyetanTerangBulan</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"your food taste is quite ... unique"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PizzaNanas</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"it's morally wrong to have pineaple on top of pizza"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">EsKrimIkanMujaer</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"I don't know what to say. this should be illegal"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">MiGorengKuah</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sometimes people do eat this, but it's ok"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">MakananLainnya</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <---- seleksi kondisi baru</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"do you like {m}? nice taste!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat ada keunikan dalam penulisan seleksi kondisi <code>Food::MakananLainnya</code> dalam blok kode <code>match</code>. Di situ ada parameter bernama <code>m</code> yang parameter tersebut akan berisi data property jika memang <em>match</em> dengan <code>makanan_favorit</code>.</p><p>Coba jalankan untuk melihat hasilnya:</p><p><img loading="lazy" alt="Enum" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc4AAABXCAIAAAACmjLYAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9y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FuctEwnZYvf160fFI91zpSC3uV2pw/Y5xhWM5a9eWkNhaQ9PGyVmqjMwiXXz2fM6YsTt7fkDQjKwKkjcjovNaQjA3UrIas1GqBiArLG1JbY/m4erZ1pBbOwavNx/f6U4yrWau+aAAhcHwq4nKmYxi6lcpbEP47URpA7eoaRjYEKG1At6fSUAV1Xq0mtRWCprmlFZbXpBY5hf3GaqPgXhr6dOzeHlf9q3Ca1OriPHIHa55YrWwyH1x2SW2wy1KKd5avcb2EbmTtsdoMu8adt7vSnKKovX6pVfvkt7y6sOosn1TPtD7lLTeAeaRWOEIv/8RTpnCPfNvrqYdibuy/Pv8rhX+T/WXzYLj3PW6lOJw7XVnkNvazfDDP7HeXDGW8FqBYyYhgpiMqe7VvkZN4otSaw5QfKG8glNuLXxhwW16vbreO1MIepHYGdvU+7v5QHMJlzLVaQwCwvtQWYrkQGqjuMXufDQHAmlI7/av170hs3yoiMvtvCADWDyAAACC1AACA1AIAILUAAIDUAgAgtQAASC0AACC1AABILQAAUgsAAEgtAABSCwAASC0AAFILAHC5/A/jZO0pFTUZWQAAAABJRU5ErkJggg==" width="462" height="87" class="img_CujE"></p><p>O iya, jumlah property value enum berbentuk <em>tuple struct</em> ini tidak terbatas ya. Pada contoh di atas, <code>Food::MakananLainnya</code> hanya memiliki 1 property. Lebih dari satu juga bisa.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a266-enum-value--struct-like">A.26.6. Enum value ➜ <em>struct</em>-like<a class="hash-link" href="#a266-enum-value--struct-like" title="Direct link to heading">​</a></h2><p>Enum value bisa juga didesain memiliki property seperti <em>struct</em>.</p><p>Mari kita terapkan pada kode sebelumnya. Tambahkan 1 buah enum value lagi dengan nama <code>MieSetan</code> yang ditulis dalam bentuk <em>struct</em>-like, dan memiliki 2 buah property.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Food</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">PenyetanTerangBulan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">PizzaNanas</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">EsKrimIkanMujaer</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">MiGorengKuah</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">MakananLainnya</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">MieSetan</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> level_pedas</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> pakek_piring</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Setelah itu, isi variabel dengan nilai adalah enum value <code>Food::MieSetan</code>, level pedasnya 5, dan tanpa piring.</p><p>Tak lupa tambahkan seleksi kondisi untuk <code>Food::MieSetan</code> pada blok kode <code>match</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> makanan_favorit </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">MieSetan</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> level_pedas</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> pakek_piring</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> makanan_favorit </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PenyetanTerangBulan</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"your food taste is quite ... unique"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PizzaNanas</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"it's morally wrong to have pineaple on top of pizza"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">EsKrimIkanMujaer</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"I don't know what to say. this should be illegal"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">MiGorengKuah</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sometimes people do eat this, but it's ok"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">MakananLainnya</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"do you like {m}? nice taste!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">MieSetan</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> level_pedas</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> pakek_piring </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> level_pedas </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"mie setan lvl {} is too much!"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> level_pedas</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"mie setan lvl {} is perfect!"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> level_pedas</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">!</span><span class="token plain">pakek_piring </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"how are you going to eat the food without a plate, huh?"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dalam seleksi kondisi <code>Food::MieSetan</code> bisa dilihat ada beberapa statement. Kurang lebih jika nilai dari variabel <code>makanan_favorit</code> adalah <code>Food::MieSetan</code> maka:</p><ul><li>Akan memunculkan pesan yang berbeda tergantung level pedasnya</li><li>Dan jika terdeteksi tidak menggunakan piring, dimunculkan pesan tambahan</li></ul><p><img loading="lazy" alt="Enum" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcAAAABiCAIAAABI5JR1AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjE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XXqI6AoBNcdnGw+0NMB8Rlb7aIEH6u73pVtlLQR0V8wSUDWC79trt9RyOHS4y7umxlNEZHWWWWHZYxbv7/GeQ1ZPOVTwLA1KfciygM74eZBy7OSS+1yyfNWKU5ay5GjPENCKENHJknJBQLXxKUbXdjSzboD5jKz2UWkubgxFf7/rHVeyrz0YMoOoAtqVsxsXdJ6A3kjBeoOGl2wgRUTW7s/OIM3yMJKDCiuhgm0PNH5ewIokbQ8R1x68bCojdnJ5KpjN4CfLKwU5q6SNkJqOs3fh7RDRwUauOfkTx6cRM9vZzKoB5jKy3keeS0NuUU2/23HN7cGhWEkwyGcR0H3R9LE24ZczF2e+Rp7wSdl64lv+ua7Px1UJaOMnx/L1zdZv3LTJExDQLS4t1PN6BXSlF2jj6XabsbpGnoCAAgIKAICAAgAgoAAAgIACACCgAAAIKAAAAgoAgIACAAACCgCAgAIAIKAAAAgoAAAc+B86KtU7hT6iaAAAAABJRU5ErkJggg==" width="448" height="98" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a267-aturan-pattern-matching-enum">A.26.7. Aturan <em>pattern matching</em> enum<a class="hash-link" href="#a267-aturan-pattern-matching-enum" title="Direct link to heading">​</a></h2><p>Dalam blok kode <code>match</code>, semua enum value harus dituliskan. Jika tidak, pasti muncul error. Contohnya bisa dilihat di gambar berikut, beberapa seleksi kondisi enum value di-remark, hasilnya ada error.</p><p><img loading="lazy" alt="Enum" src="/assets/images/enum-5-c9da1005565fda09175ddda67f9a16b5.png" width="1096" height="309" class="img_CujE"></p><p>Error tersebut sebenarnya bisa diantisipasi dengan menambahkan seleksi kondisi dengan penulisan seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> makanan_favorit </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PenyetanTerangBulan</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"your food taste is quite ... unique"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Food</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PizzaNanas</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"it's morally wrong to have pineaple on top of pizza"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"never heard about that food"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Menggunakan blok kode <code>match</code> di atas, jika nilai <code>makanan_favorit</code> adalah selain <code>Food::PenyetanTerangBulan</code> dan <code>Food::PizzaNanas</code>, maka pesan <code>never heard about that food</code> adalah yang muncul di layar.</p><p>Selain variabel <code>_</code> bisa juga menggunakan nama variabel apapun, misalnya <code>some_var</code>. Namun jika variabel tersebut tidak digunakan dalam blok kode, akan muncul warning.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a268-enum-module--visibility">A.26.8. Enum module & visibility<a class="hash-link" href="#a268-enum-module--visibility" title="Direct link to heading">​</a></h2><p>Mari kita coba cek perihal visibility dari enum. Siapkan package baru dengan struktur seperti berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── constants.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── main.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada file <code>constants.rs</code>, tambahkan enum <code>Company</code> berikut. Pastikan enum adalah publik dengan menambahkan keyword <code>pub</code> pada deklarasinya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/constants.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Company</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Apple</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Microsoft</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Google</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Github</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kemudian tambahkan kode berikut di <code>main.rs</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">constants</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> company </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">constants</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Company</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Apple</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> company </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">constants</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Company</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Apple</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"apple"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"other than apple"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan, hasilnya tidak error, karena <code>Company</code> didefinisikan publik.</p><p><img loading="lazy" alt="Enum" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAABVCAIAAACtjoiqAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy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CAWwEArt6tAACAWwEAcCsAAG4FAADcCgCAWwEAcCsAAG4FAADcCgCAWwEAcCsAAOBWAADcCgBwK/wHIqOHFo62hqAAAAAASUVORK5CYII=" width="457" height="85" class="img_CujE"></p><p>Coba lakukan modifikasi dengan menghilangkan keyword <code>pub</code> saat definisi enum, hasilnya pasti error.</p><blockquote><p>Pada tipe data enum, keyword <code>pub</code> cukup ditambahkan pada definisi enum type, tidak perlu ditambahkan satu persatu di tiap enum values.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a269-generic-pada-enum">A.26.9. Generic pada enum<a class="hash-link" href="#a269-generic-pada-enum" title="Direct link to heading">​</a></h2><p>Pembahasan mengenai generic pada enum ada pada chapter <a href="/basic/generics#a368-generics-enum">Generics</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a2610-pembahasan-lanjutan-pattern-matching">A.26.10. Pembahasan lanjutan <em>pattern matching</em><a class="hash-link" href="#a2610-pembahasan-lanjutan-pattern-matching" title="Direct link to heading">​</a></h2><p>Pembahasan yang lebih mendetail tentang keyword <code>match</code> dan <em>pattern matching</em> ada pada chapter <a href="/basic/pattern-matching">Pattern Matching</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/enum" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../enum</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-work-in-progress">◉ Work in progress<a class="hash-link" href="#-work-in-progress" title="Direct link to heading">​</a></h3><ul><li>Pembahasan tentang associated function dan method pada enum</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch06-01-defining-an-enum.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch06-01-defining-an-enum.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/custom_types/enum.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/custom_types/enum.html</a></li><li><a href="https://doc.rust-lang.org/reference/items/enumerations.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/items/enumerations.html</a></li><li><a href="https://doc.rust-lang.org/book/ch06-02-match.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch06-02-match.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.enum.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.enum.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/method"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.25. Method</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/type-alias-casting"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.27. Type Alias & Casting</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a261-keyword-enum" class="table-of-contents__link toc-highlight">A.26.1. Keyword <code>enum</code></a></li><li><a href="#a262-naming-convention-enum" class="table-of-contents__link toc-highlight">A.26.2. <em>Naming convention</em> enum</a></li><li><a href="#a263-seleksi-kondisi-enum" class="table-of-contents__link toc-highlight">A.26.3. Seleksi kondisi enum</a></li><li><a href="#a264-keyword-match" class="table-of-contents__link toc-highlight">A.26.4. Keyword <code>match</code></a></li><li><a href="#a265-enum-value--tuple-struct-like" class="table-of-contents__link toc-highlight">A.26.5. Enum value ➜ <em>tuple struct</em>-like</a></li><li><a href="#a266-enum-value--struct-like" class="table-of-contents__link toc-highlight">A.26.6. Enum value ➜ <em>struct</em>-like</a></li><li><a href="#a267-aturan-pattern-matching-enum" class="table-of-contents__link toc-highlight">A.26.7. Aturan <em>pattern matching</em> enum</a></li><li><a href="#a268-enum-module--visibility" class="table-of-contents__link toc-highlight">A.26.8. Enum module & visibility</a></li><li><a href="#a269-generic-pada-enum" class="table-of-contents__link toc-highlight">A.26.9. Generic pada enum</a></li><li><a href="#a2610-pembahasan-lanjutan-pattern-matching" class="table-of-contents__link toc-highlight">A.26.10. Pembahasan lanjutan <em>pattern matching</em></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-work-in-progress" class="table-of-contents__link toc-highlight">◉ Work in progress</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/file-path-directory.html b/basic/file-path-directory.html index c60fdb2b..5e3f853e 100644 --- a/basic/file-path-directory.html +++ b/basic/file-path-directory.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/file-path-directory/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/file-path-directory/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.53. File, Path, Directory","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/file-path-directory/#webpage"},"wordCount":517,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/file-path-directory/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/file-path-directory/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/file-path-directory","name":"A.53. File, Path, Directory","description":"Pada chapter ini kita akan belajar tentang beberapa API milik Rust yang disediakan untuk manajemen path dan file system.","datePublished":"2024-08-01T10:17:28.836Z","dateModified":"2024-08-01T10:17:28.836Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/file-path-directory/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/file-path-directory"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/file-path-directory/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.53. File, Path, Directory","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/file-path-directory/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/file-path-directory/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.53. File, Path, Directory","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/file-path-directory/#webpage"},"wordCount":517,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/file-path-directory/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/file-path-directory/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/file-path-directory","name":"A.53. File, Path, Directory","description":"Pada chapter ini kita akan belajar tentang beberapa API milik Rust yang disediakan untuk manajemen path dan file system.","datePublished":"2024-08-30T07:44:48.922Z","dateModified":"2024-08-30T07:44:48.922Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/file-path-directory/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/file-path-directory"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/file-path-directory/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.53. File, Path, Directory","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.53. File, Path, Directory</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.53. File, Path, Directory</h1></header><p>Pada chapter ini kita akan belajar tentang beberapa API milik Rust yang disediakan untuk manajemen path dan file system.</p><blockquote><p>Penulis anjurkan untuk mengikuti pembelajaran chapter per chapter secara berurutan. Nantinya pada chapter <a href="/basic/recoverable-error-handling">Recoverable Error & Error Handling</a> kita akan banyak menerapkan API yang dipelajari di chapter ini.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a531-file-path-stdpathpath">A.53.1. File path (<code>std::path::Path</code>)<a class="hash-link" href="#a531-file-path-stdpathpath" title="Direct link to heading">​</a></h2><p><code>"/home/novalagung/Desktop/my text.txt"</code> adalah salah satu contoh file path. Di Rust, file path bisa direpresentasikan sebagai string (seperti yang sudah dicontohkan), atau menggunakan tipe data <code>Path</code>.</p><p>Tipe data <code>Path</code> tersedia dalam module <code>std::path</code>. Cara penggunaannya cukup mudah, sebagai contoh, beberapa filepath berikut menghasilkan path yang sama:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">path</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> filepath_1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"/home/novalagung/Desktop/my text.txt"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> filepath_2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"/home/novalagung/Desktop/my text.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> filepath_3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"/home/novalagung/Desktop"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"my text.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> filepath_4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"/home/novalagung"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Desktop"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"my text.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> filepath_5 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"/home"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"novalagung/Desktop/my text.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> filepath_1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => "/home/novalagung/Desktop/my text.txt"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> filepath_2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => "/home/novalagung/Desktop/my text.txt"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Ketika path di-print, yang muncul adalah sesuai dengan string yang ditulis. Dengan pengecualian jika method <code>.join()</code> digunakan disitu, maka separator file yang digunakan relatif terhadap OS. Jika Windows maka <code>\</code>, dan <code>/</code> untuk non-Windows.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a532-method-filepath">A.53.2. Method filepath<a class="hash-link" href="#a532-method-filepath" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-associated-function-pathnew">◉ Associated function <code>Path::new()</code><a class="hash-link" href="#-associated-function-pathnew" title="Direct link to heading">​</a></h3><p>Digunakan untuk membuat object <code>Path</code> dari suatu string. Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"/home/novalagung/Desktop/my text.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-join">◉ Method <code>join()</code><a class="hash-link" href="#-method-join" title="Direct link to heading">​</a></h3><p>Digunakan untuk menggabungkan segment filepath. Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"/home/novalagung"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Desktop"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"my text.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Hasil dari operasi di atas adalah path:</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">/home/novalagung/Desktop/my text.txt</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-exists">◉ Method <code>exists()</code><a class="hash-link" href="#-method-exists" title="Direct link to heading">​</a></h3><p>Digunakan untuk mengecek apakah suatu filepath ada atau tidak.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exists</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path exists</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-is_file--is_dir">◉ Method <code>is_file()</code> & <code>is_dir()</code><a class="hash-link" href="#-method-is_file--is_dir" title="Direct link to heading">​</a></h3><p>Method <code>is_file()</code> digunakan untuk mengecek apakah suatu filepath berisi file.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_file</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path is a file</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sedangkan method <code>is_dir()</code> digunakan untuk mengecek apakah suatu filepath adalah folder/directory.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path contains directory</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-is_absolute--is_relative">◉ Method <code>is_absolute()</code> & <code>is_relative()</code><a class="hash-link" href="#-method-is_absolute--is_relative" title="Direct link to heading">​</a></h3><p>Method <code>is_absolute()</code> digunakan untuk mengecek apakah suatu filepath adalah <em>absolute path</em>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_absolute</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path is an absolute path</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sedangkan method <code>is_relative()</code> digunakan untuk mengecek apakah suatu filepath adalah <em>relative path</em>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_relative</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path is a relative path</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a533-module-stdfs-file-system">A.53.3. Module <code>std::fs</code> (file system)<a class="hash-link" href="#a533-module-stdfs-file-system" title="Direct link to heading">​</a></h2><p><code>std::fs</code> merupakan module yang disediakan Rust untuk pengolahan file system. Di dalamnya berisinya banyak sekali fungsi untuk keperluan seperti pembuatan file, modifikasi konten file, dan lainnya.</p><p>Sebagai contoh, untuk membuat suatu directory bisa menggunakan <code>fs::create_dir</code>. Isi argument pemanggilan fungsi dengan path dalam bentuk string (atau <code>std::path::Path</code> juga boleh).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">fs</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"./files"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">create_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> res</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => Ok(())</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>fs::create_dir</code> mengembalikan value bertipe <code>Result<(), Error></code>. Gunakan pattern matching <code>match</code> untuk mengecek hasil operasi apakah sukses atau tidak.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">create_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"./files"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error on creating directory! {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"directory created"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><ul><li>Lebih detailnya mengenai tipe data <code>Result</code> dibahas pada chapter <a href="/basic/result-type">Tipe Data ➜ Result</a>.</li><li>Lebih detailnya mengenai pattern matching dibahas pada chapter <a href="/basic/pattern-matching">Pattern Matching</a>.</li></ul></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a534-manajemen-file-system">A.53.4. Manajemen file system<a class="hash-link" href="#a534-manajemen-file-system" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-pembuatan-folder-fscreate_dir">◉ Pembuatan folder (<code>fs::create_dir</code>)<a class="hash-link" href="#-pembuatan-folder-fscreate_dir" title="Direct link to heading">​</a></h3><p>Fungsi <code>fs::create_dir</code> digunakan untuk membuat folder. Contoh penerapannya sudah dibahas di sesi <a href="/basic/file-path-directory#a523-module-stdfs-file-system">A.53.3. Module std::fs (file system)</a> di atas.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-menulis-konten-file-fswrite">◉ Menulis konten file (<code>fs::write</code>)<a class="hash-link" href="#-menulis-konten-file-fswrite" title="Direct link to heading">​</a></h3><p>Fungsi <code>fs::write</code> digunakan untuk membuat folder. Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"./files"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"target.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> content </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello rust!"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">write</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> res </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error on writing file {}! {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or_default</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"file created"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>fs::write</code> melakukan penulisan konten pada variabel <code>content</code> ke path <code>path</code>. Mode penulisannya adalah <em>overwrite</em> (bukan <em>append</em>), yang artinya konten lama pada filepath akan di-<em>replace</em> total dengan konten baru.</p><p>Jika file tidak ada pada <code>path</code> tujuan, maka otomatis dibuatkan file baru. Namun jika folder/directory di mana file akan dibuat/ditulis tidak ada, maka muncul error.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-membaca-isi-file-ke-bentuk-string-fsread_to_string">◉ Membaca isi file ke bentuk string (<code>fs::read_to_string</code>)<a class="hash-link" href="#-membaca-isi-file-ke-bentuk-string-fsread_to_string" title="Direct link to heading">​</a></h3><p>Fungsi <code>fs::read_to_string()</code> digunakan untuk membaca isi file dalam bentuk string. Contoh penerapannya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"./files"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"target.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> res </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error on reading file {}! {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or_default</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"file {:?} content is: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> path</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-membaca-isi-file-ke-bentuk-vector-fsread">◉ Membaca isi file ke bentuk vector (<code>fs::read</code>)<a class="hash-link" href="#-membaca-isi-file-ke-bentuk-vector-fsread" title="Direct link to heading">​</a></h3><p>Fungsi <code>fs::read()</code> melakukan operasi baca file dan mengembalikan nilainya dalam bentuk vector <code>Vec<u8></code>. Umumnya, fungsi ini dikombinasikan dengan fungsi <code>std::str::from_utf8()</code> agar konten file bisa dimunculkan dalam format encoding tertentu (misalnya UTF-8).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"./files"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"target.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error on reading file"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> content </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or_default</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_utf8</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error on reading file! Invalid UTF-8 sequence. {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"file {:?} content is: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> path</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-menghapus-file-fsremove_file">◉ Menghapus file (<code>fs::remove_file</code>)<a class="hash-link" href="#-menghapus-file-fsremove_file" title="Direct link to heading">​</a></h3><p>Fungsi <code>fs::remove_file</code> digunakan untuk menghapus file pada suatu path. Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"./files"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"target.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">remove_file</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> res </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error on deleting file {}! {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or_default</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"file deleted"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-menghapus-folder-fsremove_dir">◉ Menghapus folder (<code>fs::remove_dir</code>)<a class="hash-link" href="#-menghapus-folder-fsremove_dir" title="Direct link to heading">​</a></h3><p>Fungsi <code>fs::remove_dir</code> digunakan untuk menghapus folder/directory. Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"./files"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">remove_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> res </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error on deleting directory {}! {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or_default</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"directory deleted"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-list-items-dalam-folder">◉ List items dalam folder<a class="hash-link" href="#-list-items-dalam-folder" title="Direct link to heading">​</a></h3><p>Fungsi <code>fs::read_dir</code> digunakan untuk menampilkan list items suatu folder (baik subfolder ataupun file). Fungsi ini mengmbalikan nilai bertipe <code>Result<ReadDir, Error></code>, untuk mengakses list items bisa menggunakan teknik pattern matching, atau boleh juga langsung di <code>unwrap()</code> (dengan resiko program bisa panic ketika ada error).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"D:\\Labs\\Adam Studio\\Ebook\\dasarpemrogramanrust\\file_path_directory_1"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> paths </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> path </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> paths </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> item </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"file name: {:?}, file path: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">file_name</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">path</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">display</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, penulis menggunakan testing path yang isinya 4 buah item:</p><p><img loading="lazy" alt="File, Path, Directory" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlMAAACwCAIAAACkbHy6AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFvGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4wLWMwMDAgMTM3LmRhNGE3ZTUsIDIw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QoZDZlpL1GmhtoPsV/aHA+XmRb0cr3Ih8y016NLZlpqvVt7IMHpQIWMh8y0F2jdkj2hOZ4mMy3o5ebPdiIz7Rl0yUzb2bZWgtNWZtqj+VHhptrpX09pjgfITJvtitY9O3lmWtDLTZ/tRGbaK3vmzLTyAo1PcHpk9iOZVCWQmbZHUZ9OsGhc8J3qUzPTlst4d+sersxM67P+jMtEntj21BqAB4RcDU8EmWlBM8hMC7eBd7g8EWSmBc0gMy3cBq75AOBxITMt3AIiHwAA6AXv7QQAAL0g8gEAgF4Q+QAAQC+IfAAAoBdEPgAA0AsiHwAA6AWRDwAA9ILIBwAAekHkAwAAvSDyAQCAXhD5AABAL4h8AACgF0Q+AADQy/8BMFgxvPoJ+vYAAAAASUVORK5CYII=" width="595" height="176" class="img_ev3q"></p><p>Output program bisa dilihat pada gambar berikut:</p><p><img loading="lazy" alt="File, Path, Directory" src="/assets/images/file-path-directory-2-bbe0bb5499225e418b251930c44fb8f6.png" width="887" height="149" class="img_ev3q"></p><p>Tipe data variabel <code>paths</code> di atas adalah <code>ReadDir</code> yang merupakan tipe data iterator. Jika digunakan pada keyword <code>for</code>, maka variabel element perulangan <code>path</code> akan bertipe data <code>Result<DirEntry, Error></code>. Dari tipe ini kita bisa mengakses file name maupun file path.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/file_path_directory" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../file_path_directory</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-work-in-progress">◉ Work in progress<a class="hash-link" href="#-work-in-progress" title="Direct link to heading">​</a></h3><ul><li>Pembahasan tentang append content file (<a href="https://stackoverflow.com/questions/30684624/what-is-the-best-variant-for-appending-a-new-line-in-a-text-file" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/30684624/what-is-the-best-variant-for-appending-a-new-line-in-a-text-file</a>)</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/result-type">Tipe Data ➜ Result</a></li><li><a href="/basic/pattern-matching">Pattern Matching</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/std/path/struct.Path.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/path/struct.Path.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/std_misc/path.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/std_misc/path.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/std_misc/fs.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/std_misc/fs.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/datetime"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.52. Date Time</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/unrecoverable-panic-error"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.54. Error ➜ Unrecoverable Error / Panic</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a531-file-path-stdpathpath" class="table-of-contents__link toc-highlight">A.53.1. File path (<code>std::path::Path</code>)</a></li><li><a href="#a532-method-filepath" class="table-of-contents__link toc-highlight">A.53.2. Method filepath</a><ul><li><a href="#-associated-function-pathnew" class="table-of-contents__link toc-highlight">◉ Associated function <code>Path::new()</code></a></li><li><a href="#-method-join" class="table-of-contents__link toc-highlight">◉ Method <code>join()</code></a></li><li><a href="#-method-exists" class="table-of-contents__link toc-highlight">◉ Method <code>exists()</code></a></li><li><a href="#-method-is_file--is_dir" class="table-of-contents__link toc-highlight">◉ Method <code>is_file()</code> & <code>is_dir()</code></a></li><li><a href="#-method-is_absolute--is_relative" class="table-of-contents__link toc-highlight">◉ Method <code>is_absolute()</code> & <code>is_relative()</code></a></li></ul></li><li><a href="#a533-module-stdfs-file-system" class="table-of-contents__link toc-highlight">A.53.3. Module <code>std::fs</code> (file system)</a></li><li><a href="#a534-manajemen-file-system" class="table-of-contents__link toc-highlight">A.53.4. Manajemen file system</a><ul><li><a href="#-pembuatan-folder-fscreate_dir" class="table-of-contents__link toc-highlight">◉ Pembuatan folder (<code>fs::create_dir</code>)</a></li><li><a href="#-menulis-konten-file-fswrite" class="table-of-contents__link toc-highlight">◉ Menulis konten file (<code>fs::write</code>)</a></li><li><a href="#-membaca-isi-file-ke-bentuk-string-fsread_to_string" class="table-of-contents__link toc-highlight">◉ Membaca isi file ke bentuk string (<code>fs::read_to_string</code>)</a></li><li><a href="#-membaca-isi-file-ke-bentuk-vector-fsread" class="table-of-contents__link toc-highlight">◉ Membaca isi file ke bentuk vector (<code>fs::read</code>)</a></li><li><a href="#-menghapus-file-fsremove_file" class="table-of-contents__link toc-highlight">◉ Menghapus file (<code>fs::remove_file</code>)</a></li><li><a href="#-menghapus-folder-fsremove_dir" class="table-of-contents__link toc-highlight">◉ Menghapus folder (<code>fs::remove_dir</code>)</a></li><li><a href="#-list-items-dalam-folder" class="table-of-contents__link toc-highlight">◉ List items dalam folder</a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-work-in-progress" class="table-of-contents__link toc-highlight">◉ Work in progress</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.53. File, Path, Directory</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.53. File, Path, Directory</h1></header><p>Pada chapter ini kita akan belajar tentang beberapa API milik Rust yang disediakan untuk manajemen path dan file system.</p><blockquote><p>Penulis anjurkan untuk mengikuti pembelajaran chapter per chapter secara berurutan. Nantinya pada chapter <a href="/basic/recoverable-error-handling">Recoverable Error & Error Handling</a> kita akan banyak menerapkan API yang dipelajari di chapter ini.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a531-file-path-stdpathpath">A.53.1. File path (<code>std::path::Path</code>)<a class="hash-link" href="#a531-file-path-stdpathpath" title="Direct link to heading">​</a></h2><p><code>"/home/novalagung/Desktop/my text.txt"</code> adalah salah satu contoh file path. Di Rust, file path bisa direpresentasikan sebagai string (seperti yang sudah dicontohkan), atau menggunakan tipe data <code>Path</code>.</p><p>Tipe data <code>Path</code> tersedia dalam module <code>std::path</code>. Cara penggunaannya cukup mudah, sebagai contoh, beberapa filepath berikut menghasilkan path yang sama:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">path</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> filepath_1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"/home/novalagung/Desktop/my text.txt"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> filepath_2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"/home/novalagung/Desktop/my text.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> filepath_3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"/home/novalagung/Desktop"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"my text.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> filepath_4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"/home/novalagung"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Desktop"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"my text.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> filepath_5 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"/home"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"novalagung/Desktop/my text.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> filepath_1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => "/home/novalagung/Desktop/my text.txt"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> filepath_2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => "/home/novalagung/Desktop/my text.txt"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Ketika path di-print, yang muncul adalah sesuai dengan string yang ditulis. Dengan pengecualian jika method <code>.join()</code> digunakan disitu, maka separator file yang digunakan relatif terhadap OS. Jika Windows maka <code>\</code>, dan <code>/</code> untuk non-Windows.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a532-method-filepath">A.53.2. Method filepath<a class="hash-link" href="#a532-method-filepath" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-associated-function-pathnew">◉ Associated function <code>Path::new()</code><a class="hash-link" href="#-associated-function-pathnew" title="Direct link to heading">​</a></h3><p>Digunakan untuk membuat object <code>Path</code> dari suatu string. Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"/home/novalagung/Desktop/my text.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-join">◉ Method <code>join()</code><a class="hash-link" href="#-method-join" title="Direct link to heading">​</a></h3><p>Digunakan untuk menggabungkan segment filepath. Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"/home/novalagung"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Desktop"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"my text.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Hasil dari operasi di atas adalah path:</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">/home/novalagung/Desktop/my text.txt</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-exists">◉ Method <code>exists()</code><a class="hash-link" href="#-method-exists" title="Direct link to heading">​</a></h3><p>Digunakan untuk mengecek apakah suatu filepath ada atau tidak.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exists</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path exists</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-is_file--is_dir">◉ Method <code>is_file()</code> & <code>is_dir()</code><a class="hash-link" href="#-method-is_file--is_dir" title="Direct link to heading">​</a></h3><p>Method <code>is_file()</code> digunakan untuk mengecek apakah suatu filepath berisi file.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_file</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path is a file</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sedangkan method <code>is_dir()</code> digunakan untuk mengecek apakah suatu filepath adalah folder/directory.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path contains directory</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-is_absolute--is_relative">◉ Method <code>is_absolute()</code> & <code>is_relative()</code><a class="hash-link" href="#-method-is_absolute--is_relative" title="Direct link to heading">​</a></h3><p>Method <code>is_absolute()</code> digunakan untuk mengecek apakah suatu filepath adalah <em>absolute path</em>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_absolute</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path is an absolute path</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sedangkan method <code>is_relative()</code> digunakan untuk mengecek apakah suatu filepath adalah <em>relative path</em>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_relative</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path is a relative path</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a533-module-stdfs-file-system">A.53.3. Module <code>std::fs</code> (file system)<a class="hash-link" href="#a533-module-stdfs-file-system" title="Direct link to heading">​</a></h2><p><code>std::fs</code> merupakan module yang disediakan Rust untuk pengolahan file system. Di dalamnya berisinya banyak sekali fungsi untuk keperluan seperti pembuatan file, modifikasi konten file, dan lainnya.</p><p>Sebagai contoh, untuk membuat suatu directory bisa menggunakan <code>fs::create_dir</code>. Isi argument pemanggilan fungsi dengan path dalam bentuk string (atau <code>std::path::Path</code> juga boleh).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">fs</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"./files"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">create_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> res</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => Ok(())</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>fs::create_dir</code> mengembalikan value bertipe <code>Result<(), Error></code>. Gunakan pattern matching <code>match</code> untuk mengecek hasil operasi apakah sukses atau tidak.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">create_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"./files"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error on creating directory! {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"directory created"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><ul><li>Lebih detailnya mengenai tipe data <code>Result</code> dibahas pada chapter <a href="/basic/result-type">Tipe Data ➜ Result</a>.</li><li>Lebih detailnya mengenai pattern matching dibahas pada chapter <a href="/basic/pattern-matching">Pattern Matching</a>.</li></ul></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a534-manajemen-file-system">A.53.4. Manajemen file system<a class="hash-link" href="#a534-manajemen-file-system" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-pembuatan-folder-fscreate_dir">◉ Pembuatan folder (<code>fs::create_dir</code>)<a class="hash-link" href="#-pembuatan-folder-fscreate_dir" title="Direct link to heading">​</a></h3><p>Fungsi <code>fs::create_dir</code> digunakan untuk membuat folder. Contoh penerapannya sudah dibahas di sesi <a href="/basic/file-path-directory#a523-module-stdfs-file-system">A.53.3. Module std::fs (file system)</a> di atas.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-menulis-konten-file-fswrite">◉ Menulis konten file (<code>fs::write</code>)<a class="hash-link" href="#-menulis-konten-file-fswrite" title="Direct link to heading">​</a></h3><p>Fungsi <code>fs::write</code> digunakan untuk membuat folder. Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"./files"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"target.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> content </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello rust!"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">write</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> res </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error on writing file {}! {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or_default</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"file created"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>fs::write</code> melakukan penulisan konten pada variabel <code>content</code> ke path <code>path</code>. Mode penulisannya adalah <em>overwrite</em> (bukan <em>append</em>), yang artinya konten lama pada filepath akan di-<em>replace</em> total dengan konten baru.</p><p>Jika file tidak ada pada <code>path</code> tujuan, maka otomatis dibuatkan file baru. Namun jika folder/directory di mana file akan dibuat/ditulis tidak ada, maka muncul error.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-membaca-isi-file-ke-bentuk-string-fsread_to_string">◉ Membaca isi file ke bentuk string (<code>fs::read_to_string</code>)<a class="hash-link" href="#-membaca-isi-file-ke-bentuk-string-fsread_to_string" title="Direct link to heading">​</a></h3><p>Fungsi <code>fs::read_to_string()</code> digunakan untuk membaca isi file dalam bentuk string. Contoh penerapannya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"./files"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"target.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> res </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error on reading file {}! {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or_default</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"file {:?} content is: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> path</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-membaca-isi-file-ke-bentuk-vector-fsread">◉ Membaca isi file ke bentuk vector (<code>fs::read</code>)<a class="hash-link" href="#-membaca-isi-file-ke-bentuk-vector-fsread" title="Direct link to heading">​</a></h3><p>Fungsi <code>fs::read()</code> melakukan operasi baca file dan mengembalikan nilainya dalam bentuk vector <code>Vec<u8></code>. Umumnya, fungsi ini dikombinasikan dengan fungsi <code>std::str::from_utf8()</code> agar konten file bisa dimunculkan dalam format encoding tertentu (misalnya UTF-8).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"./files"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"target.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error on reading file"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> content </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or_default</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_utf8</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error on reading file! Invalid UTF-8 sequence. {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"file {:?} content is: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> path</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-menghapus-file-fsremove_file">◉ Menghapus file (<code>fs::remove_file</code>)<a class="hash-link" href="#-menghapus-file-fsremove_file" title="Direct link to heading">​</a></h3><p>Fungsi <code>fs::remove_file</code> digunakan untuk menghapus file pada suatu path. Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"./files"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"target.txt"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">remove_file</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> res </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error on deleting file {}! {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or_default</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"file deleted"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-menghapus-folder-fsremove_dir">◉ Menghapus folder (<code>fs::remove_dir</code>)<a class="hash-link" href="#-menghapus-folder-fsremove_dir" title="Direct link to heading">​</a></h3><p>Fungsi <code>fs::remove_dir</code> digunakan untuk menghapus folder/directory. Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"./files"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">remove_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> res </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error on deleting directory {}! {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or_default</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"directory deleted"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-list-items-dalam-folder">◉ List items dalam folder<a class="hash-link" href="#-list-items-dalam-folder" title="Direct link to heading">​</a></h3><p>Fungsi <code>fs::read_dir</code> digunakan untuk menampilkan list items suatu folder (baik subfolder ataupun file). Fungsi ini mengmbalikan nilai bertipe <code>Result<ReadDir, Error></code>, untuk mengakses list items bisa menggunakan teknik pattern matching, atau boleh juga langsung di <code>unwrap()</code> (dengan resiko program bisa panic ketika ada error).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"D:\\Labs\\Adam Studio\\Ebook\\dasarpemrogramanrust\\file_path_directory_1"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> paths </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> path </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> paths </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> item </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"file name: {:?}, file path: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">file_name</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">path</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">display</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, penulis menggunakan testing path yang isinya 4 buah item:</p><p><img loading="eager" fetchpriority="high" alt="File, Path, Directory" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlMAAACwCAIAAACkbH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QmZaeEC3vuZDZtrzvVZmWpmhBKeSa7BehQyXXQWZaVWO1qc/O/SWgf7ZmuUTM9M21tF4VxkPJZlpfRHNdunUto0iXWeWN+JCFp7Zba/5kJn2fK+WmVZhZIJTklbIUNnHQWbapiP12epO6v7Z8qmZacvr1fo924yx+r3v0tlNexKzdW7YXvmv5eJw9bqQmfZBaZGZdijBaTczrbpCToXMtOfxmd0YYr+sOR4vMy1R3c+bewa8quuNdiIz7RXpkpl2dILTgQoZDZlpL1GmhtoPsV/aHA+XmRb0cr3Ih8y016NLZlpqvVt7IMHpQIWMh8y0F2jdkj2hOZ4mMy3o5ebPdiIz7Rl0yUzb2bZWgtNWZtqj+VHhptrpX09pjgfITJvtitY9O3lmWtDLTZ/tRGbaK3vmzLTyAo1PcHpk9iOZVCWQmbZHUZ9OsGhc8J3qUzPTlst4d+sersxM67P+jMtEntj21BqAB4RcDU8EmWlBM8hMC7eBd7g8EWSmBc0gMy3cBq75AOBxITMt3AIiHwAA6AXv7QQAAL0g8gEAgF4Q+QAAQC+IfAAAoBdEPgAA0AsiHwAA6AWRDwAA9ILIBwAAekHkAwAAvSDyAQCAXhD5AABAL4h8AACgF0Q+AADQy/8BMFgxvPoJ+vYAAAAASUVORK5CYII=" width="595" height="176" class="img_CujE"></p><p>Output program bisa dilihat pada gambar berikut:</p><p><img loading="lazy" alt="File, Path, Directory" src="/assets/images/file-path-directory-2-bbe0bb5499225e418b251930c44fb8f6.png" width="887" height="149" class="img_CujE"></p><p>Tipe data variabel <code>paths</code> di atas adalah <code>ReadDir</code> yang merupakan tipe data iterator. Jika digunakan pada keyword <code>for</code>, maka variabel element perulangan <code>path</code> akan bertipe data <code>Result<DirEntry, Error></code>. Dari tipe ini kita bisa mengakses file name maupun file path.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/file_path_directory" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../file_path_directory</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-work-in-progress">◉ Work in progress<a class="hash-link" href="#-work-in-progress" title="Direct link to heading">​</a></h3><ul><li>Pembahasan tentang append content file (<a href="https://stackoverflow.com/questions/30684624/what-is-the-best-variant-for-appending-a-new-line-in-a-text-file" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/30684624/what-is-the-best-variant-for-appending-a-new-line-in-a-text-file</a>)</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/result-type">Tipe Data ➜ Result</a></li><li><a href="/basic/pattern-matching">Pattern Matching</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/std/path/struct.Path.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/path/struct.Path.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/std_misc/path.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/std_misc/path.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/std_misc/fs.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/std_misc/fs.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/datetime"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.52. Date Time</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/unrecoverable-panic-error"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.54. Error ➜ Unrecoverable Error / Panic</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a531-file-path-stdpathpath" class="table-of-contents__link toc-highlight">A.53.1. File path (<code>std::path::Path</code>)</a></li><li><a href="#a532-method-filepath" class="table-of-contents__link toc-highlight">A.53.2. Method filepath</a><ul><li><a href="#-associated-function-pathnew" class="table-of-contents__link toc-highlight">◉ Associated function <code>Path::new()</code></a></li><li><a href="#-method-join" class="table-of-contents__link toc-highlight">◉ Method <code>join()</code></a></li><li><a href="#-method-exists" class="table-of-contents__link toc-highlight">◉ Method <code>exists()</code></a></li><li><a href="#-method-is_file--is_dir" class="table-of-contents__link toc-highlight">◉ Method <code>is_file()</code> & <code>is_dir()</code></a></li><li><a href="#-method-is_absolute--is_relative" class="table-of-contents__link toc-highlight">◉ Method <code>is_absolute()</code> & <code>is_relative()</code></a></li></ul></li><li><a href="#a533-module-stdfs-file-system" class="table-of-contents__link toc-highlight">A.53.3. Module <code>std::fs</code> (file system)</a></li><li><a href="#a534-manajemen-file-system" class="table-of-contents__link toc-highlight">A.53.4. Manajemen file system</a><ul><li><a href="#-pembuatan-folder-fscreate_dir" class="table-of-contents__link toc-highlight">◉ Pembuatan folder (<code>fs::create_dir</code>)</a></li><li><a href="#-menulis-konten-file-fswrite" class="table-of-contents__link toc-highlight">◉ Menulis konten file (<code>fs::write</code>)</a></li><li><a href="#-membaca-isi-file-ke-bentuk-string-fsread_to_string" class="table-of-contents__link toc-highlight">◉ Membaca isi file ke bentuk string (<code>fs::read_to_string</code>)</a></li><li><a href="#-membaca-isi-file-ke-bentuk-vector-fsread" class="table-of-contents__link toc-highlight">◉ Membaca isi file ke bentuk vector (<code>fs::read</code>)</a></li><li><a href="#-menghapus-file-fsremove_file" class="table-of-contents__link toc-highlight">◉ Menghapus file (<code>fs::remove_file</code>)</a></li><li><a href="#-menghapus-folder-fsremove_dir" class="table-of-contents__link toc-highlight">◉ Menghapus folder (<code>fs::remove_dir</code>)</a></li><li><a href="#-list-items-dalam-folder" class="table-of-contents__link toc-highlight">◉ List items dalam folder</a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-work-in-progress" class="table-of-contents__link toc-highlight">◉ Work in progress</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/function.html b/basic/function.html index 39f6aea3..358595a2 100644 --- a/basic/function.html +++ b/basic/function.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/function/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/function/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.17. Function","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/function/#webpage"},"wordCount":1071,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/function/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/function/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/function","name":"A.17. Function","description":"Pada chapter ini kita akan belajar tentang function atau fungsi.","datePublished":"2024-08-01T10:17:28.920Z","dateModified":"2024-08-01T10:17:28.920Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/function/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/function"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/function/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.17. Function","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/function/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/function/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.17. Function","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/function/#webpage"},"wordCount":1071,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/function/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/function/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/function","name":"A.17. Function","description":"Pada chapter ini kita akan belajar tentang function atau fungsi.","datePublished":"2024-08-30T07:44:49.008Z","dateModified":"2024-08-30T07:44:49.008Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/function/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/function"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/function/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.17. Function","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.17. Function</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.17. Function</h1></header><p>Pada chapter ini kita akan belajar tentang <em>function</em> atau fungsi.</p><blockquote><p>Definisi fungsi dalam programming secara terminologi adalah sebuah modul atau sub-program kecil yang digunakan untuk mengeksekusi sebuah perintah, dan bisa di-<em>reuse</em> dalam penggunaannya.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a171-keyword-fn">A.17.1. Keyword <code>fn</code><a class="hash-link" href="#a171-keyword-fn" title="Direct link to heading">​</a></h2><p>Fungsi di Rust dibuat menggunakan keyword <code>fn</code>. Salah satu contoh penerapan keyword ini dalam pembuatan fungsi sudah kita praktikkan berulang kali pada definisi fungsi <code>main</code>, yang merupakan fungsi utama atau entrypoint sebuah program.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>main</code> ini spesial, ketika program dijalankan maka <code>main</code> otomatis dipanggil atau dieksekusi.</p><p>Pembuatan fungsi lainnya-pun juga didefinisikan dengan notasi penulisan yang sama. Pada contoh berikut kita akan buat fungsi bernama <code>greet</code> yang tugasnya adalah menampilkan message ke layar output.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">greet</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello world"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Panggil fungsi tersebut di <code>main</code>, lalu run program.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">greet</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="function" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAABWCAIAAADQTQ/bAAAACXBIWXMAAA7EAAAOxAGVKw4bA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PQEAsCcAAPYEAMCeAACAPQEAsCcAAPYEAMCeAADYEwAA1rDnj5e3v6/P7qItYgH1TQAA7OlaYHIty/H8+vft5QeHHACwJ/YEgLOx50FBUfd77JFHWvTZc6jwb95trfuGlTV1BJWJF2KTmrfka0YPAGADe/aGO/7d/nWUn3CWFKDDnnKRpn5bap1lB2u+vVj2tMJbYk8A2L7n3r84GEmIKvRT2Z5CvcVe/bHsUHlTMmdPrR7sCQC7sWfaJZ5qz2KwmnOf1XMfhwPkItgTAHZlT9N3k2PP6OUMe6oBK/YEgP303HODlY5xT2m3eNjUac/uzTbajFcX1FlYAQBARXteRRPajZ2S/rw6790tLubcs/PgeuQ41Pr28iyFrtdp3h4AALCePQEAAHsCAGBPAADsCQCAPQEAsCcAAGBPAIB69jzv7MjFtfMkEgBsb8/MAhvm98yvHXsCAPbEngCwO3tukx05UdtQjbK4lkfZWnv6mCkAwAr23Co7smo9a/E0j7KVNE8mdSL2BIAaPffa2ZH79fRrOP5vLZ7mUX7O7gP2BIDq9qyWHfnw0bHk8+uRztrW4hkPYk8A2I8962RHboLP59eD4A4GfW5kai2OPQFg/z33atmRj/Z8eXk9fH4od4g/kz56MBTrsqewrxzTBQCoYM+rWtmRm8XHKSs5wR4vbmWhV9Yu7iDoxgYAAJa2JwAAYE8AAOwJAIA9AQCwJwAA9gQAAOwJAIA9AQCwJwAA9gQAwJ4AABDyD9XPgdrqW+DpAAAAAElFTkSuQmCC" width="447" height="86" class="img_ev3q"></p><p>Bisa dilihat ada 2 message muncul, yang pertama adalah pesan <code>hello rust</code> yang muncul hasil eksekusi statement <code>println!("hello rust")</code>, lalu diikuti <code>hello world</code> yang statement print untuk menampilkan message tersebut ada dalam fungsi <code>greet</code>.</p><p>O iya, definisi fungsi tidak mengenal urutan ya. Sebagai contoh fungsi <code>greet</code> dan <code>main</code> di atas, bebas mana yang ditulis lebih dulu.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">greet</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ..</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ..</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... atau ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ..</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">greet</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ..</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a172-naming-convention-fungsi">A.17.2. <em>Naming convention</em> fungsi<a class="hash-link" href="#a172-naming-convention-fungsi" title="Direct link to heading">​</a></h2><p>Sesuai anjuran di <a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">halaman dokumentasi Rust</a>, aturan penulisan nama fungsi di Rust adalah menggunakan <strong>snake case</strong>. Nama fungsi dituliskan dalam huruf kecil dengan separator tanda garis bawah atau underscore (<code>_</code>). Contohnya seperti: <code>main</code>, <code>greet_message</code>, <code>get_report_Status</code>, dll.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a173-parameter-fungsi-dan-argumen-fungsi">A.17.3. Parameter fungsi dan argumen fungsi<a class="hash-link" href="#a173-parameter-fungsi-dan-argumen-fungsi" title="Direct link to heading">​</a></h2><p>Fungsi bisa didefinisikan dengan disertai parameter, dengan itu bisa menyisipkan data saat pemanggilan fungsi.</p><p>Parameter dituliskan di statement pendefinisian fungsi dengan notasi seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">func_name</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">param_a</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">func_name</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">param_a</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> param_b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">func_name</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">param_a</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> param_b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> param_c</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kembali ke praktik, pada bagian ini kita akan buat sebuah fungsi bernama <code>greet_custom_message</code>. Fungsi ini tugasnya masih sama seperti seperti <code>greet</code> hanya saja pesan yang ditampilkan adalah sesuai dengan value parameter fungsi.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">greet_custom_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hi {name}, {message}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ada dua parameter yang didefinisikan:</p><ul><li><code>name</code>, tipe datanya string literal</li><li><code>message</code>, tipe datanya juga string literal</li></ul><p>Kedua nilai parameter tersebut di-<em>combine</em> lalu di-print menggunakan macro <code>println</code>.</p><p>Ok, sekarang panggil fungsi tersebut dalam <code>main</code>, sisipkan argumen pertama <code>Damian</code> yang ditampung parameter <code>name</code>, dan argumen ke-2 <code>welcome to the castle!</code> untuk parameter <code>message</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">greet_custom_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Damian"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"welcome to the castle!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program. Output bisa dilihat di gambar berikut.</p><p><img loading="lazy" alt="function" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAABHCAIAAAAbcNDNAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFG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hhBAYRQghMIoQQmAUIYTAKEIIITCKEEJgFCGELgujz+//Po4H8avD8ePj49/78+wlXCwjk84tUktpl0tToosvpZHPwTczQBAYnRajVZBOQwf6tjC6OntOzTGmMaLo62NUq5G5ZGAUXSpGjQBsY1cGxtWMdTAKRhEqwmhnVTaD2rrmcjHqfewTaIb/6avje3Xx3/uh+fusZhRFP185/S8s52iyOBn5SQp3uGN6t6lFl5RqJjKSl7ofQWAhb3N0uYuNRdLrHvdRUIQ2b7lGYiNrRdrivgQCo8HAre+DcM7PD94Ao20Cz+/HNpn2UnUfnoI6f/2bz0smip4sZ7lp2Vxwip+r+zlokKcbpSqeXz23momMjNAPMyqMHjddQZGEuot9pA4YozWaKNJ5egKj6CIW9RHOCjEq3S89sapvwr+5jNqvUuU0maNVeDf38N70y+5nIYFGmEKOYjXTGeWhI2V0GLqobz/Yi5Tnvm/bC2WzYTRVJDCKbgajge3oruOKMBpHH4nRekvglOlZDUSEBaeK0XC6ENiQwGgyIxNGS9YIJowWFEmqu9xH3uo/sCXzGE0WCYyiW8FobYwEi8Bya1SKPhKj9W14OFbbq8dDRdV0KrE1KmA0WpHqGC0obsYaVbBWjlFjkcSgYh+pAcwYBZXoxjHabgdGe1wfAzAaRk+U0936S2L0vdrOOwU/WaT9+UdmM8GbIQ4qKZwtYGFRn9/QTK6ipYwKootNV1Akre5RH6ml0Aodz1VKkfqxhdClYDRaX2kj2HtuVDyvrc6tFYxqGQnRU7iX72MBBf05iHTc/CHuRwQPdOkn9XUwdbaIM8qVVjupz9MkiK41XUGR4rprfaSMGaFIUiNrRQKjaNMYvQZJJ8kIIQRGrQSFoQghMIoQQmAUIYTAKEIIITCKEEJgFCGEwChCCIFRhBBCYBQhhMAoQgiBUYQQumT9D7YAOuipmiA/AAAAAElFTkSuQmCC" width="450" height="71" class="img_ev3q"></p><p>O iya, parameter bisa memiliki tipe data apa saja selama di-<em>support</em> oleh Rust, jadi tidak hanya string literal <code>&str</code>.</p><blockquote><p>Secara terminologi, parameter adalah variabel yang didefinisikan di fungsi, sedangkan argumen adalah nilai yang disisipkan pada parameter saat pemanggilan fungsi.</p><p>Seiring berjalannya waktu, terjadi <a href="https://doc.rust-lang.org/book/ch03-03-how-functions-work.html#parameters" target="_blank" rel="noopener noreferrer">sedikit perubahan</a> mengenai makna untuk istilah <code>parameter</code> dan <code>argumen</code>. Sekarang kedua istilah tersebut lebih sering dimaknai sama.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a174-nilai-balik-fungsi-return-value">A.17.4. Nilai balik fungsi (<em>return value</em>)<a class="hash-link" href="#a174-nilai-balik-fungsi-return-value" title="Direct link to heading">​</a></h2><p>Sebuah fungsi bisa di-desain memiliki nilai balik. Caranya dengan menambahkan tanda <code>-></code> diikuti tipe data dari nilai balik pada pendefinisian fungsi.</p><p>Pada contoh berikut, sebuah fungsi dibuat dengan nama <code>calculate_box_volume1</code>, memiliki 3 buah parameter bertipe numerik (<code>width</code>, <code>height</code>, dan <code>length</code>), dan nilai balik bertipe data <code>i32</code>. Tugas dari fungsi <code>calculate_box_volume1</code> adalah melakukan operasi matematika perhitungan volume terhadap data yang didapat dari parameter, yang kemudian hasil kalkulasinya dijadikan nilai balik.</p><p>Keyword <code>return</code> (diikuti dengan data) digunakan untuk menentukan nilai balik suatu fungsi. Pada contoh berikut, variabel <code>volume</code> adalah nilai balik fungsi.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_box_volume1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">width</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> height</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> volume </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> width </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> height </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> volume</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Selanjutnya siapkan beberapa variabel yang nantinya digunakan saat pemanggilan <code>calculate_box_volume1</code>. Lalu panggil fungsi tersebut kemudian tampilkan <em>return value</em>-nya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> width </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> height </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> length </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">calculate_box_volume1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">width</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> height</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {res1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program, hasilnya adalah sesuai harapan. Volume dari persegi panjang dengan data <code>5 x 8 x 12</code> adalah <code>480</code>.</p><p><img loading="lazy" alt="function" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcMAAABACAIAAADpt4tLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvI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CpAghdJ36D8Tes0xqHRCFAAAAAElFTkSuQmCC" width="451" height="64" class="img_ev3q"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-keyword-return-untuk-penentuan-nilai-balik">◉ Keyword <code>return</code> untuk penentuan nilai balik<a class="hash-link" href="#-keyword-return-untuk-penentuan-nilai-balik" title="Direct link to heading">​</a></h3><p>Salah satu hal yang unik yang ada di Rust adalah beberapa variasi cara penulisan nilai balik fungsi. Cara pertama adalah menggunakan keyword <code>return</code> seperti yang sudah dipraktikkan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_box_volume1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">width</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> height</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> volume </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> width </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> height </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> volume</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Untuk cara ini penulis rasa cukup jelas.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-return-value-tanpa-keyword-return">◉ <em>Return value</em> tanpa keyword <code>return</code><a class="hash-link" href="#-return-value-tanpa-keyword-return" title="Direct link to heading">​</a></h3><p>Cara ke-2 kita langsung praktikkan menggunakan kode berikut, silakan tulis lalu jalankan program:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_box_volume2</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">width</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> height</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> volume </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> width </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> height </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> volume</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> name2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Damian"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">calculate_box_volume2</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">width</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> height</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hi {name2}, the box volume is {res2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Hasilnya kurang lebih sama, hanya di-bagian outputnya beda karena pada contoh ini pesan yang ditampilkan diubah.</p><p><img loading="lazy" alt="function" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb4AAABDCAIAAABslPfNAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZW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WkL3tDbLPUftOLSqxVh9B0EWi0yXxGntlNbosj8XwQs4bnW0rMbmPOtKHM9Ch4xsQpoP1LQtBY9FpvKCG3G7Yb9kvATpXruaH7wBWaz+IyGg6/QkfF9o+Or0L0I9c62KQopN9JO5DdwUcv/p47x2Pt+CAKAUl2U9Hjn/F9axe2zJHR2672ffRshN/qqs8n1Tc1xlHX7Rnck4ZnexT/0GxvN3FK/dRqTtOSbve64tms1hfzz4Rz4JrF9oyOuklTodr2aOJLvXhBA/vH8NphkMDMMj/ycUTTpNkz9ZziteZnpO0KV8QW4IOuWgWlyCgzx2OLJY16GAW5Zx2dEqWNzdT6yOzt+tPTzogzB++QbR7+pkCi3boTBbs1ZdHDIKETvQCZpdPDp1S/XL1nGXBPnw4OWlvuQYp5nGmkOYSwifn/eUrznNItM3AUkNnYvmaZupjw9YHiq/p+Uhoevyz92XjyRWCLhqdkY9I13NV6EyzN0NnurY3otN9istISihX22cZyJk951h0VjRTtbnfRMhljXxJ6nUGJz+sS/jWObxO6HOgs2NDtMdf73VK2Zuis2Ihymr9713frOy+fzMsjUNFor0A1eYj0Vm/XyznyN3S4Y9g9Ip3CDqHPT0IpxP6FOgM21fRNtphBDrj7Jl6xk+9lPfcsm23r0Rpdrqfx/YlY/wZ9hUdNI+QZfedhHMq6CQlHvQFu72ZxcFg3nr2fc4L75rH76bhLhF0luhMlnPaNcacCo7CIed7bsdNLkjInkN84Kvl8jdsArBalW4TpcmIUcjtcX4D3vC4LGtQck6tj/zhzsXNTVpjmklNdzhUPoMp3AhSBw64CW0cnZcgPAQIQRDQWUtNcBOCIKATgiAI6IQgCAI6IQiCgE4IgiAI6IQgCAI6IQiCgE4IgqDz0X/zfGzz8c5AEgAAAABJRU5ErkJggg==" width="446" height="67" class="img_ev3q"></p><p>Sekarang kita fokus ke kode yang sudah ditulis. Fungsi <code>calculate_box_volume2</code> kurang lebih struktur dan isinya sama seperti <code>calculate_box_volume1</code>, bedanya hanya pada dua hal:</p><ul><li>Fungsi <code>calculate_box_volume2</code> nilai baliknya dituliskan tanpa keyword <code>return</code></li><li>Fungsi <code>calculate_box_volume2</code> pada statement terakhir tidak diakhir tanda akhir statement <code>;</code></li></ul><p>Kedua poin tersebut merupakan syarat untuk penerapan <em>return value</em> tanpa keyword <code>return</code>. Caranya kurang lebih adalah dengan menuliskan data nilai balik dengan tanpa keyword <code>return</code> dan di akhir statement tidak ditambahi tanda semicolon <code>;</code>.</p><blockquote><p>Statement terakhir sebuah blok kode fungsi yang ditulis tanpa semicolon <code>;</code> disebut sebagai <code>tail</code> atau <code>body tail</code>.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-statemen-sebagai-return-value-tanpa-keyword-return">◉ Statemen sebagai <em>return value</em> tanpa keyword <code>return</code><a class="hash-link" href="#-statemen-sebagai-return-value-tanpa-keyword-return" title="Direct link to heading">​</a></h3><p>Cara selanjutnya yang akan kita bahas ini sebenarnya sama seperti sebelumnya, hanya saja bedanya di sini tidak menggunakan nama variabel sebagai nilai balik, melainkan langsung statement, yang hasil eksekusi statement tersebut dijadikan nilai balik fungsi.</p><p>Langsung saja kita praktikkan. Siapkan fungsi <code>calculate_box_volume3</code> berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_box_volume3</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">width</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> height</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> width </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> height </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> length</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">greet_custom_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hi {name}, {message}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Panggil fungsi tersebut, tampung nilai baliknya ke variabel <code>res3</code>. Lalu siapkan <code>message3</code> yang isinya adalah sebuah pesan string literal yang dibuat menggunakan macro <code>format</code>. Terakhir tampilkan pesan tersebut menggunakan fungsi <code>greet_custom_message</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">calculate_box_volume3</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">width</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> height</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the box volume is {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> res3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">greet_custom_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Damian"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message3</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat hasilnya sama seperti pada program sebelumnya.</p><p><img loading="lazy" alt="function" src="data:image/png;base64,iVBORw0KGgo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U5ErkJggg==" width="446" height="67" class="img_ev3q"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-macro-format-untuk-membuat-formatted-string">◉ Macro <code>format</code> untuk membuat <em>formatted</em> string<a class="hash-link" href="#-macro-format-untuk-membuat-formatted-string" title="Direct link to heading">​</a></h3><p>Bagian ini adalah penjelasan tambahan dari kode program yang baru saja dipraktikkan.</p><p>Macro <code>format</code> digunakan untuk <em>formatting</em> sebuah string. <em>Formatting</em> di sini maksudnya adalah pembuatan string dengan menggunakan teknik penyusunan isi string dalam format tertentu, mirip seperti yang dilakukan menggunakan macro <code>print</code> atau <code>println</code>, bedanya hanya pada macro <code>format</code> hasilnya bukan sebuah output ke console output, melainkan sebagai nilai balik.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// 2 bari statements berikut ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the box volume is {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> res3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message3</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... adalah sama dengan statement berikut ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the box volume is {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> res3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Satu hal yang penting diketahui dari macro <code>format</code>. Nilai balik macro ini bukanlah string literal <code>&str</code>, tetapi tipe <code>String</code>. <strong>Dua tipe tersebut adalah berbeda</strong>.</p><p>Pada contoh di atas, method <code>as_str</code> milik tipe data <code>String</code> digunakan untuk mengambil data string literal-nya. Method <code>as_str</code> ini menghasilkan data bertipe <code>&str</code> dari sebuah <code>String</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a175-conditional-return-value">A.17.5. <em>Conditional return value</em><a class="hash-link" href="#a175-conditional-return-value" title="Direct link to heading">​</a></h2><p>Kapan harus menggunakan keyword <code>return</code> dalam penentuan nilai balik dan kapan tidak? Jawabannya mungkin adalah preferensi, tapi di luar itu ada juga case di mana keyword <code>return</code> harus digunakan, yaitu pada fungsi yang memiliki nilai balik terkondisi. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_score_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">score</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> score </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100.0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"you got a perfect score!"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> score </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">76.0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"congrats, you passed the exam!"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"your score is below the passing grade"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">get_score_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">100.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">get_score_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">98.2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">get_score_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">33.12</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="function" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb4AAABkCAIAAAB2PcJDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luP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EOgsGXGr+3NJLGyE7OrcxBkag0zbwDGsle/PSRqATIYQQ6EQIIdCJEEKgEyGEQCdCCIFOhBBCvf4H243KXipxqzoAAAAASUVORK5CYII=" width="446" height="100" class="img_ev3q"></p><p>Teknik penentuan nilai balik tanpa keyword <code>return</code> hanya bisa dipergunakan di akhir blok kode, contohnya pada fungsi <code>get_score_message</code> statement terakhir blok kode adalah string literal <code>"your score is below the passing grade"</code>.</p><p><strong>Jika pada selain akhir blok ada kondisi di mana nilai balik harus ditentukan, maka wajib menggunakan keyword <code>return</code></strong>. Bisa dilihat pada fungsi yang sudah ditulis, <code>return</code> statement dalam blok kode seleksi kondisi <code>if</code> dipergunakan.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a176-nilai-balik-fungsi-bertipe-string-literal-str">A.17.6. Nilai balik fungsi bertipe string literal <code>&str</code><a class="hash-link" href="#a176-nilai-balik-fungsi-bertipe-string-literal-str" title="Direct link to heading">​</a></h2><p>Khusus untuk beberapa jenis tipe data, seperti <code>&str</code>, jika digunakan sebagai tipe data <em>return value</em> fungsi harus ditambahi keyword <code>static</code> dengan penulisan <code>&'static str</code>. Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_score_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">score</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"you got a perfect score!"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Agar tidak makin bingung, pembahasannya dipisah pada chapter lain, yaitu <a href="/basic/static">Static</a> dan <a href="/basic/lifetime">Lifetime</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a177-default-return-value">A.17.7. <em>Default return value</em><a class="hash-link" href="#a177-default-return-value" title="Direct link to heading">​</a></h2><p>Tambahan info saja, bahwa di Rust, semua fungsi itu memiliki nilai balik, yep semuanya. Untuk fungsi yang tidak didefinisikan nilai baliknya maka nilai baliknya adalah tuple kosong <code>()</code>. Sebagai contoh fungsi <code>greet_custom_message</code> yang sudah ditulis, coba saja tampung nilai baliknya dan print. Outputnya adalah <em>empty tuple</em> atau tuple kosong <code>()</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">greet_custom_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Damian"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"welcome to the castle!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> a</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="function" src="/assets/images/function-6-2ed9468eff22575ec04867323e17a7b2.png" width="628" height="237" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a178-pembahasan-lanjutan">A.17.8. Pembahasan lanjutan<a class="hash-link" href="#a178-pembahasan-lanjutan" title="Direct link to heading">​</a></h2><p>Ada beberapa topik lainnya yang relevan dengan function, yaitu:</p><ul><li><strong>Associated function</strong>, pembahasannya ada di chapter <a href="/basic/associated-function">Associated Function</a></li><li><strong>Method</strong>, pembahasannya juga di chapter terpisah, yaitu <a href="/basic/method">Method</a></li></ul><p>Selain itu nantinya juga ada pembahasan mengenai topik yang cukup advance yang berhubungan dengan fungsi, yaitu:</p><ul><li><strong>Unsafe function</strong>, pembahasannya ada di chapter <a href="#/wip/safe-unsafe">Safe & Unsafe</a></li><li><strong>Async function</strong>, pembahasannya ada di chapter <a href="#/wip/async">Async</a></li><li><strong>Constant function</strong>, pembahasannya ada di chapter <a href="#/wip/constant-evaluation">Constant Evaluation</a></li><li><strong>Trait ➜ Function</strong>, pembahasannya ada di chapter <a href="/basic/trait-function">Trait ➜ Function</a></li></ul><p>Untuk sekarang silakan lanjut ke pembahasan chapter berikutnya terlebih dahulu, jangan langsung loncat ke chapter di atas.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/function" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../function</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-work-in-progress">◉ Work in progress<a class="hash-link" href="#-work-in-progress" title="Direct link to heading">​</a></h3><ul><li>Pembahasan tentang diverging function (<code>() -> !</code>)</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch03-03-how-functions-work.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch03-03-how-functions-work.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.fn.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.fn.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.return.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.return.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.static.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.static.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/fn.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/fn.html</a></li><li><a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">https://rust-lang.github.io/api-guidelines/naming.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/vector"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.16. Vector</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/path-item"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.18. Module System ➜ Path & Item</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a171-keyword-fn" class="table-of-contents__link toc-highlight">A.17.1. Keyword <code>fn</code></a></li><li><a href="#a172-naming-convention-fungsi" class="table-of-contents__link toc-highlight">A.17.2. <em>Naming convention</em> fungsi</a></li><li><a href="#a173-parameter-fungsi-dan-argumen-fungsi" class="table-of-contents__link toc-highlight">A.17.3. Parameter fungsi dan argumen fungsi</a></li><li><a href="#a174-nilai-balik-fungsi-return-value" class="table-of-contents__link toc-highlight">A.17.4. Nilai balik fungsi (<em>return value</em>)</a><ul><li><a href="#-keyword-return-untuk-penentuan-nilai-balik" class="table-of-contents__link toc-highlight">◉ Keyword <code>return</code> untuk penentuan nilai balik</a></li><li><a href="#-return-value-tanpa-keyword-return" class="table-of-contents__link toc-highlight">◉ <em>Return value</em> tanpa keyword <code>return</code></a></li><li><a href="#-statemen-sebagai-return-value-tanpa-keyword-return" class="table-of-contents__link toc-highlight">◉ Statemen sebagai <em>return value</em> tanpa keyword <code>return</code></a></li><li><a href="#-macro-format-untuk-membuat-formatted-string" class="table-of-contents__link toc-highlight">◉ Macro <code>format</code> untuk membuat <em>formatted</em> string</a></li></ul></li><li><a href="#a175-conditional-return-value" class="table-of-contents__link toc-highlight">A.17.5. <em>Conditional return value</em></a></li><li><a href="#a176-nilai-balik-fungsi-bertipe-string-literal-str" class="table-of-contents__link toc-highlight">A.17.6. Nilai balik fungsi bertipe string literal <code>&str</code></a></li><li><a href="#a177-default-return-value" class="table-of-contents__link toc-highlight">A.17.7. <em>Default return value</em></a></li><li><a href="#a178-pembahasan-lanjutan" class="table-of-contents__link toc-highlight">A.17.8. Pembahasan lanjutan</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-work-in-progress" class="table-of-contents__link toc-highlight">◉ Work in progress</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.17. Function</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.17. Function</h1></header><p>Pada chapter ini kita akan belajar tentang <em>function</em> atau fungsi.</p><blockquote><p>Definisi fungsi dalam programming secara terminologi adalah sebuah modul atau sub-program kecil yang digunakan untuk mengeksekusi sebuah perintah, dan bisa di-<em>reuse</em> dalam penggunaannya.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a171-keyword-fn">A.17.1. Keyword <code>fn</code><a class="hash-link" href="#a171-keyword-fn" title="Direct link to heading">​</a></h2><p>Fungsi di Rust dibuat menggunakan keyword <code>fn</code>. Salah satu contoh penerapan keyword ini dalam pembuatan fungsi sudah kita praktikkan berulang kali pada definisi fungsi <code>main</code>, yang merupakan fungsi utama atau entrypoint sebuah program.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>main</code> ini spesial, ketika program dijalankan maka <code>main</code> otomatis dipanggil atau dieksekusi.</p><p>Pembuatan fungsi lainnya-pun juga didefinisikan dengan notasi penulisan yang sama. Pada contoh berikut kita akan buat fungsi bernama <code>greet</code> yang tugasnya adalah menampilkan message ke layar output.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">greet</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello world"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Panggil fungsi tersebut di <code>main</code>, lalu run program.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">greet</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="function" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAABWCAIAAADQTQ/bAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGG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CcAAPYEAMCeAACAPQEAsCcAAPYEAMCeAADYEwAA1rDnj5e3v6/P7qItYgH1TQAA7OlaYHIty/H8+vft5QeHHACwJ/YEgLOx50FBUfd77JFHWvTZc6jwb95trfuGlTV1BJWJF2KTmrfka0YPAGADe/aGO/7d/nWUn3CWFKDDnnKRpn5bap1lB2u+vVj2tMJbYk8A2L7n3r84GEmIKvRT2Z5CvcVe/bHsUHlTMmdPrR7sCQC7sWfaJZ5qz2KwmnOf1XMfhwPkItgTAHZlT9N3k2PP6OUMe6oBK/YEgP303HODlY5xT2m3eNjUac/uzTbajFcX1FlYAQBARXteRRPajZ2S/rw6790tLubcs/PgeuQ41Pr28iyFrtdp3h4AALCePQEAAHsCAGBPAADsCQCAPQEAsCcAAGBPAIB69jzv7MjFtfMkEgBsb8/MAhvm98yvHXsCAPbEngCwO3tukx05UdtQjbK4lkfZWnv6mCkAwAr23Co7smo9a/E0j7KVNE8mdSL2BIAaPffa2ZH79fRrOP5vLZ7mUX7O7gP2BIDq9qyWHfnw0bHk8+uRztrW4hkPYk8A2I8962RHboLP59eD4A4GfW5kai2OPQFg/z33atmRj/Z8eXk9fH4od4g/kz56MBTrsqewrxzTBQCoYM+rWtmRm8XHKSs5wR4vbmWhV9Yu7iDoxgYAAJa2JwAAYE8AAOwJAIA9AQCwJwAA9gQAAOwJAIA9AQCwJwAA9gQAwJ4AABDyD9XPgdrqW+DpAAAAAElFTkSuQmCC" width="447" height="86" class="img_CujE"></p><p>Bisa dilihat ada 2 message muncul, yang pertama adalah pesan <code>hello rust</code> yang muncul hasil eksekusi statement <code>println!("hello rust")</code>, lalu diikuti <code>hello world</code> yang statement print untuk menampilkan message tersebut ada dalam fungsi <code>greet</code>.</p><p>O iya, definisi fungsi tidak mengenal urutan ya. Sebagai contoh fungsi <code>greet</code> dan <code>main</code> di atas, bebas mana yang ditulis lebih dulu.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">greet</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ..</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ..</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... atau ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ..</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">greet</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ..</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a172-naming-convention-fungsi">A.17.2. <em>Naming convention</em> fungsi<a class="hash-link" href="#a172-naming-convention-fungsi" title="Direct link to heading">​</a></h2><p>Sesuai anjuran di <a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">halaman dokumentasi Rust</a>, aturan penulisan nama fungsi di Rust adalah menggunakan <strong>snake case</strong>. Nama fungsi dituliskan dalam huruf kecil dengan separator tanda garis bawah atau underscore (<code>_</code>). Contohnya seperti: <code>main</code>, <code>greet_message</code>, <code>get_report_Status</code>, dll.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a173-parameter-fungsi-dan-argumen-fungsi">A.17.3. Parameter fungsi dan argumen fungsi<a class="hash-link" href="#a173-parameter-fungsi-dan-argumen-fungsi" title="Direct link to heading">​</a></h2><p>Fungsi bisa didefinisikan dengan disertai parameter, dengan itu bisa menyisipkan data saat pemanggilan fungsi.</p><p>Parameter dituliskan di statement pendefinisian fungsi dengan notasi seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">func_name</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">param_a</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">func_name</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">param_a</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> param_b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">func_name</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">param_a</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> param_b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> param_c</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kembali ke praktik, pada bagian ini kita akan buat sebuah fungsi bernama <code>greet_custom_message</code>. Fungsi ini tugasnya masih sama seperti seperti <code>greet</code> hanya saja pesan yang ditampilkan adalah sesuai dengan value parameter fungsi.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">greet_custom_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hi {name}, {message}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ada dua parameter yang didefinisikan:</p><ul><li><code>name</code>, tipe datanya string literal</li><li><code>message</code>, tipe datanya juga string literal</li></ul><p>Kedua nilai parameter tersebut di-<em>combine</em> lalu di-print menggunakan macro <code>println</code>.</p><p>Ok, sekarang panggil fungsi tersebut dalam <code>main</code>, sisipkan argumen pertama <code>Damian</code> yang ditampung parameter <code>name</code>, dan argumen ke-2 <code>welcome to the castle!</code> untuk parameter <code>message</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">greet_custom_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Damian"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"welcome to the castle!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program. Output bisa dilihat di gambar berikut.</p><p><img loading="lazy" alt="function" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAABHCAIAAAAbcNDNAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHR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QghMIoQQmAUIYTAKEIIITCKEEJgFCGELgujz+//Po4H8avD8ePj49/78+wlXCwjk84tUktpl0tToosvpZHPwTczQBAYnRajVZBOQwf6tjC6OntOzTGmMaLo62NUq5G5ZGAUXSpGjQBsY1cGxtWMdTAKRhEqwmhnVTaD2rrmcjHqfewTaIb/6avje3Xx3/uh+fusZhRFP185/S8s52iyOBn5SQp3uGN6t6lFl5RqJjKSl7ofQWAhb3N0uYuNRdLrHvdRUIQ2b7lGYiNrRdrivgQCo8HAre+DcM7PD94Ao20Cz+/HNpn2UnUfnoI6f/2bz0smip4sZ7lp2Vxwip+r+zlokKcbpSqeXz23momMjNAPMyqMHjddQZGEuot9pA4YozWaKNJ5egKj6CIW9RHOCjEq3S89sapvwr+5jNqvUuU0maNVeDf38N70y+5nIYFGmEKOYjXTGeWhI2V0GLqobz/Yi5Tnvm/bC2WzYTRVJDCKbgajge3oruOKMBpHH4nRekvglOlZDUSEBaeK0XC6ENiQwGgyIxNGS9YIJowWFEmqu9xH3uo/sCXzGE0WCYyiW8FobYwEi8Bya1SKPhKj9W14OFbbq8dDRdV0KrE1KmA0WpHqGC0obsYaVbBWjlFjkcSgYh+pAcwYBZXoxjHabgdGe1wfAzAaRk+U0936S2L0vdrOOwU/WaT9+UdmM8GbIQ4qKZwtYGFRn9/QTK6ipYwKootNV1Akre5RH6ml0Aodz1VKkfqxhdClYDRaX2kj2HtuVDyvrc6tFYxqGQnRU7iX72MBBf05iHTc/CHuRwQPdOkn9XUwdbaIM8qVVjupz9MkiK41XUGR4rprfaSMGaFIUiNrRQKjaNMYvQZJJ8kIIQRGrQSFoQghMIoQQmAUIYTAKEIIITCKEEJgFCGEwChCCIFRhBBCYBQhhMAoQgiBUYQQumT9D7YAOuipmiA/AAAAAElFTkSuQmCC" width="450" height="71" class="img_CujE"></p><p>O iya, parameter bisa memiliki tipe data apa saja selama di-<em>support</em> oleh Rust, jadi tidak hanya string literal <code>&str</code>.</p><blockquote><p>Secara terminologi, parameter adalah variabel yang didefinisikan di fungsi, sedangkan argumen adalah nilai yang disisipkan pada parameter saat pemanggilan fungsi.</p><p>Seiring berjalannya waktu, terjadi <a href="https://doc.rust-lang.org/book/ch03-03-how-functions-work.html#parameters" target="_blank" rel="noopener noreferrer">sedikit perubahan</a> mengenai makna untuk istilah <code>parameter</code> dan <code>argumen</code>. Sekarang kedua istilah tersebut lebih sering dimaknai sama.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a174-nilai-balik-fungsi-return-value">A.17.4. Nilai balik fungsi (<em>return value</em>)<a class="hash-link" href="#a174-nilai-balik-fungsi-return-value" title="Direct link to heading">​</a></h2><p>Sebuah fungsi bisa di-desain memiliki nilai balik. Caranya dengan menambahkan tanda <code>-></code> diikuti tipe data dari nilai balik pada pendefinisian fungsi.</p><p>Pada contoh berikut, sebuah fungsi dibuat dengan nama <code>calculate_box_volume1</code>, memiliki 3 buah parameter bertipe numerik (<code>width</code>, <code>height</code>, dan <code>length</code>), dan nilai balik bertipe data <code>i32</code>. Tugas dari fungsi <code>calculate_box_volume1</code> adalah melakukan operasi matematika perhitungan volume terhadap data yang didapat dari parameter, yang kemudian hasil kalkulasinya dijadikan nilai balik.</p><p>Keyword <code>return</code> (diikuti dengan data) digunakan untuk menentukan nilai balik suatu fungsi. Pada contoh berikut, variabel <code>volume</code> adalah nilai balik fungsi.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_box_volume1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">width</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> height</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> volume </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> width </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> height </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> volume</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Selanjutnya siapkan beberapa variabel yang nantinya digunakan saat pemanggilan <code>calculate_box_volume1</code>. Lalu panggil fungsi tersebut kemudian tampilkan <em>return value</em>-nya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> width </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> height </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> length </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">calculate_box_volume1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">width</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> height</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {res1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program, hasilnya adalah sesuai harapan. Volume dari persegi panjang dengan data <code>5 x 8 x 12</code> adalah <code>480</code>.</p><p><img loading="lazy" alt="function" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcMAAABACAIAAADpt4tLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxu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36D8Tes0xqHRCFAAAAAElFTkSuQmCC" width="451" height="64" class="img_CujE"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-keyword-return-untuk-penentuan-nilai-balik">◉ Keyword <code>return</code> untuk penentuan nilai balik<a class="hash-link" href="#-keyword-return-untuk-penentuan-nilai-balik" title="Direct link to heading">​</a></h3><p>Salah satu hal yang unik yang ada di Rust adalah beberapa variasi cara penulisan nilai balik fungsi. Cara pertama adalah menggunakan keyword <code>return</code> seperti yang sudah dipraktikkan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_box_volume1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">width</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> height</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> volume </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> width </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> height </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> volume</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Untuk cara ini penulis rasa cukup jelas.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-return-value-tanpa-keyword-return">◉ <em>Return value</em> tanpa keyword <code>return</code><a class="hash-link" href="#-return-value-tanpa-keyword-return" title="Direct link to heading">​</a></h3><p>Cara ke-2 kita langsung praktikkan menggunakan kode berikut, silakan tulis lalu jalankan program:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_box_volume2</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">width</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> height</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> volume </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> width </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> height </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> volume</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> name2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Damian"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">calculate_box_volume2</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">width</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> height</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hi {name2}, the box volume is {res2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Hasilnya kurang lebih sama, hanya di-bagian outputnya beda karena pada contoh ini pesan yang ditampilkan diubah.</p><p><img loading="lazy" alt="function" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb4AAABDCAIAAABslPfNAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZV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PUftOLSqxVh9B0EWi0yXxGntlNbosj8XwQs4bnW0rMbmPOtKHM9Ch4xsQpoP1LQtBY9FpvKCG3G7Yb9kvATpXruaH7wBWaz+IyGg6/QkfF9o+Or0L0I9c62KQopN9JO5DdwUcv/p47x2Pt+CAKAUl2U9Hjn/F9axe2zJHR2672ffRshN/qqs8n1Tc1xlHX7Rnck4ZnexT/0GxvN3FK/dRqTtOSbve64tms1hfzz4Rz4JrF9oyOuklTodr2aOJLvXhBA/vH8NphkMDMMj/ycUTTpNkz9ZziteZnpO0KV8QW4IOuWgWlyCgzx2OLJY16GAW5Zx2dEqWNzdT6yOzt+tPTzogzB++QbR7+pkCi3boTBbs1ZdHDIKETvQCZpdPDp1S/XL1nGXBPnw4OWlvuQYp5nGmkOYSwifn/eUrznNItM3AUkNnYvmaZupjw9YHiq/p+Uhoevyz92XjyRWCLhqdkY9I13NV6EyzN0NnurY3otN9istISihX22cZyJk951h0VjRTtbnfRMhljXxJ6nUGJz+sS/jWObxO6HOgs2NDtMdf73VK2Zuis2Ihymr9713frOy+fzMsjUNFor0A1eYj0Vm/XyznyN3S4Y9g9Ip3CDqHPT0IpxP6FOgM21fRNtphBDrj7Jl6xk+9lPfcsm23r0Rpdrqfx/YlY/wZ9hUdNI+QZfedhHMq6CQlHvQFu72ZxcFg3nr2fc4L75rH76bhLhF0luhMlnPaNcacCo7CIed7bsdNLkjInkN84Kvl8jdsArBalW4TpcmIUcjtcX4D3vC4LGtQck6tj/zhzsXNTVpjmklNdzhUPoMp3AhSBw64CW0cnZcgPAQIQRDQWUtNcBOCIKATgiAI6IQgCAI6IQiCgE4IgiAI6IQgCAI6IQiCgE4IgqDz0X/zfGzz8c5AEgAAAABJRU5ErkJggg==" width="446" height="67" class="img_CujE"></p><p>Sekarang kita fokus ke kode yang sudah ditulis. Fungsi <code>calculate_box_volume2</code> kurang lebih struktur dan isinya sama seperti <code>calculate_box_volume1</code>, bedanya hanya pada dua hal:</p><ul><li>Fungsi <code>calculate_box_volume2</code> nilai baliknya dituliskan tanpa keyword <code>return</code></li><li>Fungsi <code>calculate_box_volume2</code> pada statement terakhir tidak diakhir tanda akhir statement <code>;</code></li></ul><p>Kedua poin tersebut merupakan syarat untuk penerapan <em>return value</em> tanpa keyword <code>return</code>. Caranya kurang lebih adalah dengan menuliskan data nilai balik dengan tanpa keyword <code>return</code> dan di akhir statement tidak ditambahi tanda semicolon <code>;</code>.</p><blockquote><p>Statement terakhir sebuah blok kode fungsi yang ditulis tanpa semicolon <code>;</code> disebut sebagai <code>tail</code> atau <code>body tail</code>.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-statemen-sebagai-return-value-tanpa-keyword-return">◉ Statemen sebagai <em>return value</em> tanpa keyword <code>return</code><a class="hash-link" href="#-statemen-sebagai-return-value-tanpa-keyword-return" title="Direct link to heading">​</a></h3><p>Cara selanjutnya yang akan kita bahas ini sebenarnya sama seperti sebelumnya, hanya saja bedanya di sini tidak menggunakan nama variabel sebagai nilai balik, melainkan langsung statement, yang hasil eksekusi statement tersebut dijadikan nilai balik fungsi.</p><p>Langsung saja kita praktikkan. Siapkan fungsi <code>calculate_box_volume3</code> berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">calculate_box_volume3</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">width</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> height</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> width </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> height </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> length</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">greet_custom_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hi {name}, {message}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Panggil fungsi tersebut, tampung nilai baliknya ke variabel <code>res3</code>. Lalu siapkan <code>message3</code> yang isinya adalah sebuah pesan string literal yang dibuat menggunakan macro <code>format</code>. Terakhir tampilkan pesan tersebut menggunakan fungsi <code>greet_custom_message</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">calculate_box_volume3</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">width</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> height</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the box volume is {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> res3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">greet_custom_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Damian"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message3</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat hasilnya sama seperti pada program sebelumnya.</p><p><img loading="lazy" alt="function" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEU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" width="446" height="67" class="img_CujE"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-macro-format-untuk-membuat-formatted-string">◉ Macro <code>format</code> untuk membuat <em>formatted</em> string<a class="hash-link" href="#-macro-format-untuk-membuat-formatted-string" title="Direct link to heading">​</a></h3><p>Bagian ini adalah penjelasan tambahan dari kode program yang baru saja dipraktikkan.</p><p>Macro <code>format</code> digunakan untuk <em>formatting</em> sebuah string. <em>Formatting</em> di sini maksudnya adalah pembuatan string dengan menggunakan teknik penyusunan isi string dalam format tertentu, mirip seperti yang dilakukan menggunakan macro <code>print</code> atau <code>println</code>, bedanya hanya pada macro <code>format</code> hasilnya bukan sebuah output ke console output, melainkan sebagai nilai balik.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// 2 bari statements berikut ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the box volume is {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> res3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message3</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... adalah sama dengan statement berikut ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the box volume is {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> res3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Satu hal yang penting diketahui dari macro <code>format</code>. Nilai balik macro ini bukanlah string literal <code>&str</code>, tetapi tipe <code>String</code>. <strong>Dua tipe tersebut adalah berbeda</strong>.</p><p>Pada contoh di atas, method <code>as_str</code> milik tipe data <code>String</code> digunakan untuk mengambil data string literal-nya. Method <code>as_str</code> ini menghasilkan data bertipe <code>&str</code> dari sebuah <code>String</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a175-conditional-return-value">A.17.5. <em>Conditional return value</em><a class="hash-link" href="#a175-conditional-return-value" title="Direct link to heading">​</a></h2><p>Kapan harus menggunakan keyword <code>return</code> dalam penentuan nilai balik dan kapan tidak? Jawabannya mungkin adalah preferensi, tapi di luar itu ada juga case di mana keyword <code>return</code> harus digunakan, yaitu pada fungsi yang memiliki nilai balik terkondisi. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_score_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">score</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> score </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100.0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"you got a perfect score!"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> score </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">76.0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"congrats, you passed the exam!"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"your score is below the passing grade"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">get_score_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">100.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">get_score_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">98.2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">get_score_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">33.12</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="function" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb4AAABkCAIAAAB2PcJDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlk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NJLGyE7OrcxBkag0zbwDGsle/PSRqATIYQQ6EQIIdCJEEKgEyGEQCdCCIFOhBBCvf4H243KXipxqzoAAAAASUVORK5CYII=" width="446" height="100" class="img_CujE"></p><p>Teknik penentuan nilai balik tanpa keyword <code>return</code> hanya bisa dipergunakan di akhir blok kode, contohnya pada fungsi <code>get_score_message</code> statement terakhir blok kode adalah string literal <code>"your score is below the passing grade"</code>.</p><p><strong>Jika pada selain akhir blok ada kondisi di mana nilai balik harus ditentukan, maka wajib menggunakan keyword <code>return</code></strong>. Bisa dilihat pada fungsi yang sudah ditulis, <code>return</code> statement dalam blok kode seleksi kondisi <code>if</code> dipergunakan.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a176-nilai-balik-fungsi-bertipe-string-literal-str">A.17.6. Nilai balik fungsi bertipe string literal <code>&str</code><a class="hash-link" href="#a176-nilai-balik-fungsi-bertipe-string-literal-str" title="Direct link to heading">​</a></h2><p>Khusus untuk beberapa jenis tipe data, seperti <code>&str</code>, jika digunakan sebagai tipe data <em>return value</em> fungsi harus ditambahi keyword <code>static</code> dengan penulisan <code>&'static str</code>. Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_score_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">score</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"you got a perfect score!"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Agar tidak makin bingung, pembahasannya dipisah pada chapter lain, yaitu <a href="/basic/static">Static</a> dan <a href="/basic/lifetime">Lifetime</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a177-default-return-value">A.17.7. <em>Default return value</em><a class="hash-link" href="#a177-default-return-value" title="Direct link to heading">​</a></h2><p>Tambahan info saja, bahwa di Rust, semua fungsi itu memiliki nilai balik, yep semuanya. Untuk fungsi yang tidak didefinisikan nilai baliknya maka nilai baliknya adalah tuple kosong <code>()</code>. Sebagai contoh fungsi <code>greet_custom_message</code> yang sudah ditulis, coba saja tampung nilai baliknya dan print. Outputnya adalah <em>empty tuple</em> atau tuple kosong <code>()</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">greet_custom_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Damian"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"welcome to the castle!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> a</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="function" src="/assets/images/function-6-2ed9468eff22575ec04867323e17a7b2.png" width="628" height="237" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a178-pembahasan-lanjutan">A.17.8. Pembahasan lanjutan<a class="hash-link" href="#a178-pembahasan-lanjutan" title="Direct link to heading">​</a></h2><p>Ada beberapa topik lainnya yang relevan dengan function, yaitu:</p><ul><li><strong>Associated function</strong>, pembahasannya ada di chapter <a href="/basic/associated-function">Associated Function</a></li><li><strong>Method</strong>, pembahasannya juga di chapter terpisah, yaitu <a href="/basic/method">Method</a></li></ul><p>Selain itu nantinya juga ada pembahasan mengenai topik yang cukup advance yang berhubungan dengan fungsi, yaitu:</p><ul><li><strong>Unsafe function</strong>, pembahasannya ada di chapter <a href="#/wip/safe-unsafe">Safe & Unsafe</a></li><li><strong>Async function</strong>, pembahasannya ada di chapter <a href="#/wip/async">Async</a></li><li><strong>Constant function</strong>, pembahasannya ada di chapter <a href="#/wip/constant-evaluation">Constant Evaluation</a></li><li><strong>Trait ➜ Function</strong>, pembahasannya ada di chapter <a href="/basic/trait-function">Trait ➜ Function</a></li></ul><p>Untuk sekarang silakan lanjut ke pembahasan chapter berikutnya terlebih dahulu, jangan langsung loncat ke chapter di atas.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/function" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../function</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-work-in-progress">◉ Work in progress<a class="hash-link" href="#-work-in-progress" title="Direct link to heading">​</a></h3><ul><li>Pembahasan tentang diverging function (<code>() -> !</code>)</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch03-03-how-functions-work.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch03-03-how-functions-work.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.fn.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.fn.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.return.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.return.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.static.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.static.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/fn.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/fn.html</a></li><li><a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">https://rust-lang.github.io/api-guidelines/naming.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/vector"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.16. Vector</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/path-item"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.18. Module System ➜ Path & Item</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a171-keyword-fn" class="table-of-contents__link toc-highlight">A.17.1. Keyword <code>fn</code></a></li><li><a href="#a172-naming-convention-fungsi" class="table-of-contents__link toc-highlight">A.17.2. <em>Naming convention</em> fungsi</a></li><li><a href="#a173-parameter-fungsi-dan-argumen-fungsi" class="table-of-contents__link toc-highlight">A.17.3. Parameter fungsi dan argumen fungsi</a></li><li><a href="#a174-nilai-balik-fungsi-return-value" class="table-of-contents__link toc-highlight">A.17.4. Nilai balik fungsi (<em>return value</em>)</a><ul><li><a href="#-keyword-return-untuk-penentuan-nilai-balik" class="table-of-contents__link toc-highlight">◉ Keyword <code>return</code> untuk penentuan nilai balik</a></li><li><a href="#-return-value-tanpa-keyword-return" class="table-of-contents__link toc-highlight">◉ <em>Return value</em> tanpa keyword <code>return</code></a></li><li><a href="#-statemen-sebagai-return-value-tanpa-keyword-return" class="table-of-contents__link toc-highlight">◉ Statemen sebagai <em>return value</em> tanpa keyword <code>return</code></a></li><li><a href="#-macro-format-untuk-membuat-formatted-string" class="table-of-contents__link toc-highlight">◉ Macro <code>format</code> untuk membuat <em>formatted</em> string</a></li></ul></li><li><a href="#a175-conditional-return-value" class="table-of-contents__link toc-highlight">A.17.5. <em>Conditional return value</em></a></li><li><a href="#a176-nilai-balik-fungsi-bertipe-string-literal-str" class="table-of-contents__link toc-highlight">A.17.6. Nilai balik fungsi bertipe string literal <code>&str</code></a></li><li><a href="#a177-default-return-value" class="table-of-contents__link toc-highlight">A.17.7. <em>Default return value</em></a></li><li><a href="#a178-pembahasan-lanjutan" class="table-of-contents__link toc-highlight">A.17.8. Pembahasan lanjutan</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-work-in-progress" class="table-of-contents__link toc-highlight">◉ Work in progress</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/generics.html b/basic/generics.html index e57bba4b..84d62b2f 100644 --- a/basic/generics.html +++ b/basic/generics.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/generics/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/generics/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.38. Generics","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/generics/#webpage"},"wordCount":1178,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/generics/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/generics/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/generics","name":"A.38. Generics","description":"Chapter ini membahas tentang generics.","datePublished":"2024-08-01T10:17:29.395Z","dateModified":"2024-08-01T10:17:29.395Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/generics/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/generics"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/generics/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.38. Generics","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/generics/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/generics/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.38. Generics","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/generics/#webpage"},"wordCount":1178,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/generics/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/generics/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/generics","name":"A.38. Generics","description":"Chapter ini membahas tentang generics.","datePublished":"2024-08-30T07:44:49.116Z","dateModified":"2024-08-30T07:44:49.116Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/generics/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/generics"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/generics/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.38. Generics","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.38. Generics</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.38. Generics</h1></header><p>Chapter ini membahas tentang generics.</p><p>Generics sendiri merupakan salah satu fitur yang ada pada beberapa bahasa pemrograman (termasuk Rust), yang digunakan untuk menambahkan fleksibilitas dalam pemanfaatan tipe data pada suatu block kode. Dengan adanya generics, kita bisa menentukan tipe data yang digunakan pada parameter maupun return value sbuah block fungsi, method dan lainnya.</p><p>Generics dinotasikan dengan <code><T></code>. Kita sempat sedikit memanfaatkan generic pada chapter <a href="/basic/vector">Vector</a> di mana dalam pendefinisian tipe data harus dituliskan juga tipe data item (via generics parameter), contoh <code>Vec<i32></code>, <code>Vec<&str></code>, dll. Kita juga sempat sedikit belajar tentang topik generic pada chapter <a href="/basic/traits">Traits</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a381-generics-basic">A.38.1. Generics basic<a class="hash-link" href="#a381-generics-basic" title="Direct link to heading">​</a></h2><p>Mari mulai pembahasan dengan sebauh contoh definisi fungsi yang memiliki generics.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">arg1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, fungsi <code>do_something</code> didefinisikan dengan 2 buah parameter argument dan 1 buah parameter generics. Parameter argument pertama, yaitu <code>arg1</code> bertipe <code>i32</code>, kemudian diikuti parameter ke-2 bertipe <code>T</code> yang mana <code>T</code> adalah parameter generic fungsi.</p><p>Dalam pemanggilan fungsi tersebut, <code>T</code> generics dan tipe data argument <code>arg2</code> harus sama. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">bool</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>do_something</code> dipanggil dengan disisipi argument <code>24</code> dan <code>false</code>. Parameter ke-2 fungsi tersebut tipe data-nya jelas <code>bool</code> karena pada argument-nya nilai <code>false</code> digunakan, oleh karena itu tipe data <code>bool</code> disisipkan pada parameter generics saat pemanggilan fungsi; dengan notasi penulisan adalah <code>::<tipe_data></code>, posisi penulisannya di antara nama fungsi dan tanda kurung pemanggilan fungsi <code>(</code>.</p><p>Apa yang terjadi jika nilai <code>T</code> diisi dengan tipe data argument <code>arg2</code> berbeda? program error.</p><p><img loading="lazy" alt="Generics" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAArIAA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6yQIizwy3EDdr5cQq5ECLDArUlemSrZAj9hUBcL1oYLFKMrDuRKBDlwIFYi2PmGTiHypkbFCxT11V90Cr25+skKwxrZgjzQurl6b31/KRboaYZOViCfXlCIBWZopug8S+jJa6vaVitbkLftht82cVp6txLhpnOfAzm4YOAguQ9BdMRBrEQomW9YYSVCkuVy5qYghEYeC0ZZXrag/ekFg6XO7lvgBdTI9IK+3OUwwa/W2YL6t14QNBOddDikNz8uGEEoyDkhhMCCUZQ3+8HOilj96uQuh3IFY7VZeN3GAtOFbc0E9VvnjoBEll8OKRZE73JopsrCBAiBBZ30rb07C3U8U2+l5Q4iDAkTmM52B89EcAcRajPBQD8TwR1EqMsEXtM2b9huou/kjp9887Of/WP3Twdti6knz0RACCxAqN3AyaOSKjdNhV4ViVUM/r+f/sdPNt333z96YNC28PtHCCxACPVJJhIrqxhsuumDtoXvCKEhxAKEEEIIgQUIIYQQAgsQQgghBBYghBBCCCxooanzty1/sWb5ozumOIUIIYTQiGOB0aV313xz/k5OIkIIIQQWrF07c/vyu9/jJCKEEEJgAViAEEIIgQVgAUIIIQQW+Dp4xzdf3H6Js4gQQgiBBRkZrCFngBBCCI08FszczhpFhBBCCCzIsIA8AUIIIQQWgAUIIYQQWAAWIIQQQmBBIO5yiBBCCIEF2TMRWJ2IEEIIgQUIIYQQAgsQQgghBBYghBBCCCxACCGEEFiAEEIIIbAAIYQQQmABQgghhMAChBBCCCGwACGEEEJgAUIIIYTAAoQQQgiBBQghhBACCxBCCCEEFiCEEEIILEAIIYQQWIAQQgghsAAhhBBCYAFCCCGEwAKEEEIIgQUIIYQQAgsQQggh1Ev9P6C6Ufmqlk+SAAAAAElFTkSuQmCC" width="690" height="169" class="img_ev3q"></p><p>Ok sampai sini semoga jelas.</p><p>Khusus untuk fungsi yang generic parameter-nya dipergunakan sebagai tipe data parameter, maka boleh untuk tidak ditentukan tipe data-nya saat pemanggilan fungsi. Contohnya bisa dilihat pada kode berikut, dua statements ini adalah ekuivalen.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">bool</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// T adalah bool, karena ditulis secara eksplisit</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// T adalah bool, karena diketahui dari tipe data argument.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// nilai `false` pasti tipe data-nya bool</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Tipe data generic boleh tidak ditulis karena nilai <code>T</code> bisa diketahui dari argument pemanggilan fungsi. Sedangkan jika nilai <code>T</code> tidak digunakan sebagai tipe data parameter, maka wajib untuk di-isi nilai <code>T</code> saat pemanggilan fungsi.</p><p>O iya, jumlah parameter generics tidak ada batasan. Bisa saja ada lebih dari satu parameter generic yang didefinisikan, contohnya bisa dilihat pada fungsi <code>do_something_v2</code> ini yang memiliki 2 buah parameter generic, yaitu <code>R</code> dan <code>T</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v2</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">R</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">arg1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">R</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Tipe <code>R</code> digunakan sebagai tipe parameter <code>arg1</code> dan tipe <code>T</code> pada parameter <code>arg2</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a382-mengasosiasikan-traits-ke-parameter-generic">A.38.2. Mengasosiasikan traits ke parameter generic<a class="hash-link" href="#a382-mengasosiasikan-traits-ke-parameter-generic" title="Direct link to heading">​</a></h2><p>Fungsi <code>do_something</code> yang telah dipraktikkan, susah untuk diisi dengan apapun. Memang parameter <code>arg1</code> tipe-nya adalah <code>i32</code>, dan harusnya mudah untuk bermain-main dengan parameter tersebut. Yang agak repot adalah parameter ke-2, yaitu <code>arg2</code> yang bertipe <code>T</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">arg1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Parameter <code>arg2</code> hampir tidak bisa diapa-apakan.</p><ul><li>Misal mau di-print, tidak bisa, karena tipe <code>T</code> tidak implement trait <a href="https://doc.rust-lang.org/std/fmt/trait.Debug.html" target="_blank" rel="noopener noreferrer"><code>std::fmt::Debug</code></a>.</li><li>Misal diisi nilai numerik kemudian dijadikan operand operasi aritmatika, juga tidak bisa karena tipe <code>T</code> tidak implement trait <a href="https://doc.rust-lang.org/std/ops/trait.Add.html" target="_blank" rel="noopener noreferrer"><code>std::ops::Add</code></a>, dan trait operasi bilangan lainnya.</li><li>Misal diisi dengan nilai <code>bool</code>, tidak bisa digunakan pada seleksi kondisi <code>if</code> karena tipe <code>T</code> tidak implement trait <a href="https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html" target="_blank" rel="noopener noreferrer"><code>std::cmp::PartialOrd</code></a>, dan trait operasi logika lainnya.</li></ul><p>Repot kan? Tapi tenang, tidak usah khawatir, ada soluasi agar tipe <code>T</code> bisa dimanfaatkan, yaitu dengan mengasosiasikan trait ke tipe data generic (sesuai kebutuhan).</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-1">◉ Contoh ke-1<a class="hash-link" href="#-contoh-ke-1" title="Direct link to heading">​</a></h3><p>Contoh pengaplikasiannya bisa dilihat pada kode berikut. Ada sebuah fungsi bernama <code>print_x_times</code> yang tugasnya adalah menampilkan data <code>T</code> sejumlah <code>x</code> kali, yang mana <code>T</code> adalah parameter generics.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">print_x_times</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Hello guys"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">print_x_times</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Debug</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> _ </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token plain">x </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Parameter generic <code>T</code> diasosiasikan dengan trait <code>Debug</code>, dengan ini maka kita akan bisa print parameter <code>data</code> yang tipe data-nya adalah <code>T</code>.</p><p>Untuk mengetes hasilnya, jalankan program. Bisa dilihat text <code>Hello guys</code> muncul 10x.</p><p><img loading="lazy" alt="Generics" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATsAAAD4CAIAAAActdY+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh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WRLtgLEAgLEAgLEAGAsA+o0l0Q6g21gS7QD1GkuiHUB3P5ZEO8AGjCXRDlCtsSTaATTXWBLtAOqMJdEOoMVYEu0Aiowl0Q5Qq7HrQqIdMFYTJNoBY/U5S6IdMBYAMBYAMBYAYwFAv7Ek2gF0G0uiHaBeY0m0A+jux5JoB9iAsSTaAao1lkQ7gOYaS6IdQJ2xJNoBtBhLoh1AkbEk2gFqNXZdSLQDxmqCRDtgrD5nSbQDxgIAxgIAxgJgLADoN5ZEO4BuY0m0A9RrLIl2AN39WBLtABswlkQ7QLXGkmgH0FxjSbQDqDOWRDuAFmNJtAMoMpZEO0Ctxq4LiXbAWE2QaAeM1ecsiXbAWADAWADAWACMBQCMBQCMBcBYAMBYAMBYAIwFAIwFgGn4H/SZkYOSji3nAAAAAElFTkSuQmCC" width="315" height="248" class="img_ev3q"></p><p>Cara untuk mengasosiasikan trait ke parameter generic adalah dengan menuliskannya dalam notasi berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">nama_fungsi</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">TraitYangInginDiasosiasikan</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">arg1 </span><span class="token punctuation" style="color:#393A34">...</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-2">◉ Contoh ke-2<a class="hash-link" href="#-contoh-ke-2" title="Direct link to heading">​</a></h3><p>Pada contoh ke-2 ini, dideklarasikan sebuah fungsi bernama <code>find_largest_number</code> yang tugasnya adalah mencari nilai maksimum dari sebuah tipe slice.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">find_largest_number</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">cmp</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">PartialOrd</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">list</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token punctuation" style="color:#393A34">[</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> largest </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">list</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> item </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> list </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> item </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> largest </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> largest </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> largest</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Seperti yang sudah dibahas pada bagian sebelumnya, bahwa tipe <code>T</code> tidak akan bisa diapa-apakan kalau tidak diasosiasikan dengan trait. Maka pada contoh ini, tipe <code>T</code> diasosiasikan dengan trait <code>std::cmp::PartialOrd</code>. Benefitnya, semua data dengan tipe <code>T</code> bisa dipergunakan dalam operasi perbandingan.</p><blockquote><p>Tanpa adanya trait <code>std::cmp::PartialOrd</code>, maka statement <code>if item > largest { ... }</code> menghasilkan error.</p></blockquote><p>Ok, sekarang panggil fungsi tersebut 2x, yang pertama diisi dengan data slice dari sebuah array, dan yang kedua data slice dari sebuah vector.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_arr </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> largest_number1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">find_largest_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_arr</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"largest_number1: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> largest_number1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">7</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> largest_number2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">find_largest_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"largest_number2: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> largest_number2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></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egottADh7nQUAQGcBAACdBQBAZwEA4AKf73grmUsDgCXjWfxns09H/dejGz4AADqLzraL2144o+rLg7cA6GwQg+HzHdNJfL4B0NlBOovPt+jzPV5nyRMDoLOxn/D5Hp02IJgFQGeltAE+31Jrh3YyMguAzoZBGz7flsiOkUkmwADQWXy+dZ3VRTY3P0swC3C2OovPd47Pd+Ai1s/nG8tIAOLZQmEwMRsAoLOlwecbANDZOZQWn28AQGcBAACdBQBAZwEA0Fm6AAAAnQUAQGcBAACdBQBAZwEA0FkAAEBnAQDQWQAAdBYAAArxP/4zZrK4il29AAAAAElFTkSuQmCC" width="461" height="113" class="img_ev3q"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-3">◉ Contoh ke-3<a class="hash-link" href="#-contoh-ke-3" title="Direct link to heading">​</a></h3><p>Trait yang bisa diasosiasikan dengan parameter generics adalah semua jenis traits (tanpa terkecuali), termasuk custom trait yang kita buat sendiri.</p><p>Contohnya bisa dilihat pada kode berikut. Ada custom trait bernama <code>MyTrait</code> dideklarasikan, kemudian diasosiasikan dengan parameter generic <code>T</code> milik fungsi <code>do_something_v3</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">trait</span><span class="token plain"> </span><span class="token type-definition class-name">MyTrait</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// methods declaration</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v3</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">MyTrait</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">arg1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// do something</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a383-multi-traits-pada-parameter-generic">A.38.3. Multi traits pada parameter generic<a class="hash-link" href="#a383-multi-traits-pada-parameter-generic" title="Direct link to heading">​</a></h2><p>Bagaimana jika <code>T</code> perlu untuk diasosiasikan dengan banyak traits (lebih dari satu), apakah bisa? Bisa. Cara penulisannya kurang lebih seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// fn nama_fungsi<T: Trait1 + Trait2 + ...>(arg1 ...)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">print_largest_number</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">cmp</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">PartialOrd</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Debug</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">list</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token punctuation" style="color:#393A34">[</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> largest </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">find_largest_number</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">list</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"largest number: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> largest</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi di atas adalah fungsi baru, namanya <code>print_largest_number</code>, tugasnya adalah mencari nilai maksimum kemudian menampilkannya.</p><p>Proses pencarian nilai maksimum dilakukan dengan memanfaatkan fungsi <code>find_largest_number</code> yang sebelumnya sudah dibuat. Fungsi tersebut memerlukan trait <code>std::cmp::PartialOrd</code> untuk diasosiasikan dengan tipe data <code>T</code>.</p><p>Setelah nilai maksimum diketemukan, nilainya di-print ke stdout menggunakan macro <code>println</code>. Nilai maksimum ditampung pada variabel <code>largest</code>, tipe data-nya adalah <code>T</code>. Agar bisa di-print maka perlu diasosiasikan trait <code>std::fmt::Debug</code>.</p><p>Bisa dilihat cara penulisan asosiasi multi trait ke parameter generic seperti apa. Cukup tulis saja dengan separator tanda <code>+</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a384-keyword-where">A.38.4. Keyword <code>where</code><a class="hash-link" href="#a384-keyword-where" title="Direct link to heading">​</a></h2><p>Selain notasi penulisan yang sudah dipelajari di atas ada lagi alternatif lainnya, yaitu menggunakan keyword <code>where</code>. Kurang lebih seperti berikut penerapannya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">print_largest_number</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">cmp</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">PartialOrd</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Debug</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">list</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token punctuation" style="color:#393A34">[</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> largest </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">find_largest_number</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">list</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"largest number: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> largest</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... adalah ekuivalen dengan ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">print_largest_number</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">list</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token punctuation" style="color:#393A34">[</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">cmp</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">PartialOrd</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Debug</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> largest </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">find_largest_number</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">list</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"largest number: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> largest</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Silakan gunakan sesuai preferensi dan kesepakatan tim. Kalau penulis lebih suka cara ke-2, karena terasa lebih rapi untuk penulisan fungsi yang ada banyak parameter generic beserta asosiasi traits-nya. Contohnya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">U</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">V</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">arg1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">U</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg3</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">V</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">some</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">traits</span><span class="token punctuation" style="color:#393A34">:</span><span class="token class-name">TraitA</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">U</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">some</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">traits</span><span class="token punctuation" style="color:#393A34">:</span><span class="token class-name">TraitB</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">some</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">traits</span><span class="token punctuation" style="color:#393A34">:</span><span class="token class-name">TraitC</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">some</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">traits</span><span class="token punctuation" style="color:#393A34">:</span><span class="token class-name">TraitD</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">V</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">some</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">traits</span><span class="token punctuation" style="color:#393A34">:</span><span class="token class-name">TraitA</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">some</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">traits</span><span class="token punctuation" style="color:#393A34">:</span><span class="token class-name">TraitD</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// do something</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a385-generics-struct">A.38.5. Generics struct<a class="hash-link" href="#a385-generics-struct" title="Direct link to heading">​</a></h2><p>Selain diterapkan di fungsi, generics bisa juga diterapkan di struct. Cara penulisannya, tambahkan notasi parameter generic di antara nama struct dan block struct.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">U</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> z</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">U</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> num_one</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">502</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">120</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> z</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4.5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> num_two</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1.2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4.3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> z</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">534</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, struct <code>Point</code> memiliki 2 parameter generic. Kemudian struct tersebut digunakan untuk membuat dua variabel berbeda:</p><ul><li>Variabel <code>num_one</code>, bertipe <code>Point<i32, f64></code>. Tipe data property <code>x</code> dan <code>y</code> adalah <code>i32</code> sedangkan tipe data property <code>z</code> adalah <code>f64</code>.</li><li>Variabel <code>num_two</code>, bertipe <code>Point<f64, i32></code>. Tipe data property <code>x</code> dan <code>y</code> adalah <code>f64</code> sedangkan tipe data property <code>z</code> adalah <code>i32</code>.</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a386-generics-method">A.38.6. Generics method<a class="hash-link" href="#a386-generics-method" title="Direct link to heading">​</a></h2><p>Generic bisa diterapkan pada method. Notasi penulisannya kurang lebih sama seperti pada penulisan method, hanya saja pada syntax <code>impl</code> perlu diikuti block parameter generics. Perbandingannya kurang lebih seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// method biasa</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Square</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">x</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// method dengan generic</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token class-name">Square</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">x</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Di syntax bagian <code>impl<T></code> dan <code>Square<T></code>, penulisan parameter generics di keduanya harus sama persis. Misal pada struct ada 3 buah parameter generic <code>Square<T, U, V></code> maka pada syntax <code>impl</code> juga harus sama, yaitu <code>impl<T, U, V></code>.</p><p>Jika tidak sama akan muncul error.</p></blockquote><p>Ok, sekarang mari kita praktikkan. Struct <code>Point</code> yang sudah dibuat, kita siapkan method-nya. Ada 3 buah method yang akan dibuat dan kesemuanya adalah method <em>getter</em> untuk masing-masing property struct (yaitu <code>x</code>, <code>y</code>, dan <code>z</code>).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">U</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> z</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">U</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">U</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">U</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_x</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_y</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_z</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">U</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">z</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat pada kode di atas, ada method <code>get_x</code> untuk mengambil nilai <code>x</code>. Nilai baliknya bertipe <code>T</code> yang tipe tersebut juga dipakai sebagai tipe data <code>x</code>.</p><p>Kemudian coba gunakan struct <code>Point</code> untuk membuat satu atau dua variabel, lalu akses method-nya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> num_one</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">502</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">120</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> z</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4.5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} {} {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">get_x</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">get_y</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">get_z</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 502 120 4.5</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> num_two</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1.2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4.3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> z</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">534</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} {} {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">get_x</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">get_y</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">get_z</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 1.2 4.3 534</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Hasilnya ketika di-run:</p><p><img loading="lazy" alt="Generics" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAT8AAABuCAIAAADeYYMaAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25z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9R/T6HF2uL7HXZD2/HsL9+3vPpUSil930GJzeVpsjCFoivTELFXnHVl/91wQgAZtrKXJf/x4ocqH46FxCGXZfX1+z9ObuA0FLpfc+xC6ihUDHslvjLmBWR88nxD3XM+iFQK/U1ikeZvwboZqmN0tjHT2fEHc70AuBXmaWaNmxeBz/cLgU4qIZ4yboddFzCfFdioJezHqhVdAbNnsLUbiA5SCoA+luF2HmRU8mlBoOaG2r/mEhaN701vgE2BFaDA0l6Phhw+hyQoy5jqRdoga90PLpdYaKUuYIK0I3ZpOLzieUUQB54h0STC+0aHrpJJF/OUvf83gSUQteuFYh5ehxQh3plXIEQYseOUMQBHohCAK9EAR6IQgCvRAEgV4IgkAvBIFeCIJmRm/kSc+q0JFe40lP93Ck78n63KeiK1KHoJnTy3jSS/iovfNrerKe9H7wVNCM318YvTB1CJohvVlPepn4ZwWMBf5AmaA5r10vennqEDTbeW/P9Ko96dXw5uil0VukDkEroVdzrJXSk57OZwvmvYG7sX+tJHUIWhO9ea+7Dp70HR6hjt4ydQhaOr0aF98RPOnZkPZi69QhaEH0Rm9cSr3zGeuXeoujOulOtv5cdNheaNH0Mp709zxpeu98Pb36A+RYn/tcdNALrcH2QhAEeiEIAr0QBHohCAK9EASBXgiCQC8EgV4IgkAvBEGgF4JALwRBoBeCoCH1PxzpY8lPbg24AAAAAElFTkSuQmCC" width="319" height="110" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a387-method-khusus-untuk-spesifik-tipe-parameter-generic-tertentu">A.38.7. Method khusus untuk spesifik tipe parameter generic tertentu<a class="hash-link" href="#a387-method-khusus-untuk-spesifik-tipe-parameter-generic-tertentu" title="Direct link to heading">​</a></h2><p>Pada contoh di atas, struct <code>Point<T, U></code> bisa digunakan dalam banyak kombinasi tipe data, misalnya: <code>Point<i32, f64></code>, <code>Point<i8, i32></code>, <code>Point<f32, u64></code>, dan lainya.</p><p>Di luar itu, bisa lho mendefinisikan method hanya untuk tipe parameter generic. Misalnya, method hanya bisa diakses ketika <code>T</code> adalah <code>i32</code> dan <code>U</code> adalah <code>f64</code>. Caranya kurang lebih seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_x</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_y</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_z</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">z</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Block kode <code>impl</code> tidak diterapkan dengan notasi penulisan <code>impl<T, U> Point<T, U></code>, melainkan <code>impl Point<i32, f64></code>. Tipe <code>T</code> diganti dengan <code>i32</code> dan <code>U</code> diganti <code>f64</code>. Dengan penulisan yang seperti ini, maka method dalam block kode hanya bisa diakses ketika data memiliki tipe data sesuai dengan yang dideklarasikan di block kode <code>impl</code> (yang pada contoh di atas adalah <code>Point<i32, f64></code>).</p><p>Bisa dilihat pada gambar berikut, sekarang statement pengaksesan method <code>num_two</code> menjadi error, karena method-method tersebut hanya tersedia untuk tipe data <code>Point<i32, f64></code> sedangkan <code>num_two</code> bertipe <code>Point<f64, i32></code>.</p><p><img loading="lazy" alt="Generics" src="/assets/images/generics-5-9f575c9b47e95f4301f0e9db22059d17.png" width="851" height="501" class="img_ev3q"></p><p>Jika ada keperluan untuk mendeklarasikan method lainnya khusus untuk tipe lainnya, cukup tulis lagi block <code>impl</code> diikuti dengan tipe yang diinginkan. Misalnya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// method untuk tipe data Point<i32, f64></span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// method untuk tipe data Point<f32, u64></span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i64</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// method untuk tipe data Point<i8, i64></span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a388-generics-enum">A.38.8. Generics enum<a class="hash-link" href="#a388-generics-enum" title="Direct link to heading">​</a></h2><p>Generic juga bisa diterapkan pada tipe enum. Caranya tulis saja deklarasi parameter generic setelah nama enum, lalu gunakan parameter generic-nya sesuai kebutuhan.</p><p>Contohnya pada kode berikut ini, enum <code>Kendaraan</code> memiliki parameter generic <code>T</code> yang tipe tersebut dipakai pada value enum <code>Gledekan(T)</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Kendaraan</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Skateboard</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">SepedaPancal</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Gledekan</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> kendaraan1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Kendaraan</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Skateboard</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> kendaraan2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Kendaraan</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">SepedaPancal</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> kendaraan3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Kendaraan</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Gledekan</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Artco"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/generics" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../generics</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch10-01-syntax.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch10-01-syntax.html</a></li><li><a href="https://doc.rust-lang.org/std/fmt/trait.Debug.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/fmt/trait.Debug.html</a></li><li><a href="https://doc.rust-lang.org/std/ops/trait.Add.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/ops/trait.Add.html</a></li><li><a href="https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/advanced-traits"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.37. Traits ➜ Advanced</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/option-type"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.39. Tipe Data ➜ Option</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a381-generics-basic" class="table-of-contents__link toc-highlight">A.38.1. Generics basic</a></li><li><a href="#a382-mengasosiasikan-traits-ke-parameter-generic" class="table-of-contents__link toc-highlight">A.38.2. Mengasosiasikan traits ke parameter generic</a><ul><li><a href="#-contoh-ke-1" class="table-of-contents__link toc-highlight">◉ Contoh ke-1</a></li><li><a href="#-contoh-ke-2" class="table-of-contents__link toc-highlight">◉ Contoh ke-2</a></li><li><a href="#-contoh-ke-3" class="table-of-contents__link toc-highlight">◉ Contoh ke-3</a></li></ul></li><li><a href="#a383-multi-traits-pada-parameter-generic" class="table-of-contents__link toc-highlight">A.38.3. Multi traits pada parameter generic</a></li><li><a href="#a384-keyword-where" class="table-of-contents__link toc-highlight">A.38.4. Keyword <code>where</code></a></li><li><a href="#a385-generics-struct" class="table-of-contents__link toc-highlight">A.38.5. Generics struct</a></li><li><a href="#a386-generics-method" class="table-of-contents__link toc-highlight">A.38.6. Generics method</a></li><li><a href="#a387-method-khusus-untuk-spesifik-tipe-parameter-generic-tertentu" class="table-of-contents__link toc-highlight">A.38.7. Method khusus untuk spesifik tipe parameter generic tertentu</a></li><li><a href="#a388-generics-enum" class="table-of-contents__link toc-highlight">A.38.8. Generics enum</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.38. Generics</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.38. Generics</h1></header><p>Chapter ini membahas tentang generics.</p><p>Generics sendiri merupakan salah satu fitur yang ada pada beberapa bahasa pemrograman (termasuk Rust), yang digunakan untuk menambahkan fleksibilitas dalam pemanfaatan tipe data pada suatu block kode. Dengan adanya generics, kita bisa menentukan tipe data yang digunakan pada parameter maupun return value sbuah block fungsi, method dan lainnya.</p><p>Generics dinotasikan dengan <code><T></code>. Kita sempat sedikit memanfaatkan generic pada chapter <a href="/basic/vector">Vector</a> di mana dalam pendefinisian tipe data harus dituliskan juga tipe data item (via generics parameter), contoh <code>Vec<i32></code>, <code>Vec<&str></code>, dll. Kita juga sempat sedikit belajar tentang topik generic pada chapter <a href="/basic/traits">Traits</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a381-generics-basic">A.38.1. Generics basic<a class="hash-link" href="#a381-generics-basic" title="Direct link to heading">​</a></h2><p>Mari mulai pembahasan dengan sebauh contoh definisi fungsi yang memiliki generics.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">arg1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, fungsi <code>do_something</code> didefinisikan dengan 2 buah parameter argument dan 1 buah parameter generics. Parameter argument pertama, yaitu <code>arg1</code> bertipe <code>i32</code>, kemudian diikuti parameter ke-2 bertipe <code>T</code> yang mana <code>T</code> adalah parameter generic fungsi.</p><p>Dalam pemanggilan fungsi tersebut, <code>T</code> generics dan tipe data argument <code>arg2</code> harus sama. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">bool</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>do_something</code> dipanggil dengan disisipi argument <code>24</code> dan <code>false</code>. Parameter ke-2 fungsi tersebut tipe data-nya jelas <code>bool</code> karena pada argument-nya nilai <code>false</code> digunakan, oleh karena itu tipe data <code>bool</code> disisipkan pada parameter generics saat pemanggilan fungsi; dengan notasi penulisan adalah <code>::<tipe_data></code>, posisi penulisannya di antara nama fungsi dan tanda kurung pemanggilan fungsi <code>(</code>.</p><p>Apa yang terjadi jika nilai <code>T</code> diisi dengan tipe data argument <code>arg2</code> berbeda? program error.</p><p><img loading="eager" fetchpriority="high" alt="Generics" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAArIAAACpCAIAAABYlUmmAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0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HCCxACPVJJhIrqxhsuumDtoXvCKEhxAKEEEIIgQUIIYQQAgsQQgghBBYghBBCCCxooanzty1/sWb5ozumOIUIIYTQiGOB0aV313xz/k5OIkIIIQQWrF07c/vyu9/jJCKEEEJgAViAEEIIgQVgAUIIIQQW+Dp4xzdf3H6Js4gQQgiBBRkZrCFngBBCCI08FszczhpFhBBCCCzIsIA8AUIIIQQWgAUIIYQQWAAWIIQQQmBBIO5yiBBCCIEF2TMRWJ2IEEIIgQUIIYQQAgsQQgghBBYghBBCCCxACCGEEFiAEEIIIbAAIYQQQmABQgghhMAChBBCCCGwACGEEEJgAUIIIYTAAoQQQgiBBQghhBACCxBCCCEEFiCEEEIILEAIIYQQWIAQQgghsAAhhBBCYAFCCCGEwAKEEEIIgQUIIYQQAgsQQggh1Ev9P6C6Ufmqlk+SAAAAAElFTkSuQmCC" width="690" height="169" class="img_CujE"></p><p>Ok sampai sini semoga jelas.</p><p>Khusus untuk fungsi yang generic parameter-nya dipergunakan sebagai tipe data parameter, maka boleh untuk tidak ditentukan tipe data-nya saat pemanggilan fungsi. Contohnya bisa dilihat pada kode berikut, dua statements ini adalah ekuivalen.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">bool</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// T adalah bool, karena ditulis secara eksplisit</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// T adalah bool, karena diketahui dari tipe data argument.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// nilai `false` pasti tipe data-nya bool</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Tipe data generic boleh tidak ditulis karena nilai <code>T</code> bisa diketahui dari argument pemanggilan fungsi. Sedangkan jika nilai <code>T</code> tidak digunakan sebagai tipe data parameter, maka wajib untuk di-isi nilai <code>T</code> saat pemanggilan fungsi.</p><p>O iya, jumlah parameter generics tidak ada batasan. Bisa saja ada lebih dari satu parameter generic yang didefinisikan, contohnya bisa dilihat pada fungsi <code>do_something_v2</code> ini yang memiliki 2 buah parameter generic, yaitu <code>R</code> dan <code>T</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v2</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">R</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">arg1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">R</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Tipe <code>R</code> digunakan sebagai tipe parameter <code>arg1</code> dan tipe <code>T</code> pada parameter <code>arg2</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a382-mengasosiasikan-traits-ke-parameter-generic">A.38.2. Mengasosiasikan traits ke parameter generic<a class="hash-link" href="#a382-mengasosiasikan-traits-ke-parameter-generic" title="Direct link to heading">​</a></h2><p>Fungsi <code>do_something</code> yang telah dipraktikkan, susah untuk diisi dengan apapun. Memang parameter <code>arg1</code> tipe-nya adalah <code>i32</code>, dan harusnya mudah untuk bermain-main dengan parameter tersebut. Yang agak repot adalah parameter ke-2, yaitu <code>arg2</code> yang bertipe <code>T</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">arg1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Parameter <code>arg2</code> hampir tidak bisa diapa-apakan.</p><ul><li>Misal mau di-print, tidak bisa, karena tipe <code>T</code> tidak implement trait <a href="https://doc.rust-lang.org/std/fmt/trait.Debug.html" target="_blank" rel="noopener noreferrer"><code>std::fmt::Debug</code></a>.</li><li>Misal diisi nilai numerik kemudian dijadikan operand operasi aritmatika, juga tidak bisa karena tipe <code>T</code> tidak implement trait <a href="https://doc.rust-lang.org/std/ops/trait.Add.html" target="_blank" rel="noopener noreferrer"><code>std::ops::Add</code></a>, dan trait operasi bilangan lainnya.</li><li>Misal diisi dengan nilai <code>bool</code>, tidak bisa digunakan pada seleksi kondisi <code>if</code> karena tipe <code>T</code> tidak implement trait <a href="https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html" target="_blank" rel="noopener noreferrer"><code>std::cmp::PartialOrd</code></a>, dan trait operasi logika lainnya.</li></ul><p>Repot kan? Tapi tenang, tidak usah khawatir, ada soluasi agar tipe <code>T</code> bisa dimanfaatkan, yaitu dengan mengasosiasikan trait ke tipe data generic (sesuai kebutuhan).</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-1">◉ Contoh ke-1<a class="hash-link" href="#-contoh-ke-1" title="Direct link to heading">​</a></h3><p>Contoh pengaplikasiannya bisa dilihat pada kode berikut. Ada sebuah fungsi bernama <code>print_x_times</code> yang tugasnya adalah menampilkan data <code>T</code> sejumlah <code>x</code> kali, yang mana <code>T</code> adalah parameter generics.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">print_x_times</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Hello guys"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">print_x_times</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Debug</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> _ </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token plain">x </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Parameter generic <code>T</code> diasosiasikan dengan trait <code>Debug</code>, dengan ini maka kita akan bisa print parameter <code>data</code> yang tipe data-nya adalah <code>T</code>.</p><p>Untuk mengetes hasilnya, jalankan program. Bisa dilihat text <code>Hello guys</code> muncul 10x.</p><p><img loading="lazy" alt="Generics" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATsAAAD4CAIAAAActdY+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTItMTFUMjM6NDU6MzgrMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyLTEyLTEzVDE3OjE1OjE3KzA3OjAwIi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height="248" class="img_CujE"></p><p>Cara untuk mengasosiasikan trait ke parameter generic adalah dengan menuliskannya dalam notasi berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">nama_fungsi</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">TraitYangInginDiasosiasikan</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">arg1 </span><span class="token punctuation" style="color:#393A34">...</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-2">◉ Contoh ke-2<a class="hash-link" href="#-contoh-ke-2" title="Direct link to heading">​</a></h3><p>Pada contoh ke-2 ini, dideklarasikan sebuah fungsi bernama <code>find_largest_number</code> yang tugasnya adalah mencari nilai maksimum dari sebuah tipe slice.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">find_largest_number</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">cmp</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">PartialOrd</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">list</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token punctuation" style="color:#393A34">[</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> largest </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">list</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> item </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> list </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> item </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> largest </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> largest </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> largest</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Seperti yang sudah dibahas pada bagian sebelumnya, bahwa tipe <code>T</code> tidak akan bisa diapa-apakan kalau tidak diasosiasikan dengan trait. Maka pada contoh ini, tipe <code>T</code> diasosiasikan dengan trait <code>std::cmp::PartialOrd</code>. Benefitnya, semua data dengan tipe <code>T</code> bisa dipergunakan dalam operasi perbandingan.</p><blockquote><p>Tanpa adanya trait <code>std::cmp::PartialOrd</code>, maka statement <code>if item > largest { ... }</code> menghasilkan error.</p></blockquote><p>Ok, sekarang panggil fungsi tersebut 2x, yang pertama diisi dengan data slice dari sebuah array, dan yang kedua data slice dari sebuah vector.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_arr </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> largest_number1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">find_largest_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_arr</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"largest_number1: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> largest_number1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">7</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> largest_number2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">find_largest_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"largest_number2: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> largest_number2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Hasilnya sesuai harapan.</p><p><img loading="lazy" alt="Generics" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc0AAABxCAIAAAA4WG/wAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yM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FkAAEBnAQDQWQAAdBYAANBZAAB0FgAAnQUAAHQWAOAsdPb25e294vXpdHvm2MpTbh8ArD+eXVCHnl7f315ut6Czh5q+D6urWfIMTmcA6Cw6O05jX18OaxlZ19vxqwCAE9HZLp3QykIliO0PTXE7VmtLW4t3q7W+NN/an1PB3qHsYc3ttqpyTq3rD4ciRg+PNXmq/29+9BaX6yk18+nVNEsSSbPOHhI+y2kFANavs7cvr40WdNpSq5Qp1n5r4rxW9Oo/uy+txbWQMk94bmvJvLXXqejsu/f/m7t4Vz2xnmIz9WC0p84iswDobOSno6K82fL76iiVo73WuhplsXR4oM76kqrpbFOJ9n+/fabWWj3DZj4VuOg/j+lGAHS2h856l/SNzgYiY4mnE2W+C7kEK8Vgr2cBna1OEko9I/UpkVwlQQuAzl5caCGdKEB2drb+NT3n5Kx/mXj27UWr58Q6yy1mAOhse139ZAW2ms7KmqFlCGS9yhMvVWetnOt7ns66gXdQz546O2AeDJkFOC+dDS6e2/mf5vNLdjxrJQSc1QrZBO3ehtj9BqHOWotWNxdEdTaopFhPPT0itTNPZ53FEVmAM41ny1wDk3sEAHS2MO5FcDJfAACAzg5S2pLXxF4egottADh7nQUAQGcBAACdBQBAZwEA4AKf73grmUsDgCXjWfxns09H/dejGz4AADqLzraL2144o+rLg7cA6GwQg+HzHdNJfL4B0NlBOovPt+jzPV5nyRMDoLOxn/D5Hp02IJgFQGeltAE+31Jrh3YyMguAzoZBGz7flsiOkUkmwADQWXy+dZ3VRTY3P0swC3C2OovPd47Pd+Ai1s/nG8tIAOLZQmEwMRsAoLOlwecbANDZOZQWn28AQGcBAACdBQBAZwEA0Fm6AAAAnQUAQGcBAACdBQBAZwEA0FkAAEBnAQDQWQAAdBYAAArxP/4zZrK4il29AAAAAElFTkSuQmCC" width="461" height="113" class="img_CujE"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-3">◉ Contoh ke-3<a class="hash-link" href="#-contoh-ke-3" title="Direct link to heading">​</a></h3><p>Trait yang bisa diasosiasikan dengan parameter generics adalah semua jenis traits (tanpa terkecuali), termasuk custom trait yang kita buat sendiri.</p><p>Contohnya bisa dilihat pada kode berikut. Ada custom trait bernama <code>MyTrait</code> dideklarasikan, kemudian diasosiasikan dengan parameter generic <code>T</code> milik fungsi <code>do_something_v3</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">trait</span><span class="token plain"> </span><span class="token type-definition class-name">MyTrait</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// methods declaration</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v3</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">MyTrait</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">arg1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// do something</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a383-multi-traits-pada-parameter-generic">A.38.3. Multi traits pada parameter generic<a class="hash-link" href="#a383-multi-traits-pada-parameter-generic" title="Direct link to heading">​</a></h2><p>Bagaimana jika <code>T</code> perlu untuk diasosiasikan dengan banyak traits (lebih dari satu), apakah bisa? Bisa. Cara penulisannya kurang lebih seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// fn nama_fungsi<T: Trait1 + Trait2 + ...>(arg1 ...)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">print_largest_number</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">cmp</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">PartialOrd</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Debug</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">list</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token punctuation" style="color:#393A34">[</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> largest </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">find_largest_number</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">list</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"largest number: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> largest</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi di atas adalah fungsi baru, namanya <code>print_largest_number</code>, tugasnya adalah mencari nilai maksimum kemudian menampilkannya.</p><p>Proses pencarian nilai maksimum dilakukan dengan memanfaatkan fungsi <code>find_largest_number</code> yang sebelumnya sudah dibuat. Fungsi tersebut memerlukan trait <code>std::cmp::PartialOrd</code> untuk diasosiasikan dengan tipe data <code>T</code>.</p><p>Setelah nilai maksimum diketemukan, nilainya di-print ke stdout menggunakan macro <code>println</code>. Nilai maksimum ditampung pada variabel <code>largest</code>, tipe data-nya adalah <code>T</code>. Agar bisa di-print maka perlu diasosiasikan trait <code>std::fmt::Debug</code>.</p><p>Bisa dilihat cara penulisan asosiasi multi trait ke parameter generic seperti apa. Cukup tulis saja dengan separator tanda <code>+</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a384-keyword-where">A.38.4. Keyword <code>where</code><a class="hash-link" href="#a384-keyword-where" title="Direct link to heading">​</a></h2><p>Selain notasi penulisan yang sudah dipelajari di atas ada lagi alternatif lainnya, yaitu menggunakan keyword <code>where</code>. Kurang lebih seperti berikut penerapannya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">print_largest_number</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">cmp</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">PartialOrd</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Debug</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">list</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token punctuation" style="color:#393A34">[</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> largest </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">find_largest_number</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">list</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"largest number: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> largest</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... adalah ekuivalen dengan ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">print_largest_number</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">list</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token punctuation" style="color:#393A34">[</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">cmp</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">PartialOrd</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Debug</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> largest </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">find_largest_number</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">list</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"largest number: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> largest</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Silakan gunakan sesuai preferensi dan kesepakatan tim. Kalau penulis lebih suka cara ke-2, karena terasa lebih rapi untuk penulisan fungsi yang ada banyak parameter generic beserta asosiasi traits-nya. Contohnya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">U</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">V</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">arg1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">U</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg3</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">V</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">some</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">traits</span><span class="token punctuation" style="color:#393A34">:</span><span class="token class-name">TraitA</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">U</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">some</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">traits</span><span class="token punctuation" style="color:#393A34">:</span><span class="token class-name">TraitB</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">some</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">traits</span><span class="token punctuation" style="color:#393A34">:</span><span class="token class-name">TraitC</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">some</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">traits</span><span class="token punctuation" style="color:#393A34">:</span><span class="token class-name">TraitD</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">V</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">some</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">traits</span><span class="token punctuation" style="color:#393A34">:</span><span class="token class-name">TraitA</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">some</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">traits</span><span class="token punctuation" style="color:#393A34">:</span><span class="token class-name">TraitD</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// do something</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a385-generics-struct">A.38.5. Generics struct<a class="hash-link" href="#a385-generics-struct" title="Direct link to heading">​</a></h2><p>Selain diterapkan di fungsi, generics bisa juga diterapkan di struct. Cara penulisannya, tambahkan notasi parameter generic di antara nama struct dan block struct.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">U</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> z</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">U</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> num_one</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">502</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">120</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> z</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4.5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> num_two</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1.2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4.3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> z</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">534</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, struct <code>Point</code> memiliki 2 parameter generic. Kemudian struct tersebut digunakan untuk membuat dua variabel berbeda:</p><ul><li>Variabel <code>num_one</code>, bertipe <code>Point<i32, f64></code>. Tipe data property <code>x</code> dan <code>y</code> adalah <code>i32</code> sedangkan tipe data property <code>z</code> adalah <code>f64</code>.</li><li>Variabel <code>num_two</code>, bertipe <code>Point<f64, i32></code>. Tipe data property <code>x</code> dan <code>y</code> adalah <code>f64</code> sedangkan tipe data property <code>z</code> adalah <code>i32</code>.</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a386-generics-method">A.38.6. Generics method<a class="hash-link" href="#a386-generics-method" title="Direct link to heading">​</a></h2><p>Generic bisa diterapkan pada method. Notasi penulisannya kurang lebih sama seperti pada penulisan method, hanya saja pada syntax <code>impl</code> perlu diikuti block parameter generics. Perbandingannya kurang lebih seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// method biasa</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Square</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">x</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// method dengan generic</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token class-name">Square</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">x</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Di syntax bagian <code>impl<T></code> dan <code>Square<T></code>, penulisan parameter generics di keduanya harus sama persis. Misal pada struct ada 3 buah parameter generic <code>Square<T, U, V></code> maka pada syntax <code>impl</code> juga harus sama, yaitu <code>impl<T, U, V></code>.</p><p>Jika tidak sama akan muncul error.</p></blockquote><p>Ok, sekarang mari kita praktikkan. Struct <code>Point</code> yang sudah dibuat, kita siapkan method-nya. Ada 3 buah method yang akan dibuat dan kesemuanya adalah method <em>getter</em> untuk masing-masing property struct (yaitu <code>x</code>, <code>y</code>, dan <code>z</code>).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">U</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> z</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">U</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">U</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">U</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_x</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_y</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">T</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_z</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">U</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">z</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat pada kode di atas, ada method <code>get_x</code> untuk mengambil nilai <code>x</code>. Nilai baliknya bertipe <code>T</code> yang tipe tersebut juga dipakai sebagai tipe data <code>x</code>.</p><p>Kemudian coba gunakan struct <code>Point</code> untuk membuat satu atau dua variabel, lalu akses method-nya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> num_one</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">502</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">120</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> z</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4.5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} {} {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">get_x</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">get_y</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">get_z</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 502 120 4.5</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> num_two</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1.2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4.3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> z</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">534</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} {} {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">get_x</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">get_y</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">get_z</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 1.2 4.3 534</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Hasilnya ketika di-run:</p><p><img loading="lazy" alt="Generics" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAT8AAABuCAIAAADeYYMaAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAP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CJohvVlPepn4ZwWMBf5AmaA5r10vennqEDTbeW/P9Ko96dXw5uil0VukDkEroVdzrJXSk57OZwvmvYG7sX+tJHUIWhO9ea+7Dp70HR6hjt4ydQhaOr0aF98RPOnZkPZi69QhaEH0Rm9cSr3zGeuXeoujOulOtv5cdNheaNH0Mp709zxpeu98Pb36A+RYn/tcdNALrcH2QhAEeiEIAr0QBHohCAK9EASBXgiCQC8EgV4IgkAvBEGgF4JALwRBoBeCoCH1PxzpY8lPbg24AAAAAElFTkSuQmCC" width="319" height="110" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a387-method-khusus-untuk-spesifik-tipe-parameter-generic-tertentu">A.38.7. Method khusus untuk spesifik tipe parameter generic tertentu<a class="hash-link" href="#a387-method-khusus-untuk-spesifik-tipe-parameter-generic-tertentu" title="Direct link to heading">​</a></h2><p>Pada contoh di atas, struct <code>Point<T, U></code> bisa digunakan dalam banyak kombinasi tipe data, misalnya: <code>Point<i32, f64></code>, <code>Point<i8, i32></code>, <code>Point<f32, u64></code>, dan lainya.</p><p>Di luar itu, bisa lho mendefinisikan method hanya untuk tipe parameter generic. Misalnya, method hanya bisa diakses ketika <code>T</code> adalah <code>i32</code> dan <code>U</code> adalah <code>f64</code>. Caranya kurang lebih seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_x</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_y</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_z</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">z</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Block kode <code>impl</code> tidak diterapkan dengan notasi penulisan <code>impl<T, U> Point<T, U></code>, melainkan <code>impl Point<i32, f64></code>. Tipe <code>T</code> diganti dengan <code>i32</code> dan <code>U</code> diganti <code>f64</code>. Dengan penulisan yang seperti ini, maka method dalam block kode hanya bisa diakses ketika data memiliki tipe data sesuai dengan yang dideklarasikan di block kode <code>impl</code> (yang pada contoh di atas adalah <code>Point<i32, f64></code>).</p><p>Bisa dilihat pada gambar berikut, sekarang statement pengaksesan method <code>num_two</code> menjadi error, karena method-method tersebut hanya tersedia untuk tipe data <code>Point<i32, f64></code> sedangkan <code>num_two</code> bertipe <code>Point<f64, i32></code>.</p><p><img loading="lazy" alt="Generics" src="/assets/images/generics-5-9f575c9b47e95f4301f0e9db22059d17.png" width="851" height="501" class="img_CujE"></p><p>Jika ada keperluan untuk mendeklarasikan method lainnya khusus untuk tipe lainnya, cukup tulis lagi block <code>impl</code> diikuti dengan tipe yang diinginkan. Misalnya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// method untuk tipe data Point<i32, f64></span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// method untuk tipe data Point<f32, u64></span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i64</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// method untuk tipe data Point<i8, i64></span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a388-generics-enum">A.38.8. Generics enum<a class="hash-link" href="#a388-generics-enum" title="Direct link to heading">​</a></h2><p>Generic juga bisa diterapkan pada tipe enum. Caranya tulis saja deklarasi parameter generic setelah nama enum, lalu gunakan parameter generic-nya sesuai kebutuhan.</p><p>Contohnya pada kode berikut ini, enum <code>Kendaraan</code> memiliki parameter generic <code>T</code> yang tipe tersebut dipakai pada value enum <code>Gledekan(T)</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Kendaraan</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Skateboard</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">SepedaPancal</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Gledekan</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> kendaraan1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Kendaraan</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Skateboard</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> kendaraan2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Kendaraan</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">SepedaPancal</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> kendaraan3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Kendaraan</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Gledekan</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Artco"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/generics" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../generics</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch10-01-syntax.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch10-01-syntax.html</a></li><li><a href="https://doc.rust-lang.org/std/fmt/trait.Debug.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/fmt/trait.Debug.html</a></li><li><a href="https://doc.rust-lang.org/std/ops/trait.Add.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/ops/trait.Add.html</a></li><li><a href="https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/advanced-traits"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.37. Traits ➜ Advanced</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/option-type"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.39. Tipe Data ➜ Option</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a381-generics-basic" class="table-of-contents__link toc-highlight">A.38.1. Generics basic</a></li><li><a href="#a382-mengasosiasikan-traits-ke-parameter-generic" class="table-of-contents__link toc-highlight">A.38.2. Mengasosiasikan traits ke parameter generic</a><ul><li><a href="#-contoh-ke-1" class="table-of-contents__link toc-highlight">◉ Contoh ke-1</a></li><li><a href="#-contoh-ke-2" class="table-of-contents__link toc-highlight">◉ Contoh ke-2</a></li><li><a href="#-contoh-ke-3" class="table-of-contents__link toc-highlight">◉ Contoh ke-3</a></li></ul></li><li><a href="#a383-multi-traits-pada-parameter-generic" class="table-of-contents__link toc-highlight">A.38.3. Multi traits pada parameter generic</a></li><li><a href="#a384-keyword-where" class="table-of-contents__link toc-highlight">A.38.4. Keyword <code>where</code></a></li><li><a href="#a385-generics-struct" class="table-of-contents__link toc-highlight">A.38.5. Generics struct</a></li><li><a href="#a386-generics-method" class="table-of-contents__link toc-highlight">A.38.6. Generics method</a></li><li><a href="#a387-method-khusus-untuk-spesifik-tipe-parameter-generic-tertentu" class="table-of-contents__link toc-highlight">A.38.7. Method khusus untuk spesifik tipe parameter generic tertentu</a></li><li><a href="#a388-generics-enum" class="table-of-contents__link toc-highlight">A.38.8. Generics enum</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/hello-rust.html b/basic/hello-rust.html index be819ec3..2ee220d0 100644 --- a/basic/hello-rust.html +++ b/basic/hello-rust.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/hello-rust/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/hello-rust/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.1. Program Pertama ➜ Hello Rust","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/hello-rust/#webpage"},"wordCount":654,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/hello-rust/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust","belajar rust","hello world","hello rust"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/hello-rust/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/hello-rust","name":"A.1. Program Pertama ➜ Hello Rust","description":"Belajar membuat program hello world di Rust, dimulai dengan pembuatan program Hello World sederhana.","datePublished":"2024-08-01T10:17:28.957Z","dateModified":"2024-08-01T10:17:28.957Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/hello-rust/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/hello-rust"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/hello-rust/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.1. Program Pertama ➜ Hello Rust","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/hello-rust/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/hello-rust/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.1. Program Pertama ➜ Hello Rust","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/hello-rust/#webpage"},"wordCount":654,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/hello-rust/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust","belajar rust","hello world","hello rust"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/hello-rust/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/hello-rust","name":"A.1. Program Pertama ➜ Hello Rust","description":"Belajar membuat program hello world di Rust, dimulai dengan pembuatan program Hello World sederhana.","datePublished":"2024-08-30T07:44:49.154Z","dateModified":"2024-08-30T07:44:49.154Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/hello-rust/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/hello-rust"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/hello-rust/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.1. Program Pertama ➜ Hello Rust","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.1. Program Pertama ➜ Hello Rust</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.1. Program Pertama ➜ Hello Rust</h1></header><p>Seperti pada umumnya bahasa pemrograman, belajar membuat program pasti diawali dengan aplikasi <code>Hello World</code>, dan pada chapter ini kita akan melakukannya. Kita akan buat program bernama <code>Hello Rust</code> menggunakan pemrograman Rust.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a11-pembuatan-projectpackage">A.1.1. Pembuatan project/package<a class="hash-link" href="#a11-pembuatan-projectpackage" title="Direct link to heading">​</a></h2><p>Pembuatan project baru di Rust bisa dilakukan dengan 2 cara, dengan <code>cargo</code> atau tanpanya. Di sini kita akan skip bagian pembuatan project tanpa <code>cargo</code>, karena akan butuh effort lebih banyak nantinya dalam mengelola package dan manajemen build.</p><blockquote><p>Di Rust istilah project lebih dikenal dengan <strong>package</strong>, dan pada ebook ini maknanya adalah sama.</p></blockquote><p>Ok langsung saja, buat project baru dengan mengeksekusi command berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">cargo</span><span class="token plain"> new hello_rust</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin class-name">cd</span><span class="token plain"> hello_rust</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Command di atas menghasilkan sebuah folder baru bernama <code>hello_rust</code> dengan isi beberapa file:</p><ul><li><code>Cargo.toml</code></li><li><code>.gitignore</code></li><li><code>src/main.rs</code></li></ul><p><img loading="lazy" alt="Struktur project hello_rust" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAACBCAIAAACJhZkTAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0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REzNXGHqmmUU6Nlgzm1yfSa71eswF+Hq0SvKxevLOA6fD6k0mq6XVWtfS74vLFnyKd7fn6i3gEOkejtyPE9BrxCKQ3TdPEK3UnJkrBD0n3v4VzuqjA6E49/dKxd5VfAvPBYkz2CZavUosAt5pQQMRBIJ8KWUPh5S5ktA3WK4/6J2L3rTT6VbHaMDjvFqmqd0K3FCmCobPKi8WobLRV3QsAgwaA3pAD+gBPaAHAfSAHgTQA3oQQA/oQQA9oAcB9IAeRCb/A8d3FqM8+LSSAAAAAElFTkSuQmCC" width="126" height="129" class="img_ev3q"></p><p>File <code>src/main.rs</code> adalah file penting dalam pemrograman Rust. File <code>main.rs</code> merupakan file pertama yang dipanggil saat proses build program Rust (yang kemudian di-run). Source code program harus berada dalam folder <code>src</code>.</p><blockquote><p>Pembahasan detail mengenai file <code>Cargo.toml</code> nantinya ada pada chapter <a href="/basic/package-crate">Module System ➜ Package & Crate</a>. Untuk sekarang penulis anjurkan untuk mengikuti pembelajaran tiap chapter secara urut.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a12-run-project-hello-rust">A.1.2. Run project <code>Hello Rust</code><a class="hash-link" href="#a12-run-project-hello-rust" title="Direct link to heading">​</a></h2><p>Sebelum membahas isi kode program dalam <code>main.rs</code>, ada baiknya kita run terlebih dahulu program ini untuk melihat hasilnya. Jalankan command berikut untuk run program.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">cargo</span><span class="token plain"> run</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Run project hello_rust" src="/assets/images/hello-rust-2-275752b62e2a0b25dbf8ee21f9817ea0.png" width="470" height="315" class="img_ev3q"></p><p>Bisa dilihat pada gambar di atas pesan <code>Hello, world!</code> yang ada dalam file <code>main.rs</code> muncul, menandakan proses eksekusi program sukses.</p><p>Command <code>cargo run</code> digunakan untuk menjalankan aplikasi saat proses development. Perlu diingat bahwa Rust merupakan bahasa pemrograman yang kategorinya <code>compiled language</code> yang artinya kode program akan dikompilasi terlebih dahulu untuk menghasilkan file binary, dan kemudian file binary itulah yang dijalankan.</p><p>Command <code>cargo run</code> merupakan shorthand untuk memperpendek proses kompilasi dan eksekusi. Dalam command tersebut, kode program akan di-compile terlebih dahulu, dan hasilnya adalah file executable binary bernama <code>hello_rust.exe</code> (karena penulis menggunakan windows). File binary tersebut berada dalam project dalam path <code>hello_rust/target/debug/hello_rust.exe</code>. Setelah proses kompilasi, file binary tersebut dijalankan, dan hasilnya adalah pesan <code>Hello, world!</code> yang muncul di layar</p><blockquote><p>Untuk pengguna windows, file binary akan ber-ekstensi <code>.exe</code> seperti pada contoh yaitu <code>hello_rust.exe</code>. Sedangkan untuk non-windows, file tidak mempunyai ekstensi, <code>hello_rust</code>.</p></blockquote><p>Command <code>cargo run</code> akan sering kita pakai dalam proses development.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a13-penjelasan-blok-kode-mainrs">A.1.3. Penjelasan blok kode <code>main.rs</code><a class="hash-link" href="#a13-penjelasan-blok-kode-mainrs" title="Direct link to heading">​</a></h2><p>Berikut adalah isi (default) dari file <code>main.rs</code>, dan kita akan bahas setiap barisnya (hanya 3 baris).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Hello, world!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-notasi-pendefinisian-fungsi">◉ Notasi pendefinisian fungsi<a class="hash-link" href="#-notasi-pendefinisian-fungsi" title="Direct link to heading">​</a></h3><p>Pembuatan fungsi di Rust menggunakan keyword <code>fn</code> dengan notasi penulisan sebagai berikut, contoh:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">fn </span><span class="token function-name function" style="color:#d73a49">nama_fungsi</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><code>nama_fungsi</code> di atas adalah nama fungsi. Pada program yang sudah kita buat, fungsi bernama <code>main</code>. Penulisan nama fungsi diikuti dengan <code>()</code> kemudian kurung kurawal <code>{ }</code>.</p><ul><li>Sintaks <code>()</code> nantinya bisa diisi dengan definisi parameter. Pada contoh ini tidak ada parameter yang ditulis.</li><li>Sintaks <code>{}</code> dituliskan dalam baris berbeda, isinya adalah kode program.</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-notasi-pemanggilan-fungsi">◉ Notasi pemanggilan fungsi<a class="hash-link" href="#-notasi-pemanggilan-fungsi" title="Direct link to heading">​</a></h3><p>Notasi penulisan pemanggilan fungsi adalah cukup dengan menuliskan nama fungsinya kemudian diikuti dengan <code>()</code>, seperti berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">nama_fungsi</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jika ada argument parameter yang perlu disisipkan saat pemanggilan fungsi, dituliskan di antara kurung <code>()</code>. Contoh pemanggilan <code>sebuahFungsi</code> dengan argument berupa string <code>"sebuah argument"</code>.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">sebuahFungsi</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sebuah argument"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ok, sampai sini penulis rasa cukup jelas. Sekarang kita fokus ke <code>println</code>, ada yang aneh dengan pemanggilan fungsi ini. Kenapa <code>println</code> tidak dituliskan dalam bentuk <code>println("Hello, world!")</code> melainkan <code>println!("Hello, world!")</code>?</p><p>Sekadar informasi saja, berdasarkan versi Rust terbaru, tidak ada fungsi bernama <code>println</code>, yang ada adalah macro bernama <code>println</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-macro-println">◉ Macro <code>println</code><a class="hash-link" href="#-macro-println" title="Direct link to heading">​</a></h3><p>Agar pembaca tidak bertambah bingung, setidaknya untuk sekarang pada chapter awal ini anggap saja macro adalah fungsi ... tapi sedikit berbeda. Yang paling terlihat bedanya secara sintaktis adalah tanda <code>!</code>. Pemanggilan macro pasti diikuti tanda <code>!</code> sebelum <code>()</code>. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Hello, world!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Macro <code>println</code> digunakan untuk menampilkan string atau pesan ke console output (<code>stdout</code>) dan diikuti oleh baris baru (newline/enter). Agar lebih jelas jalankan kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Hello, world!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"How"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"are"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"you?"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="println macro" src="/assets/images/hello-rust-3-6c6265ba2c94ac92baf92b864094ca1c.png" width="514" height="401" class="img_ev3q"></p><p>Bisa dilihat, setiap pesan yang ditampilkan menggunakan macro <code>println</code> muncul di baris baru.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-notasi-penulisan-statement">◉ Notasi penulisan statement<a class="hash-link" href="#-notasi-penulisan-statement" title="Direct link to heading">​</a></h3><p>Di Rust, statement harus diikuti dengan tanda <code>;</code> atau titik koma. Wajib hukumnya. Tanpa tanda <code>;</code> maka beberapa statement akan dianggap 1 baris dan kemungkinan menghasilkan error jika sintaks dianggap tidak valid. Tanda <code>;</code> adalah penanda akhir statement. Contoh <code>println!("Hello, world!");</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-indentation">◉ Indentation<a class="hash-link" href="#-indentation" title="Direct link to heading">​</a></h3><p>Mengacu ke keterangan pada dokumentasi Rust, standar indentasi untuk kode program Rust adalah <code>4 space characters</code> atau 4 karakter space.</p><hr><p>Ok, penulis rasa cukup untuk program pertama ini, semoga tidak membingungkan. Silakan diulang-ulang jika perlu. Jika sudah siap, kita akan lanjut ke pembahasan dasar pemrograman Rust pada chapter berikutnya.</p><p>Selamat! Anda telah menjadi programmer Rust!</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/hello_rust" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../hello_rust</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch01-03-hello-cargo.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch01-03-hello-cargo.html</a></li><li><a href="https://doc.rust-lang.org/std/macro.println.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/macro.println.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/hello/print.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/hello/print.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/installation/rust-editor-plugin"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Rust Editor & Plugin</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/build-dan-run-program-rust"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.2. Build dan Run Program Rust</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a11-pembuatan-projectpackage" class="table-of-contents__link toc-highlight">A.1.1. Pembuatan project/package</a></li><li><a href="#a12-run-project-hello-rust" class="table-of-contents__link toc-highlight">A.1.2. Run project <code>Hello Rust</code></a></li><li><a href="#a13-penjelasan-blok-kode-mainrs" class="table-of-contents__link toc-highlight">A.1.3. Penjelasan blok kode <code>main.rs</code></a><ul><li><a href="#-notasi-pendefinisian-fungsi" class="table-of-contents__link toc-highlight">◉ Notasi pendefinisian fungsi</a></li><li><a href="#-notasi-pemanggilan-fungsi" class="table-of-contents__link toc-highlight">◉ Notasi pemanggilan fungsi</a></li><li><a href="#-macro-println" class="table-of-contents__link toc-highlight">◉ Macro <code>println</code></a></li><li><a href="#-notasi-penulisan-statement" class="table-of-contents__link toc-highlight">◉ Notasi penulisan statement</a></li><li><a href="#-indentation" class="table-of-contents__link toc-highlight">◉ Indentation</a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.1. Program Pertama ➜ Hello Rust</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.1. Program Pertama ➜ Hello Rust</h1></header><p>Seperti pada umumnya bahasa pemrograman, belajar membuat program pasti diawali dengan aplikasi <code>Hello World</code>, dan pada chapter ini kita akan melakukannya. Kita akan buat program bernama <code>Hello Rust</code> menggunakan pemrograman Rust.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a11-pembuatan-projectpackage">A.1.1. Pembuatan project/package<a class="hash-link" href="#a11-pembuatan-projectpackage" title="Direct link to heading">​</a></h2><p>Pembuatan project baru di Rust bisa dilakukan dengan 2 cara, dengan <code>cargo</code> atau tanpanya. Di sini kita akan skip bagian pembuatan project tanpa <code>cargo</code>, karena akan butuh effort lebih banyak nantinya dalam mengelola package dan manajemen build.</p><blockquote><p>Di Rust istilah project lebih dikenal dengan <strong>package</strong>, dan pada ebook ini maknanya adalah sama.</p></blockquote><p>Ok langsung saja, buat project baru dengan mengeksekusi command berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">cargo</span><span class="token plain"> new hello_rust</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin class-name">cd</span><span class="token plain"> hello_rust</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Command di atas menghasilkan sebuah folder baru bernama <code>hello_rust</code> dengan isi beberapa file:</p><ul><li><code>Cargo.toml</code></li><li><code>.gitignore</code></li><li><code>src/main.rs</code></li></ul><p><img loading="eager" fetchpriority="high" alt="Struktur project hello_rust" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAACBCAIAAACJhZkTAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2J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y9Pvu2IprJmVWT0NpRirF/Ooos/H6svXmOvduWTpu3vvu3oHc3PHYBXj6xn/Tvb1SvT4PieYr8cyl205Ev3/UvG2n4+9o7ctdmOUPRykc6Lo4aA7HWk7HLyHg21Rotg+RbmdxikZSEBhFdb3r6hFXIw3fMaYfxEOF12tC9AX9me1mMdcsb0bDBqDAHpADwLoAT0IoAf0gB7QVzD6uvaergddjXT6srfLP+a6frUOKJcDvWcixLwpuDYeDA/MJdiXNINtVYdMsQ6qEdC3DI/K3smPz3taLJZWbdtHJyhKPFyuxzrJBkPvDEwk10NJnngoNu+Lrc9IdZC449RaW1cap5R2nwb0+UlbYF2k3H/Lyl1svBWcEOhPDDlyzIYrby/v0AFppB4fiZMNZBI2yiZlZufIMllpSC6VxYfnDGb1lx1d8yzlSD/iWyyeCMt99HqBNhjIbCMbhUsTVcTQAXS3eDQwjRRSgH0jObNMm1Kz4Xy9fTShhj46P2y7rII+5z2IedRDB8Q5VTkUpX4EvVpmcWZYLW0s9PahhLbDCQW8hXleJOxJBT0hFkEevqGct8LREzNXGHqmmUU6Nlgzm1yfSa71eswF+Hq0SvKxevLOA6fD6k0mq6XVWtfS74vLFnyKd7fn6i3gEOkejtyPE9BrxCKQ3TdPEK3UnJkrBD0n3v4VzuqjA6E49/dKxd5VfAvPBYkz2CZavUosAt5pQQMRBIJ8KWUPh5S5ktA3WK4/6J2L3rTT6VbHaMDjvFqmqd0K3FCmCobPKi8WobLRV3QsAgwaA3pAD+gBPaAHAfSAHgTQA3oQQA/oQQA9oAcB9IAeRCb/A8d3FqM8+LSSAAAAAElFTkSuQmCC" width="126" height="129" class="img_CujE"></p><p>File <code>src/main.rs</code> adalah file penting dalam pemrograman Rust. File <code>main.rs</code> merupakan file pertama yang dipanggil saat proses build program Rust (yang kemudian di-run). Source code program harus berada dalam folder <code>src</code>.</p><blockquote><p>Pembahasan detail mengenai file <code>Cargo.toml</code> nantinya ada pada chapter <a href="/basic/package-crate">Module System ➜ Package & Crate</a>. Untuk sekarang penulis anjurkan untuk mengikuti pembelajaran tiap chapter secara urut.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a12-run-project-hello-rust">A.1.2. Run project <code>Hello Rust</code><a class="hash-link" href="#a12-run-project-hello-rust" title="Direct link to heading">​</a></h2><p>Sebelum membahas isi kode program dalam <code>main.rs</code>, ada baiknya kita run terlebih dahulu program ini untuk melihat hasilnya. Jalankan command berikut untuk run program.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">cargo</span><span class="token plain"> run</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Run project hello_rust" src="/assets/images/hello-rust-2-275752b62e2a0b25dbf8ee21f9817ea0.png" width="470" height="315" class="img_CujE"></p><p>Bisa dilihat pada gambar di atas pesan <code>Hello, world!</code> yang ada dalam file <code>main.rs</code> muncul, menandakan proses eksekusi program sukses.</p><p>Command <code>cargo run</code> digunakan untuk menjalankan aplikasi saat proses development. Perlu diingat bahwa Rust merupakan bahasa pemrograman yang kategorinya <code>compiled language</code> yang artinya kode program akan dikompilasi terlebih dahulu untuk menghasilkan file binary, dan kemudian file binary itulah yang dijalankan.</p><p>Command <code>cargo run</code> merupakan shorthand untuk memperpendek proses kompilasi dan eksekusi. Dalam command tersebut, kode program akan di-compile terlebih dahulu, dan hasilnya adalah file executable binary bernama <code>hello_rust.exe</code> (karena penulis menggunakan windows). File binary tersebut berada dalam project dalam path <code>hello_rust/target/debug/hello_rust.exe</code>. Setelah proses kompilasi, file binary tersebut dijalankan, dan hasilnya adalah pesan <code>Hello, world!</code> yang muncul di layar</p><blockquote><p>Untuk pengguna windows, file binary akan ber-ekstensi <code>.exe</code> seperti pada contoh yaitu <code>hello_rust.exe</code>. Sedangkan untuk non-windows, file tidak mempunyai ekstensi, <code>hello_rust</code>.</p></blockquote><p>Command <code>cargo run</code> akan sering kita pakai dalam proses development.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a13-penjelasan-blok-kode-mainrs">A.1.3. Penjelasan blok kode <code>main.rs</code><a class="hash-link" href="#a13-penjelasan-blok-kode-mainrs" title="Direct link to heading">​</a></h2><p>Berikut adalah isi (default) dari file <code>main.rs</code>, dan kita akan bahas setiap barisnya (hanya 3 baris).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Hello, world!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-notasi-pendefinisian-fungsi">◉ Notasi pendefinisian fungsi<a class="hash-link" href="#-notasi-pendefinisian-fungsi" title="Direct link to heading">​</a></h3><p>Pembuatan fungsi di Rust menggunakan keyword <code>fn</code> dengan notasi penulisan sebagai berikut, contoh:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">fn </span><span class="token function-name function" style="color:#d73a49">nama_fungsi</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><code>nama_fungsi</code> di atas adalah nama fungsi. Pada program yang sudah kita buat, fungsi bernama <code>main</code>. Penulisan nama fungsi diikuti dengan <code>()</code> kemudian kurung kurawal <code>{ }</code>.</p><ul><li>Sintaks <code>()</code> nantinya bisa diisi dengan definisi parameter. Pada contoh ini tidak ada parameter yang ditulis.</li><li>Sintaks <code>{}</code> dituliskan dalam baris berbeda, isinya adalah kode program.</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-notasi-pemanggilan-fungsi">◉ Notasi pemanggilan fungsi<a class="hash-link" href="#-notasi-pemanggilan-fungsi" title="Direct link to heading">​</a></h3><p>Notasi penulisan pemanggilan fungsi adalah cukup dengan menuliskan nama fungsinya kemudian diikuti dengan <code>()</code>, seperti berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">nama_fungsi</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jika ada argument parameter yang perlu disisipkan saat pemanggilan fungsi, dituliskan di antara kurung <code>()</code>. Contoh pemanggilan <code>sebuahFungsi</code> dengan argument berupa string <code>"sebuah argument"</code>.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">sebuahFungsi</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sebuah argument"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ok, sampai sini penulis rasa cukup jelas. Sekarang kita fokus ke <code>println</code>, ada yang aneh dengan pemanggilan fungsi ini. Kenapa <code>println</code> tidak dituliskan dalam bentuk <code>println("Hello, world!")</code> melainkan <code>println!("Hello, world!")</code>?</p><p>Sekadar informasi saja, berdasarkan versi Rust terbaru, tidak ada fungsi bernama <code>println</code>, yang ada adalah macro bernama <code>println</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-macro-println">◉ Macro <code>println</code><a class="hash-link" href="#-macro-println" title="Direct link to heading">​</a></h3><p>Agar pembaca tidak bertambah bingung, setidaknya untuk sekarang pada chapter awal ini anggap saja macro adalah fungsi ... tapi sedikit berbeda. Yang paling terlihat bedanya secara sintaktis adalah tanda <code>!</code>. Pemanggilan macro pasti diikuti tanda <code>!</code> sebelum <code>()</code>. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Hello, world!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Macro <code>println</code> digunakan untuk menampilkan string atau pesan ke console output (<code>stdout</code>) dan diikuti oleh baris baru (newline/enter). Agar lebih jelas jalankan kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Hello, world!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"How"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"are"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"you?"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="println macro" src="/assets/images/hello-rust-3-6c6265ba2c94ac92baf92b864094ca1c.png" width="514" height="401" class="img_CujE"></p><p>Bisa dilihat, setiap pesan yang ditampilkan menggunakan macro <code>println</code> muncul di baris baru.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-notasi-penulisan-statement">◉ Notasi penulisan statement<a class="hash-link" href="#-notasi-penulisan-statement" title="Direct link to heading">​</a></h3><p>Di Rust, statement harus diikuti dengan tanda <code>;</code> atau titik koma. Wajib hukumnya. Tanpa tanda <code>;</code> maka beberapa statement akan dianggap 1 baris dan kemungkinan menghasilkan error jika sintaks dianggap tidak valid. Tanda <code>;</code> adalah penanda akhir statement. Contoh <code>println!("Hello, world!");</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-indentation">◉ Indentation<a class="hash-link" href="#-indentation" title="Direct link to heading">​</a></h3><p>Mengacu ke keterangan pada dokumentasi Rust, standar indentasi untuk kode program Rust adalah <code>4 space characters</code> atau 4 karakter space.</p><hr><p>Ok, penulis rasa cukup untuk program pertama ini, semoga tidak membingungkan. Silakan diulang-ulang jika perlu. Jika sudah siap, kita akan lanjut ke pembahasan dasar pemrograman Rust pada chapter berikutnya.</p><p>Selamat! Anda telah menjadi programmer Rust!</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/hello_rust" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../hello_rust</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch01-03-hello-cargo.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch01-03-hello-cargo.html</a></li><li><a href="https://doc.rust-lang.org/std/macro.println.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/macro.println.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/hello/print.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/hello/print.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/installation/rust-editor-plugin"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Rust Editor & Plugin</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/build-dan-run-program-rust"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.2. Build dan Run Program Rust</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a11-pembuatan-projectpackage" class="table-of-contents__link toc-highlight">A.1.1. Pembuatan project/package</a></li><li><a href="#a12-run-project-hello-rust" class="table-of-contents__link toc-highlight">A.1.2. Run project <code>Hello Rust</code></a></li><li><a href="#a13-penjelasan-blok-kode-mainrs" class="table-of-contents__link toc-highlight">A.1.3. Penjelasan blok kode <code>main.rs</code></a><ul><li><a href="#-notasi-pendefinisian-fungsi" class="table-of-contents__link toc-highlight">◉ Notasi pendefinisian fungsi</a></li><li><a href="#-notasi-pemanggilan-fungsi" class="table-of-contents__link toc-highlight">◉ Notasi pemanggilan fungsi</a></li><li><a href="#-macro-println" class="table-of-contents__link toc-highlight">◉ Macro <code>println</code></a></li><li><a href="#-notasi-penulisan-statement" class="table-of-contents__link toc-highlight">◉ Notasi penulisan statement</a></li><li><a href="#-indentation" class="table-of-contents__link toc-highlight">◉ Indentation</a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/komentar.html b/basic/komentar.html index 99d46c2b..d765a3e2 100644 --- a/basic/komentar.html +++ b/basic/komentar.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/komentar/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/komentar/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.3. Komentar","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/komentar/#webpage"},"wordCount":100,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/komentar/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/komentar/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/komentar","name":"A.3. Komentar","description":"Pada chapter ini kita akan membahas tentang komentar pada pemrograman Rust. Ada beberapa jenis komentar yang tersedia, namun untuk sekarang yang penting diketahui hanya 2.","datePublished":"2024-08-01T10:17:29.005Z","dateModified":"2024-08-01T10:17:29.005Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/komentar/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/komentar"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/komentar/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.3. Komentar","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/komentar/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/komentar/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.3. Komentar","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/komentar/#webpage"},"wordCount":100,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/komentar/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/komentar/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/komentar","name":"A.3. Komentar","description":"Pada chapter ini kita akan membahas tentang komentar pada pemrograman Rust. Ada beberapa jenis komentar yang tersedia, namun untuk sekarang yang penting diketahui hanya 2.","datePublished":"2024-08-30T07:44:49.176Z","dateModified":"2024-08-30T07:44:49.176Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/komentar/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/komentar"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/komentar/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.3. Komentar","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.3. Komentar</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.3. Komentar</h1></header><p>Pada chapter ini kita akan membahas tentang komentar pada pemrograman Rust. Ada <a href="https://doc.rust-lang.org/reference/comments.html" target="_blank" rel="noopener noreferrer">beberapa jenis komentar</a> yang tersedia, namun untuk sekarang yang penting diketahui hanya 2.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a31-baris-komentar">A.3.1. Baris komentar<a class="hash-link" href="#a31-baris-komentar" title="Direct link to heading">​</a></h2><p>Rust menggunakan double slash (<code>//</code>) sebagai penanda <em>line comment</em> atau baris komentar. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ini adalah komentar</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// komentar tidak akan di-eksekusi</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a32-blok-komentar">A.3.2. Blok komentar<a class="hash-link" href="#a32-blok-komentar" title="Direct link to heading">​</a></h2><p>Blok komentar dituliskan dengan cara diawali <code>/*</code> dan diakhiri <code>*/</code>. Silakan tambahkan kode berikut dalam blok fungsi <code>main</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">/*</span><br></span><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"> komentar ini</span><br></span><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"> tidak akan</span><br></span><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"> dieksekusi</span><br></span><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">*/</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"world"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Lalu run program tersebut. O iya, untuk kawan-kawan yang menggunakan editor VSCode dengan ekstensi <code>rust-analyzer</code> ter-install. Ada shortcut untuk run program yaitu dengan klik tombol <code>▶ Run</code> di atas definisi fungsi <code>main</code>.</p><p><img loading="lazy" alt="komentar rust" src="/assets/images/komentar-1-d4efff0ac45f370804d128be10dfc2f0.png" width="754" height="475" class="img_ev3q"></p><p>Bisa dilihat, komentar tidak menghasilkan efek apa-apa pada program yang dibuat.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/komentar" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../komentar</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/reference/comments.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/comments.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/build-dan-run-program-rust"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.2. Build dan Run Program Rust</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/variabel"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.4. Variabel</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a31-baris-komentar" class="table-of-contents__link toc-highlight">A.3.1. Baris komentar</a></li><li><a href="#a32-blok-komentar" class="table-of-contents__link toc-highlight">A.3.2. Blok komentar</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.3. Komentar</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.3. Komentar</h1></header><p>Pada chapter ini kita akan membahas tentang komentar pada pemrograman Rust. Ada <a href="https://doc.rust-lang.org/reference/comments.html" target="_blank" rel="noopener noreferrer">beberapa jenis komentar</a> yang tersedia, namun untuk sekarang yang penting diketahui hanya 2.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a31-baris-komentar">A.3.1. Baris komentar<a class="hash-link" href="#a31-baris-komentar" title="Direct link to heading">​</a></h2><p>Rust menggunakan double slash (<code>//</code>) sebagai penanda <em>line comment</em> atau baris komentar. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ini adalah komentar</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// komentar tidak akan di-eksekusi</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a32-blok-komentar">A.3.2. Blok komentar<a class="hash-link" href="#a32-blok-komentar" title="Direct link to heading">​</a></h2><p>Blok komentar dituliskan dengan cara diawali <code>/*</code> dan diakhiri <code>*/</code>. Silakan tambahkan kode berikut dalam blok fungsi <code>main</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">/*</span><br></span><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"> komentar ini</span><br></span><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"> tidak akan</span><br></span><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"> dieksekusi</span><br></span><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">*/</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"world"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Lalu run program tersebut. O iya, untuk kawan-kawan yang menggunakan editor VSCode dengan ekstensi <code>rust-analyzer</code> ter-install. Ada shortcut untuk run program yaitu dengan klik tombol <code>▶ Run</code> di atas definisi fungsi <code>main</code>.</p><p><img loading="eager" fetchpriority="high" alt="komentar rust" src="/assets/images/komentar-1-d4efff0ac45f370804d128be10dfc2f0.png" width="754" height="475" class="img_CujE"></p><p>Bisa dilihat, komentar tidak menghasilkan efek apa-apa pada program yang dibuat.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/komentar" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../komentar</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/reference/comments.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/comments.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/build-dan-run-program-rust"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.2. Build dan Run Program Rust</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/variabel"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.4. Variabel</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a31-baris-komentar" class="table-of-contents__link toc-highlight">A.3.1. Baris komentar</a></li><li><a href="#a32-blok-komentar" class="table-of-contents__link toc-highlight">A.3.2. Blok komentar</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/konstanta.html b/basic/konstanta.html index 095eba62..3a8d9790 100644 --- a/basic/konstanta.html +++ b/basic/konstanta.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/konstanta/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/konstanta/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.7. Konstanta","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/konstanta/#webpage"},"wordCount":292,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/konstanta/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/konstanta/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/konstanta","name":"A.7. Konstanta","description":"Chapter ini membahas tentang konstanta di bahasa Rust.","datePublished":"2024-08-01T10:17:28.985Z","dateModified":"2024-08-01T10:17:28.985Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/konstanta/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/konstanta"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/konstanta/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.7. Konstanta","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/konstanta/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/konstanta/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.7. Konstanta","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/konstanta/#webpage"},"wordCount":292,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/konstanta/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/konstanta/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/konstanta","name":"A.7. Konstanta","description":"Chapter ini membahas tentang konstanta di bahasa Rust.","datePublished":"2024-08-30T07:44:49.328Z","dateModified":"2024-08-30T07:44:49.328Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/konstanta/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/konstanta"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/konstanta/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.7. Konstanta","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> <div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.7. Konstanta</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.7. Konstanta</h1></header><p>Chapter ini membahas tentang konstanta di bahasa Rust.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a71-keyword-const">A.7.1. Keyword <code>const</code><a class="hash-link" href="#a71-keyword-const" title="Direct link to heading">​</a></h2><p>Berbeda dengan variabel yang dideklarasikan menggunakan keyword <code>let</code>, konstanta dibuat dengan keyword <code>const</code>. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">LABEL</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"nilai pi adalah:"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">PI</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">22.0</span><span class="token operator" style="color:#393A34">/</span><span class="token number" style="color:#36acaa">7.0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">LABEL</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">PI</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat di kode di atas, konstanta <code>LABEL</code> merupakan string dengan nilai <code>"nilai pi adalah:"</code>, sedang <code>PI</code> memiliki nilai bertipe float hasil dari operasi <code>22./7.0</code>.</p><p>Dalam pendefinisian konstanta, tipe data harus dituliskan secara eksplist. Deklarasi seperti <code>const DATA = "x"</code> akan menghasilkan error saat proses kompilasi. Dan aturan ini berlaku untuk semua tipe data yang dipergunakan untuk pendefinisian konstanta.</p><p>Nilai sebuah konstanta juga bisa dari variabel atau konstanta lain, atau hasil sebuah operasi seperti operasi aritmatika <code>22.0/7.0</code>.</p><p>Di sini penulis tidak menggunakan <code>22/7</code> karena hasilnya akan bertipe integer. Di Rust operasi aritmatika harus dilakukan dengan tipe data yang sama, dan hasilnya akan memiliki tipe data sesuai operand. Lebih jelasnya akan kita bahas pada chapter selanjutnya.</p><blockquote><p>Keyword <code>mut</code> tidak bisa diterapkan pada konstanta. Jika dipaksa akan menghasilkan error.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a72-keyword-static">A.7.2. Keyword <code>static</code><a class="hash-link" href="#a72-keyword-static" title="Direct link to heading">​</a></h2><p>Ada cara lain untuk membuat konstanta, menggunakan keyword <code>static</code>. Contohnya seperti pada kode berikut. Konstanta <code>NUMBER</code> didefinisikan di luar blok fungsi main, lalu di print di dalam fungsi main.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">static</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">NUMBER</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">18</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">NUMBER</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output ==> 18</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pertanyaan, bedanya apa dengan konstanta yang dibuat via keyword <code>const</code>? secara teknis bedanya ada di bagaimana manajemen dan alokasi memori dilakukan di belakang layar.</p><blockquote><p>Di Rust, konstanta yang dibuat via <code>const</code> tidak memiliki alamat memori yang pasti, dan setiap kali dipergunakan maka terjadi proses copy value. Sedangkan konstanta yang dibuat via keyword <code>static</code> mempunyai alamat memori yg fix/pasti.</p><p>Lebih jelasnya mengenai static nantinya dibahas pada chapter <a href="/basic/static">Static</a>. Untuk sekarang silakan lanjut dulu ke pembahasan ke chapter-chapter berikutnya secara berurutan.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a73-naming-convention-konstanta">A.7.3. <em>Naming convention</em> konstanta<a class="hash-link" href="#a73-naming-convention-konstanta" title="Direct link to heading">​</a></h2><p>Sesuai anjuran di <a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">halaman dokumentasi Rust</a>,<a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer"><em>Naming convention</em></a>, aturan penulisan konstanta adalah menggunakan <strong>screaming snake case</strong>. Nama konstanta dituliskan dalam huruf kapital dengan separator tanda garis bawah atau underscore (<code>_</code>). Contohnya seperti: <code>NUMBER</code>, <code>SOME_DATA</code>, <code>CONFIGURATION_ENV_NAME</code>, dll.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/konstanta" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../konstanta</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/static">Static Item</a></li><li><a href="/basic/lifetime">Lifetime</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">https://rust-lang.github.io/api-guidelines/naming.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/custom_types/constants.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/custom_types/constants.html</a></li><li><a href="https://users.rust-lang.org/t/const-vs-static/52951/2" target="_blank" rel="noopener noreferrer">https://users.rust-lang.org/t/const-vs-static/52951/2</a></li><li><a href="https://mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/first-edition/const-and-static.html" target="_blank" rel="noopener noreferrer">https://mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/first-edition/const-and-static.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/tipe-data-string-literal"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.6. Tipe Data ➜ String Literal (&str)</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/operator"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.8. Operator</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a71-keyword-const" class="table-of-contents__link toc-highlight">A.7.1. Keyword <code>const</code></a></li><li><a href="#a72-keyword-static" class="table-of-contents__link toc-highlight">A.7.2. Keyword <code>static</code></a></li><li><a href="#a73-naming-convention-konstanta" class="table-of-contents__link toc-highlight">A.7.3. <em>Naming convention</em> konstanta</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/lifetime.html b/basic/lifetime.html index 4694aaa7..deae0c35 100644 --- a/basic/lifetime.html +++ b/basic/lifetime.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/lifetime/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/lifetime/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.44. Lifetime","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/lifetime/#webpage"},"wordCount":1938,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/lifetime/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/lifetime/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/lifetime","name":"A.44. Lifetime","description":"Pada chapter ini kita akan belajar tentang lifetime. Lifetime adalah yang digunakan oleh Rust compiler untuk memonitor umur dari references agar tetap dianggap valid.","datePublished":"2024-08-01T10:17:29.278Z","dateModified":"2024-08-01T10:17:29.278Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/lifetime/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/lifetime"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/lifetime/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.44. Lifetime","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/lifetime/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/lifetime/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.44. Lifetime","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/lifetime/#webpage"},"wordCount":1938,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/lifetime/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/lifetime/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/lifetime","name":"A.44. Lifetime","description":"Pada chapter ini kita akan belajar tentang lifetime. Lifetime adalah yang digunakan oleh Rust compiler untuk memonitor umur dari references agar tetap dianggap valid.","datePublished":"2024-08-30T07:44:49.294Z","dateModified":"2024-08-30T07:44:49.294Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/lifetime/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/lifetime"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/lifetime/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.44. Lifetime","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.44. Lifetime</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.44. Lifetime</h1></header><p>Pada chapter ini kita akan belajar tentang lifetime. Lifetime adalah yang digunakan oleh Rust compiler untuk memonitor umur dari references agar tetap dianggap valid.</p><p>Normalnya kita tidak perlu berurusan dengan lifetime, karena Rust-lah yang mengelola lifetime sebuah reference. Namun di luar itu, pada beberapa case kita bisa me-manage lifetime data dengan memanfaatkan <em>annotation</em>.</p><p>Ketika berurusan dengan data primitif maupun non-primitif tak perlu khawatir perihal urusan lifetime. Aspek lifetime hanya perlu diperhatikan sewaktu berurusan dengan data pointer/reference, apalagi kalau data tersebut keluar masuk block scope.</p><blockquote><p>Topik lifetime adalah salah satu yang paling membingungkan di Rust. Wajar jika membutuhkan waktu lebih lama untuk menguasainya. <em>Take your time</em>, pelajari pelan-pelan dan ulangi berkali-kali jika perlu.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a441-konsep-lifetime">A.44.1. Konsep Lifetime<a class="hash-link" href="#a441-konsep-lifetime" title="Direct link to heading">​</a></h2><p>Lifetime adalah yang digunakan oleh Rust compiler untuk memonitor umur dari references agar tetap valid. Lifetime menempel di variabel, lebih tepatnya di reference variabel.</p><p>Rust menerapkan default lifetime dalam pengecekan reference. Beberapa aturan pada default lifetime sudah kita pelajari pada chapter sebelumnya, seperti variabel yang hanya akan valid di dalam block dan invalid di luar block dan data yang akan di-dealokasi ketika sudah tidak ada reference-nya.</p><blockquote><p>Rust mengidentifikasi default lifetime menggunakan <strong>lifetime elision</strong>, yang juga akan dibahas pada chapter ini.</p></blockquote><p>Agar mudah memahami konsep default lifetime, mari mulai dengan kode sederhana berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> r </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"r: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kode di atas kalau di jalankan hasilnya error, karena <code>x</code> di-dealokasi ketika block expression selesai dieksekusi, meskipun data tersebut dipinjamkan pada <code>r</code> yang scope-nya berada di atasnya.</p><p>Kalau diilustrasikan, lifetime variabel <code>r</code> dan <code>x</code> kurang lebih seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// -----------+-- 'lf1</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// |</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// -+-- 'lf2 |</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> r </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// | |</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// -+ |</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"r: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// |</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// -----------+</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Setiap data memiliki default lifetime.</p><ul><li>Variabel <code>r</code> memiliki lifetime yang pada contoh di atas diilustrasikan sebagai <code>'lf1</code>.</li><li>Variabel <code>x</code> memiliki lifetime yang pada contoh di atas diilustrasikan sebagai <code>'lf2</code>.</li><li>Lifetime <code>'lf2</code> milik variabel <code>x</code> menjadikan umur variabel tersebut valid mulai variabel tersebut dideklarasikan, hingga block expression selesai.</li><li>Lifetime <code>'lf2</code> sudah tidak valid di luar block expression. Inilah kenapa program di atas menjadi error.</li><li>Lifetime <code>'lf1</code> milik variabel <code>r</code> menjadikan umur variabel tersebut valid mulai variabel tersebut dideklarasikan, hingga block fungsi <code>main</code> selesai.</li></ul><p>Default lifetime bisa di-override menggunakan lifetime yang kita definisikan sendiri.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a442-relasi-antara-lifetime-dengan-owner-dan-borrower">A.44.2. Relasi antara lifetime dengan owner dan borrower<a class="hash-link" href="#a442-relasi-antara-lifetime-dengan-owner-dan-borrower" title="Direct link to heading">​</a></h2><p>Lifetime menjadi salah satu hal yang wajib diperhatikan ketika bermain dengan references. Operasi seperti melempar reference ke luar scope, atau memasukan reference ke block scope baru berpotensi memunculkan error yang berhubungan dengan lifetime.</p><p>Setelah ini kita akan praktik penerapan pembuatan lifetime, namun sebelum itu mari pelajari dulu pembahasan pada section berikut agar tau kenapa dan kapan kita harus menerapkan lifetime yang kita buat sendiri.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"darkspear is better than zandalari"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">print_mesage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">print_mesage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the message: {m}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Program di atas menampilkan pesan string via fungsi <code>print_message</code>. Data string didapat dari parameter pointer <code>m</code> milik fungsi tersebut.</p><p>Pada fungsi <code>main</code>, ada string bernama <code>message</code>, niainya dipinjamkan sebagai argument pemanggilan fungsi <code>print_message</code>.</p><p>Setelah eksekusi fungsi <code>print_message</code> selesai, yang terjadi di block kode fungsi tersebut adalah data <code>m</code> di-dealokasi. Hasil dari dealokasi sendiri adalah nilai sebenarnya dikembalikan ke owner (pemilik aslinya). Sampai sini harusnya cukup jelas.</p><p>Sekarang lanjut ke contoh ke-2 berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">String</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">get_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the message: {m}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"darkspear is better than zandalari"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">message</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Esensi program ke-2 ini sama seperti program sebelumnya, yaitu menampilkan pesan string yang sama persis. Perbedaannya, pesan string datanya ada di dalam fungsi <code>get_message</code>. Fungsi tersebut dipanggil kemudian reference dari pesan string dipinjamkan, maka dengan ini variabel <code>m</code> pada fungsi <code>main</code> nilainya adalah data pinjaman (borrowing).</p><p>Ketika di-run, hasilnya error.</p><p><img loading="lazy" alt="Lifetime" src="/assets/images/lifetime-1-49980dd171b372c65a19ab2c8bd2334f.png" width="779" height="275" class="img_ev3q"></p><p>Error tersebut muncul karena setelah eksekusi fungsi <code>get_message</code> selesai, semua data dalam fungsi tersebut di-dealokasi. Termasuk variabel <code>message</code> yang merupakan owner dari data yang dipinjamkan ke variabel <code>m</code>.</p><p>Ok, jadi owner-nya sudah di-dealokasi, lalu bagaimana nasib dari peminjam data (variabel <code>m</code>)? Variabel tersebut menjadi bermasalah, karena owner data aslinya sudah tidak ada di memory, dan itulah kenapa muncul error.</p><blockquote><p>Error ini disebut dengan <strong>dangling reference</strong>, muncul ketika data di-share ke variabel lain tapi owner-nya sudah tidak ada di-memory.</p><p>Di pemrograman Rust, error jenis ini bisa di-identifikasi saat kompilasi.</p></blockquote><p>Solusi pada error di atas, salah satunya adalah dengan tidak menggunakan tipe data pointer sebagai nilai balik. Gunakan saja tipe data <code>String</code>. Solusi ini aman, karena tipe data <code>String</code> owner-nya selalu berpindah saat ada operasi asignment, dengan ini maka manajemen memory menjadi efisien.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ganti kode berikut ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"darkspear is better than zandalari"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> message</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... menjadi ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"darkspear is better than zandalari"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> message</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ok, bagaimana dengan tipe data lain yang mengadopsi <em>copy semantics</em>, misalnya ada kebutuhan untuk share reference data tersebut ke block lain. Mari kita coba.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> n </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">get_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the number: {n}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">13</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">number</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Lifetime" src="/assets/images/lifetime-2-1116463c388b09c1a8822e3b1ff4682c.png" width="782" height="276" class="img_ev3q"></p><p>Bisa dilihat, ada error, karena kondisi tersebut menimbulkan dangling reference (sama seperti contoh sebelumnya). Namun pada contoh ini kita tidak bisa menerapkan solusi yang sama, karena variabel <code>number</code> mengadopsi <em>copy semantics</em>, bukan <em>move semantics</em>.</p><p>Di Rust error dangling reference diantisipasi saat kompilasi, menjadikan kode tidak bisa sukses dikompilasi.</p><p>Solusi yang bisa diambil adalah dengan menjadikan data tersebut tidak memiliki owner (atau owner-nya adalah program), caranya dengan langsung mengembalikan reference data tanpa perlu menampungnya terlebih dahulu ke variabel, seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> n </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">get_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the number: {n}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token number" style="color:#36acaa">13</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ok, tapi entah kenapa ketika dilihat masih muncul error.</p><p><img loading="lazy" alt="Lifetime" src="/assets/images/lifetime-3-d0688570ad7d667d603cde8665c863fc.png" width="777" height="260" class="img_ev3q"></p><p>Error tersebut muncul karena meskipun owner data <code>&13</code> adalah program, ketika eksekusi fungsi <code>get_number</code> selesai, data borrow tersebut langsung di-dealokasi, dan tidak ada variabel lain di-luar scope yang menampung reference data tersebut.</p><p>Agar tidak terjadi proses dealokasi, harus ada variabel yang menampung reference tersebut di-luar scope, tapi cara ini tidak bisa dilakukan karena data-nya saja baru dideklarasikan dalam block fungsi, tidak mungkin tiba-tiba ada yang menampung di-luar scope.</p><p>Solusi dari masalah ini adalah menggunakan lifetime <code>'static</code> (yang detailnya sudah dibahas pada chapter sebelumnya). Dengan ini maka data reference <code>&13</code> hidup lebih lama dari umur yang sebenarnya sudah ditakdirkan untuk data data tersebut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token number" style="color:#36acaa">13</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Namun perlu diingat, bahwa data efek dari lifetime <code>'static</code> adalah data tidak akan pernah di-dealokasi. Data tersebut akan hidup selamanya di program hingga kecuali program dimatikan. Karena alasan itulah penggunaan <code>'static</code> pada contoh ini bisa disebut berlebihan.</p><p>Solusi yang lebih pas adalah dengan membuat lifetime sendiri dengan cara menerapkan <strong>lifetime annotation</strong> (tidak menggunakan lifetime <code>'static</code>).</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a443-lifetime-annotation-dan-penerapannya-pada-return-value">A.44.3. Lifetime annotation dan penerapannya pada return value<a class="hash-link" href="#a443-lifetime-annotation-dan-penerapannya-pada-return-value" title="Direct link to heading">​</a></h2><p>Lifetime dituliskan dengan notasi <code>'nama_lifetime</code>. Dengan notasi tersebut, kita bisa menciptakan lifetime baru misalnya <code>'a</code>, <code>'b</code>, <code>'ini_lifetime</code>, dst.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// => tipe data reference i32</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// => tipe data reference i32 dengan lifetime 'a</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// => tipe data mutable reference i32 dengan lifetime 'a</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Lifetime dan block label memiliki bentuk literal yang sama, keduanya diawali tanda kutip <code>'</code>. Yang membedakan hanya pada tempat di mana syntax tersebut ditulis.</p></blockquote><p>Kegunaan dari lifetime annotation adalah untuk menginformasikan compiler agar reference tidak langsung didealokasikan setelah eksekusi block selesai. Agar lebih jelas mari kita langsung terapkan saja pada fungsi <code>get_number</code> yang sudah ditulis. Silakan tambahkan lifetime dengan nama bebas. Di sini penulis gunakan <code>'my_lifetime</code>.nnnn</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'my_lifetime</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token number" style="color:#36acaa">13</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Lifetime" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAArEAAAC4CAIAAAB7KCObAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTItMT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AAAA0AQAAAAAQBMAAAAAAE0AAAAAgDnVBAAAAABAEwAAAAAATQAAAAAANAEAAAAA0AQenLn+mY2Pt2z86eEz1BwAAACwyJpA48b7Wx5c/xx1BwAAACy6Jth67qGN9z9L3QEAAABoAjQBAAAAgCZAEwAAAABoggJHH37w8UM3qDwAAABg0TVBIQu2EC0AAAAAFlsTnHuI6YgAAAAAmoB8AgAAAABNgCYAAAAA0ARoAgAAAABNYIH3GAIAAACLrgmK7x0wEREAAABYcE0AAAAAADQBAAAAANAEAAAAAEATAAAAAABNAAAAAAA0AQAAAADQBAAAAABAEwAAAAAATQAAAAAANAEAAAAA0AQAAAAAQBMAAAAAAKAJAAAAAIAmAAAAAACaAAAAAABoAgAAAACgCQAAAACAJgAAAAAAmgAAAAAAcfw/lBNjbmDMKOMAAAAASUVORK5CYII=" width="689" height="184" class="img_ev3q"></p><p>Meski sudah ditambahkan, error tetap muncul, karena lifetime tersebut tidak dikenal. Berbeda dengan lifetime <code>'static</code> yang memang sudah disediakan oleh Rust.</p><p>Step selanjutnya adalah mengenalkan lifetime tersebut, caranya dengan menambahkannya dalam notasi parameter generic fungsi, seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_number</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'my_lifetime</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'my_lifetime</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token number" style="color:#36acaa">13</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>get_number</code> sekarang tidak menghasilkan error, karena reference yang dikembalikan memiliki umur <code>'my_lifetime</code> yang membuatnya tetap valid sampai menjadi return value, meski eksekusi block fungsi-nya sendiri sudah selesai. Efeknya, data yang di-return bisa ditampung di luar scope fungsi <code>get_number</code>.</p><p><img loading="lazy" alt="Lifetime" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcwAAABoCAIAAADzQ1edAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6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tanpa adanya lifetime pada return value, maka data return value akan langsung di-dealokasi setelah block fungsi selesai dieksekusi. Tapi karena hal ini <em>by default</em> sudah di-handle Rust, maka kita tidak perlu memikirkannya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a444-lifetime-pada-parameter">A.44.4. Lifetime pada parameter<a class="hash-link" href="#a444-lifetime-pada-parameter" title="Direct link to heading">​</a></h2><p>Pada praktik ini kita akan bahas penerapan lifetime pada parameter.</p><p>Silakan perhatikan kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kode di atas tidak menghasilkan error, karena kalau dilihat dari sudut pandang lifetime (sesuai dengan aturan lifetime elision), yang sebenarnya terjadi adalah kurang lebih seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v2</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada saat parameter <code>x</code> masuk ke fungsi, <em>by default</em> variabel tersebut memiliki lifetime (yang pada contoh di atas diilustrasikan dengan `'a'). Lifetime tersebut akan aktif hingga menjadi return value karena lifetime yang sama digunakan juga pada return value. Dengan ini nantinya setelah fungsi selesai dieksekusi, nilai baliknya tetap bisa ditampung.</p><p>Beda lagi jika lifetime lain digunakan pada nilai balik fungsi, misalnya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v3</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Lifetime" src="/assets/images/lifetime-6-661acde878a7b7fc851b9e76b22e60a7.png" width="736" height="204" class="img_ev3q"></p><p>Error muncul dengan keterangan kurang lebih: data yang dijadikan return value pada block fungsi akan valid untuk lifetime <code>'b</code>, namun data yang dijadikan return value hanya valid untuk lifetime <code>'a</code>.</p><p>Dari sini bisa ditarik kesimpulan: data yang didapat dari luar scope (yang memiliki lifetime sendiri) ketika digunakan sebagai nilai balik, lifetime-nya harus sama.</p><p>Sekarang mari kita modifikasi lagi fungsi menjadi seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v4</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'c</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'c</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi di atas memiliki 2 buah lifetime, yaitu:</p><ul><li>Lifetime <code>'a</code>, digunakan pada parameter <code>x</code></li><li>Lifetime <code>'b</code>, digunakan pada parameter <code>y</code></li><li>Lifetime <code>'c</code>, digunakan pada return value</li></ul><p>Karena yang dikembalikan ada data baru, yaitu string <code>hello</code>, maka kode di atas tidak error. Data tersebut lifetime-nya adalah <code>'c</code>, dan akan tetap valid setelah pemanggilan fungsi selesai.</p><p>Beda situasi jika yang dikembalikan adalah data dari parameter, misalnya, <code>x</code>. Jika seperti ini, maka lifetime yang sama dengan lifetime parameter <code>x</code> harus digunakan, yaitu lifetime <code>'b</code>. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v5</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'c</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas, lifetime <code>'c</code> tidak dipergunakan sama sekali, maka lifetime tersebut boleh dihapus dari fungsi. Silakan cukup definisikan lifetime yang hanya digunakan saja pada block parameter generic.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v6</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dimisalkan ada seleksi kondisi, jadi return value bisa saja <code>x</code>, bisa juga <code>y</code>. Jika seperti ini, maka <code>x</code>, <code>y</code>, dan juga return value harus memiliki lifetime yang sama.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v7</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a445-lifetime-elision">A.44.5. Lifetime elision<a class="hash-link" href="#a445-lifetime-elision" title="Direct link to heading">​</a></h2><p>Sampai section ini kita telah mempelajari kurang lebih 4 point berikut:</p><ol><li>Setiap data, lebih tepatnya setiap reference memiliki lifetime.</li><li>Lifetime digunakan oleh Rust dalam penentuan kapan reference tersebut di-dealokasi.</li><li>Pada beberapa case, lifetime perlu di-urus secara eksplisit (contohnya seperti pada fungsi <code>do_something_vx</code> di atas).</li><li>Pengecekan lifetime terjadi saat kompilasi.</li></ol><p>Rust memiliki sesuatu yang disebut dengan <strong>lifetime elision</strong>, isinya adalah aturan yang digunakan oleh Rust dalam menganalisa reference untuk menentukan lifetime <em>default</em>-nya.</p><p>Namun, bukan berarti Rust akan selalu tau lifetime tiap reference. Pada beberapa case, Rust membutuhkan bantuan kita selaku programmer untuk menginformasikan lifetime reference kode yang ditulis, contohnya seperti pada fungsi <code>do_something_v7</code> di atas.</p><p>Meskipun demikian, tak usah terlalu khawatir, karena pengecekan lifetime reference terjadi saat kompilasi, dan ketika ada reference yang perlu dikasih <em>annotication</em>, Rust akan menginformasikan ke kita via pesan error.</p><blockquote><p>Untuk sekarang, pembahasan detail mengenai lifetime elision tidak dibahas pada ebook ini. Silakan gunakan dokumentasi official Rust untuk <a href="https://doc.rust-lang.org/nomicon/lifetime-elision.html" target="_blank" rel="noopener noreferrer">lifetime elision</a> jika berminat untuk pengkajian yang lebih dalam.</p></blockquote><p>Jika kawan-kawan menggunakan <code>rust-analyzer</code> extension di VSCode, tak perlu meng-compiler program untuk memunculkan error-nya, karena langsung muncul saat penulisan kode program.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a446-lifetime-pada-struct">A.44.6. Lifetime pada struct<a class="hash-link" href="#a446-lifetime-pada-struct" title="Direct link to heading">​</a></h2><p>Tak hanya pada parameter fungsi dan return value fungsi, lifetime juga bisa diterapkan pada (property) struct.</p><p>Ketika menggunakan tipe data reference sebagai tipe property struct, Rust langsung menginformasikan kita via error message jika tidak ada anotasi lifetime pada field tersebut.</p><p>Contohnya bisa dilihat pada kode di bawah ini. Pesan error muncul karena tipe data <code>&str</code> pada property struct tidak ada lifetime annotation-nya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Book</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Lifetime" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtUAAACgCAIAAABMoQdnAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENv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vAHQgghhOAPhBBCCKHx+IPnnyKEEEJofvxRff8LN98ihBBCaG78gRBCCCEEfyCEEEII/kAIIYQQgj8QQgghBH8ghBBCCMEfCCGEEII/EEIIIQR/IIQQQgjBHwghhBCCPxBCCCGE4A+EEEIIwR8IIYQQQvAHQgghhOAPhBBCCMEfCCGEEELwB0IIIYT2jP4fTuXrBQlA1EIAAAAASUVORK5CYII=" width="725" height="160" class="img_ev3q"></p><p>Solusinya, tambahkan anotasi lifetime pada tipe data <code>&str</code>, dan juga daftarkan lifetime tersebut pada struct. Notasi penulisannya seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// struct NamaStruct<'lifetime_annotication> {</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// field: &'lifetime_annotication tipe_data,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// }</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Book</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh jika ada lebih dari 1 field dengan lifetime sama:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Book</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> description</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh jika ada beberapa field yang di antaranya memiliki lifetime berbeda (artinya ada lebih dari 1 lifetime):</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Book</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'def</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> description</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> price</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'def</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> book </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Book</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"The Silmarillion"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> description</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Good story, 10/10, would read again"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> price</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token number" style="color:#36acaa">99</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a447-lifetime-pada-method">A.44.7. Lifetime pada method<a class="hash-link" href="#a447-lifetime-pada-method" title="Direct link to heading">​</a></h2><p>Ada 2 hal yang perlu diketahui dalam penerapan lifetime pada method. Yang pertama, lifetime annotication harus ditulis pada block <code>impl</code> meskipun pada block method tidak digunakan secara langsung.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Book</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'def</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> description</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> price</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'def</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'def</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token class-name">Book</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'def</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> info </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} (${}), {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">title</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">price</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">description</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> info</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat statement block <code>impl<'abc, 'def> Book<'abc, 'def></code>, lifetime annotation-nya sama persis dengan yang ada di struct. Jika ingin mengetes, silakan coba saja hapus syntax lifetime dari statement itu, pasti muncul error.</p><p>Hal ke-2 yang penting diketahui, pada block kode method, tidak perlu menuliskan lifetime annotation, karena sudah ditulis di block kode <code>impl</code>.</p><p>Sebagai contoh, dua method berikut tidak memunculkan error:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'def</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token class-name">Book</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'def</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> info </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} (${}), {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">title</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">price</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">description</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> info</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_price</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">price</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bandingkan dengan fungsi <code>get_book_price</code> berikut, error muncul karena lifetime annotation tidak ditambahkan ke block fungsi (meskipun fungsi tersebut mengembalikan property <code>price</code> milik struct <code>Book</code> yang sudah memiliki lifetime sendiri). Hal ini karena data <code>&i32</code> yang dikembalikan statement <code>book.get_price()</code> langsung didealokasi setelah block fungsi <code>get_book_price</code> selesai dieksekusi.</p><p><img loading="lazy" alt="Lifetime" src="/assets/images/lifetime-8-da413de408eba24af5e0d0db885af9fc.png" width="813" height="223" class="img_ev3q"></p><p>Agar error tidak muncul, tambahkan lifetime:</p><ol><li>ke return value (karena tipe data return value adalah reference)</li><li>lalu pada parameter <code>book</code> (karena di block fungsi return value berasal dari data milik property variabel <code>book</code>),</li><li>dan juga tak lupa daftarkan lifetime annotation pada block fungsi <code>get_book_price</code>.</li></ol><p>Kurang kode menjadi seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_book_price</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'ghi</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">book</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'ghi</span><span class="token plain"> </span><span class="token class-name">Book</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'ghi</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> book</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">get_price</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> book </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Book</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"The Silmarillion"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> description</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Good story, 10/10, would read again"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> price</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token number" style="color:#36acaa">99</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> book</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">get_info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the price: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">get_book_price</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">book</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Run program, hasilnya sukses.</p><p><img loading="lazy" alt="Lifetime" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdkAAAB/CAIAAAAsFy8SAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc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dosNmMhU0p1wl4SFxMbADm1iz+dg7Notw2umwITSNO2t9ksex3dsWRaJE7vRRmLXHwebGw7ETXsPvgYVzDzwWLoAdt+Nd3RqiPrIqHkYmIvT6uRU32+k5cEd3kdetSPNcjFBEEQ5GKCIAiCXEwQBEEuJgiCIPbn4o136Z2ZIClBEMQqXKxL9l0SFxdotBMEQVwhF2+AYo12giCI7bhYUfVepiWvqDuX6b4DVXGt9PiECtUnLtRoJwiCOIJf3EpLfrqrQPcdfTSql+7j4mKNdoIgiCPFKMq15LGInlv3HRJ9mZK96Rh7NdoJgiCOx8UFWvJYus+tb4lCt3VK9jjo4dVoJwiCOCYXO7lK9Yt9XKzpFDZjSqdGO0EQxKZcjOTDlmjJJwfU5ETB8UnMSJMXl+6IF1uNVS8SBEFsysVii8IyLXklmVv3Pf0BHoBVtnZXodFOEASxORe3BbeHEQRBkIsJgiDIxeRigiCII3AxQRAEQS4mCIIgFxMEQRDkYoIgCHIxQRAEQS4mCIIgFxMEQRDkYoIgCHIxQRAEEeJ/kBoUtRad3qEAAAAASUVORK5CYII=" width="473" height="127" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a448-generic-parameter--trait-bounds--lifetime">A.44.8. Generic parameter + trait bounds + lifetime<a class="hash-link" href="#a448-generic-parameter--trait-bounds--lifetime" title="Direct link to heading">​</a></h2><p>Lalu bagaimana jika ada fungsi yang di situ ada penerapan trait bounds, ada juga generic parameter, dan lifetime annotation. Cara penulisannya seperti apa? Silakan lihat contoh berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">find_greater_number</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">cmp</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">PartialOrd</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> y </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>find_greater_number</code> di atas digunakan untuk mencari angka terbesar dari dua inputan parameter (<code>x</code> dan <code>y</code>), dengan tipe data yang digunakan adalah generic <code>T</code>. Dari sini maka nantinya fungsi ini bisa digunakan pada data bertipe <code>i32</code>, <code>f64</code>, dan data numerik lainnya.</p><p>Tipe <code>T</code> diasosiasikan dengan trait <code>std::cmp::PartialOrd</code> agar variabel dengan tipe tersebut bisa digunakan dalam seleksi kondisi <code>if</code> yang ada dalam block fungsi tersebut.</p><p>Ok, sampai sini semoga cukup jelas. Lalu bagaimana dengan lifetime annotation-nya? Karena lifetime annotation definisinya berada pada tempat yang sama dengan definisi tipe generic, maka langsung saja tulis di situ tanpa memperhatikan urutan. Sebagai contoh, dua definisi block fungsi berikut adalah ekuivalen.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello_v1</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello_v2</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sekarang kembali ke pembahasan di atas. Fungsi <code>find_greater_number</code> mengembalikan tipe data reference <code>&T</code> yang nilainya bisa saja dari <code>x</code> atau <code>y</code>. Dari sini maka wajib hukumnya untuk return value memiliki lifetime yang sama dengan <code>x</code> dan <code>y</code>. Itulah kenapa definisi fungsi <code>find_greater_number</code> agak panjang.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">find_greater_number</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token class-name">T</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Lanjut, mari kita panggil fungsi tersebut pada dua block expression. Block pertama untuk pengecekan data numerik <code>i32</code>, dan yang kedua untuk tipe <code>f64</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// i32 comparison test</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">13</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> y </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">20</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">find_greater_number</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">y</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// atau cukup `find_greater_number(&x, &y)`</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// f64 comparison test</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> y </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2.11</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">find_greater_number</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">y</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// atau cukup `find_greater_number(&x, &y)`</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program, hasilnya sesuai harapan, tidak ada error.</p><p><img loading="lazy" alt="Lifetime" src="/assets/images/lifetime-9-fix-96c668297e128c0b8d548a6cf72dfd0c.png" width="1072" height="200" class="img_ev3q"></p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/lifetime" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../lifetime</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html</a></li><li><a href="https://doc.rust-lang.org/nomicon/lifetimes.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/nomicon/lifetimes.html</a></li><li><a href="https://dev.to/takaakifuruse/rust-lifetimes-a-high-wall-for-rust-newbies-3ap" target="_blank" rel="noopener noreferrer">https://dev.to/takaakifuruse/rust-lifetimes-a-high-wall-for-rust-newbies-3ap</a></li><li><a href="https://anooppoommen.medium.com/lifetimes-in-rust-7f2331be998b" target="_blank" rel="noopener noreferrer">https://anooppoommen.medium.com/lifetimes-in-rust-7f2331be998b</a></li><li><a href="https://blog.logrocket.com/understanding-lifetimes-in-rust/" target="_blank" rel="noopener noreferrer">https://blog.logrocket.com/understanding-lifetimes-in-rust/</a></li><li><a href="https://educative.io/answers/what-are-generic-lifetime-parameters-in-a-rust-function" target="_blank" rel="noopener noreferrer">https://educative.io/answers/what-are-generic-lifetime-parameters-in-a-rust-function</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/static"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.43. Static Item</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/slice-memory-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.45. Slice Memory Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a441-konsep-lifetime" class="table-of-contents__link toc-highlight">A.44.1. Konsep Lifetime</a></li><li><a href="#a442-relasi-antara-lifetime-dengan-owner-dan-borrower" class="table-of-contents__link toc-highlight">A.44.2. Relasi antara lifetime dengan owner dan borrower</a></li><li><a href="#a443-lifetime-annotation-dan-penerapannya-pada-return-value" class="table-of-contents__link toc-highlight">A.44.3. Lifetime annotation dan penerapannya pada return value</a></li><li><a href="#a444-lifetime-pada-parameter" class="table-of-contents__link toc-highlight">A.44.4. Lifetime pada parameter</a></li><li><a href="#a445-lifetime-elision" class="table-of-contents__link toc-highlight">A.44.5. Lifetime elision</a></li><li><a href="#a446-lifetime-pada-struct" class="table-of-contents__link toc-highlight">A.44.6. Lifetime pada struct</a></li><li><a href="#a447-lifetime-pada-method" class="table-of-contents__link toc-highlight">A.44.7. Lifetime pada method</a></li><li><a href="#a448-generic-parameter--trait-bounds--lifetime" class="table-of-contents__link toc-highlight">A.44.8. Generic parameter + trait bounds + lifetime</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.44. Lifetime</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.44. Lifetime</h1></header><p>Pada chapter ini kita akan belajar tentang lifetime. Lifetime adalah yang digunakan oleh Rust compiler untuk memonitor umur dari references agar tetap dianggap valid.</p><p>Normalnya kita tidak perlu berurusan dengan lifetime, karena Rust-lah yang mengelola lifetime sebuah reference. Namun di luar itu, pada beberapa case kita bisa me-manage lifetime data dengan memanfaatkan <em>annotation</em>.</p><p>Ketika berurusan dengan data primitif maupun non-primitif tak perlu khawatir perihal urusan lifetime. Aspek lifetime hanya perlu diperhatikan sewaktu berurusan dengan data pointer/reference, apalagi kalau data tersebut keluar masuk block scope.</p><blockquote><p>Topik lifetime adalah salah satu yang paling membingungkan di Rust. Wajar jika membutuhkan waktu lebih lama untuk menguasainya. <em>Take your time</em>, pelajari pelan-pelan dan ulangi berkali-kali jika perlu.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a441-konsep-lifetime">A.44.1. Konsep Lifetime<a class="hash-link" href="#a441-konsep-lifetime" title="Direct link to heading">​</a></h2><p>Lifetime adalah yang digunakan oleh Rust compiler untuk memonitor umur dari references agar tetap valid. Lifetime menempel di variabel, lebih tepatnya di reference variabel.</p><p>Rust menerapkan default lifetime dalam pengecekan reference. Beberapa aturan pada default lifetime sudah kita pelajari pada chapter sebelumnya, seperti variabel yang hanya akan valid di dalam block dan invalid di luar block dan data yang akan di-dealokasi ketika sudah tidak ada reference-nya.</p><blockquote><p>Rust mengidentifikasi default lifetime menggunakan <strong>lifetime elision</strong>, yang juga akan dibahas pada chapter ini.</p></blockquote><p>Agar mudah memahami konsep default lifetime, mari mulai dengan kode sederhana berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> r </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"r: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kode di atas kalau di jalankan hasilnya error, karena <code>x</code> di-dealokasi ketika block expression selesai dieksekusi, meskipun data tersebut dipinjamkan pada <code>r</code> yang scope-nya berada di atasnya.</p><p>Kalau diilustrasikan, lifetime variabel <code>r</code> dan <code>x</code> kurang lebih seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// -----------+-- 'lf1</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// |</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// -+-- 'lf2 |</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> r </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// | |</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// -+ |</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"r: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// |</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// -----------+</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Setiap data memiliki default lifetime.</p><ul><li>Variabel <code>r</code> memiliki lifetime yang pada contoh di atas diilustrasikan sebagai <code>'lf1</code>.</li><li>Variabel <code>x</code> memiliki lifetime yang pada contoh di atas diilustrasikan sebagai <code>'lf2</code>.</li><li>Lifetime <code>'lf2</code> milik variabel <code>x</code> menjadikan umur variabel tersebut valid mulai variabel tersebut dideklarasikan, hingga block expression selesai.</li><li>Lifetime <code>'lf2</code> sudah tidak valid di luar block expression. Inilah kenapa program di atas menjadi error.</li><li>Lifetime <code>'lf1</code> milik variabel <code>r</code> menjadikan umur variabel tersebut valid mulai variabel tersebut dideklarasikan, hingga block fungsi <code>main</code> selesai.</li></ul><p>Default lifetime bisa di-override menggunakan lifetime yang kita definisikan sendiri.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a442-relasi-antara-lifetime-dengan-owner-dan-borrower">A.44.2. Relasi antara lifetime dengan owner dan borrower<a class="hash-link" href="#a442-relasi-antara-lifetime-dengan-owner-dan-borrower" title="Direct link to heading">​</a></h2><p>Lifetime menjadi salah satu hal yang wajib diperhatikan ketika bermain dengan references. Operasi seperti melempar reference ke luar scope, atau memasukan reference ke block scope baru berpotensi memunculkan error yang berhubungan dengan lifetime.</p><p>Setelah ini kita akan praktik penerapan pembuatan lifetime, namun sebelum itu mari pelajari dulu pembahasan pada section berikut agar tau kenapa dan kapan kita harus menerapkan lifetime yang kita buat sendiri.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"darkspear is better than zandalari"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">print_mesage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">print_mesage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the message: {m}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Program di atas menampilkan pesan string via fungsi <code>print_message</code>. Data string didapat dari parameter pointer <code>m</code> milik fungsi tersebut.</p><p>Pada fungsi <code>main</code>, ada string bernama <code>message</code>, niainya dipinjamkan sebagai argument pemanggilan fungsi <code>print_message</code>.</p><p>Setelah eksekusi fungsi <code>print_message</code> selesai, yang terjadi di block kode fungsi tersebut adalah data <code>m</code> di-dealokasi. Hasil dari dealokasi sendiri adalah nilai sebenarnya dikembalikan ke owner (pemilik aslinya). Sampai sini harusnya cukup jelas.</p><p>Sekarang lanjut ke contoh ke-2 berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">String</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">get_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the message: {m}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"darkspear is better than zandalari"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">message</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Esensi program ke-2 ini sama seperti program sebelumnya, yaitu menampilkan pesan string yang sama persis. Perbedaannya, pesan string datanya ada di dalam fungsi <code>get_message</code>. Fungsi tersebut dipanggil kemudian reference dari pesan string dipinjamkan, maka dengan ini variabel <code>m</code> pada fungsi <code>main</code> nilainya adalah data pinjaman (borrowing).</p><p>Ketika di-run, hasilnya error.</p><p><img loading="eager" fetchpriority="high" alt="Lifetime" src="/assets/images/lifetime-1-49980dd171b372c65a19ab2c8bd2334f.png" width="779" height="275" class="img_CujE"></p><p>Error tersebut muncul karena setelah eksekusi fungsi <code>get_message</code> selesai, semua data dalam fungsi tersebut di-dealokasi. Termasuk variabel <code>message</code> yang merupakan owner dari data yang dipinjamkan ke variabel <code>m</code>.</p><p>Ok, jadi owner-nya sudah di-dealokasi, lalu bagaimana nasib dari peminjam data (variabel <code>m</code>)? Variabel tersebut menjadi bermasalah, karena owner data aslinya sudah tidak ada di memory, dan itulah kenapa muncul error.</p><blockquote><p>Error ini disebut dengan <strong>dangling reference</strong>, muncul ketika data di-share ke variabel lain tapi owner-nya sudah tidak ada di-memory.</p><p>Di pemrograman Rust, error jenis ini bisa di-identifikasi saat kompilasi.</p></blockquote><p>Solusi pada error di atas, salah satunya adalah dengan tidak menggunakan tipe data pointer sebagai nilai balik. Gunakan saja tipe data <code>String</code>. Solusi ini aman, karena tipe data <code>String</code> owner-nya selalu berpindah saat ada operasi asignment, dengan ini maka manajemen memory menjadi efisien.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ganti kode berikut ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"darkspear is better than zandalari"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> message</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... menjadi ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"darkspear is better than zandalari"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> message</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ok, bagaimana dengan tipe data lain yang mengadopsi <em>copy semantics</em>, misalnya ada kebutuhan untuk share reference data tersebut ke block lain. Mari kita coba.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> n </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">get_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the number: {n}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">13</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">number</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Lifetime" src="/assets/images/lifetime-2-1116463c388b09c1a8822e3b1ff4682c.png" width="782" height="276" class="img_CujE"></p><p>Bisa dilihat, ada error, karena kondisi tersebut menimbulkan dangling reference (sama seperti contoh sebelumnya). Namun pada contoh ini kita tidak bisa menerapkan solusi yang sama, karena variabel <code>number</code> mengadopsi <em>copy semantics</em>, bukan <em>move semantics</em>.</p><p>Di Rust error dangling reference diantisipasi saat kompilasi, menjadikan kode tidak bisa sukses dikompilasi.</p><p>Solusi yang bisa diambil adalah dengan menjadikan data tersebut tidak memiliki owner (atau owner-nya adalah program), caranya dengan langsung mengembalikan reference data tanpa perlu menampungnya terlebih dahulu ke variabel, seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> n </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">get_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the number: {n}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token number" style="color:#36acaa">13</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ok, tapi entah kenapa ketika dilihat masih muncul error.</p><p><img loading="lazy" alt="Lifetime" src="/assets/images/lifetime-3-d0688570ad7d667d603cde8665c863fc.png" width="777" height="260" class="img_CujE"></p><p>Error tersebut muncul karena meskipun owner data <code>&13</code> adalah program, ketika eksekusi fungsi <code>get_number</code> selesai, data borrow tersebut langsung di-dealokasi, dan tidak ada variabel lain di-luar scope yang menampung reference data tersebut.</p><p>Agar tidak terjadi proses dealokasi, harus ada variabel yang menampung reference tersebut di-luar scope, tapi cara ini tidak bisa dilakukan karena data-nya saja baru dideklarasikan dalam block fungsi, tidak mungkin tiba-tiba ada yang menampung di-luar scope.</p><p>Solusi dari masalah ini adalah menggunakan lifetime <code>'static</code> (yang detailnya sudah dibahas pada chapter sebelumnya). Dengan ini maka data reference <code>&13</code> hidup lebih lama dari umur yang sebenarnya sudah ditakdirkan untuk data data tersebut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token number" style="color:#36acaa">13</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Namun perlu diingat, bahwa data efek dari lifetime <code>'static</code> adalah data tidak akan pernah di-dealokasi. Data tersebut akan hidup selamanya di program hingga kecuali program dimatikan. Karena alasan itulah penggunaan <code>'static</code> pada contoh ini bisa disebut berlebihan.</p><p>Solusi yang lebih pas adalah dengan membuat lifetime sendiri dengan cara menerapkan <strong>lifetime annotation</strong> (tidak menggunakan lifetime <code>'static</code>).</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a443-lifetime-annotation-dan-penerapannya-pada-return-value">A.44.3. Lifetime annotation dan penerapannya pada return value<a class="hash-link" href="#a443-lifetime-annotation-dan-penerapannya-pada-return-value" title="Direct link to heading">​</a></h2><p>Lifetime dituliskan dengan notasi <code>'nama_lifetime</code>. Dengan notasi tersebut, kita bisa menciptakan lifetime baru misalnya <code>'a</code>, <code>'b</code>, <code>'ini_lifetime</code>, dst.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// => tipe data reference i32</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// => tipe data reference i32 dengan lifetime 'a</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// => tipe data mutable reference i32 dengan lifetime 'a</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Lifetime dan block label memiliki bentuk literal yang sama, keduanya diawali tanda kutip <code>'</code>. Yang membedakan hanya pada tempat di mana syntax tersebut ditulis.</p></blockquote><p>Kegunaan dari lifetime annotation adalah untuk menginformasikan compiler agar reference tidak langsung didealokasikan setelah eksekusi block selesai. Agar lebih jelas mari kita langsung terapkan saja pada fungsi <code>get_number</code> yang sudah ditulis. Silakan tambahkan lifetime dengan nama bebas. Di sini penulis gunakan <code>'my_lifetime</code>.nnnn</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'my_lifetime</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token number" style="color:#36acaa">13</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Lifetime" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAArEAAAC4CAIAAAB7KCObAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOn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ABNkIqnn36a+gIAAADQBGgCAAAAAE2AJgAAAADQBGgCAAAAAE0wWU2Qv4VXv21vmSsDAAAALKomKL7huzV/k3/+Vd8Kz12+8v7fblx6Qyx646JaUnCNCd0AAADA5tEExTd8tSYQL/Pf/8Yfb7xz+dQlRxNU0Bvs51oCAAAAm0MTFFLg8NW790pxoCMEuRQ4GtYEW7+zhiYAAAAANpEmKPIJ/N//jWgCterKG4e5lAAAAMDm0AS5ILj13q0iwfDMLVsceDSBTjIgnwAAAADYVJrA5BVWIwjvLafFCXJx8MdTz3ExAQAAgPnXBNWkA/07m49ofTowpgm2Hj71zt8ufoeLCQAAAGyOOIEZLMjTDFtogu+sMXwAAAAAbBZNYMID9/I0w2UjC+R7CHJqZVAlE5BPAAAAAGwuTQAAAAAANAEAAAAA0AQAAAAAQBMAAAAAAE0AAAAAgDnVBAAAAABAEwAAAAAATQAAAAAANAEAAAAA0AQenLn+mY2Pt2z86eEz1BwAAACwyJpA48b7Wx5c/xx1BwAAACy6Jth67qGN9z9L3QEAAABoAjQBAAAAgCZAEwAAAABoggJHH37w8UM3qDwAAABg0TVBIQu2EC0AAAAAFlsTnHuI6YgAAAAAmoB8AgAAAABNgCYAAAAA0ARoAgAAAABNYIH3GAIAAACLrgmK7x0wEREAAABYcE0AAAAAADQBAAAAANAEAAAAAEATAAAAAABNAAAAAAA0AQAAAADQBAAAAABAEwAAAAAATQAAAAAANAEAAAAA0AQAAAAAQBMAAAAAAKAJAAAAAIAmAAAAAACaAAAAAABoAgAAAACgCQAAAACAJgAAAAAAmgAAAAAAcfw/lBNjbmDMKOMAAAAASUVORK5CYII=" width="689" height="184" class="img_CujE"></p><p>Meski sudah ditambahkan, error tetap muncul, karena lifetime tersebut tidak dikenal. Berbeda dengan lifetime <code>'static</code> yang memang sudah disediakan oleh Rust.</p><p>Step selanjutnya adalah mengenalkan lifetime tersebut, caranya dengan menambahkannya dalam notasi parameter generic fungsi, seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_number</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'my_lifetime</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'my_lifetime</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token number" style="color:#36acaa">13</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>get_number</code> sekarang tidak menghasilkan error, karena reference yang dikembalikan memiliki umur <code>'my_lifetime</code> yang membuatnya tetap valid sampai menjadi return value, meski eksekusi block fungsi-nya sendiri sudah selesai. Efeknya, data yang di-return bisa ditampung di luar scope fungsi <code>get_number</code>.</p><p><img loading="lazy" alt="Lifetime" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcwAAABoCAIAAADzQ1edAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTItMTJUMTc6Mzk6MzMrMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyLTEyLTEzVDE3OjM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zSIe4USf48/9t09P7yMPwhKFS3ewXVP393CLVZml19EEJoqUj2cgs9IqgL+346Yjy5uwHZv8m/f+Ldx4PKo59J3G2Py+SBbC1ghbEIoQ2mCy4/TmHnTxeA5O4GZLtMwn/T6YIOrtbRT38cijF1miGD7BgyMyeLENoKsvnMwjaQ7X5ZR18k1rTDciZlEUKbQtYZ2C0dyf75ZR19ZciymgwhtARk5f2ypKSPOObuwTzrXx9koynd/Og2ZJeYkw3ngRFCaDJkswf3kpKHZDFC+cGX2H3Yu19KUISsOorYPg+y2RzEZW0D62QRQstCFiGEEJBFCCEgixBCQBYhhBCQRQghIIsQQkAWIYQQkEUIISCLEEIIyCKE0Eb6Hxjx0ddRBCZiAAAAAElFTkSuQmCC" width="460" height="104" class="img_CujE"></p><p>Tanpa adanya lifetime pada return value, maka data return value akan langsung di-dealokasi setelah block fungsi selesai dieksekusi. Tapi karena hal ini <em>by default</em> sudah di-handle Rust, maka kita tidak perlu memikirkannya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a444-lifetime-pada-parameter">A.44.4. Lifetime pada parameter<a class="hash-link" href="#a444-lifetime-pada-parameter" title="Direct link to heading">​</a></h2><p>Pada praktik ini kita akan bahas penerapan lifetime pada parameter.</p><p>Silakan perhatikan kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kode di atas tidak menghasilkan error, karena kalau dilihat dari sudut pandang lifetime (sesuai dengan aturan lifetime elision), yang sebenarnya terjadi adalah kurang lebih seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v2</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada saat parameter <code>x</code> masuk ke fungsi, <em>by default</em> variabel tersebut memiliki lifetime (yang pada contoh di atas diilustrasikan dengan `'a'). Lifetime tersebut akan aktif hingga menjadi return value karena lifetime yang sama digunakan juga pada return value. Dengan ini nantinya setelah fungsi selesai dieksekusi, nilai baliknya tetap bisa ditampung.</p><p>Beda lagi jika lifetime lain digunakan pada nilai balik fungsi, misalnya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v3</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Lifetime" src="/assets/images/lifetime-6-661acde878a7b7fc851b9e76b22e60a7.png" width="736" height="204" class="img_CujE"></p><p>Error muncul dengan keterangan kurang lebih: data yang dijadikan return value pada block fungsi akan valid untuk lifetime <code>'b</code>, namun data yang dijadikan return value hanya valid untuk lifetime <code>'a</code>.</p><p>Dari sini bisa ditarik kesimpulan: data yang didapat dari luar scope (yang memiliki lifetime sendiri) ketika digunakan sebagai nilai balik, lifetime-nya harus sama.</p><p>Sekarang mari kita modifikasi lagi fungsi menjadi seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v4</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'c</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'c</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi di atas memiliki 2 buah lifetime, yaitu:</p><ul><li>Lifetime <code>'a</code>, digunakan pada parameter <code>x</code></li><li>Lifetime <code>'b</code>, digunakan pada parameter <code>y</code></li><li>Lifetime <code>'c</code>, digunakan pada return value</li></ul><p>Karena yang dikembalikan ada data baru, yaitu string <code>hello</code>, maka kode di atas tidak error. Data tersebut lifetime-nya adalah <code>'c</code>, dan akan tetap valid setelah pemanggilan fungsi selesai.</p><p>Beda situasi jika yang dikembalikan adalah data dari parameter, misalnya, <code>x</code>. Jika seperti ini, maka lifetime yang sama dengan lifetime parameter <code>x</code> harus digunakan, yaitu lifetime <code>'b</code>. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v5</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'c</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas, lifetime <code>'c</code> tidak dipergunakan sama sekali, maka lifetime tersebut boleh dihapus dari fungsi. Silakan cukup definisikan lifetime yang hanya digunakan saja pada block parameter generic.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v6</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'b</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dimisalkan ada seleksi kondisi, jadi return value bisa saja <code>x</code>, bisa juga <code>y</code>. Jika seperti ini, maka <code>x</code>, <code>y</code>, dan juga return value harus memiliki lifetime yang sama.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_v7</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a445-lifetime-elision">A.44.5. Lifetime elision<a class="hash-link" href="#a445-lifetime-elision" title="Direct link to heading">​</a></h2><p>Sampai section ini kita telah mempelajari kurang lebih 4 point berikut:</p><ol><li>Setiap data, lebih tepatnya setiap reference memiliki lifetime.</li><li>Lifetime digunakan oleh Rust dalam penentuan kapan reference tersebut di-dealokasi.</li><li>Pada beberapa case, lifetime perlu di-urus secara eksplisit (contohnya seperti pada fungsi <code>do_something_vx</code> di atas).</li><li>Pengecekan lifetime terjadi saat kompilasi.</li></ol><p>Rust memiliki sesuatu yang disebut dengan <strong>lifetime elision</strong>, isinya adalah aturan yang digunakan oleh Rust dalam menganalisa reference untuk menentukan lifetime <em>default</em>-nya.</p><p>Namun, bukan berarti Rust akan selalu tau lifetime tiap reference. Pada beberapa case, Rust membutuhkan bantuan kita selaku programmer untuk menginformasikan lifetime reference kode yang ditulis, contohnya seperti pada fungsi <code>do_something_v7</code> di atas.</p><p>Meskipun demikian, tak usah terlalu khawatir, karena pengecekan lifetime reference terjadi saat kompilasi, dan ketika ada reference yang perlu dikasih <em>annotication</em>, Rust akan menginformasikan ke kita via pesan error.</p><blockquote><p>Untuk sekarang, pembahasan detail mengenai lifetime elision tidak dibahas pada ebook ini. Silakan gunakan dokumentasi official Rust untuk <a href="https://doc.rust-lang.org/nomicon/lifetime-elision.html" target="_blank" rel="noopener noreferrer">lifetime elision</a> jika berminat untuk pengkajian yang lebih dalam.</p></blockquote><p>Jika kawan-kawan menggunakan <code>rust-analyzer</code> extension di VSCode, tak perlu meng-compiler program untuk memunculkan error-nya, karena langsung muncul saat penulisan kode program.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a446-lifetime-pada-struct">A.44.6. Lifetime pada struct<a class="hash-link" href="#a446-lifetime-pada-struct" title="Direct link to heading">​</a></h2><p>Tak hanya pada parameter fungsi dan return value fungsi, lifetime juga bisa diterapkan pada (property) struct.</p><p>Ketika menggunakan tipe data reference sebagai tipe property struct, Rust langsung menginformasikan kita via error message jika tidak ada anotasi lifetime pada field tersebut.</p><p>Contohnya bisa dilihat pada kode di bawah ini. Pesan error muncul karena tipe data <code>&str</code> pada property struct tidak ada lifetime annotation-nya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Book</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Lifetime" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtUAAACgCAIAAABMoQdnAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTItMTNUMTU6MzI6MzIrMD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pj0dy3oty90jxtrJpSWmRQvPUdhXjtDJt/WqU97pZTUK/VCCJvfonuZ6lmm8b3v+i6/qFp887PX+KkRAghBH/Mkz8WV/N4/vr523fIfyCEEII/4I958cdLt/+b4gtCCCH4A/7wdfTQYxY4rj7+7S+/973Pv/OsXcIJhBBCCMEfs5JhDgMcBj7+99nvfvvIyTeffNou4QRCCCGE4I9ZyQKHsYEPmwixSziBEEIIoRnyB0IIIYQQ/IEQQggh+AMhhBBCCP5ACCGE0NLzx/Xbf3f/zw/c/5+v85QKhBBCCM2JP6ze//iBL2//AwOHEEIIofnxx4M//dr9j/+egUMIIYQQ/IEQQggh+AMhhBBCaDT+uPD1L//8tfcZOYQQQgjNjz8qBHmALAhCCCGE5sUfP/0at+AihBBCaO78QeYDIYQQQvAHQgghhOAPhBBCCKHx+IPnnyKEEEJofvxRff8LN98ihBBCaG78gRBCCCEEfyCEEEII/kAIIYQQgj8QQgghBH8ghBBCCMEfCCGEEII/EEIIIQR/IIQQQgjBHwghhBCCPxBCCCGE4A+EEEIIwR8IIYQQQvAHQgghhOAPhBBCCMEfCCGEEELwB0IIIYT2jP4fTuXrBQlA1EIAAAAASUVORK5CYII=" width="725" height="160" class="img_CujE"></p><p>Solusinya, tambahkan anotasi lifetime pada tipe data <code>&str</code>, dan juga daftarkan lifetime tersebut pada struct. Notasi penulisannya seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// struct NamaStruct<'lifetime_annotication> {</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// field: &'lifetime_annotication tipe_data,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// }</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Book</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh jika ada lebih dari 1 field dengan lifetime sama:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Book</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> description</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh jika ada beberapa field yang di antaranya memiliki lifetime berbeda (artinya ada lebih dari 1 lifetime):</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Book</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'def</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> description</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> price</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'def</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> book </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Book</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"The Silmarillion"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> description</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Good story, 10/10, would read again"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> price</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token number" style="color:#36acaa">99</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a447-lifetime-pada-method">A.44.7. Lifetime pada method<a class="hash-link" href="#a447-lifetime-pada-method" title="Direct link to heading">​</a></h2><p>Ada 2 hal yang perlu diketahui dalam penerapan lifetime pada method. Yang pertama, lifetime annotication harus ditulis pada block <code>impl</code> meskipun pada block method tidak digunakan secara langsung.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Book</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'def</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> description</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> price</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'def</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'def</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token class-name">Book</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'def</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> info </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} (${}), {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">title</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">price</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">description</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> info</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat statement block <code>impl<'abc, 'def> Book<'abc, 'def></code>, lifetime annotation-nya sama persis dengan yang ada di struct. Jika ingin mengetes, silakan coba saja hapus syntax lifetime dari statement itu, pasti muncul error.</p><p>Hal ke-2 yang penting diketahui, pada block kode method, tidak perlu menuliskan lifetime annotation, karena sudah ditulis di block kode <code>impl</code>.</p><p>Sebagai contoh, dua method berikut tidak memunculkan error:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'def</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token class-name">Book</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'def</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> info </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} (${}), {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">title</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">price</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">description</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> info</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_price</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">price</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bandingkan dengan fungsi <code>get_book_price</code> berikut, error muncul karena lifetime annotation tidak ditambahkan ke block fungsi (meskipun fungsi tersebut mengembalikan property <code>price</code> milik struct <code>Book</code> yang sudah memiliki lifetime sendiri). Hal ini karena data <code>&i32</code> yang dikembalikan statement <code>book.get_price()</code> langsung didealokasi setelah block fungsi <code>get_book_price</code> selesai dieksekusi.</p><p><img loading="lazy" alt="Lifetime" src="/assets/images/lifetime-8-da413de408eba24af5e0d0db885af9fc.png" width="813" height="223" class="img_CujE"></p><p>Agar error tidak muncul, tambahkan lifetime:</p><ol><li>ke return value (karena tipe data return value adalah reference)</li><li>lalu pada parameter <code>book</code> (karena di block fungsi return value berasal dari data milik property variabel <code>book</code>),</li><li>dan juga tak lupa daftarkan lifetime annotation pada block fungsi <code>get_book_price</code>.</li></ol><p>Kurang kode menjadi seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">get_book_price</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'ghi</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">book</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'ghi</span><span class="token plain"> </span><span class="token class-name">Book</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'ghi</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> book</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">get_price</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> book </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Book</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"The Silmarillion"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> description</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Good story, 10/10, would read again"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> price</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token number" style="color:#36acaa">99</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> book</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">get_info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the price: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">get_book_price</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">book</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Run program, hasilnya sukses.</p><p><img loading="lazy" alt="Lifetime" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdkAAAB/CAIAAAAsFy8SAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj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E5dAfyBaL9Iv1niGyfLSxMWymfBipSsUlZrxi8c/DSYc/M/qqWcEfMNStdY5by9wjPtA9AcfP/d9XDHqWnOxNC2ahgUFqbMYLROoLyZXz8Xqu6bDMV7sF4vg1bZ+cTQyJluVDQLVvxuC4cK2GjvnJ40Vro8TxbyoNFO9GK6U+pjHoi+lIL2Lux/e3kAIrKo2kUGCX/R+dd3urdKwYP06DIUP31iEZ6JRd7o4cJg6uQr6SItAwL2eYhr6C0K366Qv5zu5+C22Si5EkSyKonvVFfUg1Jb8P1zTfbH8YndBBRfjVgUtKhgEwM0xrQRXrvP7XtHgvXF0VDS/k7LQxWDhGvrvuDu0VX7VyMbjFm4d87RddLHYqGOGigtuL6tSEAQI3UN1N9MQ3DIGrbePrJcPPUQxT0N/QdosNmMhU0p1wl4SFxMbADm1iz+dg7Notw2umwITSNO2t9ksex3dsWRaJE7vRRmLXHwebGw7ETXsPvgYVzDzwWLoAdt+Nd3RqiPrIqHkYmIvT6uRU32+k5cEd3kdetSPNcjFBEEQ5GKCIAiCXEwQBEEuJgiCIPbn4o136Z2ZIClBEMQqXKxL9l0SFxdotBMEQVwhF2+AYo12giCI7bhYUfVepiWvqDuX6b4DVXGt9PiECtUnLtRoJwiCOIJf3EpLfrqrQPcdfTSql+7j4mKNdoIgiCPFKMq15LGInlv3HRJ9mZK96Rh7NdoJgiCOx8UFWvJYus+tb4lCt3VK9jjo4dVoJwiCOCYXO7lK9Yt9XKzpFDZjSqdGO0EQxKZcjOTDlmjJJwfU5ETB8UnMSJMXl+6IF1uNVS8SBEFsysVii8IyLXklmVv3Pf0BHoBVtnZXodFOEASxORe3BbeHEQRBkIsJgiDIxeRigiCII3AxQRAEQS4mCIIgFxMEQRDkYoIgCHIxQRAEQS4mCIIgFxMEQRDkYoIgCHIxQRAEEeJ/kBoUtRad3qEAAAAASUVORK5CYII=" width="473" height="127" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a448-generic-parameter--trait-bounds--lifetime">A.44.8. Generic parameter + trait bounds + lifetime<a class="hash-link" href="#a448-generic-parameter--trait-bounds--lifetime" title="Direct link to heading">​</a></h2><p>Lalu bagaimana jika ada fungsi yang di situ ada penerapan trait bounds, ada juga generic parameter, dan lifetime annotation. Cara penulisannya seperti apa? Silakan lihat contoh berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">find_greater_number</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">cmp</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">PartialOrd</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> y </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>find_greater_number</code> di atas digunakan untuk mencari angka terbesar dari dua inputan parameter (<code>x</code> dan <code>y</code>), dengan tipe data yang digunakan adalah generic <code>T</code>. Dari sini maka nantinya fungsi ini bisa digunakan pada data bertipe <code>i32</code>, <code>f64</code>, dan data numerik lainnya.</p><p>Tipe <code>T</code> diasosiasikan dengan trait <code>std::cmp::PartialOrd</code> agar variabel dengan tipe tersebut bisa digunakan dalam seleksi kondisi <code>if</code> yang ada dalam block fungsi tersebut.</p><p>Ok, sampai sini semoga cukup jelas. Lalu bagaimana dengan lifetime annotation-nya? Karena lifetime annotation definisinya berada pada tempat yang sama dengan definisi tipe generic, maka langsung saja tulis di situ tanpa memperhatikan urutan. Sebagai contoh, dua definisi block fungsi berikut adalah ekuivalen.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello_v1</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello_v2</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'abc</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sekarang kembali ke pembahasan di atas. Fungsi <code>find_greater_number</code> mengembalikan tipe data reference <code>&T</code> yang nilainya bisa saja dari <code>x</code> atau <code>y</code>. Dari sini maka wajib hukumnya untuk return value memiliki lifetime yang sama dengan <code>x</code> dan <code>y</code>. Itulah kenapa definisi fungsi <code>find_greater_number</code> agak panjang.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">find_greater_number</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token class-name">T</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'a</span><span class="token plain"> </span><span class="token class-name">T</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Lanjut, mari kita panggil fungsi tersebut pada dua block expression. Block pertama untuk pengecekan data numerik <code>i32</code>, dan yang kedua untuk tipe <code>f64</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// i32 comparison test</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">13</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> y </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">20</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">find_greater_number</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">y</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// atau cukup `find_greater_number(&x, &y)`</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// f64 comparison test</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> y </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2.11</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">find_greater_number</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">y</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// atau cukup `find_greater_number(&x, &y)`</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program, hasilnya sesuai harapan, tidak ada error.</p><p><img loading="lazy" alt="Lifetime" src="/assets/images/lifetime-9-fix-96c668297e128c0b8d548a6cf72dfd0c.png" width="1072" height="200" class="img_CujE"></p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/lifetime" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../lifetime</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html</a></li><li><a href="https://doc.rust-lang.org/nomicon/lifetimes.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/nomicon/lifetimes.html</a></li><li><a href="https://dev.to/takaakifuruse/rust-lifetimes-a-high-wall-for-rust-newbies-3ap" target="_blank" rel="noopener noreferrer">https://dev.to/takaakifuruse/rust-lifetimes-a-high-wall-for-rust-newbies-3ap</a></li><li><a href="https://anooppoommen.medium.com/lifetimes-in-rust-7f2331be998b" target="_blank" rel="noopener noreferrer">https://anooppoommen.medium.com/lifetimes-in-rust-7f2331be998b</a></li><li><a href="https://blog.logrocket.com/understanding-lifetimes-in-rust/" target="_blank" rel="noopener noreferrer">https://blog.logrocket.com/understanding-lifetimes-in-rust/</a></li><li><a href="https://educative.io/answers/what-are-generic-lifetime-parameters-in-a-rust-function" target="_blank" rel="noopener noreferrer">https://educative.io/answers/what-are-generic-lifetime-parameters-in-a-rust-function</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/static"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.43. Static Item</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/slice-memory-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.45. Slice Memory Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a441-konsep-lifetime" class="table-of-contents__link toc-highlight">A.44.1. Konsep Lifetime</a></li><li><a href="#a442-relasi-antara-lifetime-dengan-owner-dan-borrower" class="table-of-contents__link toc-highlight">A.44.2. Relasi antara lifetime dengan owner dan borrower</a></li><li><a href="#a443-lifetime-annotation-dan-penerapannya-pada-return-value" class="table-of-contents__link toc-highlight">A.44.3. Lifetime annotation dan penerapannya pada return value</a></li><li><a href="#a444-lifetime-pada-parameter" class="table-of-contents__link toc-highlight">A.44.4. Lifetime pada parameter</a></li><li><a href="#a445-lifetime-elision" class="table-of-contents__link toc-highlight">A.44.5. Lifetime elision</a></li><li><a href="#a446-lifetime-pada-struct" class="table-of-contents__link toc-highlight">A.44.6. Lifetime pada struct</a></li><li><a href="#a447-lifetime-pada-method" class="table-of-contents__link toc-highlight">A.44.7. Lifetime pada method</a></li><li><a href="#a448-generic-parameter--trait-bounds--lifetime" class="table-of-contents__link toc-highlight">A.44.8. Generic parameter + trait bounds + lifetime</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/method.html b/basic/method.html index 5cb390ba..358683e0 100644 --- a/basic/method.html +++ b/basic/method.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/method/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/method/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.25. Method","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/method/#webpage"},"wordCount":563,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/method/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/method/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/method","name":"A.25. Method","description":"Pada chapter ini kita akan belajar tentang method beserta perbedaannya dengan associated function.","datePublished":"2024-08-01T10:17:29.070Z","dateModified":"2024-08-01T10:17:29.070Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/method/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/method"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/method/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.25. Method","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/method/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/method/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.25. Method","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/method/#webpage"},"wordCount":563,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/method/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/method/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/method","name":"A.25. Method","description":"Pada chapter ini kita akan belajar tentang method beserta perbedaannya dengan associated function.","datePublished":"2024-08-30T07:44:49.392Z","dateModified":"2024-08-30T07:44:49.392Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/method/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/method"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/method/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.25. Method","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.25. Method</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.25. Method</h1></header><p>Pada chapter ini kita akan belajar tentang method beserta perbedaannya dengan <em>associated function</em>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a251-method-vs-associated-function">A.25.1. Method vs <em>associated function</em><a class="hash-link" href="#a251-method-vs-associated-function" title="Direct link to heading">​</a></h2><p>Method adalah <em>associated item</em> yang hanya bisa diakses lewat instance/object, berbeda dengan <em>associated function</em> yang pengaksesan fungsinya via tipe data struct.</p><p>Silakan lihat ilustrasi kode berikut, lalu pelajari penjelasan di bawahnya untuk mencari tau perbedaan <em>associated function</em> vs method.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// associated function</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> my_car</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> info</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> my_car</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Fungsi <code>new</code> di situ adalah <em>associated function</em> milik struct <code>Car</code>. Dengannya object baru bernama <code>my_car</code> bertipe <code>Car</code> dibuat.</li><li>Object <code>my_car</code> adalah variabel bertipe <code>Car</code>. Via object tersebut method bernama <code>info</code> diakses.</li><li>Method <code>info</code> tidak bisa diakses via struct <code>Car</code>. Dan <em>associated function</em> <code>new</code> juga tidak bisa diakses dari instance/object <code>my_car</code>.</li></ul><blockquote><p>Di bahasa pemrograman lain, <em>associated function</em> disebut dengan <strong>class method</strong>, sedangkan method disebut dengan <strong>instance method</strong></p></blockquote><p>Pengaksesan <em>associated function</em> dilakukan menggunakan notasi path dengan separator <code>::</code>, contohnya seperti <code>Car::new()</code>. Sedangkan pengaksesan method menggunakan separator <code>.</code>, contoh: <code>my_car.info()</code>.</p><p>Agar lebih jelas, mari lanjut ke bagian praktik. Siapkan package dengan struktur seperti berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── models.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Buka file <code>models.rs</code>, isi dengan deklarasi struct <code>Car</code> berikut diikuti dengan blok kode <code>impl</code> untuk associated items-nya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/models.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> manufacture_year</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a252-deklarasi-method">A.25.2. Deklarasi method<a class="hash-link" href="#a252-deklarasi-method" title="Direct link to heading">​</a></h2><p>Cara deklarasi method mirip dengan <em>associated function</em>, perbedaannya adalah parameter pertama harus diisi dengan <code>&self</code> pada deklarasi method. Parameter tersebut menjadi identifier apakah fungsi merupakan <em>associated function</em> atau <em>method</em>.</p><blockquote><p>Object <code>self</code> merupakan representasi dari <em>current instance</em> atau <em>current object</em>.</p><p>Statement <code>&self</code> artinya kita melakukan operasi <em>borrowing</em> terhadap object <code>self</code>.</p><p>Lebih jelasnya mengenai borrowing dibahas pada chapter terpisah.</p></blockquote><p>Silakan tambahkan <em>associated function</em> bernama <code>new</code> dan method bernama <code>info</code> berikut. Tulis keduanya dalam blok kode <code>impl</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/models.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> manufacture_year</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">manufacture_year </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} model {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">brand</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">model</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"{} model {}, manufactured at {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">brand</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">model</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">manufacture_year</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat, deklarasi method adalah mirip dengan fungsi biasa, perbedaannya ada pada deklarasi parameter pertama fungsi yang diisi dengan <code>&self</code>.</p><p>Cara mengakses property milik <em>current object</em> dari dalam method adalah menggunakan keyword <code>self</code>, contohnya seperti <code>self.brand</code>, <code>self.model</code>, dan <code>self.manufacture_year</code>, pemanggilan ketiganya adalah mengarah ke value property milik <em>current object</em> (<code>self</code>).</p><p>Selanjutnya panggil keduanya di fungsi <code>main</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">models</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> car </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">models</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Mercedes-Benz"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Vision Gran Turismo"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"car: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> car</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> info </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> car</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"info: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> info</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat, variabel <code>car</code> adalah instance dari struct <code>models::Car</code>, dibuat menggunakan <em>associated function</em> <code>models::Car::new</code>. Dari variabel tersebut kemudian diakses method <code>info</code>.</p><p>Jalankan program untuk melihat hasilnya.</p><p><img loading="lazy" alt="Method" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAnIAAABuCAIAAAAsx2kLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiP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oBrIKAACArAIAACCrAAAAyGpLjlthWc9UrLy31MylBt15fQnb7Quw3QZAVi1blrxqsfLe3t3D1DeWsN3GdhsAWS05bhW9aLHy3p+sYrt9he02ALJquMH33janWBALSqGZAGPlXdPKe22D7qSmYLu9a9ttAKiRrcbGaYG5bsJfXjEBxsq7ppX32gbdKVHBdnvfttsAsI6smpyJKpgAY+VtENXTG3Rju30+ttsAsC1ZLW0CjJX3leX9zyc36MZ2+2xstwFgu9lqiTU6WHmbTBVOb9CN7fa52G4DwIZkNWUCjJV3TSvvtQ26tUBgux39uinbbQBYXVZVE2CbrF7pJsBYede08l7boFvvO9huBwfdlu02AJwoWwUAAABkFQAAAFkFAABAVgEAAJBVAAAAQFYBAACQVQAAAGQVAAAAkFUAAABkFQAAAFkFAABAVgEAAABZBQAAQFYBAADOh/8DEG5Q+GiaShEAAAAASUVORK5CYII=" width="626" height="110" class="img_ev3q"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-naming-convention-method">◉ <em>Naming convention</em> method<a class="hash-link" href="#-naming-convention-method" title="Direct link to heading">​</a></h3><p>Sesuai anjuran di <a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">halaman dokumentasi Rust</a>, snake case digunakan dalam penamaan method. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">NamaStruct</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">nama_method</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a253-method-parameter">A.25.3. Method parameter<a class="hash-link" href="#a253-method-parameter" title="Direct link to heading">​</a></h2><p>Ok, penulis rasa sudah cukup jelas perihal perbedaan <em>associated function</em> dengan method. Sekarang, bagaimana dengan method yang ada parameternya? Cara deklarasinya adalah cukup dengan menuliskan parameter yang diinginkan setelah <code>&self</code>.</p><p>Lanjut ke praktik berikutnya. Silakan buat method baru bernama <code>congratulate</code> yang memiliki 1 buah parameter bertipe <code>String</code>, dengan tugas adalah menampilkan pesan selamat.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/models.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">congratulate</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"congrats with your new car {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"vroooom vroooooooommmmm!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dalam method <code>congratulate</code> ada statement pemanggilan method <code>info</code>, yang return value-nya ikut di-print. Notasi <code>self.nama_method()</code> digunakan untuk pemanggilan method dari dalam method. Mirip seperti pemanggilan property yaitu <code>self.nama_property</code>.</p><p>Selanjutnya, panggil method <code>congratulate</code> di fungsi <code>main</code>. Isi argumen pemanggilan method dengan sebuah <code>String</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> car </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">models</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Mercedes-Benz"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Vision Gran Turismo"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> car</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">congratulate</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Sylvanas Windrunner"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Meskipun pada definisi method parameter pertama adalah <code>&self</code>, pada saat pemanggilan method yang menjadi parameter pertama adalah parameter setelah <code>&self</code> yaitu <code>name</code>.</p><p><img loading="lazy" alt="Method" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAecAAACACAIAAAC+6TZVAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFk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sVfW185F+j7HRqiN0KlR2w9t7+UPDI3dOCB6oY0Waq+hnXP3HWojBLUzsO0GTZZpGAdEn77RTu3jtnORvs9KbYTQyVC75uBTk3Jbo6EezX38xkzKHK2dS/V9Tmq3vm6E0AlQO76kFXyKob4nbMy2DY/UzqX6DrURgtoIIYSgNkIIIaiNEEJQGyGEENRGCCEEtRFCCGojhBCC2gghhKA2QghBbYQQQlAbIYQQ1EYIIaiNEEIIaiOEECqq/wFIh6r0VqkeMQAAAABJRU5ErkJggg==" width="487" height="128" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a254-struct-property-mutability-via-method">A.25.4. Struct property mutability via method<a class="hash-link" href="#a254-struct-property-mutability-via-method" title="Direct link to heading">​</a></h2><p>Nilai property struct bisa diubah dari dalam method. Pada bagian ini kita akan buat method baru untuk struct <code>Car</code> dengan nama <code>set_manufacture_year</code>. Method ini bertugas untuk melakukan perubahan nilai property <code>manufacture_year</code>.</p><p>Silakan tulis kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/models.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">set_manufacture_year</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> year</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">manufacture_year </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> year</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Method" src="/assets/images/method-3-2b2f604aaaa2cd04220b106aec22800d.png" width="678" height="195" class="img_ev3q"></p><p>Hmm, tapi kenapa terdeteksi error? Penyebabnya error tersebut adalah karena <strong>mutable reference</strong> tidak digunakan dalam pengaksesan current object yang padahal ada operasi <em>mutable</em> atau perubahan nilai terhadap property di situ. Syntax <code>&self</code> artinya operasi peminjaman object <code>self</code> adalah <em>read only</em>.</p><p>Cara mengambil mutable reference dari object <code>self</code> adalah dengan menggunakan <code>&mut self</code>. Cara tersebut kurang lebih sama seperti pengambilan mutable reference dari variabel biasa.</p><p>Ok, sekarang kita coba modifikasi deklarasi method <code>set_manufacture_year</code> menjadi seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/models.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">set_manufacture_year</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> year</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">manufacture_year </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> year</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Lalu panggil method <code>set_manufacture_year</code> di fungsi <code>main</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> car </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">models</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Mercedes-Benz"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Vision Gran Turismo"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> info </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> car</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"info: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> info</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> car</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">set_manufacture_year</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2013</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> detailed_info </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> car</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"detailed info: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> detailed_info</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program, lihat hasilnya.</p><p><img loading="lazy" alt="Method" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjoAAABtCAIAAAAnPlzxAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczp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ru9nCs//PRZGzehrU22U+i7rL6a9O5T/K7km8LEskw0MOyuicb1H7wl8ZbEWzJLro7EW1JN09ggWe+WU2Jdv/gJF0Bjey6cAONy6hO17VbVHxrdb+2d9y5xuTRLJfudfQzYvfuk12/HTnepiSN2yjC6JprvjfCWxFsSb8lT9JaU0mwXnYwNIlRTm9zlaU0xY0hb6KTbc+EEqE2/+eqxy9M90y1xOipfHGDa5CrTu2/6WffUpR5laHRNzJMrvCWjuAFvSXG2xlvy4mi8JdV3/hobJCu6ktO0zdXW9iw1Aca55srHWDYvBhzvCRS5KrG9aalcJS0KpQEiB57TcmV3TawkV3hL4i2Jt+SxeEtqcmVtkBy5EtJUNc0uVxOT54wJUJl+s+TKu9sIIip9DaHs09CFcqU6x/llSt3/2eTK5pq4QnSFtyTeknhLHrK35LQBWKnoajrNcnK1ZAJUp9+8mEwxbpOXLpR0F97tvzMPgQzvPmlXVex0Z+8Lu2tiBbnCWzIlV3hLTjQd3pKplHO9JS2Xup6mrUHkamozQzytacNOXCKztefCCVCdfo3BTqhV4WfSmFe3Wiy62TfvDLR690XBZ7hj0HO6mzCgU5z6kq6Jk5Ew3pIXeEviLXmc3pLR3a552GQ0iFRNcWaQ0tSuTWFWNLfnwglQLWdi66x6vUs7LcXLzX0iUOpbmryECQCOhvQ6NZw2yBUAHItSoVXIFQAAAHIFAACAXAEAAHIFAACAXAEAACBXAACAXAEAACBXAAAAyBUAACBXAAAAyBUAAJwb/wPjXPAdfiGIFQAAAABJRU5ErkJggg==" width="570" height="109" class="img_ev3q"></p><p>Setelah <code>manufacture_year</code> di-set, method <code>info</code> mengembalikan pesan yang berbeda. Dari sini bisa disimpulkan bahwa method <code>set_manufacture_year</code> sukses menjalankan tugasnya untuk mengubah property <code>manufacture_year</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a255-generic-pada-method">A.25.5. Generic pada method<a class="hash-link" href="#a255-generic-pada-method" title="Direct link to heading">​</a></h2><p>Pembahasan mengenai generic pada method ada pada chapter <a href="/basic/generics#a366-generics-method">Generics</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/method" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../method</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch05-03-method-syntax.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch05-03-method-syntax.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.impl.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.impl.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.SelfTy.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.SelfTy.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.self.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.self.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/fn/methods.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/fn/methods.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/associated-function"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.24. Associated Function</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/enum"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.26. Enum</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a251-method-vs-associated-function" class="table-of-contents__link toc-highlight">A.25.1. Method vs <em>associated function</em></a></li><li><a href="#a252-deklarasi-method" class="table-of-contents__link toc-highlight">A.25.2. Deklarasi method</a><ul><li><a href="#-naming-convention-method" class="table-of-contents__link toc-highlight">◉ <em>Naming convention</em> method</a></li></ul></li><li><a href="#a253-method-parameter" class="table-of-contents__link toc-highlight">A.25.3. Method parameter</a></li><li><a href="#a254-struct-property-mutability-via-method" class="table-of-contents__link toc-highlight">A.25.4. Struct property mutability via method</a></li><li><a href="#a255-generic-pada-method" class="table-of-contents__link toc-highlight">A.25.5. Generic pada method</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.25. Method</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.25. Method</h1></header><p>Pada chapter ini kita akan belajar tentang method beserta perbedaannya dengan <em>associated function</em>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a251-method-vs-associated-function">A.25.1. Method vs <em>associated function</em><a class="hash-link" href="#a251-method-vs-associated-function" title="Direct link to heading">​</a></h2><p>Method adalah <em>associated item</em> yang hanya bisa diakses lewat instance/object, berbeda dengan <em>associated function</em> yang pengaksesan fungsinya via tipe data struct.</p><p>Silakan lihat ilustrasi kode berikut, lalu pelajari penjelasan di bawahnya untuk mencari tau perbedaan <em>associated function</em> vs method.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// associated function</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> my_car</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> info</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> my_car</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Fungsi <code>new</code> di situ adalah <em>associated function</em> milik struct <code>Car</code>. Dengannya object baru bernama <code>my_car</code> bertipe <code>Car</code> dibuat.</li><li>Object <code>my_car</code> adalah variabel bertipe <code>Car</code>. Via object tersebut method bernama <code>info</code> diakses.</li><li>Method <code>info</code> tidak bisa diakses via struct <code>Car</code>. Dan <em>associated function</em> <code>new</code> juga tidak bisa diakses dari instance/object <code>my_car</code>.</li></ul><blockquote><p>Di bahasa pemrograman lain, <em>associated function</em> disebut dengan <strong>class method</strong>, sedangkan method disebut dengan <strong>instance method</strong></p></blockquote><p>Pengaksesan <em>associated function</em> dilakukan menggunakan notasi path dengan separator <code>::</code>, contohnya seperti <code>Car::new()</code>. Sedangkan pengaksesan method menggunakan separator <code>.</code>, contoh: <code>my_car.info()</code>.</p><p>Agar lebih jelas, mari lanjut ke bagian praktik. Siapkan package dengan struktur seperti berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── models.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Buka file <code>models.rs</code>, isi dengan deklarasi struct <code>Car</code> berikut diikuti dengan blok kode <code>impl</code> untuk associated items-nya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/models.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> manufacture_year</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a252-deklarasi-method">A.25.2. Deklarasi method<a class="hash-link" href="#a252-deklarasi-method" title="Direct link to heading">​</a></h2><p>Cara deklarasi method mirip dengan <em>associated function</em>, perbedaannya adalah parameter pertama harus diisi dengan <code>&self</code> pada deklarasi method. Parameter tersebut menjadi identifier apakah fungsi merupakan <em>associated function</em> atau <em>method</em>.</p><blockquote><p>Object <code>self</code> merupakan representasi dari <em>current instance</em> atau <em>current object</em>.</p><p>Statement <code>&self</code> artinya kita melakukan operasi <em>borrowing</em> terhadap object <code>self</code>.</p><p>Lebih jelasnya mengenai borrowing dibahas pada chapter terpisah.</p></blockquote><p>Silakan tambahkan <em>associated function</em> bernama <code>new</code> dan method bernama <code>info</code> berikut. Tulis keduanya dalam blok kode <code>impl</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/models.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">Self</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> manufacture_year</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">manufacture_year </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} model {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">brand</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">model</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"{} model {}, manufactured at {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">brand</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">model</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">manufacture_year</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat, deklarasi method adalah mirip dengan fungsi biasa, perbedaannya ada pada deklarasi parameter pertama fungsi yang diisi dengan <code>&self</code>.</p><p>Cara mengakses property milik <em>current object</em> dari dalam method adalah menggunakan keyword <code>self</code>, contohnya seperti <code>self.brand</code>, <code>self.model</code>, dan <code>self.manufacture_year</code>, pemanggilan ketiganya adalah mengarah ke value property milik <em>current object</em> (<code>self</code>).</p><p>Selanjutnya panggil keduanya di fungsi <code>main</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">models</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> car </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">models</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Mercedes-Benz"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Vision Gran Turismo"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"car: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> car</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> info </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> car</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"info: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> info</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat, variabel <code>car</code> adalah instance dari struct <code>models::Car</code>, dibuat menggunakan <em>associated function</em> <code>models::Car::new</code>. Dari variabel tersebut kemudian diakses method <code>info</code>.</p><p>Jalankan program untuk melihat hasilnya.</p><p><img loading="eager" fetchpriority="high" alt="Method" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAnIAAABuCAIAAAAsx2kLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwa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UAAABkFQAAAFkFAABAVgEAAABZBQAAQFYBAADOh/8DEG5Q+GiaShEAAAAASUVORK5CYII=" width="626" height="110" class="img_CujE"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-naming-convention-method">◉ <em>Naming convention</em> method<a class="hash-link" href="#-naming-convention-method" title="Direct link to heading">​</a></h3><p>Sesuai anjuran di <a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">halaman dokumentasi Rust</a>, snake case digunakan dalam penamaan method. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">NamaStruct</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">nama_method</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a253-method-parameter">A.25.3. Method parameter<a class="hash-link" href="#a253-method-parameter" title="Direct link to heading">​</a></h2><p>Ok, penulis rasa sudah cukup jelas perihal perbedaan <em>associated function</em> dengan method. Sekarang, bagaimana dengan method yang ada parameternya? Cara deklarasinya adalah cukup dengan menuliskan parameter yang diinginkan setelah <code>&self</code>.</p><p>Lanjut ke praktik berikutnya. Silakan buat method baru bernama <code>congratulate</code> yang memiliki 1 buah parameter bertipe <code>String</code>, dengan tugas adalah menampilkan pesan selamat.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/models.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">congratulate</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"congrats with your new car {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"vroooom vroooooooommmmm!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dalam method <code>congratulate</code> ada statement pemanggilan method <code>info</code>, yang return value-nya ikut di-print. Notasi <code>self.nama_method()</code> digunakan untuk pemanggilan method dari dalam method. Mirip seperti pemanggilan property yaitu <code>self.nama_property</code>.</p><p>Selanjutnya, panggil method <code>congratulate</code> di fungsi <code>main</code>. Isi argumen pemanggilan method dengan sebuah <code>String</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> car </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">models</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Mercedes-Benz"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Vision Gran Turismo"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> car</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">congratulate</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Sylvanas Windrunner"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Meskipun pada definisi method parameter pertama adalah <code>&self</code>, pada saat pemanggilan method yang menjadi parameter pertama adalah parameter setelah <code>&self</code> yaitu <code>name</code>.</p><p><img loading="lazy" alt="Method" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAecAAACACAIAAAC+6TZVAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94Y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4TNWSO0jRqxy1L9d3w4ko+HXZqxyOZk35h6PlL2ejgLH0ZDE6b8KDKMfUZMsxsmyFWT5v8btpQ0GArxwkZDt1gwpOM6yg4dora9twmi1I7bJ75FJeltvhwJKY1mJgnRU1BMJx6IEntly6bjJeWQM6fkHhMNKHAS9SgjlKUwWAateXn11Tfjac4Ph2TqJ2TfkEqqnUzzh0x6Auxv6XwfabJO4mfuM6eWdS/pOVpk93NjHc/hxU+8VuNlPdLtxTNZEjMxMi4M+OiALWzrs3hUco4xaXXkLjPIsIaEmfw0rZ2OuK+lIJAXCBhzkvgToL+x0T+BKGinEkQW3BS8gchg8FEal+oSSrCvmecYvF0GNupP7VkpF+QZp20jkLKHTGctcO4nmZgsYp+E7UsIpEuafcFrbwUK6ubgyspwsxEhtwm0pRLJjzJu47itwpmXEyktv3aNI9S1ikuS+3xEtz1J/wdFYkaEEJzaSlq+y6bjEUu22Q23+QghDZO7fV/HVywj9jZCKEToDZCCCGojRBCUBshhBDURgghBLVRcZ34qkyEoDaC2gghqI2gNkJoErWVQCdKnHIx1PeEjWpM8ZW1c6m+z7FRj1yLENqkre3hMBEpPBEQffxGKaa4BdtLt3Opvs+x0b1vQG2ETsFD4ocociL2BJHsxYDo0zfKsVfW185F+j7HRqiN0KlR2w9t7+UPDI3dOCB6oY0Waq+hnXP3HWojBLUzsO0GTZZpGAdEn77RTu3jtnORvs9KbYTQyVC75uBTk3Jbo6EezX38xkzKHK2dS/V9Tmq3vm6E0AlQO76kFXyKob4nbMy2DY/UzqX6DrURgtoIIYSgNkIIIaiNEEJQGyGEENRGCCEEtRFCCGojhBCC2gghhKA2QghBbYQQQlAbIYQQ1EYIIaiNEEIIaiOEECqq/wFIh6r0VqkeMQAAAABJRU5ErkJggg==" width="487" height="128" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a254-struct-property-mutability-via-method">A.25.4. Struct property mutability via method<a class="hash-link" href="#a254-struct-property-mutability-via-method" title="Direct link to heading">​</a></h2><p>Nilai property struct bisa diubah dari dalam method. Pada bagian ini kita akan buat method baru untuk struct <code>Car</code> dengan nama <code>set_manufacture_year</code>. Method ini bertugas untuk melakukan perubahan nilai property <code>manufacture_year</code>.</p><p>Silakan tulis kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/models.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">set_manufacture_year</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> year</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">manufacture_year </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> year</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Method" src="/assets/images/method-3-2b2f604aaaa2cd04220b106aec22800d.png" width="678" height="195" class="img_CujE"></p><p>Hmm, tapi kenapa terdeteksi error? Penyebabnya error tersebut adalah karena <strong>mutable reference</strong> tidak digunakan dalam pengaksesan current object yang padahal ada operasi <em>mutable</em> atau perubahan nilai terhadap property di situ. Syntax <code>&self</code> artinya operasi peminjaman object <code>self</code> adalah <em>read only</em>.</p><p>Cara mengambil mutable reference dari object <code>self</code> adalah dengan menggunakan <code>&mut self</code>. Cara tersebut kurang lebih sama seperti pengambilan mutable reference dari variabel biasa.</p><p>Ok, sekarang kita coba modifikasi deklarasi method <code>set_manufacture_year</code> menjadi seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/models.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">set_manufacture_year</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> year</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">manufacture_year </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> year</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Lalu panggil method <code>set_manufacture_year</code> di fungsi <code>main</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> car </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">models</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Mercedes-Benz"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Vision Gran Turismo"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> info </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> car</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"info: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> info</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> car</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">set_manufacture_year</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2013</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> detailed_info </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> car</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"detailed info: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> detailed_info</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program, lihat hasilnya.</p><p><img loading="lazy" alt="Method" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjoAAABtCAIAAAAnPlzxAAAACXBIWXMA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t3/2eTK5pq4QnSFtyTeknhLHrK35LQBWKnoajrNcnK1ZAJUp9+8mEwxbpOXLpR0F97tvzMPgQzvPmlXVex0Z+8Lu2tiBbnCWzIlV3hLTjQd3pKplHO9JS2Xup6mrUHkamozQzytacNOXCKztefCCVCdfo3BTqhV4WfSmFe3Wiy62TfvDLR690XBZ7hj0HO6mzCgU5z6kq6Jk5Ew3pIXeEviLXmc3pLR3a552GQ0iFRNcWaQ0tSuTWFWNLfnwglQLWdi66x6vUs7LcXLzX0iUOpbmryECQCOhvQ6NZw2yBUAHItSoVXIFQAAAHIFAACAXAEAAHIFAACAXAEAACBXAACAXAEAACBXAAAAyBUAACBXAAAAyBUAAJwb/wPjXPAdfiGIFQAAAABJRU5ErkJggg==" width="570" height="109" class="img_CujE"></p><p>Setelah <code>manufacture_year</code> di-set, method <code>info</code> mengembalikan pesan yang berbeda. Dari sini bisa disimpulkan bahwa method <code>set_manufacture_year</code> sukses menjalankan tugasnya untuk mengubah property <code>manufacture_year</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a255-generic-pada-method">A.25.5. Generic pada method<a class="hash-link" href="#a255-generic-pada-method" title="Direct link to heading">​</a></h2><p>Pembahasan mengenai generic pada method ada pada chapter <a href="/basic/generics#a366-generics-method">Generics</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/method" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../method</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch05-03-method-syntax.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch05-03-method-syntax.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.impl.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.impl.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.SelfTy.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.SelfTy.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.self.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.self.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/fn/methods.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/fn/methods.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/associated-function"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.24. Associated Function</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/enum"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.26. Enum</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a251-method-vs-associated-function" class="table-of-contents__link toc-highlight">A.25.1. Method vs <em>associated function</em></a></li><li><a href="#a252-deklarasi-method" class="table-of-contents__link toc-highlight">A.25.2. Deklarasi method</a><ul><li><a href="#-naming-convention-method" class="table-of-contents__link toc-highlight">◉ <em>Naming convention</em> method</a></li></ul></li><li><a href="#a253-method-parameter" class="table-of-contents__link toc-highlight">A.25.3. Method parameter</a></li><li><a href="#a254-struct-property-mutability-via-method" class="table-of-contents__link toc-highlight">A.25.4. Struct property mutability via method</a></li><li><a href="#a255-generic-pada-method" class="table-of-contents__link toc-highlight">A.25.5. Generic pada method</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/module-basic.html b/basic/module-basic.html index e3cb2f47..8982571b 100644 --- a/basic/module-basic.html +++ b/basic/module-basic.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-basic/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-basic/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.20. Module System ➜ Module","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-basic/#webpage"},"wordCount":1465,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-basic/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-basic/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/module-basic","name":"A.20. Module System ➜ Module","description":"Module adalah salah satu chapter yang cukup penting dalam pemrograman Rust. Pada bagian ini kita akan mempelajari dasarnya.","datePublished":"2024-08-01T10:17:29.152Z","dateModified":"2024-08-01T10:17:29.152Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-basic/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/module-basic"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-basic/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.20. Module System ➜ Module","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-basic/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-basic/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.20. Module System ➜ Module","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-basic/#webpage"},"wordCount":1465,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-basic/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-basic/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/module-basic","name":"A.20. Module System ➜ Module","description":"Module adalah salah satu chapter yang cukup penting dalam pemrograman Rust. Pada bagian ini kita akan mempelajari dasarnya.","datePublished":"2024-08-30T07:44:49.472Z","dateModified":"2024-08-30T07:44:49.472Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-basic/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/module-basic"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-basic/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.20. Module System ➜ Module","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.20. Module System ➜ Module</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.20. Module System ➜ Module</h1></header><p>Module adalah salah satu chapter yang cukup penting dalam pemrograman Rust. Pada bagian ini kita akan mempelajari dasarnya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a201-rust-module-system">A.20.1. Rust module system<a class="hash-link" href="#a201-rust-module-system" title="Direct link to heading">​</a></h2><p>Setiap bahasa pemrograman memiliki caranya sendiri dalam hal pengelolahan struktur files dan folder dalam project. Project yang isinya ada sangat banyak hal diatur sedemikian rupa menjadi beberapa bagian dan/atau sub-bagian sesuai dengan fungsinya masing-masing.</p><p>Di Rust, module memiliki hirarki (biasa disebut dengan <em>module tree</em>) yang <em>root</em>/akarnya adalah file entrypoint crate, yaitu <code>main.rs</code> untuk <em>binary crate</em> dan <code>lib.rs</code> untuk <em>library crate</em>. Kedua file ini biasa disebut dengan <em>crate root file</em>.</p><blockquote><p>Di sini pembahasan akan fokus pada penerapan module dalam <em>binary crate</em>. Kita belum masuk ke pembahasan tentang <em>library crate</em>.</p></blockquote><p>Rust memiliki 2 jenis modul, yaitu <em>normal module</em> dan <em>inline module</em>. Pembahasan dimulai dengan normal module terlebih dahulu.</p><p>Keyword <code>mod</code> digunakan untuk mendefinisikan/mendaftarkan sebuah module. Nama module menjadi path di mana isi module atau <em>module item</em> harus berada. Sebagai contoh:</p><ul><li>module yang didefinisikan dengan nama <code>my_number</code>, maka item-nya harus berada pada file <code>my_number.rs</code> atau <code>my_number/mod.rs</code></li><li>module yang didefinisikan dengan nama <code>my_io</code>, maka item-nya harus berada pada file <code>my_io.rs</code> atau <code>my_io/mod.rs</code></li></ul><p>Pendefinisian nama module sendiri berada pada file entrypoint <em>crate</em> yaitu <code>main.rs</code> (atau <code>lib.rs</code> untuk library crate). Jadi pendefinisian nama module dan isi/item-nya terpisah.</p><ul><li>Nama module ditulis di <code>main.rs</code> (atau <code>lib.rs</code> untuk library crate)</li><li>Item atau isi module ditulis dalam file <code>nama_module.rs</code> atau <code>nama_module/mod.rs</code></li></ul><blockquote><p>Sebenarnya ada beberapa hal lainnya lagi yang masih relevan yang perlu dibahas di-awal, yaitu perihal sub-module. Akan tetapi agar tidak makin bingung, mari kita lanjut ke praktik terlebih dahulu.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a202-praktik-1---nama_modulers">A.20.2. Praktik #1 - <code>nama_module.rs</code><a class="hash-link" href="#a202-praktik-1---nama_modulers" title="Direct link to heading">​</a></h2><p>Mari buat program sederhana, yang isinya mencakup pembahasan tentang module. Pada program kecil ini, inputan user ditampung ke sebuah variabel, kemudian ditampilkan ke layar. Proses pembacaan inputan user akan di-split sebagai module.</p><p>Ok, langsung saja, buat package/project baru dengan nama bebas. Di sini penulis menggunakan nama package <code>module_1</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">cargo new module_1</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Setelah itu siapkan 1 buah file bernama <code>my_io.rs</code>, letakan di dalam folder <code>src</code> (1 level dengan file <code>main.rs</code>). File ini difungsikan sebagai tempat definisi <em>module item</em> milik sebuah module bernama <code>my_io</code> (io di sini kependekan dari <em>input output</em>).</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">module_1</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── my_io.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Lanjut, definisikan fungsi <code>read_entry</code> di file <code>my_io.rs</code>, isinya kurang lebih adalah kode untuk membaca inputan user lalu mengembalikannya dalam bentuk <code>String</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/my_io.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">string</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> stdin_reader </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdin</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> reader_res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> stdin_reader</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">read_line</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> reader_res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> reader_res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">trim</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ok, kita telah menyiapkan satu item milik module <code>my_io</code> yaitu sebuah fungsi bernama <code>read_entry</code>. 1 hal yang sedikit berbeda pada definisi fungsi di atas adalah penambahan keyword <code>pub</code> yang ditulis sebagai prefix definisi fungsi.</p><p>Keyword <code>pub</code> digunakan untuk menjadikan suatu item menjadi <strong>public</strong>, agar bisa diakses dari luar module.</p><p>Fungsi <code>read_entry</code> ini berada dalam module <code>my_io</code>. Jika tidak ada keyword <code>pub</code> di situ, maka fungsi <code>read_entry</code> hanya bisa diakses dari dalam <code>my_io</code> saja, tidak bisa diakses dari luar module contohnya seperti dari <code>main.rs</code>. Dengan menjadikan <code>read_entry</code> sebagai fungsi yang public, maka fungsi tersebut bisa diakses dari <code>main.rs</code>.</p><blockquote><p>Lebih jelasnya mengenai keyword <code>pub</code> dibahas pada chapter <a href="/basic/visibility-privacy">Module System ➜ Visibility & Privacy</a></p></blockquote><p>Isi module sudah siap, selanjutnya lanjut ke pendefinisian modul. Umumnya pada bahasa pemrograman, definisi module adalah ada dalam file di mana isi module berada, namun tidak untuk Rust.</p><p>Di Rust, definisi sebuah module (sekali lagi bukan item/isinya ya, tapi definisi dari module itu sendiri) dituliskan pada file terpisah, yaitu di file entrypoint crate, yaitu <code>main.rs</code> atau <code>lib.rs</code>.</p><p>Lanjut, sekarang buka file <code>main.rs</code> dan tulis definisi modul <code>my_io</code> menggunakan statement <code>mod my_io</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// definisi module my_io</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_io</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// fungsi main</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sekarang aplikasikan fungsi <code>read_entry</code> milik module <code>my_io</code> di fungsi <code>main</code> untuk membaca inputan user.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_io</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"enter any number:"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"your number: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program, masukan sebuah angka, lalu enter. Lihat hasilnya, program berjalan sesuai harapan.</p><p><img loading="lazy" alt="Rust module" src="/assets/images/module-1-0eea2521d2399e73e455b90f5c2f97fa.png" width="762" height="717" class="img_ev3q"></p><p>Cara pengaksesan item dari sebuah module yang kita definisikan sendiri adalah sama seperti pengaksesan item dari crate lainnya, yaitu menggunakan <em>path</em>. Statement <code>my_io::read_entry()</code> artinya item <code>read_entry</code> yang merupakan fungsi dalam module <code>my_io</code> digunakan.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-summary-praktik-1">◉ Summary praktik #1<a class="hash-link" href="#-summary-praktik-1" title="Direct link to heading">​</a></h3><p>Pada praktik pertama ini kita telah belajar penerapan module dengan mengaplikasikan beberapa hal berikut:</p><ul><li>Penggunaan normal module dalam binary crate</li><li>Pembuatan module dengan nama <code>my_io</code>, dengan isi/item ditulis pada file <code>my_io.rs</code></li><li>Penggunaan keyword <code>pub</code> untuk meng-export atau menjadikan item menjadi public, agar bisa diakses dari luar module</li><li>Pengaksesan item milik module, yaitu: <code>my_io::read_entry</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-naming-convention-module">◉ <em>Naming convention</em> module<a class="hash-link" href="#-naming-convention-module" title="Direct link to heading">​</a></h3><p>Sesuai anjuran di <a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">halaman dokumentasi Rust</a>, aturan penulisan nama module adalah menggunakan snake case, contohnya <code>my_io</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-module-item">◉ Module item<a class="hash-link" href="#-module-item" title="Direct link to heading">​</a></h3><p>Module item adalah apapun yang didefinisikan di dalam sebuah module. Pada contoh praktik ke-1 di atas, module <code>my_io</code> memiliki 1 buah item yaitu fungsi bernama <code>read_entry</code>.</p><p>Selain fungsi, module item bisa dalam bentuk lainnya, contohnya: konstanta, submodule, struct, dan lainnya.</p><blockquote><p>Lebih jelasnya tentang macam-macam item dibahas pada chapter <a href="/basic/path-item">Module System ➜ Path & Item</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a203-praktik-2---nama_modulemodrs">A.20.3. Praktik #2 - <code>nama_module/mod.rs</code><a class="hash-link" href="#a203-praktik-2---nama_modulemodrs" title="Direct link to heading">​</a></h2><p>Bagian ini merupakan kelanjutan dari praktik sebelumnya. Program sederhana yang sudah di-buat ditambahi beberapa hal. Data inputan user dikonversi ke bentuk angka untuk kemudian dicek apakah angka tersebut bilangan ganjil atau genap.</p><p>Fungsi untuk konversi string ke bentuk numerik dan juga untuk pengecekan bilangan ganjil genap, adalah dua buah item milik module bernama <code>my_number</code> yang akan kita definisikan sebentar lagi.</p><p>Definisi item module <code>my_io</code> menggunakan notasi penulisan file <code>nama_module.rs</code> (yaitu <code>my_io.rs</code>). Pada module <code>my_number</code> ini kita akan gunakan notasi penulisan <code>nama_module/mod.rs</code> (menjadi <code>my_number/mod.rs</code>) untuk menampung definisi item module <code>my_number</code>.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">module_1</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── my_number</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │ └─── mod.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── my_io.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ok, sekarang buat saja folder dan filenya, yaitu <code>my_number/mod.rs</code>. Lalu pada file <code>mod.rs</code> tulis 2 buah fungsi berikut:</p><ul><li><p>Fungsi untuk konversi string ke numerik <code>i32</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/my_number/mod.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">string_to_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">text</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> text</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Fungsi untuk pengecekan bilangan ganjil</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/my_number/mod.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">is_odd_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">number</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> number </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><p>Kemudian tulis definisi module <code>my_number</code> dalam file entrypoint crate, yaitu <code>main.rs</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// definisi module my_io</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_io</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// definisi module my_number</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// fungsi main</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Terakhir, aplikasikan dua buah fungsi yang sudah didefinisikan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"enter any number:"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"your number: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_number</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">string_to_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_number</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">is_odd_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"is odd number: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program, lihat hasilnya.</p><p><img loading="lazy" alt="Rust module" src="/assets/images/module-2-d8f6f3862036da93c4b7920e144a3a3f.png" width="777" height="872" class="img_ev3q"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-summary-praktik-2">◉ Summary praktik #2<a class="hash-link" href="#-summary-praktik-2" title="Direct link to heading">​</a></h3><p>Hingga praktik ke-2 ini, kita telah belajar penerapan module dengan mengaplikasikan beberapa hal berikut:</p><ul><li>Penggunaan normal module dalam binary crate</li><li>Pembuatan module dengan nama <code>my_io</code>, dengan isi/item ditulis pada file <code>my_io.rs</code></li><li>Pembuatan module dengan nama <code>my_number</code>, dengan isi/item ditulis pada file <code>my_number/mod.rs</code></li><li>Penggunaan keyword <code>pub</code> untuk meng-export atau menjadikan item menjadi public, agar bisa diakses dari luar module</li><li>Pengaksesan item milik module, yaitu: <code>my_io::read_entry</code>, <code>my_number::string_to_number</code>, dan <code>my_number::is_odd_number</code></li></ul><blockquote><p>Penerapan notasi penulisan isi module <code>nama_module.rs</code> dan <code>nama_module/mod.rs</code> bisa diterapkan dalam satu package</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-konversi-string-ke-numerik">◉ Konversi string ke numerik<a class="hash-link" href="#-konversi-string-ke-numerik" title="Direct link to heading">​</a></h3><p>Rust mengenal beberapa jenis konversi antar tipe data. Teknik konversi yang kita praktikkan pada chapter ini menggunakan method <code>.parse()</code>, cara ini bisa dilakukan untuk konversi tipe data dari custom types ke primitive. Contohnya seperti di atas, dari <code>String</code> ke <code>i32</code>.</p><p>Penggunaannya cukup mudah, akses saja method <code>.parse()</code> kemudian sisipkan tipe data sebagai parameter generic. Lalu chain dengan method <code>unwrap</code> (yang method tersebut merupakan item milik tipe data <em>generic result type</em> atau <code>Result<T, E></code>).</p><p>Contoh lain untuk konversi dari tipe primitif lainnya bisa dilihat berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"24"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_bool </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"true"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">bool</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_float </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"3.14"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Method <code>parse</code> menghasilkan data bertipe <em>generic result type</em> atau <code>Result<T, E></code>. Tipe ini memiliki method bernama <code>unwrap</code> yang berguna untuk mengambil nilai.</p><blockquote><ul><li>Lebih jelasnya mengenai casting dibahas pada chapter <a href="/basic/type-alias-casting">Type Alias & Casting</a> dan <a href="#/wip/trait-conversion-from-into">Trait ➜ Conversion (From & Into)</a></li><li>Lebih jelasnya mengenai generic dibahas pada chapter <a href="/basic/generics">Generics</a></li><li>Lebih jelasnya mengenai result type dibahas pada chapter <a href="/basic/result-type">Tipe Data ➜ Result</a></li></ul></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a204-submodules">A.20.4. Submodules<a class="hash-link" href="#a204-submodules" title="Direct link to heading">​</a></h2><p>Sampai bagian ini kita telah belajar tentang module beserta 2 macam cara penerapannya.</p><p>Sebuah module bisa saja memiliki module di bawahnya (biasa disebut submodule), dan hal ini adalah konsep yang umum dalam bahasa pemrograman. Di Rust, aturan dalam pembuatan submodule masih sama seperti module, perbedaannya adalah tempat di mana submodule didefinisikan. Jika pada root module definisi ada pada file <code>main.rs</code> atau <code>lib.rs</code>, maka pada submodule definisi ada pada file di mana <em>parent module</em> berada.</p><p>Sebagai contoh jika pada program sebelumnya kita tambahkan module <code>my_number</code> yang sudah dibuat, jika ada submodule dengan nama <code>conversion_utility</code>, maka definisi module berada di <code>my_number/mod.rs</code> dan itemnya di <code>my_number/conversion_utility/mod.rs</code>.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── my_io.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── my_number</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── mod.rs // </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">----- definisi submodule conversion_utility</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── conversion_utility</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── mod.rs // </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">----- definisi item/isi conversion_utility</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Atau definisi module tetap di <code>my_number/mod.rs</code> namun itemnya di <code>my_number/conversion_utility.rs</code>.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── my_io.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── my_number</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── mod.rs // </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">----- definisi submodule conversion_utility</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── conversion_utility.rs // </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">----- definisi item/isi conversion_utility</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Penerapan notasi penulisan <code>nama_module.rs</code> biasanya dalam case ketika module tersebut tidak memiliki submodule.</p><p>Untuk module yang memiliki submodule, parent module harus menerapkan notasi penulisan <code>nama_module/mod.rs</code>, hal ini karena pendefinisian submodule berada pada file <code>mod.rs</code> dalam parent module tersebut.</p></blockquote><p>Lalu bagaimana jika sebuah submodule memiliki submodule yang memiliki submodule ... dst, aturannya tetap sama seperti aturan submodule.</p><p>Mari lanjut praktik agar tidak bingung. Kita akan modifikasi program sebelumnya. Item <code>string_to_number</code> yang sebelumnya adalah item milik <code>my_number</code> kita pindah ke sebuah module baru bernama <code>conversion_utility</code> yang merupakan submodule dari <code>my_number</code>. Silakan buat file baru <code>my_number/conversion_utility/mod.rs</code>, kemudian isi dengan fungsi berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/my_number/conversion_utility/mod.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">string_to_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">text</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> text</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>string_to_number</code> yang sebelumnya ada di <code>my_number/mod.rs</code> silakan dihapus.</p><p>Kemudian pada file <code>my_number/mod.rs</code>, tambahkan definisi submodule <code>conversion_utility</code>. Isi file tersebut kurang lebih menjadi seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/my_number/mod.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">conversion_utility</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">is_odd_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">number</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> number </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>O iya, karena submodule merupakan sebuah item milik module, maka harus ditambahkan juga keyword <code>pub</code>, agar submodule bisa diakses dari luar scope-nya. Contoh penerapannya bisa dilihat di atas.</p><p>Terakhir, pada <code>main.rs</code>, ubah pemanggilan fungsi <code>string_to_number</code> dari ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_number</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">string_to_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... menjadi ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_number</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">conversion_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">string_to_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kurang lebih strukturnya menjadi seperti berikut:</p><p><img loading="lazy" alt="Rust submodule" src="/assets/images/module-3-b8f34c47b905cadb9001a866ebb80809.png" width="940" height="955" class="img_ev3q"></p><p>Jalankan program untuk mengetest hasilnya.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-summary-praktik-3">◉ Summary praktik #3<a class="hash-link" href="#-summary-praktik-3" title="Direct link to heading">​</a></h3><p>Hingga pembahasan pada praktik submodule, kita telah belajar penerapan module dengan mengaplikasikan beberapa hal berikut:</p><ul><li>Penggunaan normal module dalam binary crate</li><li>Pembuatan module dengan nama <code>my_io</code>, dengan isi/item ditulis pada file <code>my_io.rs</code></li><li>Pembuatan module dengan nama <code>my_number</code>, dengan isi/item ditulis pada file <code>my_number/mod.rs</code></li><li>Pembuatan submodule dengan nama <code>my_number/conversion_utility</code>, dengan isi/item ditulis pada file <code>my_number/conversion.rs</code> yang di-import menggunakan <code>path</code> attribute.</li><li>Penggunaan keyword <code>pub</code> pada fungsi agar bisa diakses dari luar module</li><li>Penggunaan keyword <code>pub</code> pada submodule agar bisa diakses dari luar parent module</li><li>Pengaksesan item milik module, yaitu: <code>my_io::read_entry</code>, <code>my_number::conversion_utility::string_to_number</code>, dan <code>my_number::is_odd_number</code></li></ul><blockquote><p>Penerapan notasi penulisan isi module <code>nama_module.rs</code> dan <code>nama_module/mod.rs</code> bisa diterapkan dalam satu package</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a205-penerapan-keyword-use">A.20.5. Penerapan keyword <code>use</code><a class="hash-link" href="#a205-penerapan-keyword-use" title="Direct link to heading">​</a></h2><p>Keyword <code>use</code> bisa digunakan untuk meng-import module atau item tertentu, dan dengannya pengaksesan item menjadi lebih pendek. Contohnya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token namespace" style="opacity:0.7">my_number</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">conversion_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">string_to_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... bisa dituliskan menjadi ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_number</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">conversion_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">string_to_number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">string_to_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Lebih jelasnya mengenai keyword <code>use</code> dibahas pada chapter <a href="/basic/use">Module System ➜ Use</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a206-module-path-attribute">A.20.6. Module <code>path</code> attribute<a class="hash-link" href="#a206-module-path-attribute" title="Direct link to heading">​</a></h2><p>Selain menggunakan dua teknik definisi module item di atas yang fokusnya ada pada penamaan file, ada juga cara lain pendefinisian module item, yaitu dengan memanfaatkan <code>path</code> attribute.</p><p>Mari kita praktikkan, silakan ubah struktur package yang sudah dibuat dari ...</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── my_io.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── my_number</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── mod.rs // </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">----- definisi submodule conversion_utility</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── conversion_utility.rs // </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">----- definisi item/isi conversion_utility</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... menjadi ...</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── my_io.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── my_number</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── mod.rs // </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">----- definisi submodule conversion_utility</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── conversion.rs // </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">----- definisi item/isi conversion_utility</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Yang telah kita lakukan adalah me-rename file <code>conversion_utility.rs</code> menjadi <code>conversion.rs</code>. Efeknya akan muncul error dalam pengaksesan module item, karena submodule <code>my_number/conversion_utility</code> isi/item-nya harus berada pada file <code>my_number/conversion_utility.rs</code> atau <code>my_number/conversion_utility/mod.rs</code>. Sedangkan file <code>conversion.rs</code> tidak memenuhi kriteria tersebut.</p><p>Sekarang buka isi file <code>my_number/mod.rs</code>, lalu ubah statement pendefinisian submodule dari ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/my_number/mod.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">conversion_utility</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... menjadi ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/my_number/mod.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[path = </span><span class="token attribute attr-name string" style="color:#e3116c">"conversion.rs"</span><span class="token attribute attr-name" style="color:#00a4db">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">conversion_utility</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Rust module" src="/assets/images/module-4-e83e7a2e8d7d6d4d11ec121d6dc184d0.png" width="690" height="365" class="img_ev3q"></p><p>Lalu run, dan program akan jalan normal tanpa error.</p><p>Statement <code>#[path = "conversion.rs"]</code> di atas merupakan contoh penerapan dari Rust path attributes. Dengannya kita bisa menempatkan isi sebuah module pada file yang namanya bebas (pada contoh di atas, file bernama <code>conversion.rs</code>).</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-summary-praktik-4">◉ Summary praktik #4<a class="hash-link" href="#-summary-praktik-4" title="Direct link to heading">​</a></h3><p>Hingga pembahasan pada praktik module <code>path</code> attribute, kita telah belajar penerapan module dengan mengaplikasikan beberapa hal berikut:</p><ul><li>Penggunaan normal module dalam binary crate</li><li>Pembuatan module dengan nama <code>my_io</code>, dengan isi/item ditulis pada file <code>my_io.rs</code></li><li>Pembuatan module dengan nama <code>my_number</code>, dengan isi/item ditulis pada file <code>my_number/mod.rs</code></li><li>Pembuatan submodule dengan nama <code>my_number/conversion_utility</code>, dengan isi/item ditulis pada file <code>my_number/conversion_utility/mod.rs</code></li><li>Penggunaan keyword <code>pub</code> pada fungsi agar bisa diakses dari luar module</li><li>Penggunaan keyword <code>pub</code> pada submodule agar bisa diakses dari luar parent module</li><li>Pengaksesan item milik module, yaitu: <code>my_io::read_entry</code>, <code>my_number::conversion_utility::string_to_number</code>, dan <code>my_number::is_odd_number</code></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a207-pembahasan-lanjutan">A.20.7. Pembahasan lanjutan<a class="hash-link" href="#a207-pembahasan-lanjutan" title="Direct link to heading">​</a></h2><p>Pembahasan topik module dilanjutkan pada beberapa chapter lain. Pada chapter <a href="/basic/module-inline">Module System ➜ Inline Module</a> kita akan bahas secara mendetail mengenai apa itu inline module dan perbedaannya dibanding normal module. Lalu nantinya di cahpter <a href="/basic/visibility-privacy">Module System ➜ Visibility & Privacy</a> akan dibahas secara lengkap mengenai keyword <code>pub</code> dan kontrol privasi lainnya di pemrograman Rust.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/module_basic" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../module_basic</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.pub.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.pub.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.mod.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.mod.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/mod.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/mod.html</a></li><li><a href="https://aloso.github.io/2021/03/28/module-system.html" target="_blank" rel="noopener noreferrer">https://aloso.github.io/2021/03/28/module-system.html</a></li><li><a href="https://stackoverflow.com/questions/69275034/what-is-the-difference-between-use-and-pub-use" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/69275034/what-is-the-difference-between-use-and-pub-use</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/package-crate"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.19. Module System ➜ Package & Crate</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/module-inline"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.21. Module System ➜ Inline Module</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a201-rust-module-system" class="table-of-contents__link toc-highlight">A.20.1. Rust module system</a></li><li><a href="#a202-praktik-1---nama_modulers" class="table-of-contents__link toc-highlight">A.20.2. Praktik #1 - <code>nama_module.rs</code></a><ul><li><a href="#-summary-praktik-1" class="table-of-contents__link toc-highlight">◉ Summary praktik #1</a></li><li><a href="#-naming-convention-module" class="table-of-contents__link toc-highlight">◉ <em>Naming convention</em> module</a></li><li><a href="#-module-item" class="table-of-contents__link toc-highlight">◉ Module item</a></li></ul></li><li><a href="#a203-praktik-2---nama_modulemodrs" class="table-of-contents__link toc-highlight">A.20.3. Praktik #2 - <code>nama_module/mod.rs</code></a><ul><li><a href="#-summary-praktik-2" class="table-of-contents__link toc-highlight">◉ Summary praktik #2</a></li><li><a href="#-konversi-string-ke-numerik" class="table-of-contents__link toc-highlight">◉ Konversi string ke numerik</a></li></ul></li><li><a href="#a204-submodules" class="table-of-contents__link toc-highlight">A.20.4. Submodules</a><ul><li><a href="#-summary-praktik-3" class="table-of-contents__link toc-highlight">◉ Summary praktik #3</a></li></ul></li><li><a href="#a205-penerapan-keyword-use" class="table-of-contents__link toc-highlight">A.20.5. Penerapan keyword <code>use</code></a></li><li><a href="#a206-module-path-attribute" class="table-of-contents__link toc-highlight">A.20.6. Module <code>path</code> attribute</a><ul><li><a href="#-summary-praktik-4" class="table-of-contents__link toc-highlight">◉ Summary praktik #4</a></li></ul></li><li><a href="#a207-pembahasan-lanjutan" class="table-of-contents__link toc-highlight">A.20.7. Pembahasan lanjutan</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.20. Module System ➜ Module</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.20. Module System ➜ Module</h1></header><p>Module adalah salah satu chapter yang cukup penting dalam pemrograman Rust. Pada bagian ini kita akan mempelajari dasarnya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a201-rust-module-system">A.20.1. Rust module system<a class="hash-link" href="#a201-rust-module-system" title="Direct link to heading">​</a></h2><p>Setiap bahasa pemrograman memiliki caranya sendiri dalam hal pengelolahan struktur files dan folder dalam project. Project yang isinya ada sangat banyak hal diatur sedemikian rupa menjadi beberapa bagian dan/atau sub-bagian sesuai dengan fungsinya masing-masing.</p><p>Di Rust, module memiliki hirarki (biasa disebut dengan <em>module tree</em>) yang <em>root</em>/akarnya adalah file entrypoint crate, yaitu <code>main.rs</code> untuk <em>binary crate</em> dan <code>lib.rs</code> untuk <em>library crate</em>. Kedua file ini biasa disebut dengan <em>crate root file</em>.</p><blockquote><p>Di sini pembahasan akan fokus pada penerapan module dalam <em>binary crate</em>. Kita belum masuk ke pembahasan tentang <em>library crate</em>.</p></blockquote><p>Rust memiliki 2 jenis modul, yaitu <em>normal module</em> dan <em>inline module</em>. Pembahasan dimulai dengan normal module terlebih dahulu.</p><p>Keyword <code>mod</code> digunakan untuk mendefinisikan/mendaftarkan sebuah module. Nama module menjadi path di mana isi module atau <em>module item</em> harus berada. Sebagai contoh:</p><ul><li>module yang didefinisikan dengan nama <code>my_number</code>, maka item-nya harus berada pada file <code>my_number.rs</code> atau <code>my_number/mod.rs</code></li><li>module yang didefinisikan dengan nama <code>my_io</code>, maka item-nya harus berada pada file <code>my_io.rs</code> atau <code>my_io/mod.rs</code></li></ul><p>Pendefinisian nama module sendiri berada pada file entrypoint <em>crate</em> yaitu <code>main.rs</code> (atau <code>lib.rs</code> untuk library crate). Jadi pendefinisian nama module dan isi/item-nya terpisah.</p><ul><li>Nama module ditulis di <code>main.rs</code> (atau <code>lib.rs</code> untuk library crate)</li><li>Item atau isi module ditulis dalam file <code>nama_module.rs</code> atau <code>nama_module/mod.rs</code></li></ul><blockquote><p>Sebenarnya ada beberapa hal lainnya lagi yang masih relevan yang perlu dibahas di-awal, yaitu perihal sub-module. Akan tetapi agar tidak makin bingung, mari kita lanjut ke praktik terlebih dahulu.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a202-praktik-1---nama_modulers">A.20.2. Praktik #1 - <code>nama_module.rs</code><a class="hash-link" href="#a202-praktik-1---nama_modulers" title="Direct link to heading">​</a></h2><p>Mari buat program sederhana, yang isinya mencakup pembahasan tentang module. Pada program kecil ini, inputan user ditampung ke sebuah variabel, kemudian ditampilkan ke layar. Proses pembacaan inputan user akan di-split sebagai module.</p><p>Ok, langsung saja, buat package/project baru dengan nama bebas. Di sini penulis menggunakan nama package <code>module_1</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">cargo new module_1</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Setelah itu siapkan 1 buah file bernama <code>my_io.rs</code>, letakan di dalam folder <code>src</code> (1 level dengan file <code>main.rs</code>). File ini difungsikan sebagai tempat definisi <em>module item</em> milik sebuah module bernama <code>my_io</code> (io di sini kependekan dari <em>input output</em>).</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">module_1</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── my_io.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Lanjut, definisikan fungsi <code>read_entry</code> di file <code>my_io.rs</code>, isinya kurang lebih adalah kode untuk membaca inputan user lalu mengembalikannya dalam bentuk <code>String</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/my_io.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">string</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> stdin_reader </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdin</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> reader_res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> stdin_reader</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">read_line</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> reader_res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> reader_res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">trim</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ok, kita telah menyiapkan satu item milik module <code>my_io</code> yaitu sebuah fungsi bernama <code>read_entry</code>. 1 hal yang sedikit berbeda pada definisi fungsi di atas adalah penambahan keyword <code>pub</code> yang ditulis sebagai prefix definisi fungsi.</p><p>Keyword <code>pub</code> digunakan untuk menjadikan suatu item menjadi <strong>public</strong>, agar bisa diakses dari luar module.</p><p>Fungsi <code>read_entry</code> ini berada dalam module <code>my_io</code>. Jika tidak ada keyword <code>pub</code> di situ, maka fungsi <code>read_entry</code> hanya bisa diakses dari dalam <code>my_io</code> saja, tidak bisa diakses dari luar module contohnya seperti dari <code>main.rs</code>. Dengan menjadikan <code>read_entry</code> sebagai fungsi yang public, maka fungsi tersebut bisa diakses dari <code>main.rs</code>.</p><blockquote><p>Lebih jelasnya mengenai keyword <code>pub</code> dibahas pada chapter <a href="/basic/visibility-privacy">Module System ➜ Visibility & Privacy</a></p></blockquote><p>Isi module sudah siap, selanjutnya lanjut ke pendefinisian modul. Umumnya pada bahasa pemrograman, definisi module adalah ada dalam file di mana isi module berada, namun tidak untuk Rust.</p><p>Di Rust, definisi sebuah module (sekali lagi bukan item/isinya ya, tapi definisi dari module itu sendiri) dituliskan pada file terpisah, yaitu di file entrypoint crate, yaitu <code>main.rs</code> atau <code>lib.rs</code>.</p><p>Lanjut, sekarang buka file <code>main.rs</code> dan tulis definisi modul <code>my_io</code> menggunakan statement <code>mod my_io</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// definisi module my_io</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_io</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// fungsi main</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sekarang aplikasikan fungsi <code>read_entry</code> milik module <code>my_io</code> di fungsi <code>main</code> untuk membaca inputan user.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_io</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"enter any number:"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"your number: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program, masukan sebuah angka, lalu enter. Lihat hasilnya, program berjalan sesuai harapan.</p><p><img loading="eager" fetchpriority="high" alt="Rust module" src="/assets/images/module-1-0eea2521d2399e73e455b90f5c2f97fa.png" width="762" height="717" class="img_CujE"></p><p>Cara pengaksesan item dari sebuah module yang kita definisikan sendiri adalah sama seperti pengaksesan item dari crate lainnya, yaitu menggunakan <em>path</em>. Statement <code>my_io::read_entry()</code> artinya item <code>read_entry</code> yang merupakan fungsi dalam module <code>my_io</code> digunakan.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-summary-praktik-1">◉ Summary praktik #1<a class="hash-link" href="#-summary-praktik-1" title="Direct link to heading">​</a></h3><p>Pada praktik pertama ini kita telah belajar penerapan module dengan mengaplikasikan beberapa hal berikut:</p><ul><li>Penggunaan normal module dalam binary crate</li><li>Pembuatan module dengan nama <code>my_io</code>, dengan isi/item ditulis pada file <code>my_io.rs</code></li><li>Penggunaan keyword <code>pub</code> untuk meng-export atau menjadikan item menjadi public, agar bisa diakses dari luar module</li><li>Pengaksesan item milik module, yaitu: <code>my_io::read_entry</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-naming-convention-module">◉ <em>Naming convention</em> module<a class="hash-link" href="#-naming-convention-module" title="Direct link to heading">​</a></h3><p>Sesuai anjuran di <a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">halaman dokumentasi Rust</a>, aturan penulisan nama module adalah menggunakan snake case, contohnya <code>my_io</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-module-item">◉ Module item<a class="hash-link" href="#-module-item" title="Direct link to heading">​</a></h3><p>Module item adalah apapun yang didefinisikan di dalam sebuah module. Pada contoh praktik ke-1 di atas, module <code>my_io</code> memiliki 1 buah item yaitu fungsi bernama <code>read_entry</code>.</p><p>Selain fungsi, module item bisa dalam bentuk lainnya, contohnya: konstanta, submodule, struct, dan lainnya.</p><blockquote><p>Lebih jelasnya tentang macam-macam item dibahas pada chapter <a href="/basic/path-item">Module System ➜ Path & Item</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a203-praktik-2---nama_modulemodrs">A.20.3. Praktik #2 - <code>nama_module/mod.rs</code><a class="hash-link" href="#a203-praktik-2---nama_modulemodrs" title="Direct link to heading">​</a></h2><p>Bagian ini merupakan kelanjutan dari praktik sebelumnya. Program sederhana yang sudah di-buat ditambahi beberapa hal. Data inputan user dikonversi ke bentuk angka untuk kemudian dicek apakah angka tersebut bilangan ganjil atau genap.</p><p>Fungsi untuk konversi string ke bentuk numerik dan juga untuk pengecekan bilangan ganjil genap, adalah dua buah item milik module bernama <code>my_number</code> yang akan kita definisikan sebentar lagi.</p><p>Definisi item module <code>my_io</code> menggunakan notasi penulisan file <code>nama_module.rs</code> (yaitu <code>my_io.rs</code>). Pada module <code>my_number</code> ini kita akan gunakan notasi penulisan <code>nama_module/mod.rs</code> (menjadi <code>my_number/mod.rs</code>) untuk menampung definisi item module <code>my_number</code>.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">module_1</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── my_number</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │ └─── mod.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── my_io.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ok, sekarang buat saja folder dan filenya, yaitu <code>my_number/mod.rs</code>. Lalu pada file <code>mod.rs</code> tulis 2 buah fungsi berikut:</p><ul><li><p>Fungsi untuk konversi string ke numerik <code>i32</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/my_number/mod.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">string_to_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">text</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> text</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Fungsi untuk pengecekan bilangan ganjil</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/my_number/mod.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">is_odd_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">number</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> number </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><p>Kemudian tulis definisi module <code>my_number</code> dalam file entrypoint crate, yaitu <code>main.rs</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// definisi module my_io</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_io</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// definisi module my_number</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// fungsi main</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Terakhir, aplikasikan dua buah fungsi yang sudah didefinisikan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"enter any number:"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"your number: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_number</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">string_to_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_number</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">is_odd_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"is odd number: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program, lihat hasilnya.</p><p><img loading="lazy" alt="Rust module" src="/assets/images/module-2-d8f6f3862036da93c4b7920e144a3a3f.png" width="777" height="872" class="img_CujE"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-summary-praktik-2">◉ Summary praktik #2<a class="hash-link" href="#-summary-praktik-2" title="Direct link to heading">​</a></h3><p>Hingga praktik ke-2 ini, kita telah belajar penerapan module dengan mengaplikasikan beberapa hal berikut:</p><ul><li>Penggunaan normal module dalam binary crate</li><li>Pembuatan module dengan nama <code>my_io</code>, dengan isi/item ditulis pada file <code>my_io.rs</code></li><li>Pembuatan module dengan nama <code>my_number</code>, dengan isi/item ditulis pada file <code>my_number/mod.rs</code></li><li>Penggunaan keyword <code>pub</code> untuk meng-export atau menjadikan item menjadi public, agar bisa diakses dari luar module</li><li>Pengaksesan item milik module, yaitu: <code>my_io::read_entry</code>, <code>my_number::string_to_number</code>, dan <code>my_number::is_odd_number</code></li></ul><blockquote><p>Penerapan notasi penulisan isi module <code>nama_module.rs</code> dan <code>nama_module/mod.rs</code> bisa diterapkan dalam satu package</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-konversi-string-ke-numerik">◉ Konversi string ke numerik<a class="hash-link" href="#-konversi-string-ke-numerik" title="Direct link to heading">​</a></h3><p>Rust mengenal beberapa jenis konversi antar tipe data. Teknik konversi yang kita praktikkan pada chapter ini menggunakan method <code>.parse()</code>, cara ini bisa dilakukan untuk konversi tipe data dari custom types ke primitive. Contohnya seperti di atas, dari <code>String</code> ke <code>i32</code>.</p><p>Penggunaannya cukup mudah, akses saja method <code>.parse()</code> kemudian sisipkan tipe data sebagai parameter generic. Lalu chain dengan method <code>unwrap</code> (yang method tersebut merupakan item milik tipe data <em>generic result type</em> atau <code>Result<T, E></code>).</p><p>Contoh lain untuk konversi dari tipe primitif lainnya bisa dilihat berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"24"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_bool </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"true"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">bool</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_float </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"3.14"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Method <code>parse</code> menghasilkan data bertipe <em>generic result type</em> atau <code>Result<T, E></code>. Tipe ini memiliki method bernama <code>unwrap</code> yang berguna untuk mengambil nilai.</p><blockquote><ul><li>Lebih jelasnya mengenai casting dibahas pada chapter <a href="/basic/type-alias-casting">Type Alias & Casting</a> dan <a href="#/wip/trait-conversion-from-into">Trait ➜ Conversion (From & Into)</a></li><li>Lebih jelasnya mengenai generic dibahas pada chapter <a href="/basic/generics">Generics</a></li><li>Lebih jelasnya mengenai result type dibahas pada chapter <a href="/basic/result-type">Tipe Data ➜ Result</a></li></ul></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a204-submodules">A.20.4. Submodules<a class="hash-link" href="#a204-submodules" title="Direct link to heading">​</a></h2><p>Sampai bagian ini kita telah belajar tentang module beserta 2 macam cara penerapannya.</p><p>Sebuah module bisa saja memiliki module di bawahnya (biasa disebut submodule), dan hal ini adalah konsep yang umum dalam bahasa pemrograman. Di Rust, aturan dalam pembuatan submodule masih sama seperti module, perbedaannya adalah tempat di mana submodule didefinisikan. Jika pada root module definisi ada pada file <code>main.rs</code> atau <code>lib.rs</code>, maka pada submodule definisi ada pada file di mana <em>parent module</em> berada.</p><p>Sebagai contoh jika pada program sebelumnya kita tambahkan module <code>my_number</code> yang sudah dibuat, jika ada submodule dengan nama <code>conversion_utility</code>, maka definisi module berada di <code>my_number/mod.rs</code> dan itemnya di <code>my_number/conversion_utility/mod.rs</code>.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── my_io.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── my_number</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── mod.rs // </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">----- definisi submodule conversion_utility</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── conversion_utility</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── mod.rs // </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">----- definisi item/isi conversion_utility</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Atau definisi module tetap di <code>my_number/mod.rs</code> namun itemnya di <code>my_number/conversion_utility.rs</code>.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── my_io.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── my_number</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── mod.rs // </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">----- definisi submodule conversion_utility</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── conversion_utility.rs // </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">----- definisi item/isi conversion_utility</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Penerapan notasi penulisan <code>nama_module.rs</code> biasanya dalam case ketika module tersebut tidak memiliki submodule.</p><p>Untuk module yang memiliki submodule, parent module harus menerapkan notasi penulisan <code>nama_module/mod.rs</code>, hal ini karena pendefinisian submodule berada pada file <code>mod.rs</code> dalam parent module tersebut.</p></blockquote><p>Lalu bagaimana jika sebuah submodule memiliki submodule yang memiliki submodule ... dst, aturannya tetap sama seperti aturan submodule.</p><p>Mari lanjut praktik agar tidak bingung. Kita akan modifikasi program sebelumnya. Item <code>string_to_number</code> yang sebelumnya adalah item milik <code>my_number</code> kita pindah ke sebuah module baru bernama <code>conversion_utility</code> yang merupakan submodule dari <code>my_number</code>. Silakan buat file baru <code>my_number/conversion_utility/mod.rs</code>, kemudian isi dengan fungsi berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/my_number/conversion_utility/mod.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">string_to_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">text</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> text</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>string_to_number</code> yang sebelumnya ada di <code>my_number/mod.rs</code> silakan dihapus.</p><p>Kemudian pada file <code>my_number/mod.rs</code>, tambahkan definisi submodule <code>conversion_utility</code>. Isi file tersebut kurang lebih menjadi seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/my_number/mod.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">conversion_utility</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">is_odd_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">number</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> number </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>O iya, karena submodule merupakan sebuah item milik module, maka harus ditambahkan juga keyword <code>pub</code>, agar submodule bisa diakses dari luar scope-nya. Contoh penerapannya bisa dilihat di atas.</p><p>Terakhir, pada <code>main.rs</code>, ubah pemanggilan fungsi <code>string_to_number</code> dari ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_number</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">string_to_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... menjadi ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_number</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">conversion_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">string_to_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kurang lebih strukturnya menjadi seperti berikut:</p><p><img loading="lazy" alt="Rust submodule" src="/assets/images/module-3-b8f34c47b905cadb9001a866ebb80809.png" width="940" height="955" class="img_CujE"></p><p>Jalankan program untuk mengetest hasilnya.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-summary-praktik-3">◉ Summary praktik #3<a class="hash-link" href="#-summary-praktik-3" title="Direct link to heading">​</a></h3><p>Hingga pembahasan pada praktik submodule, kita telah belajar penerapan module dengan mengaplikasikan beberapa hal berikut:</p><ul><li>Penggunaan normal module dalam binary crate</li><li>Pembuatan module dengan nama <code>my_io</code>, dengan isi/item ditulis pada file <code>my_io.rs</code></li><li>Pembuatan module dengan nama <code>my_number</code>, dengan isi/item ditulis pada file <code>my_number/mod.rs</code></li><li>Pembuatan submodule dengan nama <code>my_number/conversion_utility</code>, dengan isi/item ditulis pada file <code>my_number/conversion.rs</code> yang di-import menggunakan <code>path</code> attribute.</li><li>Penggunaan keyword <code>pub</code> pada fungsi agar bisa diakses dari luar module</li><li>Penggunaan keyword <code>pub</code> pada submodule agar bisa diakses dari luar parent module</li><li>Pengaksesan item milik module, yaitu: <code>my_io::read_entry</code>, <code>my_number::conversion_utility::string_to_number</code>, dan <code>my_number::is_odd_number</code></li></ul><blockquote><p>Penerapan notasi penulisan isi module <code>nama_module.rs</code> dan <code>nama_module/mod.rs</code> bisa diterapkan dalam satu package</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a205-penerapan-keyword-use">A.20.5. Penerapan keyword <code>use</code><a class="hash-link" href="#a205-penerapan-keyword-use" title="Direct link to heading">​</a></h2><p>Keyword <code>use</code> bisa digunakan untuk meng-import module atau item tertentu, dan dengannya pengaksesan item menjadi lebih pendek. Contohnya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token namespace" style="opacity:0.7">my_number</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">conversion_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">string_to_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... bisa dituliskan menjadi ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_number</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">conversion_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">string_to_number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">string_to_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Lebih jelasnya mengenai keyword <code>use</code> dibahas pada chapter <a href="/basic/use">Module System ➜ Use</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a206-module-path-attribute">A.20.6. Module <code>path</code> attribute<a class="hash-link" href="#a206-module-path-attribute" title="Direct link to heading">​</a></h2><p>Selain menggunakan dua teknik definisi module item di atas yang fokusnya ada pada penamaan file, ada juga cara lain pendefinisian module item, yaitu dengan memanfaatkan <code>path</code> attribute.</p><p>Mari kita praktikkan, silakan ubah struktur package yang sudah dibuat dari ...</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── my_io.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── my_number</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── mod.rs // </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">----- definisi submodule conversion_utility</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── conversion_utility.rs // </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">----- definisi item/isi conversion_utility</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... menjadi ...</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── my_io.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── my_number</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── mod.rs // </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">----- definisi submodule conversion_utility</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── conversion.rs // </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">----- definisi item/isi conversion_utility</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Yang telah kita lakukan adalah me-rename file <code>conversion_utility.rs</code> menjadi <code>conversion.rs</code>. Efeknya akan muncul error dalam pengaksesan module item, karena submodule <code>my_number/conversion_utility</code> isi/item-nya harus berada pada file <code>my_number/conversion_utility.rs</code> atau <code>my_number/conversion_utility/mod.rs</code>. Sedangkan file <code>conversion.rs</code> tidak memenuhi kriteria tersebut.</p><p>Sekarang buka isi file <code>my_number/mod.rs</code>, lalu ubah statement pendefinisian submodule dari ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/my_number/mod.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">conversion_utility</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... menjadi ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/my_number/mod.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[path = </span><span class="token attribute attr-name string" style="color:#e3116c">"conversion.rs"</span><span class="token attribute attr-name" style="color:#00a4db">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">conversion_utility</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Rust module" src="/assets/images/module-4-e83e7a2e8d7d6d4d11ec121d6dc184d0.png" width="690" height="365" class="img_CujE"></p><p>Lalu run, dan program akan jalan normal tanpa error.</p><p>Statement <code>#[path = "conversion.rs"]</code> di atas merupakan contoh penerapan dari Rust path attributes. Dengannya kita bisa menempatkan isi sebuah module pada file yang namanya bebas (pada contoh di atas, file bernama <code>conversion.rs</code>).</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-summary-praktik-4">◉ Summary praktik #4<a class="hash-link" href="#-summary-praktik-4" title="Direct link to heading">​</a></h3><p>Hingga pembahasan pada praktik module <code>path</code> attribute, kita telah belajar penerapan module dengan mengaplikasikan beberapa hal berikut:</p><ul><li>Penggunaan normal module dalam binary crate</li><li>Pembuatan module dengan nama <code>my_io</code>, dengan isi/item ditulis pada file <code>my_io.rs</code></li><li>Pembuatan module dengan nama <code>my_number</code>, dengan isi/item ditulis pada file <code>my_number/mod.rs</code></li><li>Pembuatan submodule dengan nama <code>my_number/conversion_utility</code>, dengan isi/item ditulis pada file <code>my_number/conversion_utility/mod.rs</code></li><li>Penggunaan keyword <code>pub</code> pada fungsi agar bisa diakses dari luar module</li><li>Penggunaan keyword <code>pub</code> pada submodule agar bisa diakses dari luar parent module</li><li>Pengaksesan item milik module, yaitu: <code>my_io::read_entry</code>, <code>my_number::conversion_utility::string_to_number</code>, dan <code>my_number::is_odd_number</code></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a207-pembahasan-lanjutan">A.20.7. Pembahasan lanjutan<a class="hash-link" href="#a207-pembahasan-lanjutan" title="Direct link to heading">​</a></h2><p>Pembahasan topik module dilanjutkan pada beberapa chapter lain. Pada chapter <a href="/basic/module-inline">Module System ➜ Inline Module</a> kita akan bahas secara mendetail mengenai apa itu inline module dan perbedaannya dibanding normal module. Lalu nantinya di cahpter <a href="/basic/visibility-privacy">Module System ➜ Visibility & Privacy</a> akan dibahas secara lengkap mengenai keyword <code>pub</code> dan kontrol privasi lainnya di pemrograman Rust.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/module_basic" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../module_basic</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.pub.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.pub.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.mod.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.mod.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/mod.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/mod.html</a></li><li><a href="https://aloso.github.io/2021/03/28/module-system.html" target="_blank" rel="noopener noreferrer">https://aloso.github.io/2021/03/28/module-system.html</a></li><li><a href="https://stackoverflow.com/questions/69275034/what-is-the-difference-between-use-and-pub-use" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/69275034/what-is-the-difference-between-use-and-pub-use</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/package-crate"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.19. Module System ➜ Package & Crate</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/module-inline"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.21. Module System ➜ Inline Module</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a201-rust-module-system" class="table-of-contents__link toc-highlight">A.20.1. Rust module system</a></li><li><a href="#a202-praktik-1---nama_modulers" class="table-of-contents__link toc-highlight">A.20.2. Praktik #1 - <code>nama_module.rs</code></a><ul><li><a href="#-summary-praktik-1" class="table-of-contents__link toc-highlight">◉ Summary praktik #1</a></li><li><a href="#-naming-convention-module" class="table-of-contents__link toc-highlight">◉ <em>Naming convention</em> module</a></li><li><a href="#-module-item" class="table-of-contents__link toc-highlight">◉ Module item</a></li></ul></li><li><a href="#a203-praktik-2---nama_modulemodrs" class="table-of-contents__link toc-highlight">A.20.3. Praktik #2 - <code>nama_module/mod.rs</code></a><ul><li><a href="#-summary-praktik-2" class="table-of-contents__link toc-highlight">◉ Summary praktik #2</a></li><li><a href="#-konversi-string-ke-numerik" class="table-of-contents__link toc-highlight">◉ Konversi string ke numerik</a></li></ul></li><li><a href="#a204-submodules" class="table-of-contents__link toc-highlight">A.20.4. Submodules</a><ul><li><a href="#-summary-praktik-3" class="table-of-contents__link toc-highlight">◉ Summary praktik #3</a></li></ul></li><li><a href="#a205-penerapan-keyword-use" class="table-of-contents__link toc-highlight">A.20.5. Penerapan keyword <code>use</code></a></li><li><a href="#a206-module-path-attribute" class="table-of-contents__link toc-highlight">A.20.6. Module <code>path</code> attribute</a><ul><li><a href="#-summary-praktik-4" class="table-of-contents__link toc-highlight">◉ Summary praktik #4</a></li></ul></li><li><a href="#a207-pembahasan-lanjutan" class="table-of-contents__link toc-highlight">A.20.7. Pembahasan lanjutan</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/module-inline.html b/basic/module-inline.html index 2c693d85..3e288bb2 100644 --- a/basic/module-inline.html +++ b/basic/module-inline.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-inline/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-inline/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.21. Module System ➜ Inline Module","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-inline/#webpage"},"wordCount":871,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-inline/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-inline/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/module-inline","name":"A.21. Module System ➜ Inline Module","description":"Pada chapter sebelumnya kita telah belajar cara manajemen module. Pembahasan tersebut dilanjut pada chapter ini, yaitu tentang inline module.","datePublished":"2024-08-01T10:17:29.463Z","dateModified":"2024-08-01T10:17:29.463Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-inline/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/module-inline"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-inline/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.21. Module System ➜ Inline Module","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-inline/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-inline/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.21. Module System ➜ Inline Module","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-inline/#webpage"},"wordCount":871,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-inline/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-inline/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/module-inline","name":"A.21. Module System ➜ Inline Module","description":"Pada chapter sebelumnya kita telah belajar cara manajemen module. Pembahasan tersebut dilanjut pada chapter ini, yaitu tentang inline module.","datePublished":"2024-08-30T07:44:49.538Z","dateModified":"2024-08-30T07:44:49.538Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-inline/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/module-inline"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-inline/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.21. Module System ➜ Inline Module","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.21. Module System ➜ Inline Module</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.21. Module System ➜ Inline Module</h1></header><p>Pada chapter sebelumnya kita telah belajar cara manajemen module. Pembahasan tersebut dilanjut pada chapter ini, yaitu tentang inline module.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a211-inline-module">A.21.1. Inline Module<a class="hash-link" href="#a211-inline-module" title="Direct link to heading">​</a></h2><p>Inline module adalah cara lain dalam pendefinisian module beserta item-nya, caranya dengan tetap menggunakan keyword <code>mod</code> hanya saja isi/item ditulis di dalam blok kode keyword <code>mod</code> tersebut. Agar lebih jelas silakan lihat penerapan inline module berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">module_a</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">fungsi_satu</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">submodule_b</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">PI</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">fungsi_dua</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Inline module cukup mudah diterapkan, yang sebelumnya module dan submodule di-manage dengan mengacu ke penamaan file, dalam inline module cukup tulis saja sebagai blok kode definisi module.</p><p>Pada contoh di atas, <code>module_a</code> memiliki beberapa item:</p><ul><li>Item berupa fungsi <code>module_a::fungsi_satu</code></li><li>Item berupa submodule <code>module_a::submodule_b</code></li><li>Item berupa konstanta <code>module_a::submodule_b::PI</code></li><li>Item berupa fungsi <code>module_a::submodule_b::fungsi_dua</code></li></ul><p>Aturan definisi submodule dan item pada inline module masih sama seperti pada <em>normal module</em>, salah satunya adalah agar item bisa diakses dari luar module maka perlu menggunakan keyword <code>pub</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a212-praktik-inline-module">A.21.2. Praktik inline module<a class="hash-link" href="#a212-praktik-inline-module" title="Direct link to heading">​</a></h2><p>Mari lanjut proses pembalajaran dengan praktik. Kita akan buat program sederhana yang di dalamnya ada proses generate random string, yang kemudian di-hash.</p><p>Silakan buat package baru menggunakan <code>cargo new</code>. Penulis di sini memilih nama <code>inline_module_1</code> sebagai nama package. Setelah itu, siapkan fungsi main dan juga module bernama <code>utilities</code> dengan penulisan kode menerapkan inline module. O iya, tulis keduanya (<code>module utilities</code> dan fungsi <code>main</code>) dalam satu file yang sama yaitu <code>main.rs</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">utilities</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">random</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ... isi fungsi string milik module utilities::random</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">password</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">hash</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">text</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ... isi fungsi hash milik module utilities::password</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">is_valid</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">plain</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> hashed</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ... isi fungsi is_valid milik module utilities::password</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ... isi fungsi main</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Item <code>utilities::random::string</code> adalah fungsi nantinya digunakan untuk generate data random string</li><li>Item <code>utilities::password::hash</code> adalah fungsi untuk melakukan proses hashing password menggunakan <a href="https://en.wikipedia.org/wiki/Bcrypt" target="_blank" rel="noopener noreferrer">bcrypt</a></li><li>Item <code>utilities::password::is_valid</code> adalah fungsi untuk pengecekan apakah password sama dengan data setelah di-hash</li></ul><p>Ketiga fungsi tersebut kemudian diterapkan pada program kecil yang logic-nya ditulis dalam fungsi <code>main</code>.</p><blockquote><p>Pada contoh di atas, semua item dan sub-item milik <code>utilities</code> didefinisikan public menggunakan keyword <code>pub</code> agar bisa diakses dari module.</p><p>Sedangkan module <code>utilities</code> sendiri tidak wajib di-expose menggunakan keyword <code>pub</code>, karena definisi module-nya berada dalam satu file yang sama dengan fungsi <code>main</code>, yaitu file <code>main.rs</code>.</p><p>Lebih jelasnya mengenai keyword <code>pub</code> dibahas pada chapter <a href="/basic/visibility-privacy">Module System ➜ Visibility & Privacy</a></p></blockquote><p>Sebelum lanjut proses koding, silakan tambahkan dulu beberapa dependencies berikut pada <code>Cargo.toml</code>, kemudian jalankan <code>cargo build</code> di-download.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">Cargo.toml</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">package</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">name </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"module_inline_1"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">version </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.1.0"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">edition </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"2021"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">dependencies</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">bcrypt </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.13"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">rand </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.8.5"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Package <a href="https://crates.io/keywords/bcrypt" target="_blank" rel="noopener noreferrer"><code>bcrypt</code></a> adalah crate yang isinya banyak fungsi untuk kebutuhan enkripsi bcrypt</li><li>Package <a href="https://crates.io/keywords/rand" target="_blank" rel="noopener noreferrer"><code>rand</code></a> berisi item untuk keperluan generate data random. Kita sudah beberapa kali menggunakan crate ini.</li></ul><p>Ok, sekarang kembali ke source code. Tulis isi fungsi <code>utilities::random::string</code> berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">utilities</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">random</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">rand</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Rng</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">CHARSET</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token punctuation" style="color:#393A34">[</span><span class="token keyword" style="color:#00009f">u8</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"abcdefghijklmnopqrstuvwxyz"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_bytes</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> arr </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> _ </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token plain">length </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> n </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">rand</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">thread_rng</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">gen_range</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">(</span><span class="token constant" style="color:#36acaa">CHARSET</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">char</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">CHARSET</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> arr</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">char</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_utf8</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">arr</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Di atas adalah salah satu contoh penerapan generate random string dengan lebar <em>parameterized</em>.</p><p>Cara tersebut sebenarnya bukan yang paling efisien, namun karena jumlah topik yang kita pelajari masih belum terlalu banyak, penulis menghindari penerapan beberapa hal yang sifatnya baru dan bikin tambah bingung.</p></blockquote><p>Lanjut, silakan tulis kode untuk hashing password dan juga untuk validasi password berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">utilities</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">password</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">hash</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">text</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">bcrypt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">hash</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">text</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">bcrypt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token constant" style="color:#36acaa">DEFAULT_COST</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> result</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">is_valid</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">plain</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> hashed</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> valid </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">bcrypt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">verify</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">plain</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> hashed</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> valid</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dalam enkripsi menggunakan bcrypt ada dua hal yang penting diketahui, yang pertama adalah data yang akan di-hash (pada contoh di atas adalah <code>text</code>), dan <em>cost</em> atau biaya enkripsi dalam bentuk numerik. Pada praktik ini, <code>bcrypt::DEFAULT_COST</code> digunakan sebagai cost enkripsi.</p><p>Pengecekan apakah data terenkripsi adalah sama dengan data asli dilakukan menggunakan fungsi <code>bcrypt::verify</code>.</p><p>Kedua fungsi <code>bcrypt::hash</code> dan <code>bcrypt::verify</code> menghasilkan data bertipe <em>generic result type</em> atau <code>Result<T, E></code>. Tipe ini memiliki method bernama <code>unwrap</code> yang berguna untuk pengambilan result atau nilai.</p><blockquote><p>Lebih jelasnya tentang result type dibahas pada chapter <a href="/basic/result-type">Tipe Data ➜ Result</a></p></blockquote><p>Oke, sekarang fungsi utility sudah siap, mari implementasikan semua fungsi tersebut pada <code>main</code>.</p><p>Silakan tulis kode berikut. Sebuah variabel bernama <code>password</code> dibuat, diisi dengan kombinasi dari string dan juga random string. Lalu data password tersebut di-hash kemudian dicek nilainya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> password </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"zereth mortis {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">utilities</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">random</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"raw password: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> password</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> hashed </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">utilities</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">password</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">hash</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">password</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hashed password: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> hashed</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> is_valid </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">utilities</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">password</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">is_valid</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">password</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">hashed</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"is password matched? {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> is_valid</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program untuk melihat hasilnya.</p><p><img loading="lazy" alt="Rust Inline Module" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl0AAAB9CAIAAAAX00FjAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTAtMTlUMTg6MDI6MjYrMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyLTEwLTE5VDE5OjE3OjEyKzA3Oj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B6P6Fmycfpp2c6qZeC3lQ3v/RJ0wEyHdlczakTAXf4wlupyiwrnnsSbOL3qI8c2Zce71uxPYdJ37M1wtXsy3f8SBP2E6Xc1FvBgWvi47Xtmts98hXrwTetSmInT1bmYhp9OXyvI208vva9O3r14Br4+6+5+o6moaTSxGm/YgMC2R1s0ROfav8yo0t+3FWe/hTfPiBeJGL7A472U166Mf192LxrykL6ZWfPAFruTV5hIcAC9eSa2OIYTzRt+KfNpbZScv3Ku46gNeBPAiLw+4KD/51Vw1BeBFAC8CAAAA8CIAAAAALwIAAADwIgAAAPD6eLG+W+9GcPJvao4X3hrOqbwe/RcAAIAXr5IXY0ltJUgZukbnqmUsAQDgknnxZnG1vBj6BB5eBACA7XlRqLnkj1vC1FekIVyxitbVLAtvSLzOfl0RdiOhZu8+FqtIyiCBq7/41AsAAC/6bk7Y67kuDeGad4Supiy8TqqhvHqcUPMqf7E2iMWLlhQtAADAiwYvRkUirlZDOHDvbXEtf+3I+jfhrxRqNlTSo7xYGGSxFC0AAMCLym+Ter9tXrwiDWGLF+3C10djfAd4pVBz+DJTyYshqralaAEAAF7UvCg9kIi/eDUawooXncL7Eq8tEjpGqHknXmRTEQAAL67hRX/z6bo0hKO8KAtfF7qlvLpSqNnUFg60jcWLmZSjWSQAAIAXtYilVohtRr94DeE2LxrytnW1POXVI4Wa47xYF0kbZArVH7x1igQAAPiLx4H1OAAAAPAivAgAAABehBcBAADAiwAAAAC8CAAAAMCLAAAAALwIAAAAwIsAAAAAvAgAAADAiwAAAAC8CAAAAIC7u/8Dd9E0Fm64vPIAAAAASUVORK5CYII=" width="605" height="125" class="img_ev3q"></p><p>Statement <code>utilities::random::string(10)</code> menghasilkan random string dengan lebar <code>10</code>, sesuai kebutuhan. Hasil dari pemanggilan fungsi tersebut di-concat dengan text kemudian ditampung variabel <code>password</code>.</p><p>Variabel <code>password</code> kemudian di-hash menggunakan <code>utilities::password::hash</code>, kemudian dibandingkan hasil hash-nya apakah cocok dengan text aslinya menggunakan <code>utilities::password::is_valid</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a213-inline-module-item">A.21.3. Inline module item<a class="hash-link" href="#a213-inline-module-item" title="Direct link to heading">​</a></h2><p>Module item dalam inline module masih sama seperti pada module normal, yaitu adalah apapun yang didefinisikan di dalam sebuah module. Bisa berupa fungsi, konstanta, submodule, dan lainnya. Pada contoh di atas ada beberapa item didefinisikan:</p><ul><li>Item <code>utilities::random</code> yang merupakan sebuah submodule (inline module).</li><li>Item <code>utilities::random::string</code> yang merupakan sebuah fungsi.</li><li>Item <code>utilities::password</code> yang merupakan sebuah submodule (inline module).</li><li>Item <code>utilities::password::hash</code> yang merupakan sebuah fungsi.</li><li>Item <code>utilities::password::is_valid</code> yang merupakan sebuah fungsi.</li></ul><blockquote><p>Lebih jelasnya tentang macam-macam item dibahas pada chapter <a href="/basic/path-item">Module System ➜ Path & Item</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a214-inline-module-file-nama_modulers-atau-nama_modulemodrs">A.21.4. Inline module file <code>nama_module.rs</code> atau <code>nama_module/mod.rs</code><a class="hash-link" href="#a214-inline-module-file-nama_modulers-atau-nama_modulemodrs" title="Direct link to heading">​</a></h2><p>Dalam <em>real project</em> hampir tidak mungkin semua kode ditulis di file <code>main.rs</code>. Pastinya kode akan di-split menjadi banyak module sesuai kebutuhan.</p><p>Kode sebelumya, akan kita refactor. Module <code>utilities</code> yang berada di <code>main.rs</code> perlu dipindah ke file baru yang sesuai dengan aturan penulisan module, yaitu <code>nama_module.rs</code> atau <code>nama_module/mod.rs</code>. Di sini penulis memilih <code>nama_module.rs</code>, jadi silakan buat file bernama <code>utilities.rs</code>, lalu pindah isi itemnya kesana (statement definisi inline module <code>utilities</code> tidak perlu ikut dipindah, hanya isinya saja, seperti normalnya definisi module).</p><p>O iya, jangan lupa untuk menambahkan statement <code>mod utilities</code> pada <code>main.rs</code>, agar module terdaftar dan bisa digunakan.</p><p><img loading="lazy" alt="Rust Inline Module" src="/assets/images/module-inline-2-c6d08bd6d0d03ddba99457fd3c0bdc5d.png" width="775" height="963" class="img_ev3q"></p><p>Jalankan program untuk melihat hasilnya.</p><p>Pada contoh ke-2 ini modul <code>utilities</code> didefinisikan menggunakan cara biasa, sedang isi dari module tersebut didefinisikan menggunakan teknik inline module.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a215-inline-module-path-attribute">A.21.5. Inline module <code>path</code> attribute<a class="hash-link" href="#a215-inline-module-path-attribute" title="Direct link to heading">​</a></h2><p><code>path</code> attribute bisa digunakan dalam manajemen inline module. Silakan utak-atik kode yang sudah dibuat dengan mengikuti step berikut:</p><ol><li><p>Buat file baru bernama <code>utilities/password.rs</code>, kemudian pindah isi definisi module <code>password</code> ke file tersebut.</p></li><li><p>Buat file baru bernama <code>utilities/random.rs</code>, kemudian pindah isi definisi module <code>random</code> ke file tersebut.</p></li><li><p>Hapus file <code>utilities.rs</code>, pindah definisi module <code>utilities</code> ke file <code>main.rs</code>, hasilnya kurang lebih seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">utilities</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[path = </span><span class="token attribute attr-name string" style="color:#e3116c">"random.rs"</span><span class="token attribute attr-name" style="color:#00a4db">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">random</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[path = </span><span class="token attribute attr-name string" style="color:#e3116c">"password.rs"</span><span class="token attribute attr-name" style="color:#00a4db">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">password</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ol><p><img loading="lazy" alt="Rust Inline Module" src="/assets/images/module-inline-3-9234cea75bd46ea1eea49d0320315320.png" width="920" height="954" class="img_ev3q"></p><p>Jalankan program untuk melihat hasilnya.</p><p>Pada kode di atas, <code>path</code> yang digunakan bukan <code>utilities/random.rs</code> melainkan <code>random.rs</code>, hail ini dikarenakan <code>path</code> attribute dipanggil <strong>di dalam module <code>utilities</code></strong>, menjadikan current path pada blok kode tersebut menjadi <code>utilities/</code>.</p><p>Silakan coba ubah isi <code>path</code> attribute menjadi <code>utilities/random.rs</code>, hasilnya adalah error. Rust akan menggunakan gabungan dari current path (<code>utilities/</code>) dan path pada <code>path</code> attribute (<code>utilities/random.rs</code>) dalam lookup, jadinya yang di-lookup adalah <code>utilities/utilities/random.rs</code>, dan hasilnya error karena tidak ada file di sana.</p><p><img loading="lazy" alt="Rust Inline Module" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwQAAAC8CAIAAABJ6P4wAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0i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AACBDyNBwytCiLpFhQgAAgAwhQ8MqQwAAAMhQL8kQAAAAIEPIEAAAACBDAAAAAMgQAAAAADIEAAAAgAwBAAAAIEO9wuLy79/89Yab//6pRd5GAAAA6CUZ0r/MatOY3lbXDrzyxoYPl/+INxIAAAB6R4Zs6vmh1oyTG2++cRtvJAAAAPSoDI0fPdk4MFrjBpAhAAAA6F0Z2jbdqDUthAwBAABAL8tQ7WkhxUOf+vDXG1/hnQQAAICekyGdFqpx6rTtQxvIDwEAAEBvydD40ZMnj47XvgcnN3J3PQAAAPSeDHUtLcScIQAAAOg9GYq+aqgLaSFkCAAAAHpShroIMgQAAADDLEN8AzUAAAAMqQwlv03GffUAAAAwnDIEAAAAgAwBAAAAIEMAAAAAyBAAAAAAMgQAAACADAEAAAAgQwAAAADIEAAAAAAyBAAAAIAMAQAAACBDAAAAAMgQAAAAADIEAAAAgAwBAAAAIEMAAAAw3Pw/GeaY/+PLIkYAAAAASUVORK5CYII=" width="772" height="188" class="img_ev3q"></p><p>Module system di Rust merupakan topik yang cukup membingungkan (menurut penulis) karena desain-nya yang cukup unik jika dibandingkan dengan bagaimana bahasa pemrograman lain mengelola module-nya. Penulis anjurkan untuk mencoba praktik membuat program lainnya yang menerapkan module system, agar cepat terbiasa.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/module_inline" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../module_inline</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.mod.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.mod.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/mod.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/mod.html</a></li><li><a href="https://aloso.github.io/2021/03/28/module-system.html" target="_blank" rel="noopener noreferrer">https://aloso.github.io/2021/03/28/module-system.html</a></li><li><a href="https://stackoverflow.com/questions/69275034/what-is-the-difference-between-use-and-pub-use" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/69275034/what-is-the-difference-between-use-and-pub-use</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/module-basic"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.20. Module System ➜ Module</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/module-scope-item-access"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.22. Module System ➜ Scope & Akses Item</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a211-inline-module" class="table-of-contents__link toc-highlight">A.21.1. Inline Module</a></li><li><a href="#a212-praktik-inline-module" class="table-of-contents__link toc-highlight">A.21.2. Praktik inline module</a></li><li><a href="#a213-inline-module-item" class="table-of-contents__link toc-highlight">A.21.3. Inline module item</a></li><li><a href="#a214-inline-module-file-nama_modulers-atau-nama_modulemodrs" class="table-of-contents__link toc-highlight">A.21.4. Inline module file <code>nama_module.rs</code> atau <code>nama_module/mod.rs</code></a></li><li><a href="#a215-inline-module-path-attribute" class="table-of-contents__link toc-highlight">A.21.5. Inline module <code>path</code> attribute</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.21. Module System ➜ Inline Module</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.21. Module System ➜ Inline Module</h1></header><p>Pada chapter sebelumnya kita telah belajar cara manajemen module. Pembahasan tersebut dilanjut pada chapter ini, yaitu tentang inline module.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a211-inline-module">A.21.1. Inline Module<a class="hash-link" href="#a211-inline-module" title="Direct link to heading">​</a></h2><p>Inline module adalah cara lain dalam pendefinisian module beserta item-nya, caranya dengan tetap menggunakan keyword <code>mod</code> hanya saja isi/item ditulis di dalam blok kode keyword <code>mod</code> tersebut. Agar lebih jelas silakan lihat penerapan inline module berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">module_a</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">fungsi_satu</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">submodule_b</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">PI</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">fungsi_dua</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Inline module cukup mudah diterapkan, yang sebelumnya module dan submodule di-manage dengan mengacu ke penamaan file, dalam inline module cukup tulis saja sebagai blok kode definisi module.</p><p>Pada contoh di atas, <code>module_a</code> memiliki beberapa item:</p><ul><li>Item berupa fungsi <code>module_a::fungsi_satu</code></li><li>Item berupa submodule <code>module_a::submodule_b</code></li><li>Item berupa konstanta <code>module_a::submodule_b::PI</code></li><li>Item berupa fungsi <code>module_a::submodule_b::fungsi_dua</code></li></ul><p>Aturan definisi submodule dan item pada inline module masih sama seperti pada <em>normal module</em>, salah satunya adalah agar item bisa diakses dari luar module maka perlu menggunakan keyword <code>pub</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a212-praktik-inline-module">A.21.2. Praktik inline module<a class="hash-link" href="#a212-praktik-inline-module" title="Direct link to heading">​</a></h2><p>Mari lanjut proses pembalajaran dengan praktik. Kita akan buat program sederhana yang di dalamnya ada proses generate random string, yang kemudian di-hash.</p><p>Silakan buat package baru menggunakan <code>cargo new</code>. Penulis di sini memilih nama <code>inline_module_1</code> sebagai nama package. Setelah itu, siapkan fungsi main dan juga module bernama <code>utilities</code> dengan penulisan kode menerapkan inline module. O iya, tulis keduanya (<code>module utilities</code> dan fungsi <code>main</code>) dalam satu file yang sama yaitu <code>main.rs</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">utilities</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">random</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ... isi fungsi string milik module utilities::random</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">password</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">hash</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">text</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ... isi fungsi hash milik module utilities::password</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">is_valid</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">plain</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> hashed</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ... isi fungsi is_valid milik module utilities::password</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ... isi fungsi main</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Item <code>utilities::random::string</code> adalah fungsi nantinya digunakan untuk generate data random string</li><li>Item <code>utilities::password::hash</code> adalah fungsi untuk melakukan proses hashing password menggunakan <a href="https://en.wikipedia.org/wiki/Bcrypt" target="_blank" rel="noopener noreferrer">bcrypt</a></li><li>Item <code>utilities::password::is_valid</code> adalah fungsi untuk pengecekan apakah password sama dengan data setelah di-hash</li></ul><p>Ketiga fungsi tersebut kemudian diterapkan pada program kecil yang logic-nya ditulis dalam fungsi <code>main</code>.</p><blockquote><p>Pada contoh di atas, semua item dan sub-item milik <code>utilities</code> didefinisikan public menggunakan keyword <code>pub</code> agar bisa diakses dari module.</p><p>Sedangkan module <code>utilities</code> sendiri tidak wajib di-expose menggunakan keyword <code>pub</code>, karena definisi module-nya berada dalam satu file yang sama dengan fungsi <code>main</code>, yaitu file <code>main.rs</code>.</p><p>Lebih jelasnya mengenai keyword <code>pub</code> dibahas pada chapter <a href="/basic/visibility-privacy">Module System ➜ Visibility & Privacy</a></p></blockquote><p>Sebelum lanjut proses koding, silakan tambahkan dulu beberapa dependencies berikut pada <code>Cargo.toml</code>, kemudian jalankan <code>cargo build</code> di-download.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">Cargo.toml</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">package</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">name </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"module_inline_1"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">version </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.1.0"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">edition </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"2021"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">dependencies</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">bcrypt </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.13"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">rand </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.8.5"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Package <a href="https://crates.io/keywords/bcrypt" target="_blank" rel="noopener noreferrer"><code>bcrypt</code></a> adalah crate yang isinya banyak fungsi untuk kebutuhan enkripsi bcrypt</li><li>Package <a href="https://crates.io/keywords/rand" target="_blank" rel="noopener noreferrer"><code>rand</code></a> berisi item untuk keperluan generate data random. Kita sudah beberapa kali menggunakan crate ini.</li></ul><p>Ok, sekarang kembali ke source code. Tulis isi fungsi <code>utilities::random::string</code> berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">utilities</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">random</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">length</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">rand</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Rng</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">CHARSET</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token punctuation" style="color:#393A34">[</span><span class="token keyword" style="color:#00009f">u8</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"abcdefghijklmnopqrstuvwxyz"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_bytes</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> arr </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> _ </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token plain">length </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> n </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">rand</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">thread_rng</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">gen_range</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">(</span><span class="token constant" style="color:#36acaa">CHARSET</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">char</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">CHARSET</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> arr</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">char</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_utf8</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">arr</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Di atas adalah salah satu contoh penerapan generate random string dengan lebar <em>parameterized</em>.</p><p>Cara tersebut sebenarnya bukan yang paling efisien, namun karena jumlah topik yang kita pelajari masih belum terlalu banyak, penulis menghindari penerapan beberapa hal yang sifatnya baru dan bikin tambah bingung.</p></blockquote><p>Lanjut, silakan tulis kode untuk hashing password dan juga untuk validasi password berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">utilities</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">password</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">hash</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">text</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">bcrypt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">hash</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">text</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">bcrypt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token constant" style="color:#36acaa">DEFAULT_COST</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> result</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">is_valid</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">plain</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> hashed</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> valid </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">bcrypt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">verify</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">plain</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> hashed</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> valid</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dalam enkripsi menggunakan bcrypt ada dua hal yang penting diketahui, yang pertama adalah data yang akan di-hash (pada contoh di atas adalah <code>text</code>), dan <em>cost</em> atau biaya enkripsi dalam bentuk numerik. Pada praktik ini, <code>bcrypt::DEFAULT_COST</code> digunakan sebagai cost enkripsi.</p><p>Pengecekan apakah data terenkripsi adalah sama dengan data asli dilakukan menggunakan fungsi <code>bcrypt::verify</code>.</p><p>Kedua fungsi <code>bcrypt::hash</code> dan <code>bcrypt::verify</code> menghasilkan data bertipe <em>generic result type</em> atau <code>Result<T, E></code>. Tipe ini memiliki method bernama <code>unwrap</code> yang berguna untuk pengambilan result atau nilai.</p><blockquote><p>Lebih jelasnya tentang result type dibahas pada chapter <a href="/basic/result-type">Tipe Data ➜ Result</a></p></blockquote><p>Oke, sekarang fungsi utility sudah siap, mari implementasikan semua fungsi tersebut pada <code>main</code>.</p><p>Silakan tulis kode berikut. Sebuah variabel bernama <code>password</code> dibuat, diisi dengan kombinasi dari string dan juga random string. Lalu data password tersebut di-hash kemudian dicek nilainya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> password </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"zereth mortis {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">utilities</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">random</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"raw password: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> password</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> hashed </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">utilities</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">password</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">hash</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">password</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hashed password: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> hashed</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> is_valid </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">utilities</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">password</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">is_valid</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">password</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">hashed</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"is password matched? {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> is_valid</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program untuk melihat hasilnya.</p><p><img loading="eager" fetchpriority="high" alt="Rust Inline Module" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl0AAAB9CAIAAAAX00FjAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE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0ltJUgZukbnqmUsAQDgknnxZnG1vBj6BB5eBACA7XlRqLnkj1vC1FekIVyxitbVLAtvSLzOfl0RdiOhZu8+FqtIyiCBq7/41AsAAC/6bk7Y67kuDeGad4Supiy8TqqhvHqcUPMqf7E2iMWLlhQtAADAiwYvRkUirlZDOHDvbXEtf+3I+jfhrxRqNlTSo7xYGGSxFC0AAMCLym+Ter9tXrwiDWGLF+3C10djfAd4pVBz+DJTyYshqralaAEAAF7UvCg9kIi/eDUawooXncL7Eq8tEjpGqHknXmRTEQAAL67hRX/z6bo0hKO8KAtfF7qlvLpSqNnUFg60jcWLmZSjWSQAAIAXtYilVohtRr94DeE2LxrytnW1POXVI4Wa47xYF0kbZArVH7x1igQAAPiLx4H1OAAAAPAivAgAAABehBcBAADAiwAAAAC8CAAAAMCLAAAAALwIAAAAwIsAAAAAvAgAAADAiwAAAAC8CAAAAIC7u/8Dd9E0Fm64vPIAAAAASUVORK5CYII=" width="605" height="125" class="img_CujE"></p><p>Statement <code>utilities::random::string(10)</code> menghasilkan random string dengan lebar <code>10</code>, sesuai kebutuhan. Hasil dari pemanggilan fungsi tersebut di-concat dengan text kemudian ditampung variabel <code>password</code>.</p><p>Variabel <code>password</code> kemudian di-hash menggunakan <code>utilities::password::hash</code>, kemudian dibandingkan hasil hash-nya apakah cocok dengan text aslinya menggunakan <code>utilities::password::is_valid</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a213-inline-module-item">A.21.3. Inline module item<a class="hash-link" href="#a213-inline-module-item" title="Direct link to heading">​</a></h2><p>Module item dalam inline module masih sama seperti pada module normal, yaitu adalah apapun yang didefinisikan di dalam sebuah module. Bisa berupa fungsi, konstanta, submodule, dan lainnya. Pada contoh di atas ada beberapa item didefinisikan:</p><ul><li>Item <code>utilities::random</code> yang merupakan sebuah submodule (inline module).</li><li>Item <code>utilities::random::string</code> yang merupakan sebuah fungsi.</li><li>Item <code>utilities::password</code> yang merupakan sebuah submodule (inline module).</li><li>Item <code>utilities::password::hash</code> yang merupakan sebuah fungsi.</li><li>Item <code>utilities::password::is_valid</code> yang merupakan sebuah fungsi.</li></ul><blockquote><p>Lebih jelasnya tentang macam-macam item dibahas pada chapter <a href="/basic/path-item">Module System ➜ Path & Item</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a214-inline-module-file-nama_modulers-atau-nama_modulemodrs">A.21.4. Inline module file <code>nama_module.rs</code> atau <code>nama_module/mod.rs</code><a class="hash-link" href="#a214-inline-module-file-nama_modulers-atau-nama_modulemodrs" title="Direct link to heading">​</a></h2><p>Dalam <em>real project</em> hampir tidak mungkin semua kode ditulis di file <code>main.rs</code>. Pastinya kode akan di-split menjadi banyak module sesuai kebutuhan.</p><p>Kode sebelumya, akan kita refactor. Module <code>utilities</code> yang berada di <code>main.rs</code> perlu dipindah ke file baru yang sesuai dengan aturan penulisan module, yaitu <code>nama_module.rs</code> atau <code>nama_module/mod.rs</code>. Di sini penulis memilih <code>nama_module.rs</code>, jadi silakan buat file bernama <code>utilities.rs</code>, lalu pindah isi itemnya kesana (statement definisi inline module <code>utilities</code> tidak perlu ikut dipindah, hanya isinya saja, seperti normalnya definisi module).</p><p>O iya, jangan lupa untuk menambahkan statement <code>mod utilities</code> pada <code>main.rs</code>, agar module terdaftar dan bisa digunakan.</p><p><img loading="lazy" alt="Rust Inline Module" src="/assets/images/module-inline-2-c6d08bd6d0d03ddba99457fd3c0bdc5d.png" width="775" height="963" class="img_CujE"></p><p>Jalankan program untuk melihat hasilnya.</p><p>Pada contoh ke-2 ini modul <code>utilities</code> didefinisikan menggunakan cara biasa, sedang isi dari module tersebut didefinisikan menggunakan teknik inline module.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a215-inline-module-path-attribute">A.21.5. Inline module <code>path</code> attribute<a class="hash-link" href="#a215-inline-module-path-attribute" title="Direct link to heading">​</a></h2><p><code>path</code> attribute bisa digunakan dalam manajemen inline module. Silakan utak-atik kode yang sudah dibuat dengan mengikuti step berikut:</p><ol><li><p>Buat file baru bernama <code>utilities/password.rs</code>, kemudian pindah isi definisi module <code>password</code> ke file tersebut.</p></li><li><p>Buat file baru bernama <code>utilities/random.rs</code>, kemudian pindah isi definisi module <code>random</code> ke file tersebut.</p></li><li><p>Hapus file <code>utilities.rs</code>, pindah definisi module <code>utilities</code> ke file <code>main.rs</code>, hasilnya kurang lebih seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">utilities</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[path = </span><span class="token attribute attr-name string" style="color:#e3116c">"random.rs"</span><span class="token attribute attr-name" style="color:#00a4db">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">random</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token attribute attr-name" style="color:#00a4db">#[path = </span><span class="token attribute attr-name string" style="color:#e3116c">"password.rs"</span><span class="token attribute attr-name" style="color:#00a4db">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">password</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ol><p><img loading="lazy" alt="Rust Inline Module" src="/assets/images/module-inline-3-9234cea75bd46ea1eea49d0320315320.png" width="920" height="954" class="img_CujE"></p><p>Jalankan program untuk melihat hasilnya.</p><p>Pada kode di atas, <code>path</code> yang digunakan bukan <code>utilities/random.rs</code> melainkan <code>random.rs</code>, hail ini dikarenakan <code>path</code> attribute dipanggil <strong>di dalam module <code>utilities</code></strong>, menjadikan current path pada blok kode tersebut menjadi <code>utilities/</code>.</p><p>Silakan coba ubah isi <code>path</code> attribute menjadi <code>utilities/random.rs</code>, hasilnya adalah error. Rust akan menggunakan gabungan dari current path (<code>utilities/</code>) dan path pada <code>path</code> attribute (<code>utilities/random.rs</code>) dalam lookup, jadinya yang di-lookup adalah <code>utilities/utilities/random.rs</code>, dan hasilnya error karena tidak ada file di sana.</p><p><img loading="lazy" alt="Rust Inline Module" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwQAAAC8CAIAAABJ6P4wAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3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AAMqQwlv03GffUAAAAwnDIEAAAAgAwBAAAAIEMAAAAAyBAAAAAAMgQAAACADAEAAAAgQwAAAADIEAAAAAAyBAAAAIAMAQAAACBDAAAAAMgQAAAAADIEAAAAgAwBAAAAIEMAAAAw3Pw/GeaY/+PLIkYAAAAASUVORK5CYII=" width="772" height="188" class="img_CujE"></p><p>Module system di Rust merupakan topik yang cukup membingungkan (menurut penulis) karena desain-nya yang cukup unik jika dibandingkan dengan bagaimana bahasa pemrograman lain mengelola module-nya. Penulis anjurkan untuk mencoba praktik membuat program lainnya yang menerapkan module system, agar cepat terbiasa.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/module_inline" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../module_inline</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.mod.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.mod.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/mod.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/mod.html</a></li><li><a href="https://aloso.github.io/2021/03/28/module-system.html" target="_blank" rel="noopener noreferrer">https://aloso.github.io/2021/03/28/module-system.html</a></li><li><a href="https://stackoverflow.com/questions/69275034/what-is-the-difference-between-use-and-pub-use" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/69275034/what-is-the-difference-between-use-and-pub-use</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/module-basic"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.20. Module System ➜ Module</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/module-scope-item-access"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.22. Module System ➜ Scope & Akses Item</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a211-inline-module" class="table-of-contents__link toc-highlight">A.21.1. Inline Module</a></li><li><a href="#a212-praktik-inline-module" class="table-of-contents__link toc-highlight">A.21.2. Praktik inline module</a></li><li><a href="#a213-inline-module-item" class="table-of-contents__link toc-highlight">A.21.3. Inline module item</a></li><li><a href="#a214-inline-module-file-nama_modulers-atau-nama_modulemodrs" class="table-of-contents__link toc-highlight">A.21.4. Inline module file <code>nama_module.rs</code> atau <code>nama_module/mod.rs</code></a></li><li><a href="#a215-inline-module-path-attribute" class="table-of-contents__link toc-highlight">A.21.5. Inline module <code>path</code> attribute</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/module-scope-item-access.html b/basic/module-scope-item-access.html index 0b49e21a..2de228ec 100644 --- a/basic/module-scope-item-access.html +++ b/basic/module-scope-item-access.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-scope-item-access/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-scope-item-access/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.22. Module System ➜ Scope & Akses Item","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-scope-item-access/#webpage"},"wordCount":768,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-scope-item-access/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-scope-item-access/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/module-scope-item-access","name":"A.22. Module System ➜ Scope & Akses Item","description":"Pembahasan chapter ini masih dalam lingkup module system, yaitu tentang scope dan pengakesan module item.","datePublished":"2024-08-01T10:17:29.610Z","dateModified":"2024-08-01T10:17:29.610Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-scope-item-access/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/module-scope-item-access"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-scope-item-access/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.22. Module System ➜ Scope & Akses Item","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-scope-item-access/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-scope-item-access/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.22. Module System ➜ Scope & Akses Item","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-scope-item-access/#webpage"},"wordCount":768,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-scope-item-access/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-scope-item-access/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/module-scope-item-access","name":"A.22. Module System ➜ Scope & Akses Item","description":"Pembahasan chapter ini masih dalam lingkup module system, yaitu tentang scope dan pengakesan module item.","datePublished":"2024-08-30T07:44:49.755Z","dateModified":"2024-08-30T07:44:49.755Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-scope-item-access/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/module-scope-item-access"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/module-scope-item-access/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.22. Module System ➜ Scope & Akses Item","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.22. Module System ➜ Scope & Akses Item</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.22. Module System ➜ Scope & Akses Item</h1></header><p>Pembahasan chapter ini masih dalam lingkup module system, yaitu tentang scope dan pengakesan module item.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a221-scope">A.22.1. Scope<a class="hash-link" href="#a221-scope" title="Direct link to heading">​</a></h2><p>Scope bisa diartikan dengan: representasi di mana kode berada. Apapun yang ditulis dalam blok kode (ditandai dengan diapit tanda kurung kurawal <code>{ }</code>) berarti dalam satu scope yang sama.</p><p>Agar lebih jelas, lihat kode berikut kemudian pelajari penjelasan di bawahnya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">PI</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> nama </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Sylvanas Windrunner"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> occupation </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"ex-Warchief of the Horde"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Konstanta <code>PI</code>, fungsi <code>main</code>, dan juga fungsi <code>my_func</code> di definisikan satu level dan berada di scope terluar (yang pada ebook ini disebut sebagai <em>root</em>).</li><li>Statement pemanggilan fungsi <code>my_func()</code> berada dalam scope blok kode fungsi <code>main</code>.</li><li>Variabel <code>nama</code> dan <code>occupation</code> berada pada scope blok kode fungsi <code>my_func</code>.</li></ul><blockquote><p>Sebenarnya pembahasan mengenai <code>scope</code> harus diiringi dengan pembahasan tentang <a href="/basic/block-expression">Block expression</a>, namun karena kita belum mempelajarinya, chapter ini pembahasan hanya akan fokus pada penerapan scope yang berhubungan dengan <strong>module scope</strong>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a222-module-scope">A.22.2. Module Scope<a class="hash-link" href="#a222-module-scope" title="Direct link to heading">​</a></h2><p>Module scope adalah scope untuk module. Apa bedanya dengan scope secara umum? Silakan perhatikan kode berikut terlebih dahulu:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_module</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> event_one</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Siege of Ogrimmar"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_submodule</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> event_two</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Battle for Azeroth"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">func_two</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> event_three</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Sepulcher of the First Ones"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas:</p><ul><li>Konstanta <code>event_one</code> berada dalam module scope <code>my_module</code>.</li><li>Module <code>my_submodule</code> adalah sebuah inline module yang berada dalam module scope <code>my_module</code>. Module <code>my_submodule</code> berada dalam satu scope yang sama dengan variabel <code>event_one</code>.</li><li>Konstanta <code>event_two</code> berada dalam module scope <code>my_submodule</code>.</li><li>Fungsi <code>func_two</code> berada dalam module scope <code>my_submodule</code>.</li><li>Konstanta <code>event_three</code> <strong>scope</strong>-nya adalah dalam blok fungsi <code>func_two</code>. Sedangkan <strong>module scope</strong>-nya adalah dalam module scope <code>my_submodule</code>. Jadi kelihatan ya bedanya.</li></ul><p>Pemahaman tentang module scope ini penting karena akan berhubungan dengan apa yang akan dipelajari di <em>section</em> berikutnya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a223-keyword-self-dan-crate-root">A.22.3. Keyword <code>self</code> dan <em>crate root</em><a class="hash-link" href="#a223-keyword-self-dan-crate-root" title="Direct link to heading">​</a></h2><p>Keyword <code>self</code> merepresentasikan current module scope. Dengannya kita bisa mengakses item yang deklarasinya ada pada module scope yang sama.</p><blockquote><p>Sebenarnya selain penjelasan di atas, keyword <code>self</code> juga digunakan untuk hal lain yaitu sebagai receiver method.</p><p>Pembahasan tentang penerapan keyword <code>self</code> sebagai receiver method dibahas pada chapter <a href="/basic/method">Method</a></p></blockquote><p>Selanjutnya, apa itu <em>crate root</em>? <strong>Crate root</strong> adalah apapun yang didefinisikan di file entrypoint crate (yaitu <code>src/main.rs</code> untuk binary crate, dan <code>src/lib.rs</code> untuk library crate). <strong>Crate root</strong> adalah module scope yang berada di root (paling atas). Apapun yang berada di <em>crate root</em> berarti berada dalam module scope yang sama.</p><p>Sebagai contoh, pada kode program berikut, module <code>my_mod</code> dan fungsi <code>main</code> dideklarasikan di <em>crate root</em> <code>src/main.rs</code>. Artinya kedua item tersebut berada dalam satu module scope yang sama, yaitu di <em>crate root</em>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">note</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_mod::run_the_app()`. note {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> note</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"1st call"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_mod</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"2nd call"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Module item access self" src="data:image/png;base64,iVBORw0K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fL1ne1AV7At3w95L08yFS+qOH7Y7fu4Wx8B/XUrXypx3e2gsK63Fo2U7qdbHexTCK5oeU+cfJmOr6NhhO15K+QrCefZh7/ehNaZ8ShG8b3xSRmiXMtnN3wp5E7U63xt7l13wiB7wUUW2ozfoVXeoOGlsW3+6tLhNCO8Z06T2Yg7vGG2XxeaB98XyLzVfec5Hod2/MEIbR7fCOEEALfCCEEvhFCCIFvhBBCl8Q34Rr6nBCuoaaObi5cw1w9hHANiHANV4tvwjUs3l7+rXYX6yF8dQm+7+hM4Psy8L50pZ2RdPCBreMzXvCNLoFvwjUQriE/k3ANWZueGk6m7t2ZYIkRh24V34RrIFxDqd0J15Dju1zJY9Y34RrQTPgmXAPhGsrtTriGpAXH984s3pJwDWg2fBOugXAN5XYnXEMyMzwT34RrQLNa34RrIFyD3e63Hq6h5arpzJhmfROuAc3j+yZcA+Eaiu1+0+EaMnaPuwFHS0C4BjQbvu8I10C4BnU7wjWIrRnNd86FHrLCiEM3jO+LiXANOxDhGhAC38XJ+h3hGq4E34RrQOgW8E24htoaIlwDQuAbIYQQ+EYIIQS+EUIIgW+EEALfCCGEwDdCCCHwjRBC4BshhBD4RgghBL4RQujW9H+5773REWOSYgAAAABJRU5ErkJggg==" width="490" height="128" class="img_ev3q"></p><p>Pada fungsi <code>main</code>, ada dua statement pemanggilan module item <code>my_mod::run_the_app</code>. Kedua statement tersebut adalah mirip, pembedanya ada pada statement ke-2, yaitu keyword <code>self</code> digunakan di segment path sebagai prefix.</p><p>Keyword <code>self</code> menginstruksi program bahwa item yang dipanggil adalah item yang module scope-nya sama.</p><p>Pada contoh di atas, module <code>my_mod</code> berada dalam satu scope yang sama dengan fungsi <code>main</code>, yaitu di <em>crate root</em>. Karena itu, <code>my_mod</code> bisa diakses dengan menggunakan keyword <code>self</code>, atau lansung panggil saja nama module seperti biasanya, <code>my_mod()</code>.</p><p>Bisa dibilang keyword <code>self</code> ini opsional dalam penggunaannya, boleh ikut dituliskan dan boleh juga tidak.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token namespace" style="opacity:0.7">my_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"1st call"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_mod</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"2nd call"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a224-keyword-self-pada-module-scope">A.22.4. Keyword <code>self</code> pada module scope<a class="hash-link" href="#a224-keyword-self-pada-module-scope" title="Direct link to heading">​</a></h2><p>Lanjut ke praktik berikutnya. Masih tentang keyword <code>self</code>, kita akan gunakan keyword ini untuk mengakses item dalam module.</p><p>Silakan tulis kode berikut kemudian jalankan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_mod::my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_mod::run_the_app()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh bisa dilihat ada dua buah fungsi dideklarasikan dengan nama yang sama persis, yang satu berada di <em>crate root</em>, satunya lagi merupakan item milik <code>my_mod</code>.</p><p>Di dalam <code>my_mod::run_the_app</code> ada 2 kali pemanggilan fungsi <code>my_func</code>, satunya menggunakan keyword <code>self</code> dan satunya tidak. Fungsi <code>my_func</code> manakah yang dipanggil? Hasilnya bisa dilihat pada gambar di bawah ini.</p><p><img loading="lazy" alt="Module item access self" src="/assets/images/module-scope-item-access-2-d5e5b26c8180ce6a413ba9a494361526.png" width="681" height="290" class="img_ev3q"></p><p>Kedua statement <code>my_func()</code> dan <code>self::my_func()</code> dalam <code>my_mod::run_the_app</code> adalah mengarah ke fungsi yang sama, yaitu <code>my_mod::my_func</code>.</p><p>Jadi kesimpulan dari penerapan keyword <code>self</code> dalam module item adalah sama seperti penerapannya pada <em>crate root</em>, yaitu boleh dipakai boleh tidak. Keyword <code>self</code> adalah opsional.</p><p>Lalu bagaimana cara memanggil <code>my_func</code> yang berada di <em>crate root</em>, dengan pemanggilan adalah dari dalam module item? Caranya adalah menggunakan keyword <code>crate</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a225-keyword-crate-pada-module-scope">A.22.5. Keyword <code>crate</code> pada module scope<a class="hash-link" href="#a225-keyword-crate-pada-module-scope" title="Direct link to heading">​</a></h2><p>Keyword ini digunakan untuk mengakses apapun yang ada di <em>crate root</em>.</p><p>Pada contoh di atas, fungsi <code>my_func</code> yang berada di <em>crate root</em> bisa dipanggil dari fungsi <code>main</code> dengan statement <code>my_func()</code> atau <code>self::my_func()</code>. Untuk bagian ini penulis rasa sudah cukup jelas.</p><p>Beda cerita kalau fungsi tersebut dipanggil dari dalam module item <code>run_the_app</code>. Kedua statement <code>my_func()</code> dan <code>self::my_func()</code> mengarah ke <code>my_mod::my_func</code>, bukan ke fungsi <code>my_func</code> di <em>crate root</em>. Hal ini karena <strong>current module scope</strong> dalam statement <code>run_the_app</code> adalah module <code>my_mod</code>, maka pemanggilan <code>my_func</code> tanpa <code>self</code> atau dengannya mengarah ke fungsi yang sama yaitu <code>my_mod::my_func</code>.</p><p>Pada <em>section</em> ini kita akan belajar tentang keyword baru, yaitu <code>crate</code>. Keyword tersebut digunakan untuk mengakses apapun yang berada di <em>crate root</em>. Kita bisa memanfaatkannya untuk mengakses <code>my_func</code> yang berada di <em>crate root</em> dengan pengaksesan dari dalam module item.</p><p>Silakan ubah kode di atas menjadi seperti berikut. Perubahannya ada pada statement dalam fungsi <code>run_the_app</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_mod::my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_mod::run_the_app()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program, hasilnya berbeda dengan eksekusi program sebelumnya. Statement <code>crate::my_func()</code> dalam fungsi <code>run_the_app</code> mengarah ke fungsi <code>my_func</code> di root, sedangkan <code>self::my_func</code> mengarah ke <code>my_mod::my_func</code>.</p><p><img loading="lazy" alt="Module item access crate" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAecAAACICAIAAABSurQ4AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTAtMjNUMTk6NDc6NDArMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDI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9iVJjQOamfXPTzn0DlyYxnNmNoIzUTtZFo8GqvnSfLX6EWZmD77N5Zt7WZzu0Bt+Y7Ve3hQqXypy7fP/fqJi6kd9FO/hqWd2tniEOtwawFM6XTyuoslRskJLR8J0EZoRmrfTML5Mtccmun4QhepymDWayN0x9SO7bIZv5UrvRRDy1Lb/W0kQmh71E49JDOA9nTCbNIutA2sL1H5pnNO+hi2FocEIbRVaiOEEILaCCEEtRFCCEFthBBCS1H7brMijC/nZl3oQGYAhNAabO27y4qwzCpBMgMghLZG7Y1okarzpQlCaFFq7zMrgt6hMVmBzKBAZgCE0ILU3mtWhGI6mJzaKlmBEeyECEoIoeWoveOsCG22tt6ozk60UoTQgtTecVaES6lt2fFkBkAILWxr7zQrwhy2dmtMUmxthNCF1N5xVgSb2s5kBZYrHr82QmhBaj/sNiuC5c9oSVaQd13JRwK0EUKzUPtmutusCKzXRgjdJbXvOCsCmQEQQndI7fvOikBmAITQ/VEbIYQQ1EYIIaiNEEIIaiOEEFqK2nebFaG9JrdZDEL2BoSg9kR231VWhK1Qm+wNCEHtZal9t7oNtcnegBDUVlPvPWVFUIe/Mroj+Uw/qOU5uHfeoWETyd6AEJqN2nvNimAcHrZ3rFN4nph1PmqTvQEhNBO1d5wVQR2e4rM7V9KSZgcC2RsQQvNRe8dZESxqZzOLhahN9gaE0ERbe6dZETy2dvfrUtQmewNCqJ3aO86KIKkdPbEG+z9xv7f7tcnegBCai9oPu82KYB4eVCpf6vLtc79QYx5qk70BITSB2jfT3WZF2Eo9Wa+NENRuRda9ZkXYSj3J3oAQ1G7G1r1mRdhKPcnegBDURgghBLURQghqI4QQgtoIIYSgNkIIQW2EEEJQGyGEENRGCKFd6P+U9Em657m7zAAAAABJRU5ErkJggg==" width="487" height="136" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a226-keyword-super">A.22.6. Keyword <code>super</code><a class="hash-link" href="#a226-keyword-super" title="Direct link to heading">​</a></h2><p>Selain <code>self</code> dan <code>crate</code> ada juga keyword <code>super</code>, yang gunanya adalah untuk mengakses <em>parent</em> module scope atau 1 scope di atas <em>current</em> module scope. Agar lebih jelas silakan pelajari kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_mod::my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_submod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_mod::my_submod::my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_mod::my_submod::run_the_app()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">super</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">my_submod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ada 3 buah fungsi <code>my_func</code> dideklarasikan:</p><ul><li>Fungsi <code>my_func</code> yang berada di <em>crate root</em>.</li><li>Fungsi <code>my_func</code> yang merupakan module item milik <code>my_mod</code>.</li><li>Fungsi <code>my_func</code> yang merupakan module item milik submodule <code>my_submod</code>.</li></ul><p>Dalam fungsi <code>run_the_app</code>, ketiga fungsi dengan nama tersebut dipanggil.</p><ul><li>Statement <code>crate::my_func()</code> akan mengarah ke fungsi <code>my_func</code> yang ada di <em>crate root</em>.</li><li>Statement <code>super::my_func()</code> akan mengarah ke fungsi <code>my_func</code> yang ada di parent module scope, yaitu <code>my_mod::my_func</code>.</li><li>Statement <code>self::my_func()</code> akan mengarah ke fungsi <code>my_func</code> yang ada di current module scope, yaitu <code>my_mod::my_submod::my_func</code>.</li></ul><p><img loading="lazy" alt="Module item access super" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAecAAACYCAIAAABRbLajAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWx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Jc0OBLI3IISmo/aBsyJY1M5mFjNRm+wNCKErbe2DZkXw2Nrdr3NRm+wNCKF2ah84K4KkdvTEGuz/xP3e7tcmewNCaCpqPxw2K4J5eFCpfKnLty/9Qo1pqE32BoTQFdS+m3abFWEr9WS9NkJQuxVZe82KsJV6kr0BIajdjK29ZkXYSj3J3oAQ1EYIIQS1EUIIaiOEEILaCCGE7k9tsiIMNVnrIospF1qT/AGhndjaZEWA2nMzm+QPCJEVAWpvpJkkf0DIRW2yIqw9K0JY+hgQxQgUFXcyyR9I/oD2Rm2yIqw7K4LRvdWsCJdzkvyBIFloX9QmK8IGsiKoJ5ojKGsfZpbkDwSkRfuiNlkRtpEVYZj6hwZyhdp95Un+QPIHtD9bm6wIG8iKkF4an63de5ZJ/oCtjXZEbbIibCQrQurRqmZFuOxA8gf82mhn1H4gK8LasyLE/Rl1osiKkHYmyR9I/oD2R+27iawIR5mjk/wBoX1Qm6wI3w7xKR7JHxDaC7XJirD6eu6nmSR/QFAbIYQQ1EYIIQS1EUIIaiOEEILaCCGEoDZCCEFthBBCM+l/ifoKd1JW4mkAAAAASUVORK5CYII=" width="487" height="152" class="img_ev3q"></p><p>Semoga cukup jelas ya. Silakan ulangi terus praktik di atas jika perlu, agar makin paham.</p><p>O iya, keyword <code>super</code> ini bisa digunakan banyak kali sesuai kebutuhan. Setiap kali keyword ditulis sebagai segment path, maka artinya 1 level parent module scope.</p><p>Jika mengacu ke contoh program di atas, maka kedua statement berikut adalah ekuivalen.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">super</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">super</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a227-praktik-lanjutan">A.22.7. Praktik lanjutan<a class="hash-link" href="#a227-praktik-lanjutan" title="Direct link to heading">​</a></h2><p>Agar pemahaman makin mantab, silakan pelajari program berikut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"call `my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">module_a</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path item ➜ `module_a::my_func`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"call `module_a::my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">module_b</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path item ➜ `module_b::submodule_b_one`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">submodule_b_one</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path item ➜ `module_b::submodule_b_one::my_func`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"call `module_b::submodule_b_one::my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path item ➜ `module_b::submodule_b_two`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">submodule_b_two</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path item ➜ `module_b::submodule_b_two::my_func`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"call `module_b::submodule_b_two::my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// current module scope adalah module `submodule_b_two`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// keyword `super` di sini mengarah ke parent scope, yaitu `module`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">//</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// statement `super::my_func()` berikut adalah</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ekuivalen dengan `module_b::my_func()`</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// jika diakses dari crate root.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">super</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">//</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// statement `super::submodule_b_one::my_func()` berikut adalah</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ekuivalen dengan `module_b::submodule_b_one::my_func()`</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// jika diakses dari crate root.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">super</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">submodule_b_one</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path item ➜ `module_b::my_func`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// fungsi ini tidak publik, jadi hanya bisa diakses dalam scope module `module_b` saja.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"call `module_b::my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path item ➜ `module_b::run_all_funcs`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">run_all_funcs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// semua fungsi yang didefinisikan akan di call dalam blok kode ini.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"call `my::run_all_funcs()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// keyword `self` merepresentasikan current module scope.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// menjadikan dua statement berikut adalah ekuivalen:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// `my_func()` adalah ekuivalen dengan `self::my_func()`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// current module scope adalah `module_b`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// keyword `super` di sini mengarah ke parent scope, yaitu root atau scope paling luar.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">//</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// statement `super::my_func()` berikut adalah</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// memanggil fungsi `my_func` yang ada di crate root,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// yang deklarasinya satu level dengan fungsi `main`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">super</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">//</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// statement `super::module_a::my_func()` berikut adalah</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// memanggil fungsi `my_func` milik module `module_a` yang ada di crate root.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">super</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">module_a</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">//</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// module `submodule_b_two` bisa diakses menggunakan self ataupun tidak</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// karena module tersebut merupakan item yang deklarasinya 1 scope dengan fungsi ini,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 1 level dengan `run_all_funcs`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">submodule_b_two</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">submodule_b_two</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">module_b</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">run_all_funcs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/module_scope_item_access" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../module_scope_item_access</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.self.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.self.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.super.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.super.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.crate.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.crate.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/mod.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/mod.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/meta/doc.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/meta/doc.html</a></li><li><a href="https://aloso.github.io/2021/03/28/module-system.html" target="_blank" rel="noopener noreferrer">https://aloso.github.io/2021/03/28/module-system.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/module-inline"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.21. Module System ➜ Inline Module</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/struct"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.23. Struct</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a221-scope" class="table-of-contents__link toc-highlight">A.22.1. Scope</a></li><li><a href="#a222-module-scope" class="table-of-contents__link toc-highlight">A.22.2. Module Scope</a></li><li><a href="#a223-keyword-self-dan-crate-root" class="table-of-contents__link toc-highlight">A.22.3. Keyword <code>self</code> dan <em>crate root</em></a></li><li><a href="#a224-keyword-self-pada-module-scope" class="table-of-contents__link toc-highlight">A.22.4. Keyword <code>self</code> pada module scope</a></li><li><a href="#a225-keyword-crate-pada-module-scope" class="table-of-contents__link toc-highlight">A.22.5. Keyword <code>crate</code> pada module scope</a></li><li><a href="#a226-keyword-super" class="table-of-contents__link toc-highlight">A.22.6. Keyword <code>super</code></a></li><li><a href="#a227-praktik-lanjutan" class="table-of-contents__link toc-highlight">A.22.7. Praktik lanjutan</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.22. Module System ➜ Scope & Akses Item</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.22. Module System ➜ Scope & Akses Item</h1></header><p>Pembahasan chapter ini masih dalam lingkup module system, yaitu tentang scope dan pengakesan module item.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a221-scope">A.22.1. Scope<a class="hash-link" href="#a221-scope" title="Direct link to heading">​</a></h2><p>Scope bisa diartikan dengan: representasi di mana kode berada. Apapun yang ditulis dalam blok kode (ditandai dengan diapit tanda kurung kurawal <code>{ }</code>) berarti dalam satu scope yang sama.</p><p>Agar lebih jelas, lihat kode berikut kemudian pelajari penjelasan di bawahnya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">PI</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> nama </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Sylvanas Windrunner"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> occupation </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"ex-Warchief of the Horde"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Konstanta <code>PI</code>, fungsi <code>main</code>, dan juga fungsi <code>my_func</code> di definisikan satu level dan berada di scope terluar (yang pada ebook ini disebut sebagai <em>root</em>).</li><li>Statement pemanggilan fungsi <code>my_func()</code> berada dalam scope blok kode fungsi <code>main</code>.</li><li>Variabel <code>nama</code> dan <code>occupation</code> berada pada scope blok kode fungsi <code>my_func</code>.</li></ul><blockquote><p>Sebenarnya pembahasan mengenai <code>scope</code> harus diiringi dengan pembahasan tentang <a href="/basic/block-expression">Block expression</a>, namun karena kita belum mempelajarinya, chapter ini pembahasan hanya akan fokus pada penerapan scope yang berhubungan dengan <strong>module scope</strong>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a222-module-scope">A.22.2. Module Scope<a class="hash-link" href="#a222-module-scope" title="Direct link to heading">​</a></h2><p>Module scope adalah scope untuk module. Apa bedanya dengan scope secara umum? Silakan perhatikan kode berikut terlebih dahulu:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_module</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> event_one</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Siege of Ogrimmar"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_submodule</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> event_two</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Battle for Azeroth"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">func_two</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> event_three</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Sepulcher of the First Ones"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas:</p><ul><li>Konstanta <code>event_one</code> berada dalam module scope <code>my_module</code>.</li><li>Module <code>my_submodule</code> adalah sebuah inline module yang berada dalam module scope <code>my_module</code>. Module <code>my_submodule</code> berada dalam satu scope yang sama dengan variabel <code>event_one</code>.</li><li>Konstanta <code>event_two</code> berada dalam module scope <code>my_submodule</code>.</li><li>Fungsi <code>func_two</code> berada dalam module scope <code>my_submodule</code>.</li><li>Konstanta <code>event_three</code> <strong>scope</strong>-nya adalah dalam blok fungsi <code>func_two</code>. Sedangkan <strong>module scope</strong>-nya adalah dalam module scope <code>my_submodule</code>. Jadi kelihatan ya bedanya.</li></ul><p>Pemahaman tentang module scope ini penting karena akan berhubungan dengan apa yang akan dipelajari di <em>section</em> berikutnya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a223-keyword-self-dan-crate-root">A.22.3. Keyword <code>self</code> dan <em>crate root</em><a class="hash-link" href="#a223-keyword-self-dan-crate-root" title="Direct link to heading">​</a></h2><p>Keyword <code>self</code> merepresentasikan current module scope. Dengannya kita bisa mengakses item yang deklarasinya ada pada module scope yang sama.</p><blockquote><p>Sebenarnya selain penjelasan di atas, keyword <code>self</code> juga digunakan untuk hal lain yaitu sebagai receiver method.</p><p>Pembahasan tentang penerapan keyword <code>self</code> sebagai receiver method dibahas pada chapter <a href="/basic/method">Method</a></p></blockquote><p>Selanjutnya, apa itu <em>crate root</em>? <strong>Crate root</strong> adalah apapun yang didefinisikan di file entrypoint crate (yaitu <code>src/main.rs</code> untuk binary crate, dan <code>src/lib.rs</code> untuk library crate). <strong>Crate root</strong> adalah module scope yang berada di root (paling atas). Apapun yang berada di <em>crate root</em> berarti berada dalam module scope yang sama.</p><p>Sebagai contoh, pada kode program berikut, module <code>my_mod</code> dan fungsi <code>main</code> dideklarasikan di <em>crate root</em> <code>src/main.rs</code>. Artinya kedua item tersebut berada dalam satu module scope yang sama, yaitu di <em>crate root</em>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">note</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_mod::run_the_app()`. note {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> note</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"1st call"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_mod</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"2nd call"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="Module item access self" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeoAAACACAIAAABLF73lAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4b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htoaIlwDQuAbIYQQ+EYIIQS+EUIIgW+EEALfCCGEwDdCCCHwjRBC4BshhBD4RgghBL4RQujW9H+5773REWOSYgAAAABJRU5ErkJggg==" width="490" height="128" class="img_CujE"></p><p>Pada fungsi <code>main</code>, ada dua statement pemanggilan module item <code>my_mod::run_the_app</code>. Kedua statement tersebut adalah mirip, pembedanya ada pada statement ke-2, yaitu keyword <code>self</code> digunakan di segment path sebagai prefix.</p><p>Keyword <code>self</code> menginstruksi program bahwa item yang dipanggil adalah item yang module scope-nya sama.</p><p>Pada contoh di atas, module <code>my_mod</code> berada dalam satu scope yang sama dengan fungsi <code>main</code>, yaitu di <em>crate root</em>. Karena itu, <code>my_mod</code> bisa diakses dengan menggunakan keyword <code>self</code>, atau lansung panggil saja nama module seperti biasanya, <code>my_mod()</code>.</p><p>Bisa dibilang keyword <code>self</code> ini opsional dalam penggunaannya, boleh ikut dituliskan dan boleh juga tidak.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token namespace" style="opacity:0.7">my_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"1st call"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_mod</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"2nd call"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a224-keyword-self-pada-module-scope">A.22.4. Keyword <code>self</code> pada module scope<a class="hash-link" href="#a224-keyword-self-pada-module-scope" title="Direct link to heading">​</a></h2><p>Lanjut ke praktik berikutnya. Masih tentang keyword <code>self</code>, kita akan gunakan keyword ini untuk mengakses item dalam module.</p><p>Silakan tulis kode berikut kemudian jalankan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_mod::my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_mod::run_the_app()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh bisa dilihat ada dua buah fungsi dideklarasikan dengan nama yang sama persis, yang satu berada di <em>crate root</em>, satunya lagi merupakan item milik <code>my_mod</code>.</p><p>Di dalam <code>my_mod::run_the_app</code> ada 2 kali pemanggilan fungsi <code>my_func</code>, satunya menggunakan keyword <code>self</code> dan satunya tidak. Fungsi <code>my_func</code> manakah yang dipanggil? Hasilnya bisa dilihat pada gambar di bawah ini.</p><p><img loading="lazy" alt="Module item access self" src="/assets/images/module-scope-item-access-2-d5e5b26c8180ce6a413ba9a494361526.png" width="681" height="290" class="img_CujE"></p><p>Kedua statement <code>my_func()</code> dan <code>self::my_func()</code> dalam <code>my_mod::run_the_app</code> adalah mengarah ke fungsi yang sama, yaitu <code>my_mod::my_func</code>.</p><p>Jadi kesimpulan dari penerapan keyword <code>self</code> dalam module item adalah sama seperti penerapannya pada <em>crate root</em>, yaitu boleh dipakai boleh tidak. Keyword <code>self</code> adalah opsional.</p><p>Lalu bagaimana cara memanggil <code>my_func</code> yang berada di <em>crate root</em>, dengan pemanggilan adalah dari dalam module item? Caranya adalah menggunakan keyword <code>crate</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a225-keyword-crate-pada-module-scope">A.22.5. Keyword <code>crate</code> pada module scope<a class="hash-link" href="#a225-keyword-crate-pada-module-scope" title="Direct link to heading">​</a></h2><p>Keyword ini digunakan untuk mengakses apapun yang ada di <em>crate root</em>.</p><p>Pada contoh di atas, fungsi <code>my_func</code> yang berada di <em>crate root</em> bisa dipanggil dari fungsi <code>main</code> dengan statement <code>my_func()</code> atau <code>self::my_func()</code>. Untuk bagian ini penulis rasa sudah cukup jelas.</p><p>Beda cerita kalau fungsi tersebut dipanggil dari dalam module item <code>run_the_app</code>. Kedua statement <code>my_func()</code> dan <code>self::my_func()</code> mengarah ke <code>my_mod::my_func</code>, bukan ke fungsi <code>my_func</code> di <em>crate root</em>. Hal ini karena <strong>current module scope</strong> dalam statement <code>run_the_app</code> adalah module <code>my_mod</code>, maka pemanggilan <code>my_func</code> tanpa <code>self</code> atau dengannya mengarah ke fungsi yang sama yaitu <code>my_mod::my_func</code>.</p><p>Pada <em>section</em> ini kita akan belajar tentang keyword baru, yaitu <code>crate</code>. Keyword tersebut digunakan untuk mengakses apapun yang berada di <em>crate root</em>. Kita bisa memanfaatkannya untuk mengakses <code>my_func</code> yang berada di <em>crate root</em> dengan pengaksesan dari dalam module item.</p><p>Silakan ubah kode di atas menjadi seperti berikut. Perubahannya ada pada statement dalam fungsi <code>run_the_app</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_mod::my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_mod::run_the_app()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program, hasilnya berbeda dengan eksekusi program sebelumnya. Statement <code>crate::my_func()</code> dalam fungsi <code>run_the_app</code> mengarah ke fungsi <code>my_func</code> di root, sedangkan <code>self::my_func</code> mengarah ke <code>my_mod::my_func</code>.</p><p><img loading="lazy" alt="Module item access crate" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAecAAACICAIAAABSurQ4AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24g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m+wNCEHtZal9t7oNtcnegBDUVlPvPWVFUIe/Mroj+Uw/qOU5uHfeoWETyd6AEJqN2nvNimAcHrZ3rFN4nph1PmqTvQEhNBO1d5wVQR2e4rM7V9KSZgcC2RsQQvNRe8dZESxqZzOLhahN9gaE0ERbe6dZETy2dvfrUtQmewNCqJ3aO86KIKkdPbEG+z9xv7f7tcnegBCai9oPu82KYB4eVCpf6vLtc79QYx5qk70BITSB2jfT3WZF2Eo9Wa+NENRuRda9ZkXYSj3J3oAQ1G7G1r1mRdhKPcnegBDURgghBLURQghqI4QQgtoIIYSgNkIIQW2EEEJQGyGEENRGCKFd6P+U9Em657m7zAAAAABJRU5ErkJggg==" width="487" height="136" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a226-keyword-super">A.22.6. Keyword <code>super</code><a class="hash-link" href="#a226-keyword-super" title="Direct link to heading">​</a></h2><p>Selain <code>self</code> dan <code>crate</code> ada juga keyword <code>super</code>, yang gunanya adalah untuk mengakses <em>parent</em> module scope atau 1 scope di atas <em>current</em> module scope. Agar lebih jelas silakan pelajari kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_mod::my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">my_submod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_mod::my_submod::my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"calling `my_mod::my_submod::run_the_app()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">super</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">my_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">my_submod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">run_the_app</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ada 3 buah fungsi <code>my_func</code> dideklarasikan:</p><ul><li>Fungsi <code>my_func</code> yang berada di <em>crate root</em>.</li><li>Fungsi <code>my_func</code> yang merupakan module item milik <code>my_mod</code>.</li><li>Fungsi <code>my_func</code> yang merupakan module item milik submodule <code>my_submod</code>.</li></ul><p>Dalam fungsi <code>run_the_app</code>, ketiga fungsi dengan nama tersebut dipanggil.</p><ul><li>Statement <code>crate::my_func()</code> akan mengarah ke fungsi <code>my_func</code> yang ada di <em>crate root</em>.</li><li>Statement <code>super::my_func()</code> akan mengarah ke fungsi <code>my_func</code> yang ada di parent module scope, yaitu <code>my_mod::my_func</code>.</li><li>Statement <code>self::my_func()</code> akan mengarah ke fungsi <code>my_func</code> yang ada di current module scope, yaitu <code>my_mod::my_submod::my_func</code>.</li></ul><p><img loading="lazy" alt="Module item access super" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAecAAACYCAIAAABRbLajAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG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thBBCM+l/ifoKd1JW4mkAAAAASUVORK5CYII=" width="487" height="152" class="img_CujE"></p><p>Semoga cukup jelas ya. Silakan ulangi terus praktik di atas jika perlu, agar makin paham.</p><p>O iya, keyword <code>super</code> ini bisa digunakan banyak kali sesuai kebutuhan. Setiap kali keyword ditulis sebagai segment path, maka artinya 1 level parent module scope.</p><p>Jika mengacu ke contoh program di atas, maka kedua statement berikut adalah ekuivalen.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">super</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">super</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a227-praktik-lanjutan">A.22.7. Praktik lanjutan<a class="hash-link" href="#a227-praktik-lanjutan" title="Direct link to heading">​</a></h2><p>Agar pemahaman makin mantab, silakan pelajari program berikut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"call `my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">module_a</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path item ➜ `module_a::my_func`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"call `module_a::my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">module_b</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path item ➜ `module_b::submodule_b_one`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">submodule_b_one</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path item ➜ `module_b::submodule_b_one::my_func`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"call `module_b::submodule_b_one::my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path item ➜ `module_b::submodule_b_two`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">submodule_b_two</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path item ➜ `module_b::submodule_b_two::my_func`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"call `module_b::submodule_b_two::my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// current module scope adalah module `submodule_b_two`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// keyword `super` di sini mengarah ke parent scope, yaitu `module`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">//</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// statement `super::my_func()` berikut adalah</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ekuivalen dengan `module_b::my_func()`</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// jika diakses dari crate root.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">super</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">//</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// statement `super::submodule_b_one::my_func()` berikut adalah</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ekuivalen dengan `module_b::submodule_b_one::my_func()`</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// jika diakses dari crate root.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">super</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">submodule_b_one</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path item ➜ `module_b::my_func`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// fungsi ini tidak publik, jadi hanya bisa diakses dalam scope module `module_b` saja.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"call `module_b::my_func()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// path item ➜ `module_b::run_all_funcs`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">run_all_funcs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// semua fungsi yang didefinisikan akan di call dalam blok kode ini.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"call `my::run_all_funcs()`"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// keyword `self` merepresentasikan current module scope.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// menjadikan dua statement berikut adalah ekuivalen:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// `my_func()` adalah ekuivalen dengan `self::my_func()`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// current module scope adalah `module_b`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// keyword `super` di sini mengarah ke parent scope, yaitu root atau scope paling luar.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">//</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// statement `super::my_func()` berikut adalah</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// memanggil fungsi `my_func` yang ada di crate root,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// yang deklarasinya satu level dengan fungsi `main`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">super</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">//</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// statement `super::module_a::my_func()` berikut adalah</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// memanggil fungsi `my_func` milik module `module_a` yang ada di crate root.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">super</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">module_a</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">//</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// module `submodule_b_two` bisa diakses menggunakan self ataupun tidak</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// karena module tersebut merupakan item yang deklarasinya 1 scope dengan fungsi ini,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 1 level dengan `run_all_funcs`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">submodule_b_two</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">submodule_b_two</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">my_func</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">module_b</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">run_all_funcs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/module_scope_item_access" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../module_scope_item_access</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.self.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.self.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.super.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.super.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.crate.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.crate.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/mod.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/mod.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/meta/doc.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/meta/doc.html</a></li><li><a href="https://aloso.github.io/2021/03/28/module-system.html" target="_blank" rel="noopener noreferrer">https://aloso.github.io/2021/03/28/module-system.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/module-inline"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.21. Module System ➜ Inline Module</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/struct"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.23. Struct</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a221-scope" class="table-of-contents__link toc-highlight">A.22.1. Scope</a></li><li><a href="#a222-module-scope" class="table-of-contents__link toc-highlight">A.22.2. Module Scope</a></li><li><a href="#a223-keyword-self-dan-crate-root" class="table-of-contents__link toc-highlight">A.22.3. Keyword <code>self</code> dan <em>crate root</em></a></li><li><a href="#a224-keyword-self-pada-module-scope" class="table-of-contents__link toc-highlight">A.22.4. Keyword <code>self</code> pada module scope</a></li><li><a href="#a225-keyword-crate-pada-module-scope" class="table-of-contents__link toc-highlight">A.22.5. Keyword <code>crate</code> pada module scope</a></li><li><a href="#a226-keyword-super" class="table-of-contents__link toc-highlight">A.22.6. Keyword <code>super</code></a></li><li><a href="#a227-praktik-lanjutan" class="table-of-contents__link toc-highlight">A.22.7. Praktik lanjutan</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/operator-tanda-tanya.html b/basic/operator-tanda-tanya.html index e9e8478b..78b2575e 100644 --- a/basic/operator-tanda-tanya.html +++ b/basic/operator-tanda-tanya.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator-tanda-tanya/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator-tanda-tanya/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.41. Operator ?","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator-tanda-tanya/#webpage"},"wordCount":707,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator-tanda-tanya/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator-tanda-tanya/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/operator-tanda-tanya","name":"A.41. Operator ?","description":"Operator ? (atau question mark operator) adalah operator yang cukup berguna untuk operasi unwrap nilai dari tipe Result atau Option. Pada chapter ini kita akan belajar tentang operator tersebut.","datePublished":"2024-08-01T10:17:29.882Z","dateModified":"2024-08-01T10:17:29.882Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator-tanda-tanya/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/operator-tanda-tanya"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator-tanda-tanya/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.41. Operator ?","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator-tanda-tanya/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator-tanda-tanya/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.41. Operator ?","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator-tanda-tanya/#webpage"},"wordCount":707,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator-tanda-tanya/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator-tanda-tanya/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/operator-tanda-tanya","name":"A.41. Operator ?","description":"Operator ? (atau question mark operator) adalah operator yang cukup berguna untuk operasi unwrap nilai dari tipe Result atau Option. Pada chapter ini kita akan belajar tentang operator tersebut.","datePublished":"2024-08-30T07:44:49.960Z","dateModified":"2024-08-30T07:44:49.960Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator-tanda-tanya/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/operator-tanda-tanya"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator-tanda-tanya/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.41. Operator ?","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.41. Operator ?</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.41. Operator ?</h1></header><p>Operator <code>?</code> (atau <em>question mark operator</em>) adalah operator yang cukup berguna untuk operasi <strong>unwrap</strong> nilai dari tipe <code>Result<T, E></code> atau <code>Option<T></code>. Pada chapter ini kita akan belajar tentang operator tersebut.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a411-operator-">A.41.1. Operator ?<a class="hash-link" href="#a411-operator-" title="Direct link to heading">​</a></h2><p>Operator <code>?</code> digunakan untuk operasi <strong>unwrap</strong> value dari tipe data <code>Result<T, E></code> (dan <code>Option<T></code>).</p><p>Penggunaannya terhadap tipe data <code>Result<T, E></code> cukup umum untuk keperluan penanganan error (atau <em>error propagation</em>). Ketika suatu object dengan tipe tersebut di-unwrap menggunakan operator <code>?</code>, maka:</p><ul><li>Jika nilai object adalah bertipe <code>T</code>, maka yang dikembalikan adalah nilai <code>T</code></li><li>Jika nilai object adalah bertipe <code>E</code>, maka yang dikembalikan adalah nilai <code>E</code> atau error.</li></ul><p>Agar lebih mudah memahami kegunaan dari operator ini, pembelajaran lebih baik dimulai dengan praktik kode yang didalamnya ada penerapan tipe data <code>Result</code> (atau <code>Option</code>). Di contoh berikut, tipe data <code>Result</code> kita pilih untuk praktek.</p><p>Silakan tulis kode berikut, pelajari, kemudian jalankan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_some_math</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_some_math</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result1 </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result2 </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result3 </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">a</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"division by zero error"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">/</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Pada contoh di atas, operasi aritmatika ditempatkan dalam fungsi <code>do_some_math()</code> dan tidak langsung dalam fungsi <code>main()</code>. Ini disengaja karena berhubungan dengan contoh berikutnya. </p></blockquote><p>Fungsi <code>divider()</code> dibuat dengan kegunaan sangat spesifik, yaitu melakukan operasi aritmatika pembagian. Fungsi tersebut menghasilkan error jika ditemukan nilai pembagi adalah angka <code>0</code>.</p><p>Output program:</p><p><img loading="lazy" alt="Operator ? / tanda tanya / question mark" src="/assets/images/operator-tanda-tanya-1-24d0c7ef806198ea77f652c1267d13e9.png" width="530" height="149" class="img_ev3q"></p><ul><li>Hasil statement <code>divider(10.0, 5.0)</code> memenuhi kriteria <code>Ok(r)</code>, maka outputnya adalah <code>result: 2.00</code></li><li>Hasil statement <code>divider(10.0, 0.0)</code> memenuhi kriteria <code>Err(m)</code>, maka outputnya adalah <code>ERROR! "division by zero error"</code></li><li>Hasil statement <code>divider(10.0, 2.0)</code> memenuhi kriteria <code>Ok(r)</code>, maka outputnya adalah <code>result: 5.00</code></li></ul><p>Sampai sini penulis rasa cukup jelas. Selanjutnya kode tersebut akan di-refactor, beberapa statement disederhanakan menggunakan operator <code>?</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-refactor-ke-1">◉ Refactor ke-1<a class="hash-link" href="#-refactor-ke-1" title="Direct link to heading">​</a></h3><p>Ubah fungsi <code>do_some_math()</code> menjadi seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_some_math</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r1:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r2:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r3:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sekilas perbandingan fungsi sebelum dan setelah dimodifikasi bisa dilihat pada dua gambar berikut.</p><table><tbody><tr><td><p><img loading="lazy" alt="Operator ? / tanda tanya / question mark" src="/assets/images/operator-tanda-tanya-2-edc32921914c938294f2ee9ded7bcd17.png" width="1292" height="1402" class="img_ev3q"></p></td><td><p><img loading="lazy" alt="Operator ? / tanda tanya / question mark" src="/assets/images/operator-tanda-tanya-3-186ecf58877055d7fdef25594040d662.png" width="1032" height="916" class="img_ev3q"></p></td></tr></tbody></table><p>Implementasi operator <code>?</code> dilakukan dengan cukup menuliskannya setelah memanggil fungsi yang memiliki tipe nilai balik <code>Result<T, E></code> (atau <code>Option<T></code>) yang pada contoh ini adalah fungsi <code>divider()</code>. Operator tersebut meng-unwrap nilai balik fungsi <code>divider()</code> yang bertipe <code>Result<f64, &'static str></code> dengan ketentuan:</p><ul><li><p>Jila nilai balik <code>Result<f64, &'static str></code> berisi nilai <code>Ok(f64)</code>, maka nilai <code>f64</code> dikembalikan.</p><ul><li>Statement <code>let r1 = divider(10.0, 5.0)?;</code>, variabel <code>r1</code> berisi nilai bertipe <code>f64</code>.</li><li>Statement <code>let r3 = divider(10.0, 2.0)?;</code>, variabel <code>r3</code> berisi nilai bertipe <code>f64</code>.</li></ul></li><li><p>Jila nilai balik <code>Result<f64, &'static str></code> berisi nilai <code>Err(&'static str)</code>, maka nilai <code>&'static str</code> dikembalikan.</p><ul><li>Statement <code>let r2 = divider(10.0, 0.0)?;</code>, variabel <code>r2</code> berisi nilai bertipe <code>&'static str</code>.</li></ul></li></ul><p>Sampai sini semoga cukup jelas.</p><p>Namun tunggu, kode baru yang telah ditulis sebenarnya tidak valid. Kode penulis buat untuk mempermudah mempelajari perbedaan cara konvensional vs menggunakan operator <code>?</code>. Ada beberapa hal lagi yang harus dilakukan sebelum kode benar-benar bisa digunakan.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-refactor-ke-2">◉ Refactor ke-2<a class="hash-link" href="#-refactor-ke-2" title="Direct link to heading">​</a></h3><p>Rust mewajibkan penggunaan operator <code>?</code> pada statement untuk diterapkan di dalam fungsi yang mengembalikan nilai balik bertipe <code>Result<T, E></code> (atau <code>Option<T></code>) tergantung tipe apa yang digunakan pada kode-kode di dalam blok fungsi tersebut. Bahkan meskipun nilai tidak digunakan, aturan tersebut tetap harus dipatuhi. Syarat ini hukumnya wajib.</p><p>Kembali ke contoh kode yang telah ditulis, kode tersebut harus dimodifikasi lagi menjadi seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_some_math</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r1:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r2:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r3:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>do_some_math()</code> dimodifikasi dengan ditambahi nilai balik bertipe <code>Result<f64, &'static str></code>. Karena sebenarnya kita tidak memerlukan fungsi <code>do_some_math()</code> untuk menghasilkan nilai balik, maka penulis hardcode saja nilai baliknya dengan nilai apapun yang penting valid, misalnya <code>Ok(0.0)</code>.</p><blockquote><p>Silakan gunakan nilai lainnya seperti <code>Ok(r1)</code>, <code>Ok(r2)</code> atau lainnya, bebas karena nilai ini ditulis di kode hanya agar syarat penerapan operator <code>?</code> terpenuhi.</p><p>Boleh juga menggunakan notasi tipe lainnya seperti <code>Result<(), &'static str></code> dimana dengan tipe tersebut untuk nilai balik bisa menggunakan <code>Ok(())</code></p></blockquote><p>Perbandingan terbaru fungsi sebelum dan setelah dimodifikasi bisa dilihat di bawah ini.</p><table><tbody><tr><td><p><img loading="lazy" alt="Operator ? / tanda tanya / question mark" src="/assets/images/operator-tanda-tanya-2-edc32921914c938294f2ee9ded7bcd17.png" width="1292" height="1402" class="img_ev3q"></p></td><td><p><img loading="lazy" alt="Operator ? / tanda tanya / question mark" src="/assets/images/operator-tanda-tanya-4-162dd4d9f23151b811c1f27d7754cc69.png" width="1358" height="1024" class="img_ev3q"></p></td></tr></tbody></table><p>Sekarang coba jalankan program, dan lihat outputnya.</p><p><img loading="lazy" alt="Operator ? / tanda tanya / question mark" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAmoAAABhCAYAAABmio2VAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAk8UlEQVR4nO2de1hVVd7HvwcEUjAl5FLYhMJ4kNTCwcsQzouFlc4hLgZl2Q2c154GH21i8NIrkTZpJA6m+cQ8Uo/zTpESIXFetZGUjJdJReiK4nDzTW1CEYlLAwrn/WOfvdnnnH05Z58LG/p9nsfnkbP2Wuu3f+u39v7ttX5rLU1QUJABBEEQBEEQhOpwG24BCIIgCIIgCGHIUSMIgiAIglAp5KgRBEEQBEGoFHLUCIIgCIIgVAo5agRBEARBECqFHDWCIAiCIAiVQo4aQRAEQRCESiFHjSAIgiAIQqWQo0YQBEEQBKFSyFEjCIIgCIJQKeSoEQRBEARBqJQR6ahVNs1Hw5dhSBk3fDKsyS+HXq9H7rNjh0+Inylr8suxd3PscIsx7DjCBrVpO1C2bxPmeACawRjkFkmX596fjoJyPZfHXrRpO6DXv4+shWOQmF0EvX4nlg1jv/45Qf2IQcoGGXsnm5RjNNqSo5919jAiHTUAcL/ZC9O8NMNWf/6aeKS9WoMQXbHqnTVXd6KR0mlHipxiDwx7bTAgOgebkwPxv29twqnrDhR4lEL9SJiRIqeSF++AZyEOnZqER98Z/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EARBEIRKIUeNIAiCIAhCpZCjRhAEQRAEoVLIUSMIgiAIglAp5KgRBEEQBEGoFHLUCIIgCIIgVAo5agRBEARBECqFHDWCIAiCIAiVQo4aQRAEQRCESiFHjSAIgiAIQqWQo0YQBEEQBKFS/h+2ra3MqCJw9gAAAABJRU5ErkJggg==" width="618" height="97" class="img_ev3q"></p><p>Output yang muncul hanya nilai variabel <code>r2</code>. Statement <code>let r2 = divider(10.0, 0.0)?;</code> dan seterusnya tidak menghasilkan output apapun, hal ini karena ketika proses unwrap nilai menggunakan operator <code>?</code> menghasilkan nilai <code>E</code>, fungsi langsung terhenti eksekusinya dan nilai <code>Err(E)</code> dikembalikan. Menandai akhir pemanggilan <code>do_some_math()</code> dengan informasi error pemanggilan statement <code>let r2 = divider(10.0, 0.0)?;</code> langsung dikembalikan.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-refactor-ke-3">◉ Refactor ke-3<a class="hash-link" href="#-refactor-ke-3" title="Direct link to heading">​</a></h3><p>Sebenarnya aturan di atas (kenapa fungsi yang didalamnya ada penerapan operator <code>?</code> diwajibkan untuk mengembalikan nilai balik bertipe <code>Result<T, E></code> (atau <code>Option<T></code>)) bukan hanya sebatas syarat, tapi memang benar-benar diperlukan.</p><p>Ketika operasi menghasilkan error, eksekusi blok fungsi menjadi terhenti dan error otomatis dikembalikan sebagai nilai balik fungsi. Hal ini berguna agar kita bisa melakukan pengecekan tambahan untuk mengidentifikasi apakah eksekusi fungsi menghasilkan error atau sukses.</p><blockquote><p>Inilah bagaimana penanganan error di Rust dilakukan.</p><p>Lebih detailnya mengenai <em>error propagation</em> atau <em>error propagation</em> dibahas pada chapter <a href="/basic/recoverable-error-handling">Error ➜ Recoverable Error & Error Handling</a>.</p></blockquote><p>Coba sekarang ubah lagi kode yang sudah ditulis, kita coba cek error apa yang muncul saat pemanggilan fungsi <code>do_some_math()</code>. Ubah isi fungsi <code>main()</code> dengan menambahkan keyword <code>match</code> untuk mengecek nilai balik eksekusi fungsi <code>do_some_math()</code>. Kode setelah diubah:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_some_math</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">_</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_some_math</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r1:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r2:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r3:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">a</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"division by zero error"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">/</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Outputnya bisa dilihat di bawah ini. Pemanggilan fungsi <code>do_some_math()</code> memang menghasilkan error, yaitu saat eksekusi statement <code>let r2 = divider(10.0, 0.0)?;</code>. Informasi errornya bisa dilihat via blok <code>Err(m) => println!("ERROR! {:?}", m)</code>.</p><p><img loading="lazy" alt="Operator ? / tanda tanya / question mark" src="/assets/images/operator-tanda-tanya-6-31dccee9d16f41b3a88637a21ca2e330.png" width="534" height="118" class="img_ev3q"></p><blockquote><p>Pada kode di atas terdapat penerapan statement <code>Ok(_) => {},</code>, pembahasan mengenai statement tersebut dibahas di chapter selanjutnya, yaitu <a href="/basic/pattern-matching">Pattern Matching</a></p></blockquote><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/operator_tanda_tanya" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../operator_tanda_tanya</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/result-type">Tipe Data ➜ Result</a></li><li><a href="/basic/recoverable-error-handling">Error ➜ Recoverable Error & Error Handling</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-work-in-progress">◉ Work in progress<a class="hash-link" href="#-work-in-progress" title="Direct link to heading">​</a></h3><ul><li>Contoh menggunakan tipe <code>Option<T></code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/std/result/index.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/result/index.html</a></li><li><a href="https://doc.rust-lang.org/reference/expressions/operator-expr.html#the-question-mark-operator" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/expressions/operator-expr.html#the-question-mark-operator</a></li><li><a href="https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/result-type"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.40. Tipe Data ➜ Result</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/pattern-matching"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.42. Pattern Matching</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a411-operator-" class="table-of-contents__link toc-highlight">A.41.1. Operator ?</a><ul><li><a href="#-refactor-ke-1" class="table-of-contents__link toc-highlight">◉ Refactor ke-1</a></li><li><a href="#-refactor-ke-2" class="table-of-contents__link toc-highlight">◉ Refactor ke-2</a></li><li><a href="#-refactor-ke-3" class="table-of-contents__link toc-highlight">◉ Refactor ke-3</a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-work-in-progress" class="table-of-contents__link toc-highlight">◉ Work in progress</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.41. Operator ?</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.41. Operator ?</h1></header><p>Operator <code>?</code> (atau <em>question mark operator</em>) adalah operator yang cukup berguna untuk operasi <strong>unwrap</strong> nilai dari tipe <code>Result<T, E></code> atau <code>Option<T></code>. Pada chapter ini kita akan belajar tentang operator tersebut.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a411-operator-">A.41.1. Operator ?<a class="hash-link" href="#a411-operator-" title="Direct link to heading">​</a></h2><p>Operator <code>?</code> digunakan untuk operasi <strong>unwrap</strong> value dari tipe data <code>Result<T, E></code> (dan <code>Option<T></code>).</p><p>Penggunaannya terhadap tipe data <code>Result<T, E></code> cukup umum untuk keperluan penanganan error (atau <em>error propagation</em>). Ketika suatu object dengan tipe tersebut di-unwrap menggunakan operator <code>?</code>, maka:</p><ul><li>Jika nilai object adalah bertipe <code>T</code>, maka yang dikembalikan adalah nilai <code>T</code></li><li>Jika nilai object adalah bertipe <code>E</code>, maka yang dikembalikan adalah nilai <code>E</code> atau error.</li></ul><p>Agar lebih mudah memahami kegunaan dari operator ini, pembelajaran lebih baik dimulai dengan praktik kode yang didalamnya ada penerapan tipe data <code>Result</code> (atau <code>Option</code>). Di contoh berikut, tipe data <code>Result</code> kita pilih untuk praktek.</p><p>Silakan tulis kode berikut, pelajari, kemudian jalankan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_some_math</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_some_math</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result1 </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result2 </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result3 </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">a</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"division by zero error"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">/</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Pada contoh di atas, operasi aritmatika ditempatkan dalam fungsi <code>do_some_math()</code> dan tidak langsung dalam fungsi <code>main()</code>. Ini disengaja karena berhubungan dengan contoh berikutnya. </p></blockquote><p>Fungsi <code>divider()</code> dibuat dengan kegunaan sangat spesifik, yaitu melakukan operasi aritmatika pembagian. Fungsi tersebut menghasilkan error jika ditemukan nilai pembagi adalah angka <code>0</code>.</p><p>Output program:</p><p><img loading="eager" fetchpriority="high" alt="Operator ? / tanda tanya / question mark" src="/assets/images/operator-tanda-tanya-1-24d0c7ef806198ea77f652c1267d13e9.png" width="530" height="149" class="img_CujE"></p><ul><li>Hasil statement <code>divider(10.0, 5.0)</code> memenuhi kriteria <code>Ok(r)</code>, maka outputnya adalah <code>result: 2.00</code></li><li>Hasil statement <code>divider(10.0, 0.0)</code> memenuhi kriteria <code>Err(m)</code>, maka outputnya adalah <code>ERROR! "division by zero error"</code></li><li>Hasil statement <code>divider(10.0, 2.0)</code> memenuhi kriteria <code>Ok(r)</code>, maka outputnya adalah <code>result: 5.00</code></li></ul><p>Sampai sini penulis rasa cukup jelas. Selanjutnya kode tersebut akan di-refactor, beberapa statement disederhanakan menggunakan operator <code>?</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-refactor-ke-1">◉ Refactor ke-1<a class="hash-link" href="#-refactor-ke-1" title="Direct link to heading">​</a></h3><p>Ubah fungsi <code>do_some_math()</code> menjadi seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_some_math</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r1:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r2:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r3:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sekilas perbandingan fungsi sebelum dan setelah dimodifikasi bisa dilihat pada dua gambar berikut.</p><table><tbody><tr><td><p><img loading="lazy" alt="Operator ? / tanda tanya / question mark" src="/assets/images/operator-tanda-tanya-2-edc32921914c938294f2ee9ded7bcd17.png" width="1292" height="1402" class="img_CujE"></p></td><td><p><img loading="lazy" alt="Operator ? / tanda tanya / question mark" src="/assets/images/operator-tanda-tanya-3-186ecf58877055d7fdef25594040d662.png" width="1032" height="916" class="img_CujE"></p></td></tr></tbody></table><p>Implementasi operator <code>?</code> dilakukan dengan cukup menuliskannya setelah memanggil fungsi yang memiliki tipe nilai balik <code>Result<T, E></code> (atau <code>Option<T></code>) yang pada contoh ini adalah fungsi <code>divider()</code>. Operator tersebut meng-unwrap nilai balik fungsi <code>divider()</code> yang bertipe <code>Result<f64, &'static str></code> dengan ketentuan:</p><ul><li><p>Jila nilai balik <code>Result<f64, &'static str></code> berisi nilai <code>Ok(f64)</code>, maka nilai <code>f64</code> dikembalikan.</p><ul><li>Statement <code>let r1 = divider(10.0, 5.0)?;</code>, variabel <code>r1</code> berisi nilai bertipe <code>f64</code>.</li><li>Statement <code>let r3 = divider(10.0, 2.0)?;</code>, variabel <code>r3</code> berisi nilai bertipe <code>f64</code>.</li></ul></li><li><p>Jila nilai balik <code>Result<f64, &'static str></code> berisi nilai <code>Err(&'static str)</code>, maka nilai <code>&'static str</code> dikembalikan.</p><ul><li>Statement <code>let r2 = divider(10.0, 0.0)?;</code>, variabel <code>r2</code> berisi nilai bertipe <code>&'static str</code>.</li></ul></li></ul><p>Sampai sini semoga cukup jelas.</p><p>Namun tunggu, kode baru yang telah ditulis sebenarnya tidak valid. Kode penulis buat untuk mempermudah mempelajari perbedaan cara konvensional vs menggunakan operator <code>?</code>. Ada beberapa hal lagi yang harus dilakukan sebelum kode benar-benar bisa digunakan.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-refactor-ke-2">◉ Refactor ke-2<a class="hash-link" href="#-refactor-ke-2" title="Direct link to heading">​</a></h3><p>Rust mewajibkan penggunaan operator <code>?</code> pada statement untuk diterapkan di dalam fungsi yang mengembalikan nilai balik bertipe <code>Result<T, E></code> (atau <code>Option<T></code>) tergantung tipe apa yang digunakan pada kode-kode di dalam blok fungsi tersebut. Bahkan meskipun nilai tidak digunakan, aturan tersebut tetap harus dipatuhi. Syarat ini hukumnya wajib.</p><p>Kembali ke contoh kode yang telah ditulis, kode tersebut harus dimodifikasi lagi menjadi seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_some_math</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r1:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r2:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r3:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>do_some_math()</code> dimodifikasi dengan ditambahi nilai balik bertipe <code>Result<f64, &'static str></code>. Karena sebenarnya kita tidak memerlukan fungsi <code>do_some_math()</code> untuk menghasilkan nilai balik, maka penulis hardcode saja nilai baliknya dengan nilai apapun yang penting valid, misalnya <code>Ok(0.0)</code>.</p><blockquote><p>Silakan gunakan nilai lainnya seperti <code>Ok(r1)</code>, <code>Ok(r2)</code> atau lainnya, bebas karena nilai ini ditulis di kode hanya agar syarat penerapan operator <code>?</code> terpenuhi.</p><p>Boleh juga menggunakan notasi tipe lainnya seperti <code>Result<(), &'static str></code> dimana dengan tipe tersebut untuk nilai balik bisa menggunakan <code>Ok(())</code></p></blockquote><p>Perbandingan terbaru fungsi sebelum dan setelah dimodifikasi bisa dilihat di bawah ini.</p><table><tbody><tr><td><p><img loading="lazy" alt="Operator ? / tanda tanya / question mark" src="/assets/images/operator-tanda-tanya-2-edc32921914c938294f2ee9ded7bcd17.png" width="1292" height="1402" class="img_CujE"></p></td><td><p><img loading="lazy" alt="Operator ? / tanda tanya / question mark" src="/assets/images/operator-tanda-tanya-4-162dd4d9f23151b811c1f27d7754cc69.png" width="1358" height="1024" class="img_CujE"></p></td></tr></tbody></table><p>Sekarang coba jalankan program, dan lihat outputnya.</p><p><img loading="lazy" alt="Operator ? / tanda tanya / question mark" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAmoAAABhCAYAAABmio2VAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAk8UlEQVR4nO2de1hVVd7HvwcEUjAl5FLYhMJ4kNTCwcsQzouFlc4hLgZl2Q2c154GH21i8NIrkTZpJA6m+cQ8Uo/zTpESIXFetZGUjJdJReiK4nDzTW1CEYlLAwrn/WOfvdnnnH05Z58LG/p9nsfnkbP2Wuu3f+u39v7ttX5rLU1QUJABBEEQBEEQhOpwG24BCIIgCIIgCGHIUSMIgiAIglAp5KgRBEEQBEGoFHLUCIIgCIIgVAo5agRBEARBECqFHDWCIAiCIAiVQo4aQRAEQRCESiFHjSAIgiAIQqWQo0YQBEEQBKFSyFEjCIIgCIJQKeSoEQRBEARBqJQR6ahVNs1Hw5dhSBk3fDKsyS+HXq9H7rNjh0+Inylr8suxd3PscIsx7DjCBrVpO1C2bxPmeACawRjkFkmX596fjoJyPZfHXrRpO6DXv4+shWOQmF0EvX4nlg1jv/45Qf2IQcoGGXsnm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+Jhf6VePi5by3ymeeVWmlq66pP9vpgsxUOAz21eGU5MwXKyurF+01IDv7UrlQaQRAEQRAEH7scNYIgCIIgCMJ50Ia3BEEQBEEQKoUcNYIgCIIgCJVCjhpBEARBEIRKIUeNIAiCIAhCpZCjRhAEQRAEoVLIUSMIgiAIglAp5KgRBEEQBEGoFHLUCIIgCIIgVAo5agRBEARBECqFHDWCIAiCIAiVQo4aQRAEQRCESiFHjSAIgiAIQqWQo0YQBEEQBKFS/h+2ra3MqCJw9gAAAABJRU5ErkJggg==" width="618" height="97" class="img_CujE"></p><p>Output yang muncul hanya nilai variabel <code>r2</code>. Statement <code>let r2 = divider(10.0, 0.0)?;</code> dan seterusnya tidak menghasilkan output apapun, hal ini karena ketika proses unwrap nilai menggunakan operator <code>?</code> menghasilkan nilai <code>E</code>, fungsi langsung terhenti eksekusinya dan nilai <code>Err(E)</code> dikembalikan. Menandai akhir pemanggilan <code>do_some_math()</code> dengan informasi error pemanggilan statement <code>let r2 = divider(10.0, 0.0)?;</code> langsung dikembalikan.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-refactor-ke-3">◉ Refactor ke-3<a class="hash-link" href="#-refactor-ke-3" title="Direct link to heading">​</a></h3><p>Sebenarnya aturan di atas (kenapa fungsi yang didalamnya ada penerapan operator <code>?</code> diwajibkan untuk mengembalikan nilai balik bertipe <code>Result<T, E></code> (atau <code>Option<T></code>)) bukan hanya sebatas syarat, tapi memang benar-benar diperlukan.</p><p>Ketika operasi menghasilkan error, eksekusi blok fungsi menjadi terhenti dan error otomatis dikembalikan sebagai nilai balik fungsi. Hal ini berguna agar kita bisa melakukan pengecekan tambahan untuk mengidentifikasi apakah eksekusi fungsi menghasilkan error atau sukses.</p><blockquote><p>Inilah bagaimana penanganan error di Rust dilakukan.</p><p>Lebih detailnya mengenai <em>error propagation</em> atau <em>error propagation</em> dibahas pada chapter <a href="/basic/recoverable-error-handling">Error ➜ Recoverable Error & Error Handling</a>.</p></blockquote><p>Coba sekarang ubah lagi kode yang sudah ditulis, kita coba cek error apa yang muncul saat pemanggilan fungsi <code>do_some_math()</code>. Ubah isi fungsi <code>main()</code> dengan menambahkan keyword <code>match</code> untuk mengecek nilai balik eksekusi fungsi <code>do_some_math()</code>. Kode setelah diubah:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_some_math</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">_</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_some_math</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r1:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r2:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r3:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">a</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"division by zero error"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">/</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Outputnya bisa dilihat di bawah ini. Pemanggilan fungsi <code>do_some_math()</code> memang menghasilkan error, yaitu saat eksekusi statement <code>let r2 = divider(10.0, 0.0)?;</code>. Informasi errornya bisa dilihat via blok <code>Err(m) => println!("ERROR! {:?}", m)</code>.</p><p><img loading="lazy" alt="Operator ? / tanda tanya / question mark" src="/assets/images/operator-tanda-tanya-6-31dccee9d16f41b3a88637a21ca2e330.png" width="534" height="118" class="img_CujE"></p><blockquote><p>Pada kode di atas terdapat penerapan statement <code>Ok(_) => {},</code>, pembahasan mengenai statement tersebut dibahas di chapter selanjutnya, yaitu <a href="/basic/pattern-matching">Pattern Matching</a></p></blockquote><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/operator_tanda_tanya" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../operator_tanda_tanya</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/result-type">Tipe Data ➜ Result</a></li><li><a href="/basic/recoverable-error-handling">Error ➜ Recoverable Error & Error Handling</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-work-in-progress">◉ Work in progress<a class="hash-link" href="#-work-in-progress" title="Direct link to heading">​</a></h3><ul><li>Contoh menggunakan tipe <code>Option<T></code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/std/result/index.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/result/index.html</a></li><li><a href="https://doc.rust-lang.org/reference/expressions/operator-expr.html#the-question-mark-operator" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/expressions/operator-expr.html#the-question-mark-operator</a></li><li><a href="https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/result-type"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.40. Tipe Data ➜ Result</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/pattern-matching"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.42. Pattern Matching</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a411-operator-" class="table-of-contents__link toc-highlight">A.41.1. Operator ?</a><ul><li><a href="#-refactor-ke-1" class="table-of-contents__link toc-highlight">◉ Refactor ke-1</a></li><li><a href="#-refactor-ke-2" class="table-of-contents__link toc-highlight">◉ Refactor ke-2</a></li><li><a href="#-refactor-ke-3" class="table-of-contents__link toc-highlight">◉ Refactor ke-3</a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-work-in-progress" class="table-of-contents__link toc-highlight">◉ Work in progress</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/operator.html b/basic/operator.html index 8b82090e..7027ddc9 100644 --- a/basic/operator.html +++ b/basic/operator.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.8. Operator","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator/#webpage"},"wordCount":302,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/operator","name":"A.8. Operator","description":"Chapter ini membahas mengenai operator pada pemrograman rust.","datePublished":"2024-08-01T10:17:29.518Z","dateModified":"2024-08-01T10:17:29.518Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/operator"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.8. Operator","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.8. Operator","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator/#webpage"},"wordCount":302,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/operator","name":"A.8. Operator","description":"Chapter ini membahas mengenai operator pada pemrograman rust.","datePublished":"2024-08-30T07:44:49.591Z","dateModified":"2024-08-30T07:44:49.591Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/operator"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/operator/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.8. Operator","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.8. Operator</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.8. Operator</h1></header><p>Chapter ini membahas mengenai operator pada pemrograman rust.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a81-operator-aritmatika">A.8.1. Operator aritmatika<a class="hash-link" href="#a81-operator-aritmatika" title="Direct link to heading">​</a></h2><p>Berikut merupakan list operator untuk operasi aritmatika beserta contoh penerapannya di rust.</p><table><thead><tr><th align="center">Simbol</th><th>Kegunaan</th></tr></thead><tbody><tr><td align="center"><code>+</code></td><td>penambahan</td></tr><tr><td align="center"><code>-</code></td><td>pengurangan</td></tr><tr><td align="center"><code>*</code></td><td>pengalian</td></tr><tr><td align="center"><code>/</code></td><td>pembagian</td></tr><tr><td align="center"><code>%</code></td><td><em>modulus</em> atau sisa hasil bagi</td></tr></tbody></table><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">num1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value_addition </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> num1 </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} + {} = {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value_addition</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => 12 + 4 = 16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value_sub </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> num1 </span><span class="token operator" style="color:#393A34">-</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} - {} = {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value_sub</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => 12 - 4 = 8</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value_mut </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> num1 </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} * {} = {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value_mut</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => 12 * 4 = 48</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value_div </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> num1 </span><span class="token operator" style="color:#393A34">/</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} / {} = {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value_div</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => 12 / 4 = 3</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value_mod </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> num1 </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} % {} = {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value_mod</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => 12 % 4 = 0</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a82-operator-perbandingan">A.8.2. Operator perbandingan<a class="hash-link" href="#a82-operator-perbandingan" title="Direct link to heading">​</a></h2><p>Operator perbandingan selalu menghasilkan nilai bertipe data <code>bool</code>.</p><p>Berikut merupakan list operator untuk operasi perbandingan beserta contoh penerapannya di rust.</p><table><thead><tr><th align="center">Simbol</th><th>Kegunaan untuk mengecek</th></tr></thead><tbody><tr><td align="center"><code>==</code></td><td>apakah kiri sama dengan kanan?</td></tr><tr><td align="center"><code>!=</code></td><td>apakah kiri tidak sama dengan kanan?</td></tr><tr><td align="center"><code>></code></td><td>apakah kiri lebih besar dari kanan?</td></tr><tr><td align="center"><code><</code></td><td>apakah kiri lebih kecil dari kanan?</td></tr><tr><td align="center"><code>>=</code></td><td>apakah kiri lebih besar atau sama dengan kanan?</td></tr><tr><td align="center"><code><=</code></td><td>apakah kiri lebih kecil atau sama dengan kanan?</td></tr></tbody></table><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> number_b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"res_one: {res_one}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34">!=</span><span class="token plain"> number_b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"res_two: {res_two}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_three </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> number_b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"res_three: {res_three}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_four </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> number_b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"res_four: {res_four}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_five </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34">>=</span><span class="token plain"> number_b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"res_five: {res_five}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_six </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34"><=</span><span class="token plain"> number_b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"res_six: {res_six}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, variabel di print menggunakan macro <code>println</code> tanpa disisipkan paramnya. Penjelasannya ada di bawah ini.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-named-argument-macro-println">◉ <em>Named argument</em> macro <code>println</code><a class="hash-link" href="#-named-argument-macro-println" title="Direct link to heading">​</a></h3><p>Salah satu teknik <em>formatted print</em> macro <code>println</code> adalah dengan menerapkan <em>named argument</em>. Yang biasanya menggunakan <code>{}</code> atau <code>{1}</code>, <code>{2}</code>, dan seterusnya, diganti dengan nama variabel yang diapit tanda kurung kurawal, contohnya <code>res_one</code>. Dengan teknik ini maka jika variabel <code>res_one</code> ada, akan langsung mereplace argument <code>{res_one}</code> tanpa perlu menyisipkan variabel tersebut saat pemanggilan macro <code>println</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> number_b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"res_one: {res_one}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => res_one: false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34">!=</span><span class="token plain"> number_b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"res_two: {res_two}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => res_one: true</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a83-operator-negasi">A.8.3. Operator negasi<a class="hash-link" href="#a83-operator-negasi" title="Direct link to heading">​</a></h2><p>Berikut merupakan list operator untuk operasi negasi beserta contoh penerapannya di rust.</p><table><thead><tr><th align="center">Simbol</th><th>Kegunaan</th><th>Catatan</th></tr></thead><tbody><tr><td align="center"><code>-</code></td><td>negasi numerik</td><td>bisa digunakan pada tipe data integer dan float</td></tr><tr><td align="center"><code>!</code></td><td>logika <code>NOT</code> atau bitwise <code>NOT</code></td><td>bisa digunakan pada tipe data integer dan bool</td></tr></tbody></table><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">value_left</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value_right</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">-</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">-</span><span class="token plain">value_left </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> value_right</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">value_left </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> value_right</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{res_one} {res_two}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => true true</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Untuk menggunakan operator negasi pada tipe data numerik, caranya dengan langsung menambahkan prefix <code>-</code> pada angka atau variabel. Contohnya <code>-12</code> atau <code>-value_left</code>.</p><p>Penggunaan operator logika <code>!</code> juga sama, tinggal tambahkan saja sebagai prefix dari data <code>bool</code> atau statement yang menghasilkan data <code>bool</code>, contohnya <code>!(value_left == value_right)</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a84-operator-logika--bool">A.8.4. Operator logika / <code>bool</code><a class="hash-link" href="#a84-operator-logika--bool" title="Direct link to heading">​</a></h2><p>Berikut merupakan list operator untuk operasi logika <code>bool</code> beserta contoh penerapannya di rust.</p><table><thead><tr><th align="center">Simbol</th><th>Kegunaan</th></tr></thead><tbody><tr><td align="center"><code>&&</code></td><td>logika <code>AND</code></td></tr><tr><td align="center">|<!-- -->|</td><td>logika <code>OR</code></td></tr><tr><td align="center"><code>!</code></td><td>logika <code>NOT</code></td></tr></tbody></table><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">bool_left</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> bool_right</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"AND result \t: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> bool_left </span><span class="token operator" style="color:#393A34">&&</span><span class="token plain"> bool_right</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"OR result \t: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> bool_left </span><span class="token operator" style="color:#393A34">||</span><span class="token plain"> bool_right</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-whitespace-character-tab-t">◉ <em>Whitespace character</em> tab <code>\t</code><a class="hash-link" href="#-whitespace-character-tab-t" title="Direct link to heading">​</a></h3><p>Rust mendukung karakter standar whitespace seperti <code>\t</code> yang kegunaannya adalah untuk horizontal tab. Contoh penerapannya seperti pada kode di atas, tulis saja <code>\t</code> dalam string literal, hasilnya bisa dilihat saat di-print.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"AND result \t: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> bool_left </span><span class="token operator" style="color:#393A34">&&</span><span class="token plain"> bool_right</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"OR result \t: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> bool_left </span><span class="token operator" style="color:#393A34">||</span><span class="token plain"> bool_right</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="operator boolean" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAX0AAABkCAIAAADltXfhAAAACXBIWXMAAA7EAAAOx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+StFXdJh2YmZMJCyoruH2M9Snku0M2c3yf4AsAbvAAAAgHcAAADvAAAAgHcAAADvAAAAgHcAAADvzALo7FDQTXDT+TjYDdgV78TvcSTv7OzuvPJdvZcsN1n30p+baDcA2IZ36FmEE3kRlh68StKAd/YR7NQd4wTvAHvinX7gjM55tudBowOflgMH0NmZEL9Uvq8s8E6wc3Y35x3W/kp7AcBsvJO7Iz0ASkS/ygEFdHZW4B2GZ4l+CNUVKNrNcm4OZ7iARXgndyxWSNl6Dgs6O/uYZ1nsJtgfujzAPuId46AHnZ1teSc1tfG8fmJ/6PIAK63vRGsuw3oPnWcNI+MY3oHOziq8k6zHGe3G2R+6PMAKvBOv3fh1gcSP8/UCI++coLMz6/qOzDthZ73XRTLzjmR/AFiKd4KbxsF5On4aQh7o7GzIO32M4635XrCbZn/o8gAr8A4AAAB4BwAA8A4AAAB4BwAA8A4AAAB4BwAA8A4AAOAdAAAA8A4AAOAdAACAKfgPih3v0dH3yZcAAAAASUVORK5CYII=" width="381" height="100" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a85-operator-reference-dan-dereference">A.8.5. Operator reference dan dereference<a class="hash-link" href="#a85-operator-reference-dan-dereference" title="Direct link to heading">​</a></h2><p>Untuk jenis operasi ini ada 3 buah operator yang bisa dipergunakan yaitu <code>*</code>, <code>&</code> dan <code>&mut</code>. Untuk sekarang kita tidak akan membahas topik ini karena masih terlalu awal. Nantinya kita akan kupas tuntas di chapter <a href="/basic/pointer-references">Pointer & References</a>. Sementara kita pelajari chapter per chapter secara berurutan dulu.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a86-operator-bitwise">A.8.6. Operator bitwise<a class="hash-link" href="#a86-operator-bitwise" title="Direct link to heading">​</a></h2><p>Rust mendukung operator bitwise standar yang ada di bahasa pemrograman.</p><table><thead><tr><th align="center">Simbol</th><th>Kegunaan</th></tr></thead><tbody><tr><td align="center"><code>&</code></td><td>bitwise <code>AND</code></td></tr><tr><td align="center"><code>|</code></td><td>bitwise <code>OR</code></td></tr><tr><td align="center"><code>^</code></td><td>bitwise <code>XOR</code></td></tr><tr><td align="center"><code>!</code></td><td>bitwise <code>NOT</code></td></tr><tr><td align="center"><code><<</code></td><td>left shift</td></tr><tr><td align="center"><code>>></code></td><td>right shift</td></tr></tbody></table><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a87-operator-lainnya">A.8.7. Operator lainnya<a class="hash-link" href="#a87-operator-lainnya" title="Direct link to heading">​</a></h2><p>Sebenarnya ada banyak lagi jenis operator di Rust programming, seperti type cast operator, reference/borrow operator, dll. Nantinya kita akan bahas operator tersebut satu per satu secara terpisah di chapter berbeda.</p><ul><li>Type cast operator dibahas pada chapter <a href="/basic/type-alias-casting">Type Alias & Casting</a></li><li>Reference/borrow operator dibahas pada chapter <a href="/basic/pointer-references">Pointer & References</a></li><li>Operator <code>?</code> dibahas pada chapter <a href="/basic/operator-tanda-tanya">Operator ?</a></li></ul><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/operator" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../operator</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/pointer-references">Pointer & References</a></li><li><a href="#/wip/macro">Macro</a></li><li><a href="#/wip/whitespace-token">Whitespace Token</a></li><li><a href="/basic/operator-tanda-tanya">Operator ?</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/reference/expressions/operator-expr.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/expressions/operator-expr.html</a></li><li><a href="https://doc.rust-lang.org/reference/whitespace.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/whitespace.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/hello/print.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/hello/print.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/konstanta"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.7. Konstanta</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/seleksi-kondisi-if"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.9. Seleksi Kondisi ➜ if, else if, else</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a81-operator-aritmatika" class="table-of-contents__link toc-highlight">A.8.1. Operator aritmatika</a></li><li><a href="#a82-operator-perbandingan" class="table-of-contents__link toc-highlight">A.8.2. Operator perbandingan</a><ul><li><a href="#-named-argument-macro-println" class="table-of-contents__link toc-highlight">◉ <em>Named argument</em> macro <code>println</code></a></li></ul></li><li><a href="#a83-operator-negasi" class="table-of-contents__link toc-highlight">A.8.3. Operator negasi</a></li><li><a href="#a84-operator-logika--bool" class="table-of-contents__link toc-highlight">A.8.4. Operator logika / <code>bool</code></a><ul><li><a href="#-whitespace-character-tab-t" class="table-of-contents__link toc-highlight">◉ <em>Whitespace character</em> tab <code> </code></a></li></ul></li><li><a href="#a85-operator-reference-dan-dereference" class="table-of-contents__link toc-highlight">A.8.5. Operator reference dan dereference</a></li><li><a href="#a86-operator-bitwise" class="table-of-contents__link toc-highlight">A.8.6. Operator bitwise</a></li><li><a href="#a87-operator-lainnya" class="table-of-contents__link toc-highlight">A.8.7. Operator lainnya</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.8. Operator</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.8. Operator</h1></header><p>Chapter ini membahas mengenai operator pada pemrograman rust.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a81-operator-aritmatika">A.8.1. Operator aritmatika<a class="hash-link" href="#a81-operator-aritmatika" title="Direct link to heading">​</a></h2><p>Berikut merupakan list operator untuk operasi aritmatika beserta contoh penerapannya di rust.</p><table><thead><tr><th align="center">Simbol</th><th>Kegunaan</th></tr></thead><tbody><tr><td align="center"><code>+</code></td><td>penambahan</td></tr><tr><td align="center"><code>-</code></td><td>pengurangan</td></tr><tr><td align="center"><code>*</code></td><td>pengalian</td></tr><tr><td align="center"><code>/</code></td><td>pembagian</td></tr><tr><td align="center"><code>%</code></td><td><em>modulus</em> atau sisa hasil bagi</td></tr></tbody></table><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">num1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value_addition </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> num1 </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} + {} = {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value_addition</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => 12 + 4 = 16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value_sub </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> num1 </span><span class="token operator" style="color:#393A34">-</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} - {} = {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value_sub</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => 12 - 4 = 8</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value_mut </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> num1 </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} * {} = {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value_mut</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => 12 * 4 = 48</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value_div </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> num1 </span><span class="token operator" style="color:#393A34">/</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} / {} = {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value_div</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => 12 / 4 = 3</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value_mod </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> num1 </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} % {} = {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> num2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value_mod</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => 12 % 4 = 0</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a82-operator-perbandingan">A.8.2. Operator perbandingan<a class="hash-link" href="#a82-operator-perbandingan" title="Direct link to heading">​</a></h2><p>Operator perbandingan selalu menghasilkan nilai bertipe data <code>bool</code>.</p><p>Berikut merupakan list operator untuk operasi perbandingan beserta contoh penerapannya di rust.</p><table><thead><tr><th align="center">Simbol</th><th>Kegunaan untuk mengecek</th></tr></thead><tbody><tr><td align="center"><code>==</code></td><td>apakah kiri sama dengan kanan?</td></tr><tr><td align="center"><code>!=</code></td><td>apakah kiri tidak sama dengan kanan?</td></tr><tr><td align="center"><code>></code></td><td>apakah kiri lebih besar dari kanan?</td></tr><tr><td align="center"><code><</code></td><td>apakah kiri lebih kecil dari kanan?</td></tr><tr><td align="center"><code>>=</code></td><td>apakah kiri lebih besar atau sama dengan kanan?</td></tr><tr><td align="center"><code><=</code></td><td>apakah kiri lebih kecil atau sama dengan kanan?</td></tr></tbody></table><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> number_b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"res_one: {res_one}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34">!=</span><span class="token plain"> number_b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"res_two: {res_two}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_three </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> number_b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"res_three: {res_three}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_four </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> number_b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"res_four: {res_four}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_five </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34">>=</span><span class="token plain"> number_b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"res_five: {res_five}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_six </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34"><=</span><span class="token plain"> number_b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"res_six: {res_six}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, variabel di print menggunakan macro <code>println</code> tanpa disisipkan paramnya. Penjelasannya ada di bawah ini.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-named-argument-macro-println">◉ <em>Named argument</em> macro <code>println</code><a class="hash-link" href="#-named-argument-macro-println" title="Direct link to heading">​</a></h3><p>Salah satu teknik <em>formatted print</em> macro <code>println</code> adalah dengan menerapkan <em>named argument</em>. Yang biasanya menggunakan <code>{}</code> atau <code>{1}</code>, <code>{2}</code>, dan seterusnya, diganti dengan nama variabel yang diapit tanda kurung kurawal, contohnya <code>res_one</code>. Dengan teknik ini maka jika variabel <code>res_one</code> ada, akan langsung mereplace argument <code>{res_one}</code> tanpa perlu menyisipkan variabel tersebut saat pemanggilan macro <code>println</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> number_b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"res_one: {res_one}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => res_one: false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34">!=</span><span class="token plain"> number_b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"res_two: {res_two}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => res_one: true</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a83-operator-negasi">A.8.3. Operator negasi<a class="hash-link" href="#a83-operator-negasi" title="Direct link to heading">​</a></h2><p>Berikut merupakan list operator untuk operasi negasi beserta contoh penerapannya di rust.</p><table><thead><tr><th align="center">Simbol</th><th>Kegunaan</th><th>Catatan</th></tr></thead><tbody><tr><td align="center"><code>-</code></td><td>negasi numerik</td><td>bisa digunakan pada tipe data integer dan float</td></tr><tr><td align="center"><code>!</code></td><td>logika <code>NOT</code> atau bitwise <code>NOT</code></td><td>bisa digunakan pada tipe data integer dan bool</td></tr></tbody></table><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">value_left</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value_right</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">-</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">-</span><span class="token plain">value_left </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> value_right</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">value_left </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> value_right</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{res_one} {res_two}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => true true</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Untuk menggunakan operator negasi pada tipe data numerik, caranya dengan langsung menambahkan prefix <code>-</code> pada angka atau variabel. Contohnya <code>-12</code> atau <code>-value_left</code>.</p><p>Penggunaan operator logika <code>!</code> juga sama, tinggal tambahkan saja sebagai prefix dari data <code>bool</code> atau statement yang menghasilkan data <code>bool</code>, contohnya <code>!(value_left == value_right)</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a84-operator-logika--bool">A.8.4. Operator logika / <code>bool</code><a class="hash-link" href="#a84-operator-logika--bool" title="Direct link to heading">​</a></h2><p>Berikut merupakan list operator untuk operasi logika <code>bool</code> beserta contoh penerapannya di rust.</p><table><thead><tr><th align="center">Simbol</th><th>Kegunaan</th></tr></thead><tbody><tr><td align="center"><code>&&</code></td><td>logika <code>AND</code></td></tr><tr><td align="center">|<!-- -->|</td><td>logika <code>OR</code></td></tr><tr><td align="center"><code>!</code></td><td>logika <code>NOT</code></td></tr></tbody></table><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">bool_left</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> bool_right</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"AND result \t: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> bool_left </span><span class="token operator" style="color:#393A34">&&</span><span class="token plain"> bool_right</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"OR result \t: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> bool_left </span><span class="token operator" style="color:#393A34">||</span><span class="token plain"> bool_right</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-whitespace-character-tab-t">◉ <em>Whitespace character</em> tab <code>\t</code><a class="hash-link" href="#-whitespace-character-tab-t" title="Direct link to heading">​</a></h3><p>Rust mendukung karakter standar whitespace seperti <code>\t</code> yang kegunaannya adalah untuk horizontal tab. Contoh penerapannya seperti pada kode di atas, tulis saja <code>\t</code> dalam string literal, hasilnya bisa dilihat saat di-print.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"AND result \t: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> bool_left </span><span class="token operator" style="color:#393A34">&&</span><span class="token plain"> bool_right</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"OR result \t: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> bool_left </span><span class="token operator" style="color:#393A34">||</span><span class="token plain"> bool_right</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="operator boolean" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAX0AAABkCAIAAAD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Z1iQzPfLufd3/EA6gnfyvJiL+StFXdJh2YmZMJCyoruH2M9Snku0M2c3yf4AsAbvAAAAgHcAAADvAAAAgHcAAADvAAAAgHcAAADvzALo7FDQTXDT+TjYDdgV78TvcSTv7OzuvPJdvZcsN1n30p+baDcA2IZ36FmEE3kRlh68StKAd/YR7NQd4wTvAHvinX7gjM55tudBowOflgMH0NmZEL9Uvq8s8E6wc3Y35x3W/kp7AcBsvJO7Iz0ASkS/ygEFdHZW4B2GZ4l+CNUVKNrNcm4OZ7iARXgndyxWSNl6Dgs6O/uYZ1nsJtgfujzAPuId46AHnZ1teSc1tfG8fmJ/6PIAK63vRGsuw3oPnWcNI+MY3oHOziq8k6zHGe3G2R+6PMAKvBOv3fh1gcSP8/UCI++coLMz6/qOzDthZ73XRTLzjmR/AFiKd4KbxsF5On4aQh7o7GzIO32M4635XrCbZn/o8gAr8A4AAAB4BwAA8A4AAAB4BwAA8A4AAAB4BwAA8A4AAOAdAAAA8A4AAOAdAACAKfgPih3v0dH3yZcAAAAASUVORK5CYII=" width="381" height="100" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a85-operator-reference-dan-dereference">A.8.5. Operator reference dan dereference<a class="hash-link" href="#a85-operator-reference-dan-dereference" title="Direct link to heading">​</a></h2><p>Untuk jenis operasi ini ada 3 buah operator yang bisa dipergunakan yaitu <code>*</code>, <code>&</code> dan <code>&mut</code>. Untuk sekarang kita tidak akan membahas topik ini karena masih terlalu awal. Nantinya kita akan kupas tuntas di chapter <a href="/basic/pointer-references">Pointer & References</a>. Sementara kita pelajari chapter per chapter secara berurutan dulu.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a86-operator-bitwise">A.8.6. Operator bitwise<a class="hash-link" href="#a86-operator-bitwise" title="Direct link to heading">​</a></h2><p>Rust mendukung operator bitwise standar yang ada di bahasa pemrograman.</p><table><thead><tr><th align="center">Simbol</th><th>Kegunaan</th></tr></thead><tbody><tr><td align="center"><code>&</code></td><td>bitwise <code>AND</code></td></tr><tr><td align="center"><code>|</code></td><td>bitwise <code>OR</code></td></tr><tr><td align="center"><code>^</code></td><td>bitwise <code>XOR</code></td></tr><tr><td align="center"><code>!</code></td><td>bitwise <code>NOT</code></td></tr><tr><td align="center"><code><<</code></td><td>left shift</td></tr><tr><td align="center"><code>>></code></td><td>right shift</td></tr></tbody></table><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a87-operator-lainnya">A.8.7. Operator lainnya<a class="hash-link" href="#a87-operator-lainnya" title="Direct link to heading">​</a></h2><p>Sebenarnya ada banyak lagi jenis operator di Rust programming, seperti type cast operator, reference/borrow operator, dll. Nantinya kita akan bahas operator tersebut satu per satu secara terpisah di chapter berbeda.</p><ul><li>Type cast operator dibahas pada chapter <a href="/basic/type-alias-casting">Type Alias & Casting</a></li><li>Reference/borrow operator dibahas pada chapter <a href="/basic/pointer-references">Pointer & References</a></li><li>Operator <code>?</code> dibahas pada chapter <a href="/basic/operator-tanda-tanya">Operator ?</a></li></ul><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/operator" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../operator</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/pointer-references">Pointer & References</a></li><li><a href="#/wip/macro">Macro</a></li><li><a href="#/wip/whitespace-token">Whitespace Token</a></li><li><a href="/basic/operator-tanda-tanya">Operator ?</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/reference/expressions/operator-expr.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/expressions/operator-expr.html</a></li><li><a href="https://doc.rust-lang.org/reference/whitespace.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/whitespace.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/hello/print.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/hello/print.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/konstanta"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.7. Konstanta</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/seleksi-kondisi-if"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.9. Seleksi Kondisi ➜ if, else if, else</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a81-operator-aritmatika" class="table-of-contents__link toc-highlight">A.8.1. Operator aritmatika</a></li><li><a href="#a82-operator-perbandingan" class="table-of-contents__link toc-highlight">A.8.2. Operator perbandingan</a><ul><li><a href="#-named-argument-macro-println" class="table-of-contents__link toc-highlight">◉ <em>Named argument</em> macro <code>println</code></a></li></ul></li><li><a href="#a83-operator-negasi" class="table-of-contents__link toc-highlight">A.8.3. Operator negasi</a></li><li><a href="#a84-operator-logika--bool" class="table-of-contents__link toc-highlight">A.8.4. Operator logika / <code>bool</code></a><ul><li><a href="#-whitespace-character-tab-t" class="table-of-contents__link toc-highlight">◉ <em>Whitespace character</em> tab <code> </code></a></li></ul></li><li><a href="#a85-operator-reference-dan-dereference" class="table-of-contents__link toc-highlight">A.8.5. Operator reference dan dereference</a></li><li><a href="#a86-operator-bitwise" class="table-of-contents__link toc-highlight">A.8.6. Operator bitwise</a></li><li><a href="#a87-operator-lainnya" class="table-of-contents__link toc-highlight">A.8.7. Operator lainnya</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/option-type.html b/basic/option-type.html index 3606611e..50f9f938 100644 --- a/basic/option-type.html +++ b/basic/option-type.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/option-type/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/option-type/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.39. Tipe Data ➜ Option","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/option-type/#webpage"},"wordCount":719,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/option-type/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/option-type/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/option-type","name":"A.39. Tipe Data ➜ Option","description":"Option adalah salah satu tipe data penting pada Rust programming, digunakan untuk menampung data yang isinya bisa berpotensi kosong (None). Chapter ini membahas tentang tipe data tersebut.","datePublished":"2024-08-01T10:17:29.683Z","dateModified":"2024-08-01T10:17:29.683Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/option-type/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/option-type"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/option-type/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.39. Tipe Data ➜ Option","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/option-type/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/option-type/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.39. Tipe Data ➜ Option","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/option-type/#webpage"},"wordCount":719,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/option-type/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/option-type/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/option-type","name":"A.39. Tipe Data ➜ Option","description":"Option adalah salah satu tipe data penting pada Rust programming, digunakan untuk menampung data yang isinya bisa berpotensi kosong (None). Chapter ini membahas tentang tipe data tersebut.","datePublished":"2024-08-30T07:44:49.656Z","dateModified":"2024-08-30T07:44:49.656Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/option-type/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/option-type"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/option-type/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.39. Tipe Data ➜ Option","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.39. Tipe Data ➜ Option</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.39. Tipe Data ➜ Option</h1></header><p><code>Option</code> adalah salah satu tipe data penting pada Rust programming, digunakan untuk menampung data yang isinya bisa berpotensi kosong (<code>None</code>). Chapter ini membahas tentang tipe data tersebut.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a391-konsep-option">A.39.1. Konsep <code>Option</code><a class="hash-link" href="#a391-konsep-option" title="Direct link to heading">​</a></h2><p>Tipe data <code>Option</code> adalah enum dengan isi 2 buah enum value:</p><ul><li><code>Option::Some<T></code> (atau <code>Some<T></code>), digunakan untuk menandai bahwa data memiliki value/nilai.</li><li><code>Option::None</code> (atau <code>None</code>), digunakan untuk menandai bawah data adalah tidak ada nilainya.</li></ul><blockquote><ul><li><code>None</code> bisa disamakan dengan nilai <code>null</code> atau <code>nil</code> pada bahasa pemrograman lain.</li><li><code>T</code> merupakan parameter generic. Lebih jelasnya mengenai generic dibahas pada chapter <a href="/basic/generics">Generics</a>.</li></ul></blockquote><p>Tipe data <code>Option</code> memiliki notasi penulisan <code>Option<T></code> yang mana <code>T</code> adalah tipe data sebenarnya yang dibungkus oleh enum value <code>Some</code>.</p><p>Berikut adalah contoh cara penerapan <code>Option</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">a</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Option</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">None</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">/</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Option</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>divider</code> di atas tugasnya adalah melakukan operasi aritmatika pembagian angka numerik <code>i32</code>, parameter <code>a</code> dibagi <code>b</code>.</p><p>Pada fungsi tersebut terdapat pengecekan apabila nilai <code>b</code> adalah <code>0</code>, maka yang dikembalikan adalah <code>None</code>, selainnya maka hasil operasi pembagian dikembalikan dibungkus dalam enum value <code>Some<i32></code>. Bisa dilihat pada statement return value fungsi <code>divider</code>, nilai <code>result</code> dibungkus menggunakan tipe <code>Some</code>.</p><p>Fungsi <code>divider</code> nilai baliknya bertipe <code>Option<i32></code>. Dari tipe data yang digunakan nantinya bisa diprediksi pasti akan ada 2 potensi value:</p><ul><li>Return value adalah enum value <code>None</code>, muncul ketika nilai <code>b</code> adalah <code>0</code></li><li>Return value adalah nilai hasil numerik yang dibungkus oleh enum value <code>Some<i32></code></li></ul><p>Output program di atas saat di-run:</p><p><img loading="lazy" alt="Option type" src="data:image/png;base64,iVBORw0K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CIFRhBBCYBQhhMAoQgiBUYQQAqOb6vZsmxFC6IDRaM+XQef36C9NCCGEXi9Gn56epuTAKELoOBi9Hdvmkxvz8v5+9CZ/+NbmaF8/b8/fWmWqASHUG6M3YNt8TuvHr9ni/umntm2ODJ6XHSzbZoQQ6oHR49s2T2mdczZiVNo26yxZts0IIdRpUJ8x62C2zXNaz/+YDJu1bbPMkl0ihBDaCKMHs21e0hqmPn/+Mm2bTYwyIYoQ2g2jB7RtDtP68evpaXC/l7bNmuzVEiGEUE+M3h3Otjli47B/vlIfrCCpANmwbUYIoQsxihBCCIwihBAYRQghMIoQQmAUIYQQGEUIITCKEEJgFCGEwChCCCEwihBCYBQhhMAoQgjdsv4HaIKfmTxGkwwAAAAASUVORK5CYII=" width="450" height="127" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a392-pattern-matching-pada-tipe-option">A.39.2. Pattern matching pada tipe <code>Option</code><a class="hash-link" href="#a392-pattern-matching-pada-tipe-option" title="Direct link to heading">​</a></h2><p>Dalam penerapannya, ketika ada data bertipe <code>Option</code> artinya data tersebut berpotensi untuk berisi nilai <code>None</code> atau <code>Some<T></code>, pasti antara 2 nilai tersebut.</p><p>Umumnya penggunaan tipe <code>Option</code> selalu diikuti dengan seleksi kondisi. Keyword <code>if</code> bisa digunakan dalam seleksi kondisi, namun dalam Praktiknya lebih baik menggunakan keyword <code>match</code> karena memberikan kemudahan dalam pengaksesan nilai <code>T</code> milik <code>Some</code> (yang mana <code>T</code> adalah data yang kita cari dibungkus dalam enum value <code>Some</code>).</p><p>Mari kita praktikkan. Ubah isi fungsi <code>main</code> dengan kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result1 </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"cannot divide by 0"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {x}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result2 </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"cannot divide by 0"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Option type" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb4AAAB8CAIAAACZuEK1AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIi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QgiBToQQAp0IIQQ6EUIIdCKEEOhECCEEOhFC6C2iM37stHu60/VEZyll+0tN9ferEEKgcx8Ovil0YtSMEOi8GDovVYyl6Axs8jB+Quhm0Bm85RhaIsWbep/2MelodZxvFDkWrY6LMdrvwC1UHCQ2x0veA40OIfJ0B4M9OuNqGkc39p5oabzIjxC6LnSqMOjzj5+hhWdAv4lj5Y0RmwakOMO9kELJLnH4F+Gq7Nsk85SOzjbKA5+T017R0Uv2y2EdQmdphNDVorMeA30OTD0yTqmNCUWCJC50ZnS00Rn+DD5elKfUeWpHZ1eZ0soXaxZ9w6RvIMJOhK4bnUa0lEywW9Fp0G51dE6/U3I60Gk7OlfKFB50nLwX4sgk0uR2PUK3EXVm53H+0Y0FUWd8i2RldA4bMnI60elEmFWmqcYud9OmZQuE0IHRKW2NkzXAxqgzIm+EDd8dkuno0RKjQfoOmt9//Cp+cE7n6f9aR/pxz6lIJw7++lWpVGjTzF0ihG4CncnsPL2d/fvnj9aoM5ijlm5z12e4pzRDOFmwT06cko2UIs8747Z7uYWSZM6HjaYc4CZCN4JOtEBMvxECnagdnNzyQQh0ohZoMv1GCHQihBACnQghBDoRQgh0IoQQ6EQIIdCJEEKgEyGEEOhECCHQiRBCoBMhhEAnQgi9Of0fmQb7AJMnfVgAAAAASUVORK5CYII=" width="446" height="124" class="img_ev3q"></p><p>Bisa dilihat cara mengambil nilai <code>T</code> dari enum value <code>Some<T></code> cukup mudah dengan menggunakan keyword <code>match</code>. Penerapan <code>match</code> untuk seleksi kondisi biasa disebut dengan <strong>pattern matching</strong> dan teknik ini sangat fleksibel dan advance.</p><p>Sebagai contoh, dengan penerapan match yang seperti ini kita bisa meng-handle 3 skenario seleksi kondisi:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result1 </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"cannot divide by 0"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the result is 2"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {x}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Kondisi ke-1: jika nilai adalah <code>None</code>, maka munculkan pesan <code>cannot divide by 0</code></li><li>Kondisi ke-2: jika nilai adalah <code>2</code>, maka munculkan pesan <code>the result is 2</code></li><li>Kondisi ke-1: jika nilai adalah <code>Some</code> selain dari <code>None</code> dan <code>Some(2)</code>, maka munculkan pesan <code>result: {x}</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-tips-pattern-matching">◉ Tips pattern matching<a class="hash-link" href="#-tips-pattern-matching" title="Direct link to heading">​</a></h3><p>Silakan perhatikan kode yang sudah kita praktikkan berikut ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"cannot divide by 0"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {x}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Penerapan pattern matching seperti contoh di atas memiliki konsekuensi, yaitu variabel <code>x</code> hanya bisa diakses pada block <code>Some(x)</code> saja.</p><p>Adakalanya kita butuh untuk mengeluarkan variabel <code>x</code> ke luar block. Hal seperti ini mudah untuk dilakukan, dan ada beberapa cara yang bisa dipilih, namun menurut penulis yang paling elegan adalah cara berikut ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"cannot divide by 0"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Statement <code>divider(10, 5)</code> mengembalikan data bertipe <code>Option<i32></code>. Data tersebut digunakan pada keyword <code>match</code> seperti biasa. Namun pada contoh di atas ada yang berbeda, yaitu return value dari statement <code>match</code> ditampung ke variabel (<code>result</code>).</p><p>Isi dari pattern matching <code>match</code> sendiri ada dua:</p><ul><li>Ketika block <code>None</code> match, pesan error di-print kemudian nilai <code>0</code> dijadikan return statement <code>match</code>.</li><li>Ketika block <code>Some</code> match, data <code>x</code> dijadikan return value statement <code>match</code>.</li></ul><p>Dengan penerapan pattern matching seperti di atas, maka variabel <code>result</code> akan selalu berisi data hasil operasi <code>divider(10, 5)</code>. Dengan pengecualian ketika ada error, pesan errornya dimunculkan kemudian hasil operasi pembagian di-set sebagai <code>0</code>.</p><blockquote><p>Lebih jelasnya mengenai pattern matching dibahas pada chapter <a href="/basic/pattern-matching">Pattern Matching</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a393-method-tipe-data-option">A.39.3. Method tipe data <code>Option</code><a class="hash-link" href="#a393-method-tipe-data-option" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-unwrap">◉ Method <code>unwrap</code><a class="hash-link" href="#-method-unwrap" title="Direct link to heading">​</a></h3><p>Isi dari enum value <code>Some<T></code> bisa diakses tanpa menggunakan keyword <code>match</code> dengan cara memanfaatkan method <code>unwrap</code> milik <code>Option<T></code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> result1 </span><span class="token operator" style="color:#393A34">!=</span><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Penggunaan method tersebut sangat dianjurkan diiringi dengan seleksi kondisi untuk memastikan data <code>Option</code> tidak berisi <code>None</code>. Jika data ternyata adalah <code>None</code> dan method <code>unwrap</code> diakses, hasilnya adalah panic error. Contohnya bisa dilihat pada gambar berikut:</p><p><img loading="lazy" alt="Option type" src="/assets/images/option-type-3-e2943c7c0a60b13cd69ce8461805846c.png" width="659" height="262" class="img_ev3q"></p><p>Selain method <code>unwrap</code> ada beberapa method sejenis lainnya yang bisa dimanfaatkan untuk pengambilan nilai <code>T</code>. Kita akan bahas satu per satu.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-is_some--is_none">◉ Method <code>is_some</code> & <code>is_none</code><a class="hash-link" href="#-method-is_some--is_none" title="Direct link to heading">​</a></h3><p>Method <code>is_some</code> menghasilkan nilai <code>true</code> jika data isinya adalah enum value <code>Some<T></code>. Sedangkan <code>is_none</code> bernilai <code>true</code> jika data berisi <code>None</code>.</p><p>Contoh penerapannya bisa dilihat pada program berikut. Kesemua seleksi kondisi pada konteks ini menghasilkan nilai <code>true</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> result1 </span><span class="token operator" style="color:#393A34">!=</span><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> result1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">!</span><span class="token plain">result1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_none</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-unwrap_or_default">◉ Method <code>unwrap_or_default</code><a class="hash-link" href="#-method-unwrap_or_default" title="Direct link to heading">​</a></h3><p>Method <code>unwrap_or_default</code> mengembalikan nilai <code>T</code> ketika data berisi <code>Some<T></code>. Jika data ternyata isinya adalah <code>None</code>, maka nilai yang dikembalikan adalah <em>default value</em> dari tipe data <code>T</code>.</p><p>Sebagai contoh, pada kode berikut statement <code>divider(10, 0)</code> return type-nya adalah <code>Option<i32></code>, sedangkan return value-nya adalah <code>None</code>. Pengaksesan method <code>unwrap_or_default</code> menghasilkan <em>default value</em> dari tipe data <code>i32</code>, yaitu <code>0</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or_default</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// result: 0</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-unwrap_or">◉ Method <code>unwrap_or</code><a class="hash-link" href="#-method-unwrap_or" title="Direct link to heading">​</a></h3><p>Method ini mengembalikan nilai <code>T</code> ketika data berisi <code>Some<T></code>, namun jika data ternyata isinya adalah <code>None</code>, maka nilai yang dikembalikan adalah argument pemanggilan method tersebut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// result: 0</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas argument pemanggilan method <code>unwrap_or</code> adalah angka <code>0</code>, artinya ketika <code>result2</code> isinya adalah <code>None</code> maka angka <code>0</code> adalah return value pengaksesan method <code>unwrap_or</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-unwrap_or_else">◉ Method <code>unwrap_or_else</code><a class="hash-link" href="#-method-unwrap_or_else" title="Direct link to heading">​</a></h3><p>Method ini mengembalikan nilai <code>T</code> ketika data berisi <code>Some<T></code>, namun jika data isinya adalah <code>None</code>, maka nilai yang dikembalikan adalah hasil eksekusi closure yang disisipkan saat memanggil method <code>unwrap_or_else</code>. Contoh pengaplikasiannya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or_else</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// result: 0</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Closure harus dalam notasi <code>FnOnce() -> T</code> yang mana <code>T</code> pada konteks ini adalah <code>i32</code>.</p><blockquote><p>Closure <code>|| 0</code> adalah kependekan dari <code>|| -> i32 { 0 }</code>.</p><p>Lebih jelasnya mengenai closure dibahas pada chapter <a href="/basic/closures">Closures</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a384-operator--pada-tipe-option">A.38.4. Operator <code>?</code> pada tipe <code>Option</code><a class="hash-link" href="#a384-operator--pada-tipe-option" title="Direct link to heading">​</a></h2><p>Tipe data <code>Option</code> bisa digunakan pada operator <code>?</code>. Penjelasannya ada di chapter terpisah di <a href="/basic/operator-tanda-tanya">Operator ?</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/option_type" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../option_type</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/generics">Generics</a></li><li><a href="/basic/pattern-matching">Pattern Matching</a></li><li><a href="/basic/closures">Closures</a></li><li><a href="/basic/operator-tanda-tanya">Operator ?</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html</a></li><li><a href="https://doc.rust-lang.org/std/option/index.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/option/index.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/generics"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.38. Generics</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/result-type"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.40. Tipe Data ➜ Result</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a391-konsep-option" class="table-of-contents__link toc-highlight">A.39.1. Konsep <code>Option</code></a></li><li><a href="#a392-pattern-matching-pada-tipe-option" class="table-of-contents__link toc-highlight">A.39.2. Pattern matching pada tipe <code>Option</code></a><ul><li><a href="#-tips-pattern-matching" class="table-of-contents__link toc-highlight">◉ Tips pattern matching</a></li></ul></li><li><a href="#a393-method-tipe-data-option" class="table-of-contents__link toc-highlight">A.39.3. Method tipe data <code>Option</code></a><ul><li><a href="#-method-unwrap" class="table-of-contents__link toc-highlight">◉ Method <code>unwrap</code></a></li><li><a href="#-method-is_some--is_none" class="table-of-contents__link toc-highlight">◉ Method <code>is_some</code> & <code>is_none</code></a></li><li><a href="#-method-unwrap_or_default" class="table-of-contents__link toc-highlight">◉ Method <code>unwrap_or_default</code></a></li><li><a href="#-method-unwrap_or" class="table-of-contents__link toc-highlight">◉ Method <code>unwrap_or</code></a></li><li><a href="#-method-unwrap_or_else" class="table-of-contents__link toc-highlight">◉ Method <code>unwrap_or_else</code></a></li></ul></li><li><a href="#a384-operator--pada-tipe-option" class="table-of-contents__link toc-highlight">A.38.4. Operator <code>?</code> pada tipe <code>Option</code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.39. Tipe Data ➜ Option</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.39. Tipe Data ➜ Option</h1></header><p><code>Option</code> adalah salah satu tipe data penting pada Rust programming, digunakan untuk menampung data yang isinya bisa berpotensi kosong (<code>None</code>). Chapter ini membahas tentang tipe data tersebut.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a391-konsep-option">A.39.1. Konsep <code>Option</code><a class="hash-link" href="#a391-konsep-option" title="Direct link to heading">​</a></h2><p>Tipe data <code>Option</code> adalah enum dengan isi 2 buah enum value:</p><ul><li><code>Option::Some<T></code> (atau <code>Some<T></code>), digunakan untuk menandai bahwa data memiliki value/nilai.</li><li><code>Option::None</code> (atau <code>None</code>), digunakan untuk menandai bawah data adalah tidak ada nilainya.</li></ul><blockquote><ul><li><code>None</code> bisa disamakan dengan nilai <code>null</code> atau <code>nil</code> pada bahasa pemrograman lain.</li><li><code>T</code> merupakan parameter generic. Lebih jelasnya mengenai generic dibahas pada chapter <a href="/basic/generics">Generics</a>.</li></ul></blockquote><p>Tipe data <code>Option</code> memiliki notasi penulisan <code>Option<T></code> yang mana <code>T</code> adalah tipe data sebenarnya yang dibungkus oleh enum value <code>Some</code>.</p><p>Berikut adalah contoh cara penerapan <code>Option</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">a</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Option</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">None</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">/</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Option</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>divider</code> di atas tugasnya adalah melakukan operasi aritmatika pembagian angka numerik <code>i32</code>, parameter <code>a</code> dibagi <code>b</code>.</p><p>Pada fungsi tersebut terdapat pengecekan apabila nilai <code>b</code> adalah <code>0</code>, maka yang dikembalikan adalah <code>None</code>, selainnya maka hasil operasi pembagian dikembalikan dibungkus dalam enum value <code>Some<i32></code>. Bisa dilihat pada statement return value fungsi <code>divider</code>, nilai <code>result</code> dibungkus menggunakan tipe <code>Some</code>.</p><p>Fungsi <code>divider</code> nilai baliknya bertipe <code>Option<i32></code>. Dari tipe data yang digunakan nantinya bisa diprediksi pasti akan ada 2 potensi value:</p><ul><li>Return value adalah enum value <code>None</code>, muncul ketika nilai <code>b</code> adalah <code>0</code></li><li>Return value adalah nilai hasil numerik yang dibungkus oleh enum value <code>Some<i32></code></li></ul><p>Output program di atas saat di-run:</p><p><img loading="eager" fetchpriority="high" alt="Option type" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAAB/CAIAAADzWVUNAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94Y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DDs+JTIkF/z/tIktUCzAzjMJRhMCoRsUMkoES6XLKRJoJVN0x2jL8DuLOlHJj5qdzhP+3SlTGYjamZ1yPEBi1B/UaV8l4ORhChzHgbhiNsrcEmg6MmiXK483wJOIvhKMIgVEnRsuomAO1a2B0GpanDBx+2hg1aZn/YWCozinRKEJg1MMFKxRLOPY5mmccI9UiRo2FIs/cqMxeOOye0taDerNEefELDCUYRQiM+sOraBi8TI3m6+zBhOWPM2OyIbRc629aqY+eGc2ODTcqjM4rZNksRT6sT870Xz5vAEURAqPIESI33HIQQmAUkDrwyFtMCIFRdEmcyTv1CIFRhBBCYBQhhMAoQgiBUYQQAqOb6vZsmxFC6IDRaM+XQef36C9NCCGEXi9Gn56epuTAKELoOBi9Hdvmkxvz8v5+9CZ/+NbmaF8/b8/fWmWqASHUG6M3YNt8TuvHr9ni/umntm2ODJ6XHSzbZoQQ6oHR49s2T2mdczZiVNo26yxZts0IIdRpUJ8x62C2zXNaz/+YDJu1bbPMkl0ihBDaCKMHs21e0hqmPn/+Mm2bTYwyIYoQ2g2jB7RtDtP68evpaXC/l7bNmuzVEiGEUE+M3h3Otjli47B/vlIfrCCpANmwbUYIoQsxihBCCIwihBAYRQghMIoQQmAUIYQQGEUIITCKEEJgFCGEwChCCCEwihBCYBQhhMAoQgjdsv4HaIKfmTxGkwwAAAAASUVORK5CYII=" width="450" height="127" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a392-pattern-matching-pada-tipe-option">A.39.2. Pattern matching pada tipe <code>Option</code><a class="hash-link" href="#a392-pattern-matching-pada-tipe-option" title="Direct link to heading">​</a></h2><p>Dalam penerapannya, ketika ada data bertipe <code>Option</code> artinya data tersebut berpotensi untuk berisi nilai <code>None</code> atau <code>Some<T></code>, pasti antara 2 nilai tersebut.</p><p>Umumnya penggunaan tipe <code>Option</code> selalu diikuti dengan seleksi kondisi. Keyword <code>if</code> bisa digunakan dalam seleksi kondisi, namun dalam Praktiknya lebih baik menggunakan keyword <code>match</code> karena memberikan kemudahan dalam pengaksesan nilai <code>T</code> milik <code>Some</code> (yang mana <code>T</code> adalah data yang kita cari dibungkus dalam enum value <code>Some</code>).</p><p>Mari kita praktikkan. Ubah isi fungsi <code>main</code> dengan kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result1 </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"cannot divide by 0"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {x}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result2 </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"cannot divide by 0"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Option type" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb4AAAB8CAIAAACZuEK1AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOn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CCIFOhBACnQghBDoRQgh07qzPP3797vXzOx2AEAKdjQCN0fn95+9fPz4v5jFARgiBTm9mw66vuSwgMEIIrYDOHmdjSDewTsZ4wcbz1giPCSvDn+GeWbYnFrZEkqf0BJ4IoQujcwTZCXBdPBfAadwmokg/OotRJ+hECF0jOkeedbTrtgVoGoDXRY4JslZBZ5uYryOEjjJhz3gYK1xmjDbsjU6Fb4QQOgo6y3gaI79d0dlxk4ATIXRMdNZju3EBdFoJPUekRXQGqVMQV0NJuIkQOjg600n7tNSZ3x8fN//68f3MymzCL+/Rt91hH5cK0jUEhBC6ADoRQgiBToQQAp0IIQQ6EUIIdCKEEOhECCEEOhFC6C2iM37stHu60/VEZyll+0tN9ferEEKgcx8Ovil0YtSMEOi8GDovVYyl6Axs8jB+Quhm0Bm85RhaIsWbep/2MelodZxvFDkWrY6LMdrvwC1UHCQ2x0veA40OIfJ0B4M9OuNqGkc39p5oabzIjxC6LnSqMOjzj5+hhWdAv4lj5Y0RmwakOMO9kELJLnH4F+Gq7Nsk85SOzjbKA5+T017R0Uv2y2EdQmdphNDVorMeA30OTD0yTqmNCUWCJC50ZnS00Rn+DD5elKfUeWpHZ1eZ0soXaxZ9w6RvIMJOhK4bnUa0lEywW9Fp0G51dE6/U3I60Gk7OlfKFB50nLwX4sgk0uR2PUK3EXVm53H+0Y0FUWd8i2RldA4bMnI60elEmFWmqcYud9OmZQuE0IHRKW2NkzXAxqgzIm+EDd8dkuno0RKjQfoOmt9//Cp+cE7n6f9aR/pxz6lIJw7++lWpVGjTzF0ihG4CncnsPL2d/fvnj9aoM5ijlm5z12e4pzRDOFmwT06cko2UIs8747Z7uYWSZM6HjaYc4CZCN4JOtEBMvxECnagdnNzyQQh0ohZoMv1GCHQihBACnQghBDoRQgh0IoQQ6EQIIdCJEEKgEyGEEOhECCHQiRBCoBMhhEAnQgi9Of0fmQb7AJMnfVgAAAAASUVORK5CYII=" width="446" height="124" class="img_CujE"></p><p>Bisa dilihat cara mengambil nilai <code>T</code> dari enum value <code>Some<T></code> cukup mudah dengan menggunakan keyword <code>match</code>. Penerapan <code>match</code> untuk seleksi kondisi biasa disebut dengan <strong>pattern matching</strong> dan teknik ini sangat fleksibel dan advance.</p><p>Sebagai contoh, dengan penerapan match yang seperti ini kita bisa meng-handle 3 skenario seleksi kondisi:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result1 </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"cannot divide by 0"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the result is 2"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {x}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Kondisi ke-1: jika nilai adalah <code>None</code>, maka munculkan pesan <code>cannot divide by 0</code></li><li>Kondisi ke-2: jika nilai adalah <code>2</code>, maka munculkan pesan <code>the result is 2</code></li><li>Kondisi ke-1: jika nilai adalah <code>Some</code> selain dari <code>None</code> dan <code>Some(2)</code>, maka munculkan pesan <code>result: {x}</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-tips-pattern-matching">◉ Tips pattern matching<a class="hash-link" href="#-tips-pattern-matching" title="Direct link to heading">​</a></h3><p>Silakan perhatikan kode yang sudah kita praktikkan berikut ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"cannot divide by 0"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {x}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Penerapan pattern matching seperti contoh di atas memiliki konsekuensi, yaitu variabel <code>x</code> hanya bisa diakses pada block <code>Some(x)</code> saja.</p><p>Adakalanya kita butuh untuk mengeluarkan variabel <code>x</code> ke luar block. Hal seperti ini mudah untuk dilakukan, dan ada beberapa cara yang bisa dipilih, namun menurut penulis yang paling elegan adalah cara berikut ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"cannot divide by 0"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Statement <code>divider(10, 5)</code> mengembalikan data bertipe <code>Option<i32></code>. Data tersebut digunakan pada keyword <code>match</code> seperti biasa. Namun pada contoh di atas ada yang berbeda, yaitu return value dari statement <code>match</code> ditampung ke variabel (<code>result</code>).</p><p>Isi dari pattern matching <code>match</code> sendiri ada dua:</p><ul><li>Ketika block <code>None</code> match, pesan error di-print kemudian nilai <code>0</code> dijadikan return statement <code>match</code>.</li><li>Ketika block <code>Some</code> match, data <code>x</code> dijadikan return value statement <code>match</code>.</li></ul><p>Dengan penerapan pattern matching seperti di atas, maka variabel <code>result</code> akan selalu berisi data hasil operasi <code>divider(10, 5)</code>. Dengan pengecualian ketika ada error, pesan errornya dimunculkan kemudian hasil operasi pembagian di-set sebagai <code>0</code>.</p><blockquote><p>Lebih jelasnya mengenai pattern matching dibahas pada chapter <a href="/basic/pattern-matching">Pattern Matching</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a393-method-tipe-data-option">A.39.3. Method tipe data <code>Option</code><a class="hash-link" href="#a393-method-tipe-data-option" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-unwrap">◉ Method <code>unwrap</code><a class="hash-link" href="#-method-unwrap" title="Direct link to heading">​</a></h3><p>Isi dari enum value <code>Some<T></code> bisa diakses tanpa menggunakan keyword <code>match</code> dengan cara memanfaatkan method <code>unwrap</code> milik <code>Option<T></code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> result1 </span><span class="token operator" style="color:#393A34">!=</span><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Penggunaan method tersebut sangat dianjurkan diiringi dengan seleksi kondisi untuk memastikan data <code>Option</code> tidak berisi <code>None</code>. Jika data ternyata adalah <code>None</code> dan method <code>unwrap</code> diakses, hasilnya adalah panic error. Contohnya bisa dilihat pada gambar berikut:</p><p><img loading="lazy" alt="Option type" src="/assets/images/option-type-3-e2943c7c0a60b13cd69ce8461805846c.png" width="659" height="262" class="img_CujE"></p><p>Selain method <code>unwrap</code> ada beberapa method sejenis lainnya yang bisa dimanfaatkan untuk pengambilan nilai <code>T</code>. Kita akan bahas satu per satu.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-is_some--is_none">◉ Method <code>is_some</code> & <code>is_none</code><a class="hash-link" href="#-method-is_some--is_none" title="Direct link to heading">​</a></h3><p>Method <code>is_some</code> menghasilkan nilai <code>true</code> jika data isinya adalah enum value <code>Some<T></code>. Sedangkan <code>is_none</code> bernilai <code>true</code> jika data berisi <code>None</code>.</p><p>Contoh penerapannya bisa dilihat pada program berikut. Kesemua seleksi kondisi pada konteks ini menghasilkan nilai <code>true</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> result1 </span><span class="token operator" style="color:#393A34">!=</span><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> result1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">!</span><span class="token plain">result1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_none</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-unwrap_or_default">◉ Method <code>unwrap_or_default</code><a class="hash-link" href="#-method-unwrap_or_default" title="Direct link to heading">​</a></h3><p>Method <code>unwrap_or_default</code> mengembalikan nilai <code>T</code> ketika data berisi <code>Some<T></code>. Jika data ternyata isinya adalah <code>None</code>, maka nilai yang dikembalikan adalah <em>default value</em> dari tipe data <code>T</code>.</p><p>Sebagai contoh, pada kode berikut statement <code>divider(10, 0)</code> return type-nya adalah <code>Option<i32></code>, sedangkan return value-nya adalah <code>None</code>. Pengaksesan method <code>unwrap_or_default</code> menghasilkan <em>default value</em> dari tipe data <code>i32</code>, yaitu <code>0</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or_default</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// result: 0</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-unwrap_or">◉ Method <code>unwrap_or</code><a class="hash-link" href="#-method-unwrap_or" title="Direct link to heading">​</a></h3><p>Method ini mengembalikan nilai <code>T</code> ketika data berisi <code>Some<T></code>, namun jika data ternyata isinya adalah <code>None</code>, maka nilai yang dikembalikan adalah argument pemanggilan method tersebut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// result: 0</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas argument pemanggilan method <code>unwrap_or</code> adalah angka <code>0</code>, artinya ketika <code>result2</code> isinya adalah <code>None</code> maka angka <code>0</code> adalah return value pengaksesan method <code>unwrap_or</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-unwrap_or_else">◉ Method <code>unwrap_or_else</code><a class="hash-link" href="#-method-unwrap_or_else" title="Direct link to heading">​</a></h3><p>Method ini mengembalikan nilai <code>T</code> ketika data berisi <code>Some<T></code>, namun jika data isinya adalah <code>None</code>, maka nilai yang dikembalikan adalah hasil eksekusi closure yang disisipkan saat memanggil method <code>unwrap_or_else</code>. Contoh pengaplikasiannya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or_else</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// result: 0</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Closure harus dalam notasi <code>FnOnce() -> T</code> yang mana <code>T</code> pada konteks ini adalah <code>i32</code>.</p><blockquote><p>Closure <code>|| 0</code> adalah kependekan dari <code>|| -> i32 { 0 }</code>.</p><p>Lebih jelasnya mengenai closure dibahas pada chapter <a href="/basic/closures">Closures</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a384-operator--pada-tipe-option">A.38.4. Operator <code>?</code> pada tipe <code>Option</code><a class="hash-link" href="#a384-operator--pada-tipe-option" title="Direct link to heading">​</a></h2><p>Tipe data <code>Option</code> bisa digunakan pada operator <code>?</code>. Penjelasannya ada di chapter terpisah di <a href="/basic/operator-tanda-tanya">Operator ?</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/option_type" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../option_type</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/generics">Generics</a></li><li><a href="/basic/pattern-matching">Pattern Matching</a></li><li><a href="/basic/closures">Closures</a></li><li><a href="/basic/operator-tanda-tanya">Operator ?</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html</a></li><li><a href="https://doc.rust-lang.org/std/option/index.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/option/index.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/generics"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.38. Generics</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/result-type"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.40. Tipe Data ➜ Result</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a391-konsep-option" class="table-of-contents__link toc-highlight">A.39.1. Konsep <code>Option</code></a></li><li><a href="#a392-pattern-matching-pada-tipe-option" class="table-of-contents__link toc-highlight">A.39.2. Pattern matching pada tipe <code>Option</code></a><ul><li><a href="#-tips-pattern-matching" class="table-of-contents__link toc-highlight">◉ Tips pattern matching</a></li></ul></li><li><a href="#a393-method-tipe-data-option" class="table-of-contents__link toc-highlight">A.39.3. Method tipe data <code>Option</code></a><ul><li><a href="#-method-unwrap" class="table-of-contents__link toc-highlight">◉ Method <code>unwrap</code></a></li><li><a href="#-method-is_some--is_none" class="table-of-contents__link toc-highlight">◉ Method <code>is_some</code> & <code>is_none</code></a></li><li><a href="#-method-unwrap_or_default" class="table-of-contents__link toc-highlight">◉ Method <code>unwrap_or_default</code></a></li><li><a href="#-method-unwrap_or" class="table-of-contents__link toc-highlight">◉ Method <code>unwrap_or</code></a></li><li><a href="#-method-unwrap_or_else" class="table-of-contents__link toc-highlight">◉ Method <code>unwrap_or_else</code></a></li></ul></li><li><a href="#a384-operator--pada-tipe-option" class="table-of-contents__link toc-highlight">A.38.4. Operator <code>?</code> pada tipe <code>Option</code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/ownership.html b/basic/ownership.html index 131c2099..7e13bcbc 100644 --- a/basic/ownership.html +++ b/basic/ownership.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/ownership/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/ownership/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.34. Ownership","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/ownership/#webpage"},"wordCount":1798,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/ownership/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/ownership/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/ownership","name":"A.34. Ownership","description":"Chapter ini berisi pembahasan tentang ownership, bagaimana Rust melakukan manajemen memory dengan menerapkan approach ownership ini.","datePublished":"2024-08-01T10:17:29.815Z","dateModified":"2024-08-01T10:17:29.815Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/ownership/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/ownership"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/ownership/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.34. Ownership","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/ownership/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/ownership/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.34. Ownership","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/ownership/#webpage"},"wordCount":1798,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/ownership/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/ownership/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/ownership","name":"A.34. Ownership","description":"Chapter ini berisi pembahasan tentang ownership, bagaimana Rust melakukan manajemen memory dengan menerapkan approach ownership ini.","datePublished":"2024-08-30T07:44:49.894Z","dateModified":"2024-08-30T07:44:49.894Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/ownership/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/ownership"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/ownership/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.34. Ownership","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.34. Ownership</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.34. Ownership</h1></header><p>Chapter ini berisi pembahasan tentang ownership, bagaimana Rust melakukan manajemen memory dengan menerapkan approach ownership ini.</p><p>O iya, diwajibkan untuk mempelajari terlebih dahulu tentang dasar <a href="/basic/basic-memory-management">Memory Management</a> dan juga <a href="/basic/pointer-references">Pointer & References</a>, yang keduanya adalah dibahas pada chapter sebelumnya. Jika pembaca mempelajari ebook ini secara urut maka tidak usah khawatir.</p><blockquote><p>Pembahasan pada chapter ini adalah salah satu hal yang paling penting untuk dipahami dalam Rust programming, karena topik yang berhubungan dengan memory management adalah hal yang krusial pada system programming.</p><p>Silakan ulang-ulang chapter ini jika diperlukan.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a341-konsep-ownership">A.34.1. Konsep ownership<a class="hash-link" href="#a341-konsep-ownership" title="Direct link to heading">​</a></h2><p>Ownership merupakan kumpulan aturan yang ada di Rust yang dijadikan acuan oleh compiler dalam pengelolahan memory.</p><p>Sudah disinggung pada chapter <a href="/basic/basic-memory-management">Memory Management</a> bahwa Rust tidak menerapkan GC ataupun ARC dalam manajemen memory-nya. Rust membebankan manajemen memory pada penulis kode program, yaitu kita/programmer.</p><p>Aturan ownership ada banyak, dan programmer harus mengikutinya, karena jika tidak, maka proses kompilasi program dan eksekusi program akan gagal dan hasilnya error.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a342-aturan-ownership">A.34.2. Aturan ownership<a class="hash-link" href="#a342-aturan-ownership" title="Direct link to heading">​</a></h2><p>Ada 3 aturan penting yang wajib diketahui:</p><ul><li><p><strong>Semua nilai/data/value di Rust memiliki owner</strong>. Misal kita berbicara tentang deklarasi variabel dengan predefined value, maka value variabel adalah yang dimaksud dengan nilai/data/value, dan variabel itu sendiri adalah owner dari nilai/data/value tersebut.</p></li><li><p>Pada waktu yang sama, <strong>hanya boleh ada 1 owner</strong>. Satu data, ownernya hanya satu.</p></li><li><p><strong>Ketika eksekusi sebuah block scope selesai, maka owner dari data-data yang ada dalam scope tersebut akan di-drop atau di-dealokasi</strong> (dengan pengecualian yaitu owner berpindah ke luar scope).</p></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a343-variable-scope">A.34.3. Variable scope<a class="hash-link" href="#a343-variable-scope" title="Direct link to heading">​</a></h2><p>Sebelum kita masuk ke pembahasan yang lebih detail mengenai ownership, mari pelajari terlebih dahulu tentang apa itu variable scope.</p><p>Variable scope maksudnya adalah di block scope mana suatu variabel dideklarasikan, dan dalam block scope tersebut variabel menjadi valid (bisa digunakan). Di luar scope-nya variabel menjadi tidak valid, tidak bisa digunakan.</p><p>Agar lebih jelas, silakan perhatikan kode berikut, tidak perlu dipraktikkan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"one"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"two"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_three </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"three"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_four </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"four"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Program di atas memiliki 4 buah block kode:</p><ul><li><p>Block fungsi <code>main</code>, yang isinya adalah variabel <code>data_two</code> dan beberapa sub-block dan 1 buah pemanggilan fungsi. Di dalam block fungsi <code>main</code>, variabel <code>data_two</code> adalah valid, dan bisa digunakan dalam fungsi scope tersebut beserta sub-block lainnya (block expression dan block kode <code>if</code>).</p></li><li><p>Block expression yang berisi variabel <code>data_three</code>. Pada block scope ini, variabel tersebut dan juga variable <code>data_two</code> adalah valid.</p></li><li><p>Block fungsi <code>do_something</code>, yang isinya variabel <code>data_one</code>. Variabel tersebut hanya akan valid dalam block fungsi <code>do_something</code>.</p></li><li><p>Block seleksi kondisi <code>if</code>. Variabel <code>data_four</code> berada dalam block ini, maka variabel tersebut adalah valid dalam block tersebut. Selain itu <code>data_two</code> juga valid dalam block seleksi kondisi <code>if</code> ini.</p></li></ul><p>Intinya, variabel adalah valid ketika berada di dalam scope-nya (istilahnya <em>into scope</em>), dan variabel menjadi tidak valid atau invalid ketika keluar dari scope (istilahnya <em>out of scope</em>).</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a344-copy-semantics-vs-move-semantics">A.34.4. Copy semantics vs. move semantics<a class="hash-link" href="#a344-copy-semantics-vs-move-semantics" title="Direct link to heading">​</a></h2><p>Di atas sudah dijelaskan mengenai aturan ownership, yang salah satunya adalah setiap data yang ada di Rust memiliki owner, dan 1 data owner pasti 1 (tidak lebih).</p><p>Agar lebih jelas mari kita perhatikan contoh berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> y </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"x: {:?}, y: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Ownership" src="data:image/png;base64,iVBORw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cCcNlzNMRrdjPPg3G5gOdSNENpONcgYxRr+MJteb+9Y2a7SndybqP8Q6GRN2lXiHuRp5n0xPb4uCzL2nO8Nx50wcQmLdoaryvAcKfP3dHXB6+HJzkJcqUuec7wCwIaO5IiGdlBBBceiONE0YZqI95X+CKh6wPw/LoQa/Jm4bDiFejLChvU+45vyefOLiE/vvcuee4h0IHsbPuKPL+CsMGh80mek+cawnn7iiQH8/btdry95HMGz8XSZPdlJc8J4vggzwmCPCcIgjwnCII8JwiCPCcIgjwnCII8JwiCPCcIgjwnCPKcIAjy3I4ff/7+1+P9Df3098+PlYu+wSwRxJ55fuHNQJq395BADaXe399XJ9UGs0QQ1+V5a99ct294MZrA8K88mvAueBPxJd63clIF0Yg/r5Qlgti9PXdGTxBsDql6SrXPikkVMXvMw7WyRBD7n7e309k/zf+9TU/PnyOPVJpEqh9jVmaRcsEsEcQB1uft9H0Gy4P3fSJNI5Uj+uX1qblaOEsEsXeetz3/bZjXTmPU+Go7t5YoZGtP9Mk0r5Algtj9+rzt8z8E002LYcEoOISEG962z1rNi3//ypAVskQQx+c52GFXdt8T7/sQFJKk6ohuMaXym1i1LBHErazP1wOkL80uQRyF552htZFXfuMjCGJH9tw4GtCWE8SReU4QBHlOEAR5ThDkOUEQ5DlBEOQ5QRDkOUEQ5DlBEOQ5QRDkOUEQ5DlBkOcEQRwL/wO9aeJQompbygAAAABJRU5ErkJggg==" width="333" height="110" class="img_ev3q"></p><p>Variabel <code>x</code> dideklarasikan dengan nilai <code>24</code>, artinya variabel tersebut adalah owner dari data <code>24</code>. Kemudian variabel <code>x</code> dijadikan sebagai nilai variabel baru bernama <code>y</code>, dari sini apakah berarti owner data <code>24</code> adalah berpindah dari variabel <code>x</code> ke <code>y</code>? jawabannya adalah <strong>tidak</strong>.</p><p>Yang terjadi adalah data <code>24</code> milik owner <code>x</code> di-copy atau diduplikasi sebagai data baru yang owner-nya juga baru, yang pada contoh ini adalah variabel <code>y</code>.</p><p>Hasilnya, kedua variabel tersebut masing-masing adalah owner dari data yang berbeda, meskipun sumbernya adalah dari data yang sama. Perilaku ini disebut dengan <strong>copy semantics</strong>.</p><p>Semua tipe data primitif di Rust <em>by default</em> mengadopsi <em>copy semantics</em>. Ketika terjadi operasi assignment seperti pada contoh di atas, maka yang terjadi adalah data di-copy sebagai data baru, dengan owner baru, dan di sisi memory juga terjadi alokasi alamat baru untuk menampung data hasil copy tersebut.</p><blockquote><p>Copy semantics <em>by default</em> berlaku pada tipe primitif.</p><p>Sudah dibahas pada chapter <a href="/basic/basic-memory-management#a323-stack-memory">Memory Management ➜ Stack</a> bahwa data primitif disimpan di stack dan pengaksesannya sangat cepat.</p><p>Dengan ini, copy data pada tipe primitif meskipun menghasilkan alokasi memory baru, konsekuensinya tidak terlalu besar karena pengaksesannya sangat cepat.</p></blockquote><p>Ok, lalu bagaimana dengan contoh ke-2 berikut? Apakah yang terjadi juga sama?</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> a</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"a: {:?}, b: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Ownership" src="/assets/images/ownership-2-b8db9994157f3e86c2a74d048ca45363.png" width="804" height="394" class="img_ev3q"></p><p>Wow, malah muncul error. Kok bisa, padahal kode program sangat straightforward.</p><p>Jadi begini, sebelumnya sudah dibahas bahwa semua tipe data primitif mengadopsi <em>copy semantics</em>. Namun untuk tipe data non-primitif (yang salah satunya adalah custom type <code>String</code>) yang diadopsi adalah <strong>move semantics</strong>.</p><p>Pada <em>move semantics</em>, ketika ada operasi assignment seperti <code>let a = b;</code>, maka yang terjadi adalah owner dari data string <code>hello rust</code> berpindah dari variabel <code>a</code> ke <code>b</code>. Jadinya, mulai dari statement <code>let a = b;</code> dan statement seterusnya, owner dari data string <code>hello rust</code> bukan lagi variabel <code>a</code>, tetapi variabel <code>b</code>.</p><p>Ok, sampai sini cukup jelas. Tapi kenapa bisa error? Error muncul karena variabel <code>a</code> sudah tidak bisa digunakan lagi, data-nya (string <code>hello rust</code>) sudah berpindah ke variabel lain. Variabel <code>a</code> menjadi tidak valid setelah owner-nya berpindah, dan ini adalah penyebab kenapa pemanggilan variabel <code>a</code> via macro <code>println</code> menghasilkan error.</p><blockquote><p>Ingat, setiap data pasti punya owner, dan satu data ownernya hanya satu.</p><p>Pada contoh di atas, owner data <code>hello rust</code> sudah berpindah dari variabel <code>a</code> ke <code>b</code>.</p></blockquote><p>Intinya, variabel yang mengadopsi <em>move semantics</em>, setiap kali ada operasi assignment maka owner akan berpindah ke variabel baru.</p><p>Jika perlu, silakan coba praktikkan dengan tipe data non-primitif lainnya, seperti struct atau lainnya. Dengan pseudocode yang sama seperti contoh di atas, hasilnya adalah sama, yaitu error.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">MyStruct</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> g </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">MyStruct</span><span class="token punctuation" style="color:#393A34">{</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> h </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> g</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"g: {:?}, h: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> h</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Ownership" src="/assets/images/ownership-3-f9834609466195e2d46433bbc089153c.png" width="821" height="449" class="img_ev3q"></p><blockquote><p>Copy semantics di Rust merupakan sifat yang dimiliki oleh trait <code>std::marker::Copy</code>.</p><ul><li>Semua data primitif meng-implement trait <code>std::marker::Copy</code> yang berarti mengadopsi <em>copy semantics</em>.</li><li>Data non-primitif mengadopsi <em>move semantics</em>.</li></ul><p>Lebih jelasnya mengenai traits dibahas pada chapter <a href="/basic/traits">Traits</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a345-alokasi--dealokasi">A.34.5. Alokasi & dealokasi<a class="hash-link" href="#a345-alokasi--dealokasi" title="Direct link to heading">​</a></h2><p>Ok, masuk ke pembahasan selanjutnya, yaitu tentang alokasi dan dealokasi sebuah variabel dalam scope-nya.</p><p>Di sini kita akan gunakan custom type <code>String</code> sebagai contoh untuk mempelajari ownership. Untuk tipe non-primitif lainnya yang juga mengadopsi <strong>move semantics</strong> sebenarnya bisa dijadikan contoh. Tapi penulis memilih tipe <code>String</code> karena sering digunakan.</p><p>Sekarang perhatikan kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> k </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> m </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello world"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> n </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"from rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> k </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> n</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> k</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>main</code> dideklarasikan, isinya adalah pemanggilan fungsi <code>do_something</code>.</p><p>Di dalam fungsi <code>do_something</code>, variabel <code>k</code> dideklarasikan. Statement deklarasi tersebut adalah kapan proses alokasi memory berlangsung untuk data variabel <code>k</code>.</p><p>Kemudian ada block expression, dan di dalamnya terjadi lagi proses alokasi memory untuk data variabel <code>m</code> dengan nilai adalah string <code>hello world</code>, dan variabel <code>n</code> berisi string <code>from rust</code>.</p><p>Masih di dalam block expression, terjadi assignment operation, data variabel <code>n</code> berpindah ke variabel <code>k</code>. Lalu bagaimana nasib data string <code>hello</code> yang sebelumnya dimiliki oleh <code>n</code>? Yang terjadi adalah data tersebut tidak memiliki reference, dan nantinya di akhir fungsi akan di-dealokasi. Proses dealokasi terjadi setelah fungsi <code>do_something</code> selesai dieksekusi karena variable scope data tersebut adalah di block kode fungsi <code>do_something</code>.</p><p>Ok, masih dalam block expression. Ada statement print untuk data variable <code>m</code> yang merupakan statement terakhir di block expression tersebut. Setelah eksekusi block expression selesai, yang terjadi kemudian adalah:</p><ul><li>data variabel <code>m</code> di-dealokasi, karena sudah <em>out of scope</em>.</li><li>data variabel <code>n</code> tidak di-dealokasi, karena sudah berpindah scope-nya ke fungsi <code>do_something</code>. Data tersebut sekarang ownernya adalah variabel <code>k</code> yang scope-nya ada di block fungsi <code>do_something</code>.</li></ul><p>Kemudian variabel <code>k</code> di-print, dan fungsi selesai dieksekusi. Pada moment inilah semua data dalam scope block fungsi <code>do_something</code> di-dealokasi, karena kesemua data tersebut adalah <em>out of scope</em> dan tidak ada yang berpindah ke block fungsi lainnya.</p><p>Secara garis besar seperti itu proses manajemen memory pada Rust yang menerapkan konsep <em>ownership</em>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a346-transfer-ownership">A.34.6. Transfer ownership<a class="hash-link" href="#a346-transfer-ownership" title="Direct link to heading">​</a></h2><p>Di atas sudah dibahas bagaimana cara untuk transfer ownership data yang mengadopsi <em>move semantics</em>, yaitu cukup dengan statement assignment.</p><p>Berikut adalah contoh lain perihal transfer ownership. Data string yang owner awalnya adalah <code>msg1</code>, berpindah ke <code>msg2</code>, kemudian berpindah lagi ke <code>msg3</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> msg1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> msg2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Coba modifikasi sedikit kode tersebut, dengan menambahkan deklarasi variabel <code>msg4</code> yang nilai-nya didapat dari <code>msg2</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> msg1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> msg2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> msg2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Hasilnya adalah error, karena <code>msg2</code> sudah invalid.</p><p><img loading="lazy" alt="Ownership" src="/assets/images/ownership-4-90c3dccbd5f0429a8760c9a445f446af.png" width="792" height="394" class="img_ev3q"></p><p>Jika ingin memindah datanya ke <code>msg4</code>, maka gunakan statement <code>let msg4 = msg3</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-transfer-ownership-via-return-value">◉ Transfer ownership via return value<a class="hash-link" href="#-transfer-ownership-via-return-value" title="Direct link to heading">​</a></h3><p>Transfer ownership data yang mengadopsi <em>move semantics</em> juga bisa dilakukan antar fungsi via return value. Sebagai contoh pada kode berikut, variabel <code>m</code> yang berada di dalam block expression berpindah ke luar scope yaitu ke block fungsi <code>do_something</code> via operasi assignment <code>k = m</code>. Kemudian berpindah lagi ke fungsi <code>main</code> via return value pemanggilan fungsi <code>do_something</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> k </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> m </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello world"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> k </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> k</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-transfer-ownership-via-parameterargument">◉ Transfer ownership via parameter/argument<a class="hash-link" href="#-transfer-ownership-via-parameterargument" title="Direct link to heading">​</a></h3><p>Pemanggilan fungsi dengan menyisipkan argument juga menghasilkan proses transfer ownership untuk data yang mengadopsi <em>move semantics</em>. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">msg</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">param</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> param</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas, data variabel <code>msg</code> owner-nya berpindah ke parameter bernama <code>param</code> milik fungsi <code>say_hello</code>.</p><p>Ok, sampai di sini semoga cukup jelas ya tentang bagaimana proses transfer ownership terjadi pada data yang mengadopsi <em>move semantics</em>.</p><p>Untuk data bertipe primitif (yang mengadopsi <em>copy semantics</em>) kita tidak perlu repot memikirkan di mana letak owner datanya, karena setiap operasi assignment, data akan di-copy dan hasilnya ada data baru dengan owner baru.</p><p>Tapi kalau dipikir-pikir justru lebih repot mengurus data yang ownernya berpindah saat assignment. Sebagai contoh, misal variabel digunakan di fungsi lain, kemudian digunakan lagi di scope asalnya. Repot juga kalau setiap saat harus dikembalikan lagi via return value.</p><p>Misalnya pada kasus berikut ini. Hasilnya pasti error, karena variabel <code>msg</code> di print setelah owner-nya berpindah ke fungsi <code>say_hello</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">msg</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">param</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> param</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Lalu apa solusinya? apakah harus mengembalikannya via return value? Contohnya seperti kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 1. awalnya data di sini</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> msg </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">msg</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 3. lalu dikembalikan lagi ke sini</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">param</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 2. kemudian berpindah ke sini</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> param</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> param</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Boleh-boleh saja sebenarnya pakai approach tersebut, tapi malah makin repot bukan?</p><p>Ada lagi solusi lainnya yang bisa digunakan, yaitu dengan memanfaatkan method <code>clone</code> untuk cloning data.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a347-clone-data">A.34.7. Clone data<a class="hash-link" href="#a347-clone-data" title="Direct link to heading">​</a></h2><p>Semua tipe data yang mengadopsi <em>move semantics</em> meng-implement trait <code>std::clone::Clone</code>. Trait ini memiliki method bernama <code>clone</code> yang gunanya adalah menduplikasi atau clonging data. Cukup panggil saja method tersebut, maka data akan ter-cloning.</p><blockquote><p>Lebih jelasnya mengenai traits dibahas pada chapter <a href="/basic/traits">Traits</a>.</p></blockquote><p>Kita akan terapkan pada kode sebelumnya, hasilnya kurang lebih seperti ini. Pada argument pemanggilan fungsi <code>say_hello</code> disisipkan data cloning via statement <code>msg.clone()</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">msg</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">clone</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">param</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> param</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ok, dengan ini masalah untuk me-reuse data yang bisa berpindah ownernya dianggap beres. Memang beres, tapi apakah cara ini baik kalau dilihat dari sudut pandang memory management?</p><p>Konsekuensi dari cloning data adalah terjadi proses alokasi lagi di memory. Data akan di-duplikasi dan dialokasikan ke alamat memory baru, jadinya kurang efisien. Ditambah lagi, jika kita mengacu ke penjelasan pada chapter <a href="/basic/basic-memory-management#a324-heap-memory">Memory Management ➜ Heap Memory</a>, data <code>String</code> isinya disimpan di heap memory yang pengaksesannya lebih lambat dibanding pengaksesan data stack. Dari sini bisa disimpulkan bahwa cloning bukan solusi yang paling baik (kecuali terpaksa).</p><p><strong>Solusi yang lebih baik adalah dengan melakukan operasi pinjam data dari owner aslinya tanpa perlu melakukan operasi perpindahan owner</strong>, yang pada Rust programming disebut dengan <strong>borrowing</strong>.</p><p>Kita sebenarnya sudah menerapkannya beberapa kali pada chapter yang lalu, tapi kita akan bahas lagi lebih detail (dari sudut pandang ownership) pada chapter <a href="/basic/borrowing">Borrowing</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a348-ownership-pada-data-literal">A.34.8. Ownership pada data literal<a class="hash-link" href="#a348-ownership-pada-data-literal" title="Direct link to heading">​</a></h2><p>Kita akan bahas topik ini pada chapter berikutnya, yaitu chapter <a href="/basic/borrowing#a347-owner-dan-borrower-pada-literal">Borrowing</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a349-move-semantics-pada-macro-println">A.34.9. <em>Move semantics</em> pada macro <code>println</code><a class="hash-link" href="#a349-move-semantics-pada-macro-println" title="Direct link to heading">​</a></h2><p>Ada yang unik dengan macro <code>println</code>. Silakan coba kode berikut agar terlihat keunikannya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"luwe"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{str1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">str1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ngelak"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">str2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{str2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jika dijalankan ada error di statement terakhir fungsi <code>main</code>.</p><p><img loading="lazy" alt="Ownership" src="/assets/images/ownership-5-42080e6ebdac72f8d756dcf0dacb2061.png" width="883" height="682" class="img_ev3q"></p><p>Seperti yang sudah dibahas, bahwa tipe <code>String</code> mengadopsi move semantics. Ketika data bertipe ini digunakan pada operasi assignment seperti contohnya sebagai argument pemanggilan fungsi, maka owner berpindah.</p><p>Tapi entah kenapa, khusus dalam pemanggilan macro <code>println</code>, owner-nya tidak berpindah. Ajaib.</p><p>Silakan lihat sendiri di gambar di atas, ketika <code>str1</code> digunakan pada macro <code>println</code>, kemudian digunakan lagi pada argument pemanggilan fungsi <code>do_something</code>, hasilnya tidak error.</p><p>Akan tetapi ketika digunakan pada pemanggilan fungsi terlebih dahulu, jika digunakan lagi di statement di bawahnya hasilnya error.</p><p>Ini adalah keistimewaan dari macro <code>println</code> dan beberapa macro untuk keperluan printing lainnya.</p><p>Lebih jelasnya mengenai macro dibahas pada chapter <a href="#/wip/macro">Macro</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/ownership" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../ownership</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html</a></li><li><a href="https://doc.rust-lang.org/std/marker/trait.Copy.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/marker/trait.Copy.html</a></li><li><a href="https://doc.rust-lang.org/nomicon/ownership.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/nomicon/ownership.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/pointer-references"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.33. Pointer & References</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/borrowing"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.35. Borrowing</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a341-konsep-ownership" class="table-of-contents__link toc-highlight">A.34.1. Konsep ownership</a></li><li><a href="#a342-aturan-ownership" class="table-of-contents__link toc-highlight">A.34.2. Aturan ownership</a></li><li><a href="#a343-variable-scope" class="table-of-contents__link toc-highlight">A.34.3. Variable scope</a></li><li><a href="#a344-copy-semantics-vs-move-semantics" class="table-of-contents__link toc-highlight">A.34.4. Copy semantics vs. move semantics</a></li><li><a href="#a345-alokasi--dealokasi" class="table-of-contents__link toc-highlight">A.34.5. Alokasi & dealokasi</a></li><li><a href="#a346-transfer-ownership" class="table-of-contents__link toc-highlight">A.34.6. Transfer ownership</a><ul><li><a href="#-transfer-ownership-via-return-value" class="table-of-contents__link toc-highlight">◉ Transfer ownership via return value</a></li><li><a href="#-transfer-ownership-via-parameterargument" class="table-of-contents__link toc-highlight">◉ Transfer ownership via parameter/argument</a></li></ul></li><li><a href="#a347-clone-data" class="table-of-contents__link toc-highlight">A.34.7. Clone data</a></li><li><a href="#a348-ownership-pada-data-literal" class="table-of-contents__link toc-highlight">A.34.8. Ownership pada data literal</a></li><li><a href="#a349-move-semantics-pada-macro-println" class="table-of-contents__link toc-highlight">A.34.9. <em>Move semantics</em> pada macro <code>println</code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.34. Ownership</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.34. Ownership</h1></header><p>Chapter ini berisi pembahasan tentang ownership, bagaimana Rust melakukan manajemen memory dengan menerapkan approach ownership ini.</p><p>O iya, diwajibkan untuk mempelajari terlebih dahulu tentang dasar <a href="/basic/basic-memory-management">Memory Management</a> dan juga <a href="/basic/pointer-references">Pointer & References</a>, yang keduanya adalah dibahas pada chapter sebelumnya. Jika pembaca mempelajari ebook ini secara urut maka tidak usah khawatir.</p><blockquote><p>Pembahasan pada chapter ini adalah salah satu hal yang paling penting untuk dipahami dalam Rust programming, karena topik yang berhubungan dengan memory management adalah hal yang krusial pada system programming.</p><p>Silakan ulang-ulang chapter ini jika diperlukan.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a341-konsep-ownership">A.34.1. Konsep ownership<a class="hash-link" href="#a341-konsep-ownership" title="Direct link to heading">​</a></h2><p>Ownership merupakan kumpulan aturan yang ada di Rust yang dijadikan acuan oleh compiler dalam pengelolahan memory.</p><p>Sudah disinggung pada chapter <a href="/basic/basic-memory-management">Memory Management</a> bahwa Rust tidak menerapkan GC ataupun ARC dalam manajemen memory-nya. Rust membebankan manajemen memory pada penulis kode program, yaitu kita/programmer.</p><p>Aturan ownership ada banyak, dan programmer harus mengikutinya, karena jika tidak, maka proses kompilasi program dan eksekusi program akan gagal dan hasilnya error.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a342-aturan-ownership">A.34.2. Aturan ownership<a class="hash-link" href="#a342-aturan-ownership" title="Direct link to heading">​</a></h2><p>Ada 3 aturan penting yang wajib diketahui:</p><ul><li><p><strong>Semua nilai/data/value di Rust memiliki owner</strong>. Misal kita berbicara tentang deklarasi variabel dengan predefined value, maka value variabel adalah yang dimaksud dengan nilai/data/value, dan variabel itu sendiri adalah owner dari nilai/data/value tersebut.</p></li><li><p>Pada waktu yang sama, <strong>hanya boleh ada 1 owner</strong>. Satu data, ownernya hanya satu.</p></li><li><p><strong>Ketika eksekusi sebuah block scope selesai, maka owner dari data-data yang ada dalam scope tersebut akan di-drop atau di-dealokasi</strong> (dengan pengecualian yaitu owner berpindah ke luar scope).</p></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a343-variable-scope">A.34.3. Variable scope<a class="hash-link" href="#a343-variable-scope" title="Direct link to heading">​</a></h2><p>Sebelum kita masuk ke pembahasan yang lebih detail mengenai ownership, mari pelajari terlebih dahulu tentang apa itu variable scope.</p><p>Variable scope maksudnya adalah di block scope mana suatu variabel dideklarasikan, dan dalam block scope tersebut variabel menjadi valid (bisa digunakan). Di luar scope-nya variabel menjadi tidak valid, tidak bisa digunakan.</p><p>Agar lebih jelas, silakan perhatikan kode berikut, tidak perlu dipraktikkan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"one"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"two"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_three </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"three"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_four </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"four"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Program di atas memiliki 4 buah block kode:</p><ul><li><p>Block fungsi <code>main</code>, yang isinya adalah variabel <code>data_two</code> dan beberapa sub-block dan 1 buah pemanggilan fungsi. Di dalam block fungsi <code>main</code>, variabel <code>data_two</code> adalah valid, dan bisa digunakan dalam fungsi scope tersebut beserta sub-block lainnya (block expression dan block kode <code>if</code>).</p></li><li><p>Block expression yang berisi variabel <code>data_three</code>. Pada block scope ini, variabel tersebut dan juga variable <code>data_two</code> adalah valid.</p></li><li><p>Block fungsi <code>do_something</code>, yang isinya variabel <code>data_one</code>. Variabel tersebut hanya akan valid dalam block fungsi <code>do_something</code>.</p></li><li><p>Block seleksi kondisi <code>if</code>. Variabel <code>data_four</code> berada dalam block ini, maka variabel tersebut adalah valid dalam block tersebut. Selain itu <code>data_two</code> juga valid dalam block seleksi kondisi <code>if</code> ini.</p></li></ul><p>Intinya, variabel adalah valid ketika berada di dalam scope-nya (istilahnya <em>into scope</em>), dan variabel menjadi tidak valid atau invalid ketika keluar dari scope (istilahnya <em>out of scope</em>).</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a344-copy-semantics-vs-move-semantics">A.34.4. Copy semantics vs. move semantics<a class="hash-link" href="#a344-copy-semantics-vs-move-semantics" title="Direct link to heading">​</a></h2><p>Di atas sudah dijelaskan mengenai aturan ownership, yang salah satunya adalah setiap data yang ada di Rust memiliki owner, dan 1 data owner pasti 1 (tidak lebih).</p><p>Agar lebih jelas mari kita perhatikan contoh berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> y </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"x: {:?}, y: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="Ownership" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAU0AAABuCAIAAAAs3da/AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG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bFojq1egSyEDTTtikR/kJ6XqwowSEfYWPqi3657fm3QkxknpJRdK7ibdgeEmsbznEHP81xvODkopULewrx9VH1Yl+emy8/tPIfmB3dWIGyg7yUlxv3xp9UFGILUsfRFa77ade6F650Tqc5zLEyV+6qQvnl+FXueabjnMYJVti83zHNk2z35hwo8b1OcYMOTPUAsvnR7rtNP064wEH1tAYY49UhWoRORfe0GnItN1zcCcNlzNMRrdjPPg3G5gOdSNENpONcgYxRr+MJteb+9Y2a7SndybqP8Q6GRN2lXiHuRp5n0xPb4uCzL2nO8Nx50wcQmLdoaryvAcKfP3dHXB6+HJzkJcqUuec7wCwIaO5IiGdlBBBceiONE0YZqI95X+CKh6wPw/LoQa/Jm4bDiFejLChvU+45vyefOLiE/vvcuee4h0IHsbPuKPL+CsMGh80mek+cawnn7iiQH8/btdry95HMGz8XSZPdlJc8J4vggzwmCPCcIgjwnCII8JwiCPCcIgjwnCII8JwiCPCcIgjwnCPKcIAjy3I4ff/7+1+P9Df3098+PlYu+wSwRxJ55fuHNQJq395BADaXe399XJ9UGs0QQ1+V5a99ct294MZrA8K88mvAueBPxJd63clIF0Yg/r5Qlgti9PXdGTxBsDql6SrXPikkVMXvMw7WyRBD7n7e309k/zf+9TU/PnyOPVJpEqh9jVmaRcsEsEcQB1uft9H0Gy4P3fSJNI5Uj+uX1qblaOEsEsXeetz3/bZjXTmPU+Go7t5YoZGtP9Mk0r5Algtj9+rzt8z8E002LYcEoOISEG962z1rNi3//ypAVskQQx+c52GFXdt8T7/sQFJKk6ohuMaXym1i1LBHErazP1wOkL80uQRyF552htZFXfuMjCGJH9tw4GtCWE8SReU4QBHlOEAR5ThDkOUEQ5DlBEOQ5QRDkOUEQ5DlBEOQ5QRDkOUEQ5DlBkOcEQRwL/wO9aeJQompbygAAAABJRU5ErkJggg==" width="333" height="110" class="img_CujE"></p><p>Variabel <code>x</code> dideklarasikan dengan nilai <code>24</code>, artinya variabel tersebut adalah owner dari data <code>24</code>. Kemudian variabel <code>x</code> dijadikan sebagai nilai variabel baru bernama <code>y</code>, dari sini apakah berarti owner data <code>24</code> adalah berpindah dari variabel <code>x</code> ke <code>y</code>? jawabannya adalah <strong>tidak</strong>.</p><p>Yang terjadi adalah data <code>24</code> milik owner <code>x</code> di-copy atau diduplikasi sebagai data baru yang owner-nya juga baru, yang pada contoh ini adalah variabel <code>y</code>.</p><p>Hasilnya, kedua variabel tersebut masing-masing adalah owner dari data yang berbeda, meskipun sumbernya adalah dari data yang sama. Perilaku ini disebut dengan <strong>copy semantics</strong>.</p><p>Semua tipe data primitif di Rust <em>by default</em> mengadopsi <em>copy semantics</em>. Ketika terjadi operasi assignment seperti pada contoh di atas, maka yang terjadi adalah data di-copy sebagai data baru, dengan owner baru, dan di sisi memory juga terjadi alokasi alamat baru untuk menampung data hasil copy tersebut.</p><blockquote><p>Copy semantics <em>by default</em> berlaku pada tipe primitif.</p><p>Sudah dibahas pada chapter <a href="/basic/basic-memory-management#a323-stack-memory">Memory Management ➜ Stack</a> bahwa data primitif disimpan di stack dan pengaksesannya sangat cepat.</p><p>Dengan ini, copy data pada tipe primitif meskipun menghasilkan alokasi memory baru, konsekuensinya tidak terlalu besar karena pengaksesannya sangat cepat.</p></blockquote><p>Ok, lalu bagaimana dengan contoh ke-2 berikut? Apakah yang terjadi juga sama?</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> a</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"a: {:?}, b: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Ownership" src="/assets/images/ownership-2-b8db9994157f3e86c2a74d048ca45363.png" width="804" height="394" class="img_CujE"></p><p>Wow, malah muncul error. Kok bisa, padahal kode program sangat straightforward.</p><p>Jadi begini, sebelumnya sudah dibahas bahwa semua tipe data primitif mengadopsi <em>copy semantics</em>. Namun untuk tipe data non-primitif (yang salah satunya adalah custom type <code>String</code>) yang diadopsi adalah <strong>move semantics</strong>.</p><p>Pada <em>move semantics</em>, ketika ada operasi assignment seperti <code>let a = b;</code>, maka yang terjadi adalah owner dari data string <code>hello rust</code> berpindah dari variabel <code>a</code> ke <code>b</code>. Jadinya, mulai dari statement <code>let a = b;</code> dan statement seterusnya, owner dari data string <code>hello rust</code> bukan lagi variabel <code>a</code>, tetapi variabel <code>b</code>.</p><p>Ok, sampai sini cukup jelas. Tapi kenapa bisa error? Error muncul karena variabel <code>a</code> sudah tidak bisa digunakan lagi, data-nya (string <code>hello rust</code>) sudah berpindah ke variabel lain. Variabel <code>a</code> menjadi tidak valid setelah owner-nya berpindah, dan ini adalah penyebab kenapa pemanggilan variabel <code>a</code> via macro <code>println</code> menghasilkan error.</p><blockquote><p>Ingat, setiap data pasti punya owner, dan satu data ownernya hanya satu.</p><p>Pada contoh di atas, owner data <code>hello rust</code> sudah berpindah dari variabel <code>a</code> ke <code>b</code>.</p></blockquote><p>Intinya, variabel yang mengadopsi <em>move semantics</em>, setiap kali ada operasi assignment maka owner akan berpindah ke variabel baru.</p><p>Jika perlu, silakan coba praktikkan dengan tipe data non-primitif lainnya, seperti struct atau lainnya. Dengan pseudocode yang sama seperti contoh di atas, hasilnya adalah sama, yaitu error.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">MyStruct</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> g </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">MyStruct</span><span class="token punctuation" style="color:#393A34">{</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> h </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> g</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"g: {:?}, h: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> h</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Ownership" src="/assets/images/ownership-3-f9834609466195e2d46433bbc089153c.png" width="821" height="449" class="img_CujE"></p><blockquote><p>Copy semantics di Rust merupakan sifat yang dimiliki oleh trait <code>std::marker::Copy</code>.</p><ul><li>Semua data primitif meng-implement trait <code>std::marker::Copy</code> yang berarti mengadopsi <em>copy semantics</em>.</li><li>Data non-primitif mengadopsi <em>move semantics</em>.</li></ul><p>Lebih jelasnya mengenai traits dibahas pada chapter <a href="/basic/traits">Traits</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a345-alokasi--dealokasi">A.34.5. Alokasi & dealokasi<a class="hash-link" href="#a345-alokasi--dealokasi" title="Direct link to heading">​</a></h2><p>Ok, masuk ke pembahasan selanjutnya, yaitu tentang alokasi dan dealokasi sebuah variabel dalam scope-nya.</p><p>Di sini kita akan gunakan custom type <code>String</code> sebagai contoh untuk mempelajari ownership. Untuk tipe non-primitif lainnya yang juga mengadopsi <strong>move semantics</strong> sebenarnya bisa dijadikan contoh. Tapi penulis memilih tipe <code>String</code> karena sering digunakan.</p><p>Sekarang perhatikan kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> k </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> m </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello world"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> n </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"from rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> k </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> n</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> k</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>main</code> dideklarasikan, isinya adalah pemanggilan fungsi <code>do_something</code>.</p><p>Di dalam fungsi <code>do_something</code>, variabel <code>k</code> dideklarasikan. Statement deklarasi tersebut adalah kapan proses alokasi memory berlangsung untuk data variabel <code>k</code>.</p><p>Kemudian ada block expression, dan di dalamnya terjadi lagi proses alokasi memory untuk data variabel <code>m</code> dengan nilai adalah string <code>hello world</code>, dan variabel <code>n</code> berisi string <code>from rust</code>.</p><p>Masih di dalam block expression, terjadi assignment operation, data variabel <code>n</code> berpindah ke variabel <code>k</code>. Lalu bagaimana nasib data string <code>hello</code> yang sebelumnya dimiliki oleh <code>n</code>? Yang terjadi adalah data tersebut tidak memiliki reference, dan nantinya di akhir fungsi akan di-dealokasi. Proses dealokasi terjadi setelah fungsi <code>do_something</code> selesai dieksekusi karena variable scope data tersebut adalah di block kode fungsi <code>do_something</code>.</p><p>Ok, masih dalam block expression. Ada statement print untuk data variable <code>m</code> yang merupakan statement terakhir di block expression tersebut. Setelah eksekusi block expression selesai, yang terjadi kemudian adalah:</p><ul><li>data variabel <code>m</code> di-dealokasi, karena sudah <em>out of scope</em>.</li><li>data variabel <code>n</code> tidak di-dealokasi, karena sudah berpindah scope-nya ke fungsi <code>do_something</code>. Data tersebut sekarang ownernya adalah variabel <code>k</code> yang scope-nya ada di block fungsi <code>do_something</code>.</li></ul><p>Kemudian variabel <code>k</code> di-print, dan fungsi selesai dieksekusi. Pada moment inilah semua data dalam scope block fungsi <code>do_something</code> di-dealokasi, karena kesemua data tersebut adalah <em>out of scope</em> dan tidak ada yang berpindah ke block fungsi lainnya.</p><p>Secara garis besar seperti itu proses manajemen memory pada Rust yang menerapkan konsep <em>ownership</em>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a346-transfer-ownership">A.34.6. Transfer ownership<a class="hash-link" href="#a346-transfer-ownership" title="Direct link to heading">​</a></h2><p>Di atas sudah dibahas bagaimana cara untuk transfer ownership data yang mengadopsi <em>move semantics</em>, yaitu cukup dengan statement assignment.</p><p>Berikut adalah contoh lain perihal transfer ownership. Data string yang owner awalnya adalah <code>msg1</code>, berpindah ke <code>msg2</code>, kemudian berpindah lagi ke <code>msg3</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> msg1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> msg2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Coba modifikasi sedikit kode tersebut, dengan menambahkan deklarasi variabel <code>msg4</code> yang nilai-nya didapat dari <code>msg2</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> msg1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> msg2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> msg2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Hasilnya adalah error, karena <code>msg2</code> sudah invalid.</p><p><img loading="lazy" alt="Ownership" src="/assets/images/ownership-4-90c3dccbd5f0429a8760c9a445f446af.png" width="792" height="394" class="img_CujE"></p><p>Jika ingin memindah datanya ke <code>msg4</code>, maka gunakan statement <code>let msg4 = msg3</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-transfer-ownership-via-return-value">◉ Transfer ownership via return value<a class="hash-link" href="#-transfer-ownership-via-return-value" title="Direct link to heading">​</a></h3><p>Transfer ownership data yang mengadopsi <em>move semantics</em> juga bisa dilakukan antar fungsi via return value. Sebagai contoh pada kode berikut, variabel <code>m</code> yang berada di dalam block expression berpindah ke luar scope yaitu ke block fungsi <code>do_something</code> via operasi assignment <code>k = m</code>. Kemudian berpindah lagi ke fungsi <code>main</code> via return value pemanggilan fungsi <code>do_something</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> k </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> m </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello world"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> k </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> k</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-transfer-ownership-via-parameterargument">◉ Transfer ownership via parameter/argument<a class="hash-link" href="#-transfer-ownership-via-parameterargument" title="Direct link to heading">​</a></h3><p>Pemanggilan fungsi dengan menyisipkan argument juga menghasilkan proses transfer ownership untuk data yang mengadopsi <em>move semantics</em>. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">msg</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">param</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> param</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas, data variabel <code>msg</code> owner-nya berpindah ke parameter bernama <code>param</code> milik fungsi <code>say_hello</code>.</p><p>Ok, sampai di sini semoga cukup jelas ya tentang bagaimana proses transfer ownership terjadi pada data yang mengadopsi <em>move semantics</em>.</p><p>Untuk data bertipe primitif (yang mengadopsi <em>copy semantics</em>) kita tidak perlu repot memikirkan di mana letak owner datanya, karena setiap operasi assignment, data akan di-copy dan hasilnya ada data baru dengan owner baru.</p><p>Tapi kalau dipikir-pikir justru lebih repot mengurus data yang ownernya berpindah saat assignment. Sebagai contoh, misal variabel digunakan di fungsi lain, kemudian digunakan lagi di scope asalnya. Repot juga kalau setiap saat harus dikembalikan lagi via return value.</p><p>Misalnya pada kasus berikut ini. Hasilnya pasti error, karena variabel <code>msg</code> di print setelah owner-nya berpindah ke fungsi <code>say_hello</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">msg</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">param</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> param</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Lalu apa solusinya? apakah harus mengembalikannya via return value? Contohnya seperti kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> msg </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 1. awalnya data di sini</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> msg </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">msg</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 3. lalu dikembalikan lagi ke sini</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">param</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 2. kemudian berpindah ke sini</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> param</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> param</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Boleh-boleh saja sebenarnya pakai approach tersebut, tapi malah makin repot bukan?</p><p>Ada lagi solusi lainnya yang bisa digunakan, yaitu dengan memanfaatkan method <code>clone</code> untuk cloning data.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a347-clone-data">A.34.7. Clone data<a class="hash-link" href="#a347-clone-data" title="Direct link to heading">​</a></h2><p>Semua tipe data yang mengadopsi <em>move semantics</em> meng-implement trait <code>std::clone::Clone</code>. Trait ini memiliki method bernama <code>clone</code> yang gunanya adalah menduplikasi atau clonging data. Cukup panggil saja method tersebut, maka data akan ter-cloning.</p><blockquote><p>Lebih jelasnya mengenai traits dibahas pada chapter <a href="/basic/traits">Traits</a>.</p></blockquote><p>Kita akan terapkan pada kode sebelumnya, hasilnya kurang lebih seperti ini. Pada argument pemanggilan fungsi <code>say_hello</code> disisipkan data cloning via statement <code>msg.clone()</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> msg </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">msg</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">clone</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> msg</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">param</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> param</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ok, dengan ini masalah untuk me-reuse data yang bisa berpindah ownernya dianggap beres. Memang beres, tapi apakah cara ini baik kalau dilihat dari sudut pandang memory management?</p><p>Konsekuensi dari cloning data adalah terjadi proses alokasi lagi di memory. Data akan di-duplikasi dan dialokasikan ke alamat memory baru, jadinya kurang efisien. Ditambah lagi, jika kita mengacu ke penjelasan pada chapter <a href="/basic/basic-memory-management#a324-heap-memory">Memory Management ➜ Heap Memory</a>, data <code>String</code> isinya disimpan di heap memory yang pengaksesannya lebih lambat dibanding pengaksesan data stack. Dari sini bisa disimpulkan bahwa cloning bukan solusi yang paling baik (kecuali terpaksa).</p><p><strong>Solusi yang lebih baik adalah dengan melakukan operasi pinjam data dari owner aslinya tanpa perlu melakukan operasi perpindahan owner</strong>, yang pada Rust programming disebut dengan <strong>borrowing</strong>.</p><p>Kita sebenarnya sudah menerapkannya beberapa kali pada chapter yang lalu, tapi kita akan bahas lagi lebih detail (dari sudut pandang ownership) pada chapter <a href="/basic/borrowing">Borrowing</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a348-ownership-pada-data-literal">A.34.8. Ownership pada data literal<a class="hash-link" href="#a348-ownership-pada-data-literal" title="Direct link to heading">​</a></h2><p>Kita akan bahas topik ini pada chapter berikutnya, yaitu chapter <a href="/basic/borrowing#a347-owner-dan-borrower-pada-literal">Borrowing</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a349-move-semantics-pada-macro-println">A.34.9. <em>Move semantics</em> pada macro <code>println</code><a class="hash-link" href="#a349-move-semantics-pada-macro-println" title="Direct link to heading">​</a></h2><p>Ada yang unik dengan macro <code>println</code>. Silakan coba kode berikut agar terlihat keunikannya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"luwe"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{str1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">str1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ngelak"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">str2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{str2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jika dijalankan ada error di statement terakhir fungsi <code>main</code>.</p><p><img loading="lazy" alt="Ownership" src="/assets/images/ownership-5-42080e6ebdac72f8d756dcf0dacb2061.png" width="883" height="682" class="img_CujE"></p><p>Seperti yang sudah dibahas, bahwa tipe <code>String</code> mengadopsi move semantics. Ketika data bertipe ini digunakan pada operasi assignment seperti contohnya sebagai argument pemanggilan fungsi, maka owner berpindah.</p><p>Tapi entah kenapa, khusus dalam pemanggilan macro <code>println</code>, owner-nya tidak berpindah. Ajaib.</p><p>Silakan lihat sendiri di gambar di atas, ketika <code>str1</code> digunakan pada macro <code>println</code>, kemudian digunakan lagi pada argument pemanggilan fungsi <code>do_something</code>, hasilnya tidak error.</p><p>Akan tetapi ketika digunakan pada pemanggilan fungsi terlebih dahulu, jika digunakan lagi di statement di bawahnya hasilnya error.</p><p>Ini adalah keistimewaan dari macro <code>println</code> dan beberapa macro untuk keperluan printing lainnya.</p><p>Lebih jelasnya mengenai macro dibahas pada chapter <a href="#/wip/macro">Macro</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/ownership" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../ownership</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html</a></li><li><a href="https://doc.rust-lang.org/std/marker/trait.Copy.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/marker/trait.Copy.html</a></li><li><a href="https://doc.rust-lang.org/nomicon/ownership.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/nomicon/ownership.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/pointer-references"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.33. Pointer & References</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/borrowing"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.35. Borrowing</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a341-konsep-ownership" class="table-of-contents__link toc-highlight">A.34.1. Konsep ownership</a></li><li><a href="#a342-aturan-ownership" class="table-of-contents__link toc-highlight">A.34.2. Aturan ownership</a></li><li><a href="#a343-variable-scope" class="table-of-contents__link toc-highlight">A.34.3. Variable scope</a></li><li><a href="#a344-copy-semantics-vs-move-semantics" class="table-of-contents__link toc-highlight">A.34.4. Copy semantics vs. move semantics</a></li><li><a href="#a345-alokasi--dealokasi" class="table-of-contents__link toc-highlight">A.34.5. Alokasi & dealokasi</a></li><li><a href="#a346-transfer-ownership" class="table-of-contents__link toc-highlight">A.34.6. Transfer ownership</a><ul><li><a href="#-transfer-ownership-via-return-value" class="table-of-contents__link toc-highlight">◉ Transfer ownership via return value</a></li><li><a href="#-transfer-ownership-via-parameterargument" class="table-of-contents__link toc-highlight">◉ Transfer ownership via parameter/argument</a></li></ul></li><li><a href="#a347-clone-data" class="table-of-contents__link toc-highlight">A.34.7. Clone data</a></li><li><a href="#a348-ownership-pada-data-literal" class="table-of-contents__link toc-highlight">A.34.8. Ownership pada data literal</a></li><li><a href="#a349-move-semantics-pada-macro-println" class="table-of-contents__link toc-highlight">A.34.9. <em>Move semantics</em> pada macro <code>println</code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/package-crate.html b/basic/package-crate.html index 5f9cf021..76a484b5 100644 --- a/basic/package-crate.html +++ b/basic/package-crate.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/package-crate/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/package-crate/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.19. Module System ➜ Package & Crate","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/package-crate/#webpage"},"wordCount":911,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/package-crate/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/package-crate/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/package-crate","name":"A.19. Module System ➜ Package & Crate","description":"Chapter ini membahas mengenai konsep package dan path dalam Rust programming. Pembelajaran dimulai dari pembahasan mengenai konsep crate terlebih dahulu, kemudian masuk ke package.","datePublished":"2024-08-01T10:17:29.734Z","dateModified":"2024-08-01T10:17:29.734Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/package-crate/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/package-crate"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/package-crate/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.19. Module System ➜ Package & Crate","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/package-crate/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/package-crate/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.19. Module System ➜ Package & Crate","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/package-crate/#webpage"},"wordCount":911,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/package-crate/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/package-crate/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/package-crate","name":"A.19. Module System ➜ Package & Crate","description":"Chapter ini membahas mengenai konsep package dan path dalam Rust programming. Pembelajaran dimulai dari pembahasan mengenai konsep crate terlebih dahulu, kemudian masuk ke package.","datePublished":"2024-08-30T07:44:49.812Z","dateModified":"2024-08-30T07:44:49.812Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/package-crate/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/package-crate"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/package-crate/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.19. Module System ➜ Package & Crate","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.19. Module System ➜ Package & Crate</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.19. Module System ➜ Package & Crate</h1></header><p>Chapter ini membahas mengenai konsep package dan path dalam Rust programming. Pembelajaran dimulai dari pembahasan mengenai konsep crate terlebih dahulu, kemudian masuk ke package.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a191-rust-crate">A.19.1. Rust Crate<a class="hash-link" href="#a191-rust-crate" title="Direct link to heading">​</a></h2><p><strong>Crate</strong> adalah satu unit kompilasi di Rust. Eksekusi command <code>cargo run</code>, <code>cargo build</code>, atau <code>rustc</code> men-<em>trigger</em> proses kompilasi, dan unit (yang di sini disebut dengan crate) akan di-compile.</p><p>Crate bisa berisi banyak <em>module</em>. Sebuah module definisinya bisa berada di banyak file. Agar lebih jelas silakan perhatikan contoh berikut:</p><ul><li><code>XYZ</code> adalah sebuah crate, isinya ada dua module, yaitu module <code>Mod_ABC</code> dan module <code>Mod_DEF</code>.</li><li><code>Mod_ABC</code> adalah module yang didefinisikan dalam crate <code>XYZ</code>, source code-nya berada di file bernama <code>modul_a.rs</code>.</li><li><code>Mod_DEF</code> adalah module yang didefinisikan dalam crate <code>XYZ</code>, source code-nya berada di beberapa file <code>module_b_one.rs</code> dan <code>module_b_two.rs</code>.</li></ul><p>Dari contoh di atas, crate <code>XYZ</code> adalah 1 unit kompilasi, yang mana di dalam crate tersebut ada dua modules yaitu <code>Mod_ABC</code> dan <code>Mod_DEF</code></p><p>Rust mengkategorikan crate menjadi 2 jenis, <em>binary crate</em> dan <em>library crate</em></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-binary-crate">◉ Binary crate<a class="hash-link" href="#-binary-crate" title="Direct link to heading">​</a></h3><p>Binary crate adalah program yang dikompilasi ke bentuk <em>executable</em>, untuk kemudian dijalankan, seperti program-program yang sudah kita buat menggunakan <code>cargo create</code> dan run menggunakan <code>cargo run</code> itu adalah contoh dari binary crate.</p><p>Binary crate berada dalam sebuah package yang dibuat menggunakan command <code>cargo create <nama_package></code> atau <code>cargo create --bin <nama_package></code>, kedua command ini menjalankan perintah yang sama.</p><p>Ciri khas dari binary crate adalah memiliki fungsi <code>main</code>, sebuah fungsi yang merupakan <em>entrypoint</em> program.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-library-crate">◉ Library crate<a class="hash-link" href="#-library-crate" title="Direct link to heading">​</a></h3><p>Library crate berbeda dengan binary crate. Library crate tidak di-compile ke bentuk <em>executable</em> dan tidak memiliki fungsi <code>main</code>. Library crate digunakan untuk mendefinisikan set <em>functionality</em> yang <em>reusable</em> atau bisa digunakan di banyak project/package.</p><blockquote><p>Library crate di-import/digunakan dalam binary crate. Dalam proses kompilasinya, yang di-compile adalah binary crate. Library crate juga akan ikut dalam kompilasi tersebut.</p></blockquote><p>Sebagai contoh item <code>Duration</code> (yang sudah dipraktikkan pada chapter <a href="/basic/perulangan-while">Perulangan ➜ while</a>) dan <code>stdin</code> (pada chapter <a href="/basic/path-item">Module System ➜ Path & Item</a>) adalah dua buah item milik crate <em>Rust Standard Library</em> atau <code>std</code>. Crate <code>std</code> ini akan sangat sering kita gunakan dalam package/project, isinya banyak sekali functionality untuk keperluan standar dalam Rust programming.</p><blockquote><p>Di komunitas Rust, ketika ada kata <em>library</em> atau <em>crate</em> maka yang dimaksud biasanya adalah <em>library crate</em></p></blockquote><p>Kita bisa membuat library crate kemudian di-publish ke <a href="https://crates.io/" target="_blank" rel="noopener noreferrer">crates.io</a> agar bisa digunakan banyak orang. Command <code>cargo new --lib <nama_package></code> digunakan untuk membuat library crate.</p><blockquote><p>Lebih jelasnya mengenai library crate dibahas terpisah pada chapter <a href="#/wip/library-crate">Library Crate</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a192-rust-package">A.19.2. Rust Package<a class="hash-link" href="#a192-rust-package" title="Direct link to heading">​</a></h2><p>Istilah package dalam Rust programming masih sama dengan package dalam pemrograman lain. Package adalah sebuah set yang berisi banyak <em>functionality</em>. Satu buah package bisa berisi satu atau banyak crates.</p><p>Package di-manage oleh Cargo, yang merupakan package manager Rust. Command <code>cargo new <nama_package></code> digunakan untuk membuat package. Command tersebut menghasilkan beberapa file yaitu <code>src/main.rs</code> yang isinya adalah kode program, dan juga file <code>Cargo.toml</code> yang isinya adalah informasi mengenai package tersebut.</p><p>Ok, sekalian praktik mungkin lebih pas. Silakan jalankan command berikut, kemudian ikuti penjelasan selanjutnya.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">cargo</span><span class="token plain"> new belajar_package_crate</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-naming-convention-package">◉ <em>Naming convention</em> package<a class="hash-link" href="#-naming-convention-package" title="Direct link to heading">​</a></h3><p>Khusus untuk penamaan package dan juga crate, tidak ada rekomendasi dari dokumentasi official Rust. Pada ebook ini penulis menggunakan <em>snake case</em> sebagai naming convention dalam pembuatan package.</p><p>Referensi: <a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">https://rust-lang.github.io/api-guidelines/naming.html</a></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-file-cargotoml">◉ File <code>Cargo.toml</code><a class="hash-link" href="#-file-cargotoml" title="Direct link to heading">​</a></h3><p>File <code>Cargo.toml</code> menampung beberapa informasi penting milik package, di antaranya adalah nama package, versi package dan juga versi rust, serta <em>dependencies</em> atau <em>3rd-party</em> yang digunakan dalam package (dalam konteks Rust adalah <em>crate</em>).</p><p>Command yang sebelumnya di-run menghasilkan file <code>Cargo.toml</code> berikut:</p><div class="language-toml codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">Cargo.toml</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-toml codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">[</span><span class="token table class-name">package</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">name</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"belajar_package_crate"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">version</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.1.0"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">edition</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"2021"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">[</span><span class="token table class-name">dependencies</span><span class="token punctuation" style="color:#393A34">]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Blok <code>package</code> berisi berisi 3 buah field:</p><ul><li><code>name</code> isinya adalah nama package, sesuai dengan argument command <code>cargo new <nama_package></code>.</li><li><code>version</code> default-nya selalu <code>0.1.0</code>, namun kita bisa ubah nilainya seiring berjalannya proses pengembangan aplikasi.</li><li><code>edition</code> di sini me-refer ke edisi rust yang dipakai. Di ebook ini, rust versi <strong>1.65.0</strong> digunakan, dan edisi untuk versi tersebut adalah <code>2021</code>.</li></ul><p>Blok <code>dependencies</code> default-nya berisi kosong. Jika kita menambahkan external dependencies atau crates, maka detailnya tercatat pada blok <code>dependencies</code> ini.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-website-cratesio">◉ Website <a href="https://crates.io/" target="_blank" rel="noopener noreferrer">crates.io</a><a class="hash-link" href="#-website-cratesio" title="Direct link to heading">​</a></h3><p><strong>crates.io</strong> merupakan official website dari Rust untuk pencarian dan juga <em>managing</em> dependency. Silakan manfaatkan website tersebut untuk mencari crates sesuai kebutuhan.</p><blockquote><p><a href="https://crates.io/" target="_blank" rel="noopener noreferrer">https://crates.io/</a></p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-menambahkan-dependency-atau-external-crate">◉ Menambahkan dependency atau external crate<a class="hash-link" href="#-menambahkan-dependency-atau-external-crate" title="Direct link to heading">​</a></h3><p>proses pembelajaran akan dilanjutkan sambil praktik. Pada bagian ini kita akan buat program sederhana yang di dalamnya memanfaatkan sebuah dependency atau external crate.</p><p>Pertama-tama buka <a href="https://crates.io/" target="_blank" rel="noopener noreferrer">crates.io</a>, lalu gunakan keyword <code>rand</code> dalam pencarian, hasilnya adalah dependency bernama <code>rand</code>.</p><p><img loading="lazy" alt="package crate" src="/assets/images/package-crate-1-bc29d1ca7bd36fcd767c54466152bf67.png" width="814" height="429" class="img_ev3q"></p><p><code>rand</code> merupakan crate yang isinya banyak fungsi untuk keperluan <em>generate</em> data random.</p><p>Sekarang buka file <code>Cargo.toml</code>, dan tambahkan dependency <code>rand</code>. Sesuaikan dengan versi yang muncul di layar masing-masing.</p><div class="language-toml codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">Cargo.toml</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-toml codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">[</span><span class="token table class-name">package</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">name</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"package_crate"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">version</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.1.0"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">edition</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"2021"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">[</span><span class="token table class-name">dependencies</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">rand</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.8.5"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan command <code>cargo build</code> untuk memaksa Cargo agar mendownload depdency yang sudah ditambahkan ke file <code>Cargo.toml</code>.</p><p><img loading="lazy" alt="cargo download dependency" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbgAAACsCAIAAACGmC7dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF5WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0c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cK1tzq94piNvW98NFas/vOR1RGkygpScWpChYdavKn1Bhfx7SJ2S1dlaeahgmZ0b4b7GFcVXN/ejZuo8NbkkXsExe+Mua54yu6jnKKxKgBJR7/SbWtkxe+Mua64zm35kDKNGIi3nOvd6Aco7vYvFN2Cvt9Z7tjGbe6w0oEUIIUCKEEAKUCCEEKBFCCFAihBCgRAghQIkQQoASIYRuV/8HYsSFVVykzkwAAAAASUVORK5CYII=" width="440" height="172" class="img_ev3q"></p><p>Sukses! Sekarang dependency <code>rand</code> sudah bisa digunakan dalam package yang sudah dibuat.</p><blockquote><p>Jika pembaca menemui error <code>failed to authenticate when downloading repository</code>, jalankan beberapa command berikut secara berurutan:</p><ul><li><code>ssh-agent -s</code></li><li><code>ssh-add</code></li><li><code>cargo build</code></li></ul></blockquote><p>Jadi kurang lebih seperti itu cara menambahkan dependency di Rust. Seiring berjalannya proses pembelajaran penulis yakin pembaca akan terbiasa dengan flow dan juga command di atas.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-command-cargo-add">◉ Command <code>cargo add</code><a class="hash-link" href="#-command-cargo-add" title="Direct link to heading">​</a></h3><p>Selain cara di atas, ada cara lain yang lebih ringkas untuk penambahan package, yaitu menggunakan command <code>cargo add <nama_crate></code>. Command ini secara otomatis menambahkan package yang diinginkan ke file <code>Cargo.toml</code> kemudian mengunduhnya.</p><ul><li><p>Menambahkan package <code>rand</code> versi terbaru</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">cargo add rand</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Menambahkan package <code>rand</code> versi <code>0.8.5</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">cargo add rand</span><span class="token operator" style="color:#393A34">@</span><span class="token number" style="color:#36acaa">0.8</span><span class="token punctuation" style="color:#393A34">.</span><span class="token number" style="color:#36acaa">5</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a193-praktik-membuat-program-menampilkan-angka-random">A.19.3. Praktik membuat program menampilkan angka random<a class="hash-link" href="#a193-praktik-membuat-program-menampilkan-angka-random" title="Direct link to heading">​</a></h2><p>Ok, sekarang kita lanjutkan praktik pembuatan program sederhana untuk menampilkan angka random.</p><p>Angka random di sini akan di-generate menggunakan fungsi yang ada dalam dependency <code>rand</code> yang sudah ditambahkan ke package.</p><p>Silakan tulis kode berikut ke file <code>src/main.rs</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">rand</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Rng</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">generate_random_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">rand</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">thread_rng</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">gen_range</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">100</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"random number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> i</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">generate_random_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program, lalu lihat hasilnya. Sejumlah data angka random muncul di layar output.</p><p><img loading="lazy" alt="rand crate" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAccAAACeCAIAAADIaFZuAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3d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QVAABVHRFcqwEAVUVV7bn2ea5UdK3WrawBAFVdtKoGT421raXoWp2wsgaAY1ZVXKsNrtVh1BmYx3RxrdatrAHg6FUV1+pVCz+qTqoauVarVtYAsARVxbXaHC52mQCQXKs1K2sAWMgMgBwv4lottErPxarKtVrbCABLVFVcqzVJHSCedFa+MhsBYFGqimu1TVIHcK0e5BUDADDrGQBcq7UL+OFcq/veAQsAM1VVAABAVQEAUFUAAFQVAABQVQAAVBUAAFUFAEBVRwTXagBAVVFVa9VuOt+zr7gQAACqSqw6wOOlOFQDLFxVca1u71odGKO2UkmMVAFugariWt0iBg0L3t5dhUAVYPmqimt1XvCaULeHKhKoAtyaGQBdQ3CtForXTRpx/AO4taqKa/UYV/EsUwHcblXFtdomjtZ5VQJVgFs9A4BrdWJCxJdQm6p2f+MVABybqgIAAKoKAICqAgCgqgAAgKoCAKCqAACoKgAAqjoiuFYDAKqKqrbN+6brU676QwR9TVsAAFU9SlUtcr7uUMngobPQJREAFqWquFYbXavLB/n7+au6NgK+OyEALEhVca1eZd1P6q8HU9UioysmAAAWqaq4VudmDpri9pvmaI7YmIFFvQAAC5gBkONFXKvjNuqhqt48aiDi3LkAsGhVxbVamiTxaSuBhaQGrxEMfApRVYBFqyqu1bb2Ms2rRpIatDLvCQBY+gwArtWDqmoU7Da3VbBYBbA4VQUAAFQVAABVBQBAVQEAAFUFAEBVAQBQVQAAVBUAAFBVAABUFQAAVQUAAFQVAGAq/g8/e2sVyxh7AgAAAABJRU5ErkJggg==" width="455" height="158" class="img_ev3q"></p><p>Silakan coba untuk run beberapa kali, angka random berbeda setiap kali run.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-fungsi-generate_random_number">◉ Fungsi <code>generate_random_number</code><a class="hash-link" href="#-fungsi-generate_random_number" title="Direct link to heading">​</a></h3><p><code>generate_random_number</code> adalah fungsi yang kita buat, yang tugasnya mengembalikan sebuah nilai numerik bertipe <code>i32</code>. Angka tersebut berasal dari proses <em>generate random</em> hasil eksekusi statement <code>rand::thread_rng().gen_range(0..100)</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-statement-randthread_rnggen_range0100">◉ Statement <code>rand::thread_rng().gen_range(0..100)</code><a class="hash-link" href="#-statement-randthread_rnggen_range0100" title="Direct link to heading">​</a></h3><p><code>rand::thread_rng().gen_range</code> digunakan untuk generate data random. Fungsi <code>gen_range</code> menerima argument bertipe range, dan angka random akan di-generate sesuai range tersebut. Sebagai contoh, range <code>0..100</code> menghasilkan angka random antara <code>0</code> hingga <code>99</code>.</p><p>O iya, penggunaan fungsi <code>gen_range</code> mewajibkan kita untuk import path <code>rand::Rng</code>. Itulah kenapa ada statement <code>use rand::Rng</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-fungsi-main">◉ Fungsi <code>main</code><a class="hash-link" href="#-fungsi-main" title="Direct link to heading">​</a></h3><p>Dalam blok kode <code>main</code>, isinya sebuah perulangan sederhana yang menampilkan angka random hasil eksekusi fungsi <code>generate_random_number</code> di setiap iterasinya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"random number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> i</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">generate_random_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a194-pembahasan-lanjutan">A.19.4. Pembahasan lanjutan<a class="hash-link" href="#a194-pembahasan-lanjutan" title="Direct link to heading">​</a></h2><p>Sekian pembahasan mengenai package dan crate. Semoga membantu, silakan diulang-ulang jika perlu agar tidak bingung, <strong>module system</strong> merupakan salah satu hal yang sangat penting di Rust.</p><p>Masih dalam topik <em>module system</em>, penulis anjurkan untuk lanjut ke chapter berikutnya karena berkaitan.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/package_crate" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../package_crate</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/crates.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/crates.html</a></li><li><a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">https://rust-lang.github.io/api-guidelines/naming.html</a></li><li><a href="https://aloso.github.io/2021/03/28/module-system.html" target="_blank" rel="noopener noreferrer">https://aloso.github.io/2021/03/28/module-system.html</a></li><li><a href="https://github.com/rust-lang/cargo/issues/3381" target="_blank" rel="noopener noreferrer">https://github.com/rust-lang/cargo/issues/3381</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/path-item"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.18. Module System ➜ Path & Item</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/module-basic"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.20. Module System ➜ Module</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a191-rust-crate" class="table-of-contents__link toc-highlight">A.19.1. Rust Crate</a><ul><li><a href="#-binary-crate" class="table-of-contents__link toc-highlight">◉ Binary crate</a></li><li><a href="#-library-crate" class="table-of-contents__link toc-highlight">◉ Library crate</a></li></ul></li><li><a href="#a192-rust-package" class="table-of-contents__link toc-highlight">A.19.2. Rust Package</a><ul><li><a href="#-naming-convention-package" class="table-of-contents__link toc-highlight">◉ <em>Naming convention</em> package</a></li><li><a href="#-file-cargotoml" class="table-of-contents__link toc-highlight">◉ File <code>Cargo.toml</code></a></li><li><a href="#-website-cratesio" class="table-of-contents__link toc-highlight">◉ Website crates.io</a></li><li><a href="#-menambahkan-dependency-atau-external-crate" class="table-of-contents__link toc-highlight">◉ Menambahkan dependency atau external crate</a></li><li><a href="#-command-cargo-add" class="table-of-contents__link toc-highlight">◉ Command <code>cargo add</code></a></li></ul></li><li><a href="#a193-praktik-membuat-program-menampilkan-angka-random" class="table-of-contents__link toc-highlight">A.19.3. Praktik membuat program menampilkan angka random</a><ul><li><a href="#-fungsi-generate_random_number" class="table-of-contents__link toc-highlight">◉ Fungsi <code>generate_random_number</code></a></li><li><a href="#-statement-randthread_rnggen_range0100" class="table-of-contents__link toc-highlight">◉ Statement <code>rand::thread_rng().gen_range(0..100)</code></a></li><li><a href="#-fungsi-main" class="table-of-contents__link toc-highlight">◉ Fungsi <code>main</code></a></li></ul></li><li><a href="#a194-pembahasan-lanjutan" class="table-of-contents__link toc-highlight">A.19.4. Pembahasan lanjutan</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.19. Module System ➜ Package & Crate</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.19. Module System ➜ Package & Crate</h1></header><p>Chapter ini membahas mengenai konsep package dan path dalam Rust programming. Pembelajaran dimulai dari pembahasan mengenai konsep crate terlebih dahulu, kemudian masuk ke package.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a191-rust-crate">A.19.1. Rust Crate<a class="hash-link" href="#a191-rust-crate" title="Direct link to heading">​</a></h2><p><strong>Crate</strong> adalah satu unit kompilasi di Rust. Eksekusi command <code>cargo run</code>, <code>cargo build</code>, atau <code>rustc</code> men-<em>trigger</em> proses kompilasi, dan unit (yang di sini disebut dengan crate) akan di-compile.</p><p>Crate bisa berisi banyak <em>module</em>. Sebuah module definisinya bisa berada di banyak file. Agar lebih jelas silakan perhatikan contoh berikut:</p><ul><li><code>XYZ</code> adalah sebuah crate, isinya ada dua module, yaitu module <code>Mod_ABC</code> dan module <code>Mod_DEF</code>.</li><li><code>Mod_ABC</code> adalah module yang didefinisikan dalam crate <code>XYZ</code>, source code-nya berada di file bernama <code>modul_a.rs</code>.</li><li><code>Mod_DEF</code> adalah module yang didefinisikan dalam crate <code>XYZ</code>, source code-nya berada di beberapa file <code>module_b_one.rs</code> dan <code>module_b_two.rs</code>.</li></ul><p>Dari contoh di atas, crate <code>XYZ</code> adalah 1 unit kompilasi, yang mana di dalam crate tersebut ada dua modules yaitu <code>Mod_ABC</code> dan <code>Mod_DEF</code></p><p>Rust mengkategorikan crate menjadi 2 jenis, <em>binary crate</em> dan <em>library crate</em></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-binary-crate">◉ Binary crate<a class="hash-link" href="#-binary-crate" title="Direct link to heading">​</a></h3><p>Binary crate adalah program yang dikompilasi ke bentuk <em>executable</em>, untuk kemudian dijalankan, seperti program-program yang sudah kita buat menggunakan <code>cargo create</code> dan run menggunakan <code>cargo run</code> itu adalah contoh dari binary crate.</p><p>Binary crate berada dalam sebuah package yang dibuat menggunakan command <code>cargo create <nama_package></code> atau <code>cargo create --bin <nama_package></code>, kedua command ini menjalankan perintah yang sama.</p><p>Ciri khas dari binary crate adalah memiliki fungsi <code>main</code>, sebuah fungsi yang merupakan <em>entrypoint</em> program.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-library-crate">◉ Library crate<a class="hash-link" href="#-library-crate" title="Direct link to heading">​</a></h3><p>Library crate berbeda dengan binary crate. Library crate tidak di-compile ke bentuk <em>executable</em> dan tidak memiliki fungsi <code>main</code>. Library crate digunakan untuk mendefinisikan set <em>functionality</em> yang <em>reusable</em> atau bisa digunakan di banyak project/package.</p><blockquote><p>Library crate di-import/digunakan dalam binary crate. Dalam proses kompilasinya, yang di-compile adalah binary crate. Library crate juga akan ikut dalam kompilasi tersebut.</p></blockquote><p>Sebagai contoh item <code>Duration</code> (yang sudah dipraktikkan pada chapter <a href="/basic/perulangan-while">Perulangan ➜ while</a>) dan <code>stdin</code> (pada chapter <a href="/basic/path-item">Module System ➜ Path & Item</a>) adalah dua buah item milik crate <em>Rust Standard Library</em> atau <code>std</code>. Crate <code>std</code> ini akan sangat sering kita gunakan dalam package/project, isinya banyak sekali functionality untuk keperluan standar dalam Rust programming.</p><blockquote><p>Di komunitas Rust, ketika ada kata <em>library</em> atau <em>crate</em> maka yang dimaksud biasanya adalah <em>library crate</em></p></blockquote><p>Kita bisa membuat library crate kemudian di-publish ke <a href="https://crates.io/" target="_blank" rel="noopener noreferrer">crates.io</a> agar bisa digunakan banyak orang. Command <code>cargo new --lib <nama_package></code> digunakan untuk membuat library crate.</p><blockquote><p>Lebih jelasnya mengenai library crate dibahas terpisah pada chapter <a href="#/wip/library-crate">Library Crate</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a192-rust-package">A.19.2. Rust Package<a class="hash-link" href="#a192-rust-package" title="Direct link to heading">​</a></h2><p>Istilah package dalam Rust programming masih sama dengan package dalam pemrograman lain. Package adalah sebuah set yang berisi banyak <em>functionality</em>. Satu buah package bisa berisi satu atau banyak crates.</p><p>Package di-manage oleh Cargo, yang merupakan package manager Rust. Command <code>cargo new <nama_package></code> digunakan untuk membuat package. Command tersebut menghasilkan beberapa file yaitu <code>src/main.rs</code> yang isinya adalah kode program, dan juga file <code>Cargo.toml</code> yang isinya adalah informasi mengenai package tersebut.</p><p>Ok, sekalian praktik mungkin lebih pas. Silakan jalankan command berikut, kemudian ikuti penjelasan selanjutnya.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">cargo</span><span class="token plain"> new belajar_package_crate</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-naming-convention-package">◉ <em>Naming convention</em> package<a class="hash-link" href="#-naming-convention-package" title="Direct link to heading">​</a></h3><p>Khusus untuk penamaan package dan juga crate, tidak ada rekomendasi dari dokumentasi official Rust. Pada ebook ini penulis menggunakan <em>snake case</em> sebagai naming convention dalam pembuatan package.</p><p>Referensi: <a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">https://rust-lang.github.io/api-guidelines/naming.html</a></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-file-cargotoml">◉ File <code>Cargo.toml</code><a class="hash-link" href="#-file-cargotoml" title="Direct link to heading">​</a></h3><p>File <code>Cargo.toml</code> menampung beberapa informasi penting milik package, di antaranya adalah nama package, versi package dan juga versi rust, serta <em>dependencies</em> atau <em>3rd-party</em> yang digunakan dalam package (dalam konteks Rust adalah <em>crate</em>).</p><p>Command yang sebelumnya di-run menghasilkan file <code>Cargo.toml</code> berikut:</p><div class="language-toml codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">Cargo.toml</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-toml codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">[</span><span class="token table class-name">package</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">name</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"belajar_package_crate"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">version</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.1.0"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">edition</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"2021"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">[</span><span class="token table class-name">dependencies</span><span class="token punctuation" style="color:#393A34">]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Blok <code>package</code> berisi berisi 3 buah field:</p><ul><li><code>name</code> isinya adalah nama package, sesuai dengan argument command <code>cargo new <nama_package></code>.</li><li><code>version</code> default-nya selalu <code>0.1.0</code>, namun kita bisa ubah nilainya seiring berjalannya proses pengembangan aplikasi.</li><li><code>edition</code> di sini me-refer ke edisi rust yang dipakai. Di ebook ini, rust versi <strong>1.65.0</strong> digunakan, dan edisi untuk versi tersebut adalah <code>2021</code>.</li></ul><p>Blok <code>dependencies</code> default-nya berisi kosong. Jika kita menambahkan external dependencies atau crates, maka detailnya tercatat pada blok <code>dependencies</code> ini.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-website-cratesio">◉ Website <a href="https://crates.io/" target="_blank" rel="noopener noreferrer">crates.io</a><a class="hash-link" href="#-website-cratesio" title="Direct link to heading">​</a></h3><p><strong>crates.io</strong> merupakan official website dari Rust untuk pencarian dan juga <em>managing</em> dependency. Silakan manfaatkan website tersebut untuk mencari crates sesuai kebutuhan.</p><blockquote><p><a href="https://crates.io/" target="_blank" rel="noopener noreferrer">https://crates.io/</a></p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-menambahkan-dependency-atau-external-crate">◉ Menambahkan dependency atau external crate<a class="hash-link" href="#-menambahkan-dependency-atau-external-crate" title="Direct link to heading">​</a></h3><p>proses pembelajaran akan dilanjutkan sambil praktik. Pada bagian ini kita akan buat program sederhana yang di dalamnya memanfaatkan sebuah dependency atau external crate.</p><p>Pertama-tama buka <a href="https://crates.io/" target="_blank" rel="noopener noreferrer">crates.io</a>, lalu gunakan keyword <code>rand</code> dalam pencarian, hasilnya adalah dependency bernama <code>rand</code>.</p><p><img loading="eager" fetchpriority="high" alt="package crate" src="/assets/images/package-crate-1-bc29d1ca7bd36fcd767c54466152bf67.png" width="814" height="429" class="img_CujE"></p><p><code>rand</code> merupakan crate yang isinya banyak fungsi untuk keperluan <em>generate</em> data random.</p><p>Sekarang buka file <code>Cargo.toml</code>, dan tambahkan dependency <code>rand</code>. Sesuaikan dengan versi yang muncul di layar masing-masing.</p><div class="language-toml codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">Cargo.toml</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-toml codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">[</span><span class="token table class-name">package</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">name</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"package_crate"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">version</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.1.0"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">edition</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"2021"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">[</span><span class="token table class-name">dependencies</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token key property" style="color:#36acaa">rand</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.8.5"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan command <code>cargo build</code> untuk memaksa Cargo agar mendownload depdency yang sudah ditambahkan ke file <code>Cargo.toml</code>.</p><p><img loading="lazy" alt="cargo download dependency" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbgAAACsCAIAAACGmC7dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF5WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YS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p7lPd91kpNoI3vqElvqy1wKLL0ZxqTmX55jP2+xOzjNgpfTURpA6XnSOQNvf3sf97/GvsMeXu9y0GpOdrG5rULgVKxJhUMhhcDpXfbFfgn2kaaWlrz1yFbvSbC9sAyeTooEz61o0EpOS6rL04wm0BnvPik2YSMT/hioMyjLWkJHGdPnNFWQNmreTtuP6BORpRulmmgFL8t8YVQC0eUUqy0eEQZzAOpnsWrRJS6lWfkuKwPvRVCzxNRhtgZB0rV71l+BYjZBLr8rYdJ1+HFQJl/b2bckPAtaFr2giWemwXlYPGbMDO/V7J07hjqHKVo5Kn+YYvMa8tAGRmjqkNF0ZpUHHCY3tRZBErrsCzl6jp2jtL+dYhWr1InF8y9mUGZ8ak1gTLKJjsu6y9wtEZjYr9nnygYcUZTQKliLrq2QnfmYdkqM2K/TlDaTXYNxr2+fXrEWckPuIlDfbt1/d4MjTwzTqK2qRZ1YDUYoxpWafMOu8Fap+SrKoFScWDVbFmlBshdN+1itX4dSodI7rNZp9jcK1tzq94piNvW98NFas/vOR1RGkygpScWpChYdavKn1Bhfx7SJ2S1dlaeahgmZ0b4b7GFcVXN/ejZuo8NbkkXsExe+Mua54yu6jnKKxKgBJR7/SbWtkxe+Mua64zm35kDKNGIi3nOvd6Aco7vYvFN2Cvt9Z7tjGbe6w0oEUIIUCKEEAKUCCEEKBFCCFAihBCgRAghQIkQQoASIYRuV/8HYsSFVVykzkwAAAAASUVORK5CYII=" width="440" height="172" class="img_CujE"></p><p>Sukses! Sekarang dependency <code>rand</code> sudah bisa digunakan dalam package yang sudah dibuat.</p><blockquote><p>Jika pembaca menemui error <code>failed to authenticate when downloading repository</code>, jalankan beberapa command berikut secara berurutan:</p><ul><li><code>ssh-agent -s</code></li><li><code>ssh-add</code></li><li><code>cargo build</code></li></ul></blockquote><p>Jadi kurang lebih seperti itu cara menambahkan dependency di Rust. Seiring berjalannya proses pembelajaran penulis yakin pembaca akan terbiasa dengan flow dan juga command di atas.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-command-cargo-add">◉ Command <code>cargo add</code><a class="hash-link" href="#-command-cargo-add" title="Direct link to heading">​</a></h3><p>Selain cara di atas, ada cara lain yang lebih ringkas untuk penambahan package, yaitu menggunakan command <code>cargo add <nama_crate></code>. Command ini secara otomatis menambahkan package yang diinginkan ke file <code>Cargo.toml</code> kemudian mengunduhnya.</p><ul><li><p>Menambahkan package <code>rand</code> versi terbaru</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">cargo add rand</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Menambahkan package <code>rand</code> versi <code>0.8.5</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">cargo add rand</span><span class="token operator" style="color:#393A34">@</span><span class="token number" style="color:#36acaa">0.8</span><span class="token punctuation" style="color:#393A34">.</span><span class="token number" style="color:#36acaa">5</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a193-praktik-membuat-program-menampilkan-angka-random">A.19.3. Praktik membuat program menampilkan angka random<a class="hash-link" href="#a193-praktik-membuat-program-menampilkan-angka-random" title="Direct link to heading">​</a></h2><p>Ok, sekarang kita lanjutkan praktik pembuatan program sederhana untuk menampilkan angka random.</p><p>Angka random di sini akan di-generate menggunakan fungsi yang ada dalam dependency <code>rand</code> yang sudah ditambahkan ke package.</p><p>Silakan tulis kode berikut ke file <code>src/main.rs</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">rand</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Rng</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">generate_random_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">rand</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">thread_rng</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">gen_range</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">100</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"random number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> i</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">generate_random_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program, lalu lihat hasilnya. Sejumlah data angka random muncul di layar output.</p><p><img loading="lazy" alt="rand crate" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAccAAACeCAIAAADIaFZuAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEg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n7+au6NgK+OyEALEhVca1eZd1P6q8HU9UioysmAAAWqaq4VudmDpri9pvmaI7YmIFFvQAAC5gBkONFXKvjNuqhqt48aiDi3LkAsGhVxbVamiTxaSuBhaQGrxEMfApRVYBFqyqu1bb2Ms2rRpIatDLvCQBY+gwArtWDqmoU7Da3VbBYBbA4VQUAAFQVAABVBQBAVQEAAFUFAEBVAQBQVQAAVBUAAFBVAABUFQAAVQUAAFQVAGAq/g8/e2sVyxh7AgAAAABJRU5ErkJggg==" width="455" height="158" class="img_CujE"></p><p>Silakan coba untuk run beberapa kali, angka random berbeda setiap kali run.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-fungsi-generate_random_number">◉ Fungsi <code>generate_random_number</code><a class="hash-link" href="#-fungsi-generate_random_number" title="Direct link to heading">​</a></h3><p><code>generate_random_number</code> adalah fungsi yang kita buat, yang tugasnya mengembalikan sebuah nilai numerik bertipe <code>i32</code>. Angka tersebut berasal dari proses <em>generate random</em> hasil eksekusi statement <code>rand::thread_rng().gen_range(0..100)</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-statement-randthread_rnggen_range0100">◉ Statement <code>rand::thread_rng().gen_range(0..100)</code><a class="hash-link" href="#-statement-randthread_rnggen_range0100" title="Direct link to heading">​</a></h3><p><code>rand::thread_rng().gen_range</code> digunakan untuk generate data random. Fungsi <code>gen_range</code> menerima argument bertipe range, dan angka random akan di-generate sesuai range tersebut. Sebagai contoh, range <code>0..100</code> menghasilkan angka random antara <code>0</code> hingga <code>99</code>.</p><p>O iya, penggunaan fungsi <code>gen_range</code> mewajibkan kita untuk import path <code>rand::Rng</code>. Itulah kenapa ada statement <code>use rand::Rng</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-fungsi-main">◉ Fungsi <code>main</code><a class="hash-link" href="#-fungsi-main" title="Direct link to heading">​</a></h3><p>Dalam blok kode <code>main</code>, isinya sebuah perulangan sederhana yang menampilkan angka random hasil eksekusi fungsi <code>generate_random_number</code> di setiap iterasinya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"random number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> i</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">generate_random_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a194-pembahasan-lanjutan">A.19.4. Pembahasan lanjutan<a class="hash-link" href="#a194-pembahasan-lanjutan" title="Direct link to heading">​</a></h2><p>Sekian pembahasan mengenai package dan crate. Semoga membantu, silakan diulang-ulang jika perlu agar tidak bingung, <strong>module system</strong> merupakan salah satu hal yang sangat penting di Rust.</p><p>Masih dalam topik <em>module system</em>, penulis anjurkan untuk lanjut ke chapter berikutnya karena berkaitan.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/package_crate" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../package_crate</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/crates.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/crates.html</a></li><li><a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">https://rust-lang.github.io/api-guidelines/naming.html</a></li><li><a href="https://aloso.github.io/2021/03/28/module-system.html" target="_blank" rel="noopener noreferrer">https://aloso.github.io/2021/03/28/module-system.html</a></li><li><a href="https://github.com/rust-lang/cargo/issues/3381" target="_blank" rel="noopener noreferrer">https://github.com/rust-lang/cargo/issues/3381</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/path-item"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.18. Module System ➜ Path & Item</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/module-basic"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.20. Module System ➜ Module</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a191-rust-crate" class="table-of-contents__link toc-highlight">A.19.1. Rust Crate</a><ul><li><a href="#-binary-crate" class="table-of-contents__link toc-highlight">◉ Binary crate</a></li><li><a href="#-library-crate" class="table-of-contents__link toc-highlight">◉ Library crate</a></li></ul></li><li><a href="#a192-rust-package" class="table-of-contents__link toc-highlight">A.19.2. Rust Package</a><ul><li><a href="#-naming-convention-package" class="table-of-contents__link toc-highlight">◉ <em>Naming convention</em> package</a></li><li><a href="#-file-cargotoml" class="table-of-contents__link toc-highlight">◉ File <code>Cargo.toml</code></a></li><li><a href="#-website-cratesio" class="table-of-contents__link toc-highlight">◉ Website crates.io</a></li><li><a href="#-menambahkan-dependency-atau-external-crate" class="table-of-contents__link toc-highlight">◉ Menambahkan dependency atau external crate</a></li><li><a href="#-command-cargo-add" class="table-of-contents__link toc-highlight">◉ Command <code>cargo add</code></a></li></ul></li><li><a href="#a193-praktik-membuat-program-menampilkan-angka-random" class="table-of-contents__link toc-highlight">A.19.3. Praktik membuat program menampilkan angka random</a><ul><li><a href="#-fungsi-generate_random_number" class="table-of-contents__link toc-highlight">◉ Fungsi <code>generate_random_number</code></a></li><li><a href="#-statement-randthread_rnggen_range0100" class="table-of-contents__link toc-highlight">◉ Statement <code>rand::thread_rng().gen_range(0..100)</code></a></li><li><a href="#-fungsi-main" class="table-of-contents__link toc-highlight">◉ Fungsi <code>main</code></a></li></ul></li><li><a href="#a194-pembahasan-lanjutan" class="table-of-contents__link toc-highlight">A.19.4. Pembahasan lanjutan</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/path-item.html b/basic/path-item.html index 816c7d3e..b8375639 100644 --- a/basic/path-item.html +++ b/basic/path-item.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/path-item/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/path-item/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.18. Module System ➜ Path & Item","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/path-item/#webpage"},"wordCount":817,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/path-item/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/path-item/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/path-item","name":"A.18. Module System ➜ Path & Item","description":"Chapter ini membahas tentang konsep path dan item dalam Rust programming.","datePublished":"2024-08-01T10:17:29.940Z","dateModified":"2024-08-01T10:17:29.940Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/path-item/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/path-item"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/path-item/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.18. Module System ➜ Path & Item","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/path-item/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/path-item/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.18. Module System ➜ Path & Item","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/path-item/#webpage"},"wordCount":817,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/path-item/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/path-item/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/path-item","name":"A.18. Module System ➜ Path & Item","description":"Chapter ini membahas tentang konsep path dan item dalam Rust programming.","datePublished":"2024-08-30T07:44:50.020Z","dateModified":"2024-08-30T07:44:50.020Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/path-item/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/path-item"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/path-item/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.18. Module System ➜ Path & Item","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.18. Module System ➜ Path & Item</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.18. Module System ➜ Path & Item</h1></header><p>Chapter ini membahas tentang konsep <em>path</em> dan <em>item</em> dalam Rust programming.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a181-rust-paths">A.18.1. Rust <em>Paths</em><a class="hash-link" href="#a181-rust-paths" title="Direct link to heading">​</a></h2><p>Paths (atau Path) adalah notasi penulisan alamat sebuah item, contohnya <code>std::time::Duration</code>.</p><p><code>std::time::Duration</code> adalah <em>path</em> untuk item yang isinya adalah <code>struct</code> bernama <code>Duration</code>. Item bisa berupa banyak jenis, bisa saja struct, atau <em>macro</em>, konstanta, atau lainnya. Lebih jelasnya silakan cek pada halaman dokumentasi <code>std::time::Duration</code>.</p><p>Sebuah path bisa memiliki banyak bagian (biasa disebut <em>segment</em>), sebagai contoh, path <code>std::time::Duration</code> memiliki 3 segmen yaitu <code>std</code>, <code>time</code>, dan <code>Duration</code>. Karakter <code>::</code> digunakan dalam penulisan path sebagai pembatas antar segmen (jika path memiliki lebih dari 1 segmen).</p><p>Dalam sebuah path, yang disebut dengan item adalah segment terakhir. Contohnya path <code>std::time::Duration</code>, maka item yang dituju adalah struct <code>Duration</code>.</p><blockquote><p>Rust paths mirip seperti konsep <em>filesystem</em> path di sistem operasi. Seperti <code>C:\Users\novalagung\Desktop</code> di windows, atau <code>/etc/nginx/conf.d/nginx.conf</code> di Unix/Linux.</p><p>Di Rust, path tidak menggunakan <code>\</code> atau <code>/</code> sebagai separator, melainkan <code>::</code>.</p></blockquote><p>Jika di-breakdown, berikut adalah penjelasan dari setiap kombinasi segmen path pada contoh <code>std::time::Duration</code>.</p><ul><li>Path <code>std</code> ➜ adalah path untuk <strong>crate</strong> bernama <a href="https://doc.rust-lang.org/std/" target="_blank" rel="noopener noreferrer"><strong>Rust Standard Library</strong></a>, isinya adalah sangat banyak item untuk keperluan umum di Rust programming. Lebih jelasnya akan dibahas pada chapter <a href="#/wip/rust-standard-library">Rust standard library</a>.</li><li>Path <code>std::time</code> ➜ adalah path untuk <strong>module</strong> bernama <a href="https://doc.rust-lang.org/std/time/index.html" target="_blank" rel="noopener noreferrer"><code>time</code></a>, isinya banyak item yang berhubungan dengan operasi waktu/time.</li><li>Path <code>std::time::Duration</code> ➜ adalah path untuk <strong>struct</strong> bernama <a href="https://doc.rust-lang.org/std/time/index.html" target="_blank" rel="noopener noreferrer"><code>Duration</code></a>, yang merupakan representasi dari unit waktu.</li></ul><blockquote><ul><li>Lebih jelasnya mengenai crate dibahas pada chapter <a href="/basic/package-crate">Module System ➜ Package & Crate</a></li><li>Lebih jelasnya mengenai module dibahas pada chapter <a href="/basic/module-basic">Module System ➜ Module</a></li><li>Lebih jelasnya mengenai struct dibahas pada chapter <a href="/basic/struct">Struct</a></li></ul></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a182-absolute--relative-paths">A.18.2. Absolute & relative paths<a class="hash-link" href="#a182-absolute--relative-paths" title="Direct link to heading">​</a></h2><p>Rust mengenal dua jenis path:</p><ul><li>Absolute path ➜ adalah path yang penulisannya lengkap dari root path, contohnya seperti <code>std::time::Duration</code>.</li><li>Relative path ➜ adalah path yang penulisannya relatif terhadap current path, contohnya seperti <code>self::my_func</code>, <code>super::my_mod::my_consntan</code>.</li></ul><blockquote><p>Lebih jelasnya mengenai relative path dibahas pada chapter <a href="/basic/module-scope-item-access">Module System ➜ Scope & Akses Item</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a183-rust-items">A.18.3. Rust <em>Items</em><a class="hash-link" href="#a183-rust-items" title="Direct link to heading">​</a></h2><p>Seperti yang sudah dibahas bahwa path adalah notasi penulisan alamat untuk item. Lalu apa saja yang disebut dengan item? Di Rust ada banyak hal, yang kurang lebih list-nya bisa dilihat berikut:</p><ul><li>modules <em>(dibahas pada chapter <a href="/basic/module-basic">Module System ➜ Module</a>)</em></li><li>extern crate declarations</li><li>use declarations <em>(dibahas pada chapter <a href="/basic/use">Module System ➜ Use</a>)</em></li><li>function definitions <em>(dibahas pada chapter <a href="/basic/function">Function</a>, <a href="/basic/associated-function">Associated Function</a>, dan <a href="/basic/method">Method</a>)</em></li><li>type definitions <em>(dibahas pada chapter-chapter tentang tipe data)</em></li><li>struct definitions <em>(dibahas pada chapter <a href="/basic/struct">Struct</a>)</em></li><li>enumeration definitions <em>(dibahas pada chapter <a href="/basic/enum">Enum</a>)</em></li><li>union definitions</li><li>constant items <em>(dibahas pada chapter <a href="/basic/konstanta">Konstanta</a>)</em></li><li>static items <em>(dibahas pada chapter <a href="/basic/static">Static Items</a>)</em></li><li>trait definitions <em>(dibahas pada chapter <a href="/basic/traits">Traits</a>)</em></li><li>implementations <em>(dibahas pada chapter <a href="/basic/function">Function</a>, <a href="/basic/associated-function">Associated Function</a>, dan <a href="/basic/method">Method</a>)</em></li><li>extern blocks</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a184-penerapan-paths-dalam-penggaksesan-item">A.18.4. Penerapan paths dalam penggaksesan item<a class="hash-link" href="#a184-penerapan-paths-dalam-penggaksesan-item" title="Direct link to heading">​</a></h2><p>Pada bagian ini, kita akan coba terapkan path untuk mengakses beberapa item.</p><p>Dalam program sederhana berikut, inputan user ditampung sebagai string, kemudian ditampilkan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// tampilkan intro untuk user agar menginput sebuah pesan</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"enter a message:"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// variabel yang akan menampung inputan user dalam string</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">string</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// objek reader untuk membaca inputan user</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> stdin_reader </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdin</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// proses pembacaan inputan user</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> reader_res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> stdin_reader</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">read_line</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// pengecekan apakah ada error dalam pembacaan inputan.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// jika iya, maka tampilkan error dan hentikan program</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> reader_res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> reader_res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// tampilkan pesan inputan user</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program, lalu inputkan sebuah pesan, kemudian enter.</p><p><img loading="lazy" alt="Module system path" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcQAAACZCAIAAAA+Wt3VAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUg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jGsyztY4WwOsWUxtM+PUINnaKJyYgys6Nts7wjUZZ2ucrQHWLqZlWZGGUP1G7cQczpgG0nPMJBzO1jhbA6x6mO8au0sLZDXJtvugr8lCQv4FKHs+AWdrM584WwPML6bpIrtcQI4u7nT4KZ2Y5Vq+7Zo8WkxxtnbmE2drgAnFdDHEeHvVVyXO1gCwSjGNJ+lWPXTE2RoA1ium6TCfSTgAQEwBABBTAABATAEAEFMAAMQUAAAxBQAAxBQAADEFAEBMAQAAMQUAQEwBABBTAIDL4f+9xQMz8c2S2gAAAABJRU5ErkJggg==" width="452" height="153" class="img_ev3q"></p><p>Bisa dilihat pesan ditampilkan sesuai inputan. Oke, sekarang kita akan bahas program di atas per-barisnya.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-stdstringstringnew">◉ <code>std::string::String::new()</code><a class="hash-link" href="#-stdstringstringnew" title="Direct link to heading">​</a></h3><p>Variabel <code>message</code> adalah string yang dibuat menggunakan tipe data custom <code>String</code>. Salah satu cara pembuatan string bertipe data ini adalah menggunakan statement <code>std::string::String::new()</code>.</p><p>Bisa dilihat tanda <code>::</code> digunakan pada statement tersebut. Path tersebut jika dijabarkan per segment:</p><ul><li>Segment <code>std</code> adalah crate <em>Rust Standard Library</em></li><li>Pada path <code>std::string</code>, segment <code>string</code> adalah module</li><li>Pada path <code>std::string::String</code>, segment <code>String</code> adalah struct String, yang biasa disebut dengan <em>custom type <code>String</code></em></li><li>Pada path <code>std::string::String::new</code>, segment <code>new</code> adalah sebuah fungsi milik struct <code>String</code> yang mengembalikan data bertipe custom string <code>String</code>.</li><li>Di segment terakhir, yaitu <code>new</code>, ditambahkan tanda pemanggilan fungsi <code>()</code>, yang menandakan bahwa fungsi <code>new</code> dipanggil. Dengan itu maka nilai baliknya (yang berupa <code>String</code>) ditampung oleh variabel <code>message</code>.</li></ul><blockquote><p>Terkesan banyak sekali penjelasan dalam 1 baris kode, tapi tidak perlu dihafal, lama-kelamaan akan terbiasa.</p></blockquote><p>Salah satu yang menarik dari crate <em>Rust Standard Library</em> adalah, beberapa segmen otomatis di-import atau dipakai. Jadi tidak perlu menuliskan path secara full.</p><p>Pada contoh yang sudah dibuat, statement pembuatan data <code>String</code> bisa diubah dari ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">string</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... menjadi cukup ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-stdiostdin">◉ <code>std::io::stdin()</code><a class="hash-link" href="#-stdiostdin" title="Direct link to heading">​</a></h3><p>Berbeda dengan <code>String</code>, path <code>std::io::stdin</code> tidak otomatis ter-import, jadi harus dituliskan secara full meskipun sama-sama di bawah crate <em>Rust Standard Library</em>.</p><p>Path <code>std::io</code> berisi module untuk keperluan I/O atau input output. Salah satu item yang ada dalam module ini adalah <code>stdin</code>, yang merupakan sebuah fungsi berguna untuk pembuatan objek handler untuk keperluan yang berhubungan dengan console (<em>stdin</em>). Objek tersebut ditampung oleh variabel <code>stdin_reader</code>.</p><blockquote><p>Secara terminologi, <em>stdin</em> (merupakan kependekan dari <em>standard input</em>) adalah sebuah input stream yang nilainya dibaca oleh program sebagai inputan.</p></blockquote><p>Variabel <code>stdin_reader</code> ini kemudian kita gunakan untuk berinteraksi dengan input stream, untuk menangkap inputan user.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-stdin_readerread_linemut-message">◉ <code>stdin_reader.read_line(&mut message)</code><a class="hash-link" href="#-stdin_readerread_linemut-message" title="Direct link to heading">​</a></h3><p>Method <code>read_line</code> milik variabel <code>stdin_reader</code> berguna untuk menangkap inputan user. Variabel yang disisipkan sebagai argumen pemanggilan method tersebut menjadi penampung inputan user, yang pada contoh ini adalah <code>message</code>.</p><p>Perlu diperhatikan bahwa <code>message</code> disisipkan <em>mutable reference</em>-nya sebagai argumen pemanggilan fungsi.</p><blockquote><p>Lebih jelasnya mengenai pointer dan <em>mutable reference</em> dibahas pada chapter <a href="/basic/pointer-references">Pointer & References</a></p></blockquote><p>Eksekusi dari statement <code>stdin_reader.read_line(&mut message)</code> adalah blocking, artinya program akan berhenti untuk sementara di baris tersebut, hingga ada inputan dari user dan tombol enter ditekan.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-pengecekan-error-stdin_reader">◉ Pengecekan error <code>stdin_reader</code><a class="hash-link" href="#-pengecekan-error-stdin_reader" title="Direct link to heading">​</a></h3><p>Blok statement <code>if</code> pada contoh di atas bertugas melakukan pengecekan error. Jika ada error, maka <code>reader_res.is_err()</code> bernilai <code>true</code>, dan pesan error-nya dimunculkan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> reader_res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> reader_res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-menampilkan-isi-message">◉ Menampilkan isi <code>message</code><a class="hash-link" href="#-menampilkan-isi-message" title="Direct link to heading">​</a></h3><p>Jika program berlajan sesuai harapan, tanpa error, pada baris terakhir data dalam <code>message</code> ditampilkan ke layar.</p><blockquote><p>Tipe data <code>String</code> ini tidak perlu di-konversi ke bentuk literal string <code>&str</code> untuk ditampilkan menggunakan <code>println</code>. Langsung saja sisipkan variabel <code>String</code> ke macro tersebut dan <code>println</code> akan tau harus menampilkan apa.</p></blockquote><p>Oke, Penulis rasa sudah cukup jelas perihal bagaimana cara menggunakan path untuk mengakses item. Cukup tulis saja path-nya. Jika path-nya panjang? ya ditulis semua.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a185-penggunaan-keyword-use-untuk-import-path">A.18.5. Penggunaan keyword <code>use</code> untuk import path<a class="hash-link" href="#a185-penggunaan-keyword-use-untuk-import-path" title="Direct link to heading">​</a></h2><p>Ada alternatif cara lain untuk memperpendek penulisan dan pengaksesan path, yaitu dengan menggunakan keyword <code>use</code>.</p><blockquote><p>Penggunaan <code>use</code> juga sempat dipraktikkan pada chapter sebelumnya, yaitu <a href="/basic/perulangan-while">Perulangan ➜ while</a>.</p></blockquote><p>Cara penerapannya bisa dilihat pada kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> stdin_reader </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdin</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... atau ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">io</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> stdin_reader </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdin</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... atau ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">stdin</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> stdin_reader </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">stdin</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... atau ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">stdin</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> stdin_reader </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">stdin</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dengan menggunakan <code>use</code> kita bisa memperpendek pengaksesan sebuah path.</p><p>O iya keyword ini bisa digunakan di mana saja, artinya tidak harus di luar fungsi <code>main</code>. Bisa saja di dalam fungsi, atau di dalam blok kode seleksi kondisi atau lainnya.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-import-beberapa-items-yang-parent-path-nya-yang-sama">◉ Import beberapa items yang parent path-nya yang sama<a class="hash-link" href="#-import-beberapa-items-yang-parent-path-nya-yang-sama" title="Direct link to heading">​</a></h3><p>Pada contoh di atas, path yang diimport adalah sebuah item <code>std::io::stdin</code>. Dimisalkan ada path lain (sebagai contoh <code>std::io::stderr</code>) yang juga ikut diimport, maka penulisannya kurang lebih seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">stdin</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">stderr</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... atau ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">stdin</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> stderr</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-import-semua-items-dalam-suatu-path">◉ Import semua items dalam suatu path<a class="hash-link" href="#-import-semua-items-dalam-suatu-path" title="Direct link to heading">​</a></h3><p>Suatu path bisa saja memiliki cukup banyak item/child di bawahnya. Sebagai contoh, path <code>std::io</code> merupakan parent path dari <code>stdin</code> dan <code>stderr</code>. Selain dua items tersebut, ada juga item lainnya.</p><p>Ada shortcut yang membuat penulisan import path lebih praktis, tidak perlu menuliskan satu-per-satu, caranya adalah menggunakan <code>*</code>. Sebagai contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token operator" style="color:#393A34">*</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... adalah ekuivalen dengan ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">stdin</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> stderr</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> stdout</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">path lainnya</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... atau ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">stdin</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">stderr</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">stdout</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">io</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token plain">path lainnya</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a186-pembahasan-lanjutan">A.18.6. Pembahasan lanjutan<a class="hash-link" href="#a186-pembahasan-lanjutan" title="Direct link to heading">​</a></h2><p>Kita sudah beberapa kali menerapkan path untuk mengakses item milik crate <em>Rust Standard Library</em>, lalu bagaimana penerapan path untuk internal item, pastinya pada proyek real dalam 1 program akan ada banyak item.</p><p>Jawabannya akan ada di beberapa chapter berikutnya. Untuk sekarang khusus pada bagian <strong>module system</strong> ini, penulis anjurkan untuk mengikuti urutan pembelajaran ebook terlebih dahulu.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/path_item" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../path_item</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.html</a></li><li><a href="https://doc.rust-lang.org/reference/paths.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/paths.html</a></li><li><a href="https://doc.rust-lang.org/reference/items.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/items.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.use.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.use.html</a></li><li><a href="https://doc.rust-lang.org/edition-guide/rust-2018/path-changes.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/edition-guide/rust-2018/path-changes.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/function"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.17. Function</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/package-crate"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.19. Module System ➜ Package & Crate</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a181-rust-paths" class="table-of-contents__link toc-highlight">A.18.1. Rust <em>Paths</em></a></li><li><a href="#a182-absolute--relative-paths" class="table-of-contents__link toc-highlight">A.18.2. Absolute & relative paths</a></li><li><a href="#a183-rust-items" class="table-of-contents__link toc-highlight">A.18.3. Rust <em>Items</em></a></li><li><a href="#a184-penerapan-paths-dalam-penggaksesan-item" class="table-of-contents__link toc-highlight">A.18.4. Penerapan paths dalam penggaksesan item</a><ul><li><a href="#-stdstringstringnew" class="table-of-contents__link toc-highlight">◉ <code>std::string::String::new()</code></a></li><li><a href="#-stdiostdin" class="table-of-contents__link toc-highlight">◉ <code>std::io::stdin()</code></a></li><li><a href="#-stdin_readerread_linemut-message" class="table-of-contents__link toc-highlight">◉ <code>stdin_reader.read_line(&mut message)</code></a></li><li><a href="#-pengecekan-error-stdin_reader" class="table-of-contents__link toc-highlight">◉ Pengecekan error <code>stdin_reader</code></a></li><li><a href="#-menampilkan-isi-message" class="table-of-contents__link toc-highlight">◉ Menampilkan isi <code>message</code></a></li></ul></li><li><a href="#a185-penggunaan-keyword-use-untuk-import-path" class="table-of-contents__link toc-highlight">A.18.5. Penggunaan keyword <code>use</code> untuk import path</a><ul><li><a href="#-import-beberapa-items-yang-parent-path-nya-yang-sama" class="table-of-contents__link toc-highlight">◉ Import beberapa items yang parent path-nya yang sama</a></li><li><a href="#-import-semua-items-dalam-suatu-path" class="table-of-contents__link toc-highlight">◉ Import semua items dalam suatu path</a></li></ul></li><li><a href="#a186-pembahasan-lanjutan" class="table-of-contents__link toc-highlight">A.18.6. Pembahasan lanjutan</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.18. Module System ➜ Path & Item</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.18. Module System ➜ Path & Item</h1></header><p>Chapter ini membahas tentang konsep <em>path</em> dan <em>item</em> dalam Rust programming.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a181-rust-paths">A.18.1. Rust <em>Paths</em><a class="hash-link" href="#a181-rust-paths" title="Direct link to heading">​</a></h2><p>Paths (atau Path) adalah notasi penulisan alamat sebuah item, contohnya <code>std::time::Duration</code>.</p><p><code>std::time::Duration</code> adalah <em>path</em> untuk item yang isinya adalah <code>struct</code> bernama <code>Duration</code>. Item bisa berupa banyak jenis, bisa saja struct, atau <em>macro</em>, konstanta, atau lainnya. Lebih jelasnya silakan cek pada halaman dokumentasi <code>std::time::Duration</code>.</p><p>Sebuah path bisa memiliki banyak bagian (biasa disebut <em>segment</em>), sebagai contoh, path <code>std::time::Duration</code> memiliki 3 segmen yaitu <code>std</code>, <code>time</code>, dan <code>Duration</code>. Karakter <code>::</code> digunakan dalam penulisan path sebagai pembatas antar segmen (jika path memiliki lebih dari 1 segmen).</p><p>Dalam sebuah path, yang disebut dengan item adalah segment terakhir. Contohnya path <code>std::time::Duration</code>, maka item yang dituju adalah struct <code>Duration</code>.</p><blockquote><p>Rust paths mirip seperti konsep <em>filesystem</em> path di sistem operasi. Seperti <code>C:\Users\novalagung\Desktop</code> di windows, atau <code>/etc/nginx/conf.d/nginx.conf</code> di Unix/Linux.</p><p>Di Rust, path tidak menggunakan <code>\</code> atau <code>/</code> sebagai separator, melainkan <code>::</code>.</p></blockquote><p>Jika di-breakdown, berikut adalah penjelasan dari setiap kombinasi segmen path pada contoh <code>std::time::Duration</code>.</p><ul><li>Path <code>std</code> ➜ adalah path untuk <strong>crate</strong> bernama <a href="https://doc.rust-lang.org/std/" target="_blank" rel="noopener noreferrer"><strong>Rust Standard Library</strong></a>, isinya adalah sangat banyak item untuk keperluan umum di Rust programming. Lebih jelasnya akan dibahas pada chapter <a href="#/wip/rust-standard-library">Rust standard library</a>.</li><li>Path <code>std::time</code> ➜ adalah path untuk <strong>module</strong> bernama <a href="https://doc.rust-lang.org/std/time/index.html" target="_blank" rel="noopener noreferrer"><code>time</code></a>, isinya banyak item yang berhubungan dengan operasi waktu/time.</li><li>Path <code>std::time::Duration</code> ➜ adalah path untuk <strong>struct</strong> bernama <a href="https://doc.rust-lang.org/std/time/index.html" target="_blank" rel="noopener noreferrer"><code>Duration</code></a>, yang merupakan representasi dari unit waktu.</li></ul><blockquote><ul><li>Lebih jelasnya mengenai crate dibahas pada chapter <a href="/basic/package-crate">Module System ➜ Package & Crate</a></li><li>Lebih jelasnya mengenai module dibahas pada chapter <a href="/basic/module-basic">Module System ➜ Module</a></li><li>Lebih jelasnya mengenai struct dibahas pada chapter <a href="/basic/struct">Struct</a></li></ul></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a182-absolute--relative-paths">A.18.2. Absolute & relative paths<a class="hash-link" href="#a182-absolute--relative-paths" title="Direct link to heading">​</a></h2><p>Rust mengenal dua jenis path:</p><ul><li>Absolute path ➜ adalah path yang penulisannya lengkap dari root path, contohnya seperti <code>std::time::Duration</code>.</li><li>Relative path ➜ adalah path yang penulisannya relatif terhadap current path, contohnya seperti <code>self::my_func</code>, <code>super::my_mod::my_consntan</code>.</li></ul><blockquote><p>Lebih jelasnya mengenai relative path dibahas pada chapter <a href="/basic/module-scope-item-access">Module System ➜ Scope & Akses Item</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a183-rust-items">A.18.3. Rust <em>Items</em><a class="hash-link" href="#a183-rust-items" title="Direct link to heading">​</a></h2><p>Seperti yang sudah dibahas bahwa path adalah notasi penulisan alamat untuk item. Lalu apa saja yang disebut dengan item? Di Rust ada banyak hal, yang kurang lebih list-nya bisa dilihat berikut:</p><ul><li>modules <em>(dibahas pada chapter <a href="/basic/module-basic">Module System ➜ Module</a>)</em></li><li>extern crate declarations</li><li>use declarations <em>(dibahas pada chapter <a href="/basic/use">Module System ➜ Use</a>)</em></li><li>function definitions <em>(dibahas pada chapter <a href="/basic/function">Function</a>, <a href="/basic/associated-function">Associated Function</a>, dan <a href="/basic/method">Method</a>)</em></li><li>type definitions <em>(dibahas pada chapter-chapter tentang tipe data)</em></li><li>struct definitions <em>(dibahas pada chapter <a href="/basic/struct">Struct</a>)</em></li><li>enumeration definitions <em>(dibahas pada chapter <a href="/basic/enum">Enum</a>)</em></li><li>union definitions</li><li>constant items <em>(dibahas pada chapter <a href="/basic/konstanta">Konstanta</a>)</em></li><li>static items <em>(dibahas pada chapter <a href="/basic/static">Static Items</a>)</em></li><li>trait definitions <em>(dibahas pada chapter <a href="/basic/traits">Traits</a>)</em></li><li>implementations <em>(dibahas pada chapter <a href="/basic/function">Function</a>, <a href="/basic/associated-function">Associated Function</a>, dan <a href="/basic/method">Method</a>)</em></li><li>extern blocks</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a184-penerapan-paths-dalam-penggaksesan-item">A.18.4. Penerapan paths dalam penggaksesan item<a class="hash-link" href="#a184-penerapan-paths-dalam-penggaksesan-item" title="Direct link to heading">​</a></h2><p>Pada bagian ini, kita akan coba terapkan path untuk mengakses beberapa item.</p><p>Dalam program sederhana berikut, inputan user ditampung sebagai string, kemudian ditampilkan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// tampilkan intro untuk user agar menginput sebuah pesan</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"enter a message:"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// variabel yang akan menampung inputan user dalam string</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">string</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// objek reader untuk membaca inputan user</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> stdin_reader </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdin</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// proses pembacaan inputan user</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> reader_res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> stdin_reader</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">read_line</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// pengecekan apakah ada error dalam pembacaan inputan.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// jika iya, maka tampilkan error dan hentikan program</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> reader_res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> reader_res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// tampilkan pesan inputan user</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program, lalu inputkan sebuah pesan, kemudian enter.</p><p><img loading="eager" fetchpriority="high" alt="Module system path" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcQAAACZCAIAAAA+Wt3VAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+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AnFdDHEeHvVVyXO1gCwSjGNJ+lWPXTE2RoA1ium6TCfSTgAQEwBABBTAABATAEAEFMAAMQUAAAxBQAAxBQAADEFAEBMAQAAMQUAQEwBABBTAIDL4f+9xQMz8c2S2gAAAABJRU5ErkJggg==" width="452" height="153" class="img_CujE"></p><p>Bisa dilihat pesan ditampilkan sesuai inputan. Oke, sekarang kita akan bahas program di atas per-barisnya.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-stdstringstringnew">◉ <code>std::string::String::new()</code><a class="hash-link" href="#-stdstringstringnew" title="Direct link to heading">​</a></h3><p>Variabel <code>message</code> adalah string yang dibuat menggunakan tipe data custom <code>String</code>. Salah satu cara pembuatan string bertipe data ini adalah menggunakan statement <code>std::string::String::new()</code>.</p><p>Bisa dilihat tanda <code>::</code> digunakan pada statement tersebut. Path tersebut jika dijabarkan per segment:</p><ul><li>Segment <code>std</code> adalah crate <em>Rust Standard Library</em></li><li>Pada path <code>std::string</code>, segment <code>string</code> adalah module</li><li>Pada path <code>std::string::String</code>, segment <code>String</code> adalah struct String, yang biasa disebut dengan <em>custom type <code>String</code></em></li><li>Pada path <code>std::string::String::new</code>, segment <code>new</code> adalah sebuah fungsi milik struct <code>String</code> yang mengembalikan data bertipe custom string <code>String</code>.</li><li>Di segment terakhir, yaitu <code>new</code>, ditambahkan tanda pemanggilan fungsi <code>()</code>, yang menandakan bahwa fungsi <code>new</code> dipanggil. Dengan itu maka nilai baliknya (yang berupa <code>String</code>) ditampung oleh variabel <code>message</code>.</li></ul><blockquote><p>Terkesan banyak sekali penjelasan dalam 1 baris kode, tapi tidak perlu dihafal, lama-kelamaan akan terbiasa.</p></blockquote><p>Salah satu yang menarik dari crate <em>Rust Standard Library</em> adalah, beberapa segmen otomatis di-import atau dipakai. Jadi tidak perlu menuliskan path secara full.</p><p>Pada contoh yang sudah dibuat, statement pembuatan data <code>String</code> bisa diubah dari ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">string</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... menjadi cukup ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-stdiostdin">◉ <code>std::io::stdin()</code><a class="hash-link" href="#-stdiostdin" title="Direct link to heading">​</a></h3><p>Berbeda dengan <code>String</code>, path <code>std::io::stdin</code> tidak otomatis ter-import, jadi harus dituliskan secara full meskipun sama-sama di bawah crate <em>Rust Standard Library</em>.</p><p>Path <code>std::io</code> berisi module untuk keperluan I/O atau input output. Salah satu item yang ada dalam module ini adalah <code>stdin</code>, yang merupakan sebuah fungsi berguna untuk pembuatan objek handler untuk keperluan yang berhubungan dengan console (<em>stdin</em>). Objek tersebut ditampung oleh variabel <code>stdin_reader</code>.</p><blockquote><p>Secara terminologi, <em>stdin</em> (merupakan kependekan dari <em>standard input</em>) adalah sebuah input stream yang nilainya dibaca oleh program sebagai inputan.</p></blockquote><p>Variabel <code>stdin_reader</code> ini kemudian kita gunakan untuk berinteraksi dengan input stream, untuk menangkap inputan user.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-stdin_readerread_linemut-message">◉ <code>stdin_reader.read_line(&mut message)</code><a class="hash-link" href="#-stdin_readerread_linemut-message" title="Direct link to heading">​</a></h3><p>Method <code>read_line</code> milik variabel <code>stdin_reader</code> berguna untuk menangkap inputan user. Variabel yang disisipkan sebagai argumen pemanggilan method tersebut menjadi penampung inputan user, yang pada contoh ini adalah <code>message</code>.</p><p>Perlu diperhatikan bahwa <code>message</code> disisipkan <em>mutable reference</em>-nya sebagai argumen pemanggilan fungsi.</p><blockquote><p>Lebih jelasnya mengenai pointer dan <em>mutable reference</em> dibahas pada chapter <a href="/basic/pointer-references">Pointer & References</a></p></blockquote><p>Eksekusi dari statement <code>stdin_reader.read_line(&mut message)</code> adalah blocking, artinya program akan berhenti untuk sementara di baris tersebut, hingga ada inputan dari user dan tombol enter ditekan.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-pengecekan-error-stdin_reader">◉ Pengecekan error <code>stdin_reader</code><a class="hash-link" href="#-pengecekan-error-stdin_reader" title="Direct link to heading">​</a></h3><p>Blok statement <code>if</code> pada contoh di atas bertugas melakukan pengecekan error. Jika ada error, maka <code>reader_res.is_err()</code> bernilai <code>true</code>, dan pesan error-nya dimunculkan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> reader_res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> reader_res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-menampilkan-isi-message">◉ Menampilkan isi <code>message</code><a class="hash-link" href="#-menampilkan-isi-message" title="Direct link to heading">​</a></h3><p>Jika program berlajan sesuai harapan, tanpa error, pada baris terakhir data dalam <code>message</code> ditampilkan ke layar.</p><blockquote><p>Tipe data <code>String</code> ini tidak perlu di-konversi ke bentuk literal string <code>&str</code> untuk ditampilkan menggunakan <code>println</code>. Langsung saja sisipkan variabel <code>String</code> ke macro tersebut dan <code>println</code> akan tau harus menampilkan apa.</p></blockquote><p>Oke, Penulis rasa sudah cukup jelas perihal bagaimana cara menggunakan path untuk mengakses item. Cukup tulis saja path-nya. Jika path-nya panjang? ya ditulis semua.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a185-penggunaan-keyword-use-untuk-import-path">A.18.5. Penggunaan keyword <code>use</code> untuk import path<a class="hash-link" href="#a185-penggunaan-keyword-use-untuk-import-path" title="Direct link to heading">​</a></h2><p>Ada alternatif cara lain untuk memperpendek penulisan dan pengaksesan path, yaitu dengan menggunakan keyword <code>use</code>.</p><blockquote><p>Penggunaan <code>use</code> juga sempat dipraktikkan pada chapter sebelumnya, yaitu <a href="/basic/perulangan-while">Perulangan ➜ while</a>.</p></blockquote><p>Cara penerapannya bisa dilihat pada kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> stdin_reader </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdin</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... atau ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">io</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> stdin_reader </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdin</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... atau ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">stdin</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> stdin_reader </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">stdin</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... atau ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">stdin</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> stdin_reader </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">stdin</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dengan menggunakan <code>use</code> kita bisa memperpendek pengaksesan sebuah path.</p><p>O iya keyword ini bisa digunakan di mana saja, artinya tidak harus di luar fungsi <code>main</code>. Bisa saja di dalam fungsi, atau di dalam blok kode seleksi kondisi atau lainnya.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-import-beberapa-items-yang-parent-path-nya-yang-sama">◉ Import beberapa items yang parent path-nya yang sama<a class="hash-link" href="#-import-beberapa-items-yang-parent-path-nya-yang-sama" title="Direct link to heading">​</a></h3><p>Pada contoh di atas, path yang diimport adalah sebuah item <code>std::io::stdin</code>. Dimisalkan ada path lain (sebagai contoh <code>std::io::stderr</code>) yang juga ikut diimport, maka penulisannya kurang lebih seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">stdin</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">stderr</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... atau ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">stdin</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> stderr</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-import-semua-items-dalam-suatu-path">◉ Import semua items dalam suatu path<a class="hash-link" href="#-import-semua-items-dalam-suatu-path" title="Direct link to heading">​</a></h3><p>Suatu path bisa saja memiliki cukup banyak item/child di bawahnya. Sebagai contoh, path <code>std::io</code> merupakan parent path dari <code>stdin</code> dan <code>stderr</code>. Selain dua items tersebut, ada juga item lainnya.</p><p>Ada shortcut yang membuat penulisan import path lebih praktis, tidak perlu menuliskan satu-per-satu, caranya adalah menggunakan <code>*</code>. Sebagai contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token operator" style="color:#393A34">*</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... adalah ekuivalen dengan ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">stdin</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> stderr</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> stdout</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">path lainnya</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... atau ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">stdin</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">stderr</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">stdout</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">io</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token plain">path lainnya</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a186-pembahasan-lanjutan">A.18.6. Pembahasan lanjutan<a class="hash-link" href="#a186-pembahasan-lanjutan" title="Direct link to heading">​</a></h2><p>Kita sudah beberapa kali menerapkan path untuk mengakses item milik crate <em>Rust Standard Library</em>, lalu bagaimana penerapan path untuk internal item, pastinya pada proyek real dalam 1 program akan ada banyak item.</p><p>Jawabannya akan ada di beberapa chapter berikutnya. Untuk sekarang khusus pada bagian <strong>module system</strong> ini, penulis anjurkan untuk mengikuti urutan pembelajaran ebook terlebih dahulu.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/path_item" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../path_item</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.html</a></li><li><a href="https://doc.rust-lang.org/reference/paths.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/paths.html</a></li><li><a href="https://doc.rust-lang.org/reference/items.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/items.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.use.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.use.html</a></li><li><a href="https://doc.rust-lang.org/edition-guide/rust-2018/path-changes.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/edition-guide/rust-2018/path-changes.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/function"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.17. Function</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/package-crate"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.19. Module System ➜ Package & Crate</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a181-rust-paths" class="table-of-contents__link toc-highlight">A.18.1. Rust <em>Paths</em></a></li><li><a href="#a182-absolute--relative-paths" class="table-of-contents__link toc-highlight">A.18.2. Absolute & relative paths</a></li><li><a href="#a183-rust-items" class="table-of-contents__link toc-highlight">A.18.3. Rust <em>Items</em></a></li><li><a href="#a184-penerapan-paths-dalam-penggaksesan-item" class="table-of-contents__link toc-highlight">A.18.4. Penerapan paths dalam penggaksesan item</a><ul><li><a href="#-stdstringstringnew" class="table-of-contents__link toc-highlight">◉ <code>std::string::String::new()</code></a></li><li><a href="#-stdiostdin" class="table-of-contents__link toc-highlight">◉ <code>std::io::stdin()</code></a></li><li><a href="#-stdin_readerread_linemut-message" class="table-of-contents__link toc-highlight">◉ <code>stdin_reader.read_line(&mut message)</code></a></li><li><a href="#-pengecekan-error-stdin_reader" class="table-of-contents__link toc-highlight">◉ Pengecekan error <code>stdin_reader</code></a></li><li><a href="#-menampilkan-isi-message" class="table-of-contents__link toc-highlight">◉ Menampilkan isi <code>message</code></a></li></ul></li><li><a href="#a185-penggunaan-keyword-use-untuk-import-path" class="table-of-contents__link toc-highlight">A.18.5. Penggunaan keyword <code>use</code> untuk import path</a><ul><li><a href="#-import-beberapa-items-yang-parent-path-nya-yang-sama" class="table-of-contents__link toc-highlight">◉ Import beberapa items yang parent path-nya yang sama</a></li><li><a href="#-import-semua-items-dalam-suatu-path" class="table-of-contents__link toc-highlight">◉ Import semua items dalam suatu path</a></li></ul></li><li><a href="#a186-pembahasan-lanjutan" class="table-of-contents__link toc-highlight">A.18.6. Pembahasan lanjutan</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/pattern-matching.html b/basic/pattern-matching.html index fcd2cce4..45f7474a 100644 --- a/basic/pattern-matching.html +++ b/basic/pattern-matching.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/pattern-matching/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/pattern-matching/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.42. Pattern Matching","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/pattern-matching/#webpage"},"wordCount":696,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/pattern-matching/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/pattern-matching/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/pattern-matching","name":"A.42. Pattern Matching","description":"Chapter ini membahas tentang pattern matching, sebuah teknik yang lebih advance dibanding seleksi kondisi biasa.","datePublished":"2024-08-01T10:17:30.132Z","dateModified":"2024-08-01T10:17:30.132Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/pattern-matching/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/pattern-matching"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/pattern-matching/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.42. Pattern Matching","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/pattern-matching/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/pattern-matching/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.42. Pattern Matching","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/pattern-matching/#webpage"},"wordCount":696,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/pattern-matching/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/pattern-matching/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/pattern-matching","name":"A.42. Pattern Matching","description":"Chapter ini membahas tentang pattern matching, sebuah teknik yang lebih advance dibanding seleksi kondisi biasa.","datePublished":"2024-08-30T07:44:50.537Z","dateModified":"2024-08-30T07:44:50.537Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/pattern-matching/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/pattern-matching"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/pattern-matching/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.42. Pattern Matching","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.42. Pattern Matching</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.42. Pattern Matching</h1></header><p>Chapter ini membahas tentang pattern matching, sebuah teknik yang lebih <em>advance</em> dibanding seleksi kondisi biasa.</p><p>Dalam pattern matching, pengecekan dilakukan dengan melihat kecocokan suatu pola/pattern.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a421-keyword-match">A.42.1. Keyword <code>match</code><a class="hash-link" href="#a421-keyword-match" title="Direct link to heading">​</a></h2><p>Keyword <code>match</code> digunakan untuk pattern matching. Contoh penerapan versi sederhananya bisa dilihat berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> time </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"morning"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> time </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"morning"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"isuk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"afternoon"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"awan"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"evening"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"bengi"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"mbuh kapan"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Pattern Matching" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhEAAABaCAIAAACJ/JPDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4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qGtzv6VM2oGRIn+FP1YETCm66fp2yQHM2QI8rOqxk55RyOLZWvGQNGHjTIqZzbXnCYlYcL1wzJ57BCIRXQDHPFEb7FJjVOUTUkTtCD1g5GFJcsaXzdMkhqiCd0NKSYsiU0Q1lOqUzTNCNRXD8yRKSFOF6dFGMI4NI049jLm1mNLnx3Hwop0/lQxXE6adIkV+OsIXHCbqhSMCLx6nKeokHidyQv8fKyLTE2lVVOu0xBhER3xEkXYihqZCGaUGAQN8SX9T1IIgYXwBo147x4cxjN4Fg3D1+eeYP8lJvh1JRTnFeHczUGADSjCP0Myubkc1TUjDME+SldTjTj0hsDoBlvHHdsqqJgCGNTy+0j1OVcmmZ44z2LtvRaGgOgGQAAAGgGAACgGQAAgGYAAACaAQAAaAYAAKAZAAAAaAYAAKAZAACAZgAAAJoBAAAXpxnf/319ff3vx1/ZV/nrx3+jzgMAADQDAAAuXjNGg2YAALwlzWh6/ZZ/v4uHT39ojnRJTr/YmmGcFTcXAAC4QD/DEYTg182wZjSCgcMBAPBWNcMXjYRm/EAwAADermZsTiNN1tR4VDOcVAAA8AY1w9YOIwipsSnJLwEAgDenGd2MhTXd3c929weZ0AAAuHjNsNdHvdpK8Ootm9o4A1HfhXVT7Z/RDQCAS/czAAAAzQAAAEAzAAAAzQAAADQDAADQDAAAQDMAAADNAAAAQDMAAADNAAAANAMAANAMAABYG/8DiOs2Gd7BWQgAAAAASUVORK5CYII=" width="529" height="90" class="img_ev3q"></p><p>Pada contoh di atas, <code>time</code> dicek nilainya menggunakan keyword <code>match</code> dengan 4 buah klausul:</p><ul><li>Jika value-nya <code>morning</code>, tampilkan pesan <code>isuk</code></li><li>Jika value-nya <code>afternoon</code>, tampilkan pesan <code>awan</code></li><li>Jika value-nya <code>evening</code>, tampilkan pesan <code>bengi</code></li><li>Jika tidak ada yang cocok dari klausus di atas, maka tampilkan pesan <code>mbuh kapan</code></li></ul><p>Contoh di atas adalah ekuivalen dengan seleksi kondisi <code>if</code> berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> time </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"morning"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> time </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"morning"</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"isuk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> time </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"afternoon"</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"awan"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> time </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"evening"</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"bengi"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"mbuh kapan"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ada satu syarat yang harus dipenuhi dalam penerapan pattern matching, yaitu semua kondisi yang memungkinkan harus ditulis, harus lengkap. Ibarat <code>if</code> yang harus ada block <code>else</code>-nya.</p><p>Variabel <code>_</code> digunakan sebagai else-nya block <code>match</code>. Tanpa adanya kondisi <code>_</code> maka besar kemungkinan block <code>match</code> error jika klausulnya tidak lengkap.</p><p><img loading="lazy" alt="Pattern Matching" src="/assets/images/pattern-matching-2-5b5fd279cb60f0d2dc3002667e49a970.png" width="755" height="284" class="img_ev3q"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-menampung-nilai-balik-match">◉ Menampung nilai balik <code>match</code><a class="hash-link" href="#-menampung-nilai-balik-match" title="Direct link to heading">​</a></h3><p>Block statement <code>match</code> bisa saja menghasilkan return value. Contohnya bisa dilihat berikut ini, hasil dari pattern matching ditampung ke variabel <code>time_but_in_javanese</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> time </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"morning"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> time_but_in_javanese </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> time </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"morning"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"isuk"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"afternoon"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"awan"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"evening"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"bengi"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"mbuh kapan"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{time_but_in_javanese}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a422-pattern-matching">A.42.2. Pattern matching<a class="hash-link" href="#a422-pattern-matching" title="Direct link to heading">​</a></h2><p>Contoh di atas bisa dikategorikan sebagai seleksi kondisi biasa meskipun menggunakan keyword <code>match</code>. Setelah ini kita akan pelajari macam-macam pattern/pola yang di-support dalam pattern matching di Rust.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-pengecekan-nilai-enum">◉ Pengecekan nilai enum<a class="hash-link" href="#-pengecekan-nilai-enum" title="Direct link to heading">​</a></h3><p>Tipe data <a href="/basic/option-type">Option</a> adalah salah satu enum yang paling sering dipakai pada pattern matching. Enum <code>Option</code> memiliki 2 enum value, <code>Some</code> yang merepresentasikan sebuah nilai, dan <code>None</code> yang berarti tidak ada nilai.</p><p>Pattern matching pada enum cukup mudah, caranya bisa dilihat pada contoh berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Option</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Option</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{x} greater than two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"none"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Variabel <code>value</code> nilainya adalah <code>Some(5)</code>. Variabel tersebut dimasukkan ke block <code>match</code> dengan 4 buah kondisi pengecekan:</p><ul><li>Jika <code>value</code> nilainya <code>Some(1)</code>, tampilkan pesan <code>one</code></li><li>Jika <code>value</code> nilainya <code>Some(2)</code>, tampilkan pesan <code>two</code></li><li>Jika <code>value</code> nilainya <code>Some(x)</code>, tampilkan pesan <code>{x} greater than two</code></li><li>Jika tidak ada yang cocok dari klausus di atas, maka tampilkan pesan <code>none</code></li></ul><p>Tipe <code>Option</code> pasti berpotensi berisi <code>Some</code> atau <code>None</code>, tidak mungkin selainnya. Klausul terakhir di contoh di atas (<code>_ => println!("none")</code>) terpenuhi ketika nilai <code>value</code> adalah <code>None</code>. Pada konteks ini mengganti <code>_</code> dengan <code>None</code> menjadikan klausul pada pattern matching tetap lengkap.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{x} greater than two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"none"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Lebih jelasnya mengenai <code>Some</code> dan <code>None</code> dibahas pada chapter <a href="/basic/option-type">Tipe Data ➜ Option</a></p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-pattern--dan-">◉ Pattern <code>|</code> dan <code>..</code><a class="hash-link" href="#-pattern--dan-" title="Direct link to heading">​</a></h3><p>Klausul pattern matching bisa berisi operasi <code>OR</code> maupun <code>IN</code> caranya dengan memanfaatkan operator berikut:</p><ul><li>Operator <code>|</code> digunakan sebagai logika <code>OR</code></li><li>Operator <code>..</code> atau <code>..=</code> digunakan sebagai logika <code>IN</code></li></ul><p>Contoh penerapannya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one or two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"three through five"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"six"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"other number"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Jika <code>value</code> nilainya <code>1</code> atau <code>2</code>, tampilkan pesan <code>one or two</code></li><li>Jika <code>value</code> nilainya antara <code>3</code> hingga <code>5</code>, tampilkan pesan <code>three through five</code></li><li>Jika <code>value</code> nilainya <code>6</code>, tampilkan pesan <code>six</code></li><li>Jika tidak ada yang cocok dari klausus di atas, maka tampilkan pesan <code>other number</code></li></ul><p>Pattern di atas juga bisa diterapkan dalam variabel enum value, contohnya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Option</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one or two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"three through five"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"six"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{x} greater than six"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"none"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Operator <code>|</code> memiliki 2 kegunaan:</p><ul><li>Pada statement biasa, fungsinya adalah untuk <strong>bitwise OR</strong>.</li><li>Pada pattern matching, fungsinya untuk <strong>OR</strong>, kegunaannya sama seperti <code>||</code> pada statement biasa.</li></ul><p>Lebih jelasnya mengenai bitwise operator dibahas pada chapter <a href="#/wip/bitwise-operation">Bitwise Operation</a></p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-match-guard">◉ Match guard<a class="hash-link" href="#-match-guard" title="Direct link to heading">​</a></h3><p>Match guard adalah teknik menambahkan sub seleksi kondisi pada klausul <code>match</code>. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number {} is even"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number {} is odd"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{message}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Klausul pertama di atas, yaitu <code>Some(x)</code> ditambahkan match guard <code>if x % 2 == 0</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-binding-">◉ Binding <code>@</code><a class="hash-link" href="#-binding-" title="Direct link to heading">​</a></h3><p>Operator <code>@</code> digunakan untuk menampung nilai klausul <code>match</code> yang default-nya tidak bisa ditampung. Agar lebih jelas, silakan pelajari pattern matching berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one or two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"three through five"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"six"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"other number"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Klausul <code>1 | 2</code> dan <code>3..=5</code> nilai by default tidak bisa diakses. Kita hanya tau bahwa nilai pasti antara <code>1</code> dan <code>2</code> untuk klausul <code>1 | 2</code>, dan <code>3 / 4 / 5</code> untuk klausul <code>3..=5</code>.</p><p>Nilai pasti klausul tersebut bisa ditampung menggunakan operator <code>@</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> n </span><span class="token operator" style="color:#393A34">@</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one or two ({})"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> n </span><span class="token operator" style="color:#393A34">@</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"three through five ({})"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"six"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"other number"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Khusus untuk penggunaan <code>@</code> binding pada operator <code>|</code>, pada penulisan klausul seleksi kondisinya harus diapit tanda <code>()</code>.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-if-let">◉ <code>if let</code><a class="hash-link" href="#-if-let" title="Direct link to heading">​</a></h3><p>Untuk memahami pattern matching menggunakan keyword <code>if let</code>, silakan pelajari kode berikut terlebih dahulu.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Option</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{x} greater than two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"none"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pattern matching di atas cukup mudah dipahami, isinya ada 2 kondisi <code>Some</code> dan 1 buah else (menggunakan <code>_</code>). </p><p>Block kode tersebut jika dikonversi ke bentuk <code>if</code> hasilnya seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{x} greater than two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"none"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dari sini cukup jelas kegunaan dari <code>if let</code>. Meskipun menggunakan operator <code>=</code> (bukan <code>==</code>) block kode seleksi kondisi di atas adalah pattern matching, yang isinya melakukan pengecekan sama persis seperti pattern matching pada kode sebelumnya.</p><p>Tambahan contoh, 2 block kode berikut adalah juga ekuivalen.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one or two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"three through five"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"six"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"other number"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... vs ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one or two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"three through five"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"six"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"other number"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a423-destructuring-assignment">A.42.3. Destructuring assignment<a class="hash-link" href="#a423-destructuring-assignment" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-struct-destructuring">◉ Struct destructuring<a class="hash-link" href="#-struct-destructuring" title="Direct link to heading">​</a></h3><p>Operasi <em>destructuring</em> (menampung item suatu tipe) bisa dilakukan menggunakan pattern matching.</p><p>Pada kode di bawah ini, variabel <code>p</code> yang bertipe struct <code>Point { x: i32, y: i32 }</code> dimasukkan pada block pattern matching. Item dari struct tersebut di-<em>destructure</em> ke variabel <code>x</code> dan <code>y</code> masing-masing klausul pattern matching item-nya ditampung ke variabel <code>x</code> dan <code>y</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> p </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">7</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> p </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"x axis at {x}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"y axis at {y}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"axis: ({x}, {y})"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Jika <code>p.y</code> nilainya <code>0</code>, tampilkan pesan <code>x axis at {x}</code></li><li>Jika <code>p.x</code> nilainya <code>0</code>, tampilkan pesan <code>y axis at {y}</code></li><li>Jika tidak ada yang cocok dari klausus di atas, maka tampilkan pesan <code>axis: ({x}, {y})</code></li></ul><p>Operasi destructuring hasilnya pasti sukses, karena alasan ini keyword <code>match</code> boleh tidak digunakan. Contohnya bisa dilihat pada kode berikut, variabel <code>p</code> di-<em>destructure</em> ke variabel baru yaitu <code>x</code> dan <code>y</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> p</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"x: {x}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"y: {y}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-enum-destructuring">◉ Enum destructuring<a class="hash-link" href="#-enum-destructuring" title="Direct link to heading">​</a></h3><p>Destructuring juga bisa dilakukan pada tipe data enum caranya dengan menggunakan keyword <code>match</code> atau <code>if</code> (wajib menggunakan salah satu keyword tersebut).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Color</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Black</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">White</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Rgb</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> color </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Rgb</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">160</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">255</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Rgb</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> color </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"r: {r}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"g: {g}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"b: {b}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> color </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Rgb</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"r: {r}, g: {g}, b: {b}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"other color"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-tuple-destructuring">◉ Tuple destructuring<a class="hash-link" href="#-tuple-destructuring" title="Direct link to heading">​</a></h3><p>Tuple bisa di-destructure secara langsung tanpa menggunakan keyword <code>if</code> atau <code>match</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> grades </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"A"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"B"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"C"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">grade_a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> grade_b</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> grade_c</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> grades</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"grade_a: {grade_a}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"grade_b: {grade_b}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"grade_c: {grade_c}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> grades </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">grade_a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> grade_b</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> grade_c</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"grade_a: {grade_a}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"grade_b: {grade_b}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"grade_c: {grade_c}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-variabel-_">◉ Variabel <code>_</code><a class="hash-link" href="#-variabel-_" title="Direct link to heading">​</a></h3><p>Variabel <code>_</code> bisa dimanfaatkan pada statement <em>destructuring</em> untuk menampung item yang tidak digunakan. Contoh penerapannya bisa dilihat di bawah ini. Tuple <code>numbers</code> di-destructure dan hanya diambil elemen ke-2-nya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">_</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> second</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> _</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"second number: {second}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-operator-">◉ Operator <code>..</code><a class="hash-link" href="#-operator-" title="Direct link to heading">​</a></h3><p>Operator <code>..</code> bisa digunakan untuk meng-exclude item dalam range tertentu. Sebagai contoh, tuple <code>numbers</code> di-destructure dan hanya diambil nilai elemen ke-1 dan terakhirnya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">16</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">first</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> last</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"first number: {first}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"last number: {last}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Opeartor <code>..</code> hanya bisa digunakan pada statement destructuring di posisi tengah, awal, atau akhir (pilih salah satu). Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">first</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> last</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"first number: {first}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"last number: {last}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">first</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"first number: {first}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> last</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"last number: {last}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/pattern_matching" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../pattern_matching</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/seleksi-kondisi-if">Seleksi Kondisi ➜ if, else if, else</a></li><li><a href="/basic/tuple">Tipe Data ➜ Tuple</a></li><li><a href="/basic/struct">Struct</a></li><li><a href="/basic/enum">Enum</a></li><li><a href="/basic/option-type">Tipe Data ➜ Option</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-work-in-progress">◉ Work in progress<a class="hash-link" href="#-work-in-progress" title="Direct link to heading">​</a></h3><ul><li>Pembahasan tentang <code>while let</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/flow_control/match.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/flow_control/match.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/operator-tanda-tanya"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.41. Operator ?</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/static"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.43. Static Item</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a421-keyword-match" class="table-of-contents__link toc-highlight">A.42.1. Keyword <code>match</code></a><ul><li><a href="#-menampung-nilai-balik-match" class="table-of-contents__link toc-highlight">◉ Menampung nilai balik <code>match</code></a></li></ul></li><li><a href="#a422-pattern-matching" class="table-of-contents__link toc-highlight">A.42.2. Pattern matching</a><ul><li><a href="#-pengecekan-nilai-enum" class="table-of-contents__link toc-highlight">◉ Pengecekan nilai enum</a></li><li><a href="#-pattern--dan-" class="table-of-contents__link toc-highlight">◉ Pattern <code>|</code> dan <code>..</code></a></li><li><a href="#-match-guard" class="table-of-contents__link toc-highlight">◉ Match guard</a></li><li><a href="#-binding-" class="table-of-contents__link toc-highlight">◉ Binding <code>@</code></a></li><li><a href="#-if-let" class="table-of-contents__link toc-highlight">◉ <code>if let</code></a></li></ul></li><li><a href="#a423-destructuring-assignment" class="table-of-contents__link toc-highlight">A.42.3. Destructuring assignment</a><ul><li><a href="#-struct-destructuring" class="table-of-contents__link toc-highlight">◉ Struct destructuring</a></li><li><a href="#-enum-destructuring" class="table-of-contents__link toc-highlight">◉ Enum destructuring</a></li><li><a href="#-tuple-destructuring" class="table-of-contents__link toc-highlight">◉ Tuple destructuring</a></li><li><a href="#-variabel-_" class="table-of-contents__link toc-highlight">◉ Variabel <code>_</code></a></li><li><a href="#-operator-" class="table-of-contents__link toc-highlight">◉ Operator <code>..</code></a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-work-in-progress" class="table-of-contents__link toc-highlight">◉ Work in progress</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.42. Pattern Matching</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.42. Pattern Matching</h1></header><p>Chapter ini membahas tentang pattern matching, sebuah teknik yang lebih <em>advance</em> dibanding seleksi kondisi biasa.</p><p>Dalam pattern matching, pengecekan dilakukan dengan melihat kecocokan suatu pola/pattern.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a421-keyword-match">A.42.1. Keyword <code>match</code><a class="hash-link" href="#a421-keyword-match" title="Direct link to heading">​</a></h2><p>Keyword <code>match</code> digunakan untuk pattern matching. Contoh penerapan versi sederhananya bisa dilihat berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> time </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"morning"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> time </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"morning"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"isuk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"afternoon"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"awan"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"evening"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"bengi"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"mbuh kapan"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="Pattern Matching" src="data:image/png;base64,iVB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ek nilainya menggunakan keyword <code>match</code> dengan 4 buah klausul:</p><ul><li>Jika value-nya <code>morning</code>, tampilkan pesan <code>isuk</code></li><li>Jika value-nya <code>afternoon</code>, tampilkan pesan <code>awan</code></li><li>Jika value-nya <code>evening</code>, tampilkan pesan <code>bengi</code></li><li>Jika tidak ada yang cocok dari klausus di atas, maka tampilkan pesan <code>mbuh kapan</code></li></ul><p>Contoh di atas adalah ekuivalen dengan seleksi kondisi <code>if</code> berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> time </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"morning"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> time </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"morning"</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"isuk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> time </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"afternoon"</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"awan"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> time </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"evening"</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"bengi"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"mbuh kapan"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ada satu syarat yang harus dipenuhi dalam penerapan pattern matching, yaitu semua kondisi yang memungkinkan harus ditulis, harus lengkap. Ibarat <code>if</code> yang harus ada block <code>else</code>-nya.</p><p>Variabel <code>_</code> digunakan sebagai else-nya block <code>match</code>. Tanpa adanya kondisi <code>_</code> maka besar kemungkinan block <code>match</code> error jika klausulnya tidak lengkap.</p><p><img loading="lazy" alt="Pattern Matching" src="/assets/images/pattern-matching-2-5b5fd279cb60f0d2dc3002667e49a970.png" width="755" height="284" class="img_CujE"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-menampung-nilai-balik-match">◉ Menampung nilai balik <code>match</code><a class="hash-link" href="#-menampung-nilai-balik-match" title="Direct link to heading">​</a></h3><p>Block statement <code>match</code> bisa saja menghasilkan return value. Contohnya bisa dilihat berikut ini, hasil dari pattern matching ditampung ke variabel <code>time_but_in_javanese</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> time </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"morning"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> time_but_in_javanese </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> time </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"morning"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"isuk"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"afternoon"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"awan"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"evening"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"bengi"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"mbuh kapan"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{time_but_in_javanese}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a422-pattern-matching">A.42.2. Pattern matching<a class="hash-link" href="#a422-pattern-matching" title="Direct link to heading">​</a></h2><p>Contoh di atas bisa dikategorikan sebagai seleksi kondisi biasa meskipun menggunakan keyword <code>match</code>. Setelah ini kita akan pelajari macam-macam pattern/pola yang di-support dalam pattern matching di Rust.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-pengecekan-nilai-enum">◉ Pengecekan nilai enum<a class="hash-link" href="#-pengecekan-nilai-enum" title="Direct link to heading">​</a></h3><p>Tipe data <a href="/basic/option-type">Option</a> adalah salah satu enum yang paling sering dipakai pada pattern matching. Enum <code>Option</code> memiliki 2 enum value, <code>Some</code> yang merepresentasikan sebuah nilai, dan <code>None</code> yang berarti tidak ada nilai.</p><p>Pattern matching pada enum cukup mudah, caranya bisa dilihat pada contoh berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Option</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Option</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{x} greater than two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"none"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Variabel <code>value</code> nilainya adalah <code>Some(5)</code>. Variabel tersebut dimasukkan ke block <code>match</code> dengan 4 buah kondisi pengecekan:</p><ul><li>Jika <code>value</code> nilainya <code>Some(1)</code>, tampilkan pesan <code>one</code></li><li>Jika <code>value</code> nilainya <code>Some(2)</code>, tampilkan pesan <code>two</code></li><li>Jika <code>value</code> nilainya <code>Some(x)</code>, tampilkan pesan <code>{x} greater than two</code></li><li>Jika tidak ada yang cocok dari klausus di atas, maka tampilkan pesan <code>none</code></li></ul><p>Tipe <code>Option</code> pasti berpotensi berisi <code>Some</code> atau <code>None</code>, tidak mungkin selainnya. Klausul terakhir di contoh di atas (<code>_ => println!("none")</code>) terpenuhi ketika nilai <code>value</code> adalah <code>None</code>. Pada konteks ini mengganti <code>_</code> dengan <code>None</code> menjadikan klausul pada pattern matching tetap lengkap.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{x} greater than two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"none"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Lebih jelasnya mengenai <code>Some</code> dan <code>None</code> dibahas pada chapter <a href="/basic/option-type">Tipe Data ➜ Option</a></p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-pattern--dan-">◉ Pattern <code>|</code> dan <code>..</code><a class="hash-link" href="#-pattern--dan-" title="Direct link to heading">​</a></h3><p>Klausul pattern matching bisa berisi operasi <code>OR</code> maupun <code>IN</code> caranya dengan memanfaatkan operator berikut:</p><ul><li>Operator <code>|</code> digunakan sebagai logika <code>OR</code></li><li>Operator <code>..</code> atau <code>..=</code> digunakan sebagai logika <code>IN</code></li></ul><p>Contoh penerapannya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one or two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"three through five"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"six"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"other number"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Jika <code>value</code> nilainya <code>1</code> atau <code>2</code>, tampilkan pesan <code>one or two</code></li><li>Jika <code>value</code> nilainya antara <code>3</code> hingga <code>5</code>, tampilkan pesan <code>three through five</code></li><li>Jika <code>value</code> nilainya <code>6</code>, tampilkan pesan <code>six</code></li><li>Jika tidak ada yang cocok dari klausus di atas, maka tampilkan pesan <code>other number</code></li></ul><p>Pattern di atas juga bisa diterapkan dalam variabel enum value, contohnya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Option</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one or two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"three through five"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"six"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{x} greater than six"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"none"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Operator <code>|</code> memiliki 2 kegunaan:</p><ul><li>Pada statement biasa, fungsinya adalah untuk <strong>bitwise OR</strong>.</li><li>Pada pattern matching, fungsinya untuk <strong>OR</strong>, kegunaannya sama seperti <code>||</code> pada statement biasa.</li></ul><p>Lebih jelasnya mengenai bitwise operator dibahas pada chapter <a href="#/wip/bitwise-operation">Bitwise Operation</a></p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-match-guard">◉ Match guard<a class="hash-link" href="#-match-guard" title="Direct link to heading">​</a></h3><p>Match guard adalah teknik menambahkan sub seleksi kondisi pada klausul <code>match</code>. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number {} is even"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">format!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number {} is odd"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{message}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Klausul pertama di atas, yaitu <code>Some(x)</code> ditambahkan match guard <code>if x % 2 == 0</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-binding-">◉ Binding <code>@</code><a class="hash-link" href="#-binding-" title="Direct link to heading">​</a></h3><p>Operator <code>@</code> digunakan untuk menampung nilai klausul <code>match</code> yang default-nya tidak bisa ditampung. Agar lebih jelas, silakan pelajari pattern matching berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one or two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"three through five"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"six"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"other number"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Klausul <code>1 | 2</code> dan <code>3..=5</code> nilai by default tidak bisa diakses. Kita hanya tau bahwa nilai pasti antara <code>1</code> dan <code>2</code> untuk klausul <code>1 | 2</code>, dan <code>3 / 4 / 5</code> untuk klausul <code>3..=5</code>.</p><p>Nilai pasti klausul tersebut bisa ditampung menggunakan operator <code>@</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> n </span><span class="token operator" style="color:#393A34">@</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one or two ({})"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> n </span><span class="token operator" style="color:#393A34">@</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"three through five ({})"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"six"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"other number"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Khusus untuk penggunaan <code>@</code> binding pada operator <code>|</code>, pada penulisan klausul seleksi kondisinya harus diapit tanda <code>()</code>.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-if-let">◉ <code>if let</code><a class="hash-link" href="#-if-let" title="Direct link to heading">​</a></h3><p>Untuk memahami pattern matching menggunakan keyword <code>if let</code>, silakan pelajari kode berikut terlebih dahulu.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Option</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{x} greater than two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"none"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pattern matching di atas cukup mudah dipahami, isinya ada 2 kondisi <code>Some</code> dan 1 buah else (menggunakan <code>_</code>). </p><p>Block kode tersebut jika dikonversi ke bentuk <code>if</code> hasilnya seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{x} greater than two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"none"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dari sini cukup jelas kegunaan dari <code>if let</code>. Meskipun menggunakan operator <code>=</code> (bukan <code>==</code>) block kode seleksi kondisi di atas adalah pattern matching, yang isinya melakukan pengecekan sama persis seperti pattern matching pada kode sebelumnya.</p><p>Tambahan contoh, 2 block kode berikut adalah juga ekuivalen.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one or two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"three through five"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"six"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"other number"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ... vs ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"one or two"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"three through five"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> value </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"six"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"other number"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a423-destructuring-assignment">A.42.3. Destructuring assignment<a class="hash-link" href="#a423-destructuring-assignment" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-struct-destructuring">◉ Struct destructuring<a class="hash-link" href="#-struct-destructuring" title="Direct link to heading">​</a></h3><p>Operasi <em>destructuring</em> (menampung item suatu tipe) bisa dilakukan menggunakan pattern matching.</p><p>Pada kode di bawah ini, variabel <code>p</code> yang bertipe struct <code>Point { x: i32, y: i32 }</code> dimasukkan pada block pattern matching. Item dari struct tersebut di-<em>destructure</em> ke variabel <code>x</code> dan <code>y</code> masing-masing klausul pattern matching item-nya ditampung ke variabel <code>x</code> dan <code>y</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> p </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">7</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> p </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"x axis at {x}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"y axis at {y}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"axis: ({x}, {y})"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Jika <code>p.y</code> nilainya <code>0</code>, tampilkan pesan <code>x axis at {x}</code></li><li>Jika <code>p.x</code> nilainya <code>0</code>, tampilkan pesan <code>y axis at {y}</code></li><li>Jika tidak ada yang cocok dari klausus di atas, maka tampilkan pesan <code>axis: ({x}, {y})</code></li></ul><p>Operasi destructuring hasilnya pasti sukses, karena alasan ini keyword <code>match</code> boleh tidak digunakan. Contohnya bisa dilihat pada kode berikut, variabel <code>p</code> di-<em>destructure</em> ke variabel baru yaitu <code>x</code> dan <code>y</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> p</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"x: {x}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"y: {y}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-enum-destructuring">◉ Enum destructuring<a class="hash-link" href="#-enum-destructuring" title="Direct link to heading">​</a></h3><p>Destructuring juga bisa dilakukan pada tipe data enum caranya dengan menggunakan keyword <code>match</code> atau <code>if</code> (wajib menggunakan salah satu keyword tersebut).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Color</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Black</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">White</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Rgb</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> color </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Rgb</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">160</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">255</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Rgb</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> color </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"r: {r}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"g: {g}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"b: {b}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> color </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">Rgb</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"r: {r}, g: {g}, b: {b}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"other color"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-tuple-destructuring">◉ Tuple destructuring<a class="hash-link" href="#-tuple-destructuring" title="Direct link to heading">​</a></h3><p>Tuple bisa di-destructure secara langsung tanpa menggunakan keyword <code>if</code> atau <code>match</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> grades </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"A"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"B"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"C"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">grade_a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> grade_b</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> grade_c</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> grades</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"grade_a: {grade_a}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"grade_b: {grade_b}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"grade_c: {grade_c}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> grades </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">grade_a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> grade_b</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> grade_c</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"grade_a: {grade_a}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"grade_b: {grade_b}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"grade_c: {grade_c}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-variabel-_">◉ Variabel <code>_</code><a class="hash-link" href="#-variabel-_" title="Direct link to heading">​</a></h3><p>Variabel <code>_</code> bisa dimanfaatkan pada statement <em>destructuring</em> untuk menampung item yang tidak digunakan. Contoh penerapannya bisa dilihat di bawah ini. Tuple <code>numbers</code> di-destructure dan hanya diambil elemen ke-2-nya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">_</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> second</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> _</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"second number: {second}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-operator-">◉ Operator <code>..</code><a class="hash-link" href="#-operator-" title="Direct link to heading">​</a></h3><p>Operator <code>..</code> bisa digunakan untuk meng-exclude item dalam range tertentu. Sebagai contoh, tuple <code>numbers</code> di-destructure dan hanya diambil nilai elemen ke-1 dan terakhirnya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">16</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">first</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> last</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"first number: {first}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"last number: {last}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Opeartor <code>..</code> hanya bisa digunakan pada statement destructuring di posisi tengah, awal, atau akhir (pilih salah satu). Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">first</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> last</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"first number: {first}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"last number: {last}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">first</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"first number: {first}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> last</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"last number: {last}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/pattern_matching" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../pattern_matching</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/seleksi-kondisi-if">Seleksi Kondisi ➜ if, else if, else</a></li><li><a href="/basic/tuple">Tipe Data ➜ Tuple</a></li><li><a href="/basic/struct">Struct</a></li><li><a href="/basic/enum">Enum</a></li><li><a href="/basic/option-type">Tipe Data ➜ Option</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-work-in-progress">◉ Work in progress<a class="hash-link" href="#-work-in-progress" title="Direct link to heading">​</a></h3><ul><li>Pembahasan tentang <code>while let</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/flow_control/match.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/flow_control/match.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/operator-tanda-tanya"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.41. Operator ?</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/static"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.43. Static Item</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a421-keyword-match" class="table-of-contents__link toc-highlight">A.42.1. Keyword <code>match</code></a><ul><li><a href="#-menampung-nilai-balik-match" class="table-of-contents__link toc-highlight">◉ Menampung nilai balik <code>match</code></a></li></ul></li><li><a href="#a422-pattern-matching" class="table-of-contents__link toc-highlight">A.42.2. Pattern matching</a><ul><li><a href="#-pengecekan-nilai-enum" class="table-of-contents__link toc-highlight">◉ Pengecekan nilai enum</a></li><li><a href="#-pattern--dan-" class="table-of-contents__link toc-highlight">◉ Pattern <code>|</code> dan <code>..</code></a></li><li><a href="#-match-guard" class="table-of-contents__link toc-highlight">◉ Match guard</a></li><li><a href="#-binding-" class="table-of-contents__link toc-highlight">◉ Binding <code>@</code></a></li><li><a href="#-if-let" class="table-of-contents__link toc-highlight">◉ <code>if let</code></a></li></ul></li><li><a href="#a423-destructuring-assignment" class="table-of-contents__link toc-highlight">A.42.3. Destructuring assignment</a><ul><li><a href="#-struct-destructuring" class="table-of-contents__link toc-highlight">◉ Struct destructuring</a></li><li><a href="#-enum-destructuring" class="table-of-contents__link toc-highlight">◉ Enum destructuring</a></li><li><a href="#-tuple-destructuring" class="table-of-contents__link toc-highlight">◉ Tuple destructuring</a></li><li><a href="#-variabel-_" class="table-of-contents__link toc-highlight">◉ Variabel <code>_</code></a></li><li><a href="#-operator-" class="table-of-contents__link toc-highlight">◉ Operator <code>..</code></a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-work-in-progress" class="table-of-contents__link toc-highlight">◉ Work in progress</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/perulangan-for-in.html b/basic/perulangan-for-in.html index 433f87d6..f507b166 100644 --- a/basic/perulangan-for-in.html +++ b/basic/perulangan-for-in.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-for-in/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-for-in/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.12. Perulangan ➜ for in","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-for-in/#webpage"},"wordCount":264,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-for-in/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-for-in/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-for-in","name":"A.12. Perulangan ➜ for in","description":"for in adalah salah satu keyword untuk operasi perulangan yang ada di Rust selain loop dan while. Pada chapter ini kita akan mempelajarinya.","datePublished":"2024-08-01T10:17:29.974Z","dateModified":"2024-08-01T10:17:29.974Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-for-in/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/perulangan-for-in"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-for-in/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.12. Perulangan ➜ for in","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-for-in/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-for-in/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.12. Perulangan ➜ for in","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-for-in/#webpage"},"wordCount":264,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-for-in/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-for-in/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-for-in","name":"A.12. Perulangan ➜ for in","description":"for in adalah salah satu keyword untuk operasi perulangan yang ada di Rust selain loop dan while. Pada chapter ini kita akan mempelajarinya.","datePublished":"2024-08-30T07:44:50.053Z","dateModified":"2024-08-30T07:44:50.053Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-for-in/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/perulangan-for-in"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-for-in/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.12. Perulangan ➜ for in","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.12. Perulangan ➜ for in</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.12. Perulangan ➜ for in</h1></header><p><code>for in</code> adalah salah satu keyword untuk operasi perulangan yang ada di Rust selain <code>loop</code> dan <code>while</code>. Pada chapter ini kita akan mempelajarinya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a121-keyword-for-in">A.12.1. Keyword <code>for in</code><a class="hash-link" href="#a121-keyword-for-in" title="Direct link to heading">​</a></h2><p><code>for in</code> adalah keyword perulangan yang paling sering dipakai untuk meng-iterasi data yang tipe data-nya mengimplementasikan trait <code>Iterator</code>. Ada banyak jenis tipe data dengan trait ini, salah satunya adalah tipe data <strong>range</strong> yang akan kita bahas pada chapter ini.</p><blockquote><ul><li>Lebih jelasnya mengenai traits dibahas pada chapter <a href="/basic/traits">Traits</a></li><li>Lebih jelasnya mengenai trait <code>Iterator</code> dibahas pada chapter <a href="/basic/trait-iterator">Trait ➜ Iterator</a></li></ul></blockquote><p>Tipe data range dibuat dengan notasi penulisan <code>a..b</code>. Mari lanjut dengan praktik agar lebih jelas. Silakan coba kode sederhana berikut lalu jalankan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="perulangan for in" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb4AAACpCAIAAADbS88pAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rv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uJxuVb/EIScAnHgieZ3O77rV7mqonAAAUvEfuNgJAEAk+XDSvS+rrblEZlh9AQA4JqRK5w1Nnat9g6eTAOCki7zW6VzoJDzXCQBARIg6BgDoAb6ICQAgDaUTAEAaSicAgDSUTgAAaSidAADSUDoBAKShdAIASBMunavrt0ul0u311WH2BgDgWBAsnavrn6h7tdpw+wIAcEwIlc7V9U9UqpS+GXZnAACOB4HSaRbO/0DSHACAJbp03tBQOAEAPKJK542N64sonAAAHhHJSe5fEu5C9BwAnHAyoXM3NkofNPHzGgAAeCQeAEAaoo4BAKThqBMAQBpKJwCANJROAABpKJ0AANJQOgEApKF0AgBIQ+kEAJCG0gkAIA2lEwBAGkonAIA0lE4AAGkonQAA0lA6AQCk/T/+HbRpX10SrAAAAABJRU5ErkJggg==" width="446" height="169" class="img_ev3q"></p><p>Keyword <code>for in</code> jika digunakan pada notasi iterator <code>a..b</code> maka akan menghasilkan sebuah perulangan dari angka <code>a</code> hingga angka di bawah <code>b</code>.</p><p>Pada contoh di atas, <code>0..5</code> artinya adalah objek iterator yang dimulai dari angka <code>0</code> hingga di bawah <code>5</code> (yaitu <code>4</code>). Object iterator tersebut kemudian diiterasi, dan ditiap perulangan di-print menggunakan <code>println!("{i}")</code>. Dengan ini, nilai <code>i</code> muncul di layar console dimulai angka <code>0</code> hingga <code>4</code>.</p><p>Jika ingin melakukan perulangan dari <code>a</code> ke <code>b</code> (bukan dari <code>a</code> ke angka di bawah <code>b</code>) gunakan notasi iterator <code>a..=b</code>. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="perulangan for in" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb0AAADACAIAAAAfhyq4AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8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3dkKtzFtXQAGHdcdVMvmgjdBADgyt+8fTd/M25+ALnFADDGkFsMACAG9yEBAIhB3QQAEIO6CQAgBnUTAEAM6iYAgBjUTQAAMaibAABiuL6fbr7xHbnFADDmBO97X12/dydRxLeFAGCMCR6nP/7uYDD9AAA4LQTr5u3leL34JXY2AWCMceZvGj/MVnqYRdkEgHEmmuuBE5wAMO5E70N6/GWxPh1JDKQvAACngWjdvJ2Vp0vf4EYkABhfPOc3jZObhPs3AWDsIbcYAEAMvmcJACAGdRMAQAzqJgCAGNRNAAAxqJsAAGJQNwEAxKBuAgCIEambq+v38vn8vfXVgfUGAMD/+Ovm6vpn8kGpNMC+AACcBrx1c3X9M5kK+W8G2hkAgFOAr26qVfM/ER4HAMBXN29nUTUBADQcdfP23ZtzqJoAAJrOeUjmHwFuQ5ocAIwtwRy523fzn9TwKxkAMM5w3zsAgBjkFgMAiMH+JgCAGNRNAAAxqJsAAGJQNwEAxKBuAgCIQd0EABCDugkAIOZnPE9aXb93R55u/xNfsgSAccZVN4moXsC3KwEAiHCcDgAgCnUTAEAM73H6tHwnn79DhLObADDuRHM9Vtfv3ZEPUDoBYHyJHqc//rJYH0hHAABOCcG6ubr+mTxd+gY7mwAwvnjOb5pv36wX7mZxPxIAjDPkFgMAiMF9SAAAYlA3AQDEoG4CAIhB3QQAEIO6CQAgBnUTAEAM6iYAgBjUTQAAMaibAABiUDcBAMSgbgIAiPl/GSIP/OXqVSQAAAAASUVORK5CYII=" width="445" height="192" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a122-label-perulangan">A.12.2. Label perulangan<a class="hash-link" href="#a122-label-perulangan" title="Direct link to heading">​</a></h2><p>Penambahan label pada perulangan <code>for in</code> juga bisa dilakukan. Caranya dengan cukup menambahkan sintaks <code>'namaLabel: </code> sebelum statement <code>for in</code>. Contohnya seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token lifetime-annotation symbol" style="color:#36acaa">'perulangan</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"perulangan dihentikan paksa pada iterasi {i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'perulangan</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="label perulangan for in" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcAAAAC0CAIAAACMg2tHAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy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XfwVaz1bzPz9Nlnai3ObJWLBc21unOvXT4InladzGkJhbsyVzrLoeIBsS1RZmmuiuyRESFclmFYuR5I4CgcnFFblUe0s7DSstYwBJBn2LTWtF6/2Zy+JUxornrcaY+vzOXnaz9VSg5k52vDs2Z2PL6hnV/Six5MIdUmq3eVNE373t3NqvyiuUZl/DVtGG2pmeebusmlaZliS94kTyt85ujz7o7PR+w4Tyt2xwiwv2C2sNcnUX0PHf4j0C7k5zuJOXeHVrfKHSnPvzJy869j29vFArlcoFa2qbWWkmQfS60Ui6v6IOAsna7YBiqalpLSXBKs3PvoVq2TrtaWvHOPeHkbO4XNheNTKubRe32XeKVs8IuE8MhXGMWp7g251mG7heKcxuFQnnjdvFOf9UkYrTmjneeXes76se2SWx1UxVIHso6sznEm5jdwYjh+fvCPZlpfZnlEK51cCHxFlT2e/Ro9DhKhC/dBeBsWzN6fQmAvjlv78KnE9bp0/Lt9JQ5tQIAgBFz3t5EskzviAgfagIAnCH4JhIAAITkvE3hAQAgMiCAAgBASBBAAQAgJAigAAAQEgRQAAAICQIoAACEBAEUAABCggAKAAAhQQAFAICQ/D/GeNjqY6vObwAAAABJRU5ErkJggg==" width="448" height="180" class="img_ev3q"></p><p>Selain <code>break</code>, keyword <code>continue</code> juga bisa digunakan pada perulangan <code>for in</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a123-perulangan-for-in-pada-array">A.12.3. Perulangan <code>for in</code> pada array<a class="hash-link" href="#a123-perulangan-for-in-pada-array" title="Direct link to heading">​</a></h2><p>Perulangan menggunakan <code>for in</code> adalah yang paling praktis digunakan untuk mengiterasi elemen array. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> array </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"jason"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"grayon"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"drake"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> name </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> array </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{name}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="label perulangan for in" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUg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4LIRqFucU053NZWj3Yp5nUu32JpMUdMqzm3b0syrc2tYAAUAXC58/aamh8QcD3LpFmusak7TGIBuLJlpHmztVyKJVThOAMAlInCezoZTt5iIIooiU9OUQ1qZnyPZqrGkT/4BAOCS0KXfdGHoFm8dkK6jpH/RVPMP6UEul9846AxcsagJALjE+M7TD748NV6strK5Y32tJRObbrE1ma37uxVZX8g82C835bX8BjMFAAAYf/zHm9u53SVduLiym1dXH3iH9NQt1hPKz+/kcsWd1fz9rfu0uZPrzNShlwQAuFxADwkAAMTAuXcAABADfhMAAMSA3wQAADHgNwEAQAz4TQAAEAN+EwAAxBiobnEnXhHyxQCAKwPGmwAAIEa/nk/3YTuXwcPoAICrQze6xQyJ4o18camhzilKpKnulhNrSqSp5u9vUSecTcrDrXC8srnzgB7uR3PaQ/AQ/gAAjC/d6BazJYplJbqf2a1ElDXt/8TqCh1s3de0ja1peigcR5TcaiNvlUIGAIBxpBvdYrZEcVMtblv/98RL4biyq+l7OGSPAQBgvOhqfdNDonhI0QEAYKR0sZ9uSBTrM+1mcIx+RgcAgBHTpW6xl0QxJz1GBwCAEdKFbnGARHGHrQPrhHytWFzT9sk5owMAwHgC3WIAABADzwsBAIAY8JsAACAG/CYAAIgBvwkAAGLAbwIAgBjwmwAAIAb8JgAAiAG/CQAAYsBvAgCAGPCbAAAgBvwmAACIAb8JAABiwG8CAIAY8JsAACAG/CYAAIgBvwkAAGL8P8WW/mrC7FDtAAAAAElFTkSuQmCC" width="445" height="149" class="img_ev3q"></p><p>Perihal apa itu <code>array</code> akan dibahas pada chapter selanjutnya, yaitu <a href="/basic/array">Array</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a124-perulangan-for-in-pada-tipe-iterator-lainnya">A.12.4. Perulangan <code>for in</code> pada tipe iterator lainnya<a class="hash-link" href="#a124-perulangan-for-in-pada-tipe-iterator-lainnya" title="Direct link to heading">​</a></h2><p>Di Rust ada banyak cara membuat object iterator. Mengenai topik satu ini kita akan bahas seiring berjalannya proses pembelajaran. Akan berpotesi makin membingungkan jika dibahas terlalu detail pada chapter ini.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/perulangan_for_in" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../perulangan_for_in</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/reference/expressions/loop-expr.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/expressions/loop-expr.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.in.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.in.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.for.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.for.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/flow_control/for.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/flow_control/for.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/perulangan-loop-break-continue-label"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.11. Perulangan ➜ loop, break, continue, label</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/array"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.13. Array</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a121-keyword-for-in" class="table-of-contents__link toc-highlight">A.12.1. Keyword <code>for in</code></a></li><li><a href="#a122-label-perulangan" class="table-of-contents__link toc-highlight">A.12.2. Label perulangan</a></li><li><a href="#a123-perulangan-for-in-pada-array" class="table-of-contents__link toc-highlight">A.12.3. Perulangan <code>for in</code> pada array</a></li><li><a href="#a124-perulangan-for-in-pada-tipe-iterator-lainnya" class="table-of-contents__link toc-highlight">A.12.4. Perulangan <code>for in</code> pada tipe iterator lainnya</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.12. Perulangan ➜ for in</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.12. Perulangan ➜ for in</h1></header><p><code>for in</code> adalah salah satu keyword untuk operasi perulangan yang ada di Rust selain <code>loop</code> dan <code>while</code>. Pada chapter ini kita akan mempelajarinya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a121-keyword-for-in">A.12.1. Keyword <code>for in</code><a class="hash-link" href="#a121-keyword-for-in" title="Direct link to heading">​</a></h2><p><code>for in</code> adalah keyword perulangan yang paling sering dipakai untuk meng-iterasi data yang tipe data-nya mengimplementasikan trait <code>Iterator</code>. Ada banyak jenis tipe data dengan trait ini, salah satunya adalah tipe data <strong>range</strong> yang akan kita bahas pada chapter ini.</p><blockquote><ul><li>Lebih jelasnya mengenai traits dibahas pada chapter <a href="/basic/traits">Traits</a></li><li>Lebih jelasnya mengenai trait <code>Iterator</code> dibahas pada chapter <a href="/basic/trait-iterator">Trait ➜ Iterator</a></li></ul></blockquote><p>Tipe data range dibuat dengan notasi penulisan <code>a..b</code>. Mari lanjut dengan praktik agar lebih jelas. Silakan coba kode sederhana berikut lalu jalankan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="perulangan for in" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb4AAACpCAIAAADbS88pAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMDktMjZUMjE6NTE6NDkrMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyLTA5LTI3VDE2OjU3OjQyKzA3O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ADSUDoBAKShdAIASBMunavrt0ul0u311WH2BgDgWBAsnavrn6h7tdpw+wIAcEwIlc7V9U9UqpS+GXZnAACOB4HSaRbO/0DSHACAJbp03tBQOAEAPKJK542N64sonAAAHhHJSe5fEu5C9BwAnHAyoXM3NkofNPHzGgAAeCQeAEAaoo4BAKThqBMAQBpKJwCANJROAABpKJ0AANJQOgEApKF0AgBIQ+kEAJCG0gkAIA2lEwBAGkonAIA0lE4AAGkonQAA0lA6AQCk/T/+HbRpX10SrAAAAABJRU5ErkJggg==" width="446" height="169" class="img_CujE"></p><p>Keyword <code>for in</code> jika digunakan pada notasi iterator <code>a..b</code> maka akan menghasilkan sebuah perulangan dari angka <code>a</code> hingga angka di bawah <code>b</code>.</p><p>Pada contoh di atas, <code>0..5</code> artinya adalah objek iterator yang dimulai dari angka <code>0</code> hingga di bawah <code>5</code> (yaitu <code>4</code>). Object iterator tersebut kemudian diiterasi, dan ditiap perulangan di-print menggunakan <code>println!("{i}")</code>. Dengan ini, nilai <code>i</code> muncul di layar console dimulai angka <code>0</code> hingga <code>4</code>.</p><p>Jika ingin melakukan perulangan dari <code>a</code> ke <code>b</code> (bukan dari <code>a</code> ke angka di bawah <code>b</code>) gunakan notasi iterator <code>a..=b</code>. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="perulangan for in" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb0AAADACAIAAAAfhyq4AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Im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/7uYDD9AAA4LQTr5u3leL34JXY2AWCMceZvGj/MVnqYRdkEgHEmmuuBE5wAMO5E70N6/GWxPh1JDKQvAACngWjdvJ2Vp0vf4EYkABhfPOc3jZObhPs3AWDsIbcYAEAMvmcJACAGdRMAQAzqJgCAGNRNAAAxqJsAAGJQNwEAxKBuAgCIEambq+v38vn8vfXVgfUGAMD/+Ovm6vpn8kGpNMC+AACcBrx1c3X9M5kK+W8G2hkAgFOAr26qVfM/ER4HAMBXN29nUTUBADQcdfP23ZtzqJoAAJrOeUjmHwFuQ5ocAIwtwRy523fzn9TwKxkAMM5w3zsAgBjkFgMAiMH+JgCAGNRNAAAxqJsAAGJQNwEAxKBuAgCIQd0EABCDugkAIOZnPE9aXb93R55u/xNfsgSAccZVN4moXsC3KwEAiHCcDgAgCnUTAEAM73H6tHwnn79DhLObADDuRHM9Vtfv3ZEPUDoBYHyJHqc//rJYH0hHAABOCcG6ubr+mTxd+gY7mwAwvnjOb5pv36wX7mZxPxIAjDPkFgMAiMF9SAAAYlA3AQDEoG4CAIhB3QQAEIO6CQAgBnUTAEAM6iYAgBjUTQAAMaibAABiUDcBAMSgbgIAiPl/GSIP/OXqVSQAAAAASUVORK5CYII=" width="445" height="192" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a122-label-perulangan">A.12.2. Label perulangan<a class="hash-link" href="#a122-label-perulangan" title="Direct link to heading">​</a></h2><p>Penambahan label pada perulangan <code>for in</code> juga bisa dilakukan. Caranya dengan cukup menambahkan sintaks <code>'namaLabel: </code> sebelum statement <code>for in</code>. Contohnya seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token lifetime-annotation symbol" style="color:#36acaa">'perulangan</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"perulangan dihentikan paksa pada iterasi {i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'perulangan</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="label perulangan for in" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcAAAAC0CAIAAACMg2tHAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94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z2PL6hnV/Six5MIdUmq3eVNE373t3NqvyiuUZl/DVtGG2pmeebusmlaZliS94kTyt85ujz7o7PR+w4Tyt2xwiwv2C2sNcnUX0PHf4j0C7k5zuJOXeHVrfKHSnPvzJy869j29vFArlcoFa2qbWWkmQfS60Ui6v6IOAsna7YBiqalpLSXBKs3PvoVq2TrtaWvHOPeHkbO4XNheNTKubRe32XeKVs8IuE8MhXGMWp7g251mG7heKcxuFQnnjdvFOf9UkYrTmjneeXes76se2SWx1UxVIHso6sznEm5jdwYjh+fvCPZlpfZnlEK51cCHxFlT2e/Ro9DhKhC/dBeBsWzN6fQmAvjlv78KnE9bp0/Lt9JQ5tQIAgBFz3t5EskzviAgfagIAnCH4JhIAAITkvE3hAQAgMiCAAgBASBBAAQAgJAigAAAQEgRQAAAICQIoAACEBAEUAABCggAKAAAhQQAFAICQ/D/GeNjqY6vObwAAAABJRU5ErkJggg==" width="448" height="180" class="img_CujE"></p><p>Selain <code>break</code>, keyword <code>continue</code> juga bisa digunakan pada perulangan <code>for in</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a123-perulangan-for-in-pada-array">A.12.3. Perulangan <code>for in</code> pada array<a class="hash-link" href="#a123-perulangan-for-in-pada-array" title="Direct link to heading">​</a></h2><p>Perulangan menggunakan <code>for in</code> adalah yang paling praktis digunakan untuk mengiterasi elemen array. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> array </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"jason"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"grayon"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"drake"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> name </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> array </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{name}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="label perulangan for in" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb0AAACVCAIAAABDxLP8AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpy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kK6jpH/RVPMP6UEul9846AxcsagJALjE+M7TD748NV6strK5Y32tJRObbrE1ma37uxVZX8g82C835bX8BjMFAAAYf/zHm9u53SVduLiym1dXH3iH9NQt1hPKz+/kcsWd1fz9rfu0uZPrzNShlwQAuFxADwkAAMTAuXcAABADfhMAAMSA3wQAADHgNwEAQAz4TQAAEAN+EwAAxBiobnEnXhHyxQCAKwPGmwAAIEa/nk/3YTuXwcPoAICrQze6xQyJ4o18camhzilKpKnulhNrSqSp5u9vUSecTcrDrXC8srnzgB7uR3PaQ/AQ/gAAjC/d6BazJYplJbqf2a1ElDXt/8TqCh1s3de0ja1peigcR5TcaiNvlUIGAIBxpBvdYrZEcVMtblv/98RL4biyq+l7OGSPAQBgvOhqfdNDonhI0QEAYKR0sZ9uSBTrM+1mcIx+RgcAgBHTpW6xl0QxJz1GBwCAEdKFbnGARHGHrQPrhHytWFzT9sk5owMAwHgC3WIAABADzwsBAIAY8JsAACAG/CYAAIgBvwkAAGLAbwIAgBjwmwAAIAb8JgAAiAG/CQAAYsBvAgCAGPCbAAAgBvwmAACIAb8JAABiwG8CAIAY8JsAACAG/CYAAIgBvwkAAGL8P8WW/mrC7FDtAAAAAElFTkSuQmCC" width="445" height="149" class="img_CujE"></p><p>Perihal apa itu <code>array</code> akan dibahas pada chapter selanjutnya, yaitu <a href="/basic/array">Array</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a124-perulangan-for-in-pada-tipe-iterator-lainnya">A.12.4. Perulangan <code>for in</code> pada tipe iterator lainnya<a class="hash-link" href="#a124-perulangan-for-in-pada-tipe-iterator-lainnya" title="Direct link to heading">​</a></h2><p>Di Rust ada banyak cara membuat object iterator. Mengenai topik satu ini kita akan bahas seiring berjalannya proses pembelajaran. Akan berpotesi makin membingungkan jika dibahas terlalu detail pada chapter ini.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/perulangan_for_in" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../perulangan_for_in</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/reference/expressions/loop-expr.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/expressions/loop-expr.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.in.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.in.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.for.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.for.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/flow_control/for.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/flow_control/for.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/perulangan-loop-break-continue-label"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.11. Perulangan ➜ loop, break, continue, label</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/array"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.13. Array</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a121-keyword-for-in" class="table-of-contents__link toc-highlight">A.12.1. Keyword <code>for in</code></a></li><li><a href="#a122-label-perulangan" class="table-of-contents__link toc-highlight">A.12.2. Label perulangan</a></li><li><a href="#a123-perulangan-for-in-pada-array" class="table-of-contents__link toc-highlight">A.12.3. Perulangan <code>for in</code> pada array</a></li><li><a href="#a124-perulangan-for-in-pada-tipe-iterator-lainnya" class="table-of-contents__link toc-highlight">A.12.4. Perulangan <code>for in</code> pada tipe iterator lainnya</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/perulangan-loop-break-continue-label.html b/basic/perulangan-loop-break-continue-label.html index 1ece8428..c5ce6dd5 100644 --- a/basic/perulangan-loop-break-continue-label.html +++ b/basic/perulangan-loop-break-continue-label.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-loop-break-continue-label/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-loop-break-continue-label/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.11. Perulangan ➜ loop, break, continue, label","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-loop-break-continue-label/#webpage"},"wordCount":437,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-loop-break-continue-label/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-loop-break-continue-label/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-loop-break-continue-label","name":"A.11. Perulangan ➜ loop, break, continue, label","description":"Selain keyword while, ada juga keyword loop yang fungsi dasarnya adalah sama, yaitu untuk perulangan.","datePublished":"2024-08-01T10:17:30.338Z","dateModified":"2024-08-01T10:17:30.338Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-loop-break-continue-label/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/perulangan-loop-break-continue-label"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-loop-break-continue-label/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.11. Perulangan ➜ loop, break, continue, label","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-loop-break-continue-label/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-loop-break-continue-label/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.11. Perulangan ➜ loop, break, continue, label","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-loop-break-continue-label/#webpage"},"wordCount":437,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-loop-break-continue-label/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-loop-break-continue-label/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-loop-break-continue-label","name":"A.11. Perulangan ➜ loop, break, continue, label","description":"Selain keyword while, ada juga keyword loop yang fungsi dasarnya adalah sama, yaitu untuk perulangan.","datePublished":"2024-08-30T07:44:50.203Z","dateModified":"2024-08-30T07:44:50.203Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-loop-break-continue-label/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/perulangan-loop-break-continue-label"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-loop-break-continue-label/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.11. Perulangan ➜ loop, break, continue, label","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.11. Perulangan ➜ loop, break, continue, label</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.11. Perulangan ➜ loop, break, continue, label</h1></header><p>Selain keyword <code>while</code>, ada juga keyword <code>loop</code> yang fungsi dasarnya adalah sama, yaitu untuk perulangan.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a111-keyword-loop">A.11.1. Keyword <code>loop</code><a class="hash-link" href="#a111-keyword-loop" title="Direct link to heading">​</a></h2><p>Notasi penulisan dan cara penggunaan <code>loop</code> ada sedikit beda dibanding <code>while</code>. Keyword <code>loop</code> tidak membutuhkan argument. Blok kode loop akan terus dieksekusi selama program tidak di-stop.</p><p>Silakan coba praktikkan kode berikut. Angka <code>i</code> akan ditampilkan setiap perulangan kemudian di-increment nilainya. Angka akan muncul terus sampai aplikasi di-stop.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"nilai: {i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="loop tanpa break" src="/assets/images/perulangan-loop-break-continue-label-1-f02ae31c07ab672a301cbf6db2f23179.png" width="608" height="213" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a112-keyword-break">A.11.2. Keyword <code>break</code><a class="hash-link" href="#a112-keyword-break" title="Direct link to heading">​</a></h2><p><code>loop</code> menghasilkan perulangan tanpa henti, lalu bagaimana cara stop-nya? Di sinilah keyword <code>break</code> berperan. <code>break</code> digunakan untuk menghentikan paksa eksekusi blok kode perulangan. Biasanya keyword ini digunakan dalam kondisi tertentu (sesuai kebutuhan), misalnya <code>perulangan harus berhenti ketika nilai i di atas max</code>.</p><p>Mari kita ubah kode di atas dengan menambahkan kondisi untuk menghentikan perulangan jika <code>i</code> nilainya lebih dari <code>5</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"nilai: {i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> max </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"perulangan selesai"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="keyword break" src="data:image/png;base64,iVBORw0K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eWqPEmYac5jfYBbNhG72+qQ9KhMdUH47m7TLlIuUbuw/yVZrZqPsawMPeM0cqzl7ScY2pesJAHEz0Uja7xER83qe3MmVnQm936CAn3pu/OmiotkDV9+o7jdCrc5l3/EpV2uVwz16ckphLluyl/Rucz8rX08AiJWwT0GVqztqv3lKjdNm37pgKsKcfVO5WglKehbKhM7vbVtXSXVd150PX4aJlPbR7JmXK8WbGbykvc1p1hMAYkH0nHQ4cR1OUfef0N5hZTid5T9O3tj/fPuwUqnVKtQ3jo3+Top4Sc+sTGj2Jk/1mnMq3TeqT/aFV2dzT7lbxzq3mcSsfNCSw202ZhB9DQBREkl6Dnpyaf48NcrvHVayTXwxCAAispjfu89+8KPb21v7r1/+49++f9P5HwyjABARodn97c3Nzc2saxLGwb/UNv7tn37963+4ubm5uUkk/vjlZ//671FXCgDeWfgdJwAAWYs5uwcAiBOMpAAAsjCSAgDIittImkgkElHXAQAgnLjlkzoebgIAWBBxOycFAFg8GEkBAGRhJAUAkIWRFABAFkZSAABZGEkBAGT9FQWZAW1qe1RkAAAAAElFTkSuQmCC" width="451" height="195" class="img_ev3q"></p><blockquote><p>Penulisan <code>break</code> boleh tanpa diakhiri semicolon <code>;</code></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a113-nested-loop">A.11.3. Nested <code>loop</code><a class="hash-link" href="#a113-nested-loop" title="Direct link to heading">​</a></h2><p>Cara menerapkan nested loop (atau <code>loop</code> di dalam <code>loop</code>), tulis saja statement <code>loop</code> di dalam <code>loop</code> sesuai kebutuhan.</p><p>Pada kode berikut, teknik nested loop diterapkan untuk membuat bentuk segitiga menggunakan karakter <code>*</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> j </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> max</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max_inner </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> i</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"* "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> j </span><span class="token operator" style="color:#393A34">-=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> j </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> max_inner </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> max </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="keyword break" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcYAAACvCAIAAADojOlYAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvd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XQ7YiqAEALrX1R1ADAFwZWYmgBgC4AhBBDQCgDO5LBQBQBiUVAEAZlFQAAGVQUgEAlEFJBQBQBiUVAEAZlFQAAGVQUgEAlEFJBQBQBiUVAECZ5UZQAwBcK8uKoAYAuIaWGEENAHDdrCKCGgDgmlhWBDUAwDW03AhqAIBrBRHUAADK4L5UAABlUFIBAJRBSQUAUAYlFQBAGZRUAABlUFIBAJRBSQUAUAYlFQBAGZRUAABlUFIBAJRBSQUAUOb/AXL0LrDrCNz+AAAAAElFTkSuQmCC" width="454" height="175" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a114-keyword-continue">A.11.4. Keyword <code>continue</code><a class="hash-link" href="#a114-keyword-continue" title="Direct link to heading">​</a></h2><p><code>continue</code> digunakan untuk melanjutkan paksa sebuah perulangan, kebalikan dari <code>break</code> yang fungsinya menghentikan paksa sebuah perulangan.</p><p>Source code berikut merupakan contoh penerapan <code>continue</code>. Variabel <code>i</code> berperan sebagai counter perulangan. Jika nilai <code>i</code> adalah ganjil, maka perulangan dipaksa lanjut ke iterasi berikutnya. Dengan ini maka macro <code>println</code> hanya akan menampilkan nilai genap. Dan program akan berhenti jika <code>i</code> nilainya lebih dari <code>max</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">15</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">continue</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"nilai i: {i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> max </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="keyword continue" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcgAAADmCAIAAADeEoJPAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4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AAIBkKKwAAJKhsAIASIbCCgAgGQorAIBkKKwAAJIh6BoAQLLZDrpGzjUAhGCWg67Xt57nG0Z6AXKuAUCeGQ66Hu5YExHRzuvmxkY6T4TCCgCBzXDQNQBAOGY+6JqIiCq1jVxPr+McKwDIMNtB10REtL61u5FrvtCwSwsAckR2H6sZdD08FzDdEb1861u7VZX0Gu4IAABpZjjoelxVcf4VAGSa3aBr7dkPmpoy/yYihF0DgBwIugYAkAxZAQAAkqGwAgBIhsIKACAZCisAgGQorAAAkqGwAgBIhqBrAADJQtljDZZEFR5OXTa+B1CvAUCSWQ66NqxvPVdPms3c8pQzBgBwmOWga2O2z1XSa6/T1SeefQcAEDbbQddGWf0C+QAAINNMB11XNJRVAJBvhoOuK7WNZb1WRVkFAMkiK6xm0PX2IcXjydiVRzlK0SgykIiq9bqGh2ADQGAR7rE6gq6l7bGKXLxisN1hUKnVn3QRxgoAUsxu0DXKKACEBEHXAACSISsAAEAyFFYAAMlQWAEAJENhBQCQDIUVAEAyFFYAAMkQdA0AIFkov7w63H52GI/frdpVavWNnPOnAZVa3QhC9PmbAwAAjtkOul7f2q2qJy+0QN0HALCb6aDriqaeYC8VAGSb5aDryqNcr3uvVvdzPhgAYKIZDrpev7dMKTX92ij2L5q5DVwWAwAZZjjomoio+cKsyDt1/Uk1nSdC5BUABBTZfaxm0PXwXEAMnox9+MMJLd/DPioAyBbpDwRsQdfSVGpTniDded1MqdrwjRVNTTVf4zoWAAQ300HXO9Xavd2q0SfcxQoAsiDoGgBAMmQFAABIhsIKACAZCisAgGQorAAAkqGwAgBIhsIKACAZCisAgGQorAAAkqGwAgBIhsIKACAZCisAgGQorAAAkqGwAgBI9v8D/7mbhZbXfgAAAABJRU5ErkJggg==" width="456" height="230" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a115-label-perulangan">A.11.5. Label perulangan<a class="hash-link" href="#a115-label-perulangan" title="Direct link to heading">​</a></h2><p>Statement perulangan menggunakan <code>loop</code> bisa ditandai dengan label. Manfaat dari penggunaan label adalah bisa mengeksekusi <code>break</code> atau <code>continue</code> ke perulangan di luar blok kode perulangan di mana statement itu berada. Umumnya label perulangan dipergunakan pada nested loop untuk keperluan menghentikan/melanjutkan paksa perulangan terluar.</p><p>Berikut adalah notasi penulisan loop dengan dan tanpa label. Nama label diawali dengan tanda petik <code>'</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// loop biasa</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// statements</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// loop dengan label</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token lifetime-annotation symbol" style="color:#36acaa">'namaLabel</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// statements</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'namaLabel</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Mari kita pelajari dan praktikkan kode berikut ini. Di bawah ini adalah sebuah program sederhana menampilkan angka yang hasilnya bisa dilihat pada gambar di bawahnya. Perulangan di level 2 akan dihentikan secara paksa ketika <code>j > i</code>. Sedangkan perulangan level pertama atau terluar (dengan label <code>'mainLoop</code>) akan dihentikan paksa dari perulangan level 2 jika kondisi <code>i > max</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">9</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token lifetime-annotation symbol" style="color:#36acaa">'mainLoop</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> j </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> max </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'mainLoop</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> j </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> j </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> i </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{i} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="looping label" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgIAAADjCAIAAAB4oOuVAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFEmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxu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Dhoc0kAuGZMchGLiGzvf5yuPHYNxkRsLgkA147h1cCu64jhibPFJQHg+jEKA9v7H6eb5ceGJ862lgSA68gkDOy6Tqzy2OQhGZtLAsC1FB0Gtvc/Nrw/anNJALimosLA9v7nhqfDNpcEgGuLtDMAYDUmkwAAqxEGAMBqhAEAsBphAACsRhgAAKsRBgDAaoQBALBa5AyjuwfFnXT7vyuhM+5T0qQkAMyX8KuB7f3DHXnkeh5V0jsHu5QcoyQAzJ3wMJCJx5qNcvuPcqNJyfFKAsDcCQ8DD59VYs7ewa50Jth5phvtoKRJSQCYOwZzCrXHvQ0yslOSvPUArpuIJ4V2D4rFjxsHrus+OnP2iof725QcpyQAzJvQMOBNt//HL56IyMM991El5rjqu5+UNCkJAPMn8r2BWDzT/q/de2np3Qql5GglAWC+RN0b8D8QHz7uTUmTkgAwZ0g7AwBWYzIJALAaYQAArEYYAACrEQYAwGqEAQCwGmEAAKxGGAAAqw2RdibqvShKTrYkAMxCdNqZjdKBl0/lrD2ZMiVnUBIAZiQ0DOy6TqzyuH3G+rBYaqbvaY5blJxsSQCYlah7A75Z0p78/Uw23tfOoUzJyZYEgJkIDQMPn/kmTd496M6eRslplwSAWTGfYbTy6JHs3Hvm7mkyLFJysiUBYCainhR6uOd2DlPb+4dhE+lTcrIlAWAmIh8YbdveP9zLlA8+i37AkZKTLQkAUxUeBrb3D/ecmIiIVB65n4UMX1BysiUBYEZIOwMAVmMyCQCwGmEAAKxGGAAAqxEGAMBqhAEAsBphAACsRhgAAKsRBgDAaoQBALAaYQAArEYYAACrEQYAwGr/D8LOrDKULylFAAAAAElFTkSuQmCC" width="514" height="227" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a116-returning-from-loop">A.11.6. Returning from <code>loop</code><a class="hash-link" href="#a116-returning-from-loop" title="Direct link to heading">​</a></h2><p><em>Returning from <code>loop</code></em> merupakan teknik pemanfaatan <code>loop</code> dan <code>break</code> untuk menampung sebuah return value dari blok kode perulangan <code>loop</code>. Agar lebih jelas, silakan coba kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> counter </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> counter </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> counter </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token plain"> counter </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {result}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas, variabel <code>result</code> dideklarasikan dengan predefined value adalah blok kode <code>loop</code>. Di sini artinya variabel <code>result</code> isinya bukan blok kode perulangan <code>loop</code>, melainkan isinya adalah apapun yang dituliskan setelah keyword <code>break</code>. Unik ya?</p><p>Variabel <code>counter</code> yang nilai awalnya <code>0</code>, di-increment dalam perulangan. Ketika nilai <code>counter</code> adalah <code>10</code>, nilai <code>counter * 2</code> dijadikan sebagai return value. Dengan ini maka variabel <code>result</code> nilainya adalah <code>20</code>.</p><p><img loading="lazy" alt="looping label" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAikAAAB1CAIAAAAEIubsAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLm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2EMQBEEQ8XJpvi0lCIIgLgwUewiCIIi0odhDEARBpA3FHoIgCCJtKPYQBEEQaUOxhyAIgkgbij0EQRBE2lDsIQiCINKGYg9BEASRNhR7CIIgiLSh2EMQBEGkDcUegiAIIm0o9hAEQRBpQ7GHIAiCSBuKPQRBEETa/D+WdfpclQ0ncgAAAABJRU5ErkJggg==" width="553" height="117" class="img_ev3q"></p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/perulangan_loop_break_continue_label" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../perulangan_loop_break_continue_label</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch03-05-control-flow.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch03-05-control-flow.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.loop.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.loop.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.break.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.break.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.continue.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.continue.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/flow_control/loop.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/flow_control/loop.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/flow_control/loop/nested.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/flow_control/loop/nested.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/flow_control/loop/return.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/flow_control/loop/return.html</a></li><li><a href="https://doc.rust-lang.org/reference/expressions/loop-expr.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/expressions/loop-expr.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/perulangan-while"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.10. Perulangan ➜ while</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/perulangan-for-in"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.12. Perulangan ➜ for in</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a111-keyword-loop" class="table-of-contents__link toc-highlight">A.11.1. Keyword <code>loop</code></a></li><li><a href="#a112-keyword-break" class="table-of-contents__link toc-highlight">A.11.2. Keyword <code>break</code></a></li><li><a href="#a113-nested-loop" class="table-of-contents__link toc-highlight">A.11.3. Nested <code>loop</code></a></li><li><a href="#a114-keyword-continue" class="table-of-contents__link toc-highlight">A.11.4. Keyword <code>continue</code></a></li><li><a href="#a115-label-perulangan" class="table-of-contents__link toc-highlight">A.11.5. Label perulangan</a></li><li><a href="#a116-returning-from-loop" class="table-of-contents__link toc-highlight">A.11.6. Returning from <code>loop</code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.11. Perulangan ➜ loop, break, continue, label</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.11. Perulangan ➜ loop, break, continue, label</h1></header><p>Selain keyword <code>while</code>, ada juga keyword <code>loop</code> yang fungsi dasarnya adalah sama, yaitu untuk perulangan.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a111-keyword-loop">A.11.1. Keyword <code>loop</code><a class="hash-link" href="#a111-keyword-loop" title="Direct link to heading">​</a></h2><p>Notasi penulisan dan cara penggunaan <code>loop</code> ada sedikit beda dibanding <code>while</code>. Keyword <code>loop</code> tidak membutuhkan argument. Blok kode loop akan terus dieksekusi selama program tidak di-stop.</p><p>Silakan coba praktikkan kode berikut. Angka <code>i</code> akan ditampilkan setiap perulangan kemudian di-increment nilainya. Angka akan muncul terus sampai aplikasi di-stop.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"nilai: {i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="loop tanpa break" src="/assets/images/perulangan-loop-break-continue-label-1-f02ae31c07ab672a301cbf6db2f23179.png" width="608" height="213" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a112-keyword-break">A.11.2. Keyword <code>break</code><a class="hash-link" href="#a112-keyword-break" title="Direct link to heading">​</a></h2><p><code>loop</code> menghasilkan perulangan tanpa henti, lalu bagaimana cara stop-nya? Di sinilah keyword <code>break</code> berperan. <code>break</code> digunakan untuk menghentikan paksa eksekusi blok kode perulangan. Biasanya keyword ini digunakan dalam kondisi tertentu (sesuai kebutuhan), misalnya <code>perulangan harus berhenti ketika nilai i di atas max</code>.</p><p>Mari kita ubah kode di atas dengan menambahkan kondisi untuk menghentikan perulangan jika <code>i</code> nilainya lebih dari <code>5</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"nilai: {i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> max </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"perulangan selesai"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="keyword break" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcMAAADDCAIAAABxk+09AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMDktMjVUMTQ6NDQ6NDgrMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyLTA5LTI3VDE3OjAzOjA5KzA3OjAwIiB4bXA6TWV0YWRhdGFEYXRlPSIyMDIyLTA5LTI3V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47TZp/UH+TCr86mP3CFU/GZ68Zf0bpNbTwBYUBNdJ02mKE/rpFoBT6a+Yf23eWqPEmYac5jfYBbNhG72+qQ9KhMdUH47m7TLlIuUbuw/yVZrZqPsawMPeM0cqzl7ScY2pesJAHEz0Uja7xER83qe3MmVnQm936CAn3pu/OmiotkDV9+o7jdCrc5l3/EpV2uVwz16ckphLluyl/Rucz8rX08AiJWwT0GVqztqv3lKjdNm37pgKsKcfVO5WglKehbKhM7vbVtXSXVd150PX4aJlPbR7JmXK8WbGbykvc1p1hMAYkH0nHQ4cR1OUfef0N5hZTid5T9O3tj/fPuwUqnVKtQ3jo3+Top4Sc+sTGj2Jk/1mnMq3TeqT/aFV2dzT7lbxzq3mcSsfNCSw202ZhB9DQBREkl6Dnpyaf48NcrvHVayTXwxCAAispjfu89+8KPb21v7r1/+49++f9P5HwyjABARodn97c3Nzc2saxLGwb/UNv7tn37963+4ubm5uUkk/vjlZ//671FXCgDeWfgdJwAAWYs5uwcAiBOMpAAAsjCSAgDIittImkgkElHXAQAgnLjlkzoebgIAWBBxOycFAFg8GEkBAGRhJAUAkIWRFABAFkZSAABZGEkBAGT9FQWZAW1qe1RkAAAAAElFTkSuQmCC" width="451" height="195" class="img_CujE"></p><blockquote><p>Penulisan <code>break</code> boleh tanpa diakhiri semicolon <code>;</code></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a113-nested-loop">A.11.3. Nested <code>loop</code><a class="hash-link" href="#a113-nested-loop" title="Direct link to heading">​</a></h2><p>Cara menerapkan nested loop (atau <code>loop</code> di dalam <code>loop</code>), tulis saja statement <code>loop</code> di dalam <code>loop</code> sesuai kebutuhan.</p><p>Pada kode berikut, teknik nested loop diterapkan untuk membuat bentuk segitiga menggunakan karakter <code>*</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> j </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> max</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max_inner </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> i</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"* "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> j </span><span class="token operator" style="color:#393A34">-=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> j </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> max_inner </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> max </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="keyword break" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcYAAACvCAIAAADojOlYAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xL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BSAQCUQUkFAFAGJRUAQBmUVAAAZVBSAQCUyUoENQDAFbD+CGoAgCsjExHUAABXQ7YiqAEALrX1R1ADAFwZWYmgBgC4AhBBDQCgDO5LBQBQBiUVAEAZlFQAAGVQUgEAlEFJBQBQBiUVAEAZlFQAAGVQUgEAlEFJBQBQBiUVAECZ5UZQAwBcK8uKoAYAuIaWGEENAHDdrCKCGgDgmlhWBDUAwDW03AhqAIBrBRHUAADK4L5UAABlUFIBAJRBSQUAUAYlFQBAGZRUAABlUFIBAJRBSQUAUAYlFQBAGZRUAABlUFIBAJRBSQUAUOb/AXL0LrDrCNz+AAAAAElFTkSuQmCC" width="454" height="175" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a114-keyword-continue">A.11.4. Keyword <code>continue</code><a class="hash-link" href="#a114-keyword-continue" title="Direct link to heading">​</a></h2><p><code>continue</code> digunakan untuk melanjutkan paksa sebuah perulangan, kebalikan dari <code>break</code> yang fungsinya menghentikan paksa sebuah perulangan.</p><p>Source code berikut merupakan contoh penerapan <code>continue</code>. Variabel <code>i</code> berperan sebagai counter perulangan. Jika nilai <code>i</code> adalah ganjil, maka perulangan dipaksa lanjut ke iterasi berikutnya. Dengan ini maka macro <code>println</code> hanya akan menampilkan nilai genap. Dan program akan berhenti jika <code>i</code> nilainya lebih dari <code>max</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">15</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">continue</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"nilai i: {i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> max </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="keyword continue" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcgAAADmCAIAAADeEoJPAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5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73GlSzzjCsAQBCzEXRte7tarderPb32bHv7GW3tVqv1ehXh1wAgD4KuAQAkQ1YAAIBkKKwAAJKhsAIASIbCCgAgGQorAIBkKKwAAJIh6BoAQLLZDrpGzjUAhGCWg67Xt57nG0Z6AXKuAUCeGQ66Hu5YExHRzuvmxkY6T4TCCgCBzXDQNQBAOGY+6JqIiCq1jVxPr+McKwDIMNtB10REtL61u5FrvtCwSwsAckR2H6sZdD08FzDdEb1861u7VZX0Gu4IAABpZjjoelxVcf4VAGSa3aBr7dkPmpoy/yYihF0DgBwIugYAkAxZAQAAkqGwAgBIhsIKACAZCisAgGQorAAAkqGwAgBIhqBrAADJQtljDZZEFR5OXTa+B1CvAUCSWQ66NqxvPVdPms3c8pQzBgBwmOWga2O2z1XSa6/T1SeefQcAEDbbQddGWf0C+QAAINNMB11XNJRVAJBvhoOuK7WNZb1WRVkFAMkiK6xm0PX2IcXjydiVRzlK0SgykIiq9bqGh2ADQGAR7rE6gq6l7bGKXLxisN1hUKnVn3QRxgoAUsxu0DXKKACEBEHXAACSISsAAEAyFFYAAMlQWAEAJENhBQCQDIUVAEAyFFYAAMkQdA0AIFkov7w63H52GI/frdpVavWNnPOnAZVa3QhC9PmbAwAAjtkOul7f2q2qJy+0QN0HALCb6aDriqaeYC8VAGSb5aDryqNcr3uvVvdzPhgAYKIZDrpev7dMKTX92ij2L5q5DVwWAwAZZjjomoio+cKsyDt1/Uk1nSdC5BUABBTZfaxm0PXwXEAMnox9+MMJLd/DPioAyBbpDwRsQdfSVGpTniDded1MqdrwjRVNTTVf4zoWAAQ300HXO9Xavd2q0SfcxQoAsiDoGgBAMmQFAABIhsIKACAZCisAgGQorAAAkqGwAgBIhsIKACAZCisAgGQorAAAkqGwAgBIhsIKACAZCisAgGQorAAAkqGwAgBI9v8D/7mbhZbXfgAAAABJRU5ErkJggg==" width="456" height="230" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a115-label-perulangan">A.11.5. Label perulangan<a class="hash-link" href="#a115-label-perulangan" title="Direct link to heading">​</a></h2><p>Statement perulangan menggunakan <code>loop</code> bisa ditandai dengan label. Manfaat dari penggunaan label adalah bisa mengeksekusi <code>break</code> atau <code>continue</code> ke perulangan di luar blok kode perulangan di mana statement itu berada. Umumnya label perulangan dipergunakan pada nested loop untuk keperluan menghentikan/melanjutkan paksa perulangan terluar.</p><p>Berikut adalah notasi penulisan loop dengan dan tanpa label. Nama label diawali dengan tanda petik <code>'</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// loop biasa</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// statements</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// loop dengan label</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token lifetime-annotation symbol" style="color:#36acaa">'namaLabel</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// statements</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'namaLabel</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Mari kita pelajari dan praktikkan kode berikut ini. Di bawah ini adalah sebuah program sederhana menampilkan angka yang hasilnya bisa dilihat pada gambar di bawahnya. Perulangan di level 2 akan dihentikan secara paksa ketika <code>j > i</code>. Sedangkan perulangan level pertama atau terluar (dengan label <code>'mainLoop</code>) akan dihentikan paksa dari perulangan level 2 jika kondisi <code>i > max</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">9</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token lifetime-annotation symbol" style="color:#36acaa">'mainLoop</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> j </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> max </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token plain"> </span><span class="token lifetime-annotation symbol" style="color:#36acaa">'mainLoop</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> j </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> j </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> i </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{i} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="looping label" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgIAAADjCAIAAAB4oOuVAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFEmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOn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qEzjPpetGprlg4+++IJJQFgUQzx+tjuQXFHjF67tbkkAFwv5oNCu/fSzVLR5Dhoc0kAuGZMchGLiGzvf5yuPHYNxkRsLgkA147h1cCu64jhibPFJQHg+jEKA9v7H6eb5ceGJ862lgSA68gkDOy6Tqzy2OQhGZtLAsC1FB0Gtvc/Nrw/anNJALimosLA9v7nhqfDNpcEgGuLtDMAYDUmkwAAqxEGAMBqhAEAsBphAACsRhgAAKsRBgDAaoQBALBa5AyjuwfFnXT7vyuhM+5T0qQkAMyX8KuB7f3DHXnkeh5V0jsHu5QcoyQAzJ3wMJCJx5qNcvuPcqNJyfFKAsDcCQ8DD59VYs7ewa50Jth5phvtoKRJSQCYOwZzCrXHvQ0yslOSvPUArpuIJ4V2D4rFjxsHrus+OnP2iof725QcpyQAzJvQMOBNt//HL56IyMM991El5rjqu5+UNCkJAPMn8r2BWDzT/q/de2np3Qql5GglAWC+RN0b8D8QHz7uTUmTkgAwZ0g7AwBWYzIJALAaYQAArEYYAACrEQYAwGqEAQCwGmEAAKxGGAAAqw2RdibqvShKTrYkAMxCdNqZjdKBl0/lrD2ZMiVnUBIAZiQ0DOy6TqzyuH3G+rBYaqbvaY5blJxsSQCYlah7A75Z0p78/Uw23tfOoUzJyZYEgJkIDQMPn/kmTd496M6eRslplwSAWTGfYbTy6JHs3Hvm7mkyLFJysiUBYCainhR6uOd2DlPb+4dhE+lTcrIlAWAmIh8YbdveP9zLlA8+i37AkZKTLQkAUxUeBrb3D/ecmIiIVB65n4UMX1BysiUBYEZIOwMAVmMyCQCwGmEAAKxGGAAAqxEGAMBqhAEAsBphAACsRhgAAKsRBgDAaoQBALAaYQAArEYYAACrEQYAwGr/D8LOrDKULylFAAAAAElFTkSuQmCC" width="514" height="227" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a116-returning-from-loop">A.11.6. Returning from <code>loop</code><a class="hash-link" href="#a116-returning-from-loop" title="Direct link to heading">​</a></h2><p><em>Returning from <code>loop</code></em> merupakan teknik pemanfaatan <code>loop</code> dan <code>break</code> untuk menampung sebuah return value dari blok kode perulangan <code>loop</code>. Agar lebih jelas, silakan coba kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> counter </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> counter </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> counter </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">break</span><span class="token plain"> counter </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {result}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas, variabel <code>result</code> dideklarasikan dengan predefined value adalah blok kode <code>loop</code>. Di sini artinya variabel <code>result</code> isinya bukan blok kode perulangan <code>loop</code>, melainkan isinya adalah apapun yang dituliskan setelah keyword <code>break</code>. Unik ya?</p><p>Variabel <code>counter</code> yang nilai awalnya <code>0</code>, di-increment dalam perulangan. Ketika nilai <code>counter</code> adalah <code>10</code>, nilai <code>counter * 2</code> dijadikan sebagai return value. Dengan ini maka variabel <code>result</code> nilainya adalah <code>20</code>.</p><p><img loading="lazy" alt="looping label" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAikAAAB1CAIAA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R5MSh+qwjPSy+qO90HGcCY6VcuHVuj/aaD0X7AWPWz0pwVtOABEEQhIvg2EMQBEEQ8XJpvi0lCIIgLgwUewiCIIi0odhDEARBpA3FHoIgCCJtKPYQBEEQaUOxhyAIgkgbij0EQRBE2lDsIQiCINKGYg9BEASRNhR7CIIgiLSh2EMQBEGkDcUegiAIIm0o9hAEQRBpQ7GHIAiCSBuKPQRBEETa/D+WdfpclQ0ncgAAAABJRU5ErkJggg==" width="553" height="117" class="img_CujE"></p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/perulangan_loop_break_continue_label" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../perulangan_loop_break_continue_label</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch03-05-control-flow.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch03-05-control-flow.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.loop.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.loop.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.break.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.break.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.continue.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.continue.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/flow_control/loop.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/flow_control/loop.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/flow_control/loop/nested.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/flow_control/loop/nested.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/flow_control/loop/return.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/flow_control/loop/return.html</a></li><li><a href="https://doc.rust-lang.org/reference/expressions/loop-expr.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/expressions/loop-expr.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/perulangan-while"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.10. Perulangan ➜ while</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/perulangan-for-in"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.12. Perulangan ➜ for in</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a111-keyword-loop" class="table-of-contents__link toc-highlight">A.11.1. Keyword <code>loop</code></a></li><li><a href="#a112-keyword-break" class="table-of-contents__link toc-highlight">A.11.2. Keyword <code>break</code></a></li><li><a href="#a113-nested-loop" class="table-of-contents__link toc-highlight">A.11.3. Nested <code>loop</code></a></li><li><a href="#a114-keyword-continue" class="table-of-contents__link toc-highlight">A.11.4. Keyword <code>continue</code></a></li><li><a href="#a115-label-perulangan" class="table-of-contents__link toc-highlight">A.11.5. Label perulangan</a></li><li><a href="#a116-returning-from-loop" class="table-of-contents__link toc-highlight">A.11.6. Returning from <code>loop</code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/perulangan-while.html b/basic/perulangan-while.html index 622b888b..f1ffc5c3 100644 --- a/basic/perulangan-while.html +++ b/basic/perulangan-while.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-while/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-while/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.10. Perulangan ➜ while","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-while/#webpage"},"wordCount":462,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-while/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-while/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-while","name":"A.10. Perulangan ➜ while","description":"Di Rust ada beberapa cara untuk melakukan perulangan, salah satunya adalah dengan menggunakan keyword while, dan pada chapter ini kita akan mempelajarinya.","datePublished":"2024-08-01T10:17:30.017Z","dateModified":"2024-08-01T10:17:30.017Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-while/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/perulangan-while"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-while/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.10. Perulangan ➜ while","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-while/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-while/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.10. Perulangan ➜ while","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-while/#webpage"},"wordCount":462,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-while/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-while/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-while","name":"A.10. Perulangan ➜ while","description":"Di Rust ada beberapa cara untuk melakukan perulangan, salah satunya adalah dengan menggunakan keyword while, dan pada chapter ini kita akan mempelajarinya.","datePublished":"2024-08-30T07:44:50.093Z","dateModified":"2024-08-30T07:44:50.093Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-while/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/perulangan-while"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/perulangan-while/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.10. Perulangan ➜ while","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.10. Perulangan ➜ while</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.10. Perulangan ➜ while</h1></header><p>Di Rust ada beberapa cara untuk melakukan perulangan, salah satunya adalah dengan menggunakan keyword <code>while</code>, dan pada chapter ini kita akan mempelajarinya.</p><p>Perulangan sendiri merupakan teknik untuk mengulang-ulang eksekusi blok kode dengan kondisi tertentu. Perulangan akan terus menerus dieksekusi ketika kondisi perulangan nilainya <code>true</code>, dan hanya akan berhenti kita nilainya <code>false</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a101-keyword-while">A.10.1. Keyword <code>while</code><a class="hash-link" href="#a101-keyword-while" title="Direct link to heading">​</a></h2><p>Perulangan menggunakan <code>while</code> mengharuskan kondisi perulangan dituliskan di awal dengan notasi penulisan sebagai berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">while</span><span class="token plain"> kondisi </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh berikut adalah penerapan <code>while</code> untuk operasi perulangan yang isinya menampilkan angka <code>i</code> dengan kondisi <code>i</code> di bawah <code>max</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">while</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> max </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"nilai: {i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="keyword while" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc8AAACjCAIAAABjWwLpAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF5WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMDktMjVUMTM6NTE6NTgrMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyLTA5LTI3VDE3OjE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HbBh5W5OscotgAQWtOeJt57NNn69m5l9w4GbgEgpKY+Tdx2lYf3AABIM91p4s7pNTVW/xGXgAFASE11mrhrbALX2wJAmCFNHABABuQkAADIgGoLACADqi0AgAyotgAAMqDaAgDIgGoLACAD0sQBAGSYSN92bMlegszqjnoNACE2llQawbyuCc2+vv1EPanX0wsjLAMAYMKmPk18ffuJSnrpx0TxkfCmAABIN+Vp4mat/QYxiwAQdsHGbR1p4oHjDfd3inZRFJn9aVHThnZstzTUWgCYDtOcJr5V2ljQS0XUWgCYAtKqrZ0mvrNPY3r4+db9NMWoWKkU7VeKlYqG3EUACCWJfVtPmviQvu3wX8lclzJslSqPWnhODgCE1lSniQMATA2kiQMAyICcBAAAGVBtAQBkQLUFAJAB1RYAQAZUWwAAGVBtAQBkQLUFAJAB1RYAQAZUWwAAGVBtAQBkQLUFAJAB1RYAQAZUWwAAGf4fy1jcLdY1NIcAAAAASUVORK5CYII=" width="463" height="163" class="img_ev3q"></p><p>Variabel <code>i</code> pada contoh di atas menjadi penentu kapan perulangan berhenti. Di dalam blok kode <code>while</code> (yang mana akan dieksekusi setiap kondisi menghasilkan nilai <code>true</code>), nilai variabel <code>i</code> di-increment, membuat variabel <code>i</code> nilainya selalu bertambah 1 setiap kali perulangan. Perulangan akan berhenti ketika nilai <code>i</code> sudah tidak di bawah <code>max</code> lagi.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a102-nested-while">A.10.2. Nested <code>while</code><a class="hash-link" href="#a102-nested-while" title="Direct link to heading">​</a></h2><p>Penerapan nested while (atau <code>while</code> di dalam <code>while</code>) cukup mudah, tulis saja statement <code>while</code> di dalam <code>while</code> sesuai kebutuhan. Contoh bisa dilihat pada kode berikut, yaitu penerapan teknik nested while untuk print karakter <code>*</code> membuat bentuk segitiga.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">while</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> max </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> j </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max_inner </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> i</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">while</span><span class="token plain"> j </span><span class="token operator" style="color:#393A34"><=</span><span class="token plain"> max_inner </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"* "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> j </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="nested while" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUg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AIoAAAoMnuhMtTLAICPhFkKlaFeBgB8VMxYqAz1MgDg4yEtoTLUywCAW88shcpQLwMAPipmL1SGehkA8JEAoTIAACiCdaAAAKAIAigAACiCAAoAAIoggAIAgCIIoAAAoAgCKAAAKIIACgAAiiCAAgCAIgigAACgCAIoAAAoskihMtTLAIAbzWKEylAvAwBuAQsTKkO9DAC46SxeqAz1MgDghrIYoTLUywCAW8AihcpQLwMAbjQQKgMAgCJYBwoAAIoggAIAgCIIoAAAoAgCKAAAKIIACgAAiiCAAgCAIgigAACgCAIoAAAoggAKAACKIIACAIAiN0OoDPUyACCDZF2oDPUyACCz3AChMtTLAIBscpOEylAvAwAyRdaFylAvAwAyy80QKkO9DADIIBAqAwCAIlgHCgAAiiCAAgCAIgigAACgCAIoAAAoggAKAACKIIACAIAiCKAAAKAIAigAACiCAAoAAIoggAIAgCK3TagM9TIAYG7cHqEy1MsAgDlzq4TKUC8DAObJ7RQqQ70MAJgDt0eoDPUyAGDO3DahMtTLAIC5AaEyAAAognWgAACgCAIoAAAoggAKAACKIIACAIAiCKAAAKAIAigAACiCAAoAAIoggAIAgCIIoAAAoAgCKAAAKIIACgAAiiCAAgCAIgigAACgyP8DCN5kHb5KvhgAAAAASUVORK5CYII=" width="448" height="172" class="img_ev3q"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-macro-print">◉ Macro <code>print</code><a class="hash-link" href="#-macro-print" title="Direct link to heading">​</a></h3><p>Macro <code>print</code> kegunaannya mirip dengan <code>println</code>, hanya saja tanpa <em>newline</em> atau baris baru. Jadi semua string yang di-print menggunakan macro <code>print</code> akan muncul menyamping ke kanan dan tidak di baris baru. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"* "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"* "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"* "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"* "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Akan menghasilkan output:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">* * * * </span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a103-keyword-while-let">A.10.3. Keyword <code>while let</code><a class="hash-link" href="#a103-keyword-while-let" title="Direct link to heading">​</a></h2><p>Kita akan bahas keyword <code>while let</code> pada chapter <a href="/basic/pattern-matching">Pattern Matching</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a104-menambahkan-delay-dalam-perulangan">A.10.4. Menambahkan delay dalam perulangan<a class="hash-link" href="#a104-menambahkan-delay-dalam-perulangan" title="Direct link to heading">​</a></h2><p>Eksekusi statement perulangan pada program sangatlah cepat. Bisa jadi dalam 1 detik ada ribuan (atau bahkan jauh lebih banyak) statement dalam perulangan yang dieksekusi. Di-tiap eksekusinya, delay bisa saja ditambahkan, misalnya 1 detik, dan pada contoh di bawah ini kita akan coba mengaplikasikannya.</p><p>Silakan tulis kode program berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">thread</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">sleep</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">time</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Duration</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">while</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> max </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"nilai: {i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">sleep</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Duration</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_secs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ada beberapa keyword baru dipergunakan pada source code di atas. Untuk sekarang coba jalankan terlebih dahulu program yang baru dibuat, kemudian stop. Text <code>nilai: {i}</code> akan muncul di console setiap satu detik, dan hanya akan berhenti ketika program di stop.</p><p>Selanjutnya kita akan beberapa sintaks baru di atas.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-keyword-use-dan-module-dalam-rust">◉ Keyword <code>use</code> dan module dalam Rust<a class="hash-link" href="#-keyword-use-dan-module-dalam-rust" title="Direct link to heading">​</a></h3><p>Keyword <code>use</code> memiliki banyak kegunaan. Pada contoh ini <code>use</code> difungsikan untuk <em>import module</em>, yang di bahasa Rust dikenal dengan istilah <strong>import paths</strong>.</p><p>Notasi penulisan <em>module path</em> di Rust dinotasikan dengan separator <code>::</code>, contohnya seperti <code>std::thread::sleep</code> dan <code>std::time::Duration</code>.</p><ul><li><p>Statement <code>use std::thread::sleep</code> artinya path <code>std::thread::sleep</code> digunakan dalam kode program. <code>sleep</code> adalah sebuah fungsi yang gunanya untuk menambahkan jeda dengan durasi sesuai keinginan, contohnya, 1 detik, 30 menit, dst.</p></li><li><p>Statement <code>use std::time::Duration</code> artinya path <code>std::time::Duration</code> digunakan dalam kode program. <code>Duration</code> merupakan sebuah struct yang isinya banyak hal untuk keperluan yang berhubungan dengan waktu atau <em>duration</em>.</p></li></ul><p>Pada contoh di atas, fungsi <code>sleep</code> dipanggil dalam blok kode perulangan agar ada jeda ditiap eksekusinya. Sedangkan durasi jedanya sendiri ditentukan oleh argument <code>Duration::from_secs(1)</code> yang artinya durasi <code>1 detik</code>. Dengan ini durasi delay adalah 1 detik.</p><p>Jika ingin jeda durasi yang lebih lama, ubah saja angka <code>1</code> pada <code>Duration::from_secs(1)</code>. Contoh: <code>Duration::from_secs(5)</code> berarti jeda 5 detik.</p><blockquote><ul><li>Lebih jelasnya perihal path dibahas pada chapter <a href="/basic/path-item">Module System ➜ Pach & Item</a></li><li>Lebih jelasnya perihal keyword <code>use</code> dibahas pada chapter <a href="/basic/use">Module System ➜ Use</a></li><li>Lebih jelasnya perihal fungsi dibahas pada chapter <a href="/basic/function">Function</a></li><li>Lebih jelasnya perihal struct dibahas pada chapter <a href="/basic/struct">Struct</a></li></ul></blockquote><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/perulangan_while" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../perulangan_while</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch03-05-control-flow.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch03-05-control-flow.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.while.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.while.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.use.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.use.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/flow_control/while.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/flow_control/while.html</a></li><li><a href="https://doc.rust-lang.org/stable/std/time/struct.Duration.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/stable/std/time/struct.Duration.html</a></li><li><a href="https://doc.rust-lang.org/reference/expressions/while-expr.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/expressions/while-expr.html</a></li><li><a href="https://doc.rust-lang.org/reference/paths.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/paths.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/seleksi-kondisi-if"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.9. Seleksi Kondisi ➜ if, else if, else</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/perulangan-loop-break-continue-label"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.11. Perulangan ➜ loop, break, continue, label</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a101-keyword-while" class="table-of-contents__link toc-highlight">A.10.1. Keyword <code>while</code></a></li><li><a href="#a102-nested-while" class="table-of-contents__link toc-highlight">A.10.2. Nested <code>while</code></a><ul><li><a href="#-macro-print" class="table-of-contents__link toc-highlight">◉ Macro <code>print</code></a></li></ul></li><li><a href="#a103-keyword-while-let" class="table-of-contents__link toc-highlight">A.10.3. Keyword <code>while let</code></a></li><li><a href="#a104-menambahkan-delay-dalam-perulangan" class="table-of-contents__link toc-highlight">A.10.4. Menambahkan delay dalam perulangan</a><ul><li><a href="#-keyword-use-dan-module-dalam-rust" class="table-of-contents__link toc-highlight">◉ Keyword <code>use</code> dan module dalam Rust</a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.10. Perulangan ➜ while</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.10. Perulangan ➜ while</h1></header><p>Di Rust ada beberapa cara untuk melakukan perulangan, salah satunya adalah dengan menggunakan keyword <code>while</code>, dan pada chapter ini kita akan mempelajarinya.</p><p>Perulangan sendiri merupakan teknik untuk mengulang-ulang eksekusi blok kode dengan kondisi tertentu. Perulangan akan terus menerus dieksekusi ketika kondisi perulangan nilainya <code>true</code>, dan hanya akan berhenti kita nilainya <code>false</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a101-keyword-while">A.10.1. Keyword <code>while</code><a class="hash-link" href="#a101-keyword-while" title="Direct link to heading">​</a></h2><p>Perulangan menggunakan <code>while</code> mengharuskan kondisi perulangan dituliskan di awal dengan notasi penulisan sebagai berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">while</span><span class="token plain"> kondisi </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh berikut adalah penerapan <code>while</code> untuk operasi perulangan yang isinya menampilkan angka <code>i</code> dengan kondisi <code>i</code> di bawah <code>max</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">while</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> max </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"nilai: {i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="keyword while" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc8AAACjCAIAAABjWwLpAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF5WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9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RbAAAZkCYOACDDRHIS9ne+ttIUE5NYvIPj/oZgN0YAAMg11Wni69tPMrWStrNvxuHubtdwJxkAhNRUp4mbfWgiInr6Y31jI2AGJACAPFOdJg4AMDWC/UrmSBNvxxLBngW2v1O0v+aLzP60qGniA7FbpY10W69g3BYAwupjSBNf397dSNefaxizBYDwmvo08fXt3aJKegnXIwBAqE13mrhdanEpAgCE3VSniW9paoysIHEi6l/qAAAQNkgTBwCQATkJAAAyoNoCAMiAagsAIAOqLQCADKi2AAAyoNoCAMiANHEAABmmO018q1Qx8x8JaeIAEG4TvLthfXu3mHgpqQSub+8WMzXcSQYAYTXVaeIO+z+fFIMlQAIAyPSxpIlv3U+3ay/RsQWAsAo2butIE3+iBnwuzf5O0Z5aZHbBh5W5OscotgAQWtOeJt57NNn69m5l9w4GbgEgpKY+Tdx2lYf3AABIM91p4s7pNTVW/xGXgAFASE11mrhrbALX2wJAmCFNHABABuQkAADIgGoLACADqi0AgAyotgAAMqDaAgDIgGoLACAD0sQBAGSYSN92bMlegszqjnoNACE2llQawbyuCc2+vv1EPanX0wsjLAMAYMKmPk18ffuJSnrpx0TxkfCmAABIN+Vp4mat/QYxiwAQdsHGbR1p4oHjDfd3inZRFJn9aVHThnZstzTUWgCYDtOcJr5V2ljQS0XUWgCYAtKqrZ0mvrNPY3r4+db9NMWoWKkU7VeKlYqG3EUACCWJfVtPmviQvu3wX8lclzJslSqPWnhODgCE1lSniQMATA2kiQMAyICcBAAAGVBtAQBkQLUFAJAB1RYAQAZUWwAAGVBtAQBkQLUFAJAB1RYAQAZUWwAAGVBtAQBkQLUFAJAB1RYAQAZUWwAAGf4fy1jcLdY1NIcAAAAASUVORK5CYII=" width="463" height="163" class="img_CujE"></p><p>Variabel <code>i</code> pada contoh di atas menjadi penentu kapan perulangan berhenti. Di dalam blok kode <code>while</code> (yang mana akan dieksekusi setiap kondisi menghasilkan nilai <code>true</code>), nilai variabel <code>i</code> di-increment, membuat variabel <code>i</code> nilainya selalu bertambah 1 setiap kali perulangan. Perulangan akan berhenti ketika nilai <code>i</code> sudah tidak di bawah <code>max</code> lagi.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a102-nested-while">A.10.2. Nested <code>while</code><a class="hash-link" href="#a102-nested-while" title="Direct link to heading">​</a></h2><p>Penerapan nested while (atau <code>while</code> di dalam <code>while</code>) cukup mudah, tulis saja statement <code>while</code> di dalam <code>while</code> sesuai kebutuhan. Contoh bisa dilihat pada kode berikut, yaitu penerapan teknik nested while untuk print karakter <code>*</code> membuat bentuk segitiga.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">while</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> max </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> j </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max_inner </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> i</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">while</span><span class="token plain"> j </span><span class="token operator" style="color:#393A34"><=</span><span class="token plain"> max_inner </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"* "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> j </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="nested while" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcAAAACsCAIAAABjBuuxAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF5WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29t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" width="448" height="172" class="img_CujE"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-macro-print">◉ Macro <code>print</code><a class="hash-link" href="#-macro-print" title="Direct link to heading">​</a></h3><p>Macro <code>print</code> kegunaannya mirip dengan <code>println</code>, hanya saja tanpa <em>newline</em> atau baris baru. Jadi semua string yang di-print menggunakan macro <code>print</code> akan muncul menyamping ke kanan dan tidak di baris baru. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"* "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"* "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"* "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"* "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Akan menghasilkan output:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">* * * * </span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a103-keyword-while-let">A.10.3. Keyword <code>while let</code><a class="hash-link" href="#a103-keyword-while-let" title="Direct link to heading">​</a></h2><p>Kita akan bahas keyword <code>while let</code> pada chapter <a href="/basic/pattern-matching">Pattern Matching</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a104-menambahkan-delay-dalam-perulangan">A.10.4. Menambahkan delay dalam perulangan<a class="hash-link" href="#a104-menambahkan-delay-dalam-perulangan" title="Direct link to heading">​</a></h2><p>Eksekusi statement perulangan pada program sangatlah cepat. Bisa jadi dalam 1 detik ada ribuan (atau bahkan jauh lebih banyak) statement dalam perulangan yang dieksekusi. Di-tiap eksekusinya, delay bisa saja ditambahkan, misalnya 1 detik, dan pada contoh di bawah ini kita akan coba mengaplikasikannya.</p><p>Silakan tulis kode program berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">thread</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">sleep</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">time</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Duration</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">while</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> max </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"nilai: {i}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> i </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">sleep</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Duration</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_secs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ada beberapa keyword baru dipergunakan pada source code di atas. Untuk sekarang coba jalankan terlebih dahulu program yang baru dibuat, kemudian stop. Text <code>nilai: {i}</code> akan muncul di console setiap satu detik, dan hanya akan berhenti ketika program di stop.</p><p>Selanjutnya kita akan beberapa sintaks baru di atas.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-keyword-use-dan-module-dalam-rust">◉ Keyword <code>use</code> dan module dalam Rust<a class="hash-link" href="#-keyword-use-dan-module-dalam-rust" title="Direct link to heading">​</a></h3><p>Keyword <code>use</code> memiliki banyak kegunaan. Pada contoh ini <code>use</code> difungsikan untuk <em>import module</em>, yang di bahasa Rust dikenal dengan istilah <strong>import paths</strong>.</p><p>Notasi penulisan <em>module path</em> di Rust dinotasikan dengan separator <code>::</code>, contohnya seperti <code>std::thread::sleep</code> dan <code>std::time::Duration</code>.</p><ul><li><p>Statement <code>use std::thread::sleep</code> artinya path <code>std::thread::sleep</code> digunakan dalam kode program. <code>sleep</code> adalah sebuah fungsi yang gunanya untuk menambahkan jeda dengan durasi sesuai keinginan, contohnya, 1 detik, 30 menit, dst.</p></li><li><p>Statement <code>use std::time::Duration</code> artinya path <code>std::time::Duration</code> digunakan dalam kode program. <code>Duration</code> merupakan sebuah struct yang isinya banyak hal untuk keperluan yang berhubungan dengan waktu atau <em>duration</em>.</p></li></ul><p>Pada contoh di atas, fungsi <code>sleep</code> dipanggil dalam blok kode perulangan agar ada jeda ditiap eksekusinya. Sedangkan durasi jedanya sendiri ditentukan oleh argument <code>Duration::from_secs(1)</code> yang artinya durasi <code>1 detik</code>. Dengan ini durasi delay adalah 1 detik.</p><p>Jika ingin jeda durasi yang lebih lama, ubah saja angka <code>1</code> pada <code>Duration::from_secs(1)</code>. Contoh: <code>Duration::from_secs(5)</code> berarti jeda 5 detik.</p><blockquote><ul><li>Lebih jelasnya perihal path dibahas pada chapter <a href="/basic/path-item">Module System ➜ Pach & Item</a></li><li>Lebih jelasnya perihal keyword <code>use</code> dibahas pada chapter <a href="/basic/use">Module System ➜ Use</a></li><li>Lebih jelasnya perihal fungsi dibahas pada chapter <a href="/basic/function">Function</a></li><li>Lebih jelasnya perihal struct dibahas pada chapter <a href="/basic/struct">Struct</a></li></ul></blockquote><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/perulangan_while" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../perulangan_while</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch03-05-control-flow.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch03-05-control-flow.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.while.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.while.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.use.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.use.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/flow_control/while.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/flow_control/while.html</a></li><li><a href="https://doc.rust-lang.org/stable/std/time/struct.Duration.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/stable/std/time/struct.Duration.html</a></li><li><a href="https://doc.rust-lang.org/reference/expressions/while-expr.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/expressions/while-expr.html</a></li><li><a href="https://doc.rust-lang.org/reference/paths.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/paths.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/seleksi-kondisi-if"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.9. Seleksi Kondisi ➜ if, else if, else</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/perulangan-loop-break-continue-label"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.11. Perulangan ➜ loop, break, continue, label</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a101-keyword-while" class="table-of-contents__link toc-highlight">A.10.1. Keyword <code>while</code></a></li><li><a href="#a102-nested-while" class="table-of-contents__link toc-highlight">A.10.2. Nested <code>while</code></a><ul><li><a href="#-macro-print" class="table-of-contents__link toc-highlight">◉ Macro <code>print</code></a></li></ul></li><li><a href="#a103-keyword-while-let" class="table-of-contents__link toc-highlight">A.10.3. Keyword <code>while let</code></a></li><li><a href="#a104-menambahkan-delay-dalam-perulangan" class="table-of-contents__link toc-highlight">A.10.4. Menambahkan delay dalam perulangan</a><ul><li><a href="#-keyword-use-dan-module-dalam-rust" class="table-of-contents__link toc-highlight">◉ Keyword <code>use</code> dan module dalam Rust</a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/pointer-references.html b/basic/pointer-references.html index 5a018860..3d387697 100644 --- a/basic/pointer-references.html +++ b/basic/pointer-references.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/pointer-references/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/pointer-references/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.33. Pointer & References","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/pointer-references/#webpage"},"wordCount":1308,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/pointer-references/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/pointer-references/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/pointer-references","name":"A.33. Pointer & References","description":"Chapter ini membahas tentang apa itu pointer, references, dan dereferences. Pembelajaran dimulai tentang konsep dan praktik dasar tentang ketiga topik tersebut, kemudian diikuti dengan pembahasan tentang karakteristik pointer & reference.","datePublished":"2024-08-01T10:17:30.188Z","dateModified":"2024-08-01T10:17:30.188Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/pointer-references/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/pointer-references"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/pointer-references/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.33. Pointer & References","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/pointer-references/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/pointer-references/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.33. Pointer & References","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/pointer-references/#webpage"},"wordCount":1308,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/pointer-references/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/pointer-references/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/pointer-references","name":"A.33. Pointer & References","description":"Chapter ini membahas tentang apa itu pointer, references, dan dereferences. Pembelajaran dimulai tentang konsep dan praktik dasar tentang ketiga topik tersebut, kemudian diikuti dengan pembahasan tentang karakteristik pointer & reference.","datePublished":"2024-08-30T07:44:50.148Z","dateModified":"2024-08-30T07:44:50.148Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/pointer-references/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/pointer-references"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/pointer-references/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.33. Pointer & References","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.33. Pointer & References</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.33. Pointer & References</h1></header><p>Chapter ini membahas tentang apa itu pointer, references, dan dereferences. Pembelajaran dimulai tentang konsep dan praktik dasar tentang ketiga topik tersebut, kemudian diikuti dengan pembahasan tentang karakteristik pointer & reference.</p><blockquote><p>Penulis tekankan bahwa <strong>pada chapter ini, konsep reference yang dibahas adalah dalam konteks programming secara general.</strong> Tidak dari sudut pandang ownership.</p></blockquote><p>Reference pada Rust memiliki keunikan, tapi kita akan bahas itu secara terpisah pada chapter <a href="/basic/borrowing">Borrowing</a>. Untuk sekarang silakan ikuti terlebih dahulu pembahasan chapter-per-chapter secara berurutan.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a331-pointer">A.33.1. Pointer<a class="hash-link" href="#a331-pointer" title="Direct link to heading">​</a></h2><p>Pointer artinya adalah alamat memori. Variabel pointer artinya adalah variabel yang berisi alamat memory (hanya alamat memory-nya saja, bukan value yang sebenarnya).</p><p>Di Rust, variabel pointer ditandai dengan adanya karakter <code>&</code> pada tipe data. Sebagai contoh <code>&i32</code> artinya adalah tipe data pointer <code>i32</code>. Contoh lain adalah <code>&bool</code> yang merupakan tipe data pointer <code>bool</code>.</p><blockquote><p>Ada dua jenis tipe pointer di Rust programming, yaitu smart pointer dan raw pointer. Pada chapter ini kita tidak membahasnya karena termasuk topik yang cukup advance. Pembahasan akan ada pada chapter terpisah <a href="#/wip/smart-pointer-raw-pointer">Smart Pointer vs Raw Pointer</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a332-reference-operator-">A.33.2. Reference (operator <code>&</code>)<a class="hash-link" href="#a332-reference-operator-" title="Direct link to heading">​</a></h2><p>Ok, selanjutnya apa itu <em>reference</em>? Istilah ini sudah beberapa kali disinggung pada chapter sebelum-sebelumnya.</p><p>Reference artinya adalah pointer dari sebuah variabel atau data. Operasi pengambilan pointer dari variabel disebut dengan <em>referencing</em>, caranya dilakukan dengan menggunakan karakter <code>&</code>.</p><p>O iya, semua jenis variabel bisa diambil nilai pointernya. Contohnya bisa dilihat berikut ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"value: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pointer_number</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"pointer: {:p}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> pointer_number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, sebuah variabel dideklarasikan bernama <code>number</code> dengan tipe data adalah numerik dan value <code>24</code>. Variabel tersebut jika di-print akan muncul nilainya, yaitu <code>24</code>.</p><p>Ada satu lagi variabel yang dideklarasikan yaitu <code>pointer_number</code>, yang nilainya adalah <em>reference</em> dari variabel <code>number</code>. Cara pengambilan reference yang dilihat pada contoh, yaitu dengan menambahkan operator <code>&</code> pada variabel yang ingin diambil pointernya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// variabel pointer_number nilainya adalah reference variabel number.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// contoh statement:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pointer_number_1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pointer_number_2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">number</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>By default, ketika variabel pointer di print, yang muncul adalah <em>underlying value</em> atau nilai sebenarnya, yang pada contoh di atas adalah <code>24</code>. Untuk menampilkan alamat memory gunakan formatted print <code>{:p}</code>.</p><p>Coba jalankan program kemudian lihat hasilnya. Value muncul sesuai dengan yang ditulis, sedangkan pointer memunculkan data alamat memory yaitu <code>0xa3bbeff6dc</code>.</p><p><img loading="lazy" alt="pointer &amp; reference" src="/assets/images/pointer-references-1-f103aebf5517db2d9de53c1fe39be319.png" width="494" height="320" class="img_ev3q"></p><p>Seperti yang sudah dijelaskan di awal bahwa variabel pointer isinya adalah alamat memory. Penulisannya dalam notasi heksadesimal diawali dengan karakter <code>0x</code>. Contohnya adalah nilai <code>0xa3bbeff6dc</code> yang merupakan alamat memory, yang alamat tersebut adalah reference ke pemilik data sebenarnya (yaitu variabel <code>number</code>).</p><blockquote><p>Di environment lokal masing-masing, alamat memory yang muncul sangat mungkin berbeda karena alokasi adalah random</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a333-dereference-operator-">A.33.3. Dereference (operator <code>*</code>)<a class="hash-link" href="#a333-dereference-operator-" title="Direct link to heading">​</a></h2><p>Kita sudah belajar cara mengambil data pointer dari sebuah variabel. Pada bagian ini kita belajar cara mengambil nilai sebenarnya atau underlying value dari sebuah pointer (istilahnya adalah <em>dereference</em>).</p><p>Cara melakukan operasi <em>dereferencing</em> adalah dengan menambahkan karakter <code>*</code> pada variabel pointer. Contohnya seperti berikut, silakan tambahkan kode ini ke program yang sudah ditulis.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// variabel underlying_value nilainya adalah nilai sebenarnya dari pointer pointer_number</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> underlying_value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">pointer_number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"value: {:}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> underlying_value</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Dereference" src="/assets/images/pointer-references-2-8fdb7f20f15717b7d97311d81ffe005d.png" width="467" height="412" class="img_ev3q"></p><p>Bisa dilihat, nilai dari variabel <code>underlying_value</code> adalah nilai sebenarnya dari pointer <code>pointer_number</code>, yang pastinya adalah sama dengan nilai variabel <code>number</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a334-mutable-references-operator-mut">A.33.4. Mutable References (operator <code>&mut</code>)<a class="hash-link" href="#a334-mutable-references-operator-mut" title="Direct link to heading">​</a></h2><p>By default, reference sifatnya <em>read-only</em> atau <em>immutable</em>, artinya tidak bisa diubah <em>underlying-value</em>-nya.</p><p>Jika ada variabel (sebut saja X) yang merupakan underlying value dari reference variabel lain, maka perubahan value pada variabel X tersebut <em>default</em>-nya menghasilkan error.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pointer_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"pointer_number: {:p}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> pointer_number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token operator" style="color:#393A34">*</span><span class="token plain">pointer_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"*pointer_number: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">pointer_number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Pointer &amp; reference" src="/assets/images/pointer-references-3-7b60c4bdc0392eb962187ee76ac2ab54.png" width="715" height="343" class="img_ev3q"></p><p>Pada gambar di atas bisa dilihat, variabel <code>pointer_number</code> merupakan reference dari variabel mutable <code>number</code>. Setelahnya ada statement <code>*pointer_number = 12</code>, yang artinya adalah underlying value dari variabel pointer <code>pointer_number</code> diakses kemudian di-isi nilainya dengan angka <code>12</code>.</p><blockquote><p>Statement <code>*pointer_number = 12</code> tidak menghasilkan error, dan statement ini berbeda dengan <code>pointer_number = 12</code>.</p><p>Statement <code>pointer_number = 12</code> menghasilkan error karena <code>pointer_number</code> adalah variabel bertipe <strong>pointer <code>i32</code> atau <code>&i32</code> (bukan <code>i32</code>)</strong>. Jika ingin mengubah nilainya perlu mengakses dulu underlying value-nya menggunakan <code>*pointer_number</code>.</p></blockquote><p>Ok, lalu kenapa muncul error? Di gambar terlihat ada garis merah dan popup pesan error muncul, padahal tidak ada yang salah dengan statement-nya.</p><p>Penyebab erronya bukan dari statement tersebut, tetapi pada baris statement pengambilan reference variabel <code>number</code>. Statement <code>&number</code> artinya adalah mengambil reference dari variabel <code>number</code>. Di atas sempat kita bahas bahwa <em>by default</em> sebuah reference tidak bisa diubah nilainya (<em>immutable</em>), dan ini adalah penyebab error yang dialami.</p><blockquote><p>Silakan perhatikan pesan di popup error message agar mudah untuk tau di mana sumber masalahnya.</p></blockquote><p>Perubahan isi nilai variabel <code>number</code> tidak menghasilkan error, hal ini karena number adalah variabel <code>number</code> adalah mutable. Sedangkan operasi perubahan nilai variabel <code>*pointer_number</code> pada contoh di atas, dianggap sebagai error karena variabel <code>pointer_number</code> reference-nya adalah bukan mutable (meskipun reference diperoleh dari variabel <code>number</code> yang notabene mutable).</p><p>Solusi dari error di atas adalah menerapkan <strong>mutable reference</strong>. Mutable reference sama seperti reference biasa tetapi nilainya diperbolehkan untuk diubah (mutable). Caranya pengaksesan mutable reference dilakukan menggunakan operator <code>&mut</code>.</p><p>Ok, sekarang ubah statement berikut ini, lalu jalankan program:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// before</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pointer_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// after</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pointer_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Pointer &amp; reference" src="/assets/images/pointer-references-4-ba178a14defb70eb04b45ce050af0e6e.png" width="488" height="417" class="img_ev3q"></p><p>Deklarasi variable pointer yang menampung mutable reference bisa via metode penulisan <em>manifest typing</em> atau <em>type inference</em>. Pada contoh berikut, variabel <code>pointer_number</code> tipe data-nya adalah mutable reference <code>i32</code>, maka penulisan tipe data adalah <code>&mut i32</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// type inference</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pointer_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// manifest typing</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pointer_number</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh ini kita menggunakan tipe data primitif, lalu bagaimana dengan tipe data non-primitive seperti custom type struct atau <code>String</code>, apakah penerapan mutable reference juga sama? Jawabannya tidak. Ada beberapa perbedaan dan nantinya kita akan bahas secara detail pada chapter <a href="/basic/borrowing">Borrowing</a>. Untuk sekarang, dianjurkan mengikuti pembahasan chapter per chapter secara urut.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a335-aturan-reference">A.33.5. Aturan Reference<a class="hash-link" href="#a335-aturan-reference" title="Direct link to heading">​</a></h2><p>Ada dua aturan penting yang harus dipatuhi dalam penerapan reference baik mutable atau immutable reference.</p><ul><li>Dalam waktu yang sama, hanya boleh ada satu mutable reference atau banyak immutable reference (keduanya tidak bisa bersamaan, harus salah satu).</li><li>Reference harus selalu valid.</li></ul><p>Mengenai penjelasan tentang dua aturan penting di atas akan bahas pada chapter <a href="/basic/borrowing">Borrowing</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a336-karakteristik-pointer--reference">A.33.6. Karakteristik pointer & reference<a class="hash-link" href="#a336-karakteristik-pointer--reference" title="Direct link to heading">​</a></h2><p>Kita sudah belajar tentang definisi beserta cara penerapan pointer, reference, dereference, dan mutable reference. Sekarang lanjut ke pembahasan tentang karakteristik dari pointer & reference.</p><p>Pointer merupakan variabel yang isinya adalah alamat memory (bukan nilai sebenarnya). Dan reference adalah alamat memory suatu data/variabel. Dengan menerapkan keduanya kita bisa menerapkan efisiensi penggunaan memory yang dampaknya sangat positif terhadap performa program.</p><p>Sekarang perhatikan statement berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_one</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Variabel <code>number_one</code> adalah data numerik bertipe <code>i32</code>, eksekusi statement tersebut menghasilkan alokasi memori selebar 32-bit.</p><p>Kemudian ada lagi statement <code>number_two</code>. Meskipun nilainya didapat dari variabel <code>number_one</code>, yang terjadi di balik layar adalah Rust akan mengalokasikan lagi alamat memory selebar 32-bit untuk menampung data <code>number_two</code> yang didapat dari hasil operasi <strong>copy</strong> dari variabel <code>number_one</code>.</p><blockquote><p>Semua variabel primitif di Rust mengadopsi <em>copy semantics</em>, yang artinya jika variabel tersebut digunakan dalam statement assignment, maka nilai akan di-duplikasi untuk kemudian ditampung pada variabel baru.</p><p>Lebih jelasnya mengenai <em>copy semantics</em> dibahas pada chapter <a href="/basic/ownership#a334-copy-semantics-vs-move-semantics">Ownership</a>.</p></blockquote><p>Selanjutnya, bandingkan dengan statement berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">number_one</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, variabel <code>number_one</code> datanya disimpan di memory dengan lebar 32-bit (masih sama seperti contoh sebelumnya). Namun ada yang berbeda dengan dengan variabel <code>number_two</code>, variabel ini adalah variabel pointer yang nilainya reference ke alamat memory data variabel <code>number_one</code>. Yang terjadi di belakang layar, Rust tidak mengalokasikan lagi memory selebar 32-bit untuk menampung data <code>number_two</code>, melainkan menggunakan alamat memory data <code>number_one</code> sebagai reference, menjadikannya sebagai alamat tujuan variabel pointer <code>number_two</code>.</p><p>Ok, lanjut. Per sekarang, reference variabel <code>number_one</code> dan <code>number_two</code> adalah sama. Dengan ini, jika dicontohkan isi data satu variabel diubah, maka variabel lainnya juga akan berubah, hal karena reference-nya adalah sama.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-1">◉ Contoh ke-1<a class="hash-link" href="#-contoh-ke-1" title="Direct link to heading">​</a></h3><p>Contoh penerapannya bisa kita lihat pada chapter <a href="/basic/pointer-references#a315-karakteristik-pointer--reference">Pointer & References</a> ini, di situ bisa dilihat ada variabel mutable <code>number</code> dan <code>pointer_number</code> yang reference-nya adalah sama dengan variabel <code>number</code>. Ketika underlying value <code>pointer_number</code> diubah (dari <code>24</code> ke <code>12</code>), isi data variabel <code>number</code> juga berubah.</p><p><img loading="lazy" alt="Pointer &amp; reference" src="/assets/images/pointer-references-4-ba178a14defb70eb04b45ce050af0e6e.png" width="488" height="417" class="img_ev3q"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-2">◉ Contoh ke-2<a class="hash-link" href="#-contoh-ke-2" title="Direct link to heading">​</a></h3><p>Agar makin familiar dengan cara penerapan pointer & reference, silakan lanjut dengan praktik program berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── main.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">Cargo.toml</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"># </span><span class="token punctuation" style="color:#393A34">...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">dependencies</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">rand </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.8.5"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">rand</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Rng</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> _ </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">change_value</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">change_value</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">n </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">generate_random_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">generate_random_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">rand</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">thread_rng</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">gen_range</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">100</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada sederhana di atas, ada sebuah variable mutable bernama <code>number</code> yang dideklarasikan. Variabel tersebut kemudian diakses <em>mutable reference</em>-nya untuk dijadikan argumen statement pemanggilan fungsi <code>change_value</code>.</p><p>Di dalam fungsi <code>change_value</code>, disiapkan 1 buah angka random hasil pemanggilan fungsi <code>generate_random_number</code>, yang angka tersebut kemudian dijadikan sebagai nilai baru variable mutable reference yang mengarah ke <code>number</code>. Perubahan dalam fungsi <code>change_value</code> akan mempengaruhi data variabel <code>number</code>, karena reference-nya adalah sama.</p><p><img loading="lazy" alt="Pointer &amp; reference" src="data:image/png;base64,iVBORw0KGgoAAA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><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a337-reference--borrowing">A.33.7. Reference & borrowing<a class="hash-link" href="#a337-reference--borrowing" title="Direct link to heading">​</a></h2><p>Di Rust, reference (atau pengaksesan alamat memory suatu data) memiliki hubungan yang sangat erat dengan konsep <strong>borrowing</strong>.</p><p>Ketika kita mengambil reference suatu data, yang terjadi sebenarnya adalah kita meminjam data tersebut dari owner/pemilik sebenarnya.</p><p>Pada chapter ini kita tidak akan membahasnya lebih jauh lagi, karena akan ada chapter lain yang fokus mengulas topik tersebut secara detail, yaitu chapter <a href="/basic/borrowing">Borrowing</a>.</p><p>Untuk sekarang penulis anjurkan untuk lanjut ke chapter berikutnya secara urut.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/pointer_references" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../pointer_references</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html</a></li><li><a href="https://doc.rust-lang.org/std/marker/trait.Copy.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/marker/trait.Copy.html</a></li><li><a href="https://en.wikipedia.org/wiki/Reference_(computer_science)" target="_blank" rel="noopener noreferrer">https://en.wikipedia.org/wiki/Reference_(computer_science)</a></li><li><a href="https://progressivecoder.com/understanding-rust-ownership-and-borrowing-with-examples/" target="_blank" rel="noopener noreferrer">https://progressivecoder.com/understanding-rust-ownership-and-borrowing-with-examples/</a></li><li><a href="https://os.phil-opp.com/heap-allocation/" target="_blank" rel="noopener noreferrer">https://os.phil-opp.com/heap-allocation/</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/basic-memory-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.32. Basic Memory Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/ownership"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.34. Ownership</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a331-pointer" class="table-of-contents__link toc-highlight">A.33.1. Pointer</a></li><li><a href="#a332-reference-operator-" class="table-of-contents__link toc-highlight">A.33.2. Reference (operator <code>&</code>)</a></li><li><a href="#a333-dereference-operator-" class="table-of-contents__link toc-highlight">A.33.3. Dereference (operator <code>*</code>)</a></li><li><a href="#a334-mutable-references-operator-mut" class="table-of-contents__link toc-highlight">A.33.4. Mutable References (operator <code>&mut</code>)</a></li><li><a href="#a335-aturan-reference" class="table-of-contents__link toc-highlight">A.33.5. Aturan Reference</a></li><li><a href="#a336-karakteristik-pointer--reference" class="table-of-contents__link toc-highlight">A.33.6. Karakteristik pointer & reference</a><ul><li><a href="#-contoh-ke-1" class="table-of-contents__link toc-highlight">◉ Contoh ke-1</a></li><li><a href="#-contoh-ke-2" class="table-of-contents__link toc-highlight">◉ Contoh ke-2</a></li></ul></li><li><a href="#a337-reference--borrowing" class="table-of-contents__link toc-highlight">A.33.7. Reference & borrowing</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.33. Pointer & References</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.33. Pointer & References</h1></header><p>Chapter ini membahas tentang apa itu pointer, references, dan dereferences. Pembelajaran dimulai tentang konsep dan praktik dasar tentang ketiga topik tersebut, kemudian diikuti dengan pembahasan tentang karakteristik pointer & reference.</p><blockquote><p>Penulis tekankan bahwa <strong>pada chapter ini, konsep reference yang dibahas adalah dalam konteks programming secara general.</strong> Tidak dari sudut pandang ownership.</p></blockquote><p>Reference pada Rust memiliki keunikan, tapi kita akan bahas itu secara terpisah pada chapter <a href="/basic/borrowing">Borrowing</a>. Untuk sekarang silakan ikuti terlebih dahulu pembahasan chapter-per-chapter secara berurutan.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a331-pointer">A.33.1. Pointer<a class="hash-link" href="#a331-pointer" title="Direct link to heading">​</a></h2><p>Pointer artinya adalah alamat memori. Variabel pointer artinya adalah variabel yang berisi alamat memory (hanya alamat memory-nya saja, bukan value yang sebenarnya).</p><p>Di Rust, variabel pointer ditandai dengan adanya karakter <code>&</code> pada tipe data. Sebagai contoh <code>&i32</code> artinya adalah tipe data pointer <code>i32</code>. Contoh lain adalah <code>&bool</code> yang merupakan tipe data pointer <code>bool</code>.</p><blockquote><p>Ada dua jenis tipe pointer di Rust programming, yaitu smart pointer dan raw pointer. Pada chapter ini kita tidak membahasnya karena termasuk topik yang cukup advance. Pembahasan akan ada pada chapter terpisah <a href="#/wip/smart-pointer-raw-pointer">Smart Pointer vs Raw Pointer</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a332-reference-operator-">A.33.2. Reference (operator <code>&</code>)<a class="hash-link" href="#a332-reference-operator-" title="Direct link to heading">​</a></h2><p>Ok, selanjutnya apa itu <em>reference</em>? Istilah ini sudah beberapa kali disinggung pada chapter sebelum-sebelumnya.</p><p>Reference artinya adalah pointer dari sebuah variabel atau data. Operasi pengambilan pointer dari variabel disebut dengan <em>referencing</em>, caranya dilakukan dengan menggunakan karakter <code>&</code>.</p><p>O iya, semua jenis variabel bisa diambil nilai pointernya. Contohnya bisa dilihat berikut ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"value: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pointer_number</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"pointer: {:p}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> pointer_number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, sebuah variabel dideklarasikan bernama <code>number</code> dengan tipe data adalah numerik dan value <code>24</code>. Variabel tersebut jika di-print akan muncul nilainya, yaitu <code>24</code>.</p><p>Ada satu lagi variabel yang dideklarasikan yaitu <code>pointer_number</code>, yang nilainya adalah <em>reference</em> dari variabel <code>number</code>. Cara pengambilan reference yang dilihat pada contoh, yaitu dengan menambahkan operator <code>&</code> pada variabel yang ingin diambil pointernya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// variabel pointer_number nilainya adalah reference variabel number.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// contoh statement:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pointer_number_1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pointer_number_2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">number</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>By default, ketika variabel pointer di print, yang muncul adalah <em>underlying value</em> atau nilai sebenarnya, yang pada contoh di atas adalah <code>24</code>. Untuk menampilkan alamat memory gunakan formatted print <code>{:p}</code>.</p><p>Coba jalankan program kemudian lihat hasilnya. Value muncul sesuai dengan yang ditulis, sedangkan pointer memunculkan data alamat memory yaitu <code>0xa3bbeff6dc</code>.</p><p><img loading="eager" fetchpriority="high" alt="pointer &amp; reference" src="/assets/images/pointer-references-1-f103aebf5517db2d9de53c1fe39be319.png" width="494" height="320" class="img_CujE"></p><p>Seperti yang sudah dijelaskan di awal bahwa variabel pointer isinya adalah alamat memory. Penulisannya dalam notasi heksadesimal diawali dengan karakter <code>0x</code>. Contohnya adalah nilai <code>0xa3bbeff6dc</code> yang merupakan alamat memory, yang alamat tersebut adalah reference ke pemilik data sebenarnya (yaitu variabel <code>number</code>).</p><blockquote><p>Di environment lokal masing-masing, alamat memory yang muncul sangat mungkin berbeda karena alokasi adalah random</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a333-dereference-operator-">A.33.3. Dereference (operator <code>*</code>)<a class="hash-link" href="#a333-dereference-operator-" title="Direct link to heading">​</a></h2><p>Kita sudah belajar cara mengambil data pointer dari sebuah variabel. Pada bagian ini kita belajar cara mengambil nilai sebenarnya atau underlying value dari sebuah pointer (istilahnya adalah <em>dereference</em>).</p><p>Cara melakukan operasi <em>dereferencing</em> adalah dengan menambahkan karakter <code>*</code> pada variabel pointer. Contohnya seperti berikut, silakan tambahkan kode ini ke program yang sudah ditulis.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// variabel underlying_value nilainya adalah nilai sebenarnya dari pointer pointer_number</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> underlying_value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">pointer_number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"value: {:}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> underlying_value</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Dereference" src="/assets/images/pointer-references-2-8fdb7f20f15717b7d97311d81ffe005d.png" width="467" height="412" class="img_CujE"></p><p>Bisa dilihat, nilai dari variabel <code>underlying_value</code> adalah nilai sebenarnya dari pointer <code>pointer_number</code>, yang pastinya adalah sama dengan nilai variabel <code>number</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a334-mutable-references-operator-mut">A.33.4. Mutable References (operator <code>&mut</code>)<a class="hash-link" href="#a334-mutable-references-operator-mut" title="Direct link to heading">​</a></h2><p>By default, reference sifatnya <em>read-only</em> atau <em>immutable</em>, artinya tidak bisa diubah <em>underlying-value</em>-nya.</p><p>Jika ada variabel (sebut saja X) yang merupakan underlying value dari reference variabel lain, maka perubahan value pada variabel X tersebut <em>default</em>-nya menghasilkan error.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pointer_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"pointer_number: {:p}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> pointer_number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token operator" style="color:#393A34">*</span><span class="token plain">pointer_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"*pointer_number: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">pointer_number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Pointer &amp; reference" src="/assets/images/pointer-references-3-7b60c4bdc0392eb962187ee76ac2ab54.png" width="715" height="343" class="img_CujE"></p><p>Pada gambar di atas bisa dilihat, variabel <code>pointer_number</code> merupakan reference dari variabel mutable <code>number</code>. Setelahnya ada statement <code>*pointer_number = 12</code>, yang artinya adalah underlying value dari variabel pointer <code>pointer_number</code> diakses kemudian di-isi nilainya dengan angka <code>12</code>.</p><blockquote><p>Statement <code>*pointer_number = 12</code> tidak menghasilkan error, dan statement ini berbeda dengan <code>pointer_number = 12</code>.</p><p>Statement <code>pointer_number = 12</code> menghasilkan error karena <code>pointer_number</code> adalah variabel bertipe <strong>pointer <code>i32</code> atau <code>&i32</code> (bukan <code>i32</code>)</strong>. Jika ingin mengubah nilainya perlu mengakses dulu underlying value-nya menggunakan <code>*pointer_number</code>.</p></blockquote><p>Ok, lalu kenapa muncul error? Di gambar terlihat ada garis merah dan popup pesan error muncul, padahal tidak ada yang salah dengan statement-nya.</p><p>Penyebab erronya bukan dari statement tersebut, tetapi pada baris statement pengambilan reference variabel <code>number</code>. Statement <code>&number</code> artinya adalah mengambil reference dari variabel <code>number</code>. Di atas sempat kita bahas bahwa <em>by default</em> sebuah reference tidak bisa diubah nilainya (<em>immutable</em>), dan ini adalah penyebab error yang dialami.</p><blockquote><p>Silakan perhatikan pesan di popup error message agar mudah untuk tau di mana sumber masalahnya.</p></blockquote><p>Perubahan isi nilai variabel <code>number</code> tidak menghasilkan error, hal ini karena number adalah variabel <code>number</code> adalah mutable. Sedangkan operasi perubahan nilai variabel <code>*pointer_number</code> pada contoh di atas, dianggap sebagai error karena variabel <code>pointer_number</code> reference-nya adalah bukan mutable (meskipun reference diperoleh dari variabel <code>number</code> yang notabene mutable).</p><p>Solusi dari error di atas adalah menerapkan <strong>mutable reference</strong>. Mutable reference sama seperti reference biasa tetapi nilainya diperbolehkan untuk diubah (mutable). Caranya pengaksesan mutable reference dilakukan menggunakan operator <code>&mut</code>.</p><p>Ok, sekarang ubah statement berikut ini, lalu jalankan program:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// before</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pointer_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// after</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pointer_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Pointer &amp; reference" src="/assets/images/pointer-references-4-ba178a14defb70eb04b45ce050af0e6e.png" width="488" height="417" class="img_CujE"></p><p>Deklarasi variable pointer yang menampung mutable reference bisa via metode penulisan <em>manifest typing</em> atau <em>type inference</em>. Pada contoh berikut, variabel <code>pointer_number</code> tipe data-nya adalah mutable reference <code>i32</code>, maka penulisan tipe data adalah <code>&mut i32</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// type inference</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pointer_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// manifest typing</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pointer_number</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh ini kita menggunakan tipe data primitif, lalu bagaimana dengan tipe data non-primitive seperti custom type struct atau <code>String</code>, apakah penerapan mutable reference juga sama? Jawabannya tidak. Ada beberapa perbedaan dan nantinya kita akan bahas secara detail pada chapter <a href="/basic/borrowing">Borrowing</a>. Untuk sekarang, dianjurkan mengikuti pembahasan chapter per chapter secara urut.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a335-aturan-reference">A.33.5. Aturan Reference<a class="hash-link" href="#a335-aturan-reference" title="Direct link to heading">​</a></h2><p>Ada dua aturan penting yang harus dipatuhi dalam penerapan reference baik mutable atau immutable reference.</p><ul><li>Dalam waktu yang sama, hanya boleh ada satu mutable reference atau banyak immutable reference (keduanya tidak bisa bersamaan, harus salah satu).</li><li>Reference harus selalu valid.</li></ul><p>Mengenai penjelasan tentang dua aturan penting di atas akan bahas pada chapter <a href="/basic/borrowing">Borrowing</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a336-karakteristik-pointer--reference">A.33.6. Karakteristik pointer & reference<a class="hash-link" href="#a336-karakteristik-pointer--reference" title="Direct link to heading">​</a></h2><p>Kita sudah belajar tentang definisi beserta cara penerapan pointer, reference, dereference, dan mutable reference. Sekarang lanjut ke pembahasan tentang karakteristik dari pointer & reference.</p><p>Pointer merupakan variabel yang isinya adalah alamat memory (bukan nilai sebenarnya). Dan reference adalah alamat memory suatu data/variabel. Dengan menerapkan keduanya kita bisa menerapkan efisiensi penggunaan memory yang dampaknya sangat positif terhadap performa program.</p><p>Sekarang perhatikan statement berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_one</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Variabel <code>number_one</code> adalah data numerik bertipe <code>i32</code>, eksekusi statement tersebut menghasilkan alokasi memori selebar 32-bit.</p><p>Kemudian ada lagi statement <code>number_two</code>. Meskipun nilainya didapat dari variabel <code>number_one</code>, yang terjadi di balik layar adalah Rust akan mengalokasikan lagi alamat memory selebar 32-bit untuk menampung data <code>number_two</code> yang didapat dari hasil operasi <strong>copy</strong> dari variabel <code>number_one</code>.</p><blockquote><p>Semua variabel primitif di Rust mengadopsi <em>copy semantics</em>, yang artinya jika variabel tersebut digunakan dalam statement assignment, maka nilai akan di-duplikasi untuk kemudian ditampung pada variabel baru.</p><p>Lebih jelasnya mengenai <em>copy semantics</em> dibahas pada chapter <a href="/basic/ownership#a334-copy-semantics-vs-move-semantics">Ownership</a>.</p></blockquote><p>Selanjutnya, bandingkan dengan statement berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">number_one</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, variabel <code>number_one</code> datanya disimpan di memory dengan lebar 32-bit (masih sama seperti contoh sebelumnya). Namun ada yang berbeda dengan dengan variabel <code>number_two</code>, variabel ini adalah variabel pointer yang nilainya reference ke alamat memory data variabel <code>number_one</code>. Yang terjadi di belakang layar, Rust tidak mengalokasikan lagi memory selebar 32-bit untuk menampung data <code>number_two</code>, melainkan menggunakan alamat memory data <code>number_one</code> sebagai reference, menjadikannya sebagai alamat tujuan variabel pointer <code>number_two</code>.</p><p>Ok, lanjut. Per sekarang, reference variabel <code>number_one</code> dan <code>number_two</code> adalah sama. Dengan ini, jika dicontohkan isi data satu variabel diubah, maka variabel lainnya juga akan berubah, hal karena reference-nya adalah sama.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-1">◉ Contoh ke-1<a class="hash-link" href="#-contoh-ke-1" title="Direct link to heading">​</a></h3><p>Contoh penerapannya bisa kita lihat pada chapter <a href="/basic/pointer-references#a315-karakteristik-pointer--reference">Pointer & References</a> ini, di situ bisa dilihat ada variabel mutable <code>number</code> dan <code>pointer_number</code> yang reference-nya adalah sama dengan variabel <code>number</code>. Ketika underlying value <code>pointer_number</code> diubah (dari <code>24</code> ke <code>12</code>), isi data variabel <code>number</code> juga berubah.</p><p><img loading="lazy" alt="Pointer &amp; reference" src="/assets/images/pointer-references-4-ba178a14defb70eb04b45ce050af0e6e.png" width="488" height="417" class="img_CujE"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-contoh-ke-2">◉ Contoh ke-2<a class="hash-link" href="#-contoh-ke-2" title="Direct link to heading">​</a></h3><p>Agar makin familiar dengan cara penerapan pointer & reference, silakan lanjut dengan praktik program berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── main.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">Cargo.toml</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"># </span><span class="token punctuation" style="color:#393A34">...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">dependencies</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">rand </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.8.5"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">rand</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Rng</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> _ </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">change_value</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">change_value</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">n </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">generate_random_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">generate_random_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">rand</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">thread_rng</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">gen_range</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">100</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada sederhana di atas, ada sebuah variable mutable bernama <code>number</code> yang dideklarasikan. Variabel tersebut kemudian diakses <em>mutable reference</em>-nya untuk dijadikan argumen statement pemanggilan fungsi <code>change_value</code>.</p><p>Di dalam fungsi <code>change_value</code>, disiapkan 1 buah angka random hasil pemanggilan fungsi <code>generate_random_number</code>, yang angka tersebut kemudian dijadikan sebagai nilai baru variable mutable reference yang mengarah ke <code>number</code>. Perubahan dalam fungsi <code>change_value</code> akan mempengaruhi data variabel <code>number</code>, karena reference-nya adalah sama.</p><p><img loading="lazy" alt="Pointer &amp; reference" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAADMCAIAAACX588hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGdWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb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RN3ayqoAya2U6GAAcQFvb8saODxkNLxC2AsBBtLVBb+x4euv5QGEuvNMCgIa0FQAA0FYAALQVAABtBQAAtBUAAG0FAEBbAQDgatrKx1AAgLYeXlullYD2FwAAQFuduto5yIYyKjcCAFxbW4/jjT1YFYTGr2IjAEAT2noMb+xTcrjaRgCAK2vrYbyx0VYAeInauqU3NtoKAC84bt3IGxttBYDb0Na2vLHRVgA4vrY26I2dDTRcZinkgw8AAFfXVgAAQFsBANBWAAC0FQAA0FYAALQVAABtBQAAtBUAAG0FAEBbAQAg4v9FZVTogLiptQAAAABJRU5ErkJggg==" width="457" height="204" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a337-reference--borrowing">A.33.7. Reference & borrowing<a class="hash-link" href="#a337-reference--borrowing" title="Direct link to heading">​</a></h2><p>Di Rust, reference (atau pengaksesan alamat memory suatu data) memiliki hubungan yang sangat erat dengan konsep <strong>borrowing</strong>.</p><p>Ketika kita mengambil reference suatu data, yang terjadi sebenarnya adalah kita meminjam data tersebut dari owner/pemilik sebenarnya.</p><p>Pada chapter ini kita tidak akan membahasnya lebih jauh lagi, karena akan ada chapter lain yang fokus mengulas topik tersebut secara detail, yaitu chapter <a href="/basic/borrowing">Borrowing</a>.</p><p>Untuk sekarang penulis anjurkan untuk lanjut ke chapter berikutnya secara urut.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/pointer_references" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../pointer_references</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html</a></li><li><a href="https://doc.rust-lang.org/std/marker/trait.Copy.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/marker/trait.Copy.html</a></li><li><a href="https://en.wikipedia.org/wiki/Reference_(computer_science)" target="_blank" rel="noopener noreferrer">https://en.wikipedia.org/wiki/Reference_(computer_science)</a></li><li><a href="https://progressivecoder.com/understanding-rust-ownership-and-borrowing-with-examples/" target="_blank" rel="noopener noreferrer">https://progressivecoder.com/understanding-rust-ownership-and-borrowing-with-examples/</a></li><li><a href="https://os.phil-opp.com/heap-allocation/" target="_blank" rel="noopener noreferrer">https://os.phil-opp.com/heap-allocation/</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/basic-memory-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.32. Basic Memory Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/ownership"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.34. Ownership</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a331-pointer" class="table-of-contents__link toc-highlight">A.33.1. Pointer</a></li><li><a href="#a332-reference-operator-" class="table-of-contents__link toc-highlight">A.33.2. Reference (operator <code>&</code>)</a></li><li><a href="#a333-dereference-operator-" class="table-of-contents__link toc-highlight">A.33.3. Dereference (operator <code>*</code>)</a></li><li><a href="#a334-mutable-references-operator-mut" class="table-of-contents__link toc-highlight">A.33.4. Mutable References (operator <code>&mut</code>)</a></li><li><a href="#a335-aturan-reference" class="table-of-contents__link toc-highlight">A.33.5. Aturan Reference</a></li><li><a href="#a336-karakteristik-pointer--reference" class="table-of-contents__link toc-highlight">A.33.6. Karakteristik pointer & reference</a><ul><li><a href="#-contoh-ke-1" class="table-of-contents__link toc-highlight">◉ Contoh ke-1</a></li><li><a href="#-contoh-ke-2" class="table-of-contents__link toc-highlight">◉ Contoh ke-2</a></li></ul></li><li><a href="#a337-reference--borrowing" class="table-of-contents__link toc-highlight">A.33.7. Reference & borrowing</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/recoverable-error-handling.html b/basic/recoverable-error-handling.html index 88d26531..b1734103 100644 --- a/basic/recoverable-error-handling.html +++ b/basic/recoverable-error-handling.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/recoverable-error-handling/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/recoverable-error-handling/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.55. Error ➜ Recoverable Error & Error Handling","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/recoverable-error-handling/#webpage"},"wordCount":680,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/recoverable-error-handling/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/recoverable-error-handling/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/recoverable-error-handling","name":"A.55. Error ➜ Recoverable Error & Error Handling","description":"Chapter ini merupakan kelanjutan dari chapter sebelumnya tentang pembahasan topic error. Kali ini fokus kita lebih ke recoverable error dan penanganannya (error handling / error propagation).","datePublished":"2024-08-01T10:17:30.469Z","dateModified":"2024-08-01T10:17:30.469Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/recoverable-error-handling/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/recoverable-error-handling"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/recoverable-error-handling/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.55. Error ➜ Recoverable Error & Error Handling","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/recoverable-error-handling/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/recoverable-error-handling/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.55. Error ➜ Recoverable Error & Error Handling","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/recoverable-error-handling/#webpage"},"wordCount":680,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/recoverable-error-handling/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/recoverable-error-handling/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/recoverable-error-handling","name":"A.55. Error ➜ Recoverable Error & Error Handling","description":"Chapter ini merupakan kelanjutan dari chapter sebelumnya tentang pembahasan topic error. Kali ini fokus kita lebih ke recoverable error dan penanganannya (error handling / error propagation).","datePublished":"2024-08-30T07:44:50.424Z","dateModified":"2024-08-30T07:44:50.424Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/recoverable-error-handling/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/recoverable-error-handling"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/recoverable-error-handling/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.55. Error ➜ Recoverable Error & Error Handling","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.55. Error ➜ Recoverable Error & Error Handling</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.55. Error ➜ Recoverable Error & Error Handling</h1></header><p>Chapter ini merupakan kelanjutan dari chapter sebelumnya tentang pembahasan topic error. Kali ini fokus kita lebih ke <strong>recoverable error</strong> dan penanganannya (<em>error handling</em> / <em>error propagation</em>).</p><p>Best practice penanganan error di Rust adalah dengan mengkombinasikan keyword <code>match</code> dengan tipe data <code>Result<T, E></code>. Untuk penerapannya sendiri sebenarnya sudah cukup sering dipraktikan di chapter-chapter sebelumnya.</p><p>Pada chapter ini pembelajaran dilakukan dengan lebih banyak menulis kode (<em>coding</em>), dengan ini penulis harapkan pembaca bisa terbiasa dan nyaman dengan gaya penanganan error di Rust.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a551-praktik-membuat-program-file-manager">A.55.1. Praktik membuat program <strong>file manager</strong><a class="hash-link" href="#a551-praktik-membuat-program-file-manager" title="Direct link to heading">​</a></h2><p>Program yang akan dibuat skalanya lebih besar dibanding program pada praktik-praktik sebelumnya. Program <strong>file manager</strong> ini kita akan buat dari 0, kegunaannya adalah untuk mempermudah manajemen file seperti pembuatan file, pembacaan file, dan operasi file lainnya.</p><blockquote><p>Pastikan untuk mempelajari beberapa chapter berikut sebelum memulai pembelajaran</p><ul><li><a href="/basic/module-basic">Module System ➜ Module</a></li><li><a href="/basic/result-type">Tipe Data ➜ Result</a></li><li><a href="/basic/pattern-matching">Pattern Matching</a></li><li><a href="/basic/file-path-directory">File, Path, Directory</a></li><li><a href="/basic/unrecoverable-panic-error">Error ➜ Unrecoverable Error / Panic</a></li></ul></blockquote><p>Ok, sekarang siapkan sebuah package atau project terlebih dahulu, dengan struktur seperti ini:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">file_manager</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── file_action_constant.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── file_manager.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── file_utility.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── main.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>File <code>file_action_constant.rs</code> akan diisi dengan deklarasi konstanta base path, enum action/command, dan fungsi validasi command.</li><li>File <code>file_manager.rs</code> akan diisi dengan <em>business process</em> program file manager.</li><li>File <code>file_utility.rs</code> akan diisi dengan beberapa fungsi utilitas seperti operasi baca inputan user.</li><li>File <code>main.rs</code> berisi kontrol alur eksekusi program.</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-deklarasi-konstanta-command-dan-validasi-command">◉ Deklarasi konstanta, command, dan validasi command<a class="hash-link" href="#-deklarasi-konstanta-command-dan-validasi-command" title="Direct link to heading">​</a></h3><p>Deklarasikan beberapa hal berikut pada file <code>file_action_constant.rs</code>:</p><ul><li>Konstanta <code>FOLDER_BASEPATH</code>. Nantinya digunakan sebagai basepath operasi program file manager ini.</li><li>Enum <code>Command</code>, berisi action yang tersedia seperti <code>PrintFiles</code>, <code>CreateFile</code>, dan lainnya.</li><li>Fungsi validasi command.</li></ul><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">./src/file_action_constant.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">FOLDER_BASEPATH</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"./files"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Command</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">PrintFiles</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">CreateFile</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">ReadFile</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">DeleteFile</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">ExitProgram</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">validate_command</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">cmd</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> cmd </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"1"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PrintFiles</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"2"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">CreateFile</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"3"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">ReadFile</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"4"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">DeleteFile</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"9"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">ExitProgram</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"unrecognized command"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dari kode di atas terlihat bahwa program akan berisi setidaknya 5 buah action (termasuk <code>ExitProgram</code>).</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-fungsi-utilitas-pembacaan-inputan-user--flush-stdout">◉ Fungsi utilitas pembacaan inputan user & flush stdout<a class="hash-link" href="#-fungsi-utilitas-pembacaan-inputan-user--flush-stdout" title="Direct link to heading">​</a></h3><p>Siapkan 2 fungsi I/O berikut:</p><ul><li>Fungsi <code>read_entry()</code> untuk membaca inputan user, lalu mengembalikannya dalam bentuk <code>Result<T, E></code> dimana <code>T</code> berisi inputan user dan <code>E</code> berisi informasi error dalam bentuk <code>String</code> (jika ada error).</li><li>Fungsi <code>stdout_flush()</code> untuk mem-flush output <strong>stdout</strong>. Ini penting karena <em>default</em>-nya Rust mem-<em>buffer</em> stdout.</li></ul><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">./src/file_utility.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">io</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Write</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> reader_res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdin</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">read_line</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using guard method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> content </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> reader_res </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">_</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">trim</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">stdout_flush</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using basic implementation of keyword match</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdout</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">flush</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Di kode di atas kita sudah mulai mengimplementasikan operasi <strong>error handling</strong> di Rust, caranya cukup mudah bukan? Tinggal masukan saja data bertipe <code>Result<T, E></code> ke keyword <code>match</code>. Untuk penerapan keyword tersebut bisa dilakukan dengan cara konvensional, metode guard, atau lainnya.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-kontrol-flow-program">◉ Kontrol flow program<a class="hash-link" href="#-kontrol-flow-program" title="Direct link to heading">​</a></h3><p>Lanjut ke bagian kontrol eksekusi alur program. Program didesain berjalan secara kontinyu (non-stop) sampai user memilih command <code>ExitProgram</code>. Di setiap perulangan, nantinya user bisa menentukan action apa yang dipilih.</p><p>Buka file <code>main.rs</code>, buat fungsi <code>run_program()</code>. Fungsi ini mengembalikan tipe data bernotasi <code>Result<(), String></code>. Notasi ini penulis jadikan sebagai notasi utama untuk fungsi-fungsi yang berpotensi mengembalikan error.</p><p>Di dalam fungsi <code>run_program()</code>, terdapat perulangan dengan isi beberapa hal berikut secara berurutan.</p><ol><li>Memunculkan output pilihan command</li><li>Flush stdout</li><li>Baca inputan user</li><li>Validasi inputan user</li><li>Eksekusi action/command<ul><li>Command <code>PrintFiles</code>: munculkan semua file yang sudah dibuat.</li><li>Command <code>CreateFile</code>: program meminta inputan nama file dan kontennya, untuk kemudian dibuatkan filenya.</li><li>Command <code>ReadFile</code>: baca file sesuai inputan nama file.</li><li>Command <code>DeleteFile</code>: operasi hapus file.</li><li>Command <code>ExitProgram</code>: keluar program.</li></ul></li></ol><p>Source code lengkap <code>main.rs</code>:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">./src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">file_action_constant</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">file_manager</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">file_utility</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">run_program</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Welcome to file maker app!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Available command:"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"1. Print files"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"2. Create file"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"3. Read file"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"4. Delete file"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"9. Exit"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Enter your command: "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using operator ?</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdout_flush</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using guard method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> user_entry </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR. unable to continue the program. {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">continue</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">txt</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> txt</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using basic implementation of keyword match</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> cmd_result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">validate_command</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">user_entry</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> cmd_result </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR. {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">continue</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> cmd </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> cmd_result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// check command</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> cmd </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PrintFiles</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using operator ?</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_manager</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">print_files</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">CreateFile</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using operator ?</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_manager</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">create_file</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">ReadFile</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using operator ?</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_manager</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_file</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">DeleteFile</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using operator ?</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_manager</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">delete_file</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">ExitProgram</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Exiting program ..."</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using basic implementation of keyword match</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">run_program</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">panic!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERRROR {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">_</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat di kode di atas, ada beberapa metode error handling yang diterapkan.</p><ul><li>Error handling menggunakan metode guard diterapkan saat pembacaan inputan user.</li><li>Error handling menggunakan implementasi standar keyword <code>match</code> dan tipe <code>Result</code> digunakan saat validasi command.</li><li>Error handling menggunakan operator <code>?</code> digunakan saat flush stdout dan eksekusi command.</li></ul><blockquote><p>Silakan mengintip kembali chapter <a href="/basic/operator-tanda-tanya">Operator ?</a> jika diperlukan untuk mengingat kembali cara kerja operator <code>?</code>.</p></blockquote><p>Metode error handling menggunakan operator <code>?</code> sengaja diterapkan pada bagian flush stdout dan eksekusi command. Karena di dalam domain tersebut, ketika ada error maka error-nya pasti berhubungan dengan I/O dan permission di level sistim operasi (OS) yang dimana kita tidak bisa menangani error tersebut dari level program yang sedang dibuat. Oleh karena itu operator <code>?</code> digunakan. Dengannya, maka error-error tersebut akan membuat eksekusi program terhenti secara total dan error dimunculkan sebelum program terhenti karena oleh panic error.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-action-commandprintfiles">◉ Action <code>Command::PrintFiles</code><a class="hash-link" href="#-action-commandprintfiles" title="Direct link to heading">​</a></h3><p>Action <code>PrintFiles</code> melakukan pengecekan pembuatan folder <code>FOLDER_BASEPATH</code> (jika belum ada), dan menampilkan list file di dalam folder tersebut. Jika tidak ada file, pesan <code>No files</code> dimunculkan ke layar.</p><p>Tulis kode berikut di file <code>file_manager.rs</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">./src/file_manager.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">file_action_constant</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">file_utility</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">path</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">fs</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">print_files</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token constant" style="color:#36acaa">FOLDER_BASEPATH</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// if files folder not exists, create it</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">!</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using basic implementation of keyword match</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">create_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">_</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using guard method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> dir </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">entry</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> entry</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> count </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> file </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> dir </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> count </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> count </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using basic implementation of keyword match</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> file </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">entry</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">" -> {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> entry</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">path</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> count </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"No files"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dari kode di atas terlihat operasi error propagation dilakukan 3 kali yaitu ketika:</p><ul><li>Pembuatan folder <code>FOLDER_BASEPATH</code> (ketika folder belum ada).</li><li>Pembacaan isi folder.</li><li>Menampilkan nama file dalam folder.</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-action-commandcreatefile">◉ Action <code>Command::CreateFile</code><a class="hash-link" href="#-action-commandcreatefile" title="Direct link to heading">​</a></h3><p>Masih di file yang sama (<code>file_manager.rs</code>) tambahkan kode untuk handle action pembuatan file berikut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">./src/file_manager.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">create_file</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token constant" style="color:#36acaa">FOLDER_BASEPATH</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Enter filename: "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using operator ?</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdout_flush</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using guard method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> filename </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">txt</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> txt</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Enter file content: "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using operator ?</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdout_flush</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using guard method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> content </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">txt</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> txt</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using basic implementation of keyword match</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">write</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">filename</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Handler ini berisi interaksi I/O dengan user 2 kali:</p><ol><li>Program meminta inputan user untuk dijadikan nama file.</li><li>Program meminta lagi inputan untuk isi konten file.</li></ol><p>Perihal error handler-nya sendiri juga ada beberapa:</p><ul><li>Karena terdapat operasi I/O, maka flush stdout perlu dipanggil. Dalam pemanggilannya, metode error handler menggunakan operator <code>?</code> dipakai.<div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdout_flush</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li>Ketika baca inputan user untuk nama file dan konten file<div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> filename </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">...</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> content </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">...</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li>Ketika file dibuat (operasi write file)<div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">write</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">filename</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">...</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-action-commandreadfile">◉ Action <code>Command::ReadFile</code><a class="hash-link" href="#-action-commandreadfile" title="Direct link to heading">​</a></h3><p>Operasi baca file dilakukan dengan melibatkan I/O dengan user. User dimintai inputan nama file, kemudian file tersebut ditampilkan isinya. Jika ada error saat baca file (yang besar kemungkinan disebabkan oleh file yang dicari tidak ditemukan), pesan errornya kemudian dimunculkan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">./src/file_manager.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">read_file</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token constant" style="color:#36acaa">FOLDER_BASEPATH</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Enter filename: "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using operator ?</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdout_flush</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using guard method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> filename </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">txt</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> txt</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using guard method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> content </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">filename</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR. {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">txt</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> txt</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"File content: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat pada statement baca file, ketika terjadi error, <code>Err()</code> tidak dikembalikan, melainkan menggunakan <code>Ok()</code>. Ini penting karena jika <code>Err()</code> digunakan di situ, membuat eksekusi fungsi <code>run_program()</code> terhenti secara paksa karena fungsi <code>read_file()</code> (dan fungsi handler command lainnya) dipanggil dengan disertai operator <code>?</code>.</p><p>Yang kita lakukan disini adalah memunculkan pesan errornya ke layar secara <em>friendly</em>, agar program tetap bisa running sesuai flow.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-action-commanddeletefile">◉ Action <code>Command::DeleteFile</code><a class="hash-link" href="#-action-commanddeletefile" title="Direct link to heading">​</a></h3><p>Operasi baca file juga melibatkan 1 kali interaksi I/O dengan user. File yang namanya di-input oleh user akan dihapus.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">./src/file_manager.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">delete_file</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token constant" style="color:#36acaa">FOLDER_BASEPATH</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Enter filename: "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using operator ?</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdout_flush</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using guard method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> filename </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">txt</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> txt</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using basic implementation of keyword match</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">remove_file</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">filename</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR. {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">_</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"File deleted"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Error yang berpotensi muncul saat penghapusan file dimunculkan ke layar tanpa menandai pemanggilan fungsi sebagai error, agar flow program tetap berjalan.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-action-commandexitprogram">◉ Action <code>Command::ExitProgram</code><a class="hash-link" href="#-action-commandexitprogram" title="Direct link to heading">​</a></h3><p>Handler command exit program sudah ditulis di blok fungsi <code>run_program()</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a552-test-program">A.55.2. Test program<a class="hash-link" href="#a552-test-program" title="Direct link to heading">​</a></h2><p>Ok, bagian tulis menulis kode sudah selesai. Lanjut ke fase testing. Jalankan program, pilih beberapa command, test keseluruhan fungsinya.</p><ul><li><p>Testing pertama, munculkan files menggunakan command <code>1 Print files</code>.</p><p> <img loading="lazy" alt="Recoverable Error &amp; Error Handling" src="/assets/images/recoverable-error-handling-1-a60b09beaa6803045688abcf2a1f4762.png" width="637" height="291" class="img_ev3q"></p></li><li><p>Testing ke-2, buat file baru, cek keberadaan filenya, lalu munculkan isinya.</p><p> <img loading="lazy" alt="Recoverable Error &amp; Error Handling" src="/assets/images/recoverable-error-handling-2-4bb5c6b2c2f3dcc0eb5029fb2ab09519.png" width="637" height="673" class="img_ev3q"></p></li><li><p>Testing ke-3, hapus file yang telah dibuat, lalu cek lagi file yang ada.</p><p> <img loading="lazy" alt="Recoverable Error &amp; Error Handling" src="/assets/images/recoverable-error-handling-3-9ac2af92e26692ae7be26b9c2a06ed71.png" width="637" height="243" class="img_ev3q"></p></li><li><p>Testing ke-4, exit program.</p><p> <img loading="lazy" alt="Recoverable Error &amp; Error Handling" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAn0AAAC1CAIAAAClNd5qAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGlmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ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CAEwf0fc6aecbe5pWei7/unbDiN6OAADTR/StMwMAEL2ib50ZAIDoRd0FAMA41F0AAIxD3QUAwDjUXQAAjEPdBQDAONRdAACMQ90FAMA41F0AAIxD3QUAwDjUXQAAjEPdBQDAONRdAACMQ90FAMA41F0AAIxD3QUAwDj/Hyq8QZdzlMinAAAAAElFTkSuQmCC" width="637" height="181" class="img_ev3q"></p></li></ul><p>Hasilnya, mantab.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/recoverable_error_handling" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../recoverable_error_handling</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/module-basic">Module System ➜ Module</a></li><li><a href="/basic/result-type">Tipe Data ➜ Result</a></li><li><a href="/basic/operator-tanda-tanya">Operator ?</a></li><li><a href="/basic/pattern-matching">Pattern Matching</a></li><li><a href="/basic/file-path-directory">File, Path, Directory</a></li><li><a href="/basic/unrecoverable-panic-error">Error ➜ Unrecoverable Error / Panic</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-with-panic.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-with-panic.html</a></li><li><a href="https://doc.rust-lang.org/book/ch09-03-to-panic-or-not-to-panic.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch09-03-to-panic-or-not-to-panic.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/unrecoverable-panic-error"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.54. Error ➜ Unrecoverable Error / Panic</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a551-praktik-membuat-program-file-manager" class="table-of-contents__link toc-highlight">A.55.1. Praktik membuat program <strong>file manager</strong></a><ul><li><a href="#-deklarasi-konstanta-command-dan-validasi-command" class="table-of-contents__link toc-highlight">◉ Deklarasi konstanta, command, dan validasi command</a></li><li><a href="#-fungsi-utilitas-pembacaan-inputan-user--flush-stdout" class="table-of-contents__link toc-highlight">◉ Fungsi utilitas pembacaan inputan user & flush stdout</a></li><li><a href="#-kontrol-flow-program" class="table-of-contents__link toc-highlight">◉ Kontrol flow program</a></li><li><a href="#-action-commandprintfiles" class="table-of-contents__link toc-highlight">◉ Action <code>Command::PrintFiles</code></a></li><li><a href="#-action-commandcreatefile" class="table-of-contents__link toc-highlight">◉ Action <code>Command::CreateFile</code></a></li><li><a href="#-action-commandreadfile" class="table-of-contents__link toc-highlight">◉ Action <code>Command::ReadFile</code></a></li><li><a href="#-action-commanddeletefile" class="table-of-contents__link toc-highlight">◉ Action <code>Command::DeleteFile</code></a></li><li><a href="#-action-commandexitprogram" class="table-of-contents__link toc-highlight">◉ Action <code>Command::ExitProgram</code></a></li></ul></li><li><a href="#a552-test-program" class="table-of-contents__link toc-highlight">A.55.2. Test program</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.55. Error ➜ Recoverable Error & Error Handling</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.55. Error ➜ Recoverable Error & Error Handling</h1></header><p>Chapter ini merupakan kelanjutan dari chapter sebelumnya tentang pembahasan topic error. Kali ini fokus kita lebih ke <strong>recoverable error</strong> dan penanganannya (<em>error handling</em> / <em>error propagation</em>).</p><p>Best practice penanganan error di Rust adalah dengan mengkombinasikan keyword <code>match</code> dengan tipe data <code>Result<T, E></code>. Untuk penerapannya sendiri sebenarnya sudah cukup sering dipraktikan di chapter-chapter sebelumnya.</p><p>Pada chapter ini pembelajaran dilakukan dengan lebih banyak menulis kode (<em>coding</em>), dengan ini penulis harapkan pembaca bisa terbiasa dan nyaman dengan gaya penanganan error di Rust.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a551-praktik-membuat-program-file-manager">A.55.1. Praktik membuat program <strong>file manager</strong><a class="hash-link" href="#a551-praktik-membuat-program-file-manager" title="Direct link to heading">​</a></h2><p>Program yang akan dibuat skalanya lebih besar dibanding program pada praktik-praktik sebelumnya. Program <strong>file manager</strong> ini kita akan buat dari 0, kegunaannya adalah untuk mempermudah manajemen file seperti pembuatan file, pembacaan file, dan operasi file lainnya.</p><blockquote><p>Pastikan untuk mempelajari beberapa chapter berikut sebelum memulai pembelajaran</p><ul><li><a href="/basic/module-basic">Module System ➜ Module</a></li><li><a href="/basic/result-type">Tipe Data ➜ Result</a></li><li><a href="/basic/pattern-matching">Pattern Matching</a></li><li><a href="/basic/file-path-directory">File, Path, Directory</a></li><li><a href="/basic/unrecoverable-panic-error">Error ➜ Unrecoverable Error / Panic</a></li></ul></blockquote><p>Ok, sekarang siapkan sebuah package atau project terlebih dahulu, dengan struktur seperti ini:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">file_manager</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── file_action_constant.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── file_manager.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── file_utility.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── main.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>File <code>file_action_constant.rs</code> akan diisi dengan deklarasi konstanta base path, enum action/command, dan fungsi validasi command.</li><li>File <code>file_manager.rs</code> akan diisi dengan <em>business process</em> program file manager.</li><li>File <code>file_utility.rs</code> akan diisi dengan beberapa fungsi utilitas seperti operasi baca inputan user.</li><li>File <code>main.rs</code> berisi kontrol alur eksekusi program.</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-deklarasi-konstanta-command-dan-validasi-command">◉ Deklarasi konstanta, command, dan validasi command<a class="hash-link" href="#-deklarasi-konstanta-command-dan-validasi-command" title="Direct link to heading">​</a></h3><p>Deklarasikan beberapa hal berikut pada file <code>file_action_constant.rs</code>:</p><ul><li>Konstanta <code>FOLDER_BASEPATH</code>. Nantinya digunakan sebagai basepath operasi program file manager ini.</li><li>Enum <code>Command</code>, berisi action yang tersedia seperti <code>PrintFiles</code>, <code>CreateFile</code>, dan lainnya.</li><li>Fungsi validasi command.</li></ul><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">./src/file_action_constant.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">FOLDER_BASEPATH</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"./files"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">Command</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">PrintFiles</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">CreateFile</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">ReadFile</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">DeleteFile</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">ExitProgram</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">validate_command</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">cmd</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> cmd </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"1"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PrintFiles</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"2"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">CreateFile</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"3"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">ReadFile</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"4"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">DeleteFile</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"9"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">ExitProgram</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"unrecognized command"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dari kode di atas terlihat bahwa program akan berisi setidaknya 5 buah action (termasuk <code>ExitProgram</code>).</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-fungsi-utilitas-pembacaan-inputan-user--flush-stdout">◉ Fungsi utilitas pembacaan inputan user & flush stdout<a class="hash-link" href="#-fungsi-utilitas-pembacaan-inputan-user--flush-stdout" title="Direct link to heading">​</a></h3><p>Siapkan 2 fungsi I/O berikut:</p><ul><li>Fungsi <code>read_entry()</code> untuk membaca inputan user, lalu mengembalikannya dalam bentuk <code>Result<T, E></code> dimana <code>T</code> berisi inputan user dan <code>E</code> berisi informasi error dalam bentuk <code>String</code> (jika ada error).</li><li>Fungsi <code>stdout_flush()</code> untuk mem-flush output <strong>stdout</strong>. Ini penting karena <em>default</em>-nya Rust mem-<em>buffer</em> stdout.</li></ul><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">./src/file_utility.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">io</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Write</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> reader_res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdin</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">read_line</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using guard method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> content </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> reader_res </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">_</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">trim</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">stdout_flush</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using basic implementation of keyword match</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdout</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">flush</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Di kode di atas kita sudah mulai mengimplementasikan operasi <strong>error handling</strong> di Rust, caranya cukup mudah bukan? Tinggal masukan saja data bertipe <code>Result<T, E></code> ke keyword <code>match</code>. Untuk penerapan keyword tersebut bisa dilakukan dengan cara konvensional, metode guard, atau lainnya.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-kontrol-flow-program">◉ Kontrol flow program<a class="hash-link" href="#-kontrol-flow-program" title="Direct link to heading">​</a></h3><p>Lanjut ke bagian kontrol eksekusi alur program. Program didesain berjalan secara kontinyu (non-stop) sampai user memilih command <code>ExitProgram</code>. Di setiap perulangan, nantinya user bisa menentukan action apa yang dipilih.</p><p>Buka file <code>main.rs</code>, buat fungsi <code>run_program()</code>. Fungsi ini mengembalikan tipe data bernotasi <code>Result<(), String></code>. Notasi ini penulis jadikan sebagai notasi utama untuk fungsi-fungsi yang berpotensi mengembalikan error.</p><p>Di dalam fungsi <code>run_program()</code>, terdapat perulangan dengan isi beberapa hal berikut secara berurutan.</p><ol><li>Memunculkan output pilihan command</li><li>Flush stdout</li><li>Baca inputan user</li><li>Validasi inputan user</li><li>Eksekusi action/command<ul><li>Command <code>PrintFiles</code>: munculkan semua file yang sudah dibuat.</li><li>Command <code>CreateFile</code>: program meminta inputan nama file dan kontennya, untuk kemudian dibuatkan filenya.</li><li>Command <code>ReadFile</code>: baca file sesuai inputan nama file.</li><li>Command <code>DeleteFile</code>: operasi hapus file.</li><li>Command <code>ExitProgram</code>: keluar program.</li></ul></li></ol><p>Source code lengkap <code>main.rs</code>:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">./src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">file_action_constant</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">file_manager</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">file_utility</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">run_program</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Welcome to file maker app!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">loop</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Available command:"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"1. Print files"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"2. Create file"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"3. Read file"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"4. Delete file"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"9. Exit"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Enter your command: "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using operator ?</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdout_flush</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using guard method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> user_entry </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR. unable to continue the program. {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">continue</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">txt</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> txt</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using basic implementation of keyword match</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> cmd_result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">validate_command</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token plain">user_entry</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> cmd_result </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR. {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">continue</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> cmd </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> cmd_result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// check command</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> cmd </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">PrintFiles</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using operator ?</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_manager</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">print_files</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">CreateFile</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using operator ?</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_manager</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">create_file</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">ReadFile</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using operator ?</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_manager</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_file</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">DeleteFile</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using operator ?</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_manager</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">delete_file</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Command</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">ExitProgram</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Exiting program ..."</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using basic implementation of keyword match</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">run_program</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">panic!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERRROR {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">_</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat di kode di atas, ada beberapa metode error handling yang diterapkan.</p><ul><li>Error handling menggunakan metode guard diterapkan saat pembacaan inputan user.</li><li>Error handling menggunakan implementasi standar keyword <code>match</code> dan tipe <code>Result</code> digunakan saat validasi command.</li><li>Error handling menggunakan operator <code>?</code> digunakan saat flush stdout dan eksekusi command.</li></ul><blockquote><p>Silakan mengintip kembali chapter <a href="/basic/operator-tanda-tanya">Operator ?</a> jika diperlukan untuk mengingat kembali cara kerja operator <code>?</code>.</p></blockquote><p>Metode error handling menggunakan operator <code>?</code> sengaja diterapkan pada bagian flush stdout dan eksekusi command. Karena di dalam domain tersebut, ketika ada error maka error-nya pasti berhubungan dengan I/O dan permission di level sistim operasi (OS) yang dimana kita tidak bisa menangani error tersebut dari level program yang sedang dibuat. Oleh karena itu operator <code>?</code> digunakan. Dengannya, maka error-error tersebut akan membuat eksekusi program terhenti secara total dan error dimunculkan sebelum program terhenti karena oleh panic error.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-action-commandprintfiles">◉ Action <code>Command::PrintFiles</code><a class="hash-link" href="#-action-commandprintfiles" title="Direct link to heading">​</a></h3><p>Action <code>PrintFiles</code> melakukan pengecekan pembuatan folder <code>FOLDER_BASEPATH</code> (jika belum ada), dan menampilkan list file di dalam folder tersebut. Jika tidak ada file, pesan <code>No files</code> dimunculkan ke layar.</p><p>Tulis kode berikut di file <code>file_manager.rs</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">./src/file_manager.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">file_action_constant</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">file_utility</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">path</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">fs</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">print_files</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token constant" style="color:#36acaa">FOLDER_BASEPATH</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// if files folder not exists, create it</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">!</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using basic implementation of keyword match</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">create_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">_</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using guard method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> dir </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">entry</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> entry</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> count </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> file </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> dir </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> count </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> count </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using basic implementation of keyword match</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> file </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">entry</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">" -> {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> entry</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">path</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> count </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"No files"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dari kode di atas terlihat operasi error propagation dilakukan 3 kali yaitu ketika:</p><ul><li>Pembuatan folder <code>FOLDER_BASEPATH</code> (ketika folder belum ada).</li><li>Pembacaan isi folder.</li><li>Menampilkan nama file dalam folder.</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-action-commandcreatefile">◉ Action <code>Command::CreateFile</code><a class="hash-link" href="#-action-commandcreatefile" title="Direct link to heading">​</a></h3><p>Masih di file yang sama (<code>file_manager.rs</code>) tambahkan kode untuk handle action pembuatan file berikut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">./src/file_manager.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">create_file</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token constant" style="color:#36acaa">FOLDER_BASEPATH</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Enter filename: "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using operator ?</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdout_flush</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using guard method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> filename </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">txt</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> txt</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Enter file content: "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using operator ?</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdout_flush</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using guard method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> content </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">txt</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> txt</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using basic implementation of keyword match</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">write</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">filename</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Handler ini berisi interaksi I/O dengan user 2 kali:</p><ol><li>Program meminta inputan user untuk dijadikan nama file.</li><li>Program meminta lagi inputan untuk isi konten file.</li></ol><p>Perihal error handler-nya sendiri juga ada beberapa:</p><ul><li>Karena terdapat operasi I/O, maka flush stdout perlu dipanggil. Dalam pemanggilannya, metode error handler menggunakan operator <code>?</code> dipakai.<div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdout_flush</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li>Ketika baca inputan user untuk nama file dan konten file<div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> filename </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">...</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> content </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">...</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li>Ketika file dibuat (operasi write file)<div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">write</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">filename</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">...</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-action-commandreadfile">◉ Action <code>Command::ReadFile</code><a class="hash-link" href="#-action-commandreadfile" title="Direct link to heading">​</a></h3><p>Operasi baca file dilakukan dengan melibatkan I/O dengan user. User dimintai inputan nama file, kemudian file tersebut ditampilkan isinya. Jika ada error saat baca file (yang besar kemungkinan disebabkan oleh file yang dicari tidak ditemukan), pesan errornya kemudian dimunculkan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">./src/file_manager.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">read_file</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token constant" style="color:#36acaa">FOLDER_BASEPATH</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Enter filename: "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using operator ?</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdout_flush</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using guard method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> filename </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">txt</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> txt</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using guard method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> content </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">filename</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR. {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">txt</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> txt</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"File content: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> content</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat pada statement baca file, ketika terjadi error, <code>Err()</code> tidak dikembalikan, melainkan menggunakan <code>Ok()</code>. Ini penting karena jika <code>Err()</code> digunakan di situ, membuat eksekusi fungsi <code>run_program()</code> terhenti secara paksa karena fungsi <code>read_file()</code> (dan fungsi handler command lainnya) dipanggil dengan disertai operator <code>?</code>.</p><p>Yang kita lakukan disini adalah memunculkan pesan errornya ke layar secara <em>friendly</em>, agar program tetap bisa running sesuai flow.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-action-commanddeletefile">◉ Action <code>Command::DeleteFile</code><a class="hash-link" href="#-action-commanddeletefile" title="Direct link to heading">​</a></h3><p>Operasi baca file juga melibatkan 1 kali interaksi I/O dengan user. File yang namanya di-input oleh user akan dihapus.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">./src/file_manager.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">delete_file</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Path</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token namespace" style="opacity:0.7">file_action_constant</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token constant" style="color:#36acaa">FOLDER_BASEPATH</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Enter filename: "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using operator ?</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdout_flush</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token operator" style="color:#393A34">?</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using guard method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> filename </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">file_utility</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">txt</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> txt</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error handling using basic implementation of keyword match</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">fs</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">remove_file</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">filename</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">err</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR. {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">_</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"File deleted"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Error yang berpotensi muncul saat penghapusan file dimunculkan ke layar tanpa menandai pemanggilan fungsi sebagai error, agar flow program tetap berjalan.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-action-commandexitprogram">◉ Action <code>Command::ExitProgram</code><a class="hash-link" href="#-action-commandexitprogram" title="Direct link to heading">​</a></h3><p>Handler command exit program sudah ditulis di blok fungsi <code>run_program()</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a552-test-program">A.55.2. Test program<a class="hash-link" href="#a552-test-program" title="Direct link to heading">​</a></h2><p>Ok, bagian tulis menulis kode sudah selesai. Lanjut ke fase testing. Jalankan program, pilih beberapa command, test keseluruhan fungsinya.</p><ul><li><p>Testing pertama, munculkan files menggunakan command <code>1 Print files</code>.</p><p> <img loading="eager" fetchpriority="high" alt="Recoverable Error &amp; Error Handling" src="/assets/images/recoverable-error-handling-1-a60b09beaa6803045688abcf2a1f4762.png" width="637" height="291" class="img_CujE"></p></li><li><p>Testing ke-2, buat file baru, cek keberadaan filenya, lalu munculkan isinya.</p><p> <img loading="lazy" alt="Recoverable Error &amp; Error Handling" src="/assets/images/recoverable-error-handling-2-4bb5c6b2c2f3dcc0eb5029fb2ab09519.png" width="637" height="673" class="img_CujE"></p></li><li><p>Testing ke-3, hapus file yang telah dibuat, lalu cek lagi file yang ada.</p><p> <img loading="lazy" alt="Recoverable Error &amp; Error Handling" src="/assets/images/recoverable-error-handling-3-9ac2af92e26692ae7be26b9c2a06ed71.png" width="637" height="243" class="img_CujE"></p></li><li><p>Testing ke-4, exit program.</p><p> <img loading="lazy" alt="Reco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SLdaqIDDsaNu781PfMjTs/9e33WktZS1fDc+NZ9DLRG03LXSHzwU5zxvpJsxexh9iRM9YWYpo9AGCai748osS0sqqDCXW5u7XnthLTyqoOLm0L+B5RsXyYU6TrZnPoHQEAEKLo259Zu/nqlpaZMle+++qjyNdCwzoCAEwf0fc6aecbe5pWei7/unbDiN6OAADTR/StMwMAEL2ib50ZAIDoRd0FAMA41F0AAIxD3QUAwDjUXQAAjEPdBQDAONRdAACMQ90FAMA41F0AAIxD3QUAwDjUXQAAjEPdBQDAONRdAACMQ90FAMA41F0AAIxD3QUAwDj/Hyq8QZdzlMinAAAAAElFTkSuQmCC" width="637" height="181" class="img_CujE"></p></li></ul><p>Hasilnya, mantab.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/recoverable_error_handling" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../recoverable_error_handling</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/module-basic">Module System ➜ Module</a></li><li><a href="/basic/result-type">Tipe Data ➜ Result</a></li><li><a href="/basic/operator-tanda-tanya">Operator ?</a></li><li><a href="/basic/pattern-matching">Pattern Matching</a></li><li><a href="/basic/file-path-directory">File, Path, Directory</a></li><li><a href="/basic/unrecoverable-panic-error">Error ➜ Unrecoverable Error / Panic</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-with-panic.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-with-panic.html</a></li><li><a href="https://doc.rust-lang.org/book/ch09-03-to-panic-or-not-to-panic.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch09-03-to-panic-or-not-to-panic.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/unrecoverable-panic-error"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.54. Error ➜ Unrecoverable Error / Panic</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a551-praktik-membuat-program-file-manager" class="table-of-contents__link toc-highlight">A.55.1. Praktik membuat program <strong>file manager</strong></a><ul><li><a href="#-deklarasi-konstanta-command-dan-validasi-command" class="table-of-contents__link toc-highlight">◉ Deklarasi konstanta, command, dan validasi command</a></li><li><a href="#-fungsi-utilitas-pembacaan-inputan-user--flush-stdout" class="table-of-contents__link toc-highlight">◉ Fungsi utilitas pembacaan inputan user & flush stdout</a></li><li><a href="#-kontrol-flow-program" class="table-of-contents__link toc-highlight">◉ Kontrol flow program</a></li><li><a href="#-action-commandprintfiles" class="table-of-contents__link toc-highlight">◉ Action <code>Command::PrintFiles</code></a></li><li><a href="#-action-commandcreatefile" class="table-of-contents__link toc-highlight">◉ Action <code>Command::CreateFile</code></a></li><li><a href="#-action-commandreadfile" class="table-of-contents__link toc-highlight">◉ Action <code>Command::ReadFile</code></a></li><li><a href="#-action-commanddeletefile" class="table-of-contents__link toc-highlight">◉ Action <code>Command::DeleteFile</code></a></li><li><a href="#-action-commandexitprogram" class="table-of-contents__link toc-highlight">◉ Action <code>Command::ExitProgram</code></a></li></ul></li><li><a href="#a552-test-program" class="table-of-contents__link toc-highlight">A.55.2. Test program</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/result-type.html b/basic/result-type.html index 8b3bed71..3342ec6e 100644 --- a/basic/result-type.html +++ b/basic/result-type.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/result-type/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/result-type/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.40. Tipe Data ➜ Result","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/result-type/#webpage"},"wordCount":964,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/result-type/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/result-type/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/result-type","name":"A.40. Tipe Data ➜ Result","description":"Chapter ini membahas tentang tipe data Result, yaitu tipe data yang digunakan untuk menampung nilai yang isinya bisa berupa penanda operasi sukses (Ok) dan data, atau error (Err) beserta keterangan errornya.","datePublished":"2024-08-01T10:17:30.278Z","dateModified":"2024-08-01T10:17:30.278Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/result-type/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/result-type"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/result-type/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.40. Tipe Data ➜ Result","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/result-type/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/result-type/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.40. Tipe Data ➜ Result","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/result-type/#webpage"},"wordCount":964,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/result-type/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/result-type/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/result-type","name":"A.40. Tipe Data ➜ Result","description":"Chapter ini membahas tentang tipe data Result, yaitu tipe data yang digunakan untuk menampung nilai yang isinya bisa berupa penanda operasi sukses (Ok) dan data, atau error (Err) beserta keterangan errornya.","datePublished":"2024-08-30T07:44:50.287Z","dateModified":"2024-08-30T07:44:50.287Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/result-type/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/result-type"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/result-type/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.40. Tipe Data ➜ Result","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.40. Tipe Data ➜ Result</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.40. Tipe Data ➜ Result</h1></header><p>Chapter ini membahas tentang tipe data <code>Result</code>, yaitu tipe data yang digunakan untuk menampung nilai yang isinya bisa berupa penanda operasi sukses (<code>Ok</code>) dan data, atau error (<code>Err</code>) beserta keterangan errornya.</p><p>Rust menyediakan panic-level error, tapi penggunaannya untuk menandai operasi error sangat tidak dianjurkan. Selain itu, Rust tidak mengenal konsep <em>exception</em>.</p><p>Tipe <code>Result</code> ini adalah tipe yang paling umum dan direkomendasikan untuk digunakan dalam penanganan error.</p><blockquote><p>Lebih detailnya mengenai penanganan error dibahas di chapter <a href="/basic/recoverable-error-handling">Error ➜ Recoverable Error & Error Handling</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a401-konsep-result">A.40.1. Konsep <code>Result</code><a class="hash-link" href="#a401-konsep-result" title="Direct link to heading">​</a></h2><p>Tipe data <code>Result</code> adalah enum dengan isi 2 buah enum value:</p><ul><li><code>Result::Ok<T></code> (atau <code>Ok<T></code>), digunakan untuk menandai bahwa data isinya adalah kabar baik (oke / mantab / jos / sukses).</li><li><code>Result::Err<E></code> (atau <code>Err<E></code>), digunakan untuk menandai bawah data berisi kabar buruk (error).</li></ul><blockquote><ul><li><code>T</code> dan <code>E</code> merupakan parameter generic. Lebih jelasnya mengenai generic dibahas pada chapter <a href="/basic/generics">Generics</a>.</li></ul></blockquote><p>Tipe data <code>Result</code> memiliki notasi penulisan <code>Result<T, E></code> yang mana <code>T</code> digunakan pada enum value <code>Ok<T></code> dan <code>E</code> digunakan enum value <code>Err<E></code>.</p><p>Cara penerapan tipe data ini bisa dilihat pada kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">MathError</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">DivisionByZero</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">InfinityNumber</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">OtherError</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">MathError</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">a</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">MathError</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">MathError</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">DivisionByZero</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">/</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>divider</code> di atas tugasnya adalah melakukan operasi aritmatika pembagian angka numerik <code>f64</code>, parameter <code>a</code> dibagi <code>b</code>.</p><p>Pada fungsi tersebut terdapat pengecekan apabila nilai <code>b</code> adalah <code>0</code>, maka yang dikembalikan adalah <code>Err<E></code> dengan <code>E</code> berisi pesan error, selainnya maka hasil operasi pembagian dikembalikan dibungkus dalam enum value <code>Ok<f64></code>.</p><p>Fungsi <code>divider</code> nilai baliknya bertipe <code>Result<f64, MathError></code>. Dari tipe data yang digunakan nantinya bisa diprediksi pasti akan ada 2 potensi value:</p><ul><li>Return value adalah enum value <code>Err<MathError></code>, muncul ketika nilai <code>b</code> adalah <code>0</code></li><li>Return value adalah nilai hasil numerik yang dibungkus oleh enum value <code>Ok<f64></code></li></ul><p>Output program di atas saat di-run:</p><p><img loading="lazy" alt="Result type" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcYAAABwCAIAAAAL5EeiAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94c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Dj5PaAcoHXBVSw4Jm4JaaM0xEQh4gQyD1DJE6+qIOyeC/YWV6//+EQaJvBGvk5MTvJfCaAwKpFZfK2i2olUtaLLxSo+QQEZ3aj8KshT2l3EpaSi/87F0F9n9127sKBWU5pFWK5Bci/ysxSiulRdLvkAiBVHVUuW4L6gxS5cInG4UjRBhK/fxD6BurmSFP+JX60y//ee0d90ZfiZizGSsusTfTVlKKBFMRSK1F6uotqK+SudQ+fgsL/0XZqPwyQGStoiHV/xjGf2JKhTxBSgHo35X2DKou1Ey0Pgz6T+hNod+lIn1h7I9A6tg5svVZUOcH/rZZv2RsXBGlep9josrVLA+ddQdYEanBDEp0j4gW5IUjC70ptFKezISpCKSOQOrKLKgnQGohSo2iS40nCVEzrRX/JksuSnUfDUj1q3f8Xo5CS+WTkZqdnyVKRSB1GKpWaEE9HqnZudSkCGLhnSVsdjr5KlfddIZTNNUuRqnBQwuvr6/yj2sXelNqJbFIBKkIpI6O/lZoQS0+l1qFVCkK0yypLU8miCnFVtKO6ZXAS5mfS00j7egXCaSc0t7MLhWKz7RCVARSUT5s3L6WG4sz6kcgFZ05VO3P/dNsCIFUwq3SNMhyESpDfgRSEUIIgVSEEAKpCCEEUhFCCIFUhBACqQghBFIRQgikIoQQAqkIIQRSEUIIpCKEEAKpCCEEUhFCaPX6Hye9VwdYGuT2AAAAAElFTkSuQmCC" width="454" height="112" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a402-pattern-matching-pada-tipe-result">A.40.2. Pattern matching pada tipe <code>Result</code><a class="hash-link" href="#a402-pattern-matching-pada-tipe-result" title="Direct link to heading">​</a></h2><p>Dalam penerapannya, ketika ada data bertipe <code>Result</code> artinya data tersebut berpotensi untuk berisi nilai <code>Err<E></code> atau <code>Ok<T></code>, pasti antara 2 nilai tersebut.</p><p>Umumnya penggunaan tipe <code>Result</code> selalu diikuti dengan pattern matching menggunakan keyword <code>match</code>. Selain itu keyword <code>if</code> sebenarnya juga bisa diterapkan pada pattern matching tipe data ini, namun kurang dianjurkan.</p><p>Mari kita praktikkan. Ubah isi fungsi <code>main</code> dengan kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Option type" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAABZCAIAAAAirLMmAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Im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IkYpiqK2j9G/vn3/r9W/X3klKIoiRmfA1MXo13//+/7tr9lsTsIZJs3IT1EUdXkYbU7WZ23OEj3N6f+7csek8CBFUVQBjLZoG0K1nnupgK476qDS46b90c4ZnPbEtZwI0UIihvcIyfYTPEiOUhRVDKMD1Aa+WKAamRNGl3qMRqPRohi1y+jbBg9yYk9RVDmMDogx5DPHLMr0DDIRpUefIhjNU2JO7kTXTfGnz/Agw1GKokpO6gM2urKXJZ0DS2MUoVyOrocbAzrIaJSiqKoYjVNmiAgXxahhaOoE3sKnKRIeZDBKUVQ1jKZjvgFLFp/aiC+KUWFvR7U2KjK0jZ3dDaT+o1PP4CBFUVQtjPoT+5FE4T77cPj7t68dN4NFgcTDmxqMDssJ/jpDgFGnFOswPEhRFDUboxRFURQxSlEURYxSFEURoxRFUcQoRVEURYxSFEURoxRFUcQoRVEUMUpRFEWMUhRFUcQoRVEUMUpRFEWMUhRFXZX+B8p6jhhWvr2eAAAAAElFTkSuQmCC" width="450" height="89" class="img_ev3q"></p><p>Bisa dilihat pada kode di atas mudahnya pengambilan nilai <code>m</code> dari <code>Err(m)</code> dan juga <code>r</code> dari <code>Ok(r)</code>. Penerapan <code>match</code> untuk seleksi kondisi biasa disebut dengan <strong>pattern matching</strong> dan teknik ini sangat fleksibel dan advance.</p><p>Sebagai contoh, dengan penerapan match yang seperti ini kita bisa meng-handle 5 skenario seleksi kondisi:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">MathError</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">DivisionByZero</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! unable to divide number by 0"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">MathError</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">InfinityNumber</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! result is infinity number (∞)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">_</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! unknown error"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the result is 2"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {x:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Kondisi ke-1: jika nilai adalah <code>Err(MathError::DivisionByZero)</code>, maka munculkan pesan <code>ERROR! unable to divide number by 0</code>.</li><li>Kondisi ke-2: jika nilai adalah <code>Err(MathError::InfinityNumber)</code>, maka munculkan pesan <code>ERROR! result is infinity number (∞)</code>.</li><li>Kondisi ke-3: jika nilai adalah <code>Err</code> selain dari <code>Err(MathError::DivisionByZero)</code> dan <code>Err(MathError::InfinityNumber)</code>, maka munculkan pesan <code>ERROR! unknown error</code>.</li><li>Kondisi ke-4: jika nilai adalah <code>Ok(2.0)</code>, maka munculkan pesan <code>the result is 2</code>.</li><li>Kondisi ke-5: jika nilai adalah <code>Ok</code> selain dari <code>Ok(2.0)</code>, maka munculkan pesan <code>result: {x:.2}</code>.</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-tips-pattern-matching">◉ Tips pattern matching<a class="hash-link" href="#-tips-pattern-matching" title="Direct link to heading">​</a></h3><p>Silakan perhatikan kode yang sudah kita praktikkan berikut ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Penerapan pattern matching seperti contoh di atas memiliki konsekuensi, yaitu variabel <code>r</code> hanya bisa diakses pada block <code>Ok(r)</code> saja.</p><p>Adakalanya kita butuh untuk mengeluarkan variabel <code>r</code> ke luar block. Hal seperti ini mudah untuk dilakukan, dan ada beberapa cara yang bisa dipilih, namun menurut penulis yang paling elegan adalah cara berikut ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> r</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Statement <code>divider(10.0, 5.0)</code> mengembalikan data bertipe <code>Result<f64, MathError></code>. Data tersebut digunakan pada keyword <code>match</code> seperti biasa. Namun pada contoh di atas ada yang berbeda, yaitu return value dari statement <code>match</code> ditampung ke variabel (<code>result</code>).</p><p>Isi dari pattern matching <code>match</code> sendiri ada dua:</p><ul><li>Ketika block <code>Err(m)</code> match, error di-print kemudian nilai <code>0.0</code> dijadikan return statement <code>match</code>.</li><li>Ketika block <code>Ok</code> match, data <code>r</code> dijadikan return value statement <code>match</code>.</li></ul><p>Dengan penerapan pattern matching seperti di atas, maka variabel <code>result</code> akan selalu berisi data hasil operasi <code>divider(10.0, 5.0)</code>. Dengan pengecualian ketika ada error, pesan errornya dimunculkan kemudian hasil operasi pembagian di-set sebagai <code>0.0</code>.</p><blockquote><p>Lebih jelasnya mengenai pattern matching dibahas pada chapter <a href="/basic/pattern-matching">Pattern Matching</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a403-method-tipe-data-result">A.40.3. Method tipe data <code>Result</code><a class="hash-link" href="#a403-method-tipe-data-result" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-is_ok--unwrap">◉ Method <code>is_ok</code> & <code>unwrap</code><a class="hash-link" href="#-method-is_ok--unwrap" title="Direct link to heading">​</a></h3><p>Isi dari enum value <code>Ok<T></code> bisa diakses tanpa menggunakan keyword <code>match</code> dengan cara memanfaatkan method <code>unwrap</code> milik <code>Result<T, E></code>. Sebelum mengakses method tersebut sangat dianjurkan untuk mengecek apakah data berisi <code>Ok<T> atau tidak</code>, karena jika data adalah <code>Err<E></code> pengaksesan method <code>unwrap</code> menghasilkan error.</p><p>Pengecekan nilai ok atau tidak bisa dilakukan menggunakan method <code>is_ok</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// result: 2</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Result type" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAABYCAIAAADqR26rAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF5WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A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ldxIz3pNi25OAPn3aCmrh22+RQ8QcGJO+l5OfLWOqulg/7H3ydXWTve6XYkNOWEO1FFarKAaTFFkZ5JOb8KV8ehM9JzATveqctZgJ7ol4G20EoU6XltcmfuM6ITzEnXCwV1OUfRs8kFLmduoZUo0pOiKIoiPSmKokhPiqIo0pOiKIr0pCiKIj0piqIo0pOiKIr0pCiKIj0piqJIT4qiKNKToiiKWiE9P//4+V+tf7+zAyiKIj3zGerS8/u///388Xk0kslkiqJIz4yLtaeerzICwhRFUWXoWROtC+xa3MFIzzrYHHUI6eHS/mifGVy2wmFOPFmlZ/hJUdTy9OxYVjHORHUWn7pjIJbU0zMae5KeFEVtlJ4d0gzwzDGLTi3zTPzoUasIPfPEiTtFUSuauQdIdGUvOToH5qYnIjhFUdSK6BknVBf/zUpPg06GnRRFrZae6QivWwztV0WbuDRKTyu1z+JkQEl0UhS1fnr6s/d+2TPcMe8O//zxvcFlMPOHu/Z5e+7dmoG/mEBRFLUMPSmKoijSk6IoivSkKIoiPSmKokhPiqIo0pOiKIoiPSmKokhPiqIo0pOiKIr0pCiKuhL9DzCR83RW6DQ7AAAAAElFTkSuQmCC" width="447" height="88" class="img_ev3q"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-as_ref">◉ Method <code>as_ref</code><a class="hash-link" href="#-method-as_ref" title="Direct link to heading">​</a></h3><p>Method <code>as_ref</code> digunakan untuk mengakses reference <code>T</code> dan <code>E</code> pada <code>Result<T, E></code>. Method ini sering kali dibutuhkan untuk menghindari terjadinya <em>move semantics</em> pada owner data bertipe <code>Result<T, E></code>.</p><p>Method <code>as_ref</code> mengembalikan data dalam tipe <code>Result<&T, &E></code>. Jadi reference yang dipinjam bukan milik <code>Result</code>-nya melainkan milik <code>T</code> dan <code>E</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">MathError</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result_borrow</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">MathError</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_ref</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Lebih jelasnya mengenai <em>move semantics</em> dibahas pada chapter <a href="/basic/ownership#a334-copy-semantics-vs-move-semantics">Ownership</a></p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-is_err--err">◉ Method <code>is_err</code> & <code>err</code><a class="hash-link" href="#-method-is_err--err" title="Direct link to heading">​</a></h3><p>Method <code>err</code> mengembalikan data dalam tipe <code>Err<E></code>. Pada pengaksesan method ini, pastikan untuk mengecek apakah <code>Result</code> berisi data error atau ok dengan via method <code>is_err</code>. Selain itu, wajib untuk menggunakan method <code>as_ref</code> sebelum method <code>err</code> agar ownership data <code>Result</code> tidak berpindah (<em>move semantics</em>).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> err </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_ref</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error: DivisionByZero</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-ok">◉ Method <code>ok</code><a class="hash-link" href="#-method-ok" title="Direct link to heading">​</a></h3><p>Aturan yang sama juga berlaku pada pengaksesan method <code>ok</code> yang mengembalikan data <code>Ok<T></code>. Method <code>as_ref</code> harus diakses terlebih dahulu sebelum memanggil method <code>ok</code> agar tidak terjadi <em>move semantics</em>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_ref</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// result: 2</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-unwrap_or_default">◉ Method <code>unwrap_or_default</code><a class="hash-link" href="#-method-unwrap_or_default" title="Direct link to heading">​</a></h3><p>Method <code>unwrap_or_default</code> milik <code>Result<T, E></code> mengembalikan nilai <code>T</code> ketika data berisi <code>Ok<T></code>, namun jika data berisi <code>Err<E></code> maka yang dikembalikan adalah <em>default value</em> dari tipe data <code>T</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or_default</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// result: 0</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-unwrap_or">◉ Method <code>unwrap_or</code><a class="hash-link" href="#-method-unwrap_or" title="Direct link to heading">​</a></h3><p>Method <code>unwrap_or</code> milik <code>Result<T, E></code> mengembalikan nilai <code>T</code> ketika data berisi <code>Ok<T></code>, namun jika data ternyata isinya adalah <code>Err<E></code> maka yang dikembalikan adalah argument pemanggilan method tersebut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// result: 0</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-unwrap_or_else">◉ Method <code>unwrap_or_else</code><a class="hash-link" href="#-method-unwrap_or_else" title="Direct link to heading">​</a></h3><p>Method ini mengembalikan nilai <code>T</code> ketika data berisi <code>Ok<T></code>, namun jika data isinya adalah <code>Err<E></code> maka yang dikembalikan adalah hasil eksekusi closure yang disisipkan saat memanggil method <code>unwrap_or_else</code>. Contoh pengaplikasiannya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or_else</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">_</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// result: 0</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Closure harus dalam notasi <code>FnOnce(E) -> T</code> yang mana <code>T</code> pada konteks ini adalah <code>f64</code>.</p><blockquote><p>Lebih jelasnya mengenai closure dibahas pada chapter <a href="/basic/closures">Closures</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a404-operator--pada-tipe-result">A.40.4. Operator <code>?</code> pada tipe <code>Result</code><a class="hash-link" href="#a404-operator--pada-tipe-result" title="Direct link to heading">​</a></h2><p>Tipe data <code>Result</code> bisa digunakan pada operator <code>?</code>. Penjelasannya ada di chapter terpisah di <a href="/basic/operator-tanda-tanya">Operator ?</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a405-error-handling">A.40.5. Error handling<a class="hash-link" href="#a405-error-handling" title="Direct link to heading">​</a></h2><p>Tipe data <code>Result<T, E></code> banyak digunakan pada fungsi-fungsi yang disediakan Rust standard library, selain itu tipe tersebut juga akan sering kita gunakan dalam <em>real life</em> project.</p><p>Tipe ini dimanfaatkan untuk error handling di Rust. Lebih jelasnya mengenai topik tersebut dibahas pada chapter <a href="/basic/recoverable-error-handling">Error ➜ Recoverable Error & Error Handling</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a406-tipe-result-e">A.40.6. Tipe <code>Result<(), E></code><a class="hash-link" href="#a406-tipe-result-e" title="Direct link to heading">​</a></h2><p>Di atas kita telah mempelajari dan mempraktekan fungsi <code>divider()</code> yang fungsi tersebut mengembalikan 2 informasi, yaitu:</p><ul><li><code>T</code> berisi nilai hasil pembagian</li><li><code>E</code> berisi error saat operasi pembagian</li></ul><p>Bentuk lain penerapan tipe data <code>Result</code> adalah dengan menggunakan notasi <code>Result<T, E></code> dengan <code>T</code> diisi tipe data <code>()</code>. Tipe ini cukup sering digunakan pada fungsi yang memiliki potensi error tapi kita hanya butuh informasi errornya saja tanpa nilai balik lainnya.</p><p>Sebagai contoh, pada kode berikut dibuat fungsi baru bernama <code>divide_and_print()</code>. Dalam fungsi tersebut, operasi pembagian dilakukan. Jika sukses, nilainya langsung di-print; jika error, nilai errornya dikembalikan. Dari sini terlihat bahwa kita tidak membutuhkan fungsi tersebut untuk mengembalikan informasi selain error.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">divide_and_print</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">a</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">MathError</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> res </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divide_and_print</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada pemanggilan fungsi <code>Ok()</code> gunakan nilai <code>()</code> untuk memenuhi kriteria tipe data <code>Result<(), MathError></code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a407-tipe-resultt">A.40.7. Tipe <code>Result<T></code><a class="hash-link" href="#a407-tipe-resultt" title="Direct link to heading">​</a></h2><p>Notasi tipe data <code>Result</code> bawaan Rust Standard Library adalah <code>Result<T, E></code>. Namun, pada pengembangan software yang melibatkan banyak sekali library/dependency, adakalanya pembaca akan menemui notasi tipe data <code>Result<T></code>. Notasi tersebut dibuat oleh pengembang library/dependency untuk memperingkas tipe <code>Result<T, SomeErrorType></code>. Jadi tidak usah bingung.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/result_type" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../result_type</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/generics">Generics</a></li><li><a href="/basic/pattern-matching">Pattern Matching</a></li><li><a href="/basic/closures">Closures</a></li><li><a href="/basic/operator-tanda-tanya">Operator ?</a></li><li><a href="/basic/recoverable-error-handling">Error ➜ Recoverable Error & Error Handling</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html</a></li><li><a href="https://doc.rust-lang.org/std/result/index.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/result/index.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/option-type"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.39. Tipe Data ➜ Option</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/operator-tanda-tanya"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.41. Operator ?</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a401-konsep-result" class="table-of-contents__link toc-highlight">A.40.1. Konsep <code>Result</code></a></li><li><a href="#a402-pattern-matching-pada-tipe-result" class="table-of-contents__link toc-highlight">A.40.2. Pattern matching pada tipe <code>Result</code></a><ul><li><a href="#-tips-pattern-matching" class="table-of-contents__link toc-highlight">◉ Tips pattern matching</a></li></ul></li><li><a href="#a403-method-tipe-data-result" class="table-of-contents__link toc-highlight">A.40.3. Method tipe data <code>Result</code></a><ul><li><a href="#-method-is_ok--unwrap" class="table-of-contents__link toc-highlight">◉ Method <code>is_ok</code> & <code>unwrap</code></a></li><li><a href="#-method-as_ref" class="table-of-contents__link toc-highlight">◉ Method <code>as_ref</code></a></li><li><a href="#-method-is_err--err" class="table-of-contents__link toc-highlight">◉ Method <code>is_err</code> & <code>err</code></a></li><li><a href="#-method-ok" class="table-of-contents__link toc-highlight">◉ Method <code>ok</code></a></li><li><a href="#-method-unwrap_or_default" class="table-of-contents__link toc-highlight">◉ Method <code>unwrap_or_default</code></a></li><li><a href="#-method-unwrap_or" class="table-of-contents__link toc-highlight">◉ Method <code>unwrap_or</code></a></li><li><a href="#-method-unwrap_or_else" class="table-of-contents__link toc-highlight">◉ Method <code>unwrap_or_else</code></a></li></ul></li><li><a href="#a404-operator--pada-tipe-result" class="table-of-contents__link toc-highlight">A.40.4. Operator <code>?</code> pada tipe <code>Result</code></a></li><li><a href="#a405-error-handling" class="table-of-contents__link toc-highlight">A.40.5. Error handling</a></li><li><a href="#a406-tipe-result-e" class="table-of-contents__link toc-highlight">A.40.6. Tipe <code>Result<(), E></code></a></li><li><a href="#a407-tipe-resultt" class="table-of-contents__link toc-highlight">A.40.7. Tipe <code>Result<T></code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.40. Tipe Data ➜ Result</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.40. Tipe Data ➜ Result</h1></header><p>Chapter ini membahas tentang tipe data <code>Result</code>, yaitu tipe data yang digunakan untuk menampung nilai yang isinya bisa berupa penanda operasi sukses (<code>Ok</code>) dan data, atau error (<code>Err</code>) beserta keterangan errornya.</p><p>Rust menyediakan panic-level error, tapi penggunaannya untuk menandai operasi error sangat tidak dianjurkan. Selain itu, Rust tidak mengenal konsep <em>exception</em>.</p><p>Tipe <code>Result</code> ini adalah tipe yang paling umum dan direkomendasikan untuk digunakan dalam penanganan error.</p><blockquote><p>Lebih detailnya mengenai penanganan error dibahas di chapter <a href="/basic/recoverable-error-handling">Error ➜ Recoverable Error & Error Handling</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a401-konsep-result">A.40.1. Konsep <code>Result</code><a class="hash-link" href="#a401-konsep-result" title="Direct link to heading">​</a></h2><p>Tipe data <code>Result</code> adalah enum dengan isi 2 buah enum value:</p><ul><li><code>Result::Ok<T></code> (atau <code>Ok<T></code>), digunakan untuk menandai bahwa data isinya adalah kabar baik (oke / mantab / jos / sukses).</li><li><code>Result::Err<E></code> (atau <code>Err<E></code>), digunakan untuk menandai bawah data berisi kabar buruk (error).</li></ul><blockquote><ul><li><code>T</code> dan <code>E</code> merupakan parameter generic. Lebih jelasnya mengenai generic dibahas pada chapter <a href="/basic/generics">Generics</a>.</li></ul></blockquote><p>Tipe data <code>Result</code> memiliki notasi penulisan <code>Result<T, E></code> yang mana <code>T</code> digunakan pada enum value <code>Ok<T></code> dan <code>E</code> digunakan enum value <code>Err<E></code>.</p><p>Cara penerapan tipe data ini bisa dilihat pada kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">enum</span><span class="token plain"> </span><span class="token type-definition class-name">MathError</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">DivisionByZero</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">InfinityNumber</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">OtherError</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">MathError</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">a</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">MathError</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">MathError</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">DivisionByZero</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">/</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>divider</code> di atas tugasnya adalah melakukan operasi aritmatika pembagian angka numerik <code>f64</code>, parameter <code>a</code> dibagi <code>b</code>.</p><p>Pada fungsi tersebut terdapat pengecekan apabila nilai <code>b</code> adalah <code>0</code>, maka yang dikembalikan adalah <code>Err<E></code> dengan <code>E</code> berisi pesan error, selainnya maka hasil operasi pembagian dikembalikan dibungkus dalam enum value <code>Ok<f64></code>.</p><p>Fungsi <code>divider</code> nilai baliknya bertipe <code>Result<f64, MathError></code>. Dari tipe data yang digunakan nantinya bisa diprediksi pasti akan ada 2 potensi value:</p><ul><li>Return value adalah enum value <code>Err<MathError></code>, muncul ketika nilai <code>b</code> adalah <code>0</code></li><li>Return value adalah nilai hasil numerik yang dibungkus oleh enum value <code>Ok<f64></code></li></ul><p>Output program di atas saat di-run:</p><p><img loading="eager" fetchpriority="high" alt="Result type" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcYAAABwCAIAAAAL5EeiAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5k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" width="454" height="112" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a402-pattern-matching-pada-tipe-result">A.40.2. Pattern matching pada tipe <code>Result</code><a class="hash-link" href="#a402-pattern-matching-pada-tipe-result" title="Direct link to heading">​</a></h2><p>Dalam penerapannya, ketika ada data bertipe <code>Result</code> artinya data tersebut berpotensi untuk berisi nilai <code>Err<E></code> atau <code>Ok<T></code>, pasti antara 2 nilai tersebut.</p><p>Umumnya penggunaan tipe <code>Result</code> selalu diikuti dengan pattern matching menggunakan keyword <code>match</code>. Selain itu keyword <code>if</code> sebenarnya juga bisa diterapkan pada pattern matching tipe data ini, namun kurang dianjurkan.</p><p>Mari kita praktikkan. Ubah isi fungsi <code>main</code> dengan kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Option type" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAABZCAIAAAAirLMmAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1w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1gy/90n7GMsV9I3ExUrV6qT/bfo8Qm7qpiD7WehtsbC8NP+Pf1nAXv/lYEzG6NEY78JkV0uGnk0Y35cwQVWUF3WN6VkB6VlfdkFEL+RmLa5vx5sR7CfIXli5vuH0Wt9+TNtiSvTSwBA5a6vp0m0/Bcxec0xOjFyhvPfS0qjD+qH11lfUJrrd9oakn3LYq0pIzuClTFDGql/OTdm1kuiBGz+ATXLueBTCKfs1oC71EEaNXK3dSvyBDwXR1vXRQ13MWRrtS4JLnFnqJIkYpiqIoYpSiKIoYpSiKIkYpiqKIUYqiKIoYpSiKIkYpiqKIUYqiKGKUoiiKIkYpiqK2j9G/vn3/r9W/X3klKIoiRmfA1MXo13//+/7tr9lsTsIZJs3IT1EUdXkYbU7WZ23OEj3N6f+7csek8CBFUVQBjLZoG0K1nnupgK476qDS46b90c4ZnPbEtZwI0UIihvcIyfYTPEiOUhRVDKMD1Aa+WKAamRNGl3qMRqPRohi1y+jbBg9yYk9RVDmMDogx5DPHLMr0DDIRpUefIhjNU2JO7kTXTfGnz/Agw1GKokpO6gM2urKXJZ0DS2MUoVyOrocbAzrIaJSiqKoYjVNmiAgXxahhaOoE3sKnKRIeZDBKUVQ1jKZjvgFLFp/aiC+KUWFvR7U2KjK0jZ3dDaT+o1PP4CBFUVQtjPoT+5FE4T77cPj7t68dN4NFgcTDmxqMDssJ/jpDgFGnFOswPEhRFDUboxRFURQxSlEURYxSFEURoxRFUcQoRVEURYxSFEURoxRFUcQoRVEUMUpRFEWMUhRFUcQoRVEUMUpRFEWMUhRFXZX+B8p6jhhWvr2eAAAAAElFTkSuQmCC" width="450" height="89" class="img_CujE"></p><p>Bisa dilihat pada kode di atas mudahnya pengambilan nilai <code>m</code> dari <code>Err(m)</code> dan juga <code>r</code> dari <code>Ok(r)</code>. Penerapan <code>match</code> untuk seleksi kondisi biasa disebut dengan <strong>pattern matching</strong> dan teknik ini sangat fleksibel dan advance.</p><p>Sebagai contoh, dengan penerapan match yang seperti ini kita bisa meng-handle 5 skenario seleksi kondisi:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">MathError</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">DivisionByZero</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! unable to divide number by 0"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">MathError</span><span class="token punctuation" style="color:#393A34">::</span><span class="token class-name">InfinityNumber</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! result is infinity number (∞)"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">_</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! unknown error"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"the result is 2"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {x:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Kondisi ke-1: jika nilai adalah <code>Err(MathError::DivisionByZero)</code>, maka munculkan pesan <code>ERROR! unable to divide number by 0</code>.</li><li>Kondisi ke-2: jika nilai adalah <code>Err(MathError::InfinityNumber)</code>, maka munculkan pesan <code>ERROR! result is infinity number (∞)</code>.</li><li>Kondisi ke-3: jika nilai adalah <code>Err</code> selain dari <code>Err(MathError::DivisionByZero)</code> dan <code>Err(MathError::InfinityNumber)</code>, maka munculkan pesan <code>ERROR! unknown error</code>.</li><li>Kondisi ke-4: jika nilai adalah <code>Ok(2.0)</code>, maka munculkan pesan <code>the result is 2</code>.</li><li>Kondisi ke-5: jika nilai adalah <code>Ok</code> selain dari <code>Ok(2.0)</code>, maka munculkan pesan <code>result: {x:.2}</code>.</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-tips-pattern-matching">◉ Tips pattern matching<a class="hash-link" href="#-tips-pattern-matching" title="Direct link to heading">​</a></h3><p>Silakan perhatikan kode yang sudah kita praktikkan berikut ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> result </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {r:.2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Penerapan pattern matching seperti contoh di atas memiliki konsekuensi, yaitu variabel <code>r</code> hanya bisa diakses pada block <code>Ok(r)</code> saja.</p><p>Adakalanya kita butuh untuk mengeluarkan variabel <code>r</code> ke luar block. Hal seperti ini mudah untuk dilakukan, dan ada beberapa cara yang bisa dipilih, namun menurut penulis yang paling elegan adalah cara berikut ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> r</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Statement <code>divider(10.0, 5.0)</code> mengembalikan data bertipe <code>Result<f64, MathError></code>. Data tersebut digunakan pada keyword <code>match</code> seperti biasa. Namun pada contoh di atas ada yang berbeda, yaitu return value dari statement <code>match</code> ditampung ke variabel (<code>result</code>).</p><p>Isi dari pattern matching <code>match</code> sendiri ada dua:</p><ul><li>Ketika block <code>Err(m)</code> match, error di-print kemudian nilai <code>0.0</code> dijadikan return statement <code>match</code>.</li><li>Ketika block <code>Ok</code> match, data <code>r</code> dijadikan return value statement <code>match</code>.</li></ul><p>Dengan penerapan pattern matching seperti di atas, maka variabel <code>result</code> akan selalu berisi data hasil operasi <code>divider(10.0, 5.0)</code>. Dengan pengecualian ketika ada error, pesan errornya dimunculkan kemudian hasil operasi pembagian di-set sebagai <code>0.0</code>.</p><blockquote><p>Lebih jelasnya mengenai pattern matching dibahas pada chapter <a href="/basic/pattern-matching">Pattern Matching</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a403-method-tipe-data-result">A.40.3. Method tipe data <code>Result</code><a class="hash-link" href="#a403-method-tipe-data-result" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-is_ok--unwrap">◉ Method <code>is_ok</code> & <code>unwrap</code><a class="hash-link" href="#-method-is_ok--unwrap" title="Direct link to heading">​</a></h3><p>Isi dari enum value <code>Ok<T></code> bisa diakses tanpa menggunakan keyword <code>match</code> dengan cara memanfaatkan method <code>unwrap</code> milik <code>Result<T, E></code>. Sebelum mengakses method tersebut sangat dianjurkan untuk mengecek apakah data berisi <code>Ok<T> atau tidak</code>, karena jika data adalah <code>Err<E></code> pengaksesan method <code>unwrap</code> menghasilkan error.</p><p>Pengecekan nilai ok atau tidak bisa dilakukan menggunakan method <code>is_ok</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// result: 2</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Result type" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAABYCAIAAADqR26rAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF5WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvc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TAjxTnDtpTYRcdc/zLcNIT+8hcY+/aXMn3Gor0LBR7BmZIc9DTpLEiX/20PfaNmM+8NsDS7LbBCXiLZMWt5Nxt7GWQIHfQGgq76DL0lPvID85jKSnSs+DMvfcqnpeenmfdWHrOaV4b/NfstsEg9lLFnriVbOtn9NN30XUMhV10OXpG+mjXM56uA6TnTPREcahlWjwBPU2OA+JN/6u0nHlt8F2f2zZYhrdv0y3GpVYrtVc7HBBZU/cS0S5a7zaNXZzhZ/yDFe7CNp9LIj1nomfDO7P62f0MUW9anBmQqhyXWzqPCj8XNa8N0TSTbbC4bhmvTryVIHZh7vIe2ldxIz3pNi25OAPn3aCmrh22+RQ8QcGJO+l5OfLWOqulg/7H3ydXWTve6XYkNOWEO1FFarKAaTFFkZ5JOb8KV8ehM9JzATveqctZgJ7ol4G20EoU6XltcmfuM6ITzEnXCwV1OUfRs8kFLmduoZUo0pOiKIoiPSmKokhPiqIo0pOiKIr0pCiKIj0piqIo0pOiKIr0pCiKIj0piqJIT4qiKNKToiiKWiE9P//4+V+tf7+zAyiKIj3zGerS8/u///388Xk0kslkiqJIz4yLtaeerzICwhRFUWXoWROtC+xa3MFIzzrYHHUI6eHS/mifGVy2wmFOPFmlZ/hJUdTy9OxYVjHORHUWn7pjIJbU0zMae5KeFEVtlJ4d0gzwzDGLTi3zTPzoUasIPfPEiTtFUSuauQdIdGUvOToH5qYnIjhFUdSK6BknVBf/zUpPg06GnRRFrZae6QivWwztV0WbuDRKTyu1z+JkQEl0UhS1fnr6s/d+2TPcMe8O//zxvcFlMPOHu/Z5e+7dmoG/mEBRFLUMPSmKoijSk6IoivSkKIoiPSmKokhPiqIo0pOiKIoiPSmKokhPiqIo0pOiKIr0pCiKuhL9DzCR83RW6DQ7AAAAAElFTkSuQmCC" width="447" height="88" class="img_CujE"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-as_ref">◉ Method <code>as_ref</code><a class="hash-link" href="#-method-as_ref" title="Direct link to heading">​</a></h3><p>Method <code>as_ref</code> digunakan untuk mengakses reference <code>T</code> dan <code>E</code> pada <code>Result<T, E></code>. Method ini sering kali dibutuhkan untuk menghindari terjadinya <em>move semantics</em> pada owner data bertipe <code>Result<T, E></code>.</p><p>Method <code>as_ref</code> mengembalikan data dalam tipe <code>Result<&T, &E></code>. Jadi reference yang dipinjam bukan milik <code>Result</code>-nya melainkan milik <code>T</code> dan <code>E</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">MathError</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result_borrow</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token class-name">MathError</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_ref</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Lebih jelasnya mengenai <em>move semantics</em> dibahas pada chapter <a href="/basic/ownership#a334-copy-semantics-vs-move-semantics">Ownership</a></p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-is_err--err">◉ Method <code>is_err</code> & <code>err</code><a class="hash-link" href="#-method-is_err--err" title="Direct link to heading">​</a></h3><p>Method <code>err</code> mengembalikan data dalam tipe <code>Err<E></code>. Pada pengaksesan method ini, pastikan untuk mengecek apakah <code>Result</code> berisi data error atau ok dengan via method <code>is_err</code>. Selain itu, wajib untuk menggunakan method <code>as_ref</code> sebelum method <code>err</code> agar ownership data <code>Result</code> tidak berpindah (<em>move semantics</em>).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> err </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_ref</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> err</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"error: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// error: DivisionByZero</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-ok">◉ Method <code>ok</code><a class="hash-link" href="#-method-ok" title="Direct link to heading">​</a></h3><p>Aturan yang sama juga berlaku pada pengaksesan method <code>ok</code> yang mengembalikan data <code>Ok<T></code>. Method <code>as_ref</code> harus diakses terlebih dahulu sebelum memanggil method <code>ok</code> agar tidak terjadi <em>move semantics</em>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_ref</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// result: 2</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-unwrap_or_default">◉ Method <code>unwrap_or_default</code><a class="hash-link" href="#-method-unwrap_or_default" title="Direct link to heading">​</a></h3><p>Method <code>unwrap_or_default</code> milik <code>Result<T, E></code> mengembalikan nilai <code>T</code> ketika data berisi <code>Ok<T></code>, namun jika data berisi <code>Err<E></code> maka yang dikembalikan adalah <em>default value</em> dari tipe data <code>T</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or_default</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// result: 0</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-unwrap_or">◉ Method <code>unwrap_or</code><a class="hash-link" href="#-method-unwrap_or" title="Direct link to heading">​</a></h3><p>Method <code>unwrap_or</code> milik <code>Result<T, E></code> mengembalikan nilai <code>T</code> ketika data berisi <code>Ok<T></code>, namun jika data ternyata isinya adalah <code>Err<E></code> maka yang dikembalikan adalah argument pemanggilan method tersebut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// result: 0</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-unwrap_or_else">◉ Method <code>unwrap_or_else</code><a class="hash-link" href="#-method-unwrap_or_else" title="Direct link to heading">​</a></h3><p>Method ini mengembalikan nilai <code>T</code> ketika data berisi <code>Ok<T></code>, namun jika data isinya adalah <code>Err<E></code> maka yang dikembalikan adalah hasil eksekusi closure yang disisipkan saat memanggil method <code>unwrap_or_else</code>. Contoh pengaplikasiannya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap_or_else</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">_</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// result: 0</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Closure harus dalam notasi <code>FnOnce(E) -> T</code> yang mana <code>T</code> pada konteks ini adalah <code>f64</code>.</p><blockquote><p>Lebih jelasnya mengenai closure dibahas pada chapter <a href="/basic/closures">Closures</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a404-operator--pada-tipe-result">A.40.4. Operator <code>?</code> pada tipe <code>Result</code><a class="hash-link" href="#a404-operator--pada-tipe-result" title="Direct link to heading">​</a></h2><p>Tipe data <code>Result</code> bisa digunakan pada operator <code>?</code>. Penjelasannya ada di chapter terpisah di <a href="/basic/operator-tanda-tanya">Operator ?</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a405-error-handling">A.40.5. Error handling<a class="hash-link" href="#a405-error-handling" title="Direct link to heading">​</a></h2><p>Tipe data <code>Result<T, E></code> banyak digunakan pada fungsi-fungsi yang disediakan Rust standard library, selain itu tipe tersebut juga akan sering kita gunakan dalam <em>real life</em> project.</p><p>Tipe ini dimanfaatkan untuk error handling di Rust. Lebih jelasnya mengenai topik tersebut dibahas pada chapter <a href="/basic/recoverable-error-handling">Error ➜ Recoverable Error & Error Handling</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a406-tipe-result-e">A.40.6. Tipe <code>Result<(), E></code><a class="hash-link" href="#a406-tipe-result-e" title="Direct link to heading">​</a></h2><p>Di atas kita telah mempelajari dan mempraktekan fungsi <code>divider()</code> yang fungsi tersebut mengembalikan 2 informasi, yaitu:</p><ul><li><code>T</code> berisi nilai hasil pembagian</li><li><code>E</code> berisi error saat operasi pembagian</li></ul><p>Bentuk lain penerapan tipe data <code>Result</code> adalah dengan menggunakan notasi <code>Result<T, E></code> dengan <code>T</code> diisi tipe data <code>()</code>. Tipe ini cukup sering digunakan pada fungsi yang memiliki potensi error tapi kita hanya butuh informasi errornya saja tanpa nilai balik lainnya.</p><p>Sebagai contoh, pada kode berikut dibuat fungsi baru bernama <code>divide_and_print()</code>. Dalam fungsi tersebut, operasi pembagian dilakukan. Jika sukses, nilainya langsung di-print; jika error, nilai errornya dikembalikan. Dari sini terlihat bahwa kita tidak membutuhkan fungsi tersebut untuk mengembalikan informasi selain error.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">divide_and_print</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">a</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">MathError</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divider</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> res </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"ERROR! {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">m</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">divide_and_print</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">10.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada pemanggilan fungsi <code>Ok()</code> gunakan nilai <code>()</code> untuk memenuhi kriteria tipe data <code>Result<(), MathError></code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a407-tipe-resultt">A.40.7. Tipe <code>Result<T></code><a class="hash-link" href="#a407-tipe-resultt" title="Direct link to heading">​</a></h2><p>Notasi tipe data <code>Result</code> bawaan Rust Standard Library adalah <code>Result<T, E></code>. Namun, pada pengembangan software yang melibatkan banyak sekali library/dependency, adakalanya pembaca akan menemui notasi tipe data <code>Result<T></code>. Notasi tersebut dibuat oleh pengembang library/dependency untuk memperingkas tipe <code>Result<T, SomeErrorType></code>. Jadi tidak usah bingung.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/result_type" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../result_type</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/generics">Generics</a></li><li><a href="/basic/pattern-matching">Pattern Matching</a></li><li><a href="/basic/closures">Closures</a></li><li><a href="/basic/operator-tanda-tanya">Operator ?</a></li><li><a href="/basic/recoverable-error-handling">Error ➜ Recoverable Error & Error Handling</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html</a></li><li><a href="https://doc.rust-lang.org/std/result/index.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/result/index.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/option-type"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.39. Tipe Data ➜ Option</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/operator-tanda-tanya"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.41. Operator ?</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a401-konsep-result" class="table-of-contents__link toc-highlight">A.40.1. Konsep <code>Result</code></a></li><li><a href="#a402-pattern-matching-pada-tipe-result" class="table-of-contents__link toc-highlight">A.40.2. Pattern matching pada tipe <code>Result</code></a><ul><li><a href="#-tips-pattern-matching" class="table-of-contents__link toc-highlight">◉ Tips pattern matching</a></li></ul></li><li><a href="#a403-method-tipe-data-result" class="table-of-contents__link toc-highlight">A.40.3. Method tipe data <code>Result</code></a><ul><li><a href="#-method-is_ok--unwrap" class="table-of-contents__link toc-highlight">◉ Method <code>is_ok</code> & <code>unwrap</code></a></li><li><a href="#-method-as_ref" class="table-of-contents__link toc-highlight">◉ Method <code>as_ref</code></a></li><li><a href="#-method-is_err--err" class="table-of-contents__link toc-highlight">◉ Method <code>is_err</code> & <code>err</code></a></li><li><a href="#-method-ok" class="table-of-contents__link toc-highlight">◉ Method <code>ok</code></a></li><li><a href="#-method-unwrap_or_default" class="table-of-contents__link toc-highlight">◉ Method <code>unwrap_or_default</code></a></li><li><a href="#-method-unwrap_or" class="table-of-contents__link toc-highlight">◉ Method <code>unwrap_or</code></a></li><li><a href="#-method-unwrap_or_else" class="table-of-contents__link toc-highlight">◉ Method <code>unwrap_or_else</code></a></li></ul></li><li><a href="#a404-operator--pada-tipe-result" class="table-of-contents__link toc-highlight">A.40.4. Operator <code>?</code> pada tipe <code>Result</code></a></li><li><a href="#a405-error-handling" class="table-of-contents__link toc-highlight">A.40.5. Error handling</a></li><li><a href="#a406-tipe-result-e" class="table-of-contents__link toc-highlight">A.40.6. Tipe <code>Result<(), E></code></a></li><li><a href="#a407-tipe-resultt" class="table-of-contents__link toc-highlight">A.40.7. Tipe <code>Result<T></code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/seleksi-kondisi-if.html b/basic/seleksi-kondisi-if.html index f535fee3..db9bf22d 100644 --- a/basic/seleksi-kondisi-if.html +++ b/basic/seleksi-kondisi-if.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/seleksi-kondisi-if/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/seleksi-kondisi-if/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.9. Seleksi Kondisi ➜ if, else if, else","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/seleksi-kondisi-if/#webpage"},"wordCount":643,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/seleksi-kondisi-if/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/seleksi-kondisi-if/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/seleksi-kondisi-if","name":"A.9. Seleksi Kondisi ➜ if, else if, else","description":"Pada chapter ini kita akan bahas tentang penerapan if untuk kontrol alur program.","datePublished":"2024-08-01T10:17:30.530Z","dateModified":"2024-08-01T10:17:30.530Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/seleksi-kondisi-if/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/seleksi-kondisi-if"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/seleksi-kondisi-if/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.9. Seleksi Kondisi ➜ if, else if, else","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/seleksi-kondisi-if/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/seleksi-kondisi-if/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.9. Seleksi Kondisi ➜ if, else if, else","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/seleksi-kondisi-if/#webpage"},"wordCount":643,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/seleksi-kondisi-if/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/seleksi-kondisi-if/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/seleksi-kondisi-if","name":"A.9. Seleksi Kondisi ➜ if, else if, else","description":"Pada chapter ini kita akan bahas tentang penerapan if untuk kontrol alur program.","datePublished":"2024-08-30T07:44:50.596Z","dateModified":"2024-08-30T07:44:50.596Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/seleksi-kondisi-if/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/seleksi-kondisi-if"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/seleksi-kondisi-if/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.9. Seleksi Kondisi ➜ if, else if, else","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.9. Seleksi Kondisi ➜ if, else if, else</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.9. Seleksi Kondisi ➜ if, else if, else</h1></header><p>Pada chapter ini kita akan bahas tentang penerapan <code>if</code> untuk kontrol alur program.</p><p>Seleksi kondisi sendiri merupakan teknik untuk grouping blok kode yang eksekusinya tergantung hasil ekspresi seleksi kondisi. Analoginya mirip seperti fungsi rambu lalu lintas di jalan raya. Kapan kendaraan diperbolehkan melaju dan kapan harus berhenti diatur oleh rambu tersebut. Seleksi kondisi pada program juga kurang lebih sama, kapan sebuah blok kode akan dieksekusi dikontrol.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a91-keyword-if">A.9.1. Keyword <code>if</code><a class="hash-link" href="#a91-keyword-if" title="Direct link to heading">​</a></h2><p><code>if</code> adalah salah satu keyword untuk seleksi kondisi di Rust, penggunaannya sangat mudah, yaitu dengan cukup tulis keyword tersebut diikuti dengan data boolean (atau ekspresi logika yang hasilnya boolean), lalu diikuti blok kode. Notasi penulisan <code>if</code> seperti berikut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> operasiLogika </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// blok kode</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada notasi di atas, <code>operasiLogika</code> bisa diisi dengan variabel yang bertipe <code>bool</code>, atau statement ekspresi perbandingan seperti <code>a == b</code>. Lebih jelasnya sekarang silakan perhatikan dan coba kode berikut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number_a adalah di bawah 5"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result_a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34">>=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> result_a </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result_a adalah di atas atau sama dengan 5"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="seleksi kondisi" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb4AAABuCAIAAADXpuElAAAACXBIWXMAAA7EAAAOxAGVK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Z0WPZedHG71KTvtp87PzXczk8/mcHyjcA7t8od56Z3Z2dRy86Oen2upXC1ubjUEs7jzatHlRIlpAz1x/etq1PKU1XMQMvZ1hn4XHdfcz6zptD429r0Ukq5Pp6e7J8AgBATt7kWyUjiE+RGc51tvU+FGD9ahHKd5vNu6Pj1pi5335h3eyP7gVMsnmXMJJ65hQxXIdab+v921fX4f4N6ByaofDwzc6k+XTUwPrDJ5vNLaDBPUE4mWHolAq5vg4A6CxbUP/Hxf2tTRnUrfqjHQhZ/p7vmVNFKuT6+mPU+s6bw80b0v1CUW++KNTvr+tF1pljsvOi/UAe/3KCOJ+Mua+zeHUdwIgkubBzDdYf3i732y9g50W7b87cjc3hG3O950GYde+ZO28OjaEvwPrDJ8ZyyaRp8sO2HojlOrb1q1eh/WKnrRdv1Au5wzeT5tNt/IGc6/yTupwE4WKMXufOo+9vP9ncbDY3oa8+U/t3C0Fnjwbno2XeR/fg4ZPN0ZA94iaYx0319qaZZkdV++wOEXrm481nN5rGwc6zLfX2A+aZzhHv3WbzrtFX5raOZwmzjhpqA+K6Hcx6W+/flSV16xHsQPvBptxXm4wz+XFmqW91XgmCsKGPCRMEQUSG3mEnCIKITGLfJhrt3HZD+7gJgkgANGAnCIKIDA3YCYIgIkOhkyAIIjIUOgmCICJDoZMgCCIyFDoJgiAiQ6GTIAgiMhQ6CYIgIkOhkyAIIjIUOgmCICLz/6KI27Pi1qiTAAAAAElFTkSuQmCC" width="446" height="110" class="img_ev3q"></p><p>Pada kode di atas ada dua buah blok kode <code>if</code>. Yang pertama mengecek hasil ekspresi logika <code>apakah variabel number_a di bawah 5?</code>. Jika hasilnya benar atau <code>true</code> maka blok kode setelahnya yang diapit tanda kurung kurawal akan dieksekusi, hasilnya menampilkan tulisan <code>angka adalah di bawah 5</code>.</p><p>Blok kode <code>if</code> kedua adalah mengecek nilai <code>bool</code> variabel <code>result_a</code>. Variabel <code>result_a</code> sendiri isinya berasal dari ekspresi logika <code>apakah variabel number_a lebih besar atau sama dengan 5?</code>. Jika hasilnya <code>true</code> maka blok kode setelahnya (yang diapit tanda kurung kurawal) dieksekusi. Namun, pada contoh di atas, hasilnya adalah <code>false</code>, karena variabel <code>number_a</code> nilainya adalah tidak lebih besar atau sama dengan 5, dengan demikian blok kode tidak dieksekusi.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a92-keyword-if-else-if-dan-else">A.9.2. Keyword <code>if</code>, <code>else if</code>, dan <code>else</code><a class="hash-link" href="#a92-keyword-if-else-if-dan-else" title="Direct link to heading">​</a></h2><p>Jika seleksi kondisi lebih dari satu, gunakan <code>if</code> dan <code>else if</code> dan/atau <code>else</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_b </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number_b adalah 2"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_b </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number_b adalah di bawah 2"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number_b adalah di atas 2"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, <code>number_b</code> yang nilainya <code>3</code>, match dengan statement seleksi kondisi <code>else</code>, dengan ini maka statement dalam blok kode tersebut dieksekusi, text <code>number_b adalah di atas 2</code> muncul.</p><p><img loading="lazy" alt="seleksi kondisi" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAABgCAIAAAACbutrAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMDktMjRUMTE6MzA6MTgrMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyLTA5LTI3VDE3OjExOjMwKzA3OjAwIiB4bXA6T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war2+ao2YsZT8oNaTGfJ4H9gp/ZP5qBn5HVUuAIDsbOOnaQ+CeCGhb2oSBEGkgd5zJwiCSMPUvms0ePjcD71LSBDEdEAzd4IgiDTQzJ0gCCINFD0JgiDSQNGTIAgiDRQ9CYIg0kDRkyAIIg0UPQmCINJA0ZMgCCINFD0JgiDSQNGTIAgiDRQ9CYIg0vD/CpKDd2dj8oMAAAAASUVORK5CYII=" width="447" height="96" class="img_ev3q"></p><p>Silakan bermain dengan nilai variabel <code>number_b</code> untuk coba-coba.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a93-nested-if">A.9.3. Nested <code>if</code><a class="hash-link" href="#a93-nested-if" title="Direct link to heading">​</a></h2><p>Sebuah blok kode <code>if</code> bisa saja berada di dalam sebuah <code>if</code>, dan seperti ini umum terjadi di bahasa pemrograman. Di Rust penerapan nested <code>if</code> sama seperti pada bahasa lainnya, yaitu dengan langsung tuliskan saja blok kode <code>if</code> ke dalam blok kode <code>if</code>. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_c </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_c </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"selamat, anda lulus"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_c </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"dengan nilai sempurna"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_c </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">7</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"dengan nilai baik"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"dengan nilai cukup"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"anda tidak lulus"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_c </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"belajar lagi ya"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"jangan malas belajar!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="nested if" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcAAAACACAIAAAATaC78AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNv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i5tCjnARBEBGhAEoQBBERCqAEQRARoQBKEAQRkRABNPHSnFt7zt31+nb7er1e59r27z6dIAjCn6vcAyX1YoIgYuUS7gNlYj47PpvTCYL46AglqIwpDbdHwqCoULG+632Evv2dX+cYLQ+SMsy7hhCZ5Iin+yhMY7rR8qMXWOFxQWVdCPVbeKzn296Xt59wqEHT8wUEMUUChvCG0rAsy7K83/Ye3FMLG+a0YUbaXu/t6YPm0vrOGgBs7W2U2vuyOZDWhTgNoWL9KEiP2aczQFLyj9ZR62FOfzxyiGzGWtwhJSn3Qt5vZ6QN/a/oLLy83w7QZMlI29u5F6N6surO8CdBELHjG0BxpWFEUFn/wi1UDFv3S9D+pyn/0Tc0h3h1jtnwp/QyAZlkDoVpAFw32lZ4ePLPNhRu+xnqq3vbT0YFdZ5uFX72ws8E8bESfg40hKByq9cH6f4WwBNYWxcz/dYLQx1uhkLFY1ofV2HahRkWUUx/ATR3HzUBgNG1nK0/CeIjJtoiknemEL23mz+fbEtmbOmre7tNmLVQ8QSscylMb+1x5dXvhTbvZvbCzwTx0eI7hEeVhvkFlfUZAHO+0L62MaZQ8ZhMyHpEhWmTrb2NUr/1Qv/AL72MMlt/EsRHi38PFFUabqKCygjN3Rdy3T627at7j3b5hYr5QYWKW9waz7jOcZAhX4Xpn5llHY32RwvmmKAyP3H4kyAILuKUs3O9DX1t5+m22Pqod9n4vh+eIIjLRpxPIok5+3hybV3MmGNNgiCIK0CcTyLZJgAAgPtdngRBEJcDUqQnCIKIyFUWEyEIgogVCqAEQRARoQBKEAQREQqgBEEQEaEAShAEEREKoARBEBGhAEoQBBERCqAEQRARoQBKEAQREQqgBEEQEfl/XQuIt8nZYZAAAAAASUVORK5CYII=" width="448" height="128" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a94-returning-from-if">A.9.4. Returning From <code>if</code><a class="hash-link" href="#a94-returning-from-if" title="Direct link to heading">​</a></h2><p><em>Returning from <code>if</code></em> adalah salah satu cara unik penerapan <code>if</code>. Yang biasanya <code>if</code> digunakan untuk eksekusi statements dengan kondisi tertentu, pada case ini statement yang ada pada blok kode if ditampung sebagai <em>return value</em> atau nilai balik. Teknik ini mirip seperti operasi <em>ternary</em> hanya saja jumlah kondisinya bisa sebanyak yang kita inginkan.</p><p>Agar lebih jelas, silakan pelajari dulu kode berikut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result_d</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_d </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> result_d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> result_d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result_d adalah {result_d}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Blok seleksi kondisi pada contoh di atas menjadi penentu nilai variabel <code>result_d</code>. Dengan kebutuhan tersebut, kita bisa juga memanfaatkan <code>let if</code> untuk mendapatkan hasil yang ekuivalen.</p><blockquote><p>Pada kode di atas, deklarasi variabel <code>result_d</code> dan pengisian nilainya adalah ditulis dalam statement terpisah. Cara ini diperbolehkan pada variable immutable (tanpa perlu membuatnya mutable) selama operasi assignment hanya dilakukan sekali saja setelah deklarasi.</p><p>Lebih detailnya dibahas pada chapter <a href="/basic/variabel#a45-deklarasi-variabel-tanpa-predefined-value">Variabel section A.4.5</a>.</p></blockquote><p>Kode di atas jika diubah ke bentuk <code>let if</code> hasilnya menjadi seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result_d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_d </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result_d adalah {result_d}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Penulisannya cukup unik. Blok kode seleksi kondisi dituliskan sebagai value dari statement <code>let result_d</code>. Dan isi blok kode nantinya akan menjadi value untuk variabel <code>result_d</code>, tergantung kondisi mana yang match.</p><p>Pada contoh di atas, karena <code>number_d</code> nilainya 3, maka <code>result_d</code> bernilai false. Blok kode <code>else</code> adalah yang dieksekusi.</p><p><img loading="lazy" alt="seleksi kondisi" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAABwCAIAAAABuOnwAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM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q"></p><blockquote><p>Dalam penggunakan kombinasi keyword <code>let</code> dan <code>if</code>, pastikan di akhir blok kode seleksi kondisi dituliskan tanda <code>;</code>.</p></blockquote><p>O iya, beberapa orang lebih memilih memanfaatkan indentasi untuk mempermudah memahami statement <code>let if</code>. Contohnya seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result_d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_d </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result_d adalah {result_d}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a95-kombinasi-keyword-let-dan-if-dengan-tipe-data-eksplisit">A.9.5. Kombinasi Keyword <code>let</code> dan <code>if</code>, Dengan Tipe Data Eksplisit<a class="hash-link" href="#a95-kombinasi-keyword-let-dan-if-dengan-tipe-data-eksplisit" title="Direct link to heading">​</a></h2><p>Ada situasi di mana dalam pemanfaatan <code>let if</code> kita perlu men-specify secara eksplisit tipe data variabel penampung. Caranya sama seperti statement deklarasi variabel beserta tipe data, langsung tulis saja tipe data yang diinginkan setelah nama variabel dan sebelum operator <code>=</code>.</p><p>Pada contoh berikut, variabel <code>result_e</code> saya definisikan tipenya adalah <code>string literal &str</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_e </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result_e</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_e </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"angka adalah 2"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_e </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"angka adalah di bawah 2"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"angka adalah di atas 2"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"angka adalah {result_e}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh lain:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100.0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> string_f </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"nilai minimum kelulusan"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result_f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> string_f </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"nilai maksimum kelulusan"</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> max</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> max </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">/</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4.0</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"angka adalah {result_f}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="seleksi kondisi" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAABeCAIAAAA/qYOeAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMDktMjRUMTI6MDc6MzArMDc6MDAiIHhtcDpNb2Rp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F04JUP7TW1ZBmHy4nYnOGDm0Pe2j1clkfXbpjFC+4JssRqqT7FEwC7IEasFuRkJaZNvOQhBk/8C2qPdsqpRp5Uq1OkinFgDegtkzYqJeumjcM4SEJAlQVy86pm2sde51yaA6zgj10rLlk+OW6ezSymJhGXCPCUEOAiyz0YXlRQnUZWsNXKeXXPt6E0CYKxQKhUUJ1Dfbq926urysgrTYnqSx17m3JQNYkKUEZUG/drHUXZ0Igtx9sD43uvm1ua/zhvtRHxfGWls28WzwrJ1//UJZmHM84clUJ7Hk2tebIJxaMI6tOLe0uq8zJLNLZ4S6c0Hv+uwNKWHe3EAQZL/Dsqh/q6CeWZwrFOYAoKyqdSlJKbh2/qJcMAsCgPU8pV3R4vLDK4uLhZUzy6+z1km2/tbihVOmpfKFZfXMG9SSztX7XKEwZ+zAM1unYCTKC+cpNynq6rKM+04IckDo6U/azS6tLCYvtu8Izi6tLIolfJISQZB9TU9fBhWTzuXx7BkxYS2dEQRB9is9/oFl98P3+D4kgiD7H/ydegRBkEigUB6CIEgkMI0iCIJEAtMogiBIJEKm0VhsZCTGAQBw7X/1FC4W60OtEeA4LoKfHBeLcUPlD4IgvSak3mir1TT/pbeazcCi3aG3WsP1y8S6rje7b5GuD5k7CIL0HFzUIwiCRALTKIIgSCQwjSIIgkTi/wH4l5+XTFlmAAAAAABJRU5ErkJggg==" width="450" height="94" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a96-keyword-if-let">A.9.6. Keyword <code>if let</code><a class="hash-link" href="#a96-keyword-if-let" title="Direct link to heading">​</a></h2><p>Keyword <code>if let</code> berbeda dengan kombinasi <code>let</code> dan <code>if</code>. Kita akan bahas topik ini secara terpisah pada chapter <a href="/basic/pattern-matching">Pattern Matching</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/seleksi_kondisi_if" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../seleksi_kondisi_if</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch03-05-control-flow.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch03-05-control-flow.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.if.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.if.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.else.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.else.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/flow_control/if_else.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/flow_control/if_else.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/operator"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.8. Operator</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/perulangan-while"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.10. Perulangan ➜ while</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a91-keyword-if" class="table-of-contents__link toc-highlight">A.9.1. Keyword <code>if</code></a></li><li><a href="#a92-keyword-if-else-if-dan-else" class="table-of-contents__link toc-highlight">A.9.2. Keyword <code>if</code>, <code>else if</code>, dan <code>else</code></a></li><li><a href="#a93-nested-if" class="table-of-contents__link toc-highlight">A.9.3. Nested <code>if</code></a></li><li><a href="#a94-returning-from-if" class="table-of-contents__link toc-highlight">A.9.4. Returning From <code>if</code></a></li><li><a href="#a95-kombinasi-keyword-let-dan-if-dengan-tipe-data-eksplisit" class="table-of-contents__link toc-highlight">A.9.5. Kombinasi Keyword <code>let</code> dan <code>if</code>, Dengan Tipe Data Eksplisit</a></li><li><a href="#a96-keyword-if-let" class="table-of-contents__link toc-highlight">A.9.6. Keyword <code>if let</code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.9. Seleksi Kondisi ➜ if, else if, else</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.9. Seleksi Kondisi ➜ if, else if, else</h1></header><p>Pada chapter ini kita akan bahas tentang penerapan <code>if</code> untuk kontrol alur program.</p><p>Seleksi kondisi sendiri merupakan teknik untuk grouping blok kode yang eksekusinya tergantung hasil ekspresi seleksi kondisi. Analoginya mirip seperti fungsi rambu lalu lintas di jalan raya. Kapan kendaraan diperbolehkan melaju dan kapan harus berhenti diatur oleh rambu tersebut. Seleksi kondisi pada program juga kurang lebih sama, kapan sebuah blok kode akan dieksekusi dikontrol.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a91-keyword-if">A.9.1. Keyword <code>if</code><a class="hash-link" href="#a91-keyword-if" title="Direct link to heading">​</a></h2><p><code>if</code> adalah salah satu keyword untuk seleksi kondisi di Rust, penggunaannya sangat mudah, yaitu dengan cukup tulis keyword tersebut diikuti dengan data boolean (atau ekspresi logika yang hasilnya boolean), lalu diikuti blok kode. Notasi penulisan <code>if</code> seperti berikut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> operasiLogika </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// blok kode</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada notasi di atas, <code>operasiLogika</code> bisa diisi dengan variabel yang bertipe <code>bool</code>, atau statement ekspresi perbandingan seperti <code>a == b</code>. Lebih jelasnya sekarang silakan perhatikan dan coba kode berikut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number_a adalah di bawah 5"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result_a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number_a </span><span class="token operator" style="color:#393A34">>=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> result_a </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result_a adalah di atas atau sama dengan 5"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="seleksi kondisi" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb4AAABuCAIAAADXpuElAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvI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ZA94iaYx0319qaZZkdV++wOEXrm481nN5rGwc6zLfX2A+aZzhHv3WbzrtFX5raOZwmzjhpqA+K6Hcx6W+/flSV16xHsQPvBptxXm4wz+XFmqW91XgmCsKGPCRMEQUSG3mEnCIKITGLfJhrt3HZD+7gJgkgANGAnCIKIDA3YCYIgIkOhkyAIIjIUOgmCICJDoZMgCCIyFDoJgiAiQ6GTIAgiMhQ6CYIgIkOhkyAIIjIUOgmCICLz/6KI27Pi1qiTAAAAAElFTkSuQmCC" width="446" height="110" class="img_CujE"></p><p>Pada kode di atas ada dua buah blok kode <code>if</code>. Yang pertama mengecek hasil ekspresi logika <code>apakah variabel number_a di bawah 5?</code>. Jika hasilnya benar atau <code>true</code> maka blok kode setelahnya yang diapit tanda kurung kurawal akan dieksekusi, hasilnya menampilkan tulisan <code>angka adalah di bawah 5</code>.</p><p>Blok kode <code>if</code> kedua adalah mengecek nilai <code>bool</code> variabel <code>result_a</code>. Variabel <code>result_a</code> sendiri isinya berasal dari ekspresi logika <code>apakah variabel number_a lebih besar atau sama dengan 5?</code>. Jika hasilnya <code>true</code> maka blok kode setelahnya (yang diapit tanda kurung kurawal) dieksekusi. Namun, pada contoh di atas, hasilnya adalah <code>false</code>, karena variabel <code>number_a</code> nilainya adalah tidak lebih besar atau sama dengan 5, dengan demikian blok kode tidak dieksekusi.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a92-keyword-if-else-if-dan-else">A.9.2. Keyword <code>if</code>, <code>else if</code>, dan <code>else</code><a class="hash-link" href="#a92-keyword-if-else-if-dan-else" title="Direct link to heading">​</a></h2><p>Jika seleksi kondisi lebih dari satu, gunakan <code>if</code> dan <code>else if</code> dan/atau <code>else</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_b </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number_b adalah 2"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_b </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number_b adalah di bawah 2"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number_b adalah di atas 2"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, <code>number_b</code> yang nilainya <code>3</code>, match dengan statement seleksi kondisi <code>else</code>, dengan ini maka statement dalam blok kode tersebut dieksekusi, text <code>number_b adalah di atas 2</code> muncul.</p><p><img loading="lazy" alt="seleksi kondisi" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAABgCAIAAAACbutrAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+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PUWKKTtqfX/z9vvvv/+Pn33jHcCGDe1v3rbO6upb1g9WSESLtLJxd2BIpek4QYyB+OU6Y9cazOzfb3YLRYmZrqvXt73/Bk6H7c8NEK8D3LkuGrv25by/ed8oSLdWnBy21rc5LAXzZIXP/c11ZwzpZLmyccu1HpmSP09fkSJPZ1hPZChBSrZnUO5srYqBxiMIgs0E1z2bnS4UYeXKPIir9frq4Lgzee427ztBwJ1NcuXJwjdLBjCYCceSckiGK9L+5m1pq275OWYpwsljVTR2VVrzJAheJhg9pWKh2wEAdBkuYqQZm2cT/+3O1roMurUhYq3PsnIZR8ohGUGRttfVbStBfX1nAyIC6MrGzroM9sifIAg+Uj7vOX9lBcC6cjk/sr6ycUvsNu/D/v1mN2qxMgl2nhHDpaPf2Tsod61y7v/uyJnQrmzsWLs8eEr+PPlhW+c31Ox03bUOriI1O90oK07opK12gkhGirHn/uaHt3bW1+v1dejqu3p3tRiVejBLH8wfN2/Dxs76YO7OM6+MzRNju67fWrdTGrrelYsAsL2+e92e0Bq7W/qtu8yU3vnwar2+ao2YsZT8oNaTGfJ4H9gp/ZP5qBn5HVUuAIDsbOOnaQ+CeCGhb2oSBEGkgd5zJwiCSMPUvms0ePjcD71LSBDEdEAzd4IgiDTQzJ0gCCINFD0JgiDSQNGTIAgiDRQ9CYIg0kDRkyAIIg0UPQmCINJA0ZMgCCINFD0JgiDSQNGTIAgiDRQ9CYIg0vD/CpKDd2dj8oMAAAAASUVORK5CYII=" width="447" height="96" class="img_CujE"></p><p>Silakan bermain dengan nilai variabel <code>number_b</code> untuk coba-coba.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a93-nested-if">A.9.3. Nested <code>if</code><a class="hash-link" href="#a93-nested-if" title="Direct link to heading">​</a></h2><p>Sebuah blok kode <code>if</code> bisa saja berada di dalam sebuah <code>if</code>, dan seperti ini umum terjadi di bahasa pemrograman. Di Rust penerapan nested <code>if</code> sama seperti pada bahasa lainnya, yaitu dengan langsung tuliskan saja blok kode <code>if</code> ke dalam blok kode <code>if</code>. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_c </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_c </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"selamat, anda lulus"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_c </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"dengan nilai sempurna"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_c </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">7</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"dengan nilai baik"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"dengan nilai cukup"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"anda tidak lulus"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_c </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"belajar lagi ya"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"jangan malas belajar!"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="nested if" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcAAAACACAIAAAATaC78AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMDktMjVUMjM6Mzc6NTIrMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyLTA5LTI3VDE3OjEwOjM2KzA3OjAwIiB4bXA6TWV0YWRhdGFEYXRlPSIyMD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/CeIjJtoiknemEL23mz+fbEtmbOmre7tNmLVQ8QSscylMb+1x5dXvhTbvZvbCzwTx0eI7hEeVhvkFlfUZAHO+0L62MaZQ8ZhMyHpEhWmTrb2NUr/1Qv/AL72MMlt/EsRHi38PFFUabqKCygjN3Rdy3T627at7j3b5hYr5QYWKW9waz7jOcZAhX4Xpn5llHY32RwvmmKAyP3H4kyAILuKUs3O9DX1t5+m22Pqod9n4vh+eIIjLRpxPIok5+3hybV3MmGNNgiCIK0CcTyLZJgAAgPtdngRBEJcDUqQnCIKIyFUWEyEIgogVCqAEQRARoQBKEAQREQqgBEEQEaEAShAEEREKoARBEBGhAEoQBBERCqAEQRARoQBKEAQREQqgBEEQEfl/XQuIt8nZYZAAAAAASUVORK5CYII=" width="448" height="128" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a94-returning-from-if">A.9.4. Returning From <code>if</code><a class="hash-link" href="#a94-returning-from-if" title="Direct link to heading">​</a></h2><p><em>Returning from <code>if</code></em> adalah salah satu cara unik penerapan <code>if</code>. Yang biasanya <code>if</code> digunakan untuk eksekusi statements dengan kondisi tertentu, pada case ini statement yang ada pada blok kode if ditampung sebagai <em>return value</em> atau nilai balik. Teknik ini mirip seperti operasi <em>ternary</em> hanya saja jumlah kondisinya bisa sebanyak yang kita inginkan.</p><p>Agar lebih jelas, silakan pelajari dulu kode berikut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result_d</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_d </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> result_d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> result_d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result_d adalah {result_d}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Blok seleksi kondisi pada contoh di atas menjadi penentu nilai variabel <code>result_d</code>. Dengan kebutuhan tersebut, kita bisa juga memanfaatkan <code>let if</code> untuk mendapatkan hasil yang ekuivalen.</p><blockquote><p>Pada kode di atas, deklarasi variabel <code>result_d</code> dan pengisian nilainya adalah ditulis dalam statement terpisah. Cara ini diperbolehkan pada variable immutable (tanpa perlu membuatnya mutable) selama operasi assignment hanya dilakukan sekali saja setelah deklarasi.</p><p>Lebih detailnya dibahas pada chapter <a href="/basic/variabel#a45-deklarasi-variabel-tanpa-predefined-value">Variabel section A.4.5</a>.</p></blockquote><p>Kode di atas jika diubah ke bentuk <code>let if</code> hasilnya menjadi seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result_d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_d </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result_d adalah {result_d}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Penulisannya cukup unik. Blok kode seleksi kondisi dituliskan sebagai value dari statement <code>let result_d</code>. Dan isi blok kode nantinya akan menjadi value untuk variabel <code>result_d</code>, tergantung kondisi mana yang match.</p><p>Pada contoh di atas, karena <code>number_d</code> nilainya 3, maka <code>result_d</code> bernilai false. Blok kode <code>else</code> adalah yang dieks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VD1H8u7Tf14wOxzZjjm6AA+A9U4UvLDnSfi5K0baHMQBBE30dbc8adr3+3UvwMAeLjb3HnyCL55PFnRJuXh7o4M6m798T4ELF7HkTKOcgJ4nfwC6GEnQcyF8Gvu+y/aA+nBrs8cvd0fWH8Ub2wB6CEi4IPC7f4geNa5/8uJOXfdevTE2DTJ5uQXY6HoW906+3R3Sv48p0H4PE0nBzcHQRCxEGHsuf/4G3j0ZGc8WRyou988Bsfks/NMH0k9/vu9Jzs7zeYODNRn6uBBAZzT1AfN5oPxyGnfSu0znPpu59ltY+7aebar3vuWWc7vmuq9HWNO21HVgVxgnY6mxMuJpZwQfutt3MlIcyTgsQlBfOjQV+EIgiCiQLvlCYIgopDY77lbr4I7oAUSgiCSAc3cCYIgokAzd4IgiChQ9CQIgogCRU+CIIgoUPQkCIKIAkVPgiCIKFD0JAiCiAJFT4IgiChQ9CQIgogCRU+CIIgoUPQkCIKIAkVPgiCIKFD0JAiCiML/A7RwS69eEQTBAAAAAElFTkSuQmCC" width="447" height="112" class="img_CujE"></p><blockquote><p>Dalam penggunakan kombinasi keyword <code>let</code> dan <code>if</code>, pastikan di akhir blok kode seleksi kondisi dituliskan tanda <code>;</code>.</p></blockquote><p>O iya, beberapa orang lebih memilih memanfaatkan indentasi untuk mempermudah memahami statement <code>let if</code>. Contohnya seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result_d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_d </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result_d adalah {result_d}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a95-kombinasi-keyword-let-dan-if-dengan-tipe-data-eksplisit">A.9.5. Kombinasi Keyword <code>let</code> dan <code>if</code>, Dengan Tipe Data Eksplisit<a class="hash-link" href="#a95-kombinasi-keyword-let-dan-if-dengan-tipe-data-eksplisit" title="Direct link to heading">​</a></h2><p>Ada situasi di mana dalam pemanfaatan <code>let if</code> kita perlu men-specify secara eksplisit tipe data variabel penampung. Caranya sama seperti statement deklarasi variabel beserta tipe data, langsung tulis saja tipe data yang diinginkan setelah nama variabel dan sebelum operator <code>=</code>.</p><p>Pada contoh berikut, variabel <code>result_e</code> saya definisikan tipenya adalah <code>string literal &str</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_e </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result_e</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_e </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"angka adalah 2"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> number_e </span><span class="token operator" style="color:#393A34"><</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"angka adalah di bawah 2"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"angka adalah di atas 2"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"angka adalah {result_e}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh lain:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100.0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> string_f </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"nilai minimum kelulusan"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result_f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> string_f </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"nilai maksimum kelulusan"</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> max</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> max </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">/</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4.0</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"angka adalah {result_f}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="seleksi kondisi" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAABeCAIAAAA/qYOeAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cD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kxYS2dEQRB9is9/oFl98P3+D4kgiD7H/ydegRBkEigUB6CIEgkMI0iCIJEAtMogiBIJEKm0VhsZCTGAQBw7X/1FC4W60OtEeA4LoKfHBeLcUPlD4IgvSak3mir1TT/pbeazcCi3aG3WsP1y8S6rje7b5GuD5k7CIL0HFzUIwiCRALTKIIgSCQwjSIIgkTi/wH4l5+XTFlmAAAAAABJRU5ErkJggg==" width="450" height="94" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a96-keyword-if-let">A.9.6. Keyword <code>if let</code><a class="hash-link" href="#a96-keyword-if-let" title="Direct link to heading">​</a></h2><p>Keyword <code>if let</code> berbeda dengan kombinasi <code>let</code> dan <code>if</code>. Kita akan bahas topik ini secara terpisah pada chapter <a href="/basic/pattern-matching">Pattern Matching</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/seleksi_kondisi_if" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../seleksi_kondisi_if</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch03-05-control-flow.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch03-05-control-flow.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.if.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.if.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.else.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.else.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/flow_control/if_else.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/flow_control/if_else.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/operator"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.8. Operator</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/perulangan-while"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.10. Perulangan ➜ while</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a91-keyword-if" class="table-of-contents__link toc-highlight">A.9.1. Keyword <code>if</code></a></li><li><a href="#a92-keyword-if-else-if-dan-else" class="table-of-contents__link toc-highlight">A.9.2. Keyword <code>if</code>, <code>else if</code>, dan <code>else</code></a></li><li><a href="#a93-nested-if" class="table-of-contents__link toc-highlight">A.9.3. Nested <code>if</code></a></li><li><a href="#a94-returning-from-if" class="table-of-contents__link toc-highlight">A.9.4. Returning From <code>if</code></a></li><li><a href="#a95-kombinasi-keyword-let-dan-if-dengan-tipe-data-eksplisit" class="table-of-contents__link toc-highlight">A.9.5. Kombinasi Keyword <code>let</code> dan <code>if</code>, Dengan Tipe Data Eksplisit</a></li><li><a href="#a96-keyword-if-let" class="table-of-contents__link toc-highlight">A.9.6. Keyword <code>if let</code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/shadowing.html b/basic/shadowing.html index e1308a5a..413664b2 100644 --- a/basic/shadowing.html +++ b/basic/shadowing.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/shadowing/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/shadowing/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.31. Shadowing","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/shadowing/#webpage"},"wordCount":487,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/shadowing/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/shadowing/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/shadowing","name":"A.31. Shadowing","description":"Pada chapter ini kita akan belajar tentang shadowing pada variable dan apa perbedaannya dibanding variable mutable.","datePublished":"2024-08-01T10:17:30.565Z","dateModified":"2024-08-01T10:17:30.565Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/shadowing/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/shadowing"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/shadowing/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.31. Shadowing","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/shadowing/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/shadowing/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.31. Shadowing","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/shadowing/#webpage"},"wordCount":487,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/shadowing/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/shadowing/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/shadowing","name":"A.31. Shadowing","description":"Pada chapter ini kita akan belajar tentang shadowing pada variable dan apa perbedaannya dibanding variable mutable.","datePublished":"2024-08-30T07:44:50.631Z","dateModified":"2024-08-30T07:44:50.631Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/shadowing/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/shadowing"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/shadowing/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.31. Shadowing","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.31. Shadowing</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.31. Shadowing</h1></header><p>Pada chapter ini kita akan belajar tentang shadowing pada variable dan apa perbedaannya dibanding variable mutable.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a311-konsep-variable-shadowing">A.31.1 Konsep variable shadowing<a class="hash-link" href="#a311-konsep-variable-shadowing" title="Direct link to heading">​</a></h2><p>Variable shadowing adalah istilah untuk variable yang dideklarasikan dalam sebuah block, yang variabel tersebut memiliki nama sama persis dengan variable pendahulunya (baik dalam scope yang sama ataupun variable lain yang berada di luar current scope).</p><p>Penulis tekankan di sini, meskipun namanya sama, variabel-variabel tersebut dianggap variabel yang benar-benar berbeda oleh Rust, tipe datanya bisa jadi juga berbeda.</p><p>Ciri khas variable shadowing adalah deklarasi selalu menggunakan keyword <code>let</code>. Contoh penerapannya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> some_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Hello"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> some_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => Hello</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> some_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> some_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => 12</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> some_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Rust!"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> some_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => Rust!</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> some_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> some_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> some_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => true</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> some_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> some_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => 3.14</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Shadowing" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAACjCAIAAABuRXKuAAA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x+tLNUbiTljxkT8t3AoA23QrAADgVgAA3AoAgFsBAAC3AgDgVgAA3AoAALgVAGBpbuWhVQAA3AoAsGy3WuHWpW3rTxOhrsYDrwAA1K1R3VplCYrwQcutTXgWL3EBANza7lY/Kdtwq5/RSucCAODWtFsjSWpujfsUcCsA4NYx3EonKwDgVo24o9RyaxSYbb1DCwBg826Nr/XrHadKYPZVcK8BXQIAgFsBAAC3AgDgVgAA3AoAALgVAAC3AgDgVgAAwK0AAEtzaxV5lZsR6EaPnxAoHyDgyQEAwK1Xih+TdnR5gq/KWC5W4I0QLADArbo7E3Z8eXMfxgauhhAwCAC4tbNareq2/hu3AgBuDWyZ/06WwK2NUXErAODWnJK0fSTpU9wKALjV9GZb7SrdKu8x+I8XEgIAbtUQ7xW8Mm+rMotb6lYAwK2+QbWSM3Rr9G6sjPfAAABQtwIAAG4FAMCtAAC4FQAAcCsAAG4FAMCtAACAWwEAcCsAAG4FAMCtAACAWwEAcCsAAG4FAIDB/A+TwDMYaskP0AAAAABJRU5ErkJggg==" width="457" height="163" class="img_ev3q"></p><p>Bisa dilihat ada banyak variabel dengan nama <code>some_data</code> dideklarasikan dalam block fungsi <code>main</code>. Kesemuanya dideklarasikan menggunakan keyword <code>let</code>, ada yang immutable ada juga yang mutable.</p><p><strong>Variable shadowing BERBEDA dengan variable mutable</strong>. Pada variable mutable, saat deklarasinya, di belakang layar terjadi proses alokasi alamat memory untuk menampung data, kemudian saat ada perubahan nilai, maka data yang baru disimpan ke alamat memory yang sama menggantikan data sebelumnya.</p><p>Pada variable shadowing, yang terjadi di balik layar adalah: ketika ada deklarasi variabel baru menggunakan keyword <code>let</code> dan namanya sama, maka dianggap sebagai variabel baru, dan Rust akan mengalokasikan alamat memory baru untuk menampung data variable baru tersebut.</p><p>Lebih jelasnya mengenai memory management akan dibahas secara terpisah pada chapter <a href="/basic/basic-memory-management">Memory Management</a>. Untuk sekarang mari lanjut pembahasan tentang variable shadowing.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a312-shadowing-pada-block-berbeda">A.31.2 Shadowing pada block berbeda<a class="hash-link" href="#a312-shadowing-pada-block-berbeda" title="Direct link to heading">​</a></h2><p>Variable shadowing bisa terjadi dalam satu scope yang sama, bisa juga terjadi pada scope yang berbeda. Pada case ke-2 (scope yang berbeda), variabel baru hanya akan valid pada block scope itu saja, dan tidak mempengaruhi data variable di luar block.</p><p>Agar lebih jelas silakan pelajari contoh berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> name </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Orgrim Doomhammer"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> race </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Orc"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">27</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}\t {}\t {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> race</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> name </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Sylvanas Windrunner"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> race </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Undead"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}\t {}\t {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> race</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}\t {}\t {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> race</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Block" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcYAAAB+CAIAAAAx7ibSAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGF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paaOUUIYBtni4kvl9GEsXQOpOLKgZkqDVkRq15t7TL7JhFm2KUvZ8IVI9k1AzUnuohcbX6sYooQwDbPFw+Zw7MZYugdRdWFAToqJtRqn9cD7e14lShw3UyyC1jlKlCYr0RhNSY3dkO1L3Yiy9GFLXtaD22gtERZucSxV6XDT5NTdS624j93ZtoxWpUkCZh9Q9GEuPvsHuyoI6ObWK0GJI9Vq8N5wPW2s+QQogtTdiFfMpbcxEauiOnDHw34ux9LgwdZcW1ISoaHWketFnOvYU1vv1GbNXw4BaR6q4FOz8ELhfuxtzBv6CO7IZqfGYdrvG0pms2qsF9TYeAkQgddSokHgAIQRSywwKCQgQQiC1AFT5+iRCCKQihBACqQghBFIRQgikIoQQAqkIIQRSEUIIpCKEEEhFCCEEUhFCCKQihNAJ6H8eyTFEAr61xQAAAABJRU5ErkJggg==" width="454" height="126" class="img_ev3q"></p><p>Pada contoh di atas, ada 3 variabel dideklarasikan kemudian di-print, yaitu <code>name</code>, <code>race</code>, dan <code>number</code>. Variabel <code>name</code> adalah immutable, dan 2 variable lainnya adalah mutable. Ok, kita akan bahas variable tersebut satu per satu.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-variable-name">◉ Variable <code>name</code><a class="hash-link" href="#-variable-name" title="Direct link to heading">​</a></h3><p>Variabel <code>name</code> dideklarasikan dengan nilai awal adalah <code>Orgrim Doomhammer</code>, kemudian diikuti block statement yang isinya adalah variable shadowing bernama <code>name</code> dengan value <code>Sylvanas Windrunner</code>. Variabel tersebut ketika di-print dalam block, nilainya adalah <code>Sylvanas Windrunner</code>.</p><p>Setelah eksekusi block selesai, apapun yang ada di-dalam block tersebut dianggap selesai, dan tidak mempengaruhi nilai di scope atasnya. Pada contoh, nilai variable <code>name</code> setelah eksekusi block adalah tetap <code>Orgrim Doomhammer</code> (tidak berubah menjadi <code>Sylvanas Windrunner</code>).</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-variable-race">◉ Variable <code>race</code><a class="hash-link" href="#-variable-race" title="Direct link to heading">​</a></h3><p>Variabel <code>race</code> dideklarasikan mutable dengan nilai awal <code>Orc</code>. Di dalam block baru, variabel tersebut diubah nilainya. Perhatikan baik-baik statement <code>race = "Undead"</code>, statement ini adalah perubahan nilai, bukan deklarasi variable shadowing. Efeknya apa? setelah block selesai dieksekusi, nilai <code>race</code> adalah <code>Undead</code> karena memang sengaja diubah nilainya dari dalam block.</p><p>Penulis tekankan, variabel shadowing ciri khasnya adalah pasti diawali keyword <code>let</code>. Jika tidak ada keyword tersebut, maka statement adalah operasi perubahan nilai, bukan deklarasi variable shadowing.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-variable-number">◉ Variable <code>number</code><a class="hash-link" href="#-variable-number" title="Direct link to heading">​</a></h3><p>Variabel <code>number</code> dideklarasikan mutable dengan nilai awal <code>27</code>. Kemudian pada block terjadi deklarasi variable shadowing <code>let number = 24</code>. Meskipun variabel ini adalah mutable, yang terjadi di dalam block adalah variable shadowing karena statement diawali dengan keyword <code>let</code>.</p><p>Setelah eksekusi block selesai, nilai <code>number</code> pada scope tidak berubah, yaitu <code>27</code>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/shadowing" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../shadowing</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/rust-by-example/variable_bindings/scope.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/variable_bindings/scope.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/block-expression"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.30. Block Expression</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/basic-memory-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.32. Basic Memory Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a311-konsep-variable-shadowing" class="table-of-contents__link toc-highlight">A.31.1 Konsep variable shadowing</a></li><li><a href="#a312-shadowing-pada-block-berbeda" class="table-of-contents__link toc-highlight">A.31.2 Shadowing pada block berbeda</a><ul><li><a href="#-variable-name" class="table-of-contents__link toc-highlight">◉ Variable <code>name</code></a></li><li><a href="#-variable-race" class="table-of-contents__link toc-highlight">◉ Variable <code>race</code></a></li><li><a href="#-variable-number" class="table-of-contents__link toc-highlight">◉ Variable <code>number</code></a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.31. Shadowing</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.31. Shadowing</h1></header><p>Pada chapter ini kita akan belajar tentang shadowing pada variable dan apa perbedaannya dibanding variable mutable.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a311-konsep-variable-shadowing">A.31.1 Konsep variable shadowing<a class="hash-link" href="#a311-konsep-variable-shadowing" title="Direct link to heading">​</a></h2><p>Variable shadowing adalah istilah untuk variable yang dideklarasikan dalam sebuah block, yang variabel tersebut memiliki nama sama persis dengan variable pendahulunya (baik dalam scope yang sama ataupun variable lain yang berada di luar current scope).</p><p>Penulis tekankan di sini, meskipun namanya sama, variabel-variabel tersebut dianggap variabel yang benar-benar berbeda oleh Rust, tipe datanya bisa jadi juga berbeda.</p><p>Ciri khas variable shadowing adalah deklarasi selalu menggunakan keyword <code>let</code>. Contoh penerapannya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> some_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Hello"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> some_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => Hello</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> some_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> some_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => 12</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> some_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Rust!"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> some_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => Rust!</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> some_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> some_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> some_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => true</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> some_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> some_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// output => 3.14</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="Shadowing" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAACjCAIAAABuRXKuAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLz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Lz+iy3tha6AACbdKtpw851a8b1MQCADbg12Uma0d9aTEX2t3I1CwBwa3SfQCXKqKegGFEdeOX141KzAsDm3AoAALgVAAC3AgDgVgAAwK0AALgVAAC3AgAAbgUAWKBb3a3+YQgA9/4DAPR2q3sW69V7NPVo1tMf8vlVAADcmmvW+oFWXaFErQAA9OwTwK0AADO6lS4BAICR3cr7WAAARnarEyslKwDAeG5FrAAAQ9wahVv/eFXeUIhmAQB61K0AAIBbAQBwKwAAbgUAANwKAIBbAQBwKwAALMqtdvwLAMClu9V/dqBXeMDLm+pQ3AoA23bryag9Q69wKwDg1oRbaxvKgfIPWeQWg6IHZmXl600EAGCrbm0iBXW3WrI06tZiOG4FgO26NUpksd2q2RK3AgButepW2T1q9Qk0AVlSprgVAHCr3SfQvBnLdKvQZuNTy60AALj1KriWVemyrFRDt3r3ABg3BLhvUrgCwObdKurRuhv2x+tLNUbiTljxkT8t3AoA23QrAADgVgAA3AoAgFsBAAC3AgDgVgAA3AoAALgVAGBpbuWhVQAA3AoAsGy3WuHWpW3rTxOhrsYDrwAA1K1R3VplCYrwQcutTXgWL3EBANza7lY/Kdtwq5/RSucCAODWtFsjSWpujfsUcCsA4NYx3EonKwDgVo24o9RyaxSYbb1DCwBg826Nr/XrHadKYPZVcK8BXQIAgFsBAAC3AgDgVgAA3AoAALgVAAC3AgDgVgAAwK0AAEtzaxV5lZsR6EaPnxAoHyDgyQEAwK1Xih+TdnR5gq/KWC5W4I0QLADArbo7E3Z8eXMfxgauhhAwCAC4tbNareq2/hu3AgBuDWyZ/06WwK2NUXErAODWnJK0fSTpU9wKALjV9GZb7SrdKu8x+I8XEgIAbtUQ7xW8Mm+rMotb6lYAwK2+QbWSM3Rr9G6sjPfAAABQtwIAAG4FAMCtAAC4FQAAcCsAAG4FAMCtAACAWwEAcCsAAG4FAMCtAACAWwEAcCsAAG4FAIDB/A+TwDMYaskP0AAAAABJRU5ErkJggg==" width="457" height="163" class="img_CujE"></p><p>Bisa dilihat ada banyak variabel dengan nama <code>some_data</code> dideklarasikan dalam block fungsi <code>main</code>. Kesemuanya dideklarasikan menggunakan keyword <code>let</code>, ada yang immutable ada juga yang mutable.</p><p><strong>Variable shadowing BERBEDA dengan variable mutable</strong>. Pada variable mutable, saat deklarasinya, di belakang layar terjadi proses alokasi alamat memory untuk menampung data, kemudian saat ada perubahan nilai, maka data yang baru disimpan ke alamat memory yang sama menggantikan data sebelumnya.</p><p>Pada variable shadowing, yang terjadi di balik layar adalah: ketika ada deklarasi variabel baru menggunakan keyword <code>let</code> dan namanya sama, maka dianggap sebagai variabel baru, dan Rust akan mengalokasikan alamat memory baru untuk menampung data variable baru tersebut.</p><p>Lebih jelasnya mengenai memory management akan dibahas secara terpisah pada chapter <a href="/basic/basic-memory-management">Memory Management</a>. Untuk sekarang mari lanjut pembahasan tentang variable shadowing.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a312-shadowing-pada-block-berbeda">A.31.2 Shadowing pada block berbeda<a class="hash-link" href="#a312-shadowing-pada-block-berbeda" title="Direct link to heading">​</a></h2><p>Variable shadowing bisa terjadi dalam satu scope yang sama, bisa juga terjadi pada scope yang berbeda. Pada case ke-2 (scope yang berbeda), variabel baru hanya akan valid pada block scope itu saja, dan tidak mempengaruhi data variable di luar block.</p><p>Agar lebih jelas silakan pelajari contoh berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> name </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Orgrim Doomhammer"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> race </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Orc"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">27</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}\t {}\t {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> race</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> name </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Sylvanas Windrunner"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> race </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Undead"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}\t {}\t {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> race</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}\t {}\t {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> race</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Block" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcYAAAB+CAIAAAAx7ibSAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWx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R3x8+FGh9pPoD7mNLf3kx+Lk3ZHuRZl/7yNdsAq1BXrkDvLx00fRzHlKj1bQ0UvtBZeqK9FnXHZhVi58XsxedeJliFcslP5qnm79ZofNBanBzjz6QGXzwVNm5N9+Pdm2tne0m0EFCiUjDo3DzIKqST2XawVnH7qJsuT86880P2XOpb3ZjVi08apFRdOJlSlWsHT6u1UrLqyAVbWHgz70eIYRmQSrfRUMIoQJIbYZVRKgIIYQTFUIIgVSEEAKpCCEEUhFCCO0IqdmOpXNqO5aEJygsqBFIDXEz3WStGFL957gL5QikGkt+txbUmsMAQssi1X3j0+oAtVzHHnjxEKSeJ1ITFtS5eUeoLFKD5uy8wi25IwcvAjbOevGeggn08R38p+Z97ofke91qx3ZSF+0yutc8o4TaCzMYYIuHq5nfg7H0NKTuy4KauQS0MlKj4K1poKI7cuB14XFO8lGO/P+7M9d/K41esLx+UaJpaaOUUIYBtni4kvl9GEsXQOpOLKgZkqDVkRq15t7TL7JhFm2KUvZ8IVI9k1AzUnuohcbX6sYooQwDbPFw+Zw7MZYugdRdWFAToqJtRqn9cD7e14lShw3UyyC1jlKlCYr0RhNSY3dkO1L3Yiy9GFLXtaD22gtERZucSxV6XDT5NTdS624j93ZtoxWpUkCZh9Q9GEuPvsHuyoI6ObWK0GJI9Vq8N5wPW2s+QQogtTdiFfMpbcxEauiOnDHw34ux9LgwdZcW1ISoaHWketFnOvYU1vv1GbNXw4BaR6q4FOz8ELhfuxtzBv6CO7IZqfGYdrvG0pms2qsF9TYeAkQgddSokHgAIQRSywwKCQgQQiC1AFT5+iRCCKQihBACqQghBFIRQgikIoQQAqkIIQRSEUIIpCKEEEhFCCEEUhFCCKQihNAJ6H8eyTFEAr61xQAAAABJRU5ErkJggg==" width="454" height="126" class="img_CujE"></p><p>Pada contoh di atas, ada 3 variabel dideklarasikan kemudian di-print, yaitu <code>name</code>, <code>race</code>, dan <code>number</code>. Variabel <code>name</code> adalah immutable, dan 2 variable lainnya adalah mutable. Ok, kita akan bahas variable tersebut satu per satu.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-variable-name">◉ Variable <code>name</code><a class="hash-link" href="#-variable-name" title="Direct link to heading">​</a></h3><p>Variabel <code>name</code> dideklarasikan dengan nilai awal adalah <code>Orgrim Doomhammer</code>, kemudian diikuti block statement yang isinya adalah variable shadowing bernama <code>name</code> dengan value <code>Sylvanas Windrunner</code>. Variabel tersebut ketika di-print dalam block, nilainya adalah <code>Sylvanas Windrunner</code>.</p><p>Setelah eksekusi block selesai, apapun yang ada di-dalam block tersebut dianggap selesai, dan tidak mempengaruhi nilai di scope atasnya. Pada contoh, nilai variable <code>name</code> setelah eksekusi block adalah tetap <code>Orgrim Doomhammer</code> (tidak berubah menjadi <code>Sylvanas Windrunner</code>).</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-variable-race">◉ Variable <code>race</code><a class="hash-link" href="#-variable-race" title="Direct link to heading">​</a></h3><p>Variabel <code>race</code> dideklarasikan mutable dengan nilai awal <code>Orc</code>. Di dalam block baru, variabel tersebut diubah nilainya. Perhatikan baik-baik statement <code>race = "Undead"</code>, statement ini adalah perubahan nilai, bukan deklarasi variable shadowing. Efeknya apa? setelah block selesai dieksekusi, nilai <code>race</code> adalah <code>Undead</code> karena memang sengaja diubah nilainya dari dalam block.</p><p>Penulis tekankan, variabel shadowing ciri khasnya adalah pasti diawali keyword <code>let</code>. Jika tidak ada keyword tersebut, maka statement adalah operasi perubahan nilai, bukan deklarasi variable shadowing.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-variable-number">◉ Variable <code>number</code><a class="hash-link" href="#-variable-number" title="Direct link to heading">​</a></h3><p>Variabel <code>number</code> dideklarasikan mutable dengan nilai awal <code>27</code>. Kemudian pada block terjadi deklarasi variable shadowing <code>let number = 24</code>. Meskipun variabel ini adalah mutable, yang terjadi di dalam block adalah variable shadowing karena statement diawali dengan keyword <code>let</code>.</p><p>Setelah eksekusi block selesai, nilai <code>number</code> pada scope tidak berubah, yaitu <code>27</code>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/shadowing" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../shadowing</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/rust-by-example/variable_bindings/scope.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/variable_bindings/scope.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/block-expression"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.30. Block Expression</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/basic-memory-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.32. Basic Memory Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a311-konsep-variable-shadowing" class="table-of-contents__link toc-highlight">A.31.1 Konsep variable shadowing</a></li><li><a href="#a312-shadowing-pada-block-berbeda" class="table-of-contents__link toc-highlight">A.31.2 Shadowing pada block berbeda</a><ul><li><a href="#-variable-name" class="table-of-contents__link toc-highlight">◉ Variable <code>name</code></a></li><li><a href="#-variable-race" class="table-of-contents__link toc-highlight">◉ Variable <code>race</code></a></li><li><a href="#-variable-number" class="table-of-contents__link toc-highlight">◉ Variable <code>number</code></a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/slice-memory-management.html b/basic/slice-memory-management.html index acc58151..3b4beb63 100644 --- a/basic/slice-memory-management.html +++ b/basic/slice-memory-management.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice-memory-management/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice-memory-management/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.45. Slice Memory Management","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice-memory-management/#webpage"},"wordCount":514,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice-memory-management/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice-memory-management/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/slice-memory-management","name":"A.45. Slice Memory Management","description":"Kita telah mempelajari tipe data Array dan Vector, serta sudah beberapa kali menggunakan tipe data string slice (String). 3 tipe data itu memiliki kemiripan, yaitu kesemuanya termasuk dalam kategori tipe data slice.","datePublished":"2024-08-01T10:17:30.649Z","dateModified":"2024-08-01T10:17:30.649Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice-memory-management/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/slice-memory-management"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice-memory-management/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.45. Slice Memory Management","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice-memory-management/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice-memory-management/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.45. Slice Memory Management","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice-memory-management/#webpage"},"wordCount":514,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice-memory-management/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice-memory-management/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/slice-memory-management","name":"A.45. Slice Memory Management","description":"Kita telah mempelajari tipe data Array dan Vector, serta sudah beberapa kali menggunakan tipe data string slice (String). 3 tipe data itu memiliki kemiripan, yaitu kesemuanya termasuk dalam kategori tipe data slice.","datePublished":"2024-08-30T07:44:50.714Z","dateModified":"2024-08-30T07:44:50.714Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice-memory-management/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/slice-memory-management"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice-memory-management/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.45. Slice Memory Management","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.45. Slice Memory Management</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.45. Slice Memory Management</h1></header><p>Kita telah mempelajari tipe data <a href="/basic/array">Array</a> dan <a href="/basic/vector">Vector</a>, serta sudah beberapa kali menggunakan tipe data string slice (<code>String</code>). 3 tipe data itu memiliki kemiripan, yaitu kesemuanya termasuk dalam kategori tipe data slice.</p><blockquote><p>Ciri khas dari tipe data yang termasuk dalam kategori slice adalah jika diakses reference-nya menghasilkan data bertipe <code>&[T]</code> yang mana <code>T</code> adalah tipe data elemen.</p></blockquote><p>Pada chapter ini, kita akan bahas lebih dalam lagi tentang apa itu slice terutama bagian memory management-nya.</p><blockquote><p>Perbedaan chapter ini dengan chapter ini dengan chapter <a href="/basic/slice">Slice (Basic)</a> adalah di sini fokusnya lebih banyak di memory management.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a451-konsep-slice">A.45.1. Konsep slice<a class="hash-link" href="#a451-konsep-slice" title="Direct link to heading">​</a></h2><p>Slice adalah representasi <em>block of memory</em> berbentuk pointer dan memiliki size yang dinamis, dengan isi adalah koleksi element data. Slice merupakan reference atau data pinjaman (borrow).</p><p>Pada program berikut, beberapa variabel dideklarasikan menggunakan tiga tipe data di atas, kemudian masing-masing data dipinjam kemudian di-print.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_arr </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data_arr: {} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_arr</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_arr</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_arr</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice1 : {} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_arr</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice2 : {} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data_vec: {} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice1 : {} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice2 : {} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_str </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sesuk prei jarene, mosokk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data_str: {} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_str</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_str</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice1 : {} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_str</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice2 : {} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Slice memory management" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAS4AAADNCAIAAACJhQqMAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF32lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIF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YBig873i7NDheY92NWQOtyUYBhixbDM8dHjai/467cieYBigp4pjQ4d76NEjdLjmhPBrBQxXcVrocC6it5uKjTuyJxgGGDUqAgAqAqAiAKAiACoCACoCoCIAoCIAKgIAKgKgIgCgIgCgIsBV+A89TcdB11uFfAAAAABJRU5ErkJggg==" width="302" height="205" class="img_ev3q"></p><p>Terlihat kemiripan-nya, slice bisa terbentuk dari ketiga jenis data di atas.</p><p>Penulis ingatkan lagi, bahwa slice adalah tipe data reference yang berarti isi adalah data pinjaman (borrow). Tipe data slice selalu <code>&[T]</code> yang mana <code>T</code> adalah tipe data element.</p><p>Karena slice adalah data borrow, maka operasi standar borrowing termasuk mutable borrowing bisa dilakukan di slice.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a452-memory-management-pada-slice">A.45.2. Memory management pada slice<a class="hash-link" href="#a452-memory-management-pada-slice" title="Direct link to heading">​</a></h2><p>Sekarang lanjut ke pembahasan tentang bagaimana data bertipe slice di-manage di memory. Sebagai bahan belajar, kita perlu memilih satu dari 3 tipe data slice yang ada. Bebas sebenarnya mau pilih yang mana. Penulis memilih <code>String</code> untuk memulai pembahasan.</p><p>Silakan perhatikan statement sederhana berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_str </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sesuk preiii"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ada sebuah data <code>String</code> dideklarasikan, value-nya adalah <code>sesuk preiii</code>, dan owner-nya adalah variabel <code>data_str</code>. Data variabel <code>data_str</code> disimpan di memory pada 2 tempat, yaitu <strong>heap</strong> dan <strong>stack</strong>.</p><p>Selanjutnya, 2 buah slice tercipta hasil operasi slicing pada variabel <code>data_str</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_str </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sesuk preiii"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// "sesuk preiii"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_str</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// "eiii"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_str</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// "sesuk"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Slice adalah data borrow, artinya jika ada beberapa variabel baru dibuat hasil dari operasi slicing, maka isi variabel tersebut merupakan reference yang mengarah ke data sebenarnya. Di heap memory tidak ada perubahan, namun di stack memory ada beberapa data baru. Lebih jelasnya silakan perhatikan ilustrasi berikut.</p><p><img loading="lazy" alt="Slice memory management" src="/assets/images/slice-memory-management-2-97ee1868013eb53b825e4c59489aa236.png" width="739" height="713" class="img_ev3q"></p><p>Sekarang di stack memory ada 3 buah metadata informasi disimpan, yaitu <code>data_str</code> (yang merupakan owner sebenarnya data), dan <code>slice1</code> & <code>slice2</code>. Sedangkan untuk data-nya sendiri tetap berada di heap memory tanpa ada perubahan.</p><p>Tiga variabel di atas kesemuanya mengakses reference yang sama, yang membedakan adalah elemen-nya saja. Owner (yaitu <code>data_str</code>) bisa mengakses seluruh data, selain itu juga tau informasi kapasitas data. Sedangkan borrower hanya bisa mengakses data yang dia pinjam sesuai dengan operasi slicing-nya. Borrower tidak mengetahui kapasitas data, namun ia tau size dari elemen yang ia pinjam.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a452-mutable-slice">A.45.2. Mutable slice<a class="hash-link" href="#a452-mutable-slice" title="Direct link to heading">​</a></h2><p>Bagaimana dengan <em>mutability</em> pada slice, apa yang terjadi di belakang layar ketika elemen slice nilainya diubah?</p><p>Ok, mari kita bahas dengan contoh. Pada kode berikut ada sebuah data mutable array bertipe <code>[i32; 6]</code> dengan owner bernama <code>numbers</code>. Dari variabel tersebut, dilakukan operasi mutable borrowing untuk disimpan pada variabel <code>n1</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> numbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">7</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">9</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"numbers: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> n1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"n1 : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> n1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">n1</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3022</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"numbers: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Slice memory management" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZkAAACTCAIAAADTK/NLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly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ZXfUOCSIW+Syw6NoiZ4ahwRBLjs4l1HjkCDIZTvnMp7HJAhyGUEQBLmMIAiCXEYQBEEuIwiCXLYYrr+zxt9hOhG4xUHcNpehI9jm+6qVrCeOd1q6iSUD9y09bZFehQW1lE7JSYJctnsuM+QMu9q+1utfxOKUtm5iqRWH24ODoFOmsKDlSqfkJHEKLoNajOhg00Xy4ecQ1bwMf8cvk9vxY7cnnemL8XIYIYQO3HCGSRmkw/ir0fLJilO269eCAlBxsKCFSq8lP0pOEjvhMqnFqHDZW/L3VzJnm7wycM95PA6EN4kkypLkFGZBLpuKbNBHXIvLpiqFdQvttSaXUXKSOA+XwbPlgMsiKpi5bHa7zi27P4ErBjfEkhXTKfYmvzXGUVjinGwFLqud5M0x6TytnGPXwOhmQW1TTEpOEuQyyWXdJ21dWRs00wS1WvpQ1fpK5rfNQQTksnY6njNOYjFpXbyZUV86JScJcpkSl/36qblijkMqwwuYbaICJpR0Knce5cg35cbKJ3pSSHL8BAtqLp2Sk8QNcFmwBvbm47JoEQwu6pgeDwRh69bLMiM8uaHkLY2kimpBxW9+TJwSZjmXVkZklJwkyGXzh2me2G9amlyGXlEC1xGXxdPRyH9bflPOfHMKCtH6FRbHPM2CivOE75eFry0sXTolJ4mzcdnh0bSH1jK53TzPzUqn5CRBLjsaly0jkbh+npuVTslJglx2RS7jeczzdSa5jLg5LiMIglxGEARBLiMIgiCXEQRBkMsIgiCXEQRBkMsIgiDIZQRBEOQygiDIZQRBEOQygiAIchlBEEQV/gfiH8m6S53t7QAAAABJRU5ErkJggg==" width="409" height="147" class="img_ev3q"></p><p>Salah satu elemen <code>n1</code> diubah nilainya, maka efeknya juga berpengaruh pada owner. Ketika variabel <code>numbers</code> di-print, element indeks <code>2</code> berubah nilainya dari yang sebelumnya <code>8</code> sekarang <code>3022</code>.</p><p>Visualisasi memory management-nya kurang lebih seperti ini:</p><p><img loading="lazy" alt="Slice memory management" src="/assets/images/slice-memory-management-4-25a4c7b54f07cac6f773e2ff178a6d32.png" width="718" height="1088" class="img_ev3q"></p><p>Variabel <code>numbers</code> dan <code>n1</code> sama-sama mengarah ke reference yang sama. Itulah kenapa perubahan data pada peminjam membawa efek ke owner.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/slice_memory_management" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../slice_memory_management</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/array">Array</a></li><li><a href="/basic/slice">Slice (Basic)</a></li><li><a href="/basic/vector">Vector</a></li><li><a href="/basic/basic-memory-management">Basic Memory Management</a></li><li><a href="/basic/tipe-data-custom-type-string-slice">Tipe Data ➜ String Custom Type</a></li><li><a href="/basic/string-slice-vs-string-literal">String Literal (&str) vs. String Custom Type</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch04-03-slices.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch04-03-slices.html</a></li><li><a href="https://users.rust-lang.org/t/why-rust-slice-has-not-ownership/27356" target="_blank" rel="noopener noreferrer">https://users.rust-lang.org/t/why-rust-slice-has-not-ownership/27356</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/lifetime"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.44. Lifetime</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/string-slice-vs-string-literal"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.46. String Literal (&str) vs. String Custom Type</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a451-konsep-slice" class="table-of-contents__link toc-highlight">A.45.1. Konsep slice</a></li><li><a href="#a452-memory-management-pada-slice" class="table-of-contents__link toc-highlight">A.45.2. Memory management pada slice</a></li><li><a href="#a452-mutable-slice" class="table-of-contents__link toc-highlight">A.45.2. Mutable slice</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.45. Slice Memory Management</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.45. Slice Memory Management</h1></header><p>Kita telah mempelajari tipe data <a href="/basic/array">Array</a> dan <a href="/basic/vector">Vector</a>, serta sudah beberapa kali menggunakan tipe data string slice (<code>String</code>). 3 tipe data itu memiliki kemiripan, yaitu kesemuanya termasuk dalam kategori tipe data slice.</p><blockquote><p>Ciri khas dari tipe data yang termasuk dalam kategori slice adalah jika diakses reference-nya menghasilkan data bertipe <code>&[T]</code> yang mana <code>T</code> adalah tipe data elemen.</p></blockquote><p>Pada chapter ini, kita akan bahas lebih dalam lagi tentang apa itu slice terutama bagian memory management-nya.</p><blockquote><p>Perbedaan chapter ini dengan chapter ini dengan chapter <a href="/basic/slice">Slice (Basic)</a> adalah di sini fokusnya lebih banyak di memory management.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a451-konsep-slice">A.45.1. Konsep slice<a class="hash-link" href="#a451-konsep-slice" title="Direct link to heading">​</a></h2><p>Slice adalah representasi <em>block of memory</em> berbentuk pointer dan memiliki size yang dinamis, dengan isi adalah koleksi element data. Slice merupakan reference atau data pinjaman (borrow).</p><p>Pada program berikut, beberapa variabel dideklarasikan menggunakan tiga tipe data di atas, kemudian masing-masing data dipinjam kemudian di-print.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_arr </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data_arr: {} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_arr</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_arr</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_arr</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice1 : {} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_arr</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice2 : {} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data_vec: {} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice1 : {} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice2 : {} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_str </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sesuk prei jarene, mosokk"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data_str: {} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_str</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_str</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_str</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice1 : {} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_str</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice2 : {} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="Slice memory management" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAS4AAADNCAIAAACJhQqMAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF32lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTItMTNUMTg6MDkrMDc6MDAiIHhtcDpNb2RpZnlEYXRl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CIAoCIAKgIAKgKgIgCgIgCgIsBV+A89TcdB11uFfAAAAABJRU5ErkJggg==" width="302" height="205" class="img_CujE"></p><p>Terlihat kemiripan-nya, slice bisa terbentuk dari ketiga jenis data di atas.</p><p>Penulis ingatkan lagi, bahwa slice adalah tipe data reference yang berarti isi adalah data pinjaman (borrow). Tipe data slice selalu <code>&[T]</code> yang mana <code>T</code> adalah tipe data element.</p><p>Karena slice adalah data borrow, maka operasi standar borrowing termasuk mutable borrowing bisa dilakukan di slice.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a452-memory-management-pada-slice">A.45.2. Memory management pada slice<a class="hash-link" href="#a452-memory-management-pada-slice" title="Direct link to heading">​</a></h2><p>Sekarang lanjut ke pembahasan tentang bagaimana data bertipe slice di-manage di memory. Sebagai bahan belajar, kita perlu memilih satu dari 3 tipe data slice yang ada. Bebas sebenarnya mau pilih yang mana. Penulis memilih <code>String</code> untuk memulai pembahasan.</p><p>Silakan perhatikan statement sederhana berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_str </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sesuk preiii"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ada sebuah data <code>String</code> dideklarasikan, value-nya adalah <code>sesuk preiii</code>, dan owner-nya adalah variabel <code>data_str</code>. Data variabel <code>data_str</code> disimpan di memory pada 2 tempat, yaitu <strong>heap</strong> dan <strong>stack</strong>.</p><p>Selanjutnya, 2 buah slice tercipta hasil operasi slicing pada variabel <code>data_str</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_str </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sesuk preiii"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// "sesuk preiii"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_str</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// "eiii"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_str</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// "sesuk"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Slice adalah data borrow, artinya jika ada beberapa variabel baru dibuat hasil dari operasi slicing, maka isi variabel tersebut merupakan reference yang mengarah ke data sebenarnya. Di heap memory tidak ada perubahan, namun di stack memory ada beberapa data baru. Lebih jelasnya silakan perhatikan ilustrasi berikut.</p><p><img loading="lazy" alt="Slice memory management" src="/assets/images/slice-memory-management-2-97ee1868013eb53b825e4c59489aa236.png" width="739" height="713" class="img_CujE"></p><p>Sekarang di stack memory ada 3 buah metadata informasi disimpan, yaitu <code>data_str</code> (yang merupakan owner sebenarnya data), dan <code>slice1</code> & <code>slice2</code>. Sedangkan untuk data-nya sendiri tetap berada di heap memory tanpa ada perubahan.</p><p>Tiga variabel di atas kesemuanya mengakses reference yang sama, yang membedakan adalah elemen-nya saja. Owner (yaitu <code>data_str</code>) bisa mengakses seluruh data, selain itu juga tau informasi kapasitas data. Sedangkan borrower hanya bisa mengakses data yang dia pinjam sesuai dengan operasi slicing-nya. Borrower tidak mengetahui kapasitas data, namun ia tau size dari elemen yang ia pinjam.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a452-mutable-slice">A.45.2. Mutable slice<a class="hash-link" href="#a452-mutable-slice" title="Direct link to heading">​</a></h2><p>Bagaimana dengan <em>mutability</em> pada slice, apa yang terjadi di belakang layar ketika elemen slice nilainya diubah?</p><p>Ok, mari kita bahas dengan contoh. Pada kode berikut ada sebuah data mutable array bertipe <code>[i32; 6]</code> dengan owner bernama <code>numbers</code>. Dari variabel tersebut, dilakukan operasi mutable borrowing untuk disimpan pada variabel <code>n1</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> numbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">7</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">9</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"numbers: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> n1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"n1 : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> n1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">n1</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3022</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"numbers: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Slice memory management" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZkAAACTCAIAAADTK/NLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iI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rCeOd1q6iSUD9y09bZFehQW1lE7JSYJctnsuM+QMu9q+1utfxOKUtm5iqRWH24ODoFOmsKDlSqfkJHEKLoNajOhg00Xy4ecQ1bwMf8cvk9vxY7cnnemL8XIYIYQO3HCGSRmkw/ir0fLJilO269eCAlBxsKCFSq8lP0pOEjvhMqnFqHDZW/L3VzJnm7wycM95PA6EN4kkypLkFGZBLpuKbNBHXIvLpiqFdQvttSaXUXKSOA+XwbPlgMsiKpi5bHa7zi27P4ErBjfEkhXTKfYmvzXGUVjinGwFLqud5M0x6TytnGPXwOhmQW1TTEpOEuQyyWXdJ21dWRs00wS1WvpQ1fpK5rfNQQTksnY6njNOYjFpXbyZUV86JScJcpkSl/36qblijkMqwwuYbaICJpR0Knce5cg35cbKJ3pSSHL8BAtqLp2Sk8QNcFmwBvbm47JoEQwu6pgeDwRh69bLMiM8uaHkLY2kimpBxW9+TJwSZjmXVkZklJwkyGXzh2me2G9amlyGXlEC1xGXxdPRyH9bflPOfHMKCtH6FRbHPM2CivOE75eFry0sXTolJ4mzcdnh0bSH1jK53TzPzUqn5CRBLjsaly0jkbh+npuVTslJglx2RS7jeczzdSa5jLg5LiMIglxGEARBLiMIgiCXEQRBkMsIgiCXEQRBkMsIgiDIZQRBEOQygiDIZQRBEOQygiAIchlBEEQV/gfiH8m6S53t7QAAAABJRU5ErkJggg==" width="409" height="147" class="img_CujE"></p><p>Salah satu elemen <code>n1</code> diubah nilainya, maka efeknya juga berpengaruh pada owner. Ketika variabel <code>numbers</code> di-print, element indeks <code>2</code> berubah nilainya dari yang sebelumnya <code>8</code> sekarang <code>3022</code>.</p><p>Visualisasi memory management-nya kurang lebih seperti ini:</p><p><img loading="lazy" alt="Slice memory management" src="/assets/images/slice-memory-management-4-25a4c7b54f07cac6f773e2ff178a6d32.png" width="718" height="1088" class="img_CujE"></p><p>Variabel <code>numbers</code> dan <code>n1</code> sama-sama mengarah ke reference yang sama. Itulah kenapa perubahan data pada peminjam membawa efek ke owner.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/slice_memory_management" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../slice_memory_management</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/array">Array</a></li><li><a href="/basic/slice">Slice (Basic)</a></li><li><a href="/basic/vector">Vector</a></li><li><a href="/basic/basic-memory-management">Basic Memory Management</a></li><li><a href="/basic/tipe-data-custom-type-string-slice">Tipe Data ➜ String Custom Type</a></li><li><a href="/basic/string-slice-vs-string-literal">String Literal (&str) vs. String Custom Type</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch04-03-slices.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch04-03-slices.html</a></li><li><a href="https://users.rust-lang.org/t/why-rust-slice-has-not-ownership/27356" target="_blank" rel="noopener noreferrer">https://users.rust-lang.org/t/why-rust-slice-has-not-ownership/27356</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/lifetime"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.44. Lifetime</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/string-slice-vs-string-literal"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.46. String Literal (&str) vs. String Custom Type</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a451-konsep-slice" class="table-of-contents__link toc-highlight">A.45.1. Konsep slice</a></li><li><a href="#a452-memory-management-pada-slice" class="table-of-contents__link toc-highlight">A.45.2. Memory management pada slice</a></li><li><a href="#a452-mutable-slice" class="table-of-contents__link toc-highlight">A.45.2. Mutable slice</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/slice.html b/basic/slice.html index cece3520..8b141ca7 100644 --- a/basic/slice.html +++ b/basic/slice.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.14. Slice (Basic)","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice/#webpage"},"wordCount":1075,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/slice","name":"A.14. Slice (Basic)","description":"Pada bab ini kita belajar tentang apa itu slice, apa perbedaan slice dan array, slicing atau borrowing pada slice, dan juga slice mutability.","datePublished":"2024-08-01T10:17:31.088Z","dateModified":"2024-08-01T10:17:31.088Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/slice"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.14. Slice (Basic)","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.14. Slice (Basic)","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice/#webpage"},"wordCount":1075,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/slice","name":"A.14. Slice (Basic)","description":"Pada bab ini kita belajar tentang apa itu slice, apa perbedaan slice dan array, slicing atau borrowing pada slice, dan juga slice mutability.","datePublished":"2024-08-30T07:44:51.158Z","dateModified":"2024-08-30T07:44:51.158Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/slice"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/slice/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.14. Slice (Basic)","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.14. Slice (Basic)</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.14. Slice (Basic)</h1></header><p>Pada bab ini kita belajar tentang apa itu slice, apa perbedaan slice dan array, <em>slicing</em> atau <em>borrowing</em> pada slice, dan juga slice mutability.</p><blockquote><p>Pada chapter ini kita akan bahas slice secara garis besar saja, tanpa menyinggung masalah memory management.</p><p>Pembahasan lebih dalam perihal slice ada pada chapter terpisah (<a href="/basic/slice-memory-management">Memory Management ➜ Slice</a>), setelah kita mempelajari dasar-dasar memory management nantinya.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a141-tipe-data-slice">A.14.1. Tipe data slice<a class="hash-link" href="#a141-tipe-data-slice" title="Direct link to heading">​</a></h2><p>Array adalah tipe data kolektif yang isinya bertipe sejenis. Contohnya <code>["a", "b", "c"]</code> adalah sebuah array dengan elemen bertipe string dan array tersebut memiliki size <code>3</code>.</p><p>Lalu apa itu slice? menurut laman dokumentasi Rust, slice adalah:</p><blockquote><p>A slice is a dynamically sized type representing a 'view' into a sequence of elements of type T. The slice type is written as <!-- -->[T]</p><p>A dynamically-sized view into a contiguous sequence, <!-- -->[T]<!-- -->. Contiguous here means that elements are laid out so that every element is the same distance from its neighbors.</p><p>Slices are a view into a block of memory represented as a pointer and a size.</p></blockquote><p>Slice adalah representasi <em>block of memory</em> berbentuk pointer dan memiliki size yang dinamis (tidak fixed seperti array). Notasi tipe data slice adalah <code>&[T]</code> yang mana <code>T</code> adalah tipe data element.</p><p>Slice bisa dibuat dari data array (atau dari tipe kolektif data lainnya) dengan menggunakan kombinasi operator <code>&</code> dan <em>range syntax</em> <code>..</code> dengan notasi penulisan seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sliced_value1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">start_index</span><span class="token punctuation" style="color:#393A34">..</span><span class="token plain">end_index</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sliced_value2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">start_index</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token plain">end_index</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sliced_value3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">start_index</span><span class="token punctuation" style="color:#393A34">..</span><span class="token plain">end_index</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">...</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Slice juga bisa dibuat dari tipe data vector. Lebih jelasnya dibahas pada chapter <a href="/basic/vector">Vector</a>.</p></blockquote><p>Silakan perhatikan contoh berikut dan praktikkan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">16</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"numbers : {:?}, len: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"numbers[0]: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"numbers[1]: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice_a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice_a : {:?}, len: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_a</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice_a[0]: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_a</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice_a[1]: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_a</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice_b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">slice_a</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice_b : {:?}, len: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_b</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_b</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice_b[0]: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_b</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice_b[1]: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_b</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="slice" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc8AAAEACAIAAABapGodAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMDktMjdUMTY6MjA6MDErMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyLTEwLTA0VDE0OjQzOjIzKzA3OjAwIiB4bXA6TWV0YWRhdGFEYXRlPSIyMDIyLTEwL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BMcKNwsXO9MtoEgNIs2tw2/r3VmAX4Hujy1kkAgEWwaNEWAKCaUHERAEAERFsAABEQbQEARFj6auKpL17hQhMA3KYqVBOfCLPcKo5zFeQmohIKhwPAHVLBauJhLUGrVWRR6+ILhwPA3VK5auJhYZdwPsvchqU0NHJmZBhmbLqMwuEAcLdkiLZhNfEU0YWfXoiKCY6ehw/moVqzbU2fh8p6w7UNw5n6CBmlJg0q1pi2pUpE8z9DoGUdEo3XyDJ3ZL/ftxlDIgEAZqtoNfGgOJZOHaPj0eb2tBpZeauJz104HADulCpWE5dUy/LCbKrWbNPleVlfs52rcDgA3CmVqybe7fvkdwfVrMurOz5n4XAAuGMqV03cOe36knoUnNSnqTueu5p4cuFwAIAJ6avSTFQTjy5tDReGy7u8ha2xJjj3JExLUCSuxis7O1yZeyvu6Lck0tyTMLGbYbuZbqgAgDtt6WuAZSzynfidNACAUqFOAgCACIv27IY81cSl4ElY6eskzN9NAICMlj6TAACwFJBJAAAQAdEWAEAERFsAABFQTRwAQIRKVhMnXqyfs5p4/GYJhGsAyKyC1cT5lb/nojXbOkVVw6fVewQASFC5auIJlb9ntDlj0yO1baYXIAMA4KpcNXF+5e85tc49Xbds07FaWvNIlbwOJrYAkE1Fq4lnkKqaeMsyjA7pjDFL6drI2gJAZlWsJl6CaF5uOKbNLNZuFHSrBQDcGZWrJl6G8MmSxw4RtSyDbKYbJjmY4AJAepWrJp5ZymriUi26w8HckUlkrAeASkg/t52oJj5eC1xnTJ+oJj5Y2HKOD6nZtqK8QZCLGF02I0ExSDpMXS3eJdVizJr/GxbxHMrMXgIA8Cx9DTBUEweApYA6CQAAIqCaOACACEufSQAAWArIJAAAiIBoCwAgAqItAIAIiLYAACIg2gIAiIBoCwAgAqItAIAIiLYAACIg2gIAiIBoCwAgAqItAIAI/x+K0xtQhqLb3AAAAABJRU5ErkJggg==" width="463" height="256" class="img_ev3q"></p><p>Pada contoh di atas, variabel <code>numbers</code> didefinisikan bertipe <code>[i32; 4]</code>. Data pada variabel tersebut kemudian dipinjam ditampung pada variabel baru beranama <code>slice_a</code> yang merupakan slice bertipe <code>&[i32]</code>, dengan isi adalah element array <code>numbers</code> indeks ke <code>0</code> hingga sebelum <code>3</code> (yang berarti index ke-<code>2</code>). Dengan ini maka <code>slice_a</code> nilainya adalah <code>[12, 16, 8]</code> dengan size <code>3</code>.</p><p>Bisa dilihat pada statement print <code>slice_a[0]</code> dan <code>slice_a[1]</code>, nilai elemennya sesuai dengan dengan hasil peminjaman data array <code>numbers</code>.</p><blockquote><p>Data yang tipenya <code>&[T]</code> biasa disebut sebagai <a href="https://doc.rust-lang.org/reference/types/slice.html" target="_blank" rel="noopener noreferrer"><em>shared slice</em></a> atau cukup <em>slice</em>. Contohnya seperti <code>slice_a</code> dengan tipe data <code>&[i32]</code>.</p></blockquote><p>Slice <code>slice_a</code> bukan merupakan pemilik sebenarnya data <code>[12, 16, 8]</code>, slice tersebut hanya meminjam datanya dari <code>numbers</code> yang notabene dalah owner data <code>[12, 16, 8]</code>.</p><p>Meminjam di sini artinya variabel baru <code>slice_a</code> memiliki data yang sama, dan alamat memori (atau pointer) data tersebut juga sama yaitu mengarah ke owner sebenarnya, yang pada contoh ini adalah <code>numbers</code>.</p><blockquote><p>Di Rust, proses meminjam data secara umum disebut dengan <strong>borrowing</strong>. Variabel atau data hasil dari borrowing biasa disebut dengan <strong>reference</strong>. Lebih jelasnya akan dibahas pada chapter <a href="/basic/pointer-references">Pointer & References</a> dan <a href="/basic/borrowing">Borrowing</a>.</p><p>Variabel pemilik data yang sebenarnya disebut dengan <strong>owner</strong>. Lebih jelasnya mengenai ownership dibahas pada chapter <a href="/basic/ownership">Ownership</a></p><p>Dalam konteks slice, proses meminjam data (yg menggunakan teknik borrowing dan range syntax) disebut dengan <strong>slicing</strong>.</p></blockquote><p>Dengan menggunakan VSCode <code>rust-analyzer</code> kita bisa melihat dengan mudah tipe sebuah slice.</p><p><img loading="lazy" alt="slice" src="/assets/images/slice-2-f573e34bdab45ca8821163ae546a42ba.png" width="540" height="346" class="img_ev3q"></p><p>Kembali ke pembahasan pada contoh di atas. Selain <code>slice_a</code>, ada juga slice <code>slice_b</code> yang isinya merupakan data pinjaman dari <code>slice_a</code>. Statement <code>&slice_a[1..=2]</code> artinya adalah <em>borrowing</em> slice <code>slice_a</code> mulai dari indeks ke-<code>1</code> hingga <code>2</code>. Dengan ini indeks ke-1 milik <code>slice_a</code> menjadi indeks ke-0 milik <code>slice_b</code>, ... dan seterusnya. Hasilnya, nilai <code>slice_b</code> adalah <code>[16, 8]</code> dengan size <code>2</code>.</p><p>Silakan juga cek penjelasan tambahan berikut, agar semakin paham tentang slice.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">16</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// variabel numbers isinya array [12, 16, 8, 3]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice_a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// meminjam data milik numbers elemen ke-0 hingga sebelum 3 (yaitu 2)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya adalah [12, 16, 8]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice_b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">slice_a</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// meminjam data milik slice_a elemen ke-1 hingga 2</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya adalah [16, 8]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a142-size-slice">A.14.2. Size slice<a class="hash-link" href="#a142-size-slice" title="Direct link to heading">​</a></h2><p>Gunakan method <code>len</code> untuk mencari tau size dari slice.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">16</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: 4</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice_a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_a</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: 3</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice_b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">slice_a</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_b</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: 2</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a143-slice-range-syntax">A.14.3. Slice <em>range syntax</em><a class="hash-link" href="#a143-slice-range-syntax" title="Direct link to heading">​</a></h2><p>Di bawah ini adalah range syntax yang bisa digunakan untuk slicing. Variabel <code>data</code> pada contoh berikut dijadikan sebagai bahan slicing.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"d"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li><p>Notasi <code>&data[start_index..end_index]</code> untuk slicing data dari <code>start_index</code> hingga sebelum <code>end_index</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sliced_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sliced_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => ["b", "c"]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Notasi <code>&data[start_index..=end_index]</code> untuk slicing data dari <code>start_index</code> hingga <code>end_index</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sliced_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sliced_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => ["b", "c", "d"]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Notasi <code>&data[..end_index]</code> untuk slicing data dari 0 hingga sebelum <code>end_index</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sliced_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sliced_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => ["a", "b", "c"]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Notasi <code>&data[..=end_index]</code> untuk slicing data dari 0 hingga <code>end_index</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sliced_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sliced_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => ["a", "b", "c"]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Notasi <code>&data[start_index..]</code> untuk slicing data dari <code>start_index</code> hingga indeks terakhir</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sliced_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sliced_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => ["b", "c", "d"]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Notasi <code>&data[..]</code> untuk slicing semua elemen yang ada</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sliced_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sliced_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => ["A", "b", "c", "d"]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><blockquote><p>Perihal apa itu borrowing dan kegunaan dari operator <code>&</code> yang ditulis di awal variabel dibahas lebih detail pada chapter <a href="/basic/pointer-references">Pointer & References</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a144-mutability-pada-slice">A.14.4. Mutability pada slice<a class="hash-link" href="#a144-mutability-pada-slice" title="Direct link to heading">​</a></h2><p>Ada dua jenis data hasil operasi <em>borrowing</em> (atau biasa disebut dengan data <em>reference</em>).</p><ul><li>Read only atau shared reference, operator yang digunakan adalah <code>&</code>.</li><li>Mutable reference, operator yang digunakan adalah <code>&mut</code>.</li></ul><p>Kita akan bahas garis besarnya saja pada chapter ini. Intinya, shared reference adalah data hasil peminjaman/borrowing yang hanya bisa dibaca. Sedangkan mutable reference adalah data hasil borrowing yang bisa diubah nilainya, yang jika ini dilakukan maka akan mengubah juga data pemilik sebenarnya.</p><p>Contoh berikut adalah salah satu penerapan <code>&mut</code>. Variabel slice <code>numbers2</code> dipinjam beberapa elemennya dengan operator <code>&mut</code> ke variabel baru bernama <code>slice_e</code>. Dengan operator tersebut maka borrowing menghasilkan data <em>mutable reference</em>, data yang nilainya diperbolehkan untuk diubah meskipun data pinjaman.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> numbers2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">16</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"===== before ====="</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"numbers2 : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice_e </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> numbers2</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">slice_e</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">99</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"===== after ====="</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice_e : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_e</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"numbers2 : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="slice" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAAC9CAIAAABXmRFFAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpw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WQAgNBzAuaSYLHskHcNJlPalTr1k1EVr/vK3L7q1Gw+YW3skFUy99pwlSEAIRHlt9YOnu5WVVXTVOroR3onHwuKbc//7Uk9t+I1U5m76KtOLZj518YOWyW8JgDASEAHK4iF1MaGtDYAU+Cm11sXmBnUxoa0NgDTAn5rENATcAM9AQB4gW0FAADxLIaeAAAAzBawrQAAIB7YVgAAEA9sKwAAiAe2FQAAxAPbCgAA4oFtBQAA8cC2AgCAeGBbAQBAPLCtAAAgHthWAAAQD2wrAACIB7YVAADEA9sKAADigW0FAADx/DdZCPKsAGKjBwAAAABJRU5ErkJggg==" width="457" height="189" class="img_ev3q"></p><p>Bisa dilihat, indeks ke-1 <code>slice_e</code> diubah nilainya yang sebelumnya adalah <code>16</code> menjadi <code>99</code>. Setelah itu di-print, di output nilai variabel <code>numbers2</code> juga ikut berubah. Hal ini karena perubahan data pada variabel mutable reference juga punya pengaruh ke variabel pemilik data sebenarnya (yaitu <code>numbers2</code>).</p><p>O iya, penggunaan operator <code>&mut</code> mengharuskan kita untuk tidak menuliskan keyword <code>mut</code> pada variabel yang menampung nilai borrowing.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// statement yang direkomendasikan</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice_e </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> numbers2</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// statement yang TIDAK DIREKOMENDASIKAN dan akan memunculkan warning.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> slice_e </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> numbers2</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a145-perulangan-for-in-pada-slice">A.14.5. Perulangan <code>for in</code> pada slice<a class="hash-link" href="#a145-perulangan-for-in-pada-slice" title="Direct link to heading">​</a></h2><p>Slice merupakan tipe data yang implement trait Iterator (seperti array), dan semua data yang memiliki trait tersebut bisa digunakan pada perulangan. Slice <code>&[T]</code> jika dipergunakan dalam <code>for in</code>, tipe data penampung iterasi perulangan adalah <code>&T</code>, bukan <code>T</code> yaa jadi jangan sampai keliru.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> scores1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">7</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">9</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> score </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">scores1</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?} "</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> score</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="slice" src="/assets/images/slice-5-541f1e4111281ebbac474d8d9828c0e8.png" width="462" height="272" class="img_ev3q"></p><blockquote><p>Sangat dianjurkan menggunakan <code>rust-analyzer</code> jika menggunakan VSCode, agar lebih mudah melihat tipe data variabel dan informasi penting lainnya yang berguna dalam proses coding atau development.</p><ul><li>Lebih jelasnya mengenai traits dibahas pada chapter <a href="/basic/traits">Traits</a></li><li>Lebih jelasnya mengenai trait <code>Iterator</code> dibahas pada chapter <a href="/basic/trait-iterator">Trait ➜ Iterator</a></li></ul></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a146-perulangan-for-in-pada-mutable-slice">A.14.6. Perulangan <code>for in</code> pada mutable slice<a class="hash-link" href="#a146-perulangan-for-in-pada-mutable-slice" title="Direct link to heading">​</a></h2><p>Sama seperti penggunaan <code>for in</code> pada shared slice, pada contoh kasus mutable slice perbedaannya hanyalah pada tipe data penampung iterasi yaitu <code>&mut T</code>, bukan <code>&T</code>.</p><p>Pada contoh berikut kita coba eksperimen mengubah nilai elemen sebuah mutable slice yang data aslinya juga hasil dari peminjaman mutable slice.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> scores2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">7</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">9</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"(before) scores2 : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> scores2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice_f </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> scores2</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> score </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> slice_f</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">score </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"(after) scores2 : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> scores2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Variabel <code>scores</code> dipinjam menggunakan <code>&mut</code> ke variabel baru bernama <code>slice_f</code>. Kemudian <code>slice_f</code> dipinjam juga sebagai mutable slice pada perulangan <code>for in</code>.</p><p>Setelah di-increment nilainya menggunakan <code>*score += 1</code> bisa dilihat hasil akhirnya juga mengubah nilai variabel <code>scores2</code> yang merupakan <em>owner</em> atau pemilik data sebenarnya.</p><p><img loading="lazy" alt="slice" src="/assets/images/slice-6-393c62bd8cdd9da05fcae56436a3cacd.png" width="467" height="376" class="img_ev3q"></p><p>Operasi increment pada <code>score</code> tidak bisa dituliskan dalam bentuk <code>score += 1</code> karena tipe data score adalah pointer mutable reference (ditandai dengan adanya <code>&mut</code>), untuk increment nilainya perlu di-<em>dereference</em> terlebih dahulu menggunakan operator <code>*</code>. Lebih jelasnya kita bahas pada chapter <a href="/basic/pointer-references">Pointer & References</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a147-append-slice">A.14.7. Append slice<a class="hash-link" href="#a147-append-slice" title="Direct link to heading">​</a></h2><p>Slice by default tidak mendukung operasi append. Sebenarnya bisa saja dilakukan tapi agak panjang caranya (silakan cari referensinya di Google untuk ini).</p><p>Perlu diketahui, jika kebutuhannya adalah untuk menampung jenis data yang size-nya bisa bertamah, penulis anjurkan untuk menggunakan <a href="/basic/vector">Vector</a> yang beberapa bab lagi akan kita bahas.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a148-memory-management-pada-slice">A.14.8. Memory management pada slice<a class="hash-link" href="#a148-memory-management-pada-slice" title="Direct link to heading">​</a></h2><p>Nantinya setelah selesai dengan pembahasan dasar memory management di Rust, kita akan bahas lagi topik slice tapi dari sudut pandang memory management pada chapter <a href="/basic/slice-memory-management">Memory Management ➜ Slice</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a149-summary">A.14.9. Summary<a class="hash-link" href="#a149-summary" title="Direct link to heading">​</a></h2><p>Catatan ringkas perihal slice:</p><ul><li>Slice memiliki notasi <code>&[T]</code><ul><li><code>&</code> di situ artinya adalah operasi borrowing/peminjaman</li><li><code>T</code> adalah tipe data tiap elemen</li></ul></li><li>Slice bisa terbentuk dari hasil meminjam data array, vector, atau tipe data kolektif lainnya</li><li>Data slice adalah selalu data pinjaman</li><li>Slice memiliki lebar/size</li><li>Slicing adalah cara pengaksesan slice menggunakan <em>range syntax</em></li><li>Slice bisa immutable, bisa juga mutable (menggunakan <code>&mut</code>)</li></ul><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/slice" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../slice</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch04-03-slices.html#the-slice-type" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch04-03-slices.html#the-slice-type</a></li><li><a href="https://doc.rust-lang.org/std/primitive.slice.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/primitive.slice.html</a></li><li><a href="https://doc.rust-lang.org/std/iter/trait.Iterator.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/iter/trait.Iterator.html</a></li><li><a href="https://doc.rust-lang.org/reference/types/slice.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/types/slice.html</a></li><li><a href="https://doc.rust-lang.org/nomicon/references.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/nomicon/references.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/primitives/array.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/primitives/array.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/array"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.13. Array</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/tuple"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.15. Tuple</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a141-tipe-data-slice" class="table-of-contents__link toc-highlight">A.14.1. Tipe data slice</a></li><li><a href="#a142-size-slice" class="table-of-contents__link toc-highlight">A.14.2. Size slice</a></li><li><a href="#a143-slice-range-syntax" class="table-of-contents__link toc-highlight">A.14.3. Slice <em>range syntax</em></a></li><li><a href="#a144-mutability-pada-slice" class="table-of-contents__link toc-highlight">A.14.4. Mutability pada slice</a></li><li><a href="#a145-perulangan-for-in-pada-slice" class="table-of-contents__link toc-highlight">A.14.5. Perulangan <code>for in</code> pada slice</a></li><li><a href="#a146-perulangan-for-in-pada-mutable-slice" class="table-of-contents__link toc-highlight">A.14.6. Perulangan <code>for in</code> pada mutable slice</a></li><li><a href="#a147-append-slice" class="table-of-contents__link toc-highlight">A.14.7. Append slice</a></li><li><a href="#a148-memory-management-pada-slice" class="table-of-contents__link toc-highlight">A.14.8. Memory management pada slice</a></li><li><a href="#a149-summary" class="table-of-contents__link toc-highlight">A.14.9. Summary</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.14. Slice (Basic)</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.14. Slice (Basic)</h1></header><p>Pada bab ini kita belajar tentang apa itu slice, apa perbedaan slice dan array, <em>slicing</em> atau <em>borrowing</em> pada slice, dan juga slice mutability.</p><blockquote><p>Pada chapter ini kita akan bahas slice secara garis besar saja, tanpa menyinggung masalah memory management.</p><p>Pembahasan lebih dalam perihal slice ada pada chapter terpisah (<a href="/basic/slice-memory-management">Memory Management ➜ Slice</a>), setelah kita mempelajari dasar-dasar memory management nantinya.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a141-tipe-data-slice">A.14.1. Tipe data slice<a class="hash-link" href="#a141-tipe-data-slice" title="Direct link to heading">​</a></h2><p>Array adalah tipe data kolektif yang isinya bertipe sejenis. Contohnya <code>["a", "b", "c"]</code> adalah sebuah array dengan elemen bertipe string dan array tersebut memiliki size <code>3</code>.</p><p>Lalu apa itu slice? menurut laman dokumentasi Rust, slice adalah:</p><blockquote><p>A slice is a dynamically sized type representing a 'view' into a sequence of elements of type T. The slice type is written as <!-- -->[T]</p><p>A dynamically-sized view into a contiguous sequence, <!-- -->[T]<!-- -->. Contiguous here means that elements are laid out so that every element is the same distance from its neighbors.</p><p>Slices are a view into a block of memory represented as a pointer and a size.</p></blockquote><p>Slice adalah representasi <em>block of memory</em> berbentuk pointer dan memiliki size yang dinamis (tidak fixed seperti array). Notasi tipe data slice adalah <code>&[T]</code> yang mana <code>T</code> adalah tipe data element.</p><p>Slice bisa dibuat dari data array (atau dari tipe kolektif data lainnya) dengan menggunakan kombinasi operator <code>&</code> dan <em>range syntax</em> <code>..</code> dengan notasi penulisan seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sliced_value1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">start_index</span><span class="token punctuation" style="color:#393A34">..</span><span class="token plain">end_index</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sliced_value2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">start_index</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token plain">end_index</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sliced_value3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">start_index</span><span class="token punctuation" style="color:#393A34">..</span><span class="token plain">end_index</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">...</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Slice juga bisa dibuat dari tipe data vector. Lebih jelasnya dibahas pada chapter <a href="/basic/vector">Vector</a>.</p></blockquote><p>Silakan perhatikan contoh berikut dan praktikkan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">16</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"numbers : {:?}, len: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"numbers[0]: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"numbers[1]: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice_a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice_a : {:?}, len: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_a</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice_a[0]: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_a</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice_a[1]: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_a</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice_b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">slice_a</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice_b : {:?}, len: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_b</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_b</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice_b[0]: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_b</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice_b[1]: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_b</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" f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kkAgEWwaNEWAKCaUHERAEAERFsAABEQbQEARFj6auKpL17hQhMA3KYqVBOfCLPcKo5zFeQmohIKhwPAHVLBauJhLUGrVWRR6+ILhwPA3VK5auJhYZdwPsvchqU0NHJmZBhmbLqMwuEAcLdkiLZhNfEU0YWfXoiKCY6ehw/moVqzbU2fh8p6w7UNw5n6CBmlJg0q1pi2pUpE8z9DoGUdEo3XyDJ3ZL/ftxlDIgEAZqtoNfGgOJZOHaPj0eb2tBpZeauJz104HADulCpWE5dUy/LCbKrWbNPleVlfs52rcDgA3CmVqybe7fvkdwfVrMurOz5n4XAAuGMqV03cOe36knoUnNSnqTueu5p4cuFwAIAJ6avSTFQTjy5tDReGy7u8ha2xJjj3JExLUCSuxis7O1yZeyvu6Lck0tyTMLGbYbuZbqgAgDtt6WuAZSzynfidNACAUqFOAgCACIv27IY81cSl4ElY6eskzN9NAICMlj6TAACwFJBJAAAQAdEWAEAERFsAABFQTRwAQIRKVhMnXqyfs5p4/GYJhGsAyKyC1cT5lb/nojXbOkVVw6fVewQASFC5auIJlb9ntDlj0yO1baYXIAMA4KpcNXF+5e85tc49Xbds07FaWvNIlbwOJrYAkE1Fq4lnkKqaeMsyjA7pjDFL6drI2gJAZlWsJl6CaF5uOKbNLNZuFHSrBQDcGZWrJl6G8MmSxw4RtSyDbKYbJjmY4AJAepWrJp5ZymriUi26w8HckUlkrAeASkg/t52oJj5eC1xnTJ+oJj5Y2HKOD6nZtqK8QZCLGF02I0ExSDpMXS3eJdVizJr/GxbxHMrMXgIA8Cx9DTBUEweApYA6CQAAIqCaOACACEufSQAAWArIJAAAiIBoCwAgAqItAIAIiLYAACIg2gIAiIBoCwAgAqItAIAIiLYAACIg2gIAiIBoCwAgAqItAIAI/x+K0xtQhqLb3AAAAABJRU5ErkJggg==" width="463" height="256" class="img_CujE"></p><p>Pada contoh di atas, variabel <code>numbers</code> didefinisikan bertipe <code>[i32; 4]</code>. Data pada variabel tersebut kemudian dipinjam ditampung pada variabel baru beranama <code>slice_a</code> yang merupakan slice bertipe <code>&[i32]</code>, dengan isi adalah element array <code>numbers</code> indeks ke <code>0</code> hingga sebelum <code>3</code> (yang berarti index ke-<code>2</code>). Dengan ini maka <code>slice_a</code> nilainya adalah <code>[12, 16, 8]</code> dengan size <code>3</code>.</p><p>Bisa dilihat pada statement print <code>slice_a[0]</code> dan <code>slice_a[1]</code>, nilai elemennya sesuai dengan dengan hasil peminjaman data array <code>numbers</code>.</p><blockquote><p>Data yang tipenya <code>&[T]</code> biasa disebut sebagai <a href="https://doc.rust-lang.org/reference/types/slice.html" target="_blank" rel="noopener noreferrer"><em>shared slice</em></a> atau cukup <em>slice</em>. Contohnya seperti <code>slice_a</code> dengan tipe data <code>&[i32]</code>.</p></blockquote><p>Slice <code>slice_a</code> bukan merupakan pemilik sebenarnya data <code>[12, 16, 8]</code>, slice tersebut hanya meminjam datanya dari <code>numbers</code> yang notabene dalah owner data <code>[12, 16, 8]</code>.</p><p>Meminjam di sini artinya variabel baru <code>slice_a</code> memiliki data yang sama, dan alamat memori (atau pointer) data tersebut juga sama yaitu mengarah ke owner sebenarnya, yang pada contoh ini adalah <code>numbers</code>.</p><blockquote><p>Di Rust, proses meminjam data secara umum disebut dengan <strong>borrowing</strong>. Variabel atau data hasil dari borrowing biasa disebut dengan <strong>reference</strong>. Lebih jelasnya akan dibahas pada chapter <a href="/basic/pointer-references">Pointer & References</a> dan <a href="/basic/borrowing">Borrowing</a>.</p><p>Variabel pemilik data yang sebenarnya disebut dengan <strong>owner</strong>. Lebih jelasnya mengenai ownership dibahas pada chapter <a href="/basic/ownership">Ownership</a></p><p>Dalam konteks slice, proses meminjam data (yg menggunakan teknik borrowing dan range syntax) disebut dengan <strong>slicing</strong>.</p></blockquote><p>Dengan menggunakan VSCode <code>rust-analyzer</code> kita bisa melihat dengan mudah tipe sebuah slice.</p><p><img loading="lazy" alt="slice" src="/assets/images/slice-2-f573e34bdab45ca8821163ae546a42ba.png" width="540" height="346" class="img_CujE"></p><p>Kembali ke pembahasan pada contoh di atas. Selain <code>slice_a</code>, ada juga slice <code>slice_b</code> yang isinya merupakan data pinjaman dari <code>slice_a</code>. Statement <code>&slice_a[1..=2]</code> artinya adalah <em>borrowing</em> slice <code>slice_a</code> mulai dari indeks ke-<code>1</code> hingga <code>2</code>. Dengan ini indeks ke-1 milik <code>slice_a</code> menjadi indeks ke-0 milik <code>slice_b</code>, ... dan seterusnya. Hasilnya, nilai <code>slice_b</code> adalah <code>[16, 8]</code> dengan size <code>2</code>.</p><p>Silakan juga cek penjelasan tambahan berikut, agar semakin paham tentang slice.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">16</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// variabel numbers isinya array [12, 16, 8, 3]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice_a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// meminjam data milik numbers elemen ke-0 hingga sebelum 3 (yaitu 2)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya adalah [12, 16, 8]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice_b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">slice_a</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// meminjam data milik slice_a elemen ke-1 hingga 2</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya adalah [16, 8]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a142-size-slice">A.14.2. Size slice<a class="hash-link" href="#a142-size-slice" title="Direct link to heading">​</a></h2><p>Gunakan method <code>len</code> untuk mencari tau size dari slice.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numbers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">16</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: 4</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice_a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">numbers</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_a</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: 3</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice_b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">slice_a</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_b</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output: 2</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a143-slice-range-syntax">A.14.3. Slice <em>range syntax</em><a class="hash-link" href="#a143-slice-range-syntax" title="Direct link to heading">​</a></h2><p>Di bawah ini adalah range syntax yang bisa digunakan untuk slicing. Variabel <code>data</code> pada contoh berikut dijadikan sebagai bahan slicing.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"d"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li><p>Notasi <code>&data[start_index..end_index]</code> untuk slicing data dari <code>start_index</code> hingga sebelum <code>end_index</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sliced_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sliced_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => ["b", "c"]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Notasi <code>&data[start_index..=end_index]</code> untuk slicing data dari <code>start_index</code> hingga <code>end_index</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sliced_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sliced_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => ["b", "c", "d"]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Notasi <code>&data[..end_index]</code> untuk slicing data dari 0 hingga sebelum <code>end_index</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sliced_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sliced_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => ["a", "b", "c"]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Notasi <code>&data[..=end_index]</code> untuk slicing data dari 0 hingga <code>end_index</code></p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sliced_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sliced_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => ["a", "b", "c"]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Notasi <code>&data[start_index..]</code> untuk slicing data dari <code>start_index</code> hingga indeks terakhir</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sliced_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sliced_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => ["b", "c", "d"]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Notasi <code>&data[..]</code> untuk slicing semua elemen yang ada</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> sliced_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sliced_data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output => ["A", "b", "c", "d"]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><blockquote><p>Perihal apa itu borrowing dan kegunaan dari operator <code>&</code> yang ditulis di awal variabel dibahas lebih detail pada chapter <a href="/basic/pointer-references">Pointer & References</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a144-mutability-pada-slice">A.14.4. Mutability pada slice<a class="hash-link" href="#a144-mutability-pada-slice" title="Direct link to heading">​</a></h2><p>Ada dua jenis data hasil operasi <em>borrowing</em> (atau biasa disebut dengan data <em>reference</em>).</p><ul><li>Read only atau shared reference, operator yang digunakan adalah <code>&</code>.</li><li>Mutable reference, operator yang digunakan adalah <code>&mut</code>.</li></ul><p>Kita akan bahas garis besarnya saja pada chapter ini. Intinya, shared reference adalah data hasil peminjaman/borrowing yang hanya bisa dibaca. Sedangkan mutable reference adalah data hasil borrowing yang bisa diubah nilainya, yang jika ini dilakukan maka akan mengubah juga data pemilik sebenarnya.</p><p>Contoh berikut adalah salah satu penerapan <code>&mut</code>. Variabel slice <code>numbers2</code> dipinjam beberapa elemennya dengan operator <code>&mut</code> ke variabel baru bernama <code>slice_e</code>. Dengan operator tersebut maka borrowing menghasilkan data <em>mutable reference</em>, data yang nilainya diperbolehkan untuk diubah meskipun data pinjaman.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> numbers2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">16</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"===== before ====="</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"numbers2 : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice_e </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> numbers2</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">slice_e</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">99</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"===== after ====="</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"slice_e : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> slice_e</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"numbers2 : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numbers2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="slice" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAAC9CAIAAABXmRFFAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb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1Gw+YW3skFUy99pwlSEAIRHlt9YOnu5WVVXTVOroR3onHwuKbc//7Uk9t+I1U5m76KtOLZj518YOWyW8JgDASEAHK4iF1MaGtDYAU+Cm11sXmBnUxoa0NgDTAn5rENATcAM9AQB4gW0FAADxLIaeAAAAzBawrQAAIB7YVgAAEA9sKwAAiAe2FQAAxAPbCgAA4oFtBQAA8cC2AgCAeGBbAQBAPLCtAAAgHthWAAAQD2wrAACIB7YVAADEA9sKAADigW0FAADx/DdZCPKsAGKjBwAAAABJRU5ErkJggg==" width="457" height="189" class="img_CujE"></p><p>Bisa dilihat, indeks ke-1 <code>slice_e</code> diubah nilainya yang sebelumnya adalah <code>16</code> menjadi <code>99</code>. Setelah itu di-print, di output nilai variabel <code>numbers2</code> juga ikut berubah. Hal ini karena perubahan data pada variabel mutable reference juga punya pengaruh ke variabel pemilik data sebenarnya (yaitu <code>numbers2</code>).</p><p>O iya, penggunaan operator <code>&mut</code> mengharuskan kita untuk tidak menuliskan keyword <code>mut</code> pada variabel yang menampung nilai borrowing.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// statement yang direkomendasikan</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice_e </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> numbers2</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// statement yang TIDAK DIREKOMENDASIKAN dan akan memunculkan warning.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> slice_e </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> numbers2</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a145-perulangan-for-in-pada-slice">A.14.5. Perulangan <code>for in</code> pada slice<a class="hash-link" href="#a145-perulangan-for-in-pada-slice" title="Direct link to heading">​</a></h2><p>Slice merupakan tipe data yang implement trait Iterator (seperti array), dan semua data yang memiliki trait tersebut bisa digunakan pada perulangan. Slice <code>&[T]</code> jika dipergunakan dalam <code>for in</code>, tipe data penampung iterasi perulangan adalah <code>&T</code>, bukan <code>T</code> yaa jadi jangan sampai keliru.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> scores1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">7</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">9</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> score </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">scores1</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?} "</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> score</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="slice" src="/assets/images/slice-5-541f1e4111281ebbac474d8d9828c0e8.png" width="462" height="272" class="img_CujE"></p><blockquote><p>Sangat dianjurkan menggunakan <code>rust-analyzer</code> jika menggunakan VSCode, agar lebih mudah melihat tipe data variabel dan informasi penting lainnya yang berguna dalam proses coding atau development.</p><ul><li>Lebih jelasnya mengenai traits dibahas pada chapter <a href="/basic/traits">Traits</a></li><li>Lebih jelasnya mengenai trait <code>Iterator</code> dibahas pada chapter <a href="/basic/trait-iterator">Trait ➜ Iterator</a></li></ul></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a146-perulangan-for-in-pada-mutable-slice">A.14.6. Perulangan <code>for in</code> pada mutable slice<a class="hash-link" href="#a146-perulangan-for-in-pada-mutable-slice" title="Direct link to heading">​</a></h2><p>Sama seperti penggunaan <code>for in</code> pada shared slice, pada contoh kasus mutable slice perbedaannya hanyalah pada tipe data penampung iterasi yaitu <code>&mut T</code>, bukan <code>&T</code>.</p><p>Pada contoh berikut kita coba eksperimen mengubah nilai elemen sebuah mutable slice yang data aslinya juga hasil dari peminjaman mutable slice.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> scores2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">7</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">9</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"(before) scores2 : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> scores2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice_f </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> scores2</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> score </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> slice_f</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">score </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"(after) scores2 : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> scores2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Variabel <code>scores</code> dipinjam menggunakan <code>&mut</code> ke variabel baru bernama <code>slice_f</code>. Kemudian <code>slice_f</code> dipinjam juga sebagai mutable slice pada perulangan <code>for in</code>.</p><p>Setelah di-increment nilainya menggunakan <code>*score += 1</code> bisa dilihat hasil akhirnya juga mengubah nilai variabel <code>scores2</code> yang merupakan <em>owner</em> atau pemilik data sebenarnya.</p><p><img loading="lazy" alt="slice" src="/assets/images/slice-6-393c62bd8cdd9da05fcae56436a3cacd.png" width="467" height="376" class="img_CujE"></p><p>Operasi increment pada <code>score</code> tidak bisa dituliskan dalam bentuk <code>score += 1</code> karena tipe data score adalah pointer mutable reference (ditandai dengan adanya <code>&mut</code>), untuk increment nilainya perlu di-<em>dereference</em> terlebih dahulu menggunakan operator <code>*</code>. Lebih jelasnya kita bahas pada chapter <a href="/basic/pointer-references">Pointer & References</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a147-append-slice">A.14.7. Append slice<a class="hash-link" href="#a147-append-slice" title="Direct link to heading">​</a></h2><p>Slice by default tidak mendukung operasi append. Sebenarnya bisa saja dilakukan tapi agak panjang caranya (silakan cari referensinya di Google untuk ini).</p><p>Perlu diketahui, jika kebutuhannya adalah untuk menampung jenis data yang size-nya bisa bertamah, penulis anjurkan untuk menggunakan <a href="/basic/vector">Vector</a> yang beberapa bab lagi akan kita bahas.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a148-memory-management-pada-slice">A.14.8. Memory management pada slice<a class="hash-link" href="#a148-memory-management-pada-slice" title="Direct link to heading">​</a></h2><p>Nantinya setelah selesai dengan pembahasan dasar memory management di Rust, kita akan bahas lagi topik slice tapi dari sudut pandang memory management pada chapter <a href="/basic/slice-memory-management">Memory Management ➜ Slice</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a149-summary">A.14.9. Summary<a class="hash-link" href="#a149-summary" title="Direct link to heading">​</a></h2><p>Catatan ringkas perihal slice:</p><ul><li>Slice memiliki notasi <code>&[T]</code><ul><li><code>&</code> di situ artinya adalah operasi borrowing/peminjaman</li><li><code>T</code> adalah tipe data tiap elemen</li></ul></li><li>Slice bisa terbentuk dari hasil meminjam data array, vector, atau tipe data kolektif lainnya</li><li>Data slice adalah selalu data pinjaman</li><li>Slice memiliki lebar/size</li><li>Slicing adalah cara pengaksesan slice menggunakan <em>range syntax</em></li><li>Slice bisa immutable, bisa juga mutable (menggunakan <code>&mut</code>)</li></ul><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/slice" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../slice</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch04-03-slices.html#the-slice-type" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch04-03-slices.html#the-slice-type</a></li><li><a href="https://doc.rust-lang.org/std/primitive.slice.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/primitive.slice.html</a></li><li><a href="https://doc.rust-lang.org/std/iter/trait.Iterator.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/iter/trait.Iterator.html</a></li><li><a href="https://doc.rust-lang.org/reference/types/slice.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/types/slice.html</a></li><li><a href="https://doc.rust-lang.org/nomicon/references.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/nomicon/references.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/primitives/array.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/primitives/array.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/array"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.13. Array</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/tuple"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.15. Tuple</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a141-tipe-data-slice" class="table-of-contents__link toc-highlight">A.14.1. Tipe data slice</a></li><li><a href="#a142-size-slice" class="table-of-contents__link toc-highlight">A.14.2. Size slice</a></li><li><a href="#a143-slice-range-syntax" class="table-of-contents__link toc-highlight">A.14.3. Slice <em>range syntax</em></a></li><li><a href="#a144-mutability-pada-slice" class="table-of-contents__link toc-highlight">A.14.4. Mutability pada slice</a></li><li><a href="#a145-perulangan-for-in-pada-slice" class="table-of-contents__link toc-highlight">A.14.5. Perulangan <code>for in</code> pada slice</a></li><li><a href="#a146-perulangan-for-in-pada-mutable-slice" class="table-of-contents__link toc-highlight">A.14.6. Perulangan <code>for in</code> pada mutable slice</a></li><li><a href="#a147-append-slice" class="table-of-contents__link toc-highlight">A.14.7. Append slice</a></li><li><a href="#a148-memory-management-pada-slice" class="table-of-contents__link toc-highlight">A.14.8. Memory management pada slice</a></li><li><a href="#a149-summary" class="table-of-contents__link toc-highlight">A.14.9. Summary</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/static.html b/basic/static.html index 34e94f40..3ecde582 100644 --- a/basic/static.html +++ b/basic/static.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/static/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/static/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.43. Static Item","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/static/#webpage"},"wordCount":539,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/static/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/static/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/static","name":"A.43. Static Item","description":"Pada chapter ini kita akan bahas tentang apa itu static item, dan perbedaanya dibanding konstanta.","datePublished":"2024-08-01T10:17:30.596Z","dateModified":"2024-08-01T10:17:30.596Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/static/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/static"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/static/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.43. Static Item","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/static/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/static/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.43. Static Item","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/static/#webpage"},"wordCount":539,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/static/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/static/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/static","name":"A.43. Static Item","description":"Pada chapter ini kita akan bahas tentang apa itu static item, dan perbedaanya dibanding konstanta.","datePublished":"2024-08-30T07:44:50.662Z","dateModified":"2024-08-30T07:44:50.662Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/static/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/static"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/static/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.43. Static Item","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.43. Static Item</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.43. Static Item</h1></header><p>Pada chapter ini kita akan bahas tentang apa itu static item, dan perbedaanya dibanding konstanta.</p><p>Namun sebelum masuk ke inti pembahasan, mari kita sedikit belajar tentang apa itu <em>lifetime</em> dalam Rust programming.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a431-sekilas-tentang-lifetime">A.43.1. Sekilas tentang <em>lifetime</em><a class="hash-link" href="#a431-sekilas-tentang-lifetime" title="Direct link to heading">​</a></h2><p>Di Rust ada yang disebut dengan <strong>lifetime</strong>. Lifetime merupakan sebuah identifier yang digunakan compiler untuk memantau berapa lama reference valid.</p><p>Di balik layar, Rust compiler (lebih tepatnya Rust borrow checker) menggunakan sebuah anotasi dalam penerapan lifetime. Penulisan anotasinya diawali tanda petik satu <code>'</code>, contohnya <code>'a</code>, <code>'b</code>, dan <code>'c</code>.</p><p>Untuk sekarang, silakan dipahami bahwa sebuah syntax yang diawali dengan tanda <code>'</code> (contohnya seperti <code>'a</code>) adalah lifetime.</p><blockquote><p>Pembahasan detail mengenai lifetime dibahas pada chapter selanjutnya, yaitu <a href="/basic/lifetime">Lifetime</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a432-static-item">A.43.2. Static item<a class="hash-link" href="#a432-static-item" title="Direct link to heading">​</a></h2><p>Ok, sekarang kembali ke topik utama, yaitu static. Static adalah item yang mirip dengan <a href="/basic/konstanta">Konstanta</a>, tapi memiliki perbedaan yaitu alamat memory yang dialokasikan untuk menampung data static item adalah fix/jelas. Semua reference terhadap static item mengarah ke alamat memory yang sama.</p><p>Dengan karakteristik yang seperti itu, static tepat diterapkan pada data yang sifatnya shared atau bisa diakses secara global.</p><p>Ada dua cara membuat static item:</p><ul><li>Menggunakan keyword <code>static</code> pada pendefinisian konstanta</li><li>Menggunakan lifetime <code>'static</code> pada tipe data string literal (<code>&str</code>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a433-keyword-static">A.43.3. Keyword <code>static</code><a class="hash-link" href="#a433-keyword-static" title="Direct link to heading">​</a></h2><p>Ok, kita terapkan cara pertama, penerapan keyword <code>static</code> untuk pembuatan konstanta.</p><p>Pada deklarasi konstanta static, harus ditulis juga tipe datanya secara eksplisit.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">static</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">PI</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"PI: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">PI</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Cukup mudah bukan?</p><blockquote><p>Konstanta static bisa saja didefinisikan mutable, tetapi dengan konsekuensi item tersebut akan menjadi <em>unsafe</em>.</p><p>Lebih jelasnya mengenai topik ini akan dibahas nantinya pada chapter terpisah, yaitu <a href="#/wip/safe-unsafe">Safe & Unsafe</a>.</p></blockquote><p>Ok, sekarang kita coba terapkan keyword static pada tipe lainnya, contohnya <code>String</code>.</p><p><img loading="lazy" alt="Static string" src="/assets/images/static-1-095ee9ad8503b55f94f1fb79ef51dbca.png" width="765" height="259" class="img_ev3q"></p><p>Hmm, malah error.</p><p>Perlu diketahui bahwa keyword <code>static</code> bisa digunakan pada semua tipe data primitif. Selain itu bisa juga diterapkan dalam <em>constants function</em> (yang nantinya dibahas pada chapter <a href="#/wip/constant-evaluation">Constant Evaluation</a>), <a href="/basic/struct#a247-tuple-struct">Tuple Struct</a>, dan juga variant <a href="/basic/tuple">Tuple</a> lainnya, tetapi tidak bisa digunakan untuk custom type seperti <code>String</code>.</p><p>Lalu bagaimana jika ada kebutuhan membuat konstanta bertipe string? Solusinya dengan menggunakan tipe data <code>&'static str</code> yang sebentar lagi akan kita bahas.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a434-lifetime-static">A.43.4. Lifetime <code>'static</code><a class="hash-link" href="#a434-lifetime-static" title="Direct link to heading">​</a></h2><p>Lifetime <code>'static</code> digunakan untuk deklarasi reference sebagai static item. Data yang memiliki lifetime ini tidak akan pernah di-dealokasi kecuali eksekusi program selesai.</p><blockquote><p>Karena alasan di atas, ada baiknya data dengan lifetime static dideklarasikan secara global.</p><p>Dimisalkan ada variabel dengan lifetime ini dideklarasikan dalam suatu block, variabel tersebut tidak akan di-dealokasi meskipun eksekusi block selesai nantinya.</p></blockquote><p>Lifetime ini biasa dikombinasikan dengan tipe data pointer, contohnya seperti <code>&str</code> jika dikombinasikan dengan lifetime <code>'static</code> jadinya adalah <code>&'static str</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">VERSION</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"v1.2.3"</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sebelumnya telah dijelaskan bahwa custom type <code>String</code> tidak bisa digunakan untuk menyimpan data string sebagai static item, dan cara di atas ini adalah solusinya.</p><p>Penulisannya agak kurang friendly memang (<code>&'static str</code>), namun kabar baiknya semenjak Rust versi 1.17 rilis di tahun 2017, by default semua item yang dideklarasikan menggunakan keyword <code>static</code> ataupun <code>const</code> otomatis memiliki <code>'static lifetime</code>. Jadi sekarang cukup tulis saja:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">VERSION</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"v1.2.3"</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">VERSION</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"v1.2.3"</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a435-static-item-data-literal">A.43.5. Static item data literal<a class="hash-link" href="#a435-static-item-data-literal" title="Direct link to heading">​</a></h2><p>Pada chapter <a href="/basic/borrowing#a347-owner-dan-borrower-data-literal">Borrowing</a> sempat kita bahas sedikit tentang siapa owner dan borrower data literal.</p><p>Tipe <code>&str</code> adalah salah satu tipe data yang tidak memiliki owner (atau boleh disimpulkan owner-nya adalah program). Pada variabel yang bertipe ini, yang ia tampung adalah data pinjaman, jadi variabel tersebut bukan owner. Contohnya pada kode berikut konstanta <code>VERSION</code> dan <code>BUILD_COUNTER</code> di atas adalah borrower.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">VERSION</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"v1.2.3"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">BUILD_COUNTER</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token number" style="color:#36acaa">15</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Yang penting untuk diperhatikan bukan siapa owner-nya, tapi bagaimana kita memastikan data pinjaman tersebut tidak di-dealokasi. Inilah kenapa lifetime <code>'static</code> dan/atau keyword <code>static</code> & <code>const</code> dipergunakan. Dengan adanya lifetime tersebut, data borrow tidak akan pernah di-dealokasi.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/static_example" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../static_example</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/reference/items/static-items.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/items/static-items.html</a></li><li><a href="https://doc.rust-lang.org/beta/rust-by-example/custom_types/constants.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/beta/rust-by-example/custom_types/constants.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/scope/lifetime/static_lifetime.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/scope/lifetime/static_lifetime.html</a></li><li><a href="https://stackoverflow.com/questions/49684657/what-is-the-difference-between-str-and-static-str-in-a-static-or-const" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/49684657/what-is-the-difference-between-str-and-static-str-in-a-static-or-const</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/pattern-matching"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.42. Pattern Matching</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/lifetime"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.44. Lifetime</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a431-sekilas-tentang-lifetime" class="table-of-contents__link toc-highlight">A.43.1. Sekilas tentang <em>lifetime</em></a></li><li><a href="#a432-static-item" class="table-of-contents__link toc-highlight">A.43.2. Static item</a></li><li><a href="#a433-keyword-static" class="table-of-contents__link toc-highlight">A.43.3. Keyword <code>static</code></a></li><li><a href="#a434-lifetime-static" class="table-of-contents__link toc-highlight">A.43.4. Lifetime <code>'static</code></a></li><li><a href="#a435-static-item-data-literal" class="table-of-contents__link toc-highlight">A.43.5. Static item data literal</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.43. Static Item</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.43. Static Item</h1></header><p>Pada chapter ini kita akan bahas tentang apa itu static item, dan perbedaanya dibanding konstanta.</p><p>Namun sebelum masuk ke inti pembahasan, mari kita sedikit belajar tentang apa itu <em>lifetime</em> dalam Rust programming.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a431-sekilas-tentang-lifetime">A.43.1. Sekilas tentang <em>lifetime</em><a class="hash-link" href="#a431-sekilas-tentang-lifetime" title="Direct link to heading">​</a></h2><p>Di Rust ada yang disebut dengan <strong>lifetime</strong>. Lifetime merupakan sebuah identifier yang digunakan compiler untuk memantau berapa lama reference valid.</p><p>Di balik layar, Rust compiler (lebih tepatnya Rust borrow checker) menggunakan sebuah anotasi dalam penerapan lifetime. Penulisan anotasinya diawali tanda petik satu <code>'</code>, contohnya <code>'a</code>, <code>'b</code>, dan <code>'c</code>.</p><p>Untuk sekarang, silakan dipahami bahwa sebuah syntax yang diawali dengan tanda <code>'</code> (contohnya seperti <code>'a</code>) adalah lifetime.</p><blockquote><p>Pembahasan detail mengenai lifetime dibahas pada chapter selanjutnya, yaitu <a href="/basic/lifetime">Lifetime</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a432-static-item">A.43.2. Static item<a class="hash-link" href="#a432-static-item" title="Direct link to heading">​</a></h2><p>Ok, sekarang kembali ke topik utama, yaitu static. Static adalah item yang mirip dengan <a href="/basic/konstanta">Konstanta</a>, tapi memiliki perbedaan yaitu alamat memory yang dialokasikan untuk menampung data static item adalah fix/jelas. Semua reference terhadap static item mengarah ke alamat memory yang sama.</p><p>Dengan karakteristik yang seperti itu, static tepat diterapkan pada data yang sifatnya shared atau bisa diakses secara global.</p><p>Ada dua cara membuat static item:</p><ul><li>Menggunakan keyword <code>static</code> pada pendefinisian konstanta</li><li>Menggunakan lifetime <code>'static</code> pada tipe data string literal (<code>&str</code>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a433-keyword-static">A.43.3. Keyword <code>static</code><a class="hash-link" href="#a433-keyword-static" title="Direct link to heading">​</a></h2><p>Ok, kita terapkan cara pertama, penerapan keyword <code>static</code> untuk pembuatan konstanta.</p><p>Pada deklarasi konstanta static, harus ditulis juga tipe datanya secara eksplisit.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">static</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">PI</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"PI: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">PI</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Cukup mudah bukan?</p><blockquote><p>Konstanta static bisa saja didefinisikan mutable, tetapi dengan konsekuensi item tersebut akan menjadi <em>unsafe</em>.</p><p>Lebih jelasnya mengenai topik ini akan dibahas nantinya pada chapter terpisah, yaitu <a href="#/wip/safe-unsafe">Safe & Unsafe</a>.</p></blockquote><p>Ok, sekarang kita coba terapkan keyword static pada tipe lainnya, contohnya <code>String</code>.</p><p><img loading="eager" fetchpriority="high" alt="Static string" src="/assets/images/static-1-095ee9ad8503b55f94f1fb79ef51dbca.png" width="765" height="259" class="img_CujE"></p><p>Hmm, malah error.</p><p>Perlu diketahui bahwa keyword <code>static</code> bisa digunakan pada semua tipe data primitif. Selain itu bisa juga diterapkan dalam <em>constants function</em> (yang nantinya dibahas pada chapter <a href="#/wip/constant-evaluation">Constant Evaluation</a>), <a href="/basic/struct#a247-tuple-struct">Tuple Struct</a>, dan juga variant <a href="/basic/tuple">Tuple</a> lainnya, tetapi tidak bisa digunakan untuk custom type seperti <code>String</code>.</p><p>Lalu bagaimana jika ada kebutuhan membuat konstanta bertipe string? Solusinya dengan menggunakan tipe data <code>&'static str</code> yang sebentar lagi akan kita bahas.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a434-lifetime-static">A.43.4. Lifetime <code>'static</code><a class="hash-link" href="#a434-lifetime-static" title="Direct link to heading">​</a></h2><p>Lifetime <code>'static</code> digunakan untuk deklarasi reference sebagai static item. Data yang memiliki lifetime ini tidak akan pernah di-dealokasi kecuali eksekusi program selesai.</p><blockquote><p>Karena alasan di atas, ada baiknya data dengan lifetime static dideklarasikan secara global.</p><p>Dimisalkan ada variabel dengan lifetime ini dideklarasikan dalam suatu block, variabel tersebut tidak akan di-dealokasi meskipun eksekusi block selesai nantinya.</p></blockquote><p>Lifetime ini biasa dikombinasikan dengan tipe data pointer, contohnya seperti <code>&str</code> jika dikombinasikan dengan lifetime <code>'static</code> jadinya adalah <code>&'static str</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">VERSION</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"v1.2.3"</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sebelumnya telah dijelaskan bahwa custom type <code>String</code> tidak bisa digunakan untuk menyimpan data string sebagai static item, dan cara di atas ini adalah solusinya.</p><p>Penulisannya agak kurang friendly memang (<code>&'static str</code>), namun kabar baiknya semenjak Rust versi 1.17 rilis di tahun 2017, by default semua item yang dideklarasikan menggunakan keyword <code>static</code> ataupun <code>const</code> otomatis memiliki <code>'static lifetime</code>. Jadi sekarang cukup tulis saja:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">VERSION</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"v1.2.3"</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">VERSION</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'static</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"v1.2.3"</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a435-static-item-data-literal">A.43.5. Static item data literal<a class="hash-link" href="#a435-static-item-data-literal" title="Direct link to heading">​</a></h2><p>Pada chapter <a href="/basic/borrowing#a347-owner-dan-borrower-data-literal">Borrowing</a> sempat kita bahas sedikit tentang siapa owner dan borrower data literal.</p><p>Tipe <code>&str</code> adalah salah satu tipe data yang tidak memiliki owner (atau boleh disimpulkan owner-nya adalah program). Pada variabel yang bertipe ini, yang ia tampung adalah data pinjaman, jadi variabel tersebut bukan owner. Contohnya pada kode berikut konstanta <code>VERSION</code> dan <code>BUILD_COUNTER</code> di atas adalah borrower.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">VERSION</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"v1.2.3"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">BUILD_COUNTER</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token number" style="color:#36acaa">15</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Yang penting untuk diperhatikan bukan siapa owner-nya, tapi bagaimana kita memastikan data pinjaman tersebut tidak di-dealokasi. Inilah kenapa lifetime <code>'static</code> dan/atau keyword <code>static</code> & <code>const</code> dipergunakan. Dengan adanya lifetime tersebut, data borrow tidak akan pernah di-dealokasi.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/static_example" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../static_example</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/reference/items/static-items.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/items/static-items.html</a></li><li><a href="https://doc.rust-lang.org/beta/rust-by-example/custom_types/constants.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/beta/rust-by-example/custom_types/constants.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/scope/lifetime/static_lifetime.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/scope/lifetime/static_lifetime.html</a></li><li><a href="https://stackoverflow.com/questions/49684657/what-is-the-difference-between-str-and-static-str-in-a-static-or-const" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/49684657/what-is-the-difference-between-str-and-static-str-in-a-static-or-const</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/pattern-matching"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.42. Pattern Matching</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/lifetime"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.44. Lifetime</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a431-sekilas-tentang-lifetime" class="table-of-contents__link toc-highlight">A.43.1. Sekilas tentang <em>lifetime</em></a></li><li><a href="#a432-static-item" class="table-of-contents__link toc-highlight">A.43.2. Static item</a></li><li><a href="#a433-keyword-static" class="table-of-contents__link toc-highlight">A.43.3. Keyword <code>static</code></a></li><li><a href="#a434-lifetime-static" class="table-of-contents__link toc-highlight">A.43.4. Lifetime <code>'static</code></a></li><li><a href="#a435-static-item-data-literal" class="table-of-contents__link toc-highlight">A.43.5. Static item data literal</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/string-slice-vs-string-literal.html b/basic/string-slice-vs-string-literal.html index 2a927146..54daefd6 100644 --- a/basic/string-slice-vs-string-literal.html +++ b/basic/string-slice-vs-string-literal.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/string-slice-vs-string-literal/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/string-slice-vs-string-literal/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.46. String Literal (&str) vs. String Custom Type","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/string-slice-vs-string-literal/#webpage"},"wordCount":752,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/string-slice-vs-string-literal/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/string-slice-vs-string-literal/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/string-slice-vs-string-literal","name":"A.46. String Literal (&str) vs. String Custom Type","description":"Pada chapter sebelumnya kita telah membahas tentang bagaimana data slice di-manage di memory. Ada beberapa tipe data yang masuk dalam kategori slice, yang salah satunya adalah string slice atau String.","datePublished":"2024-08-01T10:17:30.752Z","dateModified":"2024-08-01T10:17:30.752Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/string-slice-vs-string-literal/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/string-slice-vs-string-literal"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/string-slice-vs-string-literal/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.46. String Literal (&str) vs. String Custom Type","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/string-slice-vs-string-literal/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/string-slice-vs-string-literal/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.46. String Literal (&str) vs. String Custom Type","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/string-slice-vs-string-literal/#webpage"},"wordCount":752,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/string-slice-vs-string-literal/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/string-slice-vs-string-literal/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/string-slice-vs-string-literal","name":"A.46. String Literal (&str) vs. String Custom Type","description":"Pada chapter sebelumnya kita telah membahas tentang bagaimana data slice di-manage di memory. Ada beberapa tipe data yang masuk dalam kategori slice, yang salah satunya adalah string slice atau String.","datePublished":"2024-08-30T07:44:50.816Z","dateModified":"2024-08-30T07:44:50.816Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/string-slice-vs-string-literal/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/string-slice-vs-string-literal"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/string-slice-vs-string-literal/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.46. String Literal (&str) vs. String Custom Type","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.46. String Literal (&str) vs. String Custom Type</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.46. String Literal (&str) vs. String Custom Type</h1></header><p>Pada chapter sebelumnya kita telah membahas tentang bagaimana data slice di-manage di memory. Ada beberapa tipe data yang masuk dalam kategori slice, yang salah satunya adalah string slice atau <code>String</code>.</p><p>Di chapter ini kita akan bahas apa perbedaan antara tipe data string slice (<code>String</code>) dan string literal <code>&str</code>.</p><p>Pembahasan mengenai topik ini sengaja dilakukan tidak di awal-awal ebook, karena ada banyak hal yang perlu dipahami sebelum mempelajarinya, contohnya seperti aspek management memory dan ownership. Dan karena topik tersebut sudah selesai dibahas, berarti ini adalah waktu yang tepat untuk membahas string slice.</p><blockquote><p>Silakan pelajari kembali pembahasan detail tentang tipe slice pada chapter sebelumnya jika diperlukan. Chapter <a href="/basic/slice-memory-management">Slice Memory Management</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a461-string-slice-string">A.46.1. String slice (<code>String</code>)<a class="hash-link" href="#a461-string-slice-string" title="Direct link to heading">​</a></h2><p>String slice atau custom type <code>String</code> merupakan tipe data bawaan Rust, dibuat via <code>struct</code>, kegunaannya untuk menampung data UTF-8 bytes yang dinamis (bisa berkembang isinya).</p><p><code>String</code> masuk dalam kategori tipe data slice, isinya adalah data kolektif bertipe bytes, datanya disimpan di heap memory, dan metadata-nya di stack memory. Tipe data ini dikategorikan sebagai tipe data <strong>owned</strong>, yang artinya owner data bisa direpresentasikan oleh variabel. Sebagai contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Lisa Blackpink"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str1: {str1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Variabel <code>str1</code> di atas merupakan owner dari string <code>Lisa Blackpink</code>. Dari string tersebut operasi borrow bisa dilakukan. Contohnya bisa dilihat pada kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Lisa Blackpink"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">str1</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// "Lisa Blackpink"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">str1</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">7</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// " Bl"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><code>slice1</code> adalah variabel baru yang datanya didapat dari borrowing seluruh elemen string milik <code>str1</code>. Sedangkan variabel <code>slice2</code> hanya meminjam elemen indeks ke-4 hingga elemen sebelum 7 (yaitu 6).</p><p>Karena <code>String</code> sebenarnya adalah UTF-8 bytes, maka kita bisa juga membuatnya menggunakan data Bytes. Tipe bytes (atau kadang disebut <em>chars</em>) di Rust direpresentasikan oleh tipe <code>[u8]</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> bytes </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">69</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">108</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">117</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">118</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">101</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">105</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">116</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">105</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">101</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">243</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">159</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">164</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">152</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_utf8</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">bytes</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str2: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> str2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, data bytes dipersiapkan dalam bentuk <code>Vec<u8></code>. Data tersebut kemudian digunakan untuk membuat string menggunakan fungsi <code>String::from_utf8()</code>. Nilai balik fungsi tersebut adalah <code>Result<String, FromUtf8Error></code>. Pemanggilan method <code>unwrap</code> di situ agar data <code>String</code>-nya di-return.</p><p><img loading="lazy" alt="String slcie vs string literal" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcoAAABsCAIAAABlzGXMAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6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mTWiRVlp5LsPffeLXj1r/f7f7eObNfvbn7lkOTIPabXv11b3SvHFFhEDt1mdZKr+LXYikeHAco2dQPjOo1j+cJmqmllHmm8ekff+jGW9t/7793h+OSIA7KeyVGxs5F/e9nZwG3vvjoPi1DEKRXYgT8/lev//tvxZGs3X+5o0UQpFeCIAiC9EoQBEF6JQiCIL0SBEEQpFeCIAjSK0EQBOmVIAiCIL0SBEGQXgmCIPYA/wcGv+k9gijq8gAAAABJRU5ErkJggg==" width="458" height="108" class="img_ev3q"></p><blockquote><p>Kita akan bahas tipe data <code>Result</code> pada chapter terpisah, <a href="/basic/result-type">Tipe Data ➜ Result</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a462-string-literal-str">A.46.2. String literal (<code>&str</code>)<a class="hash-link" href="#a462-string-literal-str" title="Direct link to heading">​</a></h2><p>Tipe data string literal atau <code>&str</code> adalah tipe yang menampung data kolektif UTF-8 bytes (seperti <code>String</code>) tetapi <strong>immutable</strong> dan disimpannya tidak di heap dan tidak juga di stack, melainkan di static storage.</p><p>String literal hanya bisa direpresentasikan dalam bentuk reference <code>&str</code> (pointer yang mengarah ke suatu bytes).</p><p>Tipe <code>&str</code> termasuk kategori tipe data yang <strong>unowned</strong> atau reference tanpa owner (atau boleh juga diartikan sebagai tipe data yang owner-nya adalah program).</p><p>Rust menjamin data string literal selalu valid. Kita juga bisa menentukan lifetime-nya secara eksplist jike diperlukan, contohnya pada tipe <code>&'static str</code>.</p><p>Cara termudah membuat <code>&str</code> adalah menggunakan string literal.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Helena Iren Michaelsen Epica"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str3: {str3}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a463-konversi-data-string">A.46.3. Konversi data string<a class="hash-link" href="#a463-konversi-data-string" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-konversi-string-ke-str">◉ Konversi <code>String</code> ke <code>&str</code><a class="hash-link" href="#-konversi-string-ke-str" title="Direct link to heading">​</a></h3><p>Data bertipe <code>&str</code> juga didapat melalui operasi borrow dari data bertipe <code>String</code>, caranya dengan menggunakan method <code>as_str</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str4</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Hiroyuki Sawano"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str4_slice1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> str4</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str4: {str4}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// str4: Hiroyuki Sawano</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str4_slice1: {str4_slice1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// str4_slice1: Hiroyuki Sawano</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa juga menggunakan method <code>as_mut_str</code> untuk mutable borrow. Namun dalam penggunaannya, owner data diwajibkan mutable. Contohnya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> str5</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Hans Zimmer"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str5_slice1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> str5</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_mut_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str5: {str5}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str5_slice1: {str5_slice1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="String slcie vs string literal" src="/assets/images/string-slice-vs-string-literal-2-1b0caccba69a37db29f101f921a76df1.png" width="650" height="237" class="img_ev3q"></p><p>Hmm, error. Perlu diingat kembali aturan <a href="/basic/borrowing">Borrowing</a> bahwa tidak boleh ada operasi borrow dan juga mutable borrow dalam satu waktu. Pada contoh di atas, <code>str5</code> dipinjam oleh <code>str5_slice1</code> menggunakan method <code>as_mut_str</code> (yang di dalamnya menjalankan operasi mutable borrow). Selain itu, operasi mutable borrow maksimal hanya boleh dilakukan 1x dalam satu waktu, inilah kenapa ketika kita berusaha menampilkan data <code>str5</code> hasilnya error, karena statement print data <code>str5</code> adalah operasi borrow.</p><p>Solusinya masalah di atas bisa menggunakan block expression:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> str5</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Hans Zimmer"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str5_slice1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> str5</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_mut_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str5_slice1: {str5_slice1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// str5_slice1: Hans Zimmer</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str5: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> str5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// str5_slice1: Hans Zimmer</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Tipe data <code>String</code> bisa diakses mutable reference-nya karena memang tipe tersebut size-nya adalah dinamis.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-konversi-str-ke-string">◉ Konversi <code>&str</code> ke <code>String</code><a class="hash-link" href="#-konversi-str-ke-string" title="Direct link to heading">​</a></h3><p>Masih dalam topik konversi tipe data string. Tipe <code>&str</code> memiliki method bernama <code>to_string</code> yang gunanya adalah untuk konversi data <code>&str</code> ke <code>String</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str6</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"John Towner Williams"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str6_slice1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> str6</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str6: {str6}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// str6: John Towner Williams</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str6_slice1: {str6_slice1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// str6_slice1: John Towner Williams</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Konversi pada tipe data ini sedikit berbeda dibandingkan konversi <code>String</code> ke <code>&str</code>. Pada contoh di atas, yang terjadi adalah data <code>&str</code> di-copy sebagai data baru bertipe <code>String</code> yang kemudian ditampung variabel <code>str6_slice1</code> (yang juga berperan sebagai owner untuk data baru tersebut).</p><p>Method <code>to_string</code> melakukan operasi copy, bukan borrow. Artinya setelah dipanggil akan ada 2 data yang reference-nya sudah berbeda.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a464-string-literal--string-slice">A.46.4. String literal & string slice<a class="hash-link" href="#a464-string-literal--string-slice" title="Direct link to heading">​</a></h2><p>Tipe <code>String</code> memiliki hubungan dekat dengan <code>&str</code>. Data bertipe <code>String</code> reference-nya bisa diakses dalam bentuk <code>&String</code>, maupun dalam bentuk <code>&str</code> (menggunakan method <code>as_str</code> atau <code>as_mut_str</code>). Data text pada string tersebut bisa dimodifikasi, ditambahi, dan juga dikurangi.</p><p>Berbeda dengan data bertipe <code>&str</code> <strong>(di paragraph ini dan setelahnya yang kita bahas adalah data yang dari awal tipe-nya sudah <code>&str</code>, bukan data hasil operasi pinjam dari <code>String</code>)</strong>, data bertipe <code>&str</code> adalah fixed dan immutable. Konversi data <code>&str</code> ke <code>String</code> menghasilkan data baru dengan owner baru. Bisa dibilang sangat terbatas apa yang bisa kita lakukan pada tipe data <code>&str</code>.</p><p>Meski demikian, tipe <code>&str</code> lebih cepat performa-nya dibanding <code>String</code> karena disimpan di static storage. Selain itu dijamin valid oleh Rust. Kekurangannya hanya pada ownership-nya. Tipe <code>&str</code> adalah <strong>unowned</strong>, operasi mutability tidak bisa dilakukan pada tipe ini.</p><p>Dalam case normal, sangat dianjurkan untuk menggunakan <code>&str</code>, kecuali memang yang dibutuhkan adalah <strong>owned</strong> string.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/string_slice_vs_string_literal" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../string_slice_vs_string_literal</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/tipe-data-string-literal">Tipe Data ➜ String Literal (&str)</a></li><li><a href="/basic/slice-memory-management">Slice Memory Management</a></li><li><a href="/basic/tipe-data-custom-type-string-slice">Tipe Data ➜ String Custom Type</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch08-02-strings.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch08-02-strings.html</a></li><li><a href="https://users.rust-lang.org/t/str-string-literals/29635" target="_blank" rel="noopener noreferrer">https://users.rust-lang.org/t/str-string-literals/29635</a></li><li><a href="https://www.quora.com/Why-does-Rust-have-two-different-string-types-static-str-and-String" target="_blank" rel="noopener noreferrer">https://www.quora.com/Why-does-Rust-have-two-different-string-types-static-str-and-String</a></li><li><a href="https://stackoverflow.com/questions/24158114/what-are-the-differences-between-rusts-string-and-str" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/24158114/what-are-the-differences-between-rusts-string-and-str</a></li><li><a href="https://stackoverflow.com/questions/30154541/how-do-i-concatenate-strings" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/30154541/how-do-i-concatenate-strings</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/slice-memory-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.45. Slice Memory Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/tipe-data-custom-type-string-slice"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.47. Tipe Data ➜ String Custom Type</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a461-string-slice-string" class="table-of-contents__link toc-highlight">A.46.1. String slice (<code>String</code>)</a></li><li><a href="#a462-string-literal-str" class="table-of-contents__link toc-highlight">A.46.2. String literal (<code>&str</code>)</a></li><li><a href="#a463-konversi-data-string" class="table-of-contents__link toc-highlight">A.46.3. Konversi data string</a><ul><li><a href="#-konversi-string-ke-str" class="table-of-contents__link toc-highlight">◉ Konversi <code>String</code> ke <code>&str</code></a></li><li><a href="#-konversi-str-ke-string" class="table-of-contents__link toc-highlight">◉ Konversi <code>&str</code> ke <code>String</code></a></li></ul></li><li><a href="#a464-string-literal--string-slice" class="table-of-contents__link toc-highlight">A.46.4. String literal & string slice</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.46. String Literal (&str) vs. String Custom Type</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.46. String Literal (&str) vs. String Custom Type</h1></header><p>Pada chapter sebelumnya kita telah membahas tentang bagaimana data slice di-manage di memory. Ada beberapa tipe data yang masuk dalam kategori slice, yang salah satunya adalah string slice atau <code>String</code>.</p><p>Di chapter ini kita akan bahas apa perbedaan antara tipe data string slice (<code>String</code>) dan string literal <code>&str</code>.</p><p>Pembahasan mengenai topik ini sengaja dilakukan tidak di awal-awal ebook, karena ada banyak hal yang perlu dipahami sebelum mempelajarinya, contohnya seperti aspek management memory dan ownership. Dan karena topik tersebut sudah selesai dibahas, berarti ini adalah waktu yang tepat untuk membahas string slice.</p><blockquote><p>Silakan pelajari kembali pembahasan detail tentang tipe slice pada chapter sebelumnya jika diperlukan. Chapter <a href="/basic/slice-memory-management">Slice Memory Management</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a461-string-slice-string">A.46.1. String slice (<code>String</code>)<a class="hash-link" href="#a461-string-slice-string" title="Direct link to heading">​</a></h2><p>String slice atau custom type <code>String</code> merupakan tipe data bawaan Rust, dibuat via <code>struct</code>, kegunaannya untuk menampung data UTF-8 bytes yang dinamis (bisa berkembang isinya).</p><p><code>String</code> masuk dalam kategori tipe data slice, isinya adalah data kolektif bertipe bytes, datanya disimpan di heap memory, dan metadata-nya di stack memory. Tipe data ini dikategorikan sebagai tipe data <strong>owned</strong>, yang artinya owner data bisa direpresentasikan oleh variabel. Sebagai contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Lisa Blackpink"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str1: {str1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Variabel <code>str1</code> di atas merupakan owner dari string <code>Lisa Blackpink</code>. Dari string tersebut operasi borrow bisa dilakukan. Contohnya bisa dilihat pada kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Lisa Blackpink"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">str1</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// "Lisa Blackpink"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> slice2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">str1</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">7</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// " Bl"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><code>slice1</code> adalah variabel baru yang datanya didapat dari borrowing seluruh elemen string milik <code>str1</code>. Sedangkan variabel <code>slice2</code> hanya meminjam elemen indeks ke-4 hingga elemen sebelum 7 (yaitu 6).</p><p>Karena <code>String</code> sebenarnya adalah UTF-8 bytes, maka kita bisa juga membuatnya menggunakan data Bytes. Tipe bytes (atau kadang disebut <em>chars</em>) di Rust direpresentasikan oleh tipe <code>[u8]</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> bytes </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">69</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">108</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">117</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">118</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">101</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">105</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">116</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">105</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">101</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">243</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">159</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">164</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">152</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_utf8</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">bytes</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str2: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> str2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, data bytes dipersiapkan dalam bentuk <code>Vec<u8></code>. Data tersebut kemudian digunakan untuk membuat string menggunakan fungsi <code>String::from_utf8()</code>. Nilai balik fungsi tersebut adalah <code>Result<String, FromUtf8Error></code>. Pemanggilan method <code>unwrap</code> di situ agar data <code>String</code>-nya di-return.</p><p><img loading="eager" fetchpriority="high" alt="String slcie vs string literal" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcoAAABsCAIAAABlzGXMAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnht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4dAkiMOhVy+qKEOMkIl0bh0/9lqnrJxtZ4fq+bN3nz33XU2lXMmTWiRVlp5LsPffeLXj1r/f7f7eObNfvbn7lkOTIPabXv11b3SvHFFhEDt1mdZKr+LXYikeHAco2dQPjOo1j+cJmqmllHmm8ekff+jGW9t/7793h+OSIA7KeyVGxs5F/e9nZwG3vvjoPi1DEKRXYgT8/lev//tvxZGs3X+5o0UQpFeCIAiC9EoQBEF6JQiCIL0SBEEQpFeCIAjSK0EQBOmVIAiCIL0SBEGQXgmCIPYA/wcGv+k9gijq8gAAAABJRU5ErkJggg==" width="458" height="108" class="img_CujE"></p><blockquote><p>Kita akan bahas tipe data <code>Result</code> pada chapter terpisah, <a href="/basic/result-type">Tipe Data ➜ Result</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a462-string-literal-str">A.46.2. String literal (<code>&str</code>)<a class="hash-link" href="#a462-string-literal-str" title="Direct link to heading">​</a></h2><p>Tipe data string literal atau <code>&str</code> adalah tipe yang menampung data kolektif UTF-8 bytes (seperti <code>String</code>) tetapi <strong>immutable</strong> dan disimpannya tidak di heap dan tidak juga di stack, melainkan di static storage.</p><p>String literal hanya bisa direpresentasikan dalam bentuk reference <code>&str</code> (pointer yang mengarah ke suatu bytes).</p><p>Tipe <code>&str</code> termasuk kategori tipe data yang <strong>unowned</strong> atau reference tanpa owner (atau boleh juga diartikan sebagai tipe data yang owner-nya adalah program).</p><p>Rust menjamin data string literal selalu valid. Kita juga bisa menentukan lifetime-nya secara eksplist jike diperlukan, contohnya pada tipe <code>&'static str</code>.</p><p>Cara termudah membuat <code>&str</code> adalah menggunakan string literal.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Helena Iren Michaelsen Epica"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str3: {str3}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a463-konversi-data-string">A.46.3. Konversi data string<a class="hash-link" href="#a463-konversi-data-string" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-konversi-string-ke-str">◉ Konversi <code>String</code> ke <code>&str</code><a class="hash-link" href="#-konversi-string-ke-str" title="Direct link to heading">​</a></h3><p>Data bertipe <code>&str</code> juga didapat melalui operasi borrow dari data bertipe <code>String</code>, caranya dengan menggunakan method <code>as_str</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str4</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Hiroyuki Sawano"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str4_slice1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> str4</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str4: {str4}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// str4: Hiroyuki Sawano</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str4_slice1: {str4_slice1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// str4_slice1: Hiroyuki Sawano</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa juga menggunakan method <code>as_mut_str</code> untuk mutable borrow. Namun dalam penggunaannya, owner data diwajibkan mutable. Contohnya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> str5</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Hans Zimmer"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str5_slice1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> str5</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_mut_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str5: {str5}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str5_slice1: {str5_slice1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="String slcie vs string literal" src="/assets/images/string-slice-vs-string-literal-2-1b0caccba69a37db29f101f921a76df1.png" width="650" height="237" class="img_CujE"></p><p>Hmm, error. Perlu diingat kembali aturan <a href="/basic/borrowing">Borrowing</a> bahwa tidak boleh ada operasi borrow dan juga mutable borrow dalam satu waktu. Pada contoh di atas, <code>str5</code> dipinjam oleh <code>str5_slice1</code> menggunakan method <code>as_mut_str</code> (yang di dalamnya menjalankan operasi mutable borrow). Selain itu, operasi mutable borrow maksimal hanya boleh dilakukan 1x dalam satu waktu, inilah kenapa ketika kita berusaha menampilkan data <code>str5</code> hasilnya error, karena statement print data <code>str5</code> adalah operasi borrow.</p><p>Solusinya masalah di atas bisa menggunakan block expression:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> str5</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Hans Zimmer"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str5_slice1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> str5</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_mut_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str5_slice1: {str5_slice1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// str5_slice1: Hans Zimmer</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str5: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> str5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// str5_slice1: Hans Zimmer</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Tipe data <code>String</code> bisa diakses mutable reference-nya karena memang tipe tersebut size-nya adalah dinamis.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-konversi-str-ke-string">◉ Konversi <code>&str</code> ke <code>String</code><a class="hash-link" href="#-konversi-str-ke-string" title="Direct link to heading">​</a></h3><p>Masih dalam topik konversi tipe data string. Tipe <code>&str</code> memiliki method bernama <code>to_string</code> yang gunanya adalah untuk konversi data <code>&str</code> ke <code>String</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str6</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"John Towner Williams"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str6_slice1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> str6</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str6: {str6}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// str6: John Towner Williams</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str6_slice1: {str6_slice1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// str6_slice1: John Towner Williams</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Konversi pada tipe data ini sedikit berbeda dibandingkan konversi <code>String</code> ke <code>&str</code>. Pada contoh di atas, yang terjadi adalah data <code>&str</code> di-copy sebagai data baru bertipe <code>String</code> yang kemudian ditampung variabel <code>str6_slice1</code> (yang juga berperan sebagai owner untuk data baru tersebut).</p><p>Method <code>to_string</code> melakukan operasi copy, bukan borrow. Artinya setelah dipanggil akan ada 2 data yang reference-nya sudah berbeda.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a464-string-literal--string-slice">A.46.4. String literal & string slice<a class="hash-link" href="#a464-string-literal--string-slice" title="Direct link to heading">​</a></h2><p>Tipe <code>String</code> memiliki hubungan dekat dengan <code>&str</code>. Data bertipe <code>String</code> reference-nya bisa diakses dalam bentuk <code>&String</code>, maupun dalam bentuk <code>&str</code> (menggunakan method <code>as_str</code> atau <code>as_mut_str</code>). Data text pada string tersebut bisa dimodifikasi, ditambahi, dan juga dikurangi.</p><p>Berbeda dengan data bertipe <code>&str</code> <strong>(di paragraph ini dan setelahnya yang kita bahas adalah data yang dari awal tipe-nya sudah <code>&str</code>, bukan data hasil operasi pinjam dari <code>String</code>)</strong>, data bertipe <code>&str</code> adalah fixed dan immutable. Konversi data <code>&str</code> ke <code>String</code> menghasilkan data baru dengan owner baru. Bisa dibilang sangat terbatas apa yang bisa kita lakukan pada tipe data <code>&str</code>.</p><p>Meski demikian, tipe <code>&str</code> lebih cepat performa-nya dibanding <code>String</code> karena disimpan di static storage. Selain itu dijamin valid oleh Rust. Kekurangannya hanya pada ownership-nya. Tipe <code>&str</code> adalah <strong>unowned</strong>, operasi mutability tidak bisa dilakukan pada tipe ini.</p><p>Dalam case normal, sangat dianjurkan untuk menggunakan <code>&str</code>, kecuali memang yang dibutuhkan adalah <strong>owned</strong> string.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/string_slice_vs_string_literal" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../string_slice_vs_string_literal</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/tipe-data-string-literal">Tipe Data ➜ String Literal (&str)</a></li><li><a href="/basic/slice-memory-management">Slice Memory Management</a></li><li><a href="/basic/tipe-data-custom-type-string-slice">Tipe Data ➜ String Custom Type</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch08-02-strings.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch08-02-strings.html</a></li><li><a href="https://users.rust-lang.org/t/str-string-literals/29635" target="_blank" rel="noopener noreferrer">https://users.rust-lang.org/t/str-string-literals/29635</a></li><li><a href="https://www.quora.com/Why-does-Rust-have-two-different-string-types-static-str-and-String" target="_blank" rel="noopener noreferrer">https://www.quora.com/Why-does-Rust-have-two-different-string-types-static-str-and-String</a></li><li><a href="https://stackoverflow.com/questions/24158114/what-are-the-differences-between-rusts-string-and-str" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/24158114/what-are-the-differences-between-rusts-string-and-str</a></li><li><a href="https://stackoverflow.com/questions/30154541/how-do-i-concatenate-strings" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/30154541/how-do-i-concatenate-strings</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/slice-memory-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.45. Slice Memory Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/tipe-data-custom-type-string-slice"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.47. Tipe Data ➜ String Custom Type</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a461-string-slice-string" class="table-of-contents__link toc-highlight">A.46.1. String slice (<code>String</code>)</a></li><li><a href="#a462-string-literal-str" class="table-of-contents__link toc-highlight">A.46.2. String literal (<code>&str</code>)</a></li><li><a href="#a463-konversi-data-string" class="table-of-contents__link toc-highlight">A.46.3. Konversi data string</a><ul><li><a href="#-konversi-string-ke-str" class="table-of-contents__link toc-highlight">◉ Konversi <code>String</code> ke <code>&str</code></a></li><li><a href="#-konversi-str-ke-string" class="table-of-contents__link toc-highlight">◉ Konversi <code>&str</code> ke <code>String</code></a></li></ul></li><li><a href="#a464-string-literal--string-slice" class="table-of-contents__link toc-highlight">A.46.4. String literal & string slice</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/struct.html b/basic/struct.html index 6b06f793..fc220951 100644 --- a/basic/struct.html +++ b/basic/struct.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/struct/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/struct/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.23. Struct","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/struct/#webpage"},"wordCount":1158,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/struct/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/struct/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/struct","name":"A.23. Struct","description":"Pada chapter ini kita akan belajar tentang struct.","datePublished":"2024-08-01T10:17:30.955Z","dateModified":"2024-08-01T10:17:30.955Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/struct/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/struct"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/struct/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.23. Struct","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/struct/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/struct/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.23. Struct","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/struct/#webpage"},"wordCount":1158,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/struct/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/struct/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/struct","name":"A.23. Struct","description":"Pada chapter ini kita akan belajar tentang struct.","datePublished":"2024-08-30T07:44:51.077Z","dateModified":"2024-08-30T07:44:51.077Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/struct/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/struct"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/struct/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.23. Struct","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.23. Struct</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.23. Struct</h1></header><p>Pada chapter ini kita akan belajar tentang struct.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a231-konsep-struct">A.23.1. Konsep Struct<a class="hash-link" href="#a231-konsep-struct" title="Direct link to heading">​</a></h2><p>Struct (kependekan dari <em>structure</em>) adalah tipe data custom yang dengannya kita bisa mengumpulkan beberapa definisi tipe data lalu menjadikannya sebagai satu buah tipe data dalam struktur tertentu.</p><p>Contoh analogi seperti sebuah mobil. Mobil memiliki roda, mesin, tempat kemudi, dan banyak lainnya. Mobil pada contoh ini adalah struct, sedang isi dari mobil tersebut biasa disebut dengan <em>attribute</em> atau <em>property</em> atau <em>field</em>.</p><p>Selain property, mobil juga bisa melakukan aksi, contohnya seperti jalan, belok kanan, berhenti. Aksi tersebut pada contoh ini adalah yang disebut dengan <em>method</em>. Method sendiri adalah fungsi yang merupakan property sebuah struct.</p><blockquote><p>Chapter ini fokus pada pembahasan struct beserta property-nya. Topik tentang method dibahas pada chapter selanjutnya, yaitu <a href="/basic/method">Method</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a232-pembuatan-struct">A.23.2. Pembuatan struct<a class="hash-link" href="#a232-pembuatan-struct" title="Direct link to heading">​</a></h2><p>Keyword <code>struct</code> digunakan untuk membuat custom type struct. Notasi penulisannya seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">NamaStruct</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> property_satu</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> property_dua</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh, sebuah struct bernama <code>User</code> yang memiliki 4 buah property:</p><ul><li><code>name</code> bertipe <code>String</code></li><li><code>sign_in_count</code> bertipe numerik <code>u64</code></li><li><code>affliation</code> bertipe vektor <code>Vec<String></code></li><li><code>active</code> bertipe boolean</li></ul><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">User</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> sign_in_count</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> affliation</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> active</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Struct adalah <em>hanya definisi structure</em>-nya saja, struct tidak menampung nilai atau value. Contoh pada struct <code>User</code> di atas bisa dilihat bahwa yang didefinisikan hanya nama struct dan property (beserta tipe datanya). Tidak ada pengisian nilai sama sekali.</p><blockquote><p>Notasi <code>Vec<String></code> merupakan salah satu contoh penerapan generics. Topik ini nantinya dibahas lebih detail pada chapter <a href="/basic/generics">Generics</a>.</p></blockquote><p>Struct merupakan tipe data data custom, yang berarti tipe data tersebut bisa digunakan dalam pembuatan variabel. Sebagai contoh di bawah ini, sebuah variabel bernama <code>user_one</code> didefinisikan dengan tipe adalah struct <code>User</code> yang telah dibuat.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">User</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> sign_in_count</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> affliation</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> active</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> user_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">User</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Orgrim Doomhammer"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> sign_in_count</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> affliation</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Warchief of the Horde"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Blackrock Chieftain"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"The Doomhammer"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> active</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"name: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> user_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sign-in count: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> user_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">sign_in_count</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"affliation: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> user_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">affliation</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"is active? {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> user_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">active</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program di atas, lihat hasilnya.</p><p><img loading="lazy" alt="Struct" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjwAAAB7CAIAAAD/r80wAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICA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wqAACsFy1HFMflUN2eMHf56YWYchf16ZUOtrZBtOqiz6lCVkUdBACARp4WAAAAogUAAIBoAQAAogUAAIBoAQAAIFoAAIBoAQAAIFoAAACIFgAAIFoAAACIFgAAAKIFAACIFgAAAKIFAABw+R/Nv9kRrdmjiwAAAABJRU5ErkJggg==" width="572" height="123" class="img_ev3q"></p><p>Variabel <code>user_one</code> didefinisikan tipe datanya adalah struct <code>User</code>. Notasinya penulisannya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> user_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">User</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// property_satu: value,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// property_dua: value,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Deklarasi variabel bertipe data struct mewajibkan isi masing-masing property harus dituliskan beserta nilainya. Sebagai contoh variabel <code>user_one</code> yang bertipe struct <code>User</code> di atas, dalam statement bisa dilihat ke-empat property milik struct <code>User</code> dituliskan beserta nilainya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> user_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">User</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Orgrim Doomhammer"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> sign_in_count</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> affliation</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Warchief of the Horde"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Blackrock Chieftain"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"The Doomhammer"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> active</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Variabel yang tipe data-nya adalah struct biasa disebut dengan <em>object</em> atau <em>instance</em>.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-fungsi-stringfrom">◉ Fungsi <code>String::from()</code><a class="hash-link" href="#-fungsi-stringfrom" title="Direct link to heading">​</a></h3><p>Pada chapter <a href="/basic/path-item#-stdstringstringnew">Module System ➜ Path & Item</a> kita telah sedikit mengenal fungsi <code>String::new()</code> yang kegunaannya adalah untuk membuat data string kosong bertipe data <code>String</code>.</p><p>Selain fungsi tersebut, ada juga fungsi <code>String::from()</code> yang kegunaannya juga untuk pembuatan data string bertipe <code>String</code>, tapi dengan isi ditentukan lewat argumen pemanggilan fungsi.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">""</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// variabel `a` bertipe data `&str`, isi value-nya ""</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// variabel `b` bertipe data `String`, isi value-nya ""</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> c </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// variabel `c` bertipe data `&str`, isi value-nya "hello"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"world"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// variabel `d` bertipe data `String`, isi value-nya "world"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Untuk sekarang, boleh menggunakan kesimpulan berikut:</p><ul><li>Hasil dari <code>String::new()</code> adalah sama dengan literal string <code>""</code> tapi bertipe data <code>String</code> (bukan <code>&str</code>)</li><li>Hasil dari <code>String::from("hello")</code> adalah sama dengan literal string <code>"hello"</code> tapi bertipe data <code>String</code> (bukan <code>&str</code>)</li></ul><p>Sebenarnya perbedaannya tidak hanya itu saja, nantinya kita pelajari lebih detail pada chapter <a href="/basic/string-slice-vs-string-literal">String Literal (&str) vs. String Custom Type</a>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-naming-convention-struct">◉ <em>Naming convention</em> struct<a class="hash-link" href="#-naming-convention-struct" title="Direct link to heading">​</a></h3><p>Sesuai anjuran di <a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">halaman dokumentasi Rust</a>, upper camel case digunakan dalam penamaan struct dan camel case untuk penamaan property-nya. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">User</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> sign_in_count</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> affliation</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> active</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a233-mutable-struct">A.23.3. Mutable struct<a class="hash-link" href="#a233-mutable-struct" title="Direct link to heading">​</a></h2><p>Penentuan <em>mutability</em> sebuah struct dilakukan dengan cara menambahkan keyword <code>mut</code> seperti pada umumnya variabel. Contohnya bisa dilihat pada variabel <code>user_two</code> berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> user_two</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">User</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">User</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Varian Wrynn"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> sign_in_count</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> affliation</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"High King of the Alliance"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"King of Stormwind"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Champion of the Crimson Ring"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> active</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">user_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">name </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Anduin Wrynn"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">user_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">affliation</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pop</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">user_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">active </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"name: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> user_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sign-in count: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> user_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">sign_in_count</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"affliation: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> user_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">affliation</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"is active? {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> user_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">active</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, <code>user_two</code> adalah object struct yang bisa diubah nilainya (mutable). Perubahan nilai struct bisa dilakukan pada property, contohnya seperti property <code>name</code>, <code>affliation</code>, dan <code>active</code> yang dicontohkan diubah nilainya.</p><p>Atau bisa juga perubahannya pada value struct itu sendiri, diganti dengan value baru.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> user_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">User</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Varian Wrynn"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> sign_in_count</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> affliation</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"High King of the Alliance"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"King of Stormwind"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Champion of the Crimson Ring"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> active</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">user_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">User</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Anduin Wrynn"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> sign_in_count</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> affliation</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"High King of the Alliance"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"King of Stormwind"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> active</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a234-macam-macam-notasi-deklarasi-variabel-struct">A.23.4. Macam-macam notasi deklarasi variabel struct<a class="hash-link" href="#a234-macam-macam-notasi-deklarasi-variabel-struct" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-type-inference--manifest-typing">◉ <em>type inference</em> / <em>manifest typing</em><a class="hash-link" href="#-type-inference--manifest-typing" title="Direct link to heading">​</a></h3><p>Metode deklarasi <em>type inference</em> ataupun <em>manifest typing</em> bisa digunakan dalam variabel struct.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> car_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Toyota"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Sprinter Trueno AE86"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> car_two</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"BMW"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"M3 GTR"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-variabel-struct-tanpa-predefined-value">◉ Variabel struct tanpa <em>predefined value</em><a class="hash-link" href="#-variabel-struct-tanpa-predefined-value" title="Direct link to heading">​</a></h3><p>Variabel struct boleh didefinisikan tanpa <em>predefined value</em>, jadi cukup tipe datanya saja yang ditentukan saat deklarasi variabel. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> car_three</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">car_three </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Audi"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Le Mans Quattro"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-variabel-struct-dengan-nilai-berasal-dari-struct-lain">◉ Variabel struct dengan nilai berasal dari struct lain<a class="hash-link" href="#-variabel-struct-dengan-nilai-berasal-dari-struct-lain" title="Direct link to heading">​</a></h3><p>Jika ada kebutuhan untuk membuat variabel object struct yang nilai property-nya sebagian adalah berasal dari variabel struct lain, bisa manfaatkan syntax <code>..</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> car_three</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">car_three </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Audi"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Le Mans Quattro"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> car_three</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">brand</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> car_three</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">model</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> car_four</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">car_four </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Audi Brand"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">..</span><span class="token plain">car_three</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> car_four</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">brand</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> car_four</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">model</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, variabel <code>car_four</code> property <code>brand</code>-nya diisi dengan <code>"Audi Brand"</code>. Sedangkan property-property lainnya nilai didapat dari nilai propery milik <code>car_three</code>.</p><p><img loading="lazy" alt="Struct" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAf8AAABsCAIAAADrFiywAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLm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ZMkL98ZbBWwbgbNV/JXcX+ejU4eT+osCzJVMki/rjLYO3DMD5qv9a7i7BuH8whi7ukhyfubhIBvXHWwZvGYDzVf/V3F18aenFcHA8JufZMlH98ZbBWwbgfNV/PXeXMLBsjx/a437J2B9vGbxlAM5X/ddzd4ljf3/WV0054NmSK5Jh5AdvGbxlAM5V/Vd0d5HX+4uBqtmzRSySKX+8ZfCWATjv2B8OEgZdAAD1P1/9JwYHANQfAABQfwAAQP0BAAD1BwBA/QEAAPUHAADUHwAAUH8AAED9AQDgSPkf6Emv3lPCWuwAAAAASUVORK5CYII=" width="511" height="108" class="img_ev3q"></p><p>Coba jalankan program, akan terlihat nilai dari variabel <code>car_four</code> untuk property selain <code>brand</code> adalah sama dengan nilai property-property <code>car_three</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-field-init-shorthand">◉ <em>Field init shorthand</em><a class="hash-link" href="#-field-init-shorthand" title="Direct link to heading">​</a></h3><p>Jika ada variabel yang namanya sama persis dengan nama property sebuah struct, maka dalam deklarasi variabel struct bisa menggunakan teknik penulisan seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> model </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Corvette C1"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> car_five </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Chevrolet"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Cukup tulis nama variabelnya saja tanpa value.</p><p>Teknik <em>shorthand</em> ini bisa juga digunakan dalam fungsi. Contoh di bawah ini ada fungsi bernama <code>new_car</code> yang memiliki nama parameter adalah sama persis dengan nama property struct <code>Car</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new_car</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> car_six </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">new_car</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Chevrolet"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Corvette C6"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-deklarasi-nilai-struct-secara-horizontal">◉ Deklarasi nilai struct secara horizontal<a class="hash-link" href="#-deklarasi-nilai-struct-secara-horizontal" title="Direct link to heading">​</a></h3><p>Umumnya, operasi <em>assignment</em> nilai struct dituliskan secara vertikal. Untuk struct yang property-nya sedikit biasanya dituliskan secara horizontal contohnya seperti di bawah ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> point_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8.0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-destructuring-assignment">◉ <em>Destructuring assignment</em><a class="hash-link" href="#-destructuring-assignment" title="Direct link to heading">​</a></h3><p>Teknik penulisan ini bisa dipakai dalam case di mana nilai property struct perlu ditampung ke variabel baru. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> point_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8.0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> x_one</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> y_one </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> point_one</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"x_one: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"y_one: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Variabel <code>x_one</code> di atas akan menampung nilai dari <code>point_one.x</code></li><li>Variabel <code>y_one</code> di atas akan menampung nilai dari <code>point_one.y</code></li></ul><p>Jika tidak semua property struct perlu untuk ditampung ke variabel baru, maka gunakan <code>_</code> untuk property yang nilainya tidak ditampung. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> point_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8.0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> _</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> y_one </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> point_one</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"y_one: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a235-unit-like-structs">A.23.5. <em>Unit-like structs</em><a class="hash-link" href="#a235-unit-like-structs" title="Direct link to heading">​</a></h2><p><em>Unit-like structs</em> adalah struct yang didefinisikan tanpa property. Cara deklrasinya bisa dilihat pada contoh berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">StructOne</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">StructOne</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Teknik pembuatan struct ini berguna ketika ada case di mana ada kebutuhan untuk mengimplementasikan sebuah trait ke suatu tipe data. Lebih jelasnya akan dibahas pada chapter <a href="/basic/traits">Traits</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a236-debugging-value-struct-menggunakan-derivedebug">A.23.6. Debugging value struct menggunakan <code>#[derive(Debug)]</code><a class="hash-link" href="#a236-debugging-value-struct-menggunakan-derivedebug" title="Direct link to heading">​</a></h2><p><em>By default</em>, error akan muncul saat berusaha menampilkan nilai variabel struct (bukan nilai property-nya, tapi nilai variabel struct-nya) menggunakan macro <code>println</code>. Ini disebabkan karena data yang bisa ditampilkan menggunakan macro <code>println</code> harus memiliki trait <code>Debug</code> (atau <code>Display</code>).</p><p><img loading="lazy" alt="Struct" src="/assets/images/struct-4-86fb5f564d330bc2d1cc10e13ea2d649.png" width="743" height="308" class="img_ev3q"></p><p>Lalu jika ingin melihat nilai property struct bagaimana solusinya? Bisa dengan menampilkan nilai property satu per satu, tapi pastinya butuh effort.</p><p>Cara yang lebih elegan adalah dengan menggunakan attribute <code>#[derive(Debug)]</code>. Penerapannya cukup dengan menuliskan atribut tersebut tepat di atas deklarasi struct. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">GamingConsole</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> console_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">GamingConsole</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"PlayStation 5"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data_struct_one: {:#?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> console_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Struct" src="/assets/images/struct-5-5e013d5895bef6a938e2c1333ff52205.png" width="510" height="330" class="img_ev3q"></p><blockquote><ul><li>Lebih detailnya mengenai traits dibahas pada chapter <a href="/basic/traits">Traits</a></li><li>Lebih detailnya mengenai attribute dibahas pada chapter <a href="/basic/attributes">Attributes</a></li></ul></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a237-tuple-struct">A.23.7. Tuple struct<a class="hash-link" href="#a237-tuple-struct" title="Direct link to heading">​</a></h2><p>Tuple struct adalah struct yang didefinisikan dengan gaya tuple. Property pada tuple struct diakses menggunakan notasi pengaksesan tuple item.</p><p>Pada contoh berikut tuple struct <code>Color</code> didefinisikan dengan isi 3 buah item yang kesemuanya bertipe data <code>i32</code>. Lalu tipe data tuple struct tersebut digunakan untuk membuat variabel baru bernama <code>red</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> red </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">255</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?} {:?} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> red</span><span class="token number" style="color:#36acaa">.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> red</span><span class="token number" style="color:#36acaa">.1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> red</span><span class="token number" style="color:#36acaa">.2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat di contoh, property diakses menggunakan nomor indeks dengan notasi penulisan <code>variable.index</code>.</p><p>Contoh lainnya, tuple struct <code>SomeTupleStruct</code> berikut dideklarasikan memiliki item ke-1 bertipe <code>i32</code> dan item ke-2 bertipe boolean.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">SomeTupleStruct</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> some_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">SomeTupleStruct</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> some_data</span><span class="token number" style="color:#36acaa">.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> some_data</span><span class="token number" style="color:#36acaa">.1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a238-struct-property-visibility">A.23.8. Struct property visibility<a class="hash-link" href="#a238-struct-property-visibility" title="Direct link to heading">​</a></h2><p>Sekarang mari kita coba praktikkan satu program lagi, namun kali ini sedikit berbeda, struct kita definisikan sebagai module item.</p><p>Silakan siapkan program dengan struktur seperti berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> ├─── models.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── models</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── game.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Lalu isi file program dengan kode di bawah ini. Sebuah struct dengan path <code>models::game::GamingConsole</code>, dan satu buah object di fungsi <code>main</code> yang dibuat dari struct tersebut. Pastikan definisi semua module item adalah publik (ada keyword <code>pub</code>).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">models</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> ps5 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">models</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">game</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">GamingConsole</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"PS 5"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:#?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> ps5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/models.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">game</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/models/game.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">GamingConsole</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ada yang aneh, baris kode pembuatan variabel object <code>ps5</code> terdeteksi sebagai error. Padahal definisi submodule dan item-nya sudah publik semua.</p><p><img loading="lazy" alt="Struct" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAaMAAAC5CAIAAAAKzcfqAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw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NSYdPh40m6XK/LHPuKkln+ua8gYj2/XR+n51AVWxYtgPS+TGvq25GJIKuAN0TJ/vpzHIV6Xrtp6vw+xr7dGIAl346bByj12NmaNXo1I06n84de53vaUTCDoxGRk4d58sde60bq83308Sn8926wZDOHXstElSSTo+9lhBpTzodgdZFtan0jZnI2Cs21KRb1y8teT5dn111A1Tkebphe/2L5+kwSDescoNi82heOphdWwXvSAw3iGl72HCRbtuW6axqvr7rR49+9rP7e3+yvta40euec8Oc58//9dr/bXp+CHOo33t92U1D28OGi3SqdqqqqSru//7kpz+a3PnOsz9mDWv6X0Pbw4aLdFnVVFLVNLtds4Y1/a+h7WHDRToMwzBIh2EYBukwDMMgHYZhGKTDMAyDdBiGYZAOwzAM0mEYBukwDMNG3/4fXrze1tJWD6UAAAAASUVORK5CYII=" width="419" height="185" class="img_ev3q"></p><p>Jika dilihat dari keterangan error, sebenarnya cukup jelas bagian mana yang menjadi sumber masalah, yaitu field <code>name</code> yang terdeteksi sebagai private property.</p><p>Struct jika didefinisikan di file yang sama dengan statement pemanggilan struct tersebut tidak akan menghasilkan error. Tetapi jika definisi struct-nya terpisah dari statement pemanggilan struct (seperti contoh di atas), maka field dari struct tersebut harus publik.</p><p>Caranya membuat field sebagai publik adalah dengan menambahkan keyword <code>pub</code> pada property struct. Silakan ubah definisi struct <code>GamingConsole</code> menjadi seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// before</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">GamingConsole</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// after</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">GamingConsole</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat keyword <code>pub</code> ditambahkan pada deklarasi property struct. yang sebelumnya <code>name: String</code> sekarang ada keyword <code>pub</code> didepannya.</p><blockquote><p>Lebih jelasnya mengenai visibility property dibahas pada chapter <a href="/basic/visibility-privacy">Module System ➜ Visibility & Privacy</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a239-tuple-struct-property-visibility">A.23.9. Tuple struct property visibility<a class="hash-link" href="#a239-tuple-struct-property-visibility" title="Direct link to heading">​</a></h2><p>Lalu bagaimana dengan tuple struct? apakah property-nya juga harus didefinisikan publik agar bisa diakses dari tempat lain? Jawabannya ada di praktik berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> ├─── models.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── models</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── color.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">models</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> red </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">models</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">color</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">255</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">255</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:#?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> red</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/models.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">color</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/models/color.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Struct" src="/assets/images/struct-7-517c0402e96dfd5898464887fa79ec98.png" width="626" height="255" class="img_ev3q"></p><p>Yap, error yang mirip juga muncul. Jadi jawaban dari pertanyaan sebelumnya adalah iya, property tuple struct juga harus publik agar bisa diakses dari tempat lain.</p><p>Cara deklarasi tuple struct dengan property publik adalah dengan menambahkan keyword <code>pub</code> di masing-masing deklarasi parameter tuple struct. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// before</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// after</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program untuk melihat hasilnya, error tidak muncul.</p><blockquote><p>Lebih jelasnya mengenai visibility property dibahas pada chapter <a href="/basic/visibility-privacy">Module System ➜ Visibility & Privacy</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a2310-generic-pada-struct">A.23.10. Generic pada struct<a class="hash-link" href="#a2310-generic-pada-struct" title="Direct link to heading">​</a></h2><p>Pembahasan mengenai generic pada struct ada pada chapter <a href="/basic/generics#a365-generics-struct">Generics</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/struct" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../struct</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch05-00-structs.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch05-00-structs.html</a></li><li><a href="https://doc.rust-lang.org/book/ch05-01-defining-structs.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch05-01-defining-structs.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.struct.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.struct.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/custom_types/structs.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/custom_types/structs.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/module-scope-item-access"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.22. Module System ➜ Scope & Akses Item</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/associated-function"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.24. Associated Function</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a231-konsep-struct" class="table-of-contents__link toc-highlight">A.23.1. Konsep Struct</a></li><li><a href="#a232-pembuatan-struct" class="table-of-contents__link toc-highlight">A.23.2. Pembuatan struct</a><ul><li><a href="#-fungsi-stringfrom" class="table-of-contents__link toc-highlight">◉ Fungsi <code>String::from()</code></a></li><li><a href="#-naming-convention-struct" class="table-of-contents__link toc-highlight">◉ <em>Naming convention</em> struct</a></li></ul></li><li><a href="#a233-mutable-struct" class="table-of-contents__link toc-highlight">A.23.3. Mutable struct</a></li><li><a href="#a234-macam-macam-notasi-deklarasi-variabel-struct" class="table-of-contents__link toc-highlight">A.23.4. Macam-macam notasi deklarasi variabel struct</a><ul><li><a href="#-type-inference--manifest-typing" class="table-of-contents__link toc-highlight">◉ <em>type inference</em> / <em>manifest typing</em></a></li><li><a href="#-variabel-struct-tanpa-predefined-value" class="table-of-contents__link toc-highlight">◉ Variabel struct tanpa <em>predefined value</em></a></li><li><a href="#-variabel-struct-dengan-nilai-berasal-dari-struct-lain" class="table-of-contents__link toc-highlight">◉ Variabel struct dengan nilai berasal dari struct lain</a></li><li><a href="#-field-init-shorthand" class="table-of-contents__link toc-highlight">◉ <em>Field init shorthand</em></a></li><li><a href="#-deklarasi-nilai-struct-secara-horizontal" class="table-of-contents__link toc-highlight">◉ Deklarasi nilai struct secara horizontal</a></li><li><a href="#-destructuring-assignment" class="table-of-contents__link toc-highlight">◉ <em>Destructuring assignment</em></a></li></ul></li><li><a href="#a235-unit-like-structs" class="table-of-contents__link toc-highlight">A.23.5. <em>Unit-like structs</em></a></li><li><a href="#a236-debugging-value-struct-menggunakan-derivedebug" class="table-of-contents__link toc-highlight">A.23.6. Debugging value struct menggunakan <code>#[derive(Debug)]</code></a></li><li><a href="#a237-tuple-struct" class="table-of-contents__link toc-highlight">A.23.7. Tuple struct</a></li><li><a href="#a238-struct-property-visibility" class="table-of-contents__link toc-highlight">A.23.8. Struct property visibility</a></li><li><a href="#a239-tuple-struct-property-visibility" class="table-of-contents__link toc-highlight">A.23.9. Tuple struct property visibility</a></li><li><a href="#a2310-generic-pada-struct" class="table-of-contents__link toc-highlight">A.23.10. Generic pada struct</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.23. Struct</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.23. Struct</h1></header><p>Pada chapter ini kita akan belajar tentang struct.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a231-konsep-struct">A.23.1. Konsep Struct<a class="hash-link" href="#a231-konsep-struct" title="Direct link to heading">​</a></h2><p>Struct (kependekan dari <em>structure</em>) adalah tipe data custom yang dengannya kita bisa mengumpulkan beberapa definisi tipe data lalu menjadikannya sebagai satu buah tipe data dalam struktur tertentu.</p><p>Contoh analogi seperti sebuah mobil. Mobil memiliki roda, mesin, tempat kemudi, dan banyak lainnya. Mobil pada contoh ini adalah struct, sedang isi dari mobil tersebut biasa disebut dengan <em>attribute</em> atau <em>property</em> atau <em>field</em>.</p><p>Selain property, mobil juga bisa melakukan aksi, contohnya seperti jalan, belok kanan, berhenti. Aksi tersebut pada contoh ini adalah yang disebut dengan <em>method</em>. Method sendiri adalah fungsi yang merupakan property sebuah struct.</p><blockquote><p>Chapter ini fokus pada pembahasan struct beserta property-nya. Topik tentang method dibahas pada chapter selanjutnya, yaitu <a href="/basic/method">Method</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a232-pembuatan-struct">A.23.2. Pembuatan struct<a class="hash-link" href="#a232-pembuatan-struct" title="Direct link to heading">​</a></h2><p>Keyword <code>struct</code> digunakan untuk membuat custom type struct. Notasi penulisannya seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">NamaStruct</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> property_satu</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> property_dua</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh, sebuah struct bernama <code>User</code> yang memiliki 4 buah property:</p><ul><li><code>name</code> bertipe <code>String</code></li><li><code>sign_in_count</code> bertipe numerik <code>u64</code></li><li><code>affliation</code> bertipe vektor <code>Vec<String></code></li><li><code>active</code> bertipe boolean</li></ul><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">User</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> sign_in_count</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> affliation</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> active</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Struct adalah <em>hanya definisi structure</em>-nya saja, struct tidak menampung nilai atau value. Contoh pada struct <code>User</code> di atas bisa dilihat bahwa yang didefinisikan hanya nama struct dan property (beserta tipe datanya). Tidak ada pengisian nilai sama sekali.</p><blockquote><p>Notasi <code>Vec<String></code> merupakan salah satu contoh penerapan generics. Topik ini nantinya dibahas lebih detail pada chapter <a href="/basic/generics">Generics</a>.</p></blockquote><p>Struct merupakan tipe data data custom, yang berarti tipe data tersebut bisa digunakan dalam pembuatan variabel. Sebagai contoh di bawah ini, sebuah variabel bernama <code>user_one</code> didefinisikan dengan tipe adalah struct <code>User</code> yang telah dibuat.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">User</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> sign_in_count</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> affliation</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> active</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> user_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">User</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Orgrim Doomhammer"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> sign_in_count</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> affliation</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Warchief of the Horde"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Blackrock Chieftain"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"The Doomhammer"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> active</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"name: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> user_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sign-in count: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> user_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">sign_in_count</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"affliation: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> user_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">affliation</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"is active? {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> user_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">active</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program di atas, lihat hasilnya.</p><p><img loading="eager" fetchpriority="high" alt="Struct" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjwAAAB7CAIAAAD/r80wAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTAtM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GdVtP+mS5OU1ZqEDN2QxP7Rauqzy8t+pRLjac7wz09KOzpFq35EShbfngi0frOue5XYnDdpqftaWLYb3IV0UK0oOFgxnBGEwOidbN9m/4NANB2TEW0AADgnkG0AAAA0QIAAEC0AAAA0VrkoOBVO+Q+vPTzXu1Yd7Etmh8AANyLaO0W79H5KXHlx7SIFgDAKUXrOJdqL2X0bJdfI0SIFgDAGUVrOaqba4evhZB0FfEezT1+ysHWHF6UOMUofDmaX238NwAAaOtpFTfELF/oDHNX8rTMbUaTOFWFYGtFT8uWTGf0OW2Qo6IOAgAgWouiVe87FMPc+UUr2Yxyjhetg62NiuQKi1WO72urlDLIYVEHAQAQreKQfQmm9xaGYm+YuwrRivYrFvsOx8USYYTdouWNPqcMclzUQQAARGtJtMKx2h6N/WHuakQrCLEWKMTmt0Yi4rUz+pyqMks1AADOJ1rltzX+MHeltPLch1jBL/GSB1XC7gefj6NEyxd9TlZi3RwqAACsFy1HFMflUN2eMHf56YWYchf16ZUOtrZBtOqiz6lCVkUdBACARp4WAAAAogUAAIBoAQAAogUAAIBoAQAAIFoAAIBoAQAAIFoAAACIFgAAIFoAAACIFgAAAKIFAACIFgAAAKIFAABw+R/Nv9kRrdmjiwAAAABJRU5ErkJggg==" width="572" height="123" class="img_CujE"></p><p>Variabel <code>user_one</code> didefinisikan tipe datanya adalah struct <code>User</code>. Notasinya penulisannya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> user_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">User</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// property_satu: value,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// property_dua: value,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Deklarasi variabel bertipe data struct mewajibkan isi masing-masing property harus dituliskan beserta nilainya. Sebagai contoh variabel <code>user_one</code> yang bertipe struct <code>User</code> di atas, dalam statement bisa dilihat ke-empat property milik struct <code>User</code> dituliskan beserta nilainya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> user_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">User</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Orgrim Doomhammer"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> sign_in_count</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> affliation</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Warchief of the Horde"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Blackrock Chieftain"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"The Doomhammer"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> active</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Variabel yang tipe data-nya adalah struct biasa disebut dengan <em>object</em> atau <em>instance</em>.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-fungsi-stringfrom">◉ Fungsi <code>String::from()</code><a class="hash-link" href="#-fungsi-stringfrom" title="Direct link to heading">​</a></h3><p>Pada chapter <a href="/basic/path-item#-stdstringstringnew">Module System ➜ Path & Item</a> kita telah sedikit mengenal fungsi <code>String::new()</code> yang kegunaannya adalah untuk membuat data string kosong bertipe data <code>String</code>.</p><p>Selain fungsi tersebut, ada juga fungsi <code>String::from()</code> yang kegunaannya juga untuk pembuatan data string bertipe <code>String</code>, tapi dengan isi ditentukan lewat argumen pemanggilan fungsi.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">""</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// variabel `a` bertipe data `&str`, isi value-nya ""</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// variabel `b` bertipe data `String`, isi value-nya ""</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> c </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// variabel `c` bertipe data `&str`, isi value-nya "hello"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"world"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// variabel `d` bertipe data `String`, isi value-nya "world"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Untuk sekarang, boleh menggunakan kesimpulan berikut:</p><ul><li>Hasil dari <code>String::new()</code> adalah sama dengan literal string <code>""</code> tapi bertipe data <code>String</code> (bukan <code>&str</code>)</li><li>Hasil dari <code>String::from("hello")</code> adalah sama dengan literal string <code>"hello"</code> tapi bertipe data <code>String</code> (bukan <code>&str</code>)</li></ul><p>Sebenarnya perbedaannya tidak hanya itu saja, nantinya kita pelajari lebih detail pada chapter <a href="/basic/string-slice-vs-string-literal">String Literal (&str) vs. String Custom Type</a>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-naming-convention-struct">◉ <em>Naming convention</em> struct<a class="hash-link" href="#-naming-convention-struct" title="Direct link to heading">​</a></h3><p>Sesuai anjuran di <a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">halaman dokumentasi Rust</a>, upper camel case digunakan dalam penamaan struct dan camel case untuk penamaan property-nya. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">User</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> sign_in_count</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> affliation</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">String</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> active</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a233-mutable-struct">A.23.3. Mutable struct<a class="hash-link" href="#a233-mutable-struct" title="Direct link to heading">​</a></h2><p>Penentuan <em>mutability</em> sebuah struct dilakukan dengan cara menambahkan keyword <code>mut</code> seperti pada umumnya variabel. Contohnya bisa dilihat pada variabel <code>user_two</code> berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> user_two</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">User</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">User</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Varian Wrynn"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> sign_in_count</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> affliation</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"High King of the Alliance"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"King of Stormwind"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Champion of the Crimson Ring"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> active</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">user_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">name </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Anduin Wrynn"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">user_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">affliation</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pop</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">user_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">active </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"name: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> user_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sign-in count: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> user_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">sign_in_count</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"affliation: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> user_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">affliation</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"is active? {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> user_two</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">active</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, <code>user_two</code> adalah object struct yang bisa diubah nilainya (mutable). Perubahan nilai struct bisa dilakukan pada property, contohnya seperti property <code>name</code>, <code>affliation</code>, dan <code>active</code> yang dicontohkan diubah nilainya.</p><p>Atau bisa juga perubahannya pada value struct itu sendiri, diganti dengan value baru.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> user_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">User</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Varian Wrynn"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> sign_in_count</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> affliation</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"High King of the Alliance"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"King of Stormwind"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Champion of the Crimson Ring"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> active</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">user_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">User</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Anduin Wrynn"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> sign_in_count</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> affliation</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"High King of the Alliance"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"King of Stormwind"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> active</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a234-macam-macam-notasi-deklarasi-variabel-struct">A.23.4. Macam-macam notasi deklarasi variabel struct<a class="hash-link" href="#a234-macam-macam-notasi-deklarasi-variabel-struct" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-type-inference--manifest-typing">◉ <em>type inference</em> / <em>manifest typing</em><a class="hash-link" href="#-type-inference--manifest-typing" title="Direct link to heading">​</a></h3><p>Metode deklarasi <em>type inference</em> ataupun <em>manifest typing</em> bisa digunakan dalam variabel struct.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> car_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Toyota"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Sprinter Trueno AE86"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> car_two</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"BMW"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"M3 GTR"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-variabel-struct-tanpa-predefined-value">◉ Variabel struct tanpa <em>predefined value</em><a class="hash-link" href="#-variabel-struct-tanpa-predefined-value" title="Direct link to heading">​</a></h3><p>Variabel struct boleh didefinisikan tanpa <em>predefined value</em>, jadi cukup tipe datanya saja yang ditentukan saat deklarasi variabel. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> car_three</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">car_three </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Audi"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Le Mans Quattro"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-variabel-struct-dengan-nilai-berasal-dari-struct-lain">◉ Variabel struct dengan nilai berasal dari struct lain<a class="hash-link" href="#-variabel-struct-dengan-nilai-berasal-dari-struct-lain" title="Direct link to heading">​</a></h3><p>Jika ada kebutuhan untuk membuat variabel object struct yang nilai property-nya sebagian adalah berasal dari variabel struct lain, bisa manfaatkan syntax <code>..</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> car_three</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">car_three </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Audi"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Le Mans Quattro"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> car_three</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">brand</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> car_three</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">model</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> car_four</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">car_four </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Audi Brand"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">..</span><span class="token plain">car_three</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> car_four</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">brand</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> car_four</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">model</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada contoh di atas, variabel <code>car_four</code> property <code>brand</code>-nya diisi dengan <code>"Audi Brand"</code>. Sedangkan property-property lainnya nilai didapat dari nilai propery milik <code>car_three</code>.</p><p><img loading="lazy" alt="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9G5ptTVceH5xnZ8wAA1L9M/D2BksQu1MWZ1N+JumFwpC/D21sl/lLStgyaUpukNAr98+qvPTYK1P/df3y8ST0P5B8AFlH/QGBahVpL/dMxkbz6B2IuDbXo6u8PqWQGVAJFHlR/Ifcy9ReehsXVCgAwQv0l/V1X/U3qdh9PSVdHStHziyFOTxQ+E/zXIbl8TjH3yeofdYZQfwBYRP0FFX8PRp/rgLkVOz/knWPkxzq0nVH/YP7VpP7ZCYZA07viDVSIl7uaQfqmNg/i5868LwAsov6JALWK0/UJ3FLQRte8dTTKyMvQuh1hkEdYR2QsZ9MhaTN+zcX+YTnzzxtxcZBUIVLuySn0N5VpDq+aiPsBYKnYHy5MI0AAAKj/Gek/MTgAoP4AAID6AwAA6g8AAKg/AACg/gAAcDLqf4DuLmyhDABwcXjuLuFvvRZYQzmg/njL8GgEQP1TvVne3SXaH3p++VxQ/fGWAYBTVP913F0Cxe/ESHE4GefZMkL98ZbBWwbgbNV/JXcX+ejU4eT+osCzJVMki/rjLYO3DMD5qv9a7i7BuH8whi7ukhyfubhIBvXHWwZvGYDzVf/V3F18aenFcHA8JufZMlH98ZbBWwbgfNV/PXeXMLBsjx/a437J2B9vGbxlAM5X/ddzd4ljf3/WV0054NmSK5Jh5AdvGbxlAM5V/Vd0d5HX+4uBqtmzRSySKX+8ZfCWATjv2B8OEgZdAAD1P1/9JwYHANQfAABQfwAAQP0BAAD1BwBA/QEAAPUHAADUHwAAUH8AAED9AQDgSPkf6Emv3lPCWuwAAAAASUVORK5CYII=" width="511" height="108" class="img_CujE"></p><p>Coba jalankan program, akan terlihat nilai dari variabel <code>car_four</code> untuk property selain <code>brand</code> adalah sama dengan nilai property-property <code>car_three</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-field-init-shorthand">◉ <em>Field init shorthand</em><a class="hash-link" href="#-field-init-shorthand" title="Direct link to heading">​</a></h3><p>Jika ada variabel yang namanya sama persis dengan nama property sebuah struct, maka dalam deklarasi variabel struct bisa menggunakan teknik penulisan seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> model </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Corvette C1"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> car_five </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Chevrolet"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Cukup tulis nama variabelnya saja tanpa value.</p><p>Teknik <em>shorthand</em> ini bisa juga digunakan dalam fungsi. Contoh di bawah ini ada fungsi bernama <code>new_car</code> yang memiliki nama parameter adalah sama persis dengan nama property struct <code>Car</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">new_car</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">brand</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Car</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Car</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> brand</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> model</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> car_six </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">new_car</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Chevrolet"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Corvette C6"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-deklarasi-nilai-struct-secara-horizontal">◉ Deklarasi nilai struct secara horizontal<a class="hash-link" href="#-deklarasi-nilai-struct-secara-horizontal" title="Direct link to heading">​</a></h3><p>Umumnya, operasi <em>assignment</em> nilai struct dituliskan secara vertikal. Untuk struct yang property-nya sedikit biasanya dituliskan secara horizontal contohnya seperti di bawah ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> point_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8.0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-destructuring-assignment">◉ <em>Destructuring assignment</em><a class="hash-link" href="#-destructuring-assignment" title="Direct link to heading">​</a></h3><p>Teknik penulisan ini bisa dipakai dalam case di mana nilai property struct perlu ditampung ke variabel baru. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> point_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8.0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> x_one</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> y_one </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> point_one</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"x_one: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"y_one: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li>Variabel <code>x_one</code> di atas akan menampung nilai dari <code>point_one.x</code></li><li>Variabel <code>y_one</code> di atas akan menampung nilai dari <code>point_one.y</code></li></ul><p>Jika tidak semua property struct perlu untuk ditampung ke variabel baru, maka gunakan <code>_</code> untuk property yang nilainya tidak ditampung. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> point_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8.0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> _</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> y_one </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> point_one</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"y_one: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a235-unit-like-structs">A.23.5. <em>Unit-like structs</em><a class="hash-link" href="#a235-unit-like-structs" title="Direct link to heading">​</a></h2><p><em>Unit-like structs</em> adalah struct yang didefinisikan tanpa property. Cara deklrasinya bisa dilihat pada contoh berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">StructOne</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">StructOne</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Teknik pembuatan struct ini berguna ketika ada case di mana ada kebutuhan untuk mengimplementasikan sebuah trait ke suatu tipe data. Lebih jelasnya akan dibahas pada chapter <a href="/basic/traits">Traits</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a236-debugging-value-struct-menggunakan-derivedebug">A.23.6. Debugging value struct menggunakan <code>#[derive(Debug)]</code><a class="hash-link" href="#a236-debugging-value-struct-menggunakan-derivedebug" title="Direct link to heading">​</a></h2><p><em>By default</em>, error akan muncul saat berusaha menampilkan nilai variabel struct (bukan nilai property-nya, tapi nilai variabel struct-nya) menggunakan macro <code>println</code>. Ini disebabkan karena data yang bisa ditampilkan menggunakan macro <code>println</code> harus memiliki trait <code>Debug</code> (atau <code>Display</code>).</p><p><img loading="lazy" alt="Struct" src="/assets/images/struct-4-86fb5f564d330bc2d1cc10e13ea2d649.png" width="743" height="308" class="img_CujE"></p><p>Lalu jika ingin melihat nilai property struct bagaimana solusinya? Bisa dengan menampilkan nilai property satu per satu, tapi pastinya butuh effort.</p><p>Cara yang lebih elegan adalah dengan menggunakan attribute <code>#[derive(Debug)]</code>. Penerapannya cukup dengan menuliskan atribut tersebut tepat di atas deklarasi struct. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">GamingConsole</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> console_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">GamingConsole</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"PlayStation 5"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data_struct_one: {:#?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> console_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Struct" src="/assets/images/struct-5-5e013d5895bef6a938e2c1333ff52205.png" width="510" height="330" class="img_CujE"></p><blockquote><ul><li>Lebih detailnya mengenai traits dibahas pada chapter <a href="/basic/traits">Traits</a></li><li>Lebih detailnya mengenai attribute dibahas pada chapter <a href="/basic/attributes">Attributes</a></li></ul></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a237-tuple-struct">A.23.7. Tuple struct<a class="hash-link" href="#a237-tuple-struct" title="Direct link to heading">​</a></h2><p>Tuple struct adalah struct yang didefinisikan dengan gaya tuple. Property pada tuple struct diakses menggunakan notasi pengaksesan tuple item.</p><p>Pada contoh berikut tuple struct <code>Color</code> didefinisikan dengan isi 3 buah item yang kesemuanya bertipe data <code>i32</code>. Lalu tipe data tuple struct tersebut digunakan untuk membuat variabel baru bernama <code>red</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> red </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">255</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?} {:?} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> red</span><span class="token number" style="color:#36acaa">.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> red</span><span class="token number" style="color:#36acaa">.1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> red</span><span class="token number" style="color:#36acaa">.2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat di contoh, property diakses menggunakan nomor indeks dengan notasi penulisan <code>variable.index</code>.</p><p>Contoh lainnya, tuple struct <code>SomeTupleStruct</code> berikut dideklarasikan memiliki item ke-1 bertipe <code>i32</code> dan item ke-2 bertipe boolean.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">SomeTupleStruct</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> some_data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">SomeTupleStruct</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> some_data</span><span class="token number" style="color:#36acaa">.0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> some_data</span><span class="token number" style="color:#36acaa">.1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a238-struct-property-visibility">A.23.8. Struct property visibility<a class="hash-link" href="#a238-struct-property-visibility" title="Direct link to heading">​</a></h2><p>Sekarang mari kita coba praktikkan satu program lagi, namun kali ini sedikit berbeda, struct kita definisikan sebagai module item.</p><p>Silakan siapkan program dengan struktur seperti berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> ├─── models.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── models</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── game.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Lalu isi file program dengan kode di bawah ini. Sebuah struct dengan path <code>models::game::GamingConsole</code>, dan satu buah object di fungsi <code>main</code> yang dibuat dari struct tersebut. Pastikan definisi semua module item adalah publik (ada keyword <code>pub</code>).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">models</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> ps5 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">models</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">game</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">GamingConsole</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"PS 5"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:#?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> ps5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/models.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">game</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/models/game.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">GamingConsole</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ada yang aneh, baris kode pembuatan variabel object <code>ps5</code> terdeteksi sebagai error. Padahal definisi submodule dan item-nya sudah publik semua.</p><p><img loading="lazy" alt="Struct" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAaMAAAC5CAIAAAAKzcfqAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtc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G0PGz7SKTzd+SwH2crDA3lrXDpVAEsjLyOaSXzq4tSBO9+YlIpuGQQ/VPgrAKeRd+pie9LlUIv5blGfTpOxSK8TiGjX8MsnnaWhRGq5fHDqrhfwNiTd8T9abOW6dv1YTjrLMhHb6vQFxfSy4aPp41MJDARzPtrOvhf/6jt07UiXR7XNYdcL6Ux8/Z0XIR02tKRz/LLCfZM6ptw3Q8AisSKd4VqRXiUod2LImKGzvayH5YSxSdJZumlOyU0ipFMOYInUfEN9uIJu2uMr0/QyHBH6dGXPnUbYpQthd97FS+ZfvbnGn0xWkE6HrqcXn25JOn+kwnSu6X63BmGs7KdrzkcZwNL2sFEh3YcmSrWqJF3mGEr1SjrpgpWoSpEuDaaGpDPxbOnTOZt0Qbqw585x1pqRThGkBenKkYTogKx29NqM1RajEA07E4t80vaw0SCdjk/t+lqfztlJN5Le1uBIV4TARr07dC1JJ3y64t/ufbqktHPnjydU+3cNSYdPh40m6XK/LHPuKkln+ua8gYj2/XR+n51AVWxYtgPS+TGvq25GJIKuAN0TJ/vpzHIV6Xrtp6vw+xr7dGIAl346bByj12NmaNXo1I06n84de53vaUTCDoxGRk4d58sde60bq83308Sn8926wZDOHXstElSSTo+9lhBpTzodgdZFtan0jZnI2Cs21KRb1y8teT5dn111A1Tkebphe/2L5+kwSDescoNi82heOphdWwXvSAw3iGl72HCRbtuW6axqvr7rR49+9rP7e3+yvta40euec8Oc58//9dr/bXp+CHOo33t92U1D28OGi3SqdqqqqSru//7kpz+a3PnOsz9mDWv6X0Pbw4aLdFnVVFLVNLtds4Y1/a+h7WHDRToMwzBIh2EYBukwDMMgHYZhGKTDMAyDdBiGYZAOwzAM0mEYBukwDMNG3/4fXrze1tJWD6UAAAAASUVORK5CYII=" width="419" height="185" class="img_CujE"></p><p>Jika dilihat dari keterangan error, sebenarnya cukup jelas bagian mana yang menjadi sumber masalah, yaitu field <code>name</code> yang terdeteksi sebagai private property.</p><p>Struct jika didefinisikan di file yang sama dengan statement pemanggilan struct tersebut tidak akan menghasilkan error. Tetapi jika definisi struct-nya terpisah dari statement pemanggilan struct (seperti contoh di atas), maka field dari struct tersebut harus publik.</p><p>Caranya membuat field sebagai publik adalah dengan menambahkan keyword <code>pub</code> pada property struct. Silakan ubah definisi struct <code>GamingConsole</code> menjadi seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// before</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">GamingConsole</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// after</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">GamingConsole</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat keyword <code>pub</code> ditambahkan pada deklarasi property struct. yang sebelumnya <code>name: String</code> sekarang ada keyword <code>pub</code> didepannya.</p><blockquote><p>Lebih jelasnya mengenai visibility property dibahas pada chapter <a href="/basic/visibility-privacy">Module System ➜ Visibility & Privacy</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a239-tuple-struct-property-visibility">A.23.9. Tuple struct property visibility<a class="hash-link" href="#a239-tuple-struct-property-visibility" title="Direct link to heading">​</a></h2><p>Lalu bagaimana dengan tuple struct? apakah property-nya juga harus didefinisikan publik agar bisa diakses dari tempat lain? Jawabannya ada di praktik berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── main.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> ├─── models.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── models</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── color.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">models</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> red </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">models</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">color</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">255</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">255</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:#?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> red</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/models.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">color</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/models/color.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Struct" src="/assets/images/struct-7-517c0402e96dfd5898464887fa79ec98.png" width="626" height="255" class="img_CujE"></p><p>Yap, error yang mirip juga muncul. Jadi jawaban dari pertanyaan sebelumnya adalah iya, property tuple struct juga harus publik agar bisa diakses dari tempat lain.</p><p>Cara deklarasi tuple struct dengan property publik adalah dengan menambahkan keyword <code>pub</code> di masing-masing deklarasi parameter tuple struct. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// before</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// after</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Color</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan program untuk melihat hasilnya, error tidak muncul.</p><blockquote><p>Lebih jelasnya mengenai visibility property dibahas pada chapter <a href="/basic/visibility-privacy">Module System ➜ Visibility & Privacy</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a2310-generic-pada-struct">A.23.10. Generic pada struct<a class="hash-link" href="#a2310-generic-pada-struct" title="Direct link to heading">​</a></h2><p>Pembahasan mengenai generic pada struct ada pada chapter <a href="/basic/generics#a365-generics-struct">Generics</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/struct" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../struct</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch05-00-structs.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch05-00-structs.html</a></li><li><a href="https://doc.rust-lang.org/book/ch05-01-defining-structs.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch05-01-defining-structs.html</a></li><li><a href="https://doc.rust-lang.org/std/keyword.struct.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.struct.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/custom_types/structs.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/custom_types/structs.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/module-scope-item-access"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.22. Module System ➜ Scope & Akses Item</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/associated-function"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.24. Associated Function</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a231-konsep-struct" class="table-of-contents__link toc-highlight">A.23.1. Konsep Struct</a></li><li><a href="#a232-pembuatan-struct" class="table-of-contents__link toc-highlight">A.23.2. Pembuatan struct</a><ul><li><a href="#-fungsi-stringfrom" class="table-of-contents__link toc-highlight">◉ Fungsi <code>String::from()</code></a></li><li><a href="#-naming-convention-struct" class="table-of-contents__link toc-highlight">◉ <em>Naming convention</em> struct</a></li></ul></li><li><a href="#a233-mutable-struct" class="table-of-contents__link toc-highlight">A.23.3. Mutable struct</a></li><li><a href="#a234-macam-macam-notasi-deklarasi-variabel-struct" class="table-of-contents__link toc-highlight">A.23.4. Macam-macam notasi deklarasi variabel struct</a><ul><li><a href="#-type-inference--manifest-typing" class="table-of-contents__link toc-highlight">◉ <em>type inference</em> / <em>manifest typing</em></a></li><li><a href="#-variabel-struct-tanpa-predefined-value" class="table-of-contents__link toc-highlight">◉ Variabel struct tanpa <em>predefined value</em></a></li><li><a href="#-variabel-struct-dengan-nilai-berasal-dari-struct-lain" class="table-of-contents__link toc-highlight">◉ Variabel struct dengan nilai berasal dari struct lain</a></li><li><a href="#-field-init-shorthand" class="table-of-contents__link toc-highlight">◉ <em>Field init shorthand</em></a></li><li><a href="#-deklarasi-nilai-struct-secara-horizontal" class="table-of-contents__link toc-highlight">◉ Deklarasi nilai struct secara horizontal</a></li><li><a href="#-destructuring-assignment" class="table-of-contents__link toc-highlight">◉ <em>Destructuring assignment</em></a></li></ul></li><li><a href="#a235-unit-like-structs" class="table-of-contents__link toc-highlight">A.23.5. <em>Unit-like structs</em></a></li><li><a href="#a236-debugging-value-struct-menggunakan-derivedebug" class="table-of-contents__link toc-highlight">A.23.6. Debugging value struct menggunakan <code>#[derive(Debug)]</code></a></li><li><a href="#a237-tuple-struct" class="table-of-contents__link toc-highlight">A.23.7. Tuple struct</a></li><li><a href="#a238-struct-property-visibility" class="table-of-contents__link toc-highlight">A.23.8. Struct property visibility</a></li><li><a href="#a239-tuple-struct-property-visibility" class="table-of-contents__link toc-highlight">A.23.9. Tuple struct property visibility</a></li><li><a href="#a2310-generic-pada-struct" class="table-of-contents__link toc-highlight">A.23.10. Generic pada struct</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/tipe-data-custom-type-string-slice.html b/basic/tipe-data-custom-type-string-slice.html index 8574beab..9495f15a 100644 --- a/basic/tipe-data-custom-type-string-slice.html +++ b/basic/tipe-data-custom-type-string-slice.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-custom-type-string-slice/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-custom-type-string-slice/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.47. Tipe Data ➜ String Custom Type","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-custom-type-string-slice/#webpage"},"wordCount":304,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-custom-type-string-slice/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-custom-type-string-slice/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-custom-type-string-slice","name":"A.47. Tipe Data ➜ String Custom Type","description":"Pembahasan kali ini lingkupnya masih dalam topik custom type String.","datePublished":"2024-08-01T10:17:30.704Z","dateModified":"2024-08-01T10:17:30.704Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-custom-type-string-slice/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-custom-type-string-slice"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-custom-type-string-slice/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.47. Tipe Data ➜ String Custom Type","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-custom-type-string-slice/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-custom-type-string-slice/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.47. Tipe Data ➜ String Custom Type","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-custom-type-string-slice/#webpage"},"wordCount":304,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-custom-type-string-slice/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-custom-type-string-slice/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-custom-type-string-slice","name":"A.47. Tipe Data ➜ String Custom Type","description":"Pembahasan kali ini lingkupnya masih dalam topik custom type String.","datePublished":"2024-08-30T07:44:50.768Z","dateModified":"2024-08-30T07:44:50.768Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-custom-type-string-slice/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-custom-type-string-slice"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-custom-type-string-slice/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.47. Tipe Data ➜ String Custom Type","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> <div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.47. Tipe Data ➜ String Custom Type</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.47. Tipe Data ➜ String Custom Type</h1></header><p>Pembahasan kali ini lingkupnya masih dalam topik custom type <code>String</code>.</p><p>Penulis rasa 2 chapter terakhir sudah cukup banyak menjelaskan perihal apa itu tipe data <code>String</code>, apa perbedaannya dibanding <code>&str</code>, dan kapan harus menggunakannya.</p><blockquote><ul><li>Pembahasan mengenai perbedaan <code>String</code> vs <code>&str</code> bisa dilihat pada chapter <a href="/basic/string-slice-vs-string-literal">String Literal (&str) vs. String Custom Type</a></li><li>Pembahasan tentang bagaimana data pada string slice di-manage di memory bisa dilihat pada chapter <a href="/basic/slice-memory-management">Slice Memory Management</a></li></ul></blockquote><p>Chapter ini akan lebih fokus ke fitur yang tersedia pada tipe <code>String</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a471-pembuatan-string-slice">A.47.1. Pembuatan string slice<a class="hash-link" href="#a471-pembuatan-string-slice" title="Direct link to heading">​</a></h2><p>Ada banyak cara yang bisa digunakan dalam membuat data <code>String</code>, di antaranya:</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-to_string-milik-str">◉ Method <code>to_string</code> milik <code>&str</code><a class="hash-link" href="#-method-to_string-milik-str" title="Direct link to heading">​</a></h3><p>Method <code>to_string</code> milik <code>&str</code> mengkonversi string literal menjadi <code>String</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"iPhone 8"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{str2}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// iPhone 8</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-stringfrom">◉ <code>String::from</code><a class="hash-link" href="#-stringfrom" title="Direct link to heading">​</a></h3><p>Associated function <code>String::from</code> digunakan untuk mengkonversi <code>&str</code> ke bentuk <code>String</code>. Kita sudah cukup sering menggunakan fungsi ini.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Nokia 3310"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{str1}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Nokia 3310</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-stringnew">◉ <code>String::new</code><a class="hash-link" href="#-stringnew" title="Direct link to heading">​</a></h3><p>Associated function <code>String::new</code> menghasilkan data string kosong.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{str3}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ""</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-stringfrom_utf8">◉ <code>String::from_utf8</code><a class="hash-link" href="#-stringfrom_utf8" title="Direct link to heading">​</a></h3><p>Berguna untuk mengkonversi data bytes ke tipe <code>String</code>. Fungsi ini nilai baliknya bertipe <code>Result<String, FromUtf8Error></code>, maka dalam penerapannya harus di-chain dengan method <code>unwrap</code> untuk mendapatkan data <code>String</code>-nya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from_utf8</span><span class="token punctuation" style="color:#393A34">(</span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">78</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">55</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">51</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{str4}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// N73</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Lebih jelasnya mengenai tipe <code>Result</code> dibahas pada chapter <a href="/basic/result-type">Tipe Data ➜ Result</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a472-string-mutability">A.47.2. String mutability<a class="hash-link" href="#a472-string-mutability" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-keyword-mut">◉ Keyword <code>mut</code><a class="hash-link" href="#-keyword-mut" title="Direct link to heading">​</a></h3><p>Keyword <code>mut</code> bisa digunakan untuk mengganti/replace data string dengan data baru. Sebagai contoh, <code>str5</code> berikut yang awalnya adalah string kosong di-replace dengan <code>Pixel 5</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> str5 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{str5}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// ""</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">str5 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Pixel 5"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{str5}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Pixel 5</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-replace-string--method-replace">◉ Replace string / method <code>replace</code><a class="hash-link" href="#-replace-string--method-replace" title="Direct link to heading">​</a></h3><p>Method <code>replace</code> digunakan untuk mengganti suatu substring dengan string lain. Method ini menghasilkan object <code>String</code> baru dan tidak mengubah data string aslinya. Karena alasan itu juga kenapa tidak perlu menggunakan keyword <code>mut</code> dalam penerapannya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str9 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"my phone is Pixel 6"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str10 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> str9</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">replace</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Pixel 6"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Nokia 3310"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str9: {str9}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// my phone is Pixel 6</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"str10: {str10}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// my phone is Nokia 3310</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-prepend-string--method-insert_str">◉ Prepend string / method <code>insert_str</code><a class="hash-link" href="#-prepend-string--method-insert_str" title="Direct link to heading">​</a></h3><p>Method <code>insert_str</code> digunakan untuk menyisipkan substring pada posisi tertentu.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> str6 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Pixel 6"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{str6}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Pixel 6</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">str6</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">insert_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"my phone"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{str6}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// my phonePixel 6</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">str6</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">insert_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">" is "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{str6}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// my phone is Pixel 6</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Parameter pertama menentukan posisi indeks string yang disisipkan.</p><ul><li>String <code>Pixel 6</code> pada indeks 0 disisipi string <code>my phone</code>, hasilnya <code>my phonePixel 6</code></li><li>String <code>my phonePixel 6</code> pada indeks 8 disisipi string <code>is</code>, hasilnya <code>my phone is Pixel 6</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-prepend-char--method-insert">◉ Prepend char / method <code>insert</code><a class="hash-link" href="#-prepend-char--method-insert" title="Direct link to heading">​</a></h3><p>Method <code>insert</code> kegunaannya sama seperti <code>insert_str</code> yaitu untuk menyisipkan string pada posisi tertentu. Perbedaannya, pada method <code>insert</code> parameter kedua diisi dengan char.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> str7 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"3310"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">str7</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">insert</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token char">'N'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// N3310</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">str7</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">insert</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token char">'o'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No3310</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">str7</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">insert</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token char">'k'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Nok3310</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">str7</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">insert</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token char">'i'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Noki3310</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">str7</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">insert</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token char">'a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Nokia3310</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">str7</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">insert</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token char">' '</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Nokia 3310</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-append-string--method-push_str">◉ Append string / method <code>push_str</code><a class="hash-link" href="#-append-string--method-push_str" title="Direct link to heading">​</a></h3><p>Method <code>push_str</code> digunakan untuk menambahkan string di akhir.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> str8 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Pixel 6"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Pixel 6</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">str8</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push_str</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">" is a good phone"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Pixel 6 is a good phone</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-append-char--method-push">◉ Append char / method <code>push</code><a class="hash-link" href="#-append-char--method-push" title="Direct link to heading">​</a></h3><p>Method <code>push</code> sama kegunaannya seperti <code>push_str</code>, namun untuk penambahan data <code>char</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> str8 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Pixel"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">str8</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token char">' '</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// "Pixel "</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">str8</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token char">'7'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// "Pixel 7"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-clear-string--method-clear">◉ Clear string / method <code>clear</code><a class="hash-link" href="#-clear-string--method-clear" title="Direct link to heading">​</a></h3><p>Method <code>clear</code> digunakan untuk mengosongkan data string.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> str11 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Nokia 3310"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">str11</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">clear</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{str11}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ""</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a473-operasi-string-lainnya">A.47.3. Operasi string lainnya<a class="hash-link" href="#a473-operasi-string-lainnya" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-cek-substring--method-contains">◉ Cek substring / method <code>contains</code><a class="hash-link" href="#-cek-substring--method-contains" title="Direct link to heading">​</a></h3><p>Method <code>contains</code> digunakan untuk mengecek apakah suatu substring yang dicari ada atau tidak. Method ini mengembalikan nilai bertipe <code>bool</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str11 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Nokia 3310"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> is_exists </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> str11</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">contains</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"3310"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{is_exists}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// true</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> is_exists </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> str11</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">contains</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"3315"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{is_exists}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// false</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-concat-strings--slice-join">◉ Concat strings / slice <code>join</code><a class="hash-link" href="#-concat-strings--slice-join" title="Direct link to heading">​</a></h3><p>Operasi concat string bisa dilakukan memanfaatkan method <code>insert_str</code> atau <code>push_str</code>. Selain itu juga bisa dengan menggunakan method <code>.join</code> milik slice. Caranya, jadikan string yang ingin di-gabung sebagai element array, kemudian akses method <code>.join</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str12 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"iPhone"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str13 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"12"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> str14 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"Pro"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">str12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> str13</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> str14</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">join</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">" "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{str}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// iPhone 12 Pro</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/tipe_data_custom_type_string_slice" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../tipe_data_custom_type_string_slice</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/tipe-data-string-literal">Tipe Data ➜ String Literal (&str)</a></li><li><a href="/basic/static">Static Item</a></li><li><a href="/basic/lifetime">Lifetime</a></li><li><a href="/basic/slice-memory-management">Slice Memory Management</a></li><li><a href="/basic/string-slice-vs-string-literal">String Literal (&str) vs. String Custom Type</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/std/string/struct.String.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/string/struct.String.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/string-slice-vs-string-literal"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.46. String Literal (&str) vs. String Custom Type</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/closures"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.48. Closures</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a471-pembuatan-string-slice" class="table-of-contents__link toc-highlight">A.47.1. Pembuatan string slice</a><ul><li><a href="#-method-to_string-milik-str" class="table-of-contents__link toc-highlight">◉ Method <code>to_string</code> milik <code>&str</code></a></li><li><a href="#-stringfrom" class="table-of-contents__link toc-highlight">◉ <code>String::from</code></a></li><li><a href="#-stringnew" class="table-of-contents__link toc-highlight">◉ <code>String::new</code></a></li><li><a href="#-stringfrom_utf8" class="table-of-contents__link toc-highlight">◉ <code>String::from_utf8</code></a></li></ul></li><li><a href="#a472-string-mutability" class="table-of-contents__link toc-highlight">A.47.2. String mutability</a><ul><li><a href="#-keyword-mut" class="table-of-contents__link toc-highlight">◉ Keyword <code>mut</code></a></li><li><a href="#-replace-string--method-replace" class="table-of-contents__link toc-highlight">◉ Replace string / method <code>replace</code></a></li><li><a href="#-prepend-string--method-insert_str" class="table-of-contents__link toc-highlight">◉ Prepend string / method <code>insert_str</code></a></li><li><a href="#-prepend-char--method-insert" class="table-of-contents__link toc-highlight">◉ Prepend char / method <code>insert</code></a></li><li><a href="#-append-string--method-push_str" class="table-of-contents__link toc-highlight">◉ Append string / method <code>push_str</code></a></li><li><a href="#-append-char--method-push" class="table-of-contents__link toc-highlight">◉ Append char / method <code>push</code></a></li><li><a href="#-clear-string--method-clear" class="table-of-contents__link toc-highlight">◉ Clear string / method <code>clear</code></a></li></ul></li><li><a href="#a473-operasi-string-lainnya" class="table-of-contents__link toc-highlight">A.47.3. Operasi string lainnya</a><ul><li><a href="#-cek-substring--method-contains" class="table-of-contents__link toc-highlight">◉ Cek substring / method <code>contains</code></a></li><li><a href="#-concat-strings--slice-join" class="table-of-contents__link toc-highlight">◉ Concat strings / slice <code>join</code></a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/tipe-data-primitive-scalar.html b/basic/tipe-data-primitive-scalar.html index fd1dad1e..ed948f5f 100644 --- a/basic/tipe-data-primitive-scalar.html +++ b/basic/tipe-data-primitive-scalar.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-primitive-scalar/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-primitive-scalar/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.5. Tipe Data ➜ Primitive Scalar","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-primitive-scalar/#webpage"},"wordCount":625,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-primitive-scalar/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-primitive-scalar/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-primitive-scalar","name":"A.5. Tipe Data ➜ Primitive Scalar","description":"Tipe data di Rust dikategorikan menjadi beberapa group, salah satunya adalah group tipe data primitif scalar atau biasa disebut scalar types. Pada chapter ini kita akan mempelajarinya.","datePublished":"2024-08-01T10:17:30.797Z","dateModified":"2024-08-01T10:17:30.797Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-primitive-scalar/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-primitive-scalar"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-primitive-scalar/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.5. Tipe Data ➜ Primitive Scalar","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-primitive-scalar/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-primitive-scalar/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.5. Tipe Data ➜ Primitive Scalar","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-primitive-scalar/#webpage"},"wordCount":625,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-primitive-scalar/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-primitive-scalar/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-primitive-scalar","name":"A.5. Tipe Data ➜ Primitive Scalar","description":"Tipe data di Rust dikategorikan menjadi beberapa group, salah satunya adalah group tipe data primitif scalar atau biasa disebut scalar types. Pada chapter ini kita akan mempelajarinya.","datePublished":"2024-08-30T07:44:50.860Z","dateModified":"2024-08-30T07:44:50.860Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-primitive-scalar/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-primitive-scalar"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-primitive-scalar/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.5. Tipe Data ➜ Primitive Scalar","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.5. Tipe Data ➜ Primitive Scalar</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.5. Tipe Data ➜ Primitive Scalar</h1></header><p>Tipe data di Rust dikategorikan menjadi beberapa group, salah satunya adalah group tipe data primitif scalar atau biasa disebut <strong>scalar types</strong>. Pada chapter ini kita akan mempelajarinya.</p><p>Tipe data scalar sendiri merupakan tipe data primitif yang isinya hanya 1 nilai. Rust memiliki 4 tipe scalar, yaitu integers, floating-point, boolean, dan character.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a51-signed-integers">A.5.1. Signed integers<a class="hash-link" href="#a51-signed-integers" title="Direct link to heading">​</a></h2><p>Signed integer merupakan tipe data numerik/integer yang bisa menampung nilai positif dan juga negatif. Ada beberapa tipe data singed integer tersedia di Rust yang dibedakan sesuai size-nya.</p><p>Tipe data ini keyword-nya ditandai dengan huruf awalan <code>i</code>, contohnya <code>i8</code>, yang mana tipe ini adalah tipe data numerik integer dengan range value yang bisa ditampung adalah mulai dari angka <strong>−128</strong> (didapat dari −(2<sup>7</sup>) hingga <strong>127</strong> (didapat dari 2<sup>7</sup>-1).</p><p>Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numerik1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numerik2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i8</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numerik3</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} | {} | {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numerik1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numerik2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numerik3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output ==> 24 | 2 | 12</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dengan menggunakan teknik deklarasi <em>type inference</em>, maka default angka numerik tipe datanya adalah <code>i32</code>.</p><p>Range value pada tipe data itu cukup penting untuk diperhatikan, jika ada sebuah variabel yang tipe datanya pasti dan diisi dengan nilai di luar kapasitas yang bisa ditampung, maka akan muncul error. Contoh, tipe data <code>i8</code>, jika diisi nilai <code>128</code> maka error.</p><p><img loading="lazy" alt="data type error" src="/assets/images/tipe-data-primitive-scalar-1-7710e1ad76b0cc40fbae8a8d42ead294.png" width="642" height="488" class="img_ev3q"></p><p>Umumnya, tipe data <code>i32</code> cukup digunakan untuk kebutuhan menampung nilai, namun sebenarnya ada banyak case lainnya di mana kita perlu tipe dengan size yang lebih besar seperti <code>i64</code>.</p><p>Berikut merupakan list tipe data signed integers yang ada di Rust. Tidak perlu dihafal.</p><table><thead><tr><th>Tipe data</th><th>Deskripsi</th></tr></thead><tbody><tr><td><code>i8</code></td><td>−(2<sup>7</sup>) hingga (2<sup>7</sup>)-1</td></tr><tr><td><code>i16</code></td><td>−(2<sup>15</sup>) hingga (2<sup>15</sup>)-1</td></tr><tr><td><code>i32</code></td><td>−(2<sup>31</sup>) hingga (2<sup>31</sup>)-1</td></tr><tr><td><code>i64</code></td><td>−(2<sup>63</sup>) hingga (2<sup>63</sup>)-1</td></tr><tr><td><code>i128</code></td><td>−(2<sup>127</sup>) hingga (2<sup>127</sup>)-1</td></tr><tr><td><code>isize</code></td><td>tipe pointer</td></tr></tbody></table><blockquote><p>Lebih jelasnya tentang tipe data <strong>pointer</strong> dibahas pada chapter terpisah, <a href="/basic/pointer-references">Pointer & References</a></p></blockquote><p>Bisa gunakan <code>tipedata::MIN</code> dan <code>tipedata::MAX</code> untuk mengetahui nilai minimal dan juga maksimal tipe data signed integers.</p><p>Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> min_i8 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i8</span><span class="token punctuation" style="color:#393A34">::</span><span class="token constant" style="color:#36acaa">MIN</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max_i8 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i8</span><span class="token punctuation" style="color:#393A34">::</span><span class="token constant" style="color:#36acaa">MAX</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} | {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> min_i8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> max_i8</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output ==> -128 | 127</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Notasi <code>i8::MIN</code> dan <code>i8::MAX</code> memiliki tanda <code>::</code> yang di Rust merupakan path separator. Untuk sekarang penulis anjurkan tidak terlalu pusing memahami apa itu path separator, karena nantinya akan ada pembahasan yang cukup detail khusus untuk mengupas topik tersebut.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a52-unsigned-integers">A.5.2. Unsigned integers<a class="hash-link" href="#a52-unsigned-integers" title="Direct link to heading">​</a></h2><p>Perbedaan antara signed dan unsigned adalah pada range value yang ditampung, size-nya sama, hanya angka minimal dan maksimalnya berbeda.</p><p>Unsigned di sini maksudnya adalah hanya bisa menampung angka mulai dari 0. Tipe data unsigned tidak bisa menampung angka negatif (jika dipaksa akan memunculkan error).</p><p>Berikut list tipe data unsigned integer pada Rust:</p><table><thead><tr><th>Tipe data</th><th>Deskripsi</th></tr></thead><tbody><tr><td><code>u8</code></td><td>0 hingga (2<sup>8</sup>)-1</td></tr><tr><td><code>u16</code></td><td>0 hingga (2<sup>16</sup>)-1</td></tr><tr><td><code>u32</code></td><td>0 hingga (2<sup>32</sup>)-1</td></tr><tr><td><code>u64</code></td><td>0 hingga (2<sup>64</sup>)-1</td></tr><tr><td><code>u128</code></td><td>0 hingga (2<sup>128</sup>)-1</td></tr><tr><td><code>usize</code></td><td>tipe pointer</td></tr></tbody></table><blockquote><p>Lebih jelasnya tentang tipe data <strong>pointer</strong> dibahas pada chapter terpisah, <a href="/basic/pointer-references">Pointer & References</a></p></blockquote><p>Contoh penerapan unsigned integer:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numerik4</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">28</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numerik5</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u8</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">16</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numerik6</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">42</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} | {} | {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numerik4</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numerik5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numerik6</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output ==> 28 | 16 | 42</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa gunakan <code>tipedata::MIN</code> dan <code>tipedata::MAX</code> untuk mengetahui nilai minimal dan juga maksimal tipe data unsigned integers.</p><p>Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> min_u8 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u8</span><span class="token punctuation" style="color:#393A34">::</span><span class="token constant" style="color:#36acaa">MIN</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max_u8 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u8</span><span class="token punctuation" style="color:#393A34">::</span><span class="token constant" style="color:#36acaa">MAX</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} | {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> min_u8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> max_u8</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output ==> 0 | 255</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Catatan saja, variabel yang dideklarasikan dengan predefined value adalah numerik, by default tipe datanya adalah <code>i32</code> (signed).</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a53-floating-point">A.5.3. Floating point<a class="hash-link" href="#a53-floating-point" title="Direct link to heading">​</a></h2><p>Floating point adalah tipe data yang mendukung nilai dibelakang koma, contohnya seperti <code>3.14</code>. Di Rust ada dua tipe data floating point, yaitu <code>f32</code> dan <code>f64</code>. Contoh penggunaan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> fp1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> fp2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.1415926535</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} | {:.5}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fp1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fp2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output ==> 3.14 | 3.14159</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>O iya, jumlah digit di belakang koma bisa diatur saat diprint menggunakan <code>println</code>. Caranya dengan menggunakan notasi <code>{:.n}</code>. Sebagai contoh <code>{:.5}</code> maka akan menampilkan hanya 5 digit dibelakang koma.</p><blockquote><p>Dalam penerapan definisi variabel sekaligus nilai, jika nilai dituliskan dalam desimal seperti contohnya <code>24</code>, maka tipe data variabel penampung adalah numerik.</p><p>Jika dituliskan dalam notasi floating point, contohnya <code>3.14</code>, maka tipe data variabel penampung adalah float.</p></blockquote><p>Bisa gunakan <code>tipedata::MIN</code> dan <code>tipedata::MAX</code> untuk mengetahui nilai minimal dan juga maksimal tipe data floating point.</p><p>Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> min_f32 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token punctuation" style="color:#393A34">::</span><span class="token constant" style="color:#36acaa">MIN</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max_f32 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token punctuation" style="color:#393A34">::</span><span class="token constant" style="color:#36acaa">MAX</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"min_f32={} | max_f32={}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> min_f32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> max_f32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output ==> min_f32=-340282350000000000000000000000000000000 | max_f32=340282350000000000000000000000000000000</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Catatan saja, variabel yang dideklarasikan dengan predefined value numerik yang ada titiknya (<code>3.10</code>) adalah floating point, by default tipe datanya adalah <code>f64</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a54-bool">A.5.4. Bool<a class="hash-link" href="#a54-bool" title="Direct link to heading">​</a></h2><p>Tipe data <code>bool</code> menerima dua pilihan nilai saja, <code>true</code> atau <code>false</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> b1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> b2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} | {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output ==> true | false</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a55-char">A.5.5. Char<a class="hash-link" href="#a55-char" title="Direct link to heading">​</a></h2><p>Tipe <code>char</code> menampung sebuah data (unicode), contohnya seperti <code>'n'</code>, <code>'-'</code>, <code>'2'</code>. Penulisan literal untuk tipe ini menggunakan notasi <code>''</code>, diapit tanda petik satu.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> c1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token char">'n'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> c2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token char">'-'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> c3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token char">'2'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} | {} | {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> c1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> c2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> c3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output ==> n | - | 2</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a56-pointer-scalar">A.5.6. Pointer scalar<a class="hash-link" href="#a56-pointer-scalar" title="Direct link to heading">​</a></h2><p>Deklarasi tipe data pointer cukup mudah, yaitu dengan menuliskan deklarasinya seperti biasa tapi ditambahkan karakter <code>&</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> ptr1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> ptr1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output ==> 24</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Perihal apa itu tipe data pointer dan apa kegunaan prefix <code>&</code> akan dibahas pada chapter terpisah, yaitu <a href="/basic/pointer-references">Pointer & References</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a57-tipe-data-primitive-compound">A.5.7. Tipe data primitive compound<a class="hash-link" href="#a57-tipe-data-primitive-compound" title="Direct link to heading">​</a></h2><p>Selain beberapa tipe data yang sudah dibahas di atas, ada juga jenis tipe data primitif jenis lainnya, yaitu primitive compound yang di antaranya adalah <a href="/basic/array">Array</a> dan <a href="/basic/tuple">Tuple</a>. Lebih detailnya mengenai tipe tersebut dibahas pada chapter terpisah.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/tipe_data_primitive_scalar" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../tipe_data_primitive_scalar</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/tipe-data-string-literal">Tipe Data ➜ String Literal (&str)</a></li><li><a href="/basic/array">Array</a></li><li><a href="/basic/slice">Slice (Basic)</a></li><li><a href="/basic/tuple">Tuple</a></li><li><a href="/basic/tipe-data-custom-type-string-slice">Tipe Data ➜ String Custom Type</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/rust-by-example/primitives.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/primitives.html</a></li><li><a href="https://doc.rust-lang.org/std/fmt/index.html#syntax" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/fmt/index.html#syntax</a></li><li><a href="https://en.wikipedia.org/wiki/Integer_(computer_science)" target="_blank" rel="noopener noreferrer">https://en.wikipedia.org/wiki/Integer_(computer_science)</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/variabel"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.4. Variabel</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/tipe-data-string-literal"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.6. Tipe Data ➜ String Literal (&str)</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a51-signed-integers" class="table-of-contents__link toc-highlight">A.5.1. Signed integers</a></li><li><a href="#a52-unsigned-integers" class="table-of-contents__link toc-highlight">A.5.2. Unsigned integers</a></li><li><a href="#a53-floating-point" class="table-of-contents__link toc-highlight">A.5.3. Floating point</a></li><li><a href="#a54-bool" class="table-of-contents__link toc-highlight">A.5.4. Bool</a></li><li><a href="#a55-char" class="table-of-contents__link toc-highlight">A.5.5. Char</a></li><li><a href="#a56-pointer-scalar" class="table-of-contents__link toc-highlight">A.5.6. Pointer scalar</a></li><li><a href="#a57-tipe-data-primitive-compound" class="table-of-contents__link toc-highlight">A.5.7. Tipe data primitive compound</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.5. Tipe Data ➜ Primitive Scalar</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.5. Tipe Data ➜ Primitive Scalar</h1></header><p>Tipe data di Rust dikategorikan menjadi beberapa group, salah satunya adalah group tipe data primitif scalar atau biasa disebut <strong>scalar types</strong>. Pada chapter ini kita akan mempelajarinya.</p><p>Tipe data scalar sendiri merupakan tipe data primitif yang isinya hanya 1 nilai. Rust memiliki 4 tipe scalar, yaitu integers, floating-point, boolean, dan character.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a51-signed-integers">A.5.1. Signed integers<a class="hash-link" href="#a51-signed-integers" title="Direct link to heading">​</a></h2><p>Signed integer merupakan tipe data numerik/integer yang bisa menampung nilai positif dan juga negatif. Ada beberapa tipe data singed integer tersedia di Rust yang dibedakan sesuai size-nya.</p><p>Tipe data ini keyword-nya ditandai dengan huruf awalan <code>i</code>, contohnya <code>i8</code>, yang mana tipe ini adalah tipe data numerik integer dengan range value yang bisa ditampung adalah mulai dari angka <strong>−128</strong> (didapat dari −(2<sup>7</sup>) hingga <strong>127</strong> (didapat dari 2<sup>7</sup>-1).</p><p>Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numerik1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numerik2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i8</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numerik3</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} | {} | {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numerik1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numerik2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numerik3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output ==> 24 | 2 | 12</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dengan menggunakan teknik deklarasi <em>type inference</em>, maka default angka numerik tipe datanya adalah <code>i32</code>.</p><p>Range value pada tipe data itu cukup penting untuk diperhatikan, jika ada sebuah variabel yang tipe datanya pasti dan diisi dengan nilai di luar kapasitas yang bisa ditampung, maka akan muncul error. Contoh, tipe data <code>i8</code>, jika diisi nilai <code>128</code> maka error.</p><p><img loading="eager" fetchpriority="high" alt="data type error" src="/assets/images/tipe-data-primitive-scalar-1-7710e1ad76b0cc40fbae8a8d42ead294.png" width="642" height="488" class="img_CujE"></p><p>Umumnya, tipe data <code>i32</code> cukup digunakan untuk kebutuhan menampung nilai, namun sebenarnya ada banyak case lainnya di mana kita perlu tipe dengan size yang lebih besar seperti <code>i64</code>.</p><p>Berikut merupakan list tipe data signed integers yang ada di Rust. Tidak perlu dihafal.</p><table><thead><tr><th>Tipe data</th><th>Deskripsi</th></tr></thead><tbody><tr><td><code>i8</code></td><td>−(2<sup>7</sup>) hingga (2<sup>7</sup>)-1</td></tr><tr><td><code>i16</code></td><td>−(2<sup>15</sup>) hingga (2<sup>15</sup>)-1</td></tr><tr><td><code>i32</code></td><td>−(2<sup>31</sup>) hingga (2<sup>31</sup>)-1</td></tr><tr><td><code>i64</code></td><td>−(2<sup>63</sup>) hingga (2<sup>63</sup>)-1</td></tr><tr><td><code>i128</code></td><td>−(2<sup>127</sup>) hingga (2<sup>127</sup>)-1</td></tr><tr><td><code>isize</code></td><td>tipe pointer</td></tr></tbody></table><blockquote><p>Lebih jelasnya tentang tipe data <strong>pointer</strong> dibahas pada chapter terpisah, <a href="/basic/pointer-references">Pointer & References</a></p></blockquote><p>Bisa gunakan <code>tipedata::MIN</code> dan <code>tipedata::MAX</code> untuk mengetahui nilai minimal dan juga maksimal tipe data signed integers.</p><p>Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> min_i8 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i8</span><span class="token punctuation" style="color:#393A34">::</span><span class="token constant" style="color:#36acaa">MIN</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max_i8 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i8</span><span class="token punctuation" style="color:#393A34">::</span><span class="token constant" style="color:#36acaa">MAX</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} | {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> min_i8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> max_i8</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output ==> -128 | 127</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Notasi <code>i8::MIN</code> dan <code>i8::MAX</code> memiliki tanda <code>::</code> yang di Rust merupakan path separator. Untuk sekarang penulis anjurkan tidak terlalu pusing memahami apa itu path separator, karena nantinya akan ada pembahasan yang cukup detail khusus untuk mengupas topik tersebut.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a52-unsigned-integers">A.5.2. Unsigned integers<a class="hash-link" href="#a52-unsigned-integers" title="Direct link to heading">​</a></h2><p>Perbedaan antara signed dan unsigned adalah pada range value yang ditampung, size-nya sama, hanya angka minimal dan maksimalnya berbeda.</p><p>Unsigned di sini maksudnya adalah hanya bisa menampung angka mulai dari 0. Tipe data unsigned tidak bisa menampung angka negatif (jika dipaksa akan memunculkan error).</p><p>Berikut list tipe data unsigned integer pada Rust:</p><table><thead><tr><th>Tipe data</th><th>Deskripsi</th></tr></thead><tbody><tr><td><code>u8</code></td><td>0 hingga (2<sup>8</sup>)-1</td></tr><tr><td><code>u16</code></td><td>0 hingga (2<sup>16</sup>)-1</td></tr><tr><td><code>u32</code></td><td>0 hingga (2<sup>32</sup>)-1</td></tr><tr><td><code>u64</code></td><td>0 hingga (2<sup>64</sup>)-1</td></tr><tr><td><code>u128</code></td><td>0 hingga (2<sup>128</sup>)-1</td></tr><tr><td><code>usize</code></td><td>tipe pointer</td></tr></tbody></table><blockquote><p>Lebih jelasnya tentang tipe data <strong>pointer</strong> dibahas pada chapter terpisah, <a href="/basic/pointer-references">Pointer & References</a></p></blockquote><p>Contoh penerapan unsigned integer:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numerik4</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">28</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numerik5</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u8</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">16</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numerik6</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">42</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} | {} | {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numerik4</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numerik5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> numerik6</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output ==> 28 | 16 | 42</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa gunakan <code>tipedata::MIN</code> dan <code>tipedata::MAX</code> untuk mengetahui nilai minimal dan juga maksimal tipe data unsigned integers.</p><p>Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> min_u8 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u8</span><span class="token punctuation" style="color:#393A34">::</span><span class="token constant" style="color:#36acaa">MIN</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max_u8 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u8</span><span class="token punctuation" style="color:#393A34">::</span><span class="token constant" style="color:#36acaa">MAX</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} | {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> min_u8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> max_u8</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output ==> 0 | 255</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Catatan saja, variabel yang dideklarasikan dengan predefined value adalah numerik, by default tipe datanya adalah <code>i32</code> (signed).</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a53-floating-point">A.5.3. Floating point<a class="hash-link" href="#a53-floating-point" title="Direct link to heading">​</a></h2><p>Floating point adalah tipe data yang mendukung nilai dibelakang koma, contohnya seperti <code>3.14</code>. Di Rust ada dua tipe data floating point, yaitu <code>f32</code> dan <code>f64</code>. Contoh penggunaan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> fp1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.14</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> fp2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.1415926535</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} | {:.5}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fp1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> fp2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output ==> 3.14 | 3.14159</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>O iya, jumlah digit di belakang koma bisa diatur saat diprint menggunakan <code>println</code>. Caranya dengan menggunakan notasi <code>{:.n}</code>. Sebagai contoh <code>{:.5}</code> maka akan menampilkan hanya 5 digit dibelakang koma.</p><blockquote><p>Dalam penerapan definisi variabel sekaligus nilai, jika nilai dituliskan dalam desimal seperti contohnya <code>24</code>, maka tipe data variabel penampung adalah numerik.</p><p>Jika dituliskan dalam notasi floating point, contohnya <code>3.14</code>, maka tipe data variabel penampung adalah float.</p></blockquote><p>Bisa gunakan <code>tipedata::MIN</code> dan <code>tipedata::MAX</code> untuk mengetahui nilai minimal dan juga maksimal tipe data floating point.</p><p>Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> min_f32 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token punctuation" style="color:#393A34">::</span><span class="token constant" style="color:#36acaa">MIN</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max_f32 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token punctuation" style="color:#393A34">::</span><span class="token constant" style="color:#36acaa">MAX</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"min_f32={} | max_f32={}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> min_f32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> max_f32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output ==> min_f32=-340282350000000000000000000000000000000 | max_f32=340282350000000000000000000000000000000</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Catatan saja, variabel yang dideklarasikan dengan predefined value numerik yang ada titiknya (<code>3.10</code>) adalah floating point, by default tipe datanya adalah <code>f64</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a54-bool">A.5.4. Bool<a class="hash-link" href="#a54-bool" title="Direct link to heading">​</a></h2><p>Tipe data <code>bool</code> menerima dua pilihan nilai saja, <code>true</code> atau <code>false</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> b1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> b2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} | {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output ==> true | false</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a55-char">A.5.5. Char<a class="hash-link" href="#a55-char" title="Direct link to heading">​</a></h2><p>Tipe <code>char</code> menampung sebuah data (unicode), contohnya seperti <code>'n'</code>, <code>'-'</code>, <code>'2'</code>. Penulisan literal untuk tipe ini menggunakan notasi <code>''</code>, diapit tanda petik satu.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> c1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token char">'n'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> c2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token char">'-'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> c3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token char">'2'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} | {} | {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> c1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> c2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> c3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output ==> n | - | 2</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a56-pointer-scalar">A.5.6. Pointer scalar<a class="hash-link" href="#a56-pointer-scalar" title="Direct link to heading">​</a></h2><p>Deklarasi tipe data pointer cukup mudah, yaitu dengan menuliskan deklarasinya seperti biasa tapi ditambahkan karakter <code>&</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> ptr1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> ptr1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// output ==> 24</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Perihal apa itu tipe data pointer dan apa kegunaan prefix <code>&</code> akan dibahas pada chapter terpisah, yaitu <a href="/basic/pointer-references">Pointer & References</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a57-tipe-data-primitive-compound">A.5.7. Tipe data primitive compound<a class="hash-link" href="#a57-tipe-data-primitive-compound" title="Direct link to heading">​</a></h2><p>Selain beberapa tipe data yang sudah dibahas di atas, ada juga jenis tipe data primitif jenis lainnya, yaitu primitive compound yang di antaranya adalah <a href="/basic/array">Array</a> dan <a href="/basic/tuple">Tuple</a>. Lebih detailnya mengenai tipe tersebut dibahas pada chapter terpisah.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/tipe_data_primitive_scalar" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../tipe_data_primitive_scalar</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/tipe-data-string-literal">Tipe Data ➜ String Literal (&str)</a></li><li><a href="/basic/array">Array</a></li><li><a href="/basic/slice">Slice (Basic)</a></li><li><a href="/basic/tuple">Tuple</a></li><li><a href="/basic/tipe-data-custom-type-string-slice">Tipe Data ➜ String Custom Type</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/rust-by-example/primitives.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/primitives.html</a></li><li><a href="https://doc.rust-lang.org/std/fmt/index.html#syntax" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/fmt/index.html#syntax</a></li><li><a href="https://en.wikipedia.org/wiki/Integer_(computer_science)" target="_blank" rel="noopener noreferrer">https://en.wikipedia.org/wiki/Integer_(computer_science)</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/variabel"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.4. Variabel</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/tipe-data-string-literal"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.6. Tipe Data ➜ String Literal (&str)</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a51-signed-integers" class="table-of-contents__link toc-highlight">A.5.1. Signed integers</a></li><li><a href="#a52-unsigned-integers" class="table-of-contents__link toc-highlight">A.5.2. Unsigned integers</a></li><li><a href="#a53-floating-point" class="table-of-contents__link toc-highlight">A.5.3. Floating point</a></li><li><a href="#a54-bool" class="table-of-contents__link toc-highlight">A.5.4. Bool</a></li><li><a href="#a55-char" class="table-of-contents__link toc-highlight">A.5.5. Char</a></li><li><a href="#a56-pointer-scalar" class="table-of-contents__link toc-highlight">A.5.6. Pointer scalar</a></li><li><a href="#a57-tipe-data-primitive-compound" class="table-of-contents__link toc-highlight">A.5.7. Tipe data primitive compound</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/tipe-data-string-literal.html b/basic/tipe-data-string-literal.html index a47e81b4..d1315e87 100644 --- a/basic/tipe-data-string-literal.html +++ b/basic/tipe-data-string-literal.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-string-literal/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-string-literal/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.6. Tipe Data ➜ String Literal (&str)","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-string-literal/#webpage"},"wordCount":434,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-string-literal/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-string-literal/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-string-literal","name":"A.6. Tipe Data ➜ String Literal (&str)","description":"String adalah tipe data penting dalam pemrograman manapun. Biasanya tiap bahasa punya cara berbeda dalam meng-handle tipe ini. Di bahasa Rust, ada dua jenis tipe data string:","datePublished":"2024-08-01T10:17:30.830Z","dateModified":"2024-08-01T10:17:30.830Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-string-literal/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-string-literal"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-string-literal/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.6. Tipe Data ➜ String Literal (&str)","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-string-literal/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-string-literal/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.6. Tipe Data ➜ String Literal (&str)","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-string-literal/#webpage"},"wordCount":434,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-string-literal/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-string-literal/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-string-literal","name":"A.6. Tipe Data ➜ String Literal (&str)","description":"String adalah tipe data penting dalam pemrograman manapun. Biasanya tiap bahasa punya cara berbeda dalam meng-handle tipe ini. Di bahasa Rust, ada dua jenis tipe data string:","datePublished":"2024-08-30T07:44:50.894Z","dateModified":"2024-08-30T07:44:50.894Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-string-literal/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-string-literal"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tipe-data-string-literal/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.6. Tipe Data ➜ String Literal (&str)","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.6. Tipe Data ➜ String Literal (&str)</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.6. Tipe Data ➜ String Literal (&str)</h1></header><p>String adalah tipe data penting dalam pemrograman manapun. Biasanya tiap bahasa punya cara berbeda dalam meng-handle tipe ini. Di bahasa Rust, ada dua jenis tipe data string:</p><ul><li>Tipe string literal (kadang disebut dengan string slice, atau <code>&str</code>). Tipe data ini ada pada nilai yang dideklarasikan dengan diapit tanda petik dua (string literal), contohnya <code>"Hello, world!"</code>.</li><li>Tipe <code>String</code> yang merupakan tipe data custom atau <em>custom types</em> yang merupakan sebuah struct. Lebih jelasnya akan kita bahas pada chapter terpisah.</li></ul><p>Chapter ini hanya fokus pada string literal, dengan level pembahasan yang tidak terlalu advance.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a61-string-literal-atau-str">A.6.1. String literal atau <code>&str</code><a class="hash-link" href="#a61-string-literal-atau-str" title="Direct link to heading">​</a></h2><blockquote><p>Kita tidak akan bahas terlalu low-level untuk topik ini, karena memang masih di chapter awal-awal.</p></blockquote><p>Rust adalah bahasa yang <em>statically typed</em>, tipe data harus diketahui saat kompilasi. Setiap pendefinisian variabel, entah itu dengan di-specify tipe datanya (contoh: <code>let x: i32 = 5</code>) atau menggunakan teknik <em>type inference</em> (contoh: <code>let x = 5</code>), tipe datanya akan diketahui di awal saat kompilasi program.</p><p>Begitu juga pada tipe string. Sebagai contoh, statement <code>let y = "hello"</code>, variabel <code>y</code> di sini memiliki tipe data, yaitu <code>&str</code>.</p><p>Apa itu tipe <code>&str</code>? Tipe <code>str</code> merupakan salah satu tipe primitif yang ada di Rust. Penulisan <code>&str</code> menandakan bahwa tipe tersebut adalah <strong>pointer <code>str</code></strong>.</p><blockquote><p>Untuk pembahasan lebih detail mengenai tanda <code>&</code> pada tipe data akan dibahas pada chapter terpisah, <a href="/basic/pointer-references">Pointer & References</a></p></blockquote><p>Untuk kawan-kawan yang menggunakan VSCode dengan ekstensi <code>rust-analyzer</code>, tipe data variabel bisa terlihat saat definisi.</p><p><img loading="lazy" alt="rust string literal" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASsAAACSCAIAAACSdHvqAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF5WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzK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zMAbnMQt2H/nqg7QaySdAsxkCbMUlB2X+ET2IgDHRCKbTcFGFystb7BkjzFDlDP8OGKGkuM+foBwO9b2B61+VN+oW66M5t/IdDv1BvGAgADISBAAYCAGAgADAQAAADAYCBTiE+svDJw4InvyyP4/cEMNAIOkDepnvoci7+UPB4ZA1+UQADdf41RPoOhcM2GxjoK3zyw/P4RQEM1EIHJRH3gjAQgNwbyCdogoEA5N7At8PKuHj7DTy4/PHDwov4SQEMVBCts99AWcICREIAA5UAqMeecbpyFooLEgAGWoiHqAcCAAMB8JOB9gMDAQzMI+gTA2BgfpD7heJSBICBAAAYCAAMBADAQABgIAAABgIAAwEAuTWwcl8kN92yAYCBxgbacN9cAGAgDAQABgIAAy3XA8OoBQKQWwMF2B2tISEAeTKQxUMYCEB+DGTTZuNqBAC5NJBlnjJs1lAAQL6yUAAADAQABgIAYCAAMBAAGAgAgIEAwEAAAAwEAAYCAGAgADAQAAADAfAo/wft4Zmp8ssd4wAAAABJRU5ErkJggg==" width="299" height="146" class="img_ev3q"></p><p>Ok, sampai sini yang paling penting adalah dipahami dulu bahwa string literal tipe datanya adalah <code>&str</code>. Jadi selanjutnya kalau melihat tipe data <code>&str</code> jangan bingung, itu berarti string.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a62-escape-karakter-menggunakan-">A.6.2. Escape karakter menggunakan <code>\</code><a class="hash-link" href="#a62-escape-karakter-menggunakan-" title="Direct link to heading">​</a></h2><p>Tanda <code>\</code> digunakan untuk <em>escape</em> beberapa karakter string.</p><p>Silakan perhatikan contoh berikut. Variabel <code>var2</code> isinya adalah string yang di dalamnya ada beberapa karakter yang di escape, yaitu tanda <code>"</code> dan baris baru atau newline.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> var2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello \</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> \"rust\" \</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> and \</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> \"world\""</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Coba jalankan kode di atas.</p><p><img loading="lazy" alt="rust string literal" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb0AAABzCAIAAACD2UtjAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9i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Ie16SuLKKMofiPe7If+h/eOOH2rNNMZkZM3CWI/vKkyXdjfLH6uzZvQSV1AGdC3a8CbvcP58rubN/390tGoZjryJkHsf5xuTUo65jdT6imnR5fwZrKrRmYvS2hOqpLme8dT480kZDr9GeLN124u9fD6wecUI/JsItXFm0uzRBDEfN68RcuyYvQOl69PryeLwvH9SZgmxqT+vL6k/I4TUvcDRIbpB17T/c20lCd/8Xs4nWmpKV08L3OufUiA5RdliSAIF28SBEEQ5E2CIAjyJkEQBHmTIAiCvEkQBEHeJAiCIG8SBEEQ5E2CIAjyJkEQBHmTIAiCvEkQBEHeJAiCIMibBEEQ5E2CIAjyJkEQBHmTIAji4vE/suSRC2XSqAIAAAAASUVORK5CYII=" width="445" height="115" class="img_ev3q"></p><p>Karena semua baris baru pada contoh di atas di-escape, jadinya string akan tetap 1 baris. Tanda <code>"</code> juga tetap muncul karena di-escape.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a63-multiline-string-literal">A.6.3. Multiline string literal<a class="hash-link" href="#a63-multiline-string-literal" title="Direct link to heading">​</a></h2><p>Penulisan string banyak baris atau <em>multiline string</em> adalah sama seperti penulisan string biasa, yaitu langsung tulis saja string dengan diapit tanda <code>"</code>, tambahkan baris baru di dalam string tersebut sesuai kebutuhan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> var3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"baris satu</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c">baris dua</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c">baris tiga"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Hasilnya adalah sesuai dengan string yang sudah didefinisikan.</p><p><img loading="lazy" alt="rust string literal" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcQAAACBCAIAAADR310jAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0i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Q36m658TAOByxVTZWIWYAsBfJ6ZLlRjNBIDLENN9zKGjvajv4c5R79CxkG6xcIwGgGbEdEdz6ERkGpwk8EQZ/oljNAA0OMzf2By6QEzdksm6iS8fADQjphubQxeIqReOTlqKYzQANBqZbmkOXTrMF2ZxcYwGgObEdHtz6FSK/KugcIwGgKbEdE9z6DC3Z+Wc2bV8HKMBYE8xPROEFS6W7gEAMS3Ff8yg6GkBAADE1JdTlu0BADEFAEBMAQAQUwAAQEwBABBTAADEFAAAMaUJAAAQUwAAxBQAADEFAADEFACgJv8D2PwwcbjrJLoAAAAASUVORK5CYII=" width="452" height="129" class="img_ev3q"></p><p>Perlu diketahui bahwa karakter spasi, baris baru, dan lainnya adalah <strong>tidak dihiraukan</strong>, jadi jika kawan-kawan menuliskan string multiline seperti ini ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> var4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"baris satu</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> baris dua</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> baris tiga"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... maka hasilnya juga sesuai dengan yang ditulis, yaitu ada 4 karakter spasi di baris ke-2 dan ke-3.</p><p><img loading="lazy" alt="rust string literal" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcEAAACCCAIAAACxYuTJAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8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Gi+/4AgIZCMJdHQAHQUAAANBQAANBQAAA0FAAADQUAQEMBAAANBQBAQwEA0FAAADQUAAANpQkAANBQAAA0FAAADQUAeCf8DzIhP4a2rvfKAAAAAElFTkSuQmCC" width="449" height="130" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a64-raw-string">A.6.4. Raw string<a class="hash-link" href="#a64-raw-string" title="Direct link to heading">​</a></h2><p>Raw string adalah istilah untuk string yang tidak meng-<em>escape</em> karakter apapun. Di Rust, string literal bisa didefinisikan dengan menuliskan string diapit <code>r#"</code> dan <code>"#</code>. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> var5 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">r#"</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> {</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> "name": "tim drake",</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> "gender": "male"</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> }</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c">"#</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kode di atas hasilnya adalah ekuivalen dengan kode di bawah ini, yang mana string didefinisikan dengan meng-escape karakter <code>"</code> menggunakan <code>\</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> var6 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> {</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> \"name\": \"cassandra cain\",</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> \"gender\": \"female\"</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> }</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c">"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var6</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="raw string literal" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAa4AAAEECAIAAAD/EEdFAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAHQmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnht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0uKlt23Mxhhel4JR53a1wXFOJdqu2u32gBZmueia5RSdnZRlI6ACuHYiCcLAFAhHMqCeBBQIQAAKgQAQIUAAKgQAAAVAgCgQp/KYXZTHkGul2w4hr4scOlUyobZppMBUCEqtH9decJ3vhBRIcDVq7ByrueUuVYKea3zUK5proSnAuxdhXoZE2XLxIGsBZmmYp6rEnSabNWskNfgy1GTLGG0vssiFRbF1gKgwp2L0EkaGJ+4DQNZCzNNozxXMeh0cRXGsWFDiRY2SQmjNYenlsbWAqDCazChH9kSBrKWpFfJea72+KqFV6uvAMM1UgMm1DIwWt11YmsBUGF1nFIwqP/8QXOBCpU811VdEahQXCNNhcbw1PViawFQ4TrSiN90JJRsRSoUKr6tVSjFpMqvKLCFpxKXCnA7KtStl35RRzLTVL6NpFCFy142UWJSFRXaw1ORIcANVoXyJWBHcMZM08SrMjdSodQkZYBsDk89FcbWAqDCa6kKuRAKAEdUoV89MeQDAAbI3CgMAEdVIQAAKgQAQIUAAKgQAGDXKrzcscadLQBAVcgz/gCACsP0EwAAVAgAgAoBAA6qQpKgAAAV9jbkiTgAOPgAmUvIAIAKqQcBABWiQgBAhagQAFAhpwoB4NAq7N+aQU0IAAyQAQBQIQAAKgQAQIUAAKgQAAAVAgCgQgAAVAgAgAoBAFAhAAAqBABAhQAAqBAAABUCANwG/wPCySSNXW5ZPQAAAABJRU5ErkJggg==" width="430" height="260" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a65-pembahasan-lanjutan-tentang-string">A.6.5. Pembahasan lanjutan tentang string<a class="hash-link" href="#a65-pembahasan-lanjutan-tentang-string" title="Direct link to heading">​</a></h2><p><strong>String adalah salah satu topik yang sangat luas cakupan pembahasannya</strong>, tidak cukup jika dirangkum dalam 1 chapter. Selain itu, bisa bikin makin bingung jika dibahas sekarang.</p><p>Penulis anjurkan untuk mempelajari chapter-chapter berikutnya secara urut terlebih dahulu.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/tipe_data_string_literal" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../tipe_data_string_literal</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/pointer-references">Pointer & References</a></li><li><a href="/basic/string-slice-vs-string-literal">String Literal (&str) vs. String Custom Type</a></li><li><a href="/basic/tipe-data-custom-type-string-slice">Tipe Data ➜ String Custom Type</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/reference/tokens.html#raw-string-literals" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/tokens.html#raw-string-literals</a></li><li><a href="https://doc.rust-lang.org/std/str/index.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/str/index.html</a></li><li><a href="https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/first-edition/strings.html" target="_blank" rel="noopener noreferrer">https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/first-edition/strings.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/tipe-data-primitive-scalar"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.5. Tipe Data ➜ Primitive Scalar</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/konstanta"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.7. Konstanta</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a61-string-literal-atau-str" class="table-of-contents__link toc-highlight">A.6.1. String literal atau <code>&str</code></a></li><li><a href="#a62-escape-karakter-menggunakan-" class="table-of-contents__link toc-highlight">A.6.2. Escape karakter menggunakan <code></code></a></li><li><a href="#a63-multiline-string-literal" class="table-of-contents__link toc-highlight">A.6.3. Multiline string literal</a></li><li><a href="#a64-raw-string" class="table-of-contents__link toc-highlight">A.6.4. Raw string</a></li><li><a href="#a65-pembahasan-lanjutan-tentang-string" class="table-of-contents__link toc-highlight">A.6.5. Pembahasan lanjutan tentang string</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.6. Tipe Data ➜ String Literal (&str)</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.6. Tipe Data ➜ String Literal (&str)</h1></header><p>String adalah tipe data penting dalam pemrograman manapun. Biasanya tiap bahasa punya cara berbeda dalam meng-handle tipe ini. Di bahasa Rust, ada dua jenis tipe data string:</p><ul><li>Tipe string literal (kadang disebut dengan string slice, atau <code>&str</code>). Tipe data ini ada pada nilai yang dideklarasikan dengan diapit tanda petik dua (string literal), contohnya <code>"Hello, world!"</code>.</li><li>Tipe <code>String</code> yang merupakan tipe data custom atau <em>custom types</em> yang merupakan sebuah struct. Lebih jelasnya akan kita bahas pada chapter terpisah.</li></ul><p>Chapter ini hanya fokus pada string literal, dengan level pembahasan yang tidak terlalu advance.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a61-string-literal-atau-str">A.6.1. String literal atau <code>&str</code><a class="hash-link" href="#a61-string-literal-atau-str" title="Direct link to heading">​</a></h2><blockquote><p>Kita tidak akan bahas terlalu low-level untuk topik ini, karena memang masih di chapter awal-awal.</p></blockquote><p>Rust adalah bahasa yang <em>statically typed</em>, tipe data harus diketahui saat kompilasi. Setiap pendefinisian variabel, entah itu dengan di-specify tipe datanya (contoh: <code>let x: i32 = 5</code>) atau menggunakan teknik <em>type inference</em> (contoh: <code>let x = 5</code>), tipe datanya akan diketahui di awal saat kompilasi program.</p><p>Begitu juga pada tipe string. Sebagai contoh, statement <code>let y = "hello"</code>, variabel <code>y</code> di sini memiliki tipe data, yaitu <code>&str</code>.</p><p>Apa itu tipe <code>&str</code>? Tipe <code>str</code> merupakan salah satu tipe primitif yang ada di Rust. Penulisan <code>&str</code> menandakan bahwa tipe tersebut adalah <strong>pointer <code>str</code></strong>.</p><blockquote><p>Untuk pembahasan lebih detail mengenai tanda <code>&</code> pada tipe data akan dibahas pada chapter terpisah, <a href="/basic/pointer-references">Pointer & References</a></p></blockquote><p>Untuk kawan-kawan yang menggunakan VSCode dengan ekstensi <code>rust-analyzer</code>, tipe data variabel bisa terlihat saat definisi.</p><p><img loading="eager" fetchpriority="high" alt="rust string literal" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASsAAACSCAIAAACSdHvqAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF5WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHht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M1E5FlT3kEEeU08wZp521cWYGIgZqWmJcOFuhYKCYeWbLQLMLAOka2BK9N3353tiO/NcDWS3r/q0RS9Us5l6N3Jqic0kzEXhmBprWA9Maxu5iA9VKoIvrgUYTopkUVmF+CrHFMqk8upl/MzmIoYGs/KURAbLTEiMNVL1isYCztk3NtIvCbMVTbSljIKkQaifp0Oxj/B90ks0kceWkHwzMAbnMQt2H/nqg7QaySdAsxkCbMUlB2X+ET2IgDHRCKbTcFGFystb7BkjzFDlDP8OGKGkuM+foBwO9b2B61+VN+oW66M5t/IdDv1BvGAgADISBAAYCAGAgADAQAAADAYCBTiE+svDJw4InvyyP4/cEMNAIOkDepnvoci7+UPB4ZA1+UQADdf41RPoOhcM2GxjoK3zyw/P4RQEM1EIHJRH3gjAQgNwbyCdogoEA5N7At8PKuHj7DTy4/PHDwov4SQEMVBCts99AWcICREIAA5UAqMeecbpyFooLEgAGWoiHqAcCAAMB8JOB9gMDAQzMI+gTA2BgfpD7heJSBICBAAAYCAAMBADAQABgIAAABgIAAwEAuTWwcl8kN92yAYCBxgbacN9cAGAgDAQABgIAAy3XA8OoBQKQWwMF2B2tISEAeTKQxUMYCEB+DGTTZuNqBAC5NJBlnjJs1lAAQL6yUAAADAQABgIAYCAAMBAAGAgAgIEAwEAAAAwEAAYCAGAgADAQAAADAfAo/wft4Zmp8ssd4wAAAABJRU5ErkJggg==" width="299" height="146" class="img_CujE"></p><p>Ok, sampai sini yang paling penting adalah dipahami dulu bahwa string literal tipe datanya adalah <code>&str</code>. Jadi selanjutnya kalau melihat tipe data <code>&str</code> jangan bingung, itu berarti string.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a62-escape-karakter-menggunakan-">A.6.2. Escape karakter menggunakan <code>\</code><a class="hash-link" href="#a62-escape-karakter-menggunakan-" title="Direct link to heading">​</a></h2><p>Tanda <code>\</code> digunakan untuk <em>escape</em> beberapa karakter string.</p><p>Silakan perhatikan contoh berikut. Variabel <code>var2</code> isinya adalah string yang di dalamnya ada beberapa karakter yang di escape, yaitu tanda <code>"</code> dan baris baru atau newline.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> var2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello \</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> \"rust\" \</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> and \</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> \"world\""</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Coba jalankan kode di atas.</p><p><img loading="lazy" alt="rust string literal" src="data:image/png;base64,iVBORw0KGgoA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mVaKVhQwWApt5UxIoNolp+fJYIgArw59K/jv/t/HftuQkxp93PwZvrKnKHhiTlGvvzzqvGm5m0t8au+v/4eXh0LUrVSOEXId5rppEG+K/EsyRJBEHPG6cOPQ4/L+6LeUcHDtO/OGsMP03HT6xZvosjXoowhIZR6Xq5wioONhxeP/9dMJw3yYtYfeZMgNudNOdaN8mbVQY2NYS1+GIe16SuLKKMofiPe7If+h/eOOH2rNNMZkZM3CWI/vKkyXdjfLH6uzZvQSV1AGdC3a8CbvcP58rubN/390tGoZjryJkHsf5xuTUo65jdT6imnR5fwZrKrRmYvS2hOqpLme8dT480kZDr9GeLN124u9fD6wecUI/JsItXFm0uzRBDEfN68RcuyYvQOl69PryeLwvH9SZgmxqT+vL6k/I4TUvcDRIbpB17T/c20lCd/8Xs4nWmpKV08L3OufUiA5RdliSAIF28SBEEQ5E2CIAjyJkEQBHmTIAiCvEkQBEHeJAiCIG8SBEEQ5E2CIAjyJkEQBHmTIAiCvEkQBEHeJAiCIMibBEEQ5E2CIAjyJkEQBHmTIAji4vE/suSRC2XSqAIAAAAASUVORK5CYII=" width="445" height="115" class="img_CujE"></p><p>Karena semua baris baru pada contoh di atas di-escape, jadinya string akan tetap 1 baris. Tanda <code>"</code> juga tetap muncul karena di-escape.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a63-multiline-string-literal">A.6.3. Multiline string literal<a class="hash-link" href="#a63-multiline-string-literal" title="Direct link to heading">​</a></h2><p>Penulisan string banyak baris atau <em>multiline string</em> adalah sama seperti penulisan string biasa, yaitu langsung tulis saja string dengan diapit tanda <code>"</code>, tambahkan baris baru di dalam string tersebut sesuai kebutuhan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> var3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"baris satu</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c">baris dua</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c">baris tiga"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Hasilnya adalah sesuai dengan string yang sudah didefinisikan.</p><p><img loading="lazy" alt="rust string literal" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcQAAACBCAIAAADR310jAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwM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W8IMQWAcxfTRsyhJydoyb5EKBIAQENiuqM5tGugOkSmsphqjtEAAO0N8zc2hxb8/35ZjPVw2wOAtsV0Y3PoIjFVHKMBAJqMTLc0hy4Q00RYDADQlphubw49ZeTM3YqWz6pjNABAK2K6nzm0Mx3w+vxx2On8kuWz7hgNALC/mAIAAGIKAICYAgAgpgAAiCkAACCmAACIKQDABYppQ36m658TAOByxVTZWIWYAsBfJ6ZLlRjNBIDLENN9zKGjvajv4c5R79CxkG6xcIwGgGbEdEdz6ERkGpwk8EQZ/oljNAA0OMzf2By6QEzdksm6iS8fADQjphubQxeIqReOTlqKYzQANBqZbmkOXTrMF2ZxcYwGgObEdHtz6FSK/KugcIwGgKbEdE9z6DC3Z+Wc2bV8HKMBYE8xPROEFS6W7gEAMS3Ff8yg6GkBAADE1JdTlu0BADEFAEBMAQAQUwAAQEwBABBTAADEFAAAMaUJAAAQUwAAxBQAADEFAADEFACgJv8D2PwwcbjrJLoAAAAASUVORK5CYII=" width="452" height="129" class="img_CujE"></p><p>Perlu diketahui bahwa karakter spasi, baris baru, dan lainnya adalah <strong>tidak dihiraukan</strong>, jadi jika kawan-kawan menuliskan string multiline seperti ini ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> var4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"baris satu</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> baris dua</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> baris tiga"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... maka hasilnya juga sesuai dengan yang ditulis, yaitu ada 4 karakter spasi di baris ke-2 dan ke-3.</p><p><img loading="lazy" alt="rust string literal" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcEAAACCCAIAAACxYuTJAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLm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FGKkEQEPPWkP38WCONoq+hts6vUPnSrrVwpgZAA3dW0N39GBOxKFBJoE9yfRPjJkB0NB+5vIbezAXaKhbM1kuMcQDQEP31tCNPZgLNNQLPhcJxZgZAA3tKw7d0oO5dC4vrNBizAyAhvaiodt7MKdS5F+rhDEzABrag4bu6cEclvZHyTN7Vx5jZgA0FGxLDtyEB0BDoQT/gYGi+/4AgIZCMJdHQAHQUAAANBQAANBQAAA0FAAADQUAQEMBAAANBQBAQwEA0FAAADQUAAANpQkAANBQAAA0FAAADQUAeCf8DzIhP4a2rvfKAAAAAElFTkSuQmCC" width="449" height="130" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a64-raw-string">A.6.4. Raw string<a class="hash-link" href="#a64-raw-string" title="Direct link to heading">​</a></h2><p>Raw string adalah istilah untuk string yang tidak meng-<em>escape</em> karakter apapun. Di Rust, string literal bisa didefinisikan dengan menuliskan string diapit <code>r#"</code> dan <code>"#</code>. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> var5 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">r#"</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> {</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> "name": "tim drake",</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> "gender": "male"</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> }</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c">"#</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kode di atas hasilnya adalah ekuivalen dengan kode di bawah ini, yang mana string didefinisikan dengan meng-escape karakter <code>"</code> menggunakan <code>\</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> var6 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> {</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> \"name\": \"cassandra cain\",</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> \"gender\": \"female\"</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c"> }</span><br></span><span class="token-line" style="color:#393A34"><span class="token string" style="color:#e3116c">"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var6</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="raw string literal" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAa4AAAEECAIAAAD/EEdFAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAHQmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIi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qMgvWSFNhesMBoMLZKvSGg79VFQaTVXxE0C3LoqI2GvgO40a3OcKHwtfLVCisrtKkmWuECgEVrq9CqdxRVbjOISguKVuWSUPQ8UPx6zNVmG3S9DVChYAKN1ChcwJQrwqL79mYfq5QWpLUzvwgdPhQ/HqmQ9xTdJoKk02avkazVOi2GwAVGgfI7lXhN70qHM7Zm8fHs64gu0uKlt23Mxhhel4JR53a1wXFOJdqu2u32gBZmueia5RSdnZRlI6ACuHYiCcLAFAhHMqCeBBQIQAAKgQAQIUAAKgQAAAVAgCgQp/KYXZTHkGul2w4hr4scOlUyobZppMBUCEqtH9decJ3vhBRIcDVq7ByrueUuVYKea3zUK5proSnAuxdhXoZE2XLxIGsBZmmYp6rEnSabNWskNfgy1GTLGG0vssiFRbF1gKgwp2L0EkaGJ+4DQNZCzNNozxXMeh0cRXGsWFDiRY2SQmjNYenlsbWAqDCazChH9kSBrKWpFfJea72+KqFV6uvAMM1UgMm1DIwWt11YmsBUGF1nFIwqP/8QXOBCpU811VdEahQXCNNhcbw1PViawFQ4TrSiN90JJRsRSoUKr6tVSjFpMqvKLCFpxKXCnA7KtStl35RRzLTVL6NpFCFy142UWJSFRXaw1ORIcANVoXyJWBHcMZM08SrMjdSodQkZYBsDk89FcbWAqDCa6kKuRAKAEdUoV89MeQDAAbI3CgMAEdVIQAAKgQAQIUAAKgQAGDXKrzcscadLQBAVcgz/gCACsP0EwAAVAgAgAoBAA6qQpKgAAAV9jbkiTgAOPgAmUvIAIAKqQcBABWiQgBAhagQAFAhpwoB4NAq7N+aQU0IAAyQAQBQIQAAKgQAQIUAAKgQAAAVAgCgQgAAVAgAgAoBAFAhAAAqBABAhQAAqBAAABUCANwG/wPCySSNXW5ZPQAAAABJRU5ErkJggg==" width="430" height="260" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a65-pembahasan-lanjutan-tentang-string">A.6.5. Pembahasan lanjutan tentang string<a class="hash-link" href="#a65-pembahasan-lanjutan-tentang-string" title="Direct link to heading">​</a></h2><p><strong>String adalah salah satu topik yang sangat luas cakupan pembahasannya</strong>, tidak cukup jika dirangkum dalam 1 chapter. Selain itu, bisa bikin makin bingung jika dibahas sekarang.</p><p>Penulis anjurkan untuk mempelajari chapter-chapter berikutnya secara urut terlebih dahulu.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/tipe_data_string_literal" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../tipe_data_string_literal</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/pointer-references">Pointer & References</a></li><li><a href="/basic/string-slice-vs-string-literal">String Literal (&str) vs. String Custom Type</a></li><li><a href="/basic/tipe-data-custom-type-string-slice">Tipe Data ➜ String Custom Type</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/reference/tokens.html#raw-string-literals" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/tokens.html#raw-string-literals</a></li><li><a href="https://doc.rust-lang.org/std/str/index.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/str/index.html</a></li><li><a href="https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/first-edition/strings.html" target="_blank" rel="noopener noreferrer">https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/first-edition/strings.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/tipe-data-primitive-scalar"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.5. Tipe Data ➜ Primitive Scalar</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/konstanta"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.7. Konstanta</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a61-string-literal-atau-str" class="table-of-contents__link toc-highlight">A.6.1. String literal atau <code>&str</code></a></li><li><a href="#a62-escape-karakter-menggunakan-" class="table-of-contents__link toc-highlight">A.6.2. Escape karakter menggunakan <code></code></a></li><li><a href="#a63-multiline-string-literal" class="table-of-contents__link toc-highlight">A.6.3. Multiline string literal</a></li><li><a href="#a64-raw-string" class="table-of-contents__link toc-highlight">A.6.4. Raw string</a></li><li><a href="#a65-pembahasan-lanjutan-tentang-string" class="table-of-contents__link toc-highlight">A.6.5. Pembahasan lanjutan tentang string</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/trait-function.html b/basic/trait-function.html index d12c101b..f4aec772 100644 --- a/basic/trait-function.html +++ b/basic/trait-function.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-function/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-function/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.49. Trait ➜ Function (Fn, FnMut, FnOnce)","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-function/#webpage"},"wordCount":392,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-function/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-function/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/trait-function","name":"A.49. Trait ➜ Function (Fn, FnMut, FnOnce)","description":"Chapter ini merupakan topik lanjutan dari chapter sebelumnya, di sini kita akan bahas beberapa jenis trait yang digunakan di closure.","datePublished":"2024-08-01T10:17:31.014Z","dateModified":"2024-08-01T10:17:31.014Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-function/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/trait-function"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-function/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.49. Trait ➜ Function (Fn, FnMut, FnOnce)","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-function/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-function/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.49. Trait ➜ Function (Fn, FnMut, FnOnce)","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-function/#webpage"},"wordCount":392,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-function/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-function/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/trait-function","name":"A.49. Trait ➜ Function (Fn, FnMut, FnOnce)","description":"Chapter ini merupakan topik lanjutan dari chapter sebelumnya, di sini kita akan bahas beberapa jenis trait yang digunakan di closure.","datePublished":"2024-08-30T07:44:50.948Z","dateModified":"2024-08-30T07:44:50.948Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-function/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/trait-function"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-function/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.49. Trait ➜ Function (Fn, FnMut, FnOnce)","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</h1></header><p>Chapter ini merupakan topik lanjutan dari chapter sebelumnya, di sini kita akan bahas beberapa jenis trait yang digunakan di closure.</p><p>Rust memiliki 3 buah trait yang otomatis ter-implement pada closure, yaitu <code>Fn</code>, <code>FnMut</code>, dan <code>FnOnce</code>. Ketiga trait ini juga otomatis ter-implement pada fungsi yang didefinisikan menggunakan keyword <code>fn</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a491-trait-fn">A.49.1. Trait <code>Fn</code><a class="hash-link" href="#a491-trait-fn" title="Direct link to heading">​</a></h2><p><code>Fn</code> sudah kita terapkan beberapa kali saat praktik pembuatan closure di chapter sebelumnya. Fn adalah trait (<a href="https://doc.rust-lang.org/std/ops/trait.Fn.html" target="_blank" rel="noopener noreferrer">std::ops::Fn</a>), yang dipakai oleh Rust untuk menandai bahwa suatu closure bisa dipanggil berkali-kali dengan catatan di dalam closure tersebut tidak ada operasi mutable terhadap variabel yang scope-nya berada di luar block closure.</p><p>Contoh penerapan trait <code>Fn</code> bisa dilihat pada kode berikut. Trait tersebut secara otomatis ter-implement pada closure <code>pow</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pow_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">n</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> n</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"pow_number(2): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">pow_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"pow_number(3): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">pow_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"pow_number(4): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">pow_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh penerapan trait <code>Fn</code> lainnya pada fungsi yang memiliki parameter closure:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something_with_number_v1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">13</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">d</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> d </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {result}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_with_number_v1</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">F</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Fn</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <----- Fn digunakan</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Statement `f(n)` bisa dipanggil berkali-kali</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">f</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a492-trait-fnmut">A.49.2. Trait <code>FnMut</code><a class="hash-link" href="#a492-trait-fnmut" title="Direct link to heading">​</a></h2><p>Trait <code>FnMut</code> (<a href="https://doc.rust-lang.org/std/ops/trait.FnMut.html" target="_blank" rel="noopener noreferrer">std::ops::FnMut</a>) merupakan trait yang menjadikan suatu closure bisa diakses berkali-kali dan bisa me-mutate atau mengubah data suatu variabel yang berada di luar scope block closure. Trait ini juga otomatis ter-implement pada closure yang di dalamnya ada kode pengaksesan variabel yang berada di luar scope block closure.</p><p>Contoh penerapannya silakan lihat closure <code>square_x</code> berikut. Closure tersebut di-dalamnya mengubah nilai <code>x</code> yang dideklarasikan di luar blcok closure, oleh karenanya trait <code>FnMut</code> otomatis ter-implement.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> square_x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">*=</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">square_x</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh lain penerapan <code>FnMut</code> pada fungsi yang memiliki parameter closure:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something_with_number_v2</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">14</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number: {number}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_with_number_v2</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">F</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">FnMut</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <----- FnMut digunakan</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Statement `f(n)` berisi kode yang mengubah isi variavel `number` (mutable).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// `f(n)` bisa dipanggil berkali-kali</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">f</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Parameter ke-2 fungsi <code>do_something_with_number_v2</code> adalah closure yang me-mutate nilai <code>number</code>, berarti terjadi mutable borrow karena variabel <code>number</code> berada di luar block closure. Karena alasan tersebut maka closure harus dideklarasikan menggunakan <code>FnMut</code> (bukan <code>Fn</code>).</p><p>Jika dipaksa deklarasi menggunakan <code>Fn</code>, hasilnya pasti error.</p><p><img loading="lazy" alt="Closure" src="/assets/images/trait-function-1-69d13024d5321866a37aa3bb1f72a1b2.png" width="673" height="274" class="img_ev3q"></p><p><code>FnMut</code> merupakan supertrait dari <code>Fn</code>, artinya closure dengan trait <code>Fn</code> juga bisa digunakan sebagai argument pemanggilan fungsi di mana parameter fungsi tersebut bertipe <code>FnMut</code>.</p><blockquote><p>Lebih jelasnya mengenai supertrait dibahas pada chpater <a href="#/wip/supertrait">Supertrait</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a493-trait-fnonce">A.49.3. Trait <code>FnOnce</code><a class="hash-link" href="#a493-trait-fnonce" title="Direct link to heading">​</a></h2><p>Trait <code>FnOnce</code> (<a href="https://doc.rust-lang.org/std/ops/trait.FnOnce.html" target="_blank" rel="noopener noreferrer">std::ops::FnOnce</a>) adalah trait yang menjadikan suatu closure hanya boleh di akses sekali saja, dan closure tersebut bisa berisi operasi mutable ataupun tidak.</p><p>Contoh penerapan <code>FnOnce</code> pada fungsi yang memiliki parameter closure.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something_with_number_v3</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">14</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number: {number}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_with_number_v3</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">F</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">FnOnce</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <----- FnOnce digunakan</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">f</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jika closure dengan tipe <code>FnOnce</code> dipaksa diakses dua kali, pasti muncul error. Contohnya bisa dilihat pada parameter <code>f</code> berikut.</p><p><img loading="lazy" alt="Closure" src="/assets/images/trait-function-2-5f9002b90d061f7ad1815a678e71f312.png" width="506" height="395" class="img_ev3q"></p><blockquote><p>Lebih jelasnya mengenai supertrait dibahas pada chpater <a href="#/wip/supertrait">Supertrait</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a494-relasi-antara-trait-function-dengan-function">A.49.4. Relasi antara trait function dengan function<a class="hash-link" href="#a494-relasi-antara-trait-function-dengan-function" title="Direct link to heading">​</a></h2><p>Trait <code>Fn</code>, <code>FnMut</code>, dan juga <code>FnOnce</code> tidak hanya ter-implement pada closure, tapi juga ter-implement pada fungsi juga (secara otomatis).</p><p>Contohnya bisa dilihat pada contoh berikut. Fungsi <code>do_something_with_number_v1</code> dipanggil 3 kali.</p><ul><li>Pemanggilan pertama, argument <code>f</code> diisi dengan closure <code>|d: i32| d * 2</code></li><li>Pemanggilan kedua, argument <code>f</code> diisi dengan fungsi <code>double</code></li><li>Pemanggilan ketiga, argument <code>f</code> diisi dengan fungsi <code>pow_number</code></li></ul><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something_with_number_v1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">13</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">d</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> d </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {result}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something_with_number_v1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">13</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> double</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {result}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something_with_number_v1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">13</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> pow_number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {result}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_with_number_v1</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">F</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Fn</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">f</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">double</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">d</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> d </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">pow_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">d</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> d</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dari contoh di atas terbukti bahwa fungsi <code>double</code> dan juga <code>pow_number</code> memenuhi kriteria tipe <code>F</code> yaitu <code>Fn(i32) -> i32</code>.</p><p><img loading="lazy" alt="Closure" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAACPCAIAAADmy0wUAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9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qUx0M/wZHpkl24WTM7TwtH+/+9u/0FAAuLyMjqJ2ErsuzpuEatomoku/jBaj0cUy2qX3gzE9AFxcRkdt65QvDfIG8VMD6CYyOo8pw32IO5wiKggAwM6D+kwbY8JpyWjD3jIaSXn1fAAAl5PRsh6Nkd+uMtppaJhAnB4yCgBHkdH68+9xwnSaOT1HqkUZDfZORbkqgJmGDkeGg3pUFACOIaPpwH6aGs2fs4+b//3x/ayb2aSAfNY/70n99HJoPK1gvk0KALCTjAIAADIKAICMAgAgowAAyCgAACCjAADIKADAu5ZRbJsBABltJKbYNgMAMnoMGcW2GQCOKqPYNgMArJVRbJsBANbJKLbNAAArB/WZNmLbDACAbTMAwGVkFNtmAIB1MnqHbTMAwB2LQQEAkFEAAGQUAAAZBQBARgEAABkFAEBGAQCQ0TrYNgMAMtpITBuvqe9ewldLmWLRnrbgVQIAyGiolj9/JMtJxbLVcMUpC0QBYHsZvRLb5u8/0zX85yPT42LlxK4EAPaQ0SuybY5lVNk2J+doYnEKAMhoRUavx7Y5klFl25y7PiGjALDHoD7TqgPbNseiL84XPnPia00AcCEZPaJtsx7UF22bgw+KAgDsJqOHtG2WKZRtm43TAQBsLqN3x7NtztI0bZsxcgaAfWUUAACQUQAAZBQAABkFAEBGAQAAGQUAQEYBAJBRAABkFAAAGQUAAGQUAOAy/A82p+fN3SYAAgAAAABJRU5ErkJggg==" width="450" height="143" class="img_ev3q"></p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/trait_function" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../trait_function</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/function">Function</a></li><li><a href="/basic/traits">Traits</a></li><li><a href="/basic/closures">Closures</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch13-01-closures.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch13-01-closures.html</a></li><li><a href="https://doc.rust-lang.org/beta/rust-by-example/fn/closures.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/beta/rust-by-example/fn/closures.html</a></li><li><a href="https://doc.rust-lang.org/std/ops/trait.Fn.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/ops/trait.Fn.html</a></li><li><a href="https://doc.rust-lang.org/std/ops/trait.FnMut.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/ops/trait.FnMut.html</a></li><li><a href="https://doc.rust-lang.org/std/ops/trait.FnOnce.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/ops/trait.FnOnce.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/closures"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.48. Closures</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/trait-iterator"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.50. Trait ➜ Iterator</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a491-trait-fn" class="table-of-contents__link toc-highlight">A.49.1. Trait <code>Fn</code></a></li><li><a href="#a492-trait-fnmut" class="table-of-contents__link toc-highlight">A.49.2. Trait <code>FnMut</code></a></li><li><a href="#a493-trait-fnonce" class="table-of-contents__link toc-highlight">A.49.3. Trait <code>FnOnce</code></a></li><li><a href="#a494-relasi-antara-trait-function-dengan-function" class="table-of-contents__link toc-highlight">A.49.4. Relasi antara trait function dengan function</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</h1></header><p>Chapter ini merupakan topik lanjutan dari chapter sebelumnya, di sini kita akan bahas beberapa jenis trait yang digunakan di closure.</p><p>Rust memiliki 3 buah trait yang otomatis ter-implement pada closure, yaitu <code>Fn</code>, <code>FnMut</code>, dan <code>FnOnce</code>. Ketiga trait ini juga otomatis ter-implement pada fungsi yang didefinisikan menggunakan keyword <code>fn</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a491-trait-fn">A.49.1. Trait <code>Fn</code><a class="hash-link" href="#a491-trait-fn" title="Direct link to heading">​</a></h2><p><code>Fn</code> sudah kita terapkan beberapa kali saat praktik pembuatan closure di chapter sebelumnya. Fn adalah trait (<a href="https://doc.rust-lang.org/std/ops/trait.Fn.html" target="_blank" rel="noopener noreferrer">std::ops::Fn</a>), yang dipakai oleh Rust untuk menandai bahwa suatu closure bisa dipanggil berkali-kali dengan catatan di dalam closure tersebut tidak ada operasi mutable terhadap variabel yang scope-nya berada di luar block closure.</p><p>Contoh penerapan trait <code>Fn</code> bisa dilihat pada kode berikut. Trait tersebut secara otomatis ter-implement pada closure <code>pow</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> pow_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">n</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> n</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"pow_number(2): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">pow_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"pow_number(3): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">pow_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"pow_number(4): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">pow_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh penerapan trait <code>Fn</code> lainnya pada fungsi yang memiliki parameter closure:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something_with_number_v1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">13</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">d</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> d </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {result}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_with_number_v1</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">F</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Fn</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <----- Fn digunakan</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Statement `f(n)` bisa dipanggil berkali-kali</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">f</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a492-trait-fnmut">A.49.2. Trait <code>FnMut</code><a class="hash-link" href="#a492-trait-fnmut" title="Direct link to heading">​</a></h2><p>Trait <code>FnMut</code> (<a href="https://doc.rust-lang.org/std/ops/trait.FnMut.html" target="_blank" rel="noopener noreferrer">std::ops::FnMut</a>) merupakan trait yang menjadikan suatu closure bisa diakses berkali-kali dan bisa me-mutate atau mengubah data suatu variabel yang berada di luar scope block closure. Trait ini juga otomatis ter-implement pada closure yang di dalamnya ada kode pengaksesan variabel yang berada di luar scope block closure.</p><p>Contoh penerapannya silakan lihat closure <code>square_x</code> berikut. Closure tersebut di-dalamnya mengubah nilai <code>x</code> yang dideklarasikan di luar blcok closure, oleh karenanya trait <code>FnMut</code> otomatis ter-implement.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> square_x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">*=</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">square_x</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh lain penerapan <code>FnMut</code> pada fungsi yang memiliki parameter closure:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something_with_number_v2</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">14</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number: {number}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_with_number_v2</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">F</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">FnMut</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <----- FnMut digunakan</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Statement `f(n)` berisi kode yang mengubah isi variavel `number` (mutable).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// `f(n)` bisa dipanggil berkali-kali</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">f</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Parameter ke-2 fungsi <code>do_something_with_number_v2</code> adalah closure yang me-mutate nilai <code>number</code>, berarti terjadi mutable borrow karena variabel <code>number</code> berada di luar block closure. Karena alasan tersebut maka closure harus dideklarasikan menggunakan <code>FnMut</code> (bukan <code>Fn</code>).</p><p>Jika dipaksa deklarasi menggunakan <code>Fn</code>, hasilnya pasti error.</p><p><img loading="eager" fetchpriority="high" alt="Closure" src="/assets/images/trait-function-1-69d13024d5321866a37aa3bb1f72a1b2.png" width="673" height="274" class="img_CujE"></p><p><code>FnMut</code> merupakan supertrait dari <code>Fn</code>, artinya closure dengan trait <code>Fn</code> juga bisa digunakan sebagai argument pemanggilan fungsi di mana parameter fungsi tersebut bertipe <code>FnMut</code>.</p><blockquote><p>Lebih jelasnya mengenai supertrait dibahas pada chpater <a href="#/wip/supertrait">Supertrait</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a493-trait-fnonce">A.49.3. Trait <code>FnOnce</code><a class="hash-link" href="#a493-trait-fnonce" title="Direct link to heading">​</a></h2><p>Trait <code>FnOnce</code> (<a href="https://doc.rust-lang.org/std/ops/trait.FnOnce.html" target="_blank" rel="noopener noreferrer">std::ops::FnOnce</a>) adalah trait yang menjadikan suatu closure hanya boleh di akses sekali saja, dan closure tersebut bisa berisi operasi mutable ataupun tidak.</p><p>Contoh penerapan <code>FnOnce</code> pada fungsi yang memiliki parameter closure.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something_with_number_v3</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">14</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number: {number}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_with_number_v3</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">F</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">FnOnce</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <----- FnOnce digunakan</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">f</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jika closure dengan tipe <code>FnOnce</code> dipaksa diakses dua kali, pasti muncul error. Contohnya bisa dilihat pada parameter <code>f</code> berikut.</p><p><img loading="lazy" alt="Closure" src="/assets/images/trait-function-2-5f9002b90d061f7ad1815a678e71f312.png" width="506" height="395" class="img_CujE"></p><blockquote><p>Lebih jelasnya mengenai supertrait dibahas pada chpater <a href="#/wip/supertrait">Supertrait</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a494-relasi-antara-trait-function-dengan-function">A.49.4. Relasi antara trait function dengan function<a class="hash-link" href="#a494-relasi-antara-trait-function-dengan-function" title="Direct link to heading">​</a></h2><p>Trait <code>Fn</code>, <code>FnMut</code>, dan juga <code>FnOnce</code> tidak hanya ter-implement pada closure, tapi juga ter-implement pada fungsi juga (secara otomatis).</p><p>Contohnya bisa dilihat pada contoh berikut. Fungsi <code>do_something_with_number_v1</code> dipanggil 3 kali.</p><ul><li>Pemanggilan pertama, argument <code>f</code> diisi dengan closure <code>|d: i32| d * 2</code></li><li>Pemanggilan kedua, argument <code>f</code> diisi dengan fungsi <code>double</code></li><li>Pemanggilan ketiga, argument <code>f</code> diisi dengan fungsi <code>pow_number</code></li></ul><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something_with_number_v1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">13</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">d</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> d </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {result}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something_with_number_v1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">13</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> double</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {result}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">do_something_with_number_v1</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">13</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> pow_number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {result}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something_with_number_v1</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">F</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">where</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">F</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Fn</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">f</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">double</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">d</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> d </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">pow_number</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">d</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> d</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dari contoh di atas terbukti bahwa fungsi <code>double</code> dan juga <code>pow_number</code> memenuhi kriteria tipe <code>F</code> yaitu <code>Fn(i32) -> i32</code>.</p><p><img loading="lazy" alt="Closure" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAACPCAIAAADmy0wUAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIi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63W5jxVRBsAkNF6YsOhJ9kc/t1pK+oJAJeU0V7axlBvkCQZ+wUbz1sjqUx0M/wZHpkl24WTM7TwtH+/+9u/0FAAuLyMjqJ2ErsuzpuEatomoku/jBaj0cUy2qX3gzE9AFxcRkdt65QvDfIG8VMD6CYyOo8pw32IO5wiKggAwM6D+kwbY8JpyWjD3jIaSXn1fAAAl5PRsh6Nkd+uMtppaJhAnB4yCgBHkdH68+9xwnSaOT1HqkUZDfZORbkqgJmGDkeGg3pUFACOIaPpwH6aGs2fs4+b//3x/ayb2aSAfNY/70n99HJoPK1gvk0KALCTjAIAADIKAICMAgAgowAAyCgAACCjAADIKADAu5ZRbJsBABltJKbYNgMAMnoMGcW2GQCOKqPYNgMArJVRbJsBANbJKLbNAAArB/WZNmLbDACAbTMAwGVkFNtmAIB1MnqHbTMAwB2LQQEAkFEAAGQUAAAZBQBARgEAABkFAEBGAQCQ0TrYNgMAMtpITBuvqe9ewldLmWLRnrbgVQIAyGiolj9/JMtJxbLVcMUpC0QBYHsZvRLb5u8/0zX85yPT42LlxK4EAPaQ0SuybY5lVNk2J+doYnEKAMhoRUavx7Y5klFl25y7PiGjALDHoD7TqgPbNseiL84XPnPia00AcCEZPaJtsx7UF22bgw+KAgDsJqOHtG2WKZRtm43TAQBsLqN3x7NtztI0bZsxcgaAfWUUAACQUQAAZBQAABkFAEBGAQAAGQUAQEYBAJBRAABkFAAAGQUAAGQUAOAy/A82p+fN3SYAAgAAAABJRU5ErkJggg==" width="450" height="143" class="img_CujE"></p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/trait_function" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../trait_function</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/function">Function</a></li><li><a href="/basic/traits">Traits</a></li><li><a href="/basic/closures">Closures</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch13-01-closures.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch13-01-closures.html</a></li><li><a href="https://doc.rust-lang.org/beta/rust-by-example/fn/closures.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/beta/rust-by-example/fn/closures.html</a></li><li><a href="https://doc.rust-lang.org/std/ops/trait.Fn.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/ops/trait.Fn.html</a></li><li><a href="https://doc.rust-lang.org/std/ops/trait.FnMut.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/ops/trait.FnMut.html</a></li><li><a href="https://doc.rust-lang.org/std/ops/trait.FnOnce.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/ops/trait.FnOnce.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/closures"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.48. Closures</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/trait-iterator"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.50. Trait ➜ Iterator</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a491-trait-fn" class="table-of-contents__link toc-highlight">A.49.1. Trait <code>Fn</code></a></li><li><a href="#a492-trait-fnmut" class="table-of-contents__link toc-highlight">A.49.2. Trait <code>FnMut</code></a></li><li><a href="#a493-trait-fnonce" class="table-of-contents__link toc-highlight">A.49.3. Trait <code>FnOnce</code></a></li><li><a href="#a494-relasi-antara-trait-function-dengan-function" class="table-of-contents__link toc-highlight">A.49.4. Relasi antara trait function dengan function</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/trait-iterator.html b/basic/trait-iterator.html index 937be752..60d3e8b2 100644 --- a/basic/trait-iterator.html +++ b/basic/trait-iterator.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-iterator/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-iterator/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.50. Trait ➜ Iterator","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-iterator/#webpage"},"wordCount":1212,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-iterator/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-iterator/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/trait-iterator","name":"A.50. Trait ➜ Iterator","description":"Iterator adalah salah satu trait dan tipe data custom penting pada Rust programming, gunanya untuk iterasi data. Di chapter ini kita akan mempelajarinya beserta beberapa module item lainnya yang masih relevan dengan topik Iterator.","datePublished":"2024-08-01T10:17:31.525Z","dateModified":"2024-08-01T10:17:31.525Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-iterator/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/trait-iterator"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-iterator/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.50. Trait ➜ Iterator","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-iterator/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-iterator/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.50. Trait ➜ Iterator","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-iterator/#webpage"},"wordCount":1212,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-iterator/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-iterator/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/trait-iterator","name":"A.50. Trait ➜ Iterator","description":"Iterator adalah salah satu trait dan tipe data custom penting pada Rust programming, gunanya untuk iterasi data. Di chapter ini kita akan mempelajarinya beserta beberapa module item lainnya yang masih relevan dengan topik Iterator.","datePublished":"2024-08-30T07:44:51.594Z","dateModified":"2024-08-30T07:44:51.594Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-iterator/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/trait-iterator"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/trait-iterator/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.50. Trait ➜ Iterator","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.50. Trait ➜ Iterator</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.50. Trait ➜ Iterator</h1></header><p>Iterator adalah salah satu trait dan tipe data custom penting pada Rust programming, gunanya untuk iterasi data. Di chapter ini kita akan mempelajarinya beserta beberapa module item lainnya yang masih relevan dengan topik Iterator.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a501-iterator--intoiterator">A.50.1. <code>Iterator</code> & <code>IntoIterator</code><a class="hash-link" href="#a501-iterator--intoiterator" title="Direct link to heading">​</a></h2><p><code>Iterator</code> adalah sebuah nama yang dipakai sebagai nama module item dalam <strong>Rust Standard Library</strong> maupun <strong>Rust Core Library</strong>, digunakan untuk iterasi data dan operasi lain yang berhubungan dengannya.</p><p>Iterator sendiri merupakan istilah untuk object atau trait yang bisa diiterasi, baik menggunakan keyword <code>for in</code> ataupun menggunakan method iterator seperti <code>for_each</code> (yang juga akan kita bahas di sini).</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-trait-iterator--intoiterator">◉ Trait <code>Iterator</code> & <code>IntoIterator</code><a class="hash-link" href="#-trait-iterator--intoiterator" title="Direct link to heading">​</a></h3><p>Dalam perulangan menggunakan keyword <code>for in</code>, tipe data variabel yang digunakan harus memiliki trait <code>Iterator</code>. Jika tidak, pasti error muncul.</p><p>Tipe data slice di Rust by default mengadopsi trait bernama <code>IntoIterator</code>, yang trait ini digunakan untuk konversi data bertipe slice ke bentuk iterator.</p><p>Dalam praktiknya, tidak perlu mengakses method tertentu untuk mendapatkan object iterator suatu data. Cukup gunakan variabel tipe data slice pada keyword <code>for in</code>, maka proses konversi ke bentuk iterator akan dilakukan oleh Rust secara otomatis dibalik layar.</p><p>Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// array</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_arr </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"d"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> e </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_arr </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e:?} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// vector</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"d"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> e </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_vec </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e:?} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// slice</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"d"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_slice_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> e </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> data_slice_vec </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e:?} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dianjurkan untuk selalu menggunakan teknik <a href="/basic/borrowing">Borrowing</a> dalam penggunaan keyword <code>for in</code> pada tipe data yang karakteristiknya adalah <a href="/basic/ownership#a344-copy-semantics-vs-move-semantics">Move Semantics</a>, hal ini karena dalam penerapan keyword tersebut, terjadi proses konversi tipe data dengan trait <code>IntoIterator</code> ke bentuk <code>Iterator</code>.</p><p>Jika data yang digunakan bukan data borrow, maka pasti owner berpindah.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-struct-iterator">◉ Struct <code>Iterator</code><a class="hash-link" href="#-struct-iterator" title="Direct link to heading">​</a></h3><p>Selain trait <code>Iterator</code>, ada juga tipe data struct bernama sama, yaitu <code>Iterator</code>. Perbedaan antara trait vs struct <code>Iterator</code> adalah tipe struct <code>Iterator</code> memiliki beberapa method untuk keperluan iterasi object. Jadi dengan memanfaatkan method-method tersebut, kita bisa melakukan iterasi data dan operasi sejenisnya tanpa menggunakan <code>for in</code>.</p><p>Semua tipe data slice bisa dikonversi ke tipe data <code>Iterator</code>, caranya dengan mengakses method <code>iter</code> (atau method <code>chars</code> khusus untuk tipe data <code>String</code>).</p><p>Dari object iterator tersebut, perulangan bisa dilakukan via keyword <code>for in</code>, atau dengan memanfaatkan method bernama <code>for_each</code>. Perbedaannya pada iterasi menggunakan <code>for_each</code>, block perulangan dituliskan dalam bentuk closure.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// array</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_arr </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"d"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> iterator_arr </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_arr</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">iterator_arr</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">for_each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">e</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e:?} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// vector</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"d"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">for_each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">e</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e:?} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// slice from vector</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"d"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_slice_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">data_slice_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">for_each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">e</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e:?} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// slice from String</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_str </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"abcd"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_borrow_str </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_str</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">data_borrow_str</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">chars</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">for_each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">e</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e:?} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat pada contoh di atas, data slice diambil objek Iterator-nya menggunakan method <code>iter</code> (atau <code>chars</code> khusus untuk tipe data <code>String</code>), kemudian di-iterasi menggunakan method <code>for_each</code>.</p><p><img loading="lazy" alt="Trait iterator" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcgAAACVCAYAAADcxmp3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAByhSURBVHhe7Z3LrSS5sYZlyYwG8kBGyIeGgHFhLBAa0FYmHGAc6IVs6IV2vbkWnZt8B4MRwUcxs7Kq/8WH7kqSwWAwyL8yT2XmX3755ZdPAAAAANRAIAEAAAABCCQAAAAgAIEEAAAABCCQAAAAgAAEEgAAABCAQAIAA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h2 class="anchor anchorWithStickyNavbar_LWe7" id="a502-pemanfaatan-tipe-data-iterator">A.50.2. Pemanfaatan tipe data <code>Iterator</code><a class="hash-link" href="#a502-pemanfaatan-tipe-data-iterator" title="Direct link to heading">​</a></h2><p>Tipe data <code>Iterator</code> memiliki cukup banyak method untuk keperluan operasi data iterator, contohnya seperti <code>for_each</code>, <code>map</code>, <code>filter</code>, dan lainnya.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-praktik-ke-1">◉ Praktik ke-1<a class="hash-link" href="#-praktik-ke-1" title="Direct link to heading">​</a></h3><p>Sebagai contoh, kita akan buat sebuah program sederhana yang melakukan operasi kuadrat pada elemen tiap-tiap array.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_arr </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> doubles</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_arr</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">e</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> e </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> e</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{doubles:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Trait iterator" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAAB5CAIAAAAmt7g4AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFqGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjMtMDEtMjRUMTg6NTY6MTYrMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIzLTAxLTI1VDAyOjU1OjI1KzA3OjAwIiB4bXA6TWV0YWRhd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IQQ9EUIIeiKEEPRECCEEPRFCaLn+DyiB1plsXAGMAAAAAElFTkSuQmCC" width="447" height="121" class="img_ev3q"></p><p>Penjelasan:</p><ol><li>Variabel <code>data_arr</code> yang bertipe data <code>[i32; 3]</code> dikonversi ke tipe data <code>Iterator</code> menggunakan method <code>iter</code>.</li><li>Object <code>Iterator</code> kemudian di-iterasi menggunakan method <code>map</code> dan nilai baliknya dijadikan <em>replacement</em> data elemen tersebut.</li><li>Object <code>Iterator</code> kemudian di-collect data-nya ke bentuk <code>Vec<i32></code> menggunakan method <code>collect</code>.</li></ol><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-praktik-ke-2">◉ Praktik ke-2<a class="hash-link" href="#-praktik-ke-2" title="Direct link to heading">​</a></h3><p>Contoh lain penerapan method iterator bisa dilihat pada kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"1"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"2"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"3"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"4"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">e</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> e</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> n</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">_</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">filter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">e</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">e </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&&</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">e </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">rev</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">>></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{numbers:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Program di atas melakukan beberapa hal:</p><ol><li><p>Data <code>data_vec</code> yang merupakan koleksi string di-konversi menjadi object <code>Iterator</code> menggunakan method <code>iter</code>.</p></li><li><p>Kemudian method <code>map</code> diakses. Setiap elemen <code>data_vec</code> di-iterasi, kemudian dikonversi dari <code>String</code> ke <code>i32</code>, lalu dijadikan <em>replacement</em> data elemen tersebut. Jika proses konversi gagal, maka angka <code>0</code> digunakan sebagai data element tersebut.</p><ul><li>Sampai sini, data yang sebelumnya <code>["1", "2", "3", "4", "a"]</code> sekarang menjadi <code>[1, 2, 3, 4, 0]</code>.</li></ul></li><li><p>Selanjutnya, dilakukan proses filtering menggunakan method <code>filter</code> dengan kondisi <code>*e > 0 && *e % 2 == 0</code> yang kurang lebih artinya, jika nilai <em>dereference</em> <code>e</code> lebih besar dari <code>0</code> dan nilai tersebut adalah genap, maka filter bernilai <code>true</code>.</p><ul><li>Sampai sini, data yang sebelumnya <code>[1, 2, 3, 4, 0]</code> sekarang menjadi <code>[2, 4]</code>.</li></ul></li><li><p>Kemudian, data kolektif tersebut dibalik urutan elemennya menggunakan method <code>rev</code>.</p><ul><li>Sampai sini, data yang sebelumnya <code>[2, 4]</code> sekarang menjadi <code>[4, 2]</code>.</li></ul></li><li><p>Terakhir data di-collect menggunakan method <code>collect</code> dengan ditentukan tipe data masing-masing elemen adalah <code>Vec<i32></code>.</p></li></ol><p>Hasilnya ketika di run:</p><p><img loading="lazy" alt="Trait iterator" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAAB2CAIAAADX4QrtAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFqGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6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QEyGEEPRECCHoiRBC0BMhhKAnQghBz4x+//nfWf/9+1fDus37+fObnkIIHYKeOjb/+ve/ZUgdN9RBefoNeiKEDkzPAXN//tTT82XDyzandDPZHnoihA5NzxPkXpb+/rPucv6Ez5iV0BMhdGB6ntmZuaqHnggh6CkIOS9ZR0/lwh16IoQOS8/w7xX0HG4dSU5CT4TQQek5P1gUqJZ3AzpV7kJPhNBxr9zN33zPMNnohJ4IobdJzzM+8/QTyasoAXoihI5OTxWNq+7CQ0+E0Fuj55hTrn2bE3oihA5ET95zRwhBT4QQQtATIYSgJ0IIQU+EEIKeCCEEPQkBQghBT4QQgp4IIQQ9EUIIeiKEEIKeCCEEPRFCCHoihNCu9X9YM488urBmmgAAAABJRU5ErkJggg==" width="447" height="118" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a503-method-tipe-data-iterator">A.50.3. Method tipe data <code>Iterator</code><a class="hash-link" href="#a503-method-tipe-data-iterator" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-iter-iter_mut-into_iter">◉ Method <code>iter</code>, <code>iter_mut</code>, <code>into_iter</code><a class="hash-link" href="#-method-iter-iter_mut-into_iter" title="Direct link to heading">​</a></h3><p>Ketiga method ini berguna untuk konversi data slice ke bentuk <code>Iterator</code>, perbedannya:</p><ul><li><p>Method <code>iter</code> mengembalikan data <code>Iterator</code> yang isinya adalah reference (<code>&T</code>) setiap element. Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">for_each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">d</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> d </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_vec </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Method <code>iter_mut</code> mengembalikan data <code>Iterator</code> yang isinya adalah mutable reference (<code>&mut T</code>) setiap element. Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter_mut</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">for_each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">d</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> d </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> data_vec </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Method <code>into_iter</code> mengkonversi data slice ke bentuk <code>Iterator</code> (<em>move semantics</em>).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">into_iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">for_each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">d</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> d </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// statement di bawah ini menghasilkan error,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// karena ownership `data_vec` telah berpindah setelah method `into_iter` dipanggil</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// println!("{}", data_vec)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-collect">◉ Method <code>collect</code><a class="hash-link" href="#-method-collect" title="Direct link to heading">​</a></h3><p>Method ini digunakan untuk <em>collecting</em> data Iterator ke bentuk tertentu. Contoh penerapannya bisa dilihat pada kode berikut ini.</p><p>Data <code>data_vec</code> yang merupakan vektor bertipe <code>Vec<i32></code> dikonversi ke bentuk <code>Iterator</code> kemudian di-collect datanya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// [1, 2, 3, 4]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Method <code>iter</code> menghasilkan object <code>Iterator</code> yang menampung reference <code>&T</code> setiap element slice. Hal ini membuat penerapan method <code>collect</code> menghasilkan data bertipe <code>Vec<&i32></code> (bukan <code>Vec<i32></code>).</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-map">◉ Method <code>map</code><a class="hash-link" href="#-method-map" title="Direct link to heading">​</a></h3><p>Method <code>map</code> digunakan untuk mapping element setiap data iterator ke nilai baru.</p><p>Sebelumnya kita telah mempelajari method <code>iter</code> dan <code>collect</code> yang keduanya jika dikombinasikan dan digunakan pada tipe data <code>Vec<i32></code> hasilnya adalah data bertipe <code>Vec<&i32></code>. Dengan memanfaatkan method <code>map</code>, tipe data setiap element bisa di-mapping ke nilai baru dengan tipe data berbeda, misalnya menjadi <code>Vec<i32></code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// [1, 2, 3, 4]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">d</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params operator" style="color:#393A34">&</span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// [1, 2, 3, 4]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh lainnya bisa dilihat pada <em>section</em> <a href="/basic/trait-iterator#a482-pemanfaatan-tipe-data-iterator">A.50.2. Pemanfaatan tipe data <code>Iterator</code></a>, di situ terdapat operasi mapping data slice numerik ke bentuk yang sama tapi nilai setiap element adalah kuadrat, dan ke bentuk lain dengan tipe data berbeda.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-rev">◉ Method <code>rev</code><a class="hash-link" href="#-method-rev" title="Direct link to heading">​</a></h3><p><code>rev</code> kependekan dari <em>reverse</em>, digunakan untuk membalikan urutan data slice.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// [1, 2, 3, 4]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">rev</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// [4, 3, 2, 1]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-filter">◉ Method <code>filter</code><a class="hash-link" href="#-method-filter" title="Direct link to heading">​</a></h3><p>Method <code>filter</code> digunakan untuk memfilter element data slice. Data kolektif diiterasi kemudian dicek menggunakan closure, jika nilai balik bertipe <code>true</code> maka elemen tersebut masuk dalam dalam hasil filter, selebihnya maka dianggap tidak memenuhi kondisi filter dan elemen di-<em>exclude</em>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> odd</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">filter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">d</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">!=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"odd numbers: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> odd</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// odd numbers: [1, 3]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> even</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">filter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">d</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"even numbers: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> even</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// odd numbers: [2, 4]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-cloned">◉ Method <code>cloned</code><a class="hash-link" href="#-method-cloned" title="Direct link to heading">​</a></h3><p>Digunakan untuk <em>cloning</em> data slice secara keseluruhan tanpa mengubah tipe data. Hasilnya adalah data dengan skema sama persis (dalam bentuk <code>Iterator</code>) tapi berbeda owner.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">cloned</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// [1, 2, 3, 4]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-copied">◉ Method <code>copied</code><a class="hash-link" href="#-method-copied" title="Direct link to heading">​</a></h3><p>Secara <em>high-level</em> <code>copied</code> menghasilkan output yang sama dengan <code>cloned</code>. Namun jika dibahas dari sisi management memory-nya, ada perbedaan yang cukup besar.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">copied</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// [1, 2, 3, 4]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Lebih detailnya mengenai clone vs copy akan dibahas pada chapter <a href="#/wip/copy-clone-move-drop">Copy, Clone, Move, Drop</a></p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-cmp">◉ Method <code>cmp</code><a class="hash-link" href="#-method-cmp" title="Direct link to heading">​</a></h3><p><code>cmp</code> kependekan dari <em>compare</em>, digunakan untuk membandingkan 2 buah data iterasi dengan nilai balik bertipe enum <code>Ordering</code>. Dari tipe data enum tersebut nantinya bisa dicek apakah 2 buah data slice tersebut sama (secara <em>Lexicographical</em>).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">cmp</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data_vec2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_eq</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// true</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Enum <code>Ordering</code> memiliki beberapa method, salah satunya adalah <code>is_eq</code> yang mengembalikan nilai <code>true</code> jika dua buah data slice tersebut adalah sama.</p><blockquote><p>Lebih detailnya mengenai <code>Ordering</code> akan dibahas pada chapter <a href="#/wip/enum-ordering">Enum Ordering</a></p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-count">◉ Method <code>count</code><a class="hash-link" href="#-method-count" title="Direct link to heading">​</a></h3><p>Digunakan untuk melihat size dari elemen Iterator.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> length </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">count</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// 4</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-eq-ne-gt-ge-lt-le">◉ Method <code>eq</code>, <code>ne</code>, <code>gt</code>, <code>ge</code>, <code>lt</code>, <code>le</code><a class="hash-link" href="#-method-eq-ne-gt-ge-lt-le" title="Direct link to heading">​</a></h3><p>6 Method ini digunakan untuk komparasi dua buah slice. Penggunakan 6 method ini merupakan alternatif selain menggunakan method <code>cmp</code>.</p><p>Sebagai contoh, penerapan method <code>eq</code> berikut untuk untuk mengecek apakah 2 buah data slice adalah sama (secara <em>Lexicographical</em>).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">eq</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data_vec2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// true</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kode di atas adalah ekuivalen dengan kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">cmp</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data_vec2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_eq</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// true</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Berikut merupakan kegunaan tiap-tiap method di atas:</p><ul><li>Method <code>eq</code> digunakan untuk <em>equal lexicographical comparison</em></li><li>Method <code>ne</code> digunakan untuk <em>not equal lexicographical comparison</em></li><li>Method <code>gt</code> digunakan untuk <em>greater than lexicographical comparison</em></li><li>Method <code>ge</code> digunakan untuk <em>greater than or equal lexicographical comparison</em></li><li>Method <code>lt</code> digunakan untuk <em>lower than lexicographical comparison</em></li><li>Method <code>le</code> digunakan untuk <em>lower than or equal lexicographical comparison</em></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-find">◉ Method <code>find</code><a class="hash-link" href="#-method-find" title="Direct link to heading">​</a></h3><p>Digunakan untuk mencari apakah suatu elemen ada atau tidak dengan kondisi pencarian dituliskan dalam bentuk closure. Nilai balik method ini bertipe <code>Option</code>.</p><p>Sebagai contoh, perhatikan kode berikut. Method <code>find</code> digunakan untuk mencari elemen yang nilainya adalah <code>4</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">find</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">d</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params operator" style="color:#393A34">&&</span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">d</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// 4</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-last">◉ Method <code>last</code><a class="hash-link" href="#-method-last" title="Direct link to heading">​</a></h3><p>Digunakan untuk mengambil elemen terakhir data Iterator. Method <code>last</code> ini mengembalikan nilai balik bertipe <code>Option</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">last</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// 4</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Satu hal yang unik perihal notasi closure method <code>find</code>, parameter closure adalah bertipe <code>&&T</code>. Dari tipe tersebut, untuk mengambil <em>underlying value</em> gunakan operator <em>dereference</em> dua kali. Contohnya pada kode di atas, <code>d</code> bertipe data <code>&&i32</code>, untuk mengambil nilai sebenarnya digunakan <code>**d</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-fold">◉ Method <code>fold</code><a class="hash-link" href="#-method-fold" title="Direct link to heading">​</a></h3><p>Method ini digunakan untuk mengkonversi setiap element <code>Iterator</code> menjadi sebuah akumulator yang direpresentasikan oleh 1 buah variabel.</p><blockquote><p>konsep <code>fold</code> milik Rust mirip seperti <code>reduce</code> pada bahasa pemrograman lain</p></blockquote><p>Pada contoh berikut, kita coba terapkan method <code>fold</code> untuk grouping data vector <code>data_vec</code> menjadi 1 buah data bertipe <code>NumberCategory</code>.</p><ul><li>Data numerik genap elemen <code>data_vec</code> masuk ke property <code>even</code> milik <code>NumberCategory</code>.</li><li>Data numerik ganjil elemen <code>data_vec</code> masuk ke property <code>odd</code> milik <code>NumberCategory</code>.</li></ul><p>Dalam penerapannnya, parameter pertama method <code>fold</code> diisi dengan <em>initial value</em>, dan parameter ke-2 isinya closure untuk akumulasi data.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">NumberCategory</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> even</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> odd</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_grouped </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">fold</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">NumberCategory</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> even</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> odd</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params keyword" style="color:#00009f">mut</span><span class="token closure-params"> group</span><span class="token closure-params punctuation" style="color:#393A34">,</span><span class="token closure-params"> each</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">each </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> group</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">even</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">*</span><span class="token plain">each</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> group</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">odd</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">*</span><span class="token plain">each</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> group</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_grouped</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas, data <code>each</code> di-cek nilainya, jika genap maka dimasukan dalam <code>group.even</code>, dan sisanya masuk <code>group.odd</code>.</p><p><img loading="lazy" alt="Trait iterator" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcYAAAB6CAIAAACqf2TEAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFqGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0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OJ9JnxLe2X3nnAY5+v2ZlHqNpGoswjzXFvk13/FH9ez8NrPTd/wZo5JSCYIgSKkEQRAEKZUgCIKUShAEQUolCIIgpRIEQRCkVIIgCFIqQRAEKZUgCIIgpRIEQZBSCYIgSKkEQRCkVIIgCIKUShAEcX78D5xetkU6y2glAAAAAElFTkSuQmCC" width="454" height="122" class="img_ev3q"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-inspect">◉ Method <code>inspect</code><a class="hash-link" href="#-method-inspect" title="Direct link to heading">​</a></h3><p>Biasanya digunakan sewaktu debugging, untuk inspeksi flow pemanggilan method-method milik Iterator. Contoh penerapannya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">cloned</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">inspect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"about to filter: {x}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">filter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">inspect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"made it through filter: {x}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">fold</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">sum</span><span class="token closure-params punctuation" style="color:#393A34">,</span><span class="token closure-params"> i</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> sum </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> i</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sum: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// sum: 10</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Trait iterator" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcEAAADeCAIAAADKLixFAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFqGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjMtMDEtMjVUMDE6NTg6MzkrMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIz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AHAoAADgUAACHAgDgUAAAHAoAADgUAACHAgDgUAAAHAoAADgUAACHAgDgUAAAHAoAgEMBAACHAgA05P/cKzc8bD1H4gAAAABJRU5ErkJggg==" width="449" height="222" class="img_ev3q"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-sum">◉ Method <code>sum</code><a class="hash-link" href="#-method-sum" title="Direct link to heading">​</a></h3><p>Digunakan untuk mencari total/summary data slice numerik.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1.1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2.2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4.5</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">sum</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sum: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// sum: 11.1</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-reduce">◉ Method <code>reduce</code><a class="hash-link" href="#-method-reduce" title="Direct link to heading">​</a></h3><p>Method ini digunakan untuk mengiterasi setiap element array dengan setiap iterasi menampilkan data element ke-<code>n</code> dan element ke-<code>n+1</code>.</p><p>Contoh penerapan sederhananya pada pencarian angka numerik terbesar, yang kode-nya bisa dilihat berikut ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">reduce</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">left</span><span class="token closure-params punctuation" style="color:#393A34">,</span><span class="token closure-params"> right</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"left ({left}) vs right ({right})"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">left </span><span class="token operator" style="color:#393A34">>=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">right </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">" -> left ({left}) is greater"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> left</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">" -> right ({right}) is greater"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> right</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> max_number </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"max_number: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"no data found"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Trait iterator" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcEAAACqCAIAAABanWOSAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFqGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cG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qPvyoO5VkDwYIbOc/l+HszJou/bg7nqeugZPJjrrYdaewgezGiodYlsMw/mKpbDZ/JgTlbuHj2YVwYED2bolYf2AsthAnKcgODBjIYeV0WxHCYg2wcED2Y0dKdgOUxADhIQPJjRUAAAQEMBANBQAAA0FAAADd0vvBgMAGjogTQ08vcFADQUDS053Q/eCAGABRp6eczu5ZqGfXfTsdA7NvBNSxpYjAYgnhev/CKgdHbRyvchqFLepNbisHErVPT3BQA01KShv65qdvv/RUtk79jJuCJtYid78SoaGp09mFpPpyo0qbVpaMrfFwDQUIuGehqS8cYZ/v2Sm2uL3hOKhkZnF91+G5nUpv19AQANXaqhines7aXhqho6+oS3MKnN+fsCABq6RENz3rHfc24PtfPQny8tTGqz/r4AgIYu11DBO3banPHMUTXUWeP8ZdNQbzm1xKTWek+pghgDABoa/F/wjvVFafir0PJ8KnRMZZMaKtg/l5nUoqEA0EFDAQAADQUAOJyGindluC8DAGgoAAAaCgAAaCgAABoKAICGAgCgoQAAgIYCAKChAABoKAAAGgoAgIYCAAAaCgCAhgIAoKEAAKfnf8MuIu6Tpsk4AAAAAElFTkSuQmCC" width="449" height="170" class="img_ev3q"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-min-max">◉ Method <code>min</code>, <code>max</code><a class="hash-link" href="#-method-min-max" title="Direct link to heading">​</a></h3><p>Method <code>min</code> digunakan untuk mencari elemen terkecil pada Iterator, dan <code>max</code> untuk mencari elemen terbesar. Keduanya mengembalikan nilai balik bertipe <code>Option</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> min </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">min</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"min: {min}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// min: 1</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">max</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"max: {max}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// max: 4</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a504-method-lainnya">A.50.4. Method lainnya<a class="hash-link" href="#a504-method-lainnya" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-sort-milik-vect">◉ Method <code>sort</code> milik <code>Vec<T></code><a class="hash-link" href="#-method-sort-milik-vect" title="Direct link to heading">​</a></h3><p>Method <code>sort</code> bukanlah property Iterator, melainkan milik tipe data vector. Kegunaan method ini adalah untuk sorting urutan elemen vector.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"before: {data_vec:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// before: [2, 3, 1, 4]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">sort</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"after: {data_vec:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// after: [1, 2, 3, 4]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/trait_iterator" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../trait_iterator</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/traits">Traits</a></li><li><a href="/basic/vector">Vector</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-work-in-progress">◉ Work in progress<a class="hash-link" href="#-work-in-progress" title="Direct link to heading">​</a></h3><ul><li>Desugar iterator</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/std/iter/index.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/iter/index.html</a></li><li><a href="https://doc.rust-lang.org/std/iter/trait.Iterator.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/iter/trait.Iterator.html</a></li><li><a href="https://becomebetterprogrammer.com/rust-iter-vs-iter_mut-vs-into_iter/" target="_blank" rel="noopener noreferrer">https://becomebetterprogrammer.com/rust-iter-vs-iter_mut-vs-into_iter/</a></li><li><a href="https://blog.thoughtram.io/iterators-in-rust/" target="_blank" rel="noopener noreferrer">https://blog.thoughtram.io/iterators-in-rust/</a></li><li><a href="https://blog.logrocket.com/rust-iterators-closures-deep-dive/" target="_blank" rel="noopener noreferrer">https://blog.logrocket.com/rust-iterators-closures-deep-dive/</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/trait-function"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/attributes"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.51. Attributes</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a501-iterator--intoiterator" class="table-of-contents__link toc-highlight">A.50.1. <code>Iterator</code> & <code>IntoIterator</code></a><ul><li><a href="#-trait-iterator--intoiterator" class="table-of-contents__link toc-highlight">◉ Trait <code>Iterator</code> & <code>IntoIterator</code></a></li><li><a href="#-struct-iterator" class="table-of-contents__link toc-highlight">◉ Struct <code>Iterator</code></a></li></ul></li><li><a href="#a502-pemanfaatan-tipe-data-iterator" class="table-of-contents__link toc-highlight">A.50.2. Pemanfaatan tipe data <code>Iterator</code></a><ul><li><a href="#-praktik-ke-1" class="table-of-contents__link toc-highlight">◉ Praktik ke-1</a></li><li><a href="#-praktik-ke-2" class="table-of-contents__link toc-highlight">◉ Praktik ke-2</a></li></ul></li><li><a href="#a503-method-tipe-data-iterator" class="table-of-contents__link toc-highlight">A.50.3. Method tipe data <code>Iterator</code></a><ul><li><a href="#-method-iter-iter_mut-into_iter" class="table-of-contents__link toc-highlight">◉ Method <code>iter</code>, <code>iter_mut</code>, <code>into_iter</code></a></li><li><a href="#-method-collect" class="table-of-contents__link toc-highlight">◉ Method <code>collect</code></a></li><li><a href="#-method-map" class="table-of-contents__link toc-highlight">◉ Method <code>map</code></a></li><li><a href="#-method-rev" class="table-of-contents__link toc-highlight">◉ Method <code>rev</code></a></li><li><a href="#-method-filter" class="table-of-contents__link toc-highlight">◉ Method <code>filter</code></a></li><li><a href="#-method-cloned" class="table-of-contents__link toc-highlight">◉ Method <code>cloned</code></a></li><li><a href="#-method-copied" class="table-of-contents__link toc-highlight">◉ Method <code>copied</code></a></li><li><a href="#-method-cmp" class="table-of-contents__link toc-highlight">◉ Method <code>cmp</code></a></li><li><a href="#-method-count" class="table-of-contents__link toc-highlight">◉ Method <code>count</code></a></li><li><a href="#-method-eq-ne-gt-ge-lt-le" class="table-of-contents__link toc-highlight">◉ Method <code>eq</code>, <code>ne</code>, <code>gt</code>, <code>ge</code>, <code>lt</code>, <code>le</code></a></li><li><a href="#-method-find" class="table-of-contents__link toc-highlight">◉ Method <code>find</code></a></li><li><a href="#-method-last" class="table-of-contents__link toc-highlight">◉ Method <code>last</code></a></li><li><a href="#-method-fold" class="table-of-contents__link toc-highlight">◉ Method <code>fold</code></a></li><li><a href="#-method-inspect" class="table-of-contents__link toc-highlight">◉ Method <code>inspect</code></a></li><li><a href="#-method-sum" class="table-of-contents__link toc-highlight">◉ Method <code>sum</code></a></li><li><a href="#-method-reduce" class="table-of-contents__link toc-highlight">◉ Method <code>reduce</code></a></li><li><a href="#-method-min-max" class="table-of-contents__link toc-highlight">◉ Method <code>min</code>, <code>max</code></a></li></ul></li><li><a href="#a504-method-lainnya" class="table-of-contents__link toc-highlight">A.50.4. Method lainnya</a><ul><li><a href="#-method-sort-milik-vect" class="table-of-contents__link toc-highlight">◉ Method <code>sort</code> milik <code>Vec<T></code></a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-work-in-progress" class="table-of-contents__link toc-highlight">◉ Work in progress</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.50. Trait ➜ Iterator</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.50. Trait ➜ Iterator</h1></header><p>Iterator adalah salah satu trait dan tipe data custom penting pada Rust programming, gunanya untuk iterasi data. Di chapter ini kita akan mempelajarinya beserta beberapa module item lainnya yang masih relevan dengan topik Iterator.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a501-iterator--intoiterator">A.50.1. <code>Iterator</code> & <code>IntoIterator</code><a class="hash-link" href="#a501-iterator--intoiterator" title="Direct link to heading">​</a></h2><p><code>Iterator</code> adalah sebuah nama yang dipakai sebagai nama module item dalam <strong>Rust Standard Library</strong> maupun <strong>Rust Core Library</strong>, digunakan untuk iterasi data dan operasi lain yang berhubungan dengannya.</p><p>Iterator sendiri merupakan istilah untuk object atau trait yang bisa diiterasi, baik menggunakan keyword <code>for in</code> ataupun menggunakan method iterator seperti <code>for_each</code> (yang juga akan kita bahas di sini).</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-trait-iterator--intoiterator">◉ Trait <code>Iterator</code> & <code>IntoIterator</code><a class="hash-link" href="#-trait-iterator--intoiterator" title="Direct link to heading">​</a></h3><p>Dalam perulangan menggunakan keyword <code>for in</code>, tipe data variabel yang digunakan harus memiliki trait <code>Iterator</code>. Jika tidak, pasti error muncul.</p><p>Tipe data slice di Rust by default mengadopsi trait bernama <code>IntoIterator</code>, yang trait ini digunakan untuk konversi data bertipe slice ke bentuk iterator.</p><p>Dalam praktiknya, tidak perlu mengakses method tertentu untuk mendapatkan object iterator suatu data. Cukup gunakan variabel tipe data slice pada keyword <code>for in</code>, maka proses konversi ke bentuk iterator akan dilakukan oleh Rust secara otomatis dibalik layar.</p><p>Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// array</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_arr </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"d"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> e </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_arr </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e:?} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// vector</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"d"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> e </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_vec </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e:?} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// slice</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"d"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_slice_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> e </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> data_slice_vec </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e:?} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dianjurkan untuk selalu menggunakan teknik <a href="/basic/borrowing">Borrowing</a> dalam penggunaan keyword <code>for in</code> pada tipe data yang karakteristiknya adalah <a href="/basic/ownership#a344-copy-semantics-vs-move-semantics">Move Semantics</a>, hal ini karena dalam penerapan keyword tersebut, terjadi proses konversi tipe data dengan trait <code>IntoIterator</code> ke bentuk <code>Iterator</code>.</p><p>Jika data yang digunakan bukan data borrow, maka pasti owner berpindah.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-struct-iterator">◉ Struct <code>Iterator</code><a class="hash-link" href="#-struct-iterator" title="Direct link to heading">​</a></h3><p>Selain trait <code>Iterator</code>, ada juga tipe data struct bernama sama, yaitu <code>Iterator</code>. Perbedaan antara trait vs struct <code>Iterator</code> adalah tipe struct <code>Iterator</code> memiliki beberapa method untuk keperluan iterasi object. Jadi dengan memanfaatkan method-method tersebut, kita bisa melakukan iterasi data dan operasi sejenisnya tanpa menggunakan <code>for in</code>.</p><p>Semua tipe data slice bisa dikonversi ke tipe data <code>Iterator</code>, caranya dengan mengakses method <code>iter</code> (atau method <code>chars</code> khusus untuk tipe data <code>String</code>).</p><p>Dari object iterator tersebut, perulangan bisa dilakukan via keyword <code>for in</code>, atau dengan memanfaatkan method bernama <code>for_each</code>. Perbedaannya pada iterasi menggunakan <code>for_each</code>, block perulangan dituliskan dalam bentuk closure.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// array</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_arr </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"d"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> iterator_arr </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_arr</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">iterator_arr</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">for_each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">e</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e:?} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// vector</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"d"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">for_each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">e</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e:?} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// slice from vector</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"d"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_slice_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">..</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">data_slice_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">for_each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">e</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e:?} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// slice from String</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_str </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"abcd"</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_borrow_str </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_str</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">data_borrow_str</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">chars</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">for_each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">e</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e:?} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat pada contoh di atas, data slice diambil objek Iterator-nya menggunakan method <code>iter</code> (atau <code>chars</code> khusus untuk tipe data <code>String</code>), kemudian di-iterasi menggunakan method <code>for_each</code>.</p><p><img loading="eager" fetchpriority="high" alt="Trait iterator" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcgAAACVCAYAAADcxmp3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAByhSURBVHhe7Z3LrSS5sYZlyYwG8kBGyIeGgHFhLBAa0FYmHGAc6IVs6IV2vbkWnZt8B4MRwUcxs7Kq/8WH7kqSwWAwyL8yT2XmX3755ZdPAAAAANRAIAEAAAABCCQAAAAgAIEEAAAABCCQAAAAgAAEEgAAABCAQAIAAAACEEgAAABAAAIJAAAACEAgAQAAAAEIJAAAACAAgQQAAAAEIJAAAACAAAQSAAAAEIBAAgAAAAKPCeTXb58/vn98fvGfv3x+fP/x+e0rq3MqXz+//fj2+VUsew2+fvvx+f3ji1i2xvo87PJl/5iupx2Dy7UfJN/7rMXhjHUUbGq+zPj5DnMLzuPdcmldIL98fH7/8f3z40s69gyB/OXzy8f3qU0rb3SUb1/N8u6Y3BcF1mZ44l0cNf+rLyCjPDAPli8OP+fH+Do+nZ/49hzt6L+1MS+QVjydfeq/I/R3vUB2553wCpsaOB81D94slxYFUlpwzxFIx1ygw0ZX/Ax+B5HsbCQaXiDJmWwUkjE7RtyuFshOW/dl5PvH16MO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AICCTnxu0gkAAAcB3zAkmfEeo26RNeDFyhtusI5G387DDRrhLI1f4AAAAMsflvkOzxb6du2kkg8cJkAAAA+9kqkHhh8l74eKozSAAAAKey+Qyyxv9t7LK3eRx4ATvrLPJswWfQS6gRCCQAAFzHXoH0m3q5HOi5UiAFUdkHXpgMAAA/ExsFEi9M3goEEgAAnsp2gcwCks4mLxPI8y+BXns7BV6YDAAAz2Tzj3TCJh7AC5Mfhv5i9oij6xsCCQAA13Dqj3QAAACAVwUCCQAAAAhAIAEAAAABCCQAAAAgAIEEAAAABCCQAAAAgAAEEgAAABBYFMh4D+L0PY4724Vj9pNt7uDnCGPt2ifprPYHAACgBwRS5J7tIJAAAHAdDwnk/FNddrYLx0YE8rl+jjDWThPI+f4AAAD02Pw3yLBh58ej4YXJD8LieXp/AAAAElsFEi9M3gsfT3sGCQAA4Cw2n0HW+Ad7nyZY6QySHMMLkwEAAGxir0CmV1xRrhRIQVT2gRcmAwDAz8RGgcQLk7cCgQQAgKeyXSCzgKSzycsE8vxLoOFdkGedoXLwwmQAAHgmm3+kQ18mjBcmPwxemAwAAE/j1B/pAAAAAK8KBBIAAAAQgEACAAAAAhBIAAAAQAACCQAAADT88vn/3H/DgxlJlrQAAAAASUVORK5CYII=" width="456" height="149" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a502-pemanfaatan-tipe-data-iterator">A.50.2. Pemanfaatan tipe data <code>Iterator</code><a class="hash-link" href="#a502-pemanfaatan-tipe-data-iterator" title="Direct link to heading">​</a></h2><p>Tipe data <code>Iterator</code> memiliki cukup banyak method untuk keperluan operasi data iterator, contohnya seperti <code>for_each</code>, <code>map</code>, <code>filter</code>, dan lainnya.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-praktik-ke-1">◉ Praktik ke-1<a class="hash-link" href="#-praktik-ke-1" title="Direct link to heading">​</a></h3><p>Sebagai contoh, kita akan buat sebuah program sederhana yang melakukan operasi kuadrat pada elemen tiap-tiap array.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_arr </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> doubles</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_arr</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">e</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> e </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> e</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{doubles:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Trait iterator" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAAB5CAIAAAAmt7g4AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFqGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjI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sx88iFoJathsuxzrTwqO6WOkEbLTyWdk+C5JOi5N3qeeDesfk6fIZpNiysDUpfj8pnOq8LPi5rXSuB0sg0urFuWVi3UVrIclw8Fa2efmW5aesVPV7RJbHIdPDVa9Y1lBD1vT8la53HpYP74e3Nta8fb7t6Fp5zcOUHQ83Up+ircGId2pOcF7HhvupwIQc+eimfuHdGpzNz3i6RrKKf6wUQ4j6AnQghBT4QQgp4IIQQ9EUIIQU+EEIKeCCEEPRFCCHoihBD0RAghBD0RQgh6IoQQ9EQIIeiJEELQ09Lvv/876b8/36+ssnPZ//6m6xFC3empYXMA00KergPy9z//CSYG2yQrjz9CT4TQDuh5pN/fPy9MWgq/83FDQr9rDw+PPv072KrnCD0RQhen5++/w9/fl9EzBuY6sM1pQU+E0LXM3FfQMzzKSh16IoSgpx18rlk8DSfu8bpnSkroiRC6BXrGd8Jf/r0IbAMu1SPlL9ATIXQb9IwTWZDGAEjzOAFL6IkQ2jk9x/mzG4dpCr7D8+jUglLoiRDaBT2TZytDlI0/5UmlPa5Zcfg87Z9yj4skwQo9EUJ7ij1Ntq2Yzq88/OCcyiOE0I7oOQaFi9m38nDoiRDaIT15zx0hhPBYQggh6IkQQtATIYSgJ0IIQU+EEELQEyGEoCdCCEFPhBCCngghBD0RQghBT4QQgp4IIQQ9EUIIeiKEEPRECCEEPRFCaLn+DyiB1plsXAGMAAAAAElFTkSuQmCC" width="447" height="121" class="img_CujE"></p><p>Penjelasan:</p><ol><li>Variabel <code>data_arr</code> yang bertipe data <code>[i32; 3]</code> dikonversi ke tipe data <code>Iterator</code> menggunakan method <code>iter</code>.</li><li>Object <code>Iterator</code> kemudian di-iterasi menggunakan method <code>map</code> dan nilai baliknya dijadikan <em>replacement</em> data elemen tersebut.</li><li>Object <code>Iterator</code> kemudian di-collect data-nya ke bentuk <code>Vec<i32></code> menggunakan method <code>collect</code>.</li></ol><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-praktik-ke-2">◉ Praktik ke-2<a class="hash-link" href="#-praktik-ke-2" title="Direct link to heading">​</a></h3><p>Contoh lain penerapan method iterator bisa dilihat pada kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"1"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"2"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"3"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"4"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> numbers</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">e</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> e</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Ok</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> n</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">_</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">filter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">e</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">e </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&&</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">e </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">rev</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">::</span><span class="token operator" style="color:#393A34"><</span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">>></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{numbers:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Program di atas melakukan beberapa hal:</p><ol><li><p>Data <code>data_vec</code> yang merupakan koleksi string di-konversi menjadi object <code>Iterator</code> menggunakan method <code>iter</code>.</p></li><li><p>Kemudian method <code>map</code> diakses. Setiap elemen <code>data_vec</code> di-iterasi, kemudian dikonversi dari <code>String</code> ke <code>i32</code>, lalu dijadikan <em>replacement</em> data elemen tersebut. Jika proses konversi gagal, maka angka <code>0</code> digunakan sebagai data element tersebut.</p><ul><li>Sampai sini, data yang sebelumnya <code>["1", "2", "3", "4", "a"]</code> sekarang menjadi <code>[1, 2, 3, 4, 0]</code>.</li></ul></li><li><p>Selanjutnya, dilakukan proses filtering menggunakan method <code>filter</code> dengan kondisi <code>*e > 0 && *e % 2 == 0</code> yang kurang lebih artinya, jika nilai <em>dereference</em> <code>e</code> lebih besar dari <code>0</code> dan nilai tersebut adalah genap, maka filter bernilai <code>true</code>.</p><ul><li>Sampai sini, data yang sebelumnya <code>[1, 2, 3, 4, 0]</code> sekarang menjadi <code>[2, 4]</code>.</li></ul></li><li><p>Kemudian, data kolektif tersebut dibalik urutan elemennya menggunakan method <code>rev</code>.</p><ul><li>Sampai sini, data yang sebelumnya <code>[2, 4]</code> sekarang menjadi <code>[4, 2]</code>.</li></ul></li><li><p>Terakhir data di-collect menggunakan method <code>collect</code> dengan ditentukan tipe data masing-masing elemen adalah <code>Vec<i32></code>.</p></li></ol><p>Hasilnya ketika di run:</p><p><img loading="lazy" alt="Trait iterator" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAAB2CAIAAADX4QrtAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFqGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjMtMDEtMjRUMjI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9YM488urBmmgAAAABJRU5ErkJggg==" width="447" height="118" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a503-method-tipe-data-iterator">A.50.3. Method tipe data <code>Iterator</code><a class="hash-link" href="#a503-method-tipe-data-iterator" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-iter-iter_mut-into_iter">◉ Method <code>iter</code>, <code>iter_mut</code>, <code>into_iter</code><a class="hash-link" href="#-method-iter-iter_mut-into_iter" title="Direct link to heading">​</a></h3><p>Ketiga method ini berguna untuk konversi data slice ke bentuk <code>Iterator</code>, perbedannya:</p><ul><li><p>Method <code>iter</code> mengembalikan data <code>Iterator</code> yang isinya adalah reference (<code>&T</code>) setiap element. Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">for_each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">d</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> d </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">data_vec </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Method <code>iter_mut</code> mengembalikan data <code>Iterator</code> yang isinya adalah mutable reference (<code>&mut T</code>) setiap element. Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter_mut</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">for_each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">d</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> d </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> data_vec </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Method <code>into_iter</code> mengkonversi data slice ke bentuk <code>Iterator</code> (<em>move semantics</em>).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">into_iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">for_each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">d</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> d </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// statement di bawah ini menghasilkan error,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// karena ownership `data_vec` telah berpindah setelah method `into_iter` dipanggil</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// println!("{}", data_vec)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-collect">◉ Method <code>collect</code><a class="hash-link" href="#-method-collect" title="Direct link to heading">​</a></h3><p>Method ini digunakan untuk <em>collecting</em> data Iterator ke bentuk tertentu. Contoh penerapannya bisa dilihat pada kode berikut ini.</p><p>Data <code>data_vec</code> yang merupakan vektor bertipe <code>Vec<i32></code> dikonversi ke bentuk <code>Iterator</code> kemudian di-collect datanya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// [1, 2, 3, 4]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Method <code>iter</code> menghasilkan object <code>Iterator</code> yang menampung reference <code>&T</code> setiap element slice. Hal ini membuat penerapan method <code>collect</code> menghasilkan data bertipe <code>Vec<&i32></code> (bukan <code>Vec<i32></code>).</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-map">◉ Method <code>map</code><a class="hash-link" href="#-method-map" title="Direct link to heading">​</a></h3><p>Method <code>map</code> digunakan untuk mapping element setiap data iterator ke nilai baru.</p><p>Sebelumnya kita telah mempelajari method <code>iter</code> dan <code>collect</code> yang keduanya jika dikombinasikan dan digunakan pada tipe data <code>Vec<i32></code> hasilnya adalah data bertipe <code>Vec<&i32></code>. Dengan memanfaatkan method <code>map</code>, tipe data setiap element bisa di-mapping ke nilai baru dengan tipe data berbeda, misalnya menjadi <code>Vec<i32></code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result1</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// [1, 2, 3, 4]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result2</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">d</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params operator" style="color:#393A34">&</span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// [1, 2, 3, 4]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh lainnya bisa dilihat pada <em>section</em> <a href="/basic/trait-iterator#a482-pemanfaatan-tipe-data-iterator">A.50.2. Pemanfaatan tipe data <code>Iterator</code></a>, di situ terdapat operasi mapping data slice numerik ke bentuk yang sama tapi nilai setiap element adalah kuadrat, dan ke bentuk lain dengan tipe data berbeda.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-rev">◉ Method <code>rev</code><a class="hash-link" href="#-method-rev" title="Direct link to heading">​</a></h3><p><code>rev</code> kependekan dari <em>reverse</em>, digunakan untuk membalikan urutan data slice.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// [1, 2, 3, 4]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">rev</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// [4, 3, 2, 1]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-filter">◉ Method <code>filter</code><a class="hash-link" href="#-method-filter" title="Direct link to heading">​</a></h3><p>Method <code>filter</code> digunakan untuk memfilter element data slice. Data kolektif diiterasi kemudian dicek menggunakan closure, jika nilai balik bertipe <code>true</code> maka elemen tersebut masuk dalam dalam hasil filter, selebihnya maka dianggap tidak memenuhi kondisi filter dan elemen di-<em>exclude</em>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> odd</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">filter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">d</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">!=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"odd numbers: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> odd</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// odd numbers: [1, 3]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> even</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">filter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">d</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"even numbers: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> even</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// odd numbers: [2, 4]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-cloned">◉ Method <code>cloned</code><a class="hash-link" href="#-method-cloned" title="Direct link to heading">​</a></h3><p>Digunakan untuk <em>cloning</em> data slice secara keseluruhan tanpa mengubah tipe data. Hasilnya adalah data dengan skema sama persis (dalam bentuk <code>Iterator</code>) tapi berbeda owner.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">cloned</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// [1, 2, 3, 4]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-copied">◉ Method <code>copied</code><a class="hash-link" href="#-method-copied" title="Direct link to heading">​</a></h3><p>Secara <em>high-level</em> <code>copied</code> menghasilkan output yang sama dengan <code>cloned</code>. Namun jika dibahas dari sisi management memory-nya, ada perbedaan yang cukup besar.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">copied</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">collect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// [1, 2, 3, 4]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Lebih detailnya mengenai clone vs copy akan dibahas pada chapter <a href="#/wip/copy-clone-move-drop">Copy, Clone, Move, Drop</a></p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-cmp">◉ Method <code>cmp</code><a class="hash-link" href="#-method-cmp" title="Direct link to heading">​</a></h3><p><code>cmp</code> kependekan dari <em>compare</em>, digunakan untuk membandingkan 2 buah data iterasi dengan nilai balik bertipe enum <code>Ordering</code>. Dari tipe data enum tersebut nantinya bisa dicek apakah 2 buah data slice tersebut sama (secara <em>Lexicographical</em>).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">cmp</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data_vec2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_eq</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// true</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Enum <code>Ordering</code> memiliki beberapa method, salah satunya adalah <code>is_eq</code> yang mengembalikan nilai <code>true</code> jika dua buah data slice tersebut adalah sama.</p><blockquote><p>Lebih detailnya mengenai <code>Ordering</code> akan dibahas pada chapter <a href="#/wip/enum-ordering">Enum Ordering</a></p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-count">◉ Method <code>count</code><a class="hash-link" href="#-method-count" title="Direct link to heading">​</a></h3><p>Digunakan untuk melihat size dari elemen Iterator.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> length </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">count</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> length</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// 4</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-eq-ne-gt-ge-lt-le">◉ Method <code>eq</code>, <code>ne</code>, <code>gt</code>, <code>ge</code>, <code>lt</code>, <code>le</code><a class="hash-link" href="#-method-eq-ne-gt-ge-lt-le" title="Direct link to heading">​</a></h3><p>6 Method ini digunakan untuk komparasi dua buah slice. Penggunakan 6 method ini merupakan alternatif selain menggunakan method <code>cmp</code>.</p><p>Sebagai contoh, penerapan method <code>eq</code> berikut untuk untuk mengecek apakah 2 buah data slice adalah sama (secara <em>Lexicographical</em>).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">eq</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data_vec2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// true</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kode di atas adalah ekuivalen dengan kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec1</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">cmp</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data_vec2</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_eq</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// true</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Berikut merupakan kegunaan tiap-tiap method di atas:</p><ul><li>Method <code>eq</code> digunakan untuk <em>equal lexicographical comparison</em></li><li>Method <code>ne</code> digunakan untuk <em>not equal lexicographical comparison</em></li><li>Method <code>gt</code> digunakan untuk <em>greater than lexicographical comparison</em></li><li>Method <code>ge</code> digunakan untuk <em>greater than or equal lexicographical comparison</em></li><li>Method <code>lt</code> digunakan untuk <em>lower than lexicographical comparison</em></li><li>Method <code>le</code> digunakan untuk <em>lower than or equal lexicographical comparison</em></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-find">◉ Method <code>find</code><a class="hash-link" href="#-method-find" title="Direct link to heading">​</a></h3><p>Digunakan untuk mencari apakah suatu elemen ada atau tidak dengan kondisi pencarian dituliskan dalam bentuk closure. Nilai balik method ini bertipe <code>Option</code>.</p><p>Sebagai contoh, perhatikan kode berikut. Method <code>find</code> digunakan untuk mencari elemen yang nilainya adalah <code>4</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">find</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">d</span><span class="token closure-params punctuation" style="color:#393A34">:</span><span class="token closure-params"> </span><span class="token closure-params operator" style="color:#393A34">&&</span><span class="token closure-params keyword" style="color:#00009f">i32</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">d</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">d</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// 4</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-last">◉ Method <code>last</code><a class="hash-link" href="#-method-last" title="Direct link to heading">​</a></h3><p>Digunakan untuk mengambil elemen terakhir data Iterator. Method <code>last</code> ini mengembalikan nilai balik bertipe <code>Option</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">i32</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">last</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// 4</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Satu hal yang unik perihal notasi closure method <code>find</code>, parameter closure adalah bertipe <code>&&T</code>. Dari tipe tersebut, untuk mengambil <em>underlying value</em> gunakan operator <em>dereference</em> dua kali. Contohnya pada kode di atas, <code>d</code> bertipe data <code>&&i32</code>, untuk mengambil nilai sebenarnya digunakan <code>**d</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-fold">◉ Method <code>fold</code><a class="hash-link" href="#-method-fold" title="Direct link to heading">​</a></h3><p>Method ini digunakan untuk mengkonversi setiap element <code>Iterator</code> menjadi sebuah akumulator yang direpresentasikan oleh 1 buah variabel.</p><blockquote><p>konsep <code>fold</code> milik Rust mirip seperti <code>reduce</code> pada bahasa pemrograman lain</p></blockquote><p>Pada contoh berikut, kita coba terapkan method <code>fold</code> untuk grouping data vector <code>data_vec</code> menjadi 1 buah data bertipe <code>NumberCategory</code>.</p><ul><li>Data numerik genap elemen <code>data_vec</code> masuk ke property <code>even</code> milik <code>NumberCategory</code>.</li><li>Data numerik ganjil elemen <code>data_vec</code> masuk ke property <code>odd</code> milik <code>NumberCategory</code>.</li></ul><p>Dalam penerapannnya, parameter pertama method <code>fold</code> diisi dengan <em>initial value</em>, dan parameter ke-2 isinya closure untuk akumulasi data.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">NumberCategory</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> even</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> odd</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i32</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_grouped </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">fold</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">NumberCategory</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> even</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> odd</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params keyword" style="color:#00009f">mut</span><span class="token closure-params"> group</span><span class="token closure-params punctuation" style="color:#393A34">,</span><span class="token closure-params"> each</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">each </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> group</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">even</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">*</span><span class="token plain">each</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> group</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">odd</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">*</span><span class="token plain">each</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> group</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_grouped</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pada kode di atas, data <code>each</code> di-cek nilainya, jika genap maka dimasukan dalam <code>group.even</code>, dan sisanya masuk <code>group.odd</code>.</p><p><img loading="lazy" alt="Trait iterator" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcYAAAB6CAIAAACq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SK2hmVPVoc5QyNnEz581Fq2I91KFUfI7GIgomrGGQFSl1iEFLqpVDqMJQ2pUYzaKLUODp8S/0iuCBc4p+u88zlsAIQWYiK4uk2TJCkoqDXSZNeohoddOmaLNggwaXjMhz2CA3HetsT89b9U4FrUSoaI+lfTVUwcSWDLKDUKXCevZfK497LodTmHwNvzqfUaRr8lStvbffKXvfLrQM1W7AXEUSpqO6AUsH0CSNGy73dRxmKQSLjTym4R5UoNTDW3OJWpFQxRoeiVKOMEoMkJ8bEUSm1m9avi6PU0+WK/2iHziIrjB01SsUVpbtsysalMq+C3eMXvwFn5Ol/mI6KcM5alBqfDc7b8oTH3GtEqd2K55CUKvtfsvDnkf+lUGq7Qf/+PlJqQEZ/fZQa7/0hpoTHtdGO4tur2E6Uy3iTkrH3hjQd7bpiB25+eH93ObdnEqixYEumL6/v8bFemtOg1Plbhyqf4ueilm0dusqEY5Qe2+mJ1fZSSw0CFl/cS71OSg1XsuMKtDveNykVHbyCdM2J5SlveOb9KnYW1BN/cLSfHO/ndhLmbDCWn/hnKEDmrEGpItBMT9jdM9u18HeWCcboJnjS4Vf4aIpMXGQQsedSZpDo8vl7qaTUw1Pq5SHx3pkLOf8C7KDPpXrDxXUWviuUeWkGIaWSUg+CeNU17/il5KmiY5zRehmki/7WOJ9JnxLe2X3nnAY5+v2ZlHqNpGoswjzXFvk13/FH9ez8NrPTd/wZo5JSCYIgSKkEQRAEKZUgCIKUShAEQUolCIIgpRIEQRCkVIIgCFIqQRAEKZUgCIIgpRIEQZBSCYIgSKkEQRCkVIIgCIKUShAEcX78D5xetkU6y2glAAAAAElFTkSuQmCC" width="454" height="122" class="img_CujE"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-inspect">◉ Method <code>inspect</code><a class="hash-link" href="#-method-inspect" title="Direct link to heading">​</a></h3><p>Biasanya digunakan sewaktu debugging, untuk inspeksi flow pemanggilan method-method milik Iterator. Contoh penerapannya:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">cloned</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">inspect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"about to filter: {x}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">filter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">==</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">inspect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">x</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"made it through filter: {x}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">fold</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">sum</span><span class="token closure-params punctuation" style="color:#393A34">,</span><span class="token closure-params"> i</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> sum </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> i</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sum: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// sum: 10</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Trait iterator" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcEAAADeCAIAAADKLixFAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFqGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1Q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AAOBQA4DwOnfo1Rz3WcyqrZUVPekKeWGgAHLqCQ2cmPO3SocRCA+DQJg6dtarDOJRYaIDX4tBr0tvzrRR5CksSGcx8MZ4B9T7TKYeus9Oa9axoIy/ZFSCdLtktbYdSe8tQYqEBzuvQ7nIL/v96PWnBzJEZhutOTSxuVHapdejdiLm85KoA6XGPxvgRvSG363PlKbHQAAd3aHQdKdfT7SJX8vA+W4nFazpUl2Ac51cTIB0uGsVTqRF/zjp0nkOJhQY4nENlMLPqUCOxeHOHpiusCJAOsu/G6m5ThxILDXAsh+oljunQuvJnM4e6A6TD2dBw+L+pQ4mFBjiaQ0UwczJPGNSrNRefIwU5+17bLjmH+gOkdWGt6lBioQEOP5bXgpmD6qX7AWTlvnxuKF+VgnwpryR7U0jbDG+AdHpXfoH5UGKhAc7qUMiXhf4iGQBwKCQlZPVUBQDgUCzKjRYAHAoAADgUAACHAgDgUAAAHAoAAMd06HjTmxveAIBDa+DLlgBwRoeGzxGOD8Snjzaaac0X58OFcYIbAMApHKo9/W04VEtrdju0W/6ZoTwAnM+hqdEMh5bSmsvFbvi7HDyGDgCnGMuPN3pycZkLOLT0sxgAAEd0aOhSM+ptpkOT5XEoAJzOodlw4pxDvfeUorE8CgWA4zs0TgLOhBPPdmhN1jIAwPHqUAAAHAoAADgUAACHAgDgUAAAHAoAADgUAACHAgDgUAAAHAoAADgUAACHAgDgUAAAHAoAgEMBAACHAgA05P/cKzc8bD1H4gAAAABJRU5ErkJggg==" width="449" height="222" class="img_CujE"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-sum">◉ Method <code>sum</code><a class="hash-link" href="#-method-sum" title="Direct link to heading">​</a></h3><p>Digunakan untuk mencari total/summary data slice numerik.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1.1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2.2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3.3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4.5</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">sum</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"sum: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// sum: 11.1</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-reduce">◉ Method <code>reduce</code><a class="hash-link" href="#-method-reduce" title="Direct link to heading">​</a></h3><p>Method ini digunakan untuk mengiterasi setiap element array dengan setiap iterasi menampilkan data element ke-<code>n</code> dan element ke-<code>n+1</code>.</p><p>Contoh penerapan sederhananya pada pencarian angka numerik terbesar, yang kode-nya bisa dilihat berikut ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">reduce</span><span class="token punctuation" style="color:#393A34">(</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token closure-params">left</span><span class="token closure-params punctuation" style="color:#393A34">,</span><span class="token closure-params"> right</span><span class="token closure-params closure-punctuation punctuation" style="color:#393A34">|</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"left ({left}) vs right ({right})"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">left </span><span class="token operator" style="color:#393A34">>=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain">right </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">" -> left ({left}) is greater"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> left</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">" -> right ({right}) is greater"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> right</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">match</span><span class="token plain"> max_number </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">Some</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"max_number: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> n</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"no data found"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Trait iterator" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcEAAACqCAIAAABanWOSAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFqGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvb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24PtfPQny8tTGqz/r4AgIYu11DBO3banPHMUTXUWeP8ZdNQbzm1xKTWek+pghgDABoa/F/wjvVFafir0PJ8KnRMZZMaKtg/l5nUoqEA0EFDAQAADQUAOJyGindluC8DAGgoAAAaCgAAaCgAABoKAICGAgCgoQAAgIYCAKChAABoKAAAGgoAgIYCAAAaCgCAhgIAoKEAAKfnf8MuIu6Tpsk4AAAAAElFTkSuQmCC" width="449" height="170" class="img_CujE"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-min-max">◉ Method <code>min</code>, <code>max</code><a class="hash-link" href="#-method-min-max" title="Direct link to heading">​</a></h3><p>Method <code>min</code> digunakan untuk mencari elemen terkecil pada Iterator, dan <code>max</code> untuk mencari elemen terbesar. Keduanya mengembalikan nilai balik bertipe <code>Option</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> min </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">min</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"min: {min}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// min: 1</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> max </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">max</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"max: {max}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// max: 4</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a504-method-lainnya">A.50.4. Method lainnya<a class="hash-link" href="#a504-method-lainnya" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-sort-milik-vect">◉ Method <code>sort</code> milik <code>Vec<T></code><a class="hash-link" href="#-method-sort-milik-vect" title="Direct link to heading">​</a></h3><p>Method <code>sort</code> bukanlah property Iterator, melainkan milik tipe data vector. Kegunaan method ini adalah untuk sorting urutan elemen vector.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> data_vec </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"before: {data_vec:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// before: [2, 3, 1, 4]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">data_vec</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">sort</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"after: {data_vec:?}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// after: [1, 2, 3, 4]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/trait_iterator" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../trait_iterator</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/traits">Traits</a></li><li><a href="/basic/vector">Vector</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-work-in-progress">◉ Work in progress<a class="hash-link" href="#-work-in-progress" title="Direct link to heading">​</a></h3><ul><li>Desugar iterator</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/std/iter/index.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/iter/index.html</a></li><li><a href="https://doc.rust-lang.org/std/iter/trait.Iterator.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/iter/trait.Iterator.html</a></li><li><a href="https://becomebetterprogrammer.com/rust-iter-vs-iter_mut-vs-into_iter/" target="_blank" rel="noopener noreferrer">https://becomebetterprogrammer.com/rust-iter-vs-iter_mut-vs-into_iter/</a></li><li><a href="https://blog.thoughtram.io/iterators-in-rust/" target="_blank" rel="noopener noreferrer">https://blog.thoughtram.io/iterators-in-rust/</a></li><li><a href="https://blog.logrocket.com/rust-iterators-closures-deep-dive/" target="_blank" rel="noopener noreferrer">https://blog.logrocket.com/rust-iterators-closures-deep-dive/</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/trait-function"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/attributes"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.51. Attributes</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a501-iterator--intoiterator" class="table-of-contents__link toc-highlight">A.50.1. <code>Iterator</code> & <code>IntoIterator</code></a><ul><li><a href="#-trait-iterator--intoiterator" class="table-of-contents__link toc-highlight">◉ Trait <code>Iterator</code> & <code>IntoIterator</code></a></li><li><a href="#-struct-iterator" class="table-of-contents__link toc-highlight">◉ Struct <code>Iterator</code></a></li></ul></li><li><a href="#a502-pemanfaatan-tipe-data-iterator" class="table-of-contents__link toc-highlight">A.50.2. Pemanfaatan tipe data <code>Iterator</code></a><ul><li><a href="#-praktik-ke-1" class="table-of-contents__link toc-highlight">◉ Praktik ke-1</a></li><li><a href="#-praktik-ke-2" class="table-of-contents__link toc-highlight">◉ Praktik ke-2</a></li></ul></li><li><a href="#a503-method-tipe-data-iterator" class="table-of-contents__link toc-highlight">A.50.3. Method tipe data <code>Iterator</code></a><ul><li><a href="#-method-iter-iter_mut-into_iter" class="table-of-contents__link toc-highlight">◉ Method <code>iter</code>, <code>iter_mut</code>, <code>into_iter</code></a></li><li><a href="#-method-collect" class="table-of-contents__link toc-highlight">◉ Method <code>collect</code></a></li><li><a href="#-method-map" class="table-of-contents__link toc-highlight">◉ Method <code>map</code></a></li><li><a href="#-method-rev" class="table-of-contents__link toc-highlight">◉ Method <code>rev</code></a></li><li><a href="#-method-filter" class="table-of-contents__link toc-highlight">◉ Method <code>filter</code></a></li><li><a href="#-method-cloned" class="table-of-contents__link toc-highlight">◉ Method <code>cloned</code></a></li><li><a href="#-method-copied" class="table-of-contents__link toc-highlight">◉ Method <code>copied</code></a></li><li><a href="#-method-cmp" class="table-of-contents__link toc-highlight">◉ Method <code>cmp</code></a></li><li><a href="#-method-count" class="table-of-contents__link toc-highlight">◉ Method <code>count</code></a></li><li><a href="#-method-eq-ne-gt-ge-lt-le" class="table-of-contents__link toc-highlight">◉ Method <code>eq</code>, <code>ne</code>, <code>gt</code>, <code>ge</code>, <code>lt</code>, <code>le</code></a></li><li><a href="#-method-find" class="table-of-contents__link toc-highlight">◉ Method <code>find</code></a></li><li><a href="#-method-last" class="table-of-contents__link toc-highlight">◉ Method <code>last</code></a></li><li><a href="#-method-fold" class="table-of-contents__link toc-highlight">◉ Method <code>fold</code></a></li><li><a href="#-method-inspect" class="table-of-contents__link toc-highlight">◉ Method <code>inspect</code></a></li><li><a href="#-method-sum" class="table-of-contents__link toc-highlight">◉ Method <code>sum</code></a></li><li><a href="#-method-reduce" class="table-of-contents__link toc-highlight">◉ Method <code>reduce</code></a></li><li><a href="#-method-min-max" class="table-of-contents__link toc-highlight">◉ Method <code>min</code>, <code>max</code></a></li></ul></li><li><a href="#a504-method-lainnya" class="table-of-contents__link toc-highlight">A.50.4. Method lainnya</a><ul><li><a href="#-method-sort-milik-vect" class="table-of-contents__link toc-highlight">◉ Method <code>sort</code> milik <code>Vec<T></code></a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-work-in-progress" class="table-of-contents__link toc-highlight">◉ Work in progress</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/traits.html b/basic/traits.html index 2e5b0c69..a1f5f217 100644 --- a/basic/traits.html +++ b/basic/traits.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/traits/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/traits/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.36. Traits","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/traits/#webpage"},"wordCount":891,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/traits/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/traits/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/traits","name":"A.36. Traits","description":"Trait jika diartikan dalam Bahasa Indonesia artinya adalah sifat. Chapter ini akan membahas tentang apa itu trait, apa kegunaannya, dan bagaimana cara penerapannya di Rust programming.","datePublished":"2024-08-01T10:17:31.203Z","dateModified":"2024-08-01T10:17:31.203Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/traits/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/traits"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/traits/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.36. Traits","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/traits/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/traits/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.36. Traits","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/traits/#webpage"},"wordCount":891,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/traits/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/traits/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/traits","name":"A.36. Traits","description":"Trait jika diartikan dalam Bahasa Indonesia artinya adalah sifat. Chapter ini akan membahas tentang apa itu trait, apa kegunaannya, dan bagaimana cara penerapannya di Rust programming.","datePublished":"2024-08-30T07:44:51.221Z","dateModified":"2024-08-30T07:44:51.221Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/traits/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/traits"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/traits/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.36. Traits","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.36. Traits</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.36. Traits</h1></header><p>Trait jika diartikan dalam Bahasa Indonesia artinya adalah sifat. Chapter ini akan membahas tentang apa itu trait, apa kegunaannya, dan bagaimana cara penerapannya di Rust programming.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a361-konsep-traits">A.36.1. Konsep traits<a class="hash-link" href="#a361-konsep-traits" title="Direct link to heading">​</a></h2><p>Di Rust kita bisa mendefinisikan trait/sifat, isinya adalah definisi header method yang bisa di-share ke banyak tipe data.</p><p>Trait isinya hanya definisi header method (bisa diartikan method tanpa isi). Ketika ada tipe data yang meng-implement suatu trait, maka tipe tersebut wajib untuk menuliskan implementasi method sesuai dengan header method yang ada di trait.</p><blockquote><p>Pada bahasa pemrograman lain, contohnya Java, konsep trait mirip dengan <code>interface</code></p></blockquote><p>Ada dua bagian penting dalam trait yang harus diketahui:</p><ol><li>Deklarasi trait</li><li>Implementasi trait ke tipe data</li></ol><p>Perihal point pertama, intinya kita bisa menciptakan trait sesuai kebutuhan. Terlepas dari itu, Rust juga menyediakan cukup banyak traits yang di-implement ke banyak tipe data yang ada di Rust standard library. Beberapa di antaranya:</p><ul><li>Trait <code>std::fmt::Debug</code>, digunakan agar data bisa di-print menggunakan formatted print <code>{:?}</code>.</li><li>Trait <code>std::iter::Enumerate</code>, digunakan agar data bisa di-iterasi menggunakan keyword <code>for</code>.</li><li>Trait <code>std::ops::Add</code>, di-implementasikan agar data bisa digunakan pada operasi aritmatik penambahan <code>+</code>.</li></ul><p>Ok, biar lebih jelas, mari lanjut pembelajaran menggunakan contoh. Kita mulai dengan pembahasan tentang cara implementasi trait. Contoh yang digunakan adalah implementasi salah satu trait milik Rust standard library, yaitu trait <code>std::fmt::Debug</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-jenis-traits-berdasarkan-tempat-dideklarasikannya">◉ Jenis traits berdasarkan tempat dideklarasikannya<a class="hash-link" href="#-jenis-traits-berdasarkan-tempat-dideklarasikannya" title="Direct link to heading">​</a></h3><p>Berdasarkan tempat dimana traits dibuat, ada 2 jenis traits:</p><ul><li><p><strong>External traits</strong> (atau foreign traits).</p><p> Yaitu traits yang tempat dideklarasikannya berada di luar create kode yang ditulis. Misalnya, trait <code>std::fmt::Debug</code> dan <code>std::ops::Add</code>, keduanya merupakan external traits yang berada di crate <code>std</code> atau crate Rust Standard Library.</p><p> Pada case yang berhubungan dengan external traits, kita programmer umumnya hanya fokus ke implementasi saya, bagaimana cara memanfaatkan dan menggunakan external traits yang sudah ada ke dalam kode yang ditulis.</p></li><li><p><strong>Local traits</strong>.</p><p> Adalah traits yang kita ciptakan di crate yang berada di dalam package/project yang sedang kita kerjakan. </p></li></ul><p>Chapter ini fokusnya adalah pembahasan tentang dasar implementasi <strong>external traits</strong> dan cara kerjanya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a362-implementasi-trait">A.36.2. Implementasi trait<a class="hash-link" href="#a362-implementasi-trait" title="Direct link to heading">​</a></h2><p>Kita pilih trait <code>std::fmt::Debug</code> milik Rust standard library untuk belajar cara implementasi trait pada tipe data.</p><p>Kegunaan dari trait ini adalah: jika di-implement ke tipe data tertentu maka data dengan tipe tersebut bisa di-print via macro <code>println</code> atau macro printing lainnya, dengan menggunakan formatted print <code>{:?}</code>.</p><p>Trait <code>Debug</code> ini diimplementasikan ke pada banyak tipe data yang di Rust standard library, baik itu tipe primitif maupun non-primitif. Contohnya bisa dilihat pada kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> text </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> text</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Trait" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcMAAABtCAIAAABShZ2jAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4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VnwYGzCsoaXfGGXFo8RLd1Ig3U5qtLZBznZOfdih91iKoJatiijromqkUiaQ3sP7URjzFy7NOsGslHbSvmy0dP7s0GTA3Bqou9+ijUp8Ulp7ViDcXn40skCvznLWZDVlLlnv0fcWm2mcMnOa+6A08/CU27A6eSm367jSgpNdNMjd6mF4YV73WZ1lr4fXWPTz5ZNUFUNLbJfoiXh+fbqikZ7AWvup8AqCk5yIe3W8oo2J0v195uoR8JjMQPDYPKCkAAEoKAICSAgAASgoAgJICAKCkAAAoKQAAoKQAACgpAABKCgCAkgIAwCJK+t+PX79+/fz+edzw+fvPXwM//qMaAQAlravoj+/vyjkp6buOHn8c/hpKLAAASprraKeTnyMlzYSWsBQAUNIqKCkAwFpKyuAeAOAkJe2WnYhHAQAlnauknYwSjgIAzFVSZBQAwK+kwYOjPT+/D4+XxhsRVQBASQEAACUFAEBJAQBQUgAAlBQAAFBSAACUFADgWpX0+Gp98G7o4Z/Ot0Sn51GDHeRG99kBAG5MSSfpzHZwHQUlBYBrUNJR8N5FbXiXaUMlFWcHALg4JTXlbXxndJRD85skPiUNXkJFNAHgFpT0qHaTt0ng+ZxaRzmUNNyFoTwA3EpMmvx4F9JA/OLBeF1JE+v95vkDAIArUNLMNKpZSatBLADADSipqX3NMSlfhwKAmxzdlyY3HfOk4Reh7O/vAQBctZLeJ7bQ49edI0bNTTfeR2v3xKMAcO1KCgAAKCkAAEoKAICSAgCgpAAAgJICAKCkAAAoKQAASgoAACgpAABKCgCAkgIAXAf/A/sstK3qbfb1AAAAAElFTkSuQmCC" width="451" height="109" class="img_ev3q"></p><p>Dua variabel di atas sukses di-print tanpa error, karena tipe data <code>i32</code> dan <code>String</code> <em>by default</em> sudah implement trait <code>std::fmt::Debug</code>.</p><blockquote><p>Jika tertarik untuk pengecekan lebih lanjut, silakan lihat di halaman dokumentasi tipe data <a href="https://doc.rust-lang.org/std/primitive.i32.html" target="_blank" rel="noopener noreferrer">i32</a> dan <a href="https://doc.rust-lang.org/std/string/struct.String.html" target="_blank" rel="noopener noreferrer">String</a>.</p></blockquote><p>Bagaimana dengan custom type yang kita buat sendiri? Misalnya struct.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> circle_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">raidus</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> circle_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> raidus</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Trait" src="/assets/images/traits-2-7c5e41bf2bd31dba0f78fc7afd81c7ba.png" width="841" height="512" class="img_ev3q"></p><p>Hasilnya error, karena struct <code>Circle</code> yang dibuat tidak implement trait <code>std::fmt::Debug</code>.</p><p>Solusi agar tidak error adalah dengan mengimplementasikan trait <code>std::fmt::Debug</code> ke tipe <code>Circle</code>, dengan itu semua data bertipe <code>Circle</code> akan bisa di-print menggunakan formatted print <code>{:?}</code>.</p><blockquote><p>Selain via implementasi trait, tipe data custom bisa di-print dengan cara menambahkan atribut <code>#[derive(Debug)]</code> pada definisi tipe data-nya. Namun kita tidak membahas itu pada chapter ini.</p></blockquote><p>Langkah pertama untuk implementasi trait adalah mencari tau terlebih dahulu spesifikasi trait yang ingin diimplementasikan. Trait <code>std::fmt::Debug</code> adalah traits milik Rust standard library, maka harusnya spesifikasi bisa dilihat di dokumentasi Rust.</p><blockquote><p><a href="https://doc.rust-lang.org/std/fmt/trait.Debug.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/fmt/trait.Debug.html</a></p></blockquote><p>Pada URL dokumentasi bisa dilihat kalau trait <code>Debug</code> memiliki struktur kurang lebih seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">trait</span><span class="token plain"> </span><span class="token type-definition class-name">Debug</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">fmt</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token class-name">Formatter</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'_</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Trait <code>Debug</code> mempunyai satu spesifikasi method, bernama <code>fmt</code> yang detail strukturnya bisa dilihat di atas.</p><p>Kita akan implement trait <code>Debug</code> ini ke tipe <code>Circle</code>, maka wajib hukumnya untuk menuliskan implementasi method sesuai dengan yang ada di trait <code>Debug</code>.</p><p>Di bawah ini adalah contoh cara implementasi trait.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> raidus</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Debug</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">fmt</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Formatter</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'_</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Result</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">write!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">f</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Circle radius: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">raidus</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> circle_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">raidus</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> circle_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ketika program di-run, hasilnya sukses tanpa error. Artinya implementasi trait <code>Debug</code> pada tipe data struct <code>Circle</code> adalah sukses.</p><p><img loading="lazy" alt="Trait" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAABzCAIAAAB8e26BAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB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ElHnhV+KKOLWvHTNVj+yjrC1K/A7SwIIwdblbP2Z8u1HnZL57nmQV72AtwV9kzmbAuawdTYT+5A3ITu3zhCCrTPZauhR29/wLFeVreLHIoc12JquZ0wGY9E7O68uI4QOzdZq5BZga40oLs8CwJcQL2PZNdgq859TTdiKEGwtoZJi54eLCxlOVuBs6RaETyNAHi/Gx439tjpbz7/2kapaZigf4Qrcy8riX9CKEGw1eNV32tP7NN4aaZr6fNtJ7S7v6cfXBNKHDL4P3Byq/uPbc4Ja6cPmn9+/nXfPU2ZkDLE1/uQDQugtshUhhBBsRQgh2IoQQrAVIYQQbEUIIdiKEEKwFSGEEGxFCCHYihBCsBUhhGArQggh2IoQQrAVIYRgK0IIIdiKEEKH1P/rrMjnM/fMegAAAABJRU5ErkJggg==" width="457" height="115" class="img_ev3q"></p><p>Cara implementasi trait ke struct <code>Circle</code> memang step-nya agak panjang, tapi penulis yakin lama-kelamaan pasti terbiasa. Ok, sekarang kita bahas satu per satu kode di atas.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-struct-circle">◉ Struct <code>Circle</code><a class="hash-link" href="#-struct-circle" title="Direct link to heading">​</a></h3><p>Block kode definisi struct <code>Circle</code> cukup straightforward, isinya hanya 1 property bernama <code>radius</code> bertipe <code>i32</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-block-kode-impl-x-for-y">◉ Block kode <code>impl X for Y</code><a class="hash-link" href="#-block-kode-impl-x-for-y" title="Direct link to heading">​</a></h3><p>Notasi penulisan implementasi trait adalah <code>impl X for Y</code>, yang mana <code>X</code> adalah trait yang ingin diimplementasikan dan <code>Y</code> adalah tipe data tujuan implementasi.</p><p>Pada contoh di atas, trait <code>Debug</code> diimplementasikan ke custom type struct <code>Circle</code>. Maka statement-nya adalah:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Debug</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-block-kode-method-dalam-impl">◉ Block kode method dalam <code>impl</code><a class="hash-link" href="#-block-kode-method-dalam-impl" title="Direct link to heading">​</a></h3><p>Block kode <code>impl</code> harus diikuti dengan implementasi method. Pada contoh ini, method <code>fmt</code> milik trait <code>Debug</code> wajib untuk diimplementasikan. Spesifikasi method ini adalah <code>fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error></code> (lebih jelasnya silakan lihat dokumentasi).</p><p>Silakan copy method tersebut kemudian paste ke dalam block kode <code>impl</code> yang sudah ditulis, kemudian tambahkan block kurung kurawal.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Debug</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">fmt</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Formatter</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'_</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Result</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kemudian tulis implementasi method <code>fmt</code> dalam block method. Tulis statement macro <code>write</code> untuk data string (yang ingin di-print) dengan tujuan adalah variabel <code>f</code>.</p><p>Di contoh, format <code>Circle radius: {}</code> digunakan. Dengan ini nantinya saat printing data, yang muncul adalah text <code>Circle radius: {}</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Debug</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">fmt</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Formatter</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'_</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Result</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">write!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">f</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Circle radius: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">raidus</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Tips untuk pengguna visual studio code dengan rust-analyzer extension ter-install, setelah selesai menulis block kode <code>impl</code>, cukup jalankan <code>ctrl+space</code> atau <code>cmd+space</code> untuk men-trigger autocomplete suggestion. Kemudian klik opsi method yang ada di situ, maka kode implementasi method langsung muncul dengan sendirinya.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-macro-write">◉ Macro <code>write</code><a class="hash-link" href="#-macro-write" title="Direct link to heading">​</a></h3><p>Macro ini digunakan untuk menuliskan sebuah data ke object tertentu. Pada contoh kita gunakan untuk menulis string <code>Circle radius: {}</code> ke variabel <code>f</code> yang bertipe <code>std::fmt::Formatter<'_></code>.</p><p>Notasi penulisan macro <code>write</code>:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// notasi penulisan</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">write!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">variabel_tujuan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_yang_ingin_di_print</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">...</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// contoh penerapan</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">write!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">f</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Circle radius: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">raidus</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-print-data-menggunakan-formatted-print-">◉ Print data menggunakan formatted print <code>{:?}</code><a class="hash-link" href="#-print-data-menggunakan-formatted-print-" title="Direct link to heading">​</a></h3><p>Step terakhir adalah print variabel <code>circle</code> menggunakan macro <code>println</code>. Hasilnya sukses, tidak error seperti sebelumnya.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-print-data-menggunakan-formatted-print--1">◉ Print data menggunakan formatted print <code>{}</code><a class="hash-link" href="#-print-data-menggunakan-formatted-print--1" title="Direct link to heading">​</a></h3><p>Coba tambahkan statement <code>println</code>, tetapi kali ini gunakan formatted print <code>{}</code>, apakah hasilnya juga tidak error?</p><p><img loading="lazy" alt="Trait" src="/assets/images/traits-4-fe5c6a716894397c8088bae54e7194f9.png" width="849" height="309" class="img_ev3q"></p><p>Hasilnya error, karena trait <code>std::fmt::Debug</code> hanya berguna untuk formatted print <code>{:?}</code>. Agar data bertipe <code>Circle</code> bisa di-print menggunakan formatted print <code>{}</code> maka trait <code>std::fmt::Display</code> harus di-implementasikan juga.</p><p>Ubah kode dengan menambahkan implementasi trait <code>Display</code>. Hasilnya kurang lebih seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> raidus</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Debug</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">fmt</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Formatter</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'_</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Result</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">write!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">f</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Circle radius: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">raidus</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Display</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">fmt</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Formatter</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'_</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Result</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">write!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">f</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Circle radius: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">raidus</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><ul><li>Link dokumentasi trait <code>Debug</code> <a href="https://doc.rust-lang.org/std/fmt/trait.Debug.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/fmt/trait.Debug.html</a></li><li>Link dokumentasi trait <code>Display</code> <a href="https://doc.rust-lang.org/std/fmt/trait.Display.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/fmt/trait.Display.html</a></li></ul></blockquote><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/traits" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../traits</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-work-in-progress">◉ Work in progress<a class="hash-link" href="#-work-in-progress" title="Direct link to heading">​</a></h3><ul><li>Pembahasan tentang trait bounds untuk implementasi method kondisional</li><li>Pembahasan tentang trait overloading</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch10-02-traits.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch10-02-traits.html</a></li><li><a href="https://doc.rust-lang.org/std/fmt/trait.Debug.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/fmt/trait.Debug.html</a></li><li><a href="https://doc.rust-lang.org/std/fmt/trait.Display.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/fmt/trait.Display.html</a></li><li><a href="https://doc.rust-lang.org/std/string/struct.String.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/string/struct.String.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/borrowing"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.35. Borrowing</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/advanced-traits"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.37. Traits ➜ Advanced</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a361-konsep-traits" class="table-of-contents__link toc-highlight">A.36.1. Konsep traits</a><ul><li><a href="#-jenis-traits-berdasarkan-tempat-dideklarasikannya" class="table-of-contents__link toc-highlight">◉ Jenis traits berdasarkan tempat dideklarasikannya</a></li></ul></li><li><a href="#a362-implementasi-trait" class="table-of-contents__link toc-highlight">A.36.2. Implementasi trait</a><ul><li><a href="#-struct-circle" class="table-of-contents__link toc-highlight">◉ Struct <code>Circle</code></a></li><li><a href="#-block-kode-impl-x-for-y" class="table-of-contents__link toc-highlight">◉ Block kode <code>impl X for Y</code></a></li><li><a href="#-block-kode-method-dalam-impl" class="table-of-contents__link toc-highlight">◉ Block kode method dalam <code>impl</code></a></li><li><a href="#-macro-write" class="table-of-contents__link toc-highlight">◉ Macro <code>write</code></a></li><li><a href="#-print-data-menggunakan-formatted-print-" class="table-of-contents__link toc-highlight">◉ Print data menggunakan formatted print <code>{:?}</code></a></li><li><a href="#-print-data-menggunakan-formatted-print--1" class="table-of-contents__link toc-highlight">◉ Print data menggunakan formatted print <code>{}</code></a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-work-in-progress" class="table-of-contents__link toc-highlight">◉ Work in progress</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.36. Traits</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.36. Traits</h1></header><p>Trait jika diartikan dalam Bahasa Indonesia artinya adalah sifat. Chapter ini akan membahas tentang apa itu trait, apa kegunaannya, dan bagaimana cara penerapannya di Rust programming.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a361-konsep-traits">A.36.1. Konsep traits<a class="hash-link" href="#a361-konsep-traits" title="Direct link to heading">​</a></h2><p>Di Rust kita bisa mendefinisikan trait/sifat, isinya adalah definisi header method yang bisa di-share ke banyak tipe data.</p><p>Trait isinya hanya definisi header method (bisa diartikan method tanpa isi). Ketika ada tipe data yang meng-implement suatu trait, maka tipe tersebut wajib untuk menuliskan implementasi method sesuai dengan header method yang ada di trait.</p><blockquote><p>Pada bahasa pemrograman lain, contohnya Java, konsep trait mirip dengan <code>interface</code></p></blockquote><p>Ada dua bagian penting dalam trait yang harus diketahui:</p><ol><li>Deklarasi trait</li><li>Implementasi trait ke tipe data</li></ol><p>Perihal point pertama, intinya kita bisa menciptakan trait sesuai kebutuhan. Terlepas dari itu, Rust juga menyediakan cukup banyak traits yang di-implement ke banyak tipe data yang ada di Rust standard library. Beberapa di antaranya:</p><ul><li>Trait <code>std::fmt::Debug</code>, digunakan agar data bisa di-print menggunakan formatted print <code>{:?}</code>.</li><li>Trait <code>std::iter::Enumerate</code>, digunakan agar data bisa di-iterasi menggunakan keyword <code>for</code>.</li><li>Trait <code>std::ops::Add</code>, di-implementasikan agar data bisa digunakan pada operasi aritmatik penambahan <code>+</code>.</li></ul><p>Ok, biar lebih jelas, mari lanjut pembelajaran menggunakan contoh. Kita mulai dengan pembahasan tentang cara implementasi trait. Contoh yang digunakan adalah implementasi salah satu trait milik Rust standard library, yaitu trait <code>std::fmt::Debug</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-jenis-traits-berdasarkan-tempat-dideklarasikannya">◉ Jenis traits berdasarkan tempat dideklarasikannya<a class="hash-link" href="#-jenis-traits-berdasarkan-tempat-dideklarasikannya" title="Direct link to heading">​</a></h3><p>Berdasarkan tempat dimana traits dibuat, ada 2 jenis traits:</p><ul><li><p><strong>External traits</strong> (atau foreign traits).</p><p> Yaitu traits yang tempat dideklarasikannya berada di luar create kode yang ditulis. Misalnya, trait <code>std::fmt::Debug</code> dan <code>std::ops::Add</code>, keduanya merupakan external traits yang berada di crate <code>std</code> atau crate Rust Standard Library.</p><p> Pada case yang berhubungan dengan external traits, kita programmer umumnya hanya fokus ke implementasi saya, bagaimana cara memanfaatkan dan menggunakan external traits yang sudah ada ke dalam kode yang ditulis.</p></li><li><p><strong>Local traits</strong>.</p><p> Adalah traits yang kita ciptakan di crate yang berada di dalam package/project yang sedang kita kerjakan. </p></li></ul><p>Chapter ini fokusnya adalah pembahasan tentang dasar implementasi <strong>external traits</strong> dan cara kerjanya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a362-implementasi-trait">A.36.2. Implementasi trait<a class="hash-link" href="#a362-implementasi-trait" title="Direct link to heading">​</a></h2><p>Kita pilih trait <code>std::fmt::Debug</code> milik Rust standard library untuk belajar cara implementasi trait pada tipe data.</p><p>Kegunaan dari trait ini adalah: jika di-implement ke tipe data tertentu maka data dengan tipe tersebut bisa di-print via macro <code>println</code> atau macro printing lainnya, dengan menggunakan formatted print <code>{:?}</code>.</p><p>Trait <code>Debug</code> ini diimplementasikan ke pada banyak tipe data yang di Rust standard library, baik itu tipe primitif maupun non-primitif. Contohnya bisa dilihat pada kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> text </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> text</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="Trait" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcMAAABtCAIAAABShZ2jAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIH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AAEoKAICSAgAASgoAgJICAKCkAAAoKQAAoKQAACgpAABKCgCAkgIAwCJK+t+PX79+/fz+edzw+fvPXwM//qMaAQAlravoj+/vyjkp6buOHn8c/hpKLAAASprraKeTnyMlzYSWsBQAUNIqKCkAwFpKyuAeAOAkJe2WnYhHAQAlnauknYwSjgIAzFVSZBQAwK+kwYOjPT+/D4+XxhsRVQBASQEAACUFAEBJAQBQUgAAlBQAAFBSAACUFADgWpX0+Gp98G7o4Z/Ot0Sn51GDHeRG99kBAG5MSSfpzHZwHQUlBYBrUNJR8N5FbXiXaUMlFWcHALg4JTXlbXxndJRD85skPiUNXkJFNAHgFpT0qHaTt0ng+ZxaRzmUNNyFoTwA3EpMmvx4F9JA/OLBeF1JE+v95vkDAIArUNLMNKpZSatBLADADSipqX3NMSlfhwKAmxzdlyY3HfOk4Reh7O/vAQBctZLeJ7bQ49edI0bNTTfeR2v3xKMAcO1KCgAAKCkAAEoKAICSAgCgpAAAgJICAKCkAAAoKQAASgoAACgpAABKCgCAkgIAXAf/A/sstK3qbfb1AAAAAElFTkSuQmCC" width="451" height="109" class="img_CujE"></p><p>Dua variabel di atas sukses di-print tanpa error, karena tipe data <code>i32</code> dan <code>String</code> <em>by default</em> sudah implement trait <code>std::fmt::Debug</code>.</p><blockquote><p>Jika tertarik untuk pengecekan lebih lanjut, silakan lihat di halaman dokumentasi tipe data <a href="https://doc.rust-lang.org/std/primitive.i32.html" target="_blank" rel="noopener noreferrer">i32</a> dan <a href="https://doc.rust-lang.org/std/string/struct.String.html" target="_blank" rel="noopener noreferrer">String</a>.</p></blockquote><p>Bagaimana dengan custom type yang kita buat sendiri? Misalnya struct.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> circle_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">raidus</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> circle_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> raidus</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Trait" src="/assets/images/traits-2-7c5e41bf2bd31dba0f78fc7afd81c7ba.png" width="841" height="512" class="img_CujE"></p><p>Hasilnya error, karena struct <code>Circle</code> yang dibuat tidak implement trait <code>std::fmt::Debug</code>.</p><p>Solusi agar tidak error adalah dengan mengimplementasikan trait <code>std::fmt::Debug</code> ke tipe <code>Circle</code>, dengan itu semua data bertipe <code>Circle</code> akan bisa di-print menggunakan formatted print <code>{:?}</code>.</p><blockquote><p>Selain via implementasi trait, tipe data custom bisa di-print dengan cara menambahkan atribut <code>#[derive(Debug)]</code> pada definisi tipe data-nya. Namun kita tidak membahas itu pada chapter ini.</p></blockquote><p>Langkah pertama untuk implementasi trait adalah mencari tau terlebih dahulu spesifikasi trait yang ingin diimplementasikan. Trait <code>std::fmt::Debug</code> adalah traits milik Rust standard library, maka harusnya spesifikasi bisa dilihat di dokumentasi Rust.</p><blockquote><p><a href="https://doc.rust-lang.org/std/fmt/trait.Debug.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/fmt/trait.Debug.html</a></p></blockquote><p>Pada URL dokumentasi bisa dilihat kalau trait <code>Debug</code> memiliki struktur kurang lebih seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">trait</span><span class="token plain"> </span><span class="token type-definition class-name">Debug</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">fmt</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token class-name">Formatter</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'_</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">Result</span><span class="token operator" style="color:#393A34"><</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Trait <code>Debug</code> mempunyai satu spesifikasi method, bernama <code>fmt</code> yang detail strukturnya bisa dilihat di atas.</p><p>Kita akan implement trait <code>Debug</code> ini ke tipe <code>Circle</code>, maka wajib hukumnya untuk menuliskan implementasi method sesuai dengan yang ada di trait <code>Debug</code>.</p><p>Di bawah ini adalah contoh cara implementasi trait.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> raidus</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Debug</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">fmt</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Formatter</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'_</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Result</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">write!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">f</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Circle radius: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">raidus</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> circle_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">raidus</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> circle_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ketika program di-run, hasilnya sukses tanpa error. Artinya implementasi trait <code>Debug</code> pada tipe data struct <code>Circle</code> adalah sukses.</p><p><img loading="lazy" alt="Trait" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAABzCAIAAAB8e26BAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3R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NKHDL4P3Byq/uPbc4Ja6cPmn9+/nXfPU2ZkDLE1/uQDQugtshUhhBBsRQgh2IoQQrAVIYQQbEUIIdiKEEKwFSGEEGxFCCHYihBCsBUhhGArQggh2IoQQrAVIYRgK0IIIdiKEEKH1P/rrMjnM/fMegAAAABJRU5ErkJggg==" width="457" height="115" class="img_CujE"></p><p>Cara implementasi trait ke struct <code>Circle</code> memang step-nya agak panjang, tapi penulis yakin lama-kelamaan pasti terbiasa. Ok, sekarang kita bahas satu per satu kode di atas.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-struct-circle">◉ Struct <code>Circle</code><a class="hash-link" href="#-struct-circle" title="Direct link to heading">​</a></h3><p>Block kode definisi struct <code>Circle</code> cukup straightforward, isinya hanya 1 property bernama <code>radius</code> bertipe <code>i32</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-block-kode-impl-x-for-y">◉ Block kode <code>impl X for Y</code><a class="hash-link" href="#-block-kode-impl-x-for-y" title="Direct link to heading">​</a></h3><p>Notasi penulisan implementasi trait adalah <code>impl X for Y</code>, yang mana <code>X</code> adalah trait yang ingin diimplementasikan dan <code>Y</code> adalah tipe data tujuan implementasi.</p><p>Pada contoh di atas, trait <code>Debug</code> diimplementasikan ke custom type struct <code>Circle</code>. Maka statement-nya adalah:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Debug</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-block-kode-method-dalam-impl">◉ Block kode method dalam <code>impl</code><a class="hash-link" href="#-block-kode-method-dalam-impl" title="Direct link to heading">​</a></h3><p>Block kode <code>impl</code> harus diikuti dengan implementasi method. Pada contoh ini, method <code>fmt</code> milik trait <code>Debug</code> wajib untuk diimplementasikan. Spesifikasi method ini adalah <code>fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error></code> (lebih jelasnya silakan lihat dokumentasi).</p><p>Silakan copy method tersebut kemudian paste ke dalam block kode <code>impl</code> yang sudah ditulis, kemudian tambahkan block kurung kurawal.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Debug</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">fmt</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Formatter</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'_</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Result</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Kemudian tulis implementasi method <code>fmt</code> dalam block method. Tulis statement macro <code>write</code> untuk data string (yang ingin di-print) dengan tujuan adalah variabel <code>f</code>.</p><p>Di contoh, format <code>Circle radius: {}</code> digunakan. Dengan ini nantinya saat printing data, yang muncul adalah text <code>Circle radius: {}</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Debug</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">fmt</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Formatter</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'_</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Result</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">write!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">f</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Circle radius: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">raidus</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Tips untuk pengguna visual studio code dengan rust-analyzer extension ter-install, setelah selesai menulis block kode <code>impl</code>, cukup jalankan <code>ctrl+space</code> atau <code>cmd+space</code> untuk men-trigger autocomplete suggestion. Kemudian klik opsi method yang ada di situ, maka kode implementasi method langsung muncul dengan sendirinya.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-macro-write">◉ Macro <code>write</code><a class="hash-link" href="#-macro-write" title="Direct link to heading">​</a></h3><p>Macro ini digunakan untuk menuliskan sebuah data ke object tertentu. Pada contoh kita gunakan untuk menulis string <code>Circle radius: {}</code> ke variabel <code>f</code> yang bertipe <code>std::fmt::Formatter<'_></code>.</p><p>Notasi penulisan macro <code>write</code>:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// notasi penulisan</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">write!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">variabel_tujuan</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_yang_ingin_di_print</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> arg2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">...</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// contoh penerapan</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">write!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">f</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Circle radius: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">raidus</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-print-data-menggunakan-formatted-print-">◉ Print data menggunakan formatted print <code>{:?}</code><a class="hash-link" href="#-print-data-menggunakan-formatted-print-" title="Direct link to heading">​</a></h3><p>Step terakhir adalah print variabel <code>circle</code> menggunakan macro <code>println</code>. Hasilnya sukses, tidak error seperti sebelumnya.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-print-data-menggunakan-formatted-print--1">◉ Print data menggunakan formatted print <code>{}</code><a class="hash-link" href="#-print-data-menggunakan-formatted-print--1" title="Direct link to heading">​</a></h3><p>Coba tambahkan statement <code>println</code>, tetapi kali ini gunakan formatted print <code>{}</code>, apakah hasilnya juga tidak error?</p><p><img loading="lazy" alt="Trait" src="/assets/images/traits-4-fe5c6a716894397c8088bae54e7194f9.png" width="849" height="309" class="img_CujE"></p><p>Hasilnya error, karena trait <code>std::fmt::Debug</code> hanya berguna untuk formatted print <code>{:?}</code>. Agar data bertipe <code>Circle</code> bisa di-print menggunakan formatted print <code>{}</code> maka trait <code>std::fmt::Display</code> harus di-implementasikan juga.</p><p>Ubah kode dengan menambahkan implementasi trait <code>Display</code>. Hasilnya kurang lebih seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> raidus</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Debug</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">fmt</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Formatter</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'_</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Result</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">write!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">f</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Circle radius: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">raidus</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">impl</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Display</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> </span><span class="token class-name">Circle</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">fmt</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> f</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Formatter</span><span class="token operator" style="color:#393A34"><</span><span class="token lifetime-annotation symbol" style="color:#36acaa">'_</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">fmt</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Result</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">write!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">f</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Circle radius: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">raidus</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><ul><li>Link dokumentasi trait <code>Debug</code> <a href="https://doc.rust-lang.org/std/fmt/trait.Debug.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/fmt/trait.Debug.html</a></li><li>Link dokumentasi trait <code>Display</code> <a href="https://doc.rust-lang.org/std/fmt/trait.Display.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/fmt/trait.Display.html</a></li></ul></blockquote><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/traits" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../traits</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-work-in-progress">◉ Work in progress<a class="hash-link" href="#-work-in-progress" title="Direct link to heading">​</a></h3><ul><li>Pembahasan tentang trait bounds untuk implementasi method kondisional</li><li>Pembahasan tentang trait overloading</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch10-02-traits.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch10-02-traits.html</a></li><li><a href="https://doc.rust-lang.org/std/fmt/trait.Debug.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/fmt/trait.Debug.html</a></li><li><a href="https://doc.rust-lang.org/std/fmt/trait.Display.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/fmt/trait.Display.html</a></li><li><a href="https://doc.rust-lang.org/std/string/struct.String.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/string/struct.String.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/borrowing"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.35. Borrowing</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/advanced-traits"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.37. Traits ➜ Advanced</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a361-konsep-traits" class="table-of-contents__link toc-highlight">A.36.1. Konsep traits</a><ul><li><a href="#-jenis-traits-berdasarkan-tempat-dideklarasikannya" class="table-of-contents__link toc-highlight">◉ Jenis traits berdasarkan tempat dideklarasikannya</a></li></ul></li><li><a href="#a362-implementasi-trait" class="table-of-contents__link toc-highlight">A.36.2. Implementasi trait</a><ul><li><a href="#-struct-circle" class="table-of-contents__link toc-highlight">◉ Struct <code>Circle</code></a></li><li><a href="#-block-kode-impl-x-for-y" class="table-of-contents__link toc-highlight">◉ Block kode <code>impl X for Y</code></a></li><li><a href="#-block-kode-method-dalam-impl" class="table-of-contents__link toc-highlight">◉ Block kode method dalam <code>impl</code></a></li><li><a href="#-macro-write" class="table-of-contents__link toc-highlight">◉ Macro <code>write</code></a></li><li><a href="#-print-data-menggunakan-formatted-print-" class="table-of-contents__link toc-highlight">◉ Print data menggunakan formatted print <code>{:?}</code></a></li><li><a href="#-print-data-menggunakan-formatted-print--1" class="table-of-contents__link toc-highlight">◉ Print data menggunakan formatted print <code>{}</code></a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-work-in-progress" class="table-of-contents__link toc-highlight">◉ Work in progress</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/tuple.html b/basic/tuple.html index c98021d9..3223afb6 100644 --- a/basic/tuple.html +++ b/basic/tuple.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tuple/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tuple/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.15. Tipe Data ➜ Tuple","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tuple/#webpage"},"wordCount":311,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tuple/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tuple/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/tuple","name":"A.15. Tipe Data ➜ Tuple","description":"Pada chapter ini kita akan membahas tentang tipe data kolektif bernama Tuple.","datePublished":"2024-08-01T10:17:31.143Z","dateModified":"2024-08-01T10:17:31.143Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tuple/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/tuple"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tuple/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.15. Tipe Data ➜ Tuple","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tuple/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tuple/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.15. Tipe Data ➜ Tuple","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tuple/#webpage"},"wordCount":311,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tuple/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tuple/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/tuple","name":"A.15. Tipe Data ➜ Tuple","description":"Pada chapter ini kita akan membahas tentang tipe data kolektif bernama Tuple.","datePublished":"2024-08-30T07:44:51.270Z","dateModified":"2024-08-30T07:44:51.270Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/tuple/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/tuple"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/tuple/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.15. Tipe Data ➜ Tuple","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.15. Tuple</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.15. Tipe Data ➜ Tuple</h1></header><p>Pada chapter ini kita akan membahas tentang tipe data kolektif bernama Tuple.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a151-tipe-data-tuple">A.15.1. Tipe data tuple<a class="hash-link" href="#a151-tipe-data-tuple" title="Direct link to heading">​</a></h2><p>Tuple merupakan tipe data yang isinya koleksi dari banyak data atau value, yang bisa jadi tiap value tersebut tipe datanya berbeda satu sama lain. Tuple biasa digunakan untuk menampung data yang <em>heterogeneous</em> atau campuran.</p><blockquote><p>Tipe ini tidak diciptakan sebagai pengganti array.</p><p>Cukup mudah untuk mengidentifikasi kapan harus menggunakan tuple, contohnya: jika ada kebutuhan data harus bisa di-iterate, atau data memiliki pattern yg pasti seperti size-nya fixed, atau tipe datanya <em>homogeneous</em> atau sejenis, ... maka baiknya gunakan tipe data array atau slice.</p></blockquote><p>Tuple dibuat dengan notasi penulisan diapit tanda <code>(</code> dan <code>)</code>. Contoh deklarasi tuple:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> tuple_a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"jason"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">27</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"racing"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"working out"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"tuple_a: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_a</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Variabel <code>tuple_a</code> di atas bertipe data tuple, dengan tipe data spesifik per-elemennya bervariasi, ada string, numerik, array <code>[&str; 2]</code>, dan boolean.</p><p>Untuk menampilkan nilai per-elemen, gunakan notasi <code>.N</code> yang mana <code>N</code> merupakan indeks elemen. Contohnya seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"index 0: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_a</span><span class="token number" style="color:#36acaa">.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"index 1: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_a</span><span class="token number" style="color:#36acaa">.1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"index 2: {:?} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_a</span><span class="token number" style="color:#36acaa">.2</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_a</span><span class="token number" style="color:#36acaa">.2</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"index 3: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_a</span><span class="token number" style="color:#36acaa">.3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="tuple" src="/assets/images/tuple-1-3234f50043ed15a37da7ad04884b7f8d.png" width="811" height="433" class="img_ev3q"></p><p>Data pada <code>tuple_a</code> indeks ke-2 bertipe slice, untuk mengakses tiap elemennya bisa menggunakan notasi pengaksesan indeks array/slice seperti biasa.</p><ul><li>Tuple <code>tuple_a.2</code> nilainya <code>["racing", "working out"]</code></li><li>Tuple <code>tuple_a.2[0]</code> nilainya <code>"racing"</code></li><li>Tuple <code>tuple_a.2[1]</code> nilainya <code>"working out"</code></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a152-mutable-tuple">A.15.2. Mutable tuple<a class="hash-link" href="#a152-mutable-tuple" title="Direct link to heading">​</a></h2><p>Cara untuk membuat tuple menjadi data yang mutable adalah dengan menambahkan <code>mut</code> pada saat deklarasi. Pada contoh berikut variabel <code>tuple_b</code> dideklarasikan sebagai mutable dengan teknik <em>manifest typing</em>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> tuple_b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"default"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">""</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">tuple_b</span><span class="token number" style="color:#36acaa">.0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">tuple_b</span><span class="token number" style="color:#36acaa">.1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">18</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">tuple_b</span><span class="token number" style="color:#36acaa">.2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"gaming"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"adventuring"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">tuple_b</span><span class="token number" style="color:#36acaa">.3</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"tuple_b: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_b</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="tuple" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcwAAAB7CAIAAAB2ASeoAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5v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JNvY+3bzablcq5VBvdPoB/rygdzfSqopR2N95Ok8bNVqW+rpj2H3aXk0LXB+0mnL0xv7r1pb7oO4/fLBWk0x1DqoyJtPAAD2a/JmWbXekuW+mMRPNj1JN1ST83QnGkfNJ6LIWnhRMVoXy7VauS9XHu89zlZqo6mX0XdcefKXcO9IqhmneH258nhvQtdhoxXcELsG41cTLTzaQ/Ryia2DvdEBpHuzi8l9cdkIzHV4QXn9aa+RSyq9mqjrNGv5zWyidXQl9hZ42sLlhdDusMibtjZdNdSlVV9Lz5kn1xYuS7MH52zvhoJw3ZVknDZCLufZ+pN7Q2EomNaabFhQ7plPdvONK9JAGsrWRn83g/qep/nJYn4zmwhoSufJUBCuu7pM3kaz9qfyzmalfGUaM4QjWctOaQ1ftuqPLFyh+2A40FvF8eoyN56PbTYzQ9cPL67T04bGxTuV2tqrkJSFj4CCLEEQBAHw5WkXEARBTBUKsgRBEAFCQZYgCCJAKMgSBEEECAVZgiCIAKEgSxAEESAUZAmCIAKEgixBEESAUJAlCIIIEAqyBEEQAUJBliAIIkAoyBIEQQQIBVmCIIgAoSBLEAQRIBRkCYIgAoSCLEEQRID8P2Gd6E6R7f/SAAAAAElFTkSuQmCC" width="460" height="123" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a153-notasi-deklarasi-tuple">A.15.3. Notasi deklarasi tuple<a class="hash-link" href="#a153-notasi-deklarasi-tuple" title="Direct link to heading">​</a></h2><p>Ada beberapa cara yang bisa digunakan dalam deklarasi tuple.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-type-inference">◉ Type inference<a class="hash-link" href="#-type-inference" title="Direct link to heading">​</a></h3><p>Cara pertama menggunakan teknik <em>type inference</em> seperti yang sudah dipraktikkan pada contoh pertama.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> tuple_a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"jason"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">27</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"racing"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"working out"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-manifest-typing">◉ Manifest typing<a class="hash-link" href="#-manifest-typing" title="Direct link to heading">​</a></h3><p>Bisa juga menggunakan teknik deklarasi <em>manifest typing</em>, biasanya diterapkan pada pembuatan mutable tuple dengan <em>predefined value</em> adalah nilai kosong seperti empty string, 0, dan lainnya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> tuple_b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">18</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"gaming"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"adventuring"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh lain:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> tuple_b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"default"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">""</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">tuple_b</span><span class="token number" style="color:#36acaa">.0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">tuple_b</span><span class="token number" style="color:#36acaa">.1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">18</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">tuple_b</span><span class="token number" style="color:#36acaa">.2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"gaming"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"adventuring"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">tuple_b</span><span class="token number" style="color:#36acaa">.3</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="tuple" src="/assets/images/tuple-3-3378d68b3ca9526a7b5cb148b01c8450.png" width="464" height="166" class="img_ev3q"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-packing-tuple">◉ Packing tuple<a class="hash-link" href="#-packing-tuple" title="Direct link to heading">​</a></h3><p>Adalah cara pembuatan tuple yang mana nilai elemenya bersumber dari variabel lain.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> name </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"grayson"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> age </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">29</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> hobbies </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"sleeping"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"parkour"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> tuple_c </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> hobbies</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"name : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_c</span><span class="token number" style="color:#36acaa">.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"age : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_c</span><span class="token number" style="color:#36acaa">.1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hobbies : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_c</span><span class="token number" style="color:#36acaa">.2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Istilah packing tuple bukan resmi dari official Rust. Istilah ini penulis buat sendiri.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-unpacking-tuple">◉ Unpacking tuple<a class="hash-link" href="#-unpacking-tuple" title="Direct link to heading">​</a></h3><p>Unpacking tuple adalah kebalikan dari packing tuple. Data tuple didistribusikan ke banyak variabel dalam 1 baris deklarasi.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> tuple_d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"stephanie"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">28</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"software engineering"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> hobbies</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> is_male</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> tuple_d</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"name : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"age : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hobbies : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> hobbies</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"is_male : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> is_male</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="tuple" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc8AAACmCAIAAAAzlpNaAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlL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4j2tkvdGefLa34aJdsE+zeW8SCIcNZL3NtF1Le/Wxjv2CUrh6qhUqztamktOIulanyuKC0tBJRuaRtFIwoVTWtpUTF9TFRYh1gS/IFj9WSddbviny3j9hpCe+StJ/sxcAZ4v1EzgUzwLXWAMNDBz1mRRt+ED8d5wAwGaCTAIhodrThZ8VPAFxc97GtsUse09HZ0Yb342ev7PS2B1wbrnW2BQCAwMBKAgAABAGyLQAABAGyLQAABIF/DbAx31ASCIONDYk7ZUG7BAB4F5m4vq0TUwkgGP1nRvl70i4BAN5NfGXbd0469B1U/gYATCmy2ba/8rfHNHu7WFprasuKEmlph5XUphIxZu2MeHZf+xLTeWk1cUZNZiCX+ihqAwCAdLZlZ9OGzLZMTkkq0UP1cK20uan/u7GRIdpQ6TNVNRWvHu9kyoLkZohSmy982N+pDLl07Hos30iOhp63hEts20fuJwDgnWHoPQmSIt+mRpZVK0sonu1EXjxbp7+aeFmg/C3tEhG52+7XTwDANWKou2TDinwLxLNdxeQlsYdG0iW27UH6CQCYNYbdkzCwyPduebtYGod49jD40vN2tf04MD8BALPHqJ5ukBH5ZhixeLbBUGriUi7ZMNs+DvFsAMC7guTYlhd7Hkbkeyezx4lny0uMj+Puk7xLfNuD8hMAMHtAAwwAAIIAOgkAABAEo31y1y703AW3jgAA1x6sJAAAQBBgJQEAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAILgfwCoSF56a7OxngAAAABJRU5ErkJggg==" width="463" height="166" class="img_ev3q"></p><blockquote><p>Pada bahasa lain teknik ini biasa disebut dengan destructuring assignment</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a154-tuple-">A.15.4. Tuple <code>()</code><a class="hash-link" href="#a154-tuple-" title="Direct link to heading">​</a></h2><p>Tuple bisa didefinisikan dengan tanpa isi dengan menggunakan <code>()</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> tuple_d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_d</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a155-tuple-structs">A.15.5. Tuple Structs<a class="hash-link" href="#a155-tuple-structs" title="Direct link to heading">​</a></h2><p>Pembahasan mengenai tuple structs dibahas pada chapter <a href="/basic/struct#a247-tuple-struct">Struct</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/tuple" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../tuple</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/std/primitive.tuple.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/primitive.tuple.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/primitives/tuples.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/primitives/tuples.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/slice"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.14. Slice (Basic)</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/vector"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.16. Vector</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a151-tipe-data-tuple" class="table-of-contents__link toc-highlight">A.15.1. Tipe data tuple</a></li><li><a href="#a152-mutable-tuple" class="table-of-contents__link toc-highlight">A.15.2. Mutable tuple</a></li><li><a href="#a153-notasi-deklarasi-tuple" class="table-of-contents__link toc-highlight">A.15.3. Notasi deklarasi tuple</a><ul><li><a href="#-type-inference" class="table-of-contents__link toc-highlight">◉ Type inference</a></li><li><a href="#-manifest-typing" class="table-of-contents__link toc-highlight">◉ Manifest typing</a></li><li><a href="#-packing-tuple" class="table-of-contents__link toc-highlight">◉ Packing tuple</a></li><li><a href="#-unpacking-tuple" class="table-of-contents__link toc-highlight">◉ Unpacking tuple</a></li></ul></li><li><a href="#a154-tuple-" class="table-of-contents__link toc-highlight">A.15.4. Tuple <code>()</code></a></li><li><a href="#a155-tuple-structs" class="table-of-contents__link toc-highlight">A.15.5. Tuple Structs</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.15. Tuple</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.15. Tipe Data ➜ Tuple</h1></header><p>Pada chapter ini kita akan membahas tentang tipe data kolektif bernama Tuple.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a151-tipe-data-tuple">A.15.1. Tipe data tuple<a class="hash-link" href="#a151-tipe-data-tuple" title="Direct link to heading">​</a></h2><p>Tuple merupakan tipe data yang isinya koleksi dari banyak data atau value, yang bisa jadi tiap value tersebut tipe datanya berbeda satu sama lain. Tuple biasa digunakan untuk menampung data yang <em>heterogeneous</em> atau campuran.</p><blockquote><p>Tipe ini tidak diciptakan sebagai pengganti array.</p><p>Cukup mudah untuk mengidentifikasi kapan harus menggunakan tuple, contohnya: jika ada kebutuhan data harus bisa di-iterate, atau data memiliki pattern yg pasti seperti size-nya fixed, atau tipe datanya <em>homogeneous</em> atau sejenis, ... maka baiknya gunakan tipe data array atau slice.</p></blockquote><p>Tuple dibuat dengan notasi penulisan diapit tanda <code>(</code> dan <code>)</code>. Contoh deklarasi tuple:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> tuple_a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"jason"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">27</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"racing"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"working out"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"tuple_a: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_a</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Variabel <code>tuple_a</code> di atas bertipe data tuple, dengan tipe data spesifik per-elemennya bervariasi, ada string, numerik, array <code>[&str; 2]</code>, dan boolean.</p><p>Untuk menampilkan nilai per-elemen, gunakan notasi <code>.N</code> yang mana <code>N</code> merupakan indeks elemen. Contohnya seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"index 0: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_a</span><span class="token number" style="color:#36acaa">.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"index 1: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_a</span><span class="token number" style="color:#36acaa">.1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"index 2: {:?} {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_a</span><span class="token number" style="color:#36acaa">.2</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_a</span><span class="token number" style="color:#36acaa">.2</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"index 3: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_a</span><span class="token number" style="color:#36acaa">.3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="tuple" src="/assets/images/tuple-1-3234f50043ed15a37da7ad04884b7f8d.png" width="811" height="433" class="img_CujE"></p><p>Data pada <code>tuple_a</code> indeks ke-2 bertipe slice, untuk mengakses tiap elemennya bisa menggunakan notasi pengaksesan indeks array/slice seperti biasa.</p><ul><li>Tuple <code>tuple_a.2</code> nilainya <code>["racing", "working out"]</code></li><li>Tuple <code>tuple_a.2[0]</code> nilainya <code>"racing"</code></li><li>Tuple <code>tuple_a.2[1]</code> nilainya <code>"working out"</code></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a152-mutable-tuple">A.15.2. Mutable tuple<a class="hash-link" href="#a152-mutable-tuple" title="Direct link to heading">​</a></h2><p>Cara untuk membuat tuple menjadi data yang mutable adalah dengan menambahkan <code>mut</code> pada saat deklarasi. Pada contoh berikut variabel <code>tuple_b</code> dideklarasikan sebagai mutable dengan teknik <em>manifest typing</em>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> tuple_b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"default"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">""</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">tuple_b</span><span class="token number" style="color:#36acaa">.0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">tuple_b</span><span class="token number" style="color:#36acaa">.1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">18</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">tuple_b</span><span class="token number" style="color:#36acaa">.2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"gaming"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"adventuring"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">tuple_b</span><span class="token number" style="color:#36acaa">.3</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"tuple_b: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_b</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="tuple" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcwAAAB7CAIAAAB2ASeoAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJs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cO9IqhmneH258nhvQtdhoxXcELsG41cTLTzaQ/Ryia2DvdEBpHuzi8l9cdkIzHV4QXn9aa+RSyq9mqjrNGv5zWyidXQl9hZ42sLlhdDusMibtjZdNdSlVV9Lz5kn1xYuS7MH52zvhoJw3ZVknDZCLufZ+pN7Q2EomNaabFhQ7plPdvONK9JAGsrWRn83g/qep/nJYn4zmwhoSufJUBCuu7pM3kaz9qfyzmalfGUaM4QjWctOaQ1ftuqPLFyh+2A40FvF8eoyN56PbTYzQ9cPL67T04bGxTuV2tqrkJSFj4CCLEEQBAHw5WkXEARBTBUKsgRBEAFCQZYgCCJAKMgSBEEECAVZgiCIAKEgSxAEESAUZAmCIAKEgixBEESAUJAlCIIIEAqyBEEQAUJBliAIIkAoyBIEQQQIBVmCIIgAoSBLEAQRIBRkCYIgAoSCLEEQRID8P2Gd6E6R7f/SAAAAAElFTkSuQmCC" width="460" height="123" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a153-notasi-deklarasi-tuple">A.15.3. Notasi deklarasi tuple<a class="hash-link" href="#a153-notasi-deklarasi-tuple" title="Direct link to heading">​</a></h2><p>Ada beberapa cara yang bisa digunakan dalam deklarasi tuple.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-type-inference">◉ Type inference<a class="hash-link" href="#-type-inference" title="Direct link to heading">​</a></h3><p>Cara pertama menggunakan teknik <em>type inference</em> seperti yang sudah dipraktikkan pada contoh pertama.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> tuple_a </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"jason"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">27</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"racing"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"working out"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-manifest-typing">◉ Manifest typing<a class="hash-link" href="#-manifest-typing" title="Direct link to heading">​</a></h3><p>Bisa juga menggunakan teknik deklarasi <em>manifest typing</em>, biasanya diterapkan pada pembuatan mutable tuple dengan <em>predefined value</em> adalah nilai kosong seperti empty string, 0, dan lainnya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> tuple_b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">18</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"gaming"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"adventuring"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh lain:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> tuple_b</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">bool</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"default"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">""</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">tuple_b</span><span class="token number" style="color:#36acaa">.0</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"damian"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">tuple_b</span><span class="token number" style="color:#36acaa">.1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">18</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">tuple_b</span><span class="token number" style="color:#36acaa">.2</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"gaming"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"adventuring"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">tuple_b</span><span class="token number" style="color:#36acaa">.3</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="tuple" src="/assets/images/tuple-3-3378d68b3ca9526a7b5cb148b01c8450.png" width="464" height="166" class="img_CujE"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-packing-tuple">◉ Packing tuple<a class="hash-link" href="#-packing-tuple" title="Direct link to heading">​</a></h3><p>Adalah cara pembuatan tuple yang mana nilai elemenya bersumber dari variabel lain.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> name </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"grayson"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> age </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">29</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> hobbies </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"sleeping"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"parkour"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> tuple_c </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> hobbies</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"name : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_c</span><span class="token number" style="color:#36acaa">.0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"age : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_c</span><span class="token number" style="color:#36acaa">.1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hobbies : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_c</span><span class="token number" style="color:#36acaa">.2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Istilah packing tuple bukan resmi dari official Rust. Istilah ini penulis buat sendiri.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-unpacking-tuple">◉ Unpacking tuple<a class="hash-link" href="#-unpacking-tuple" title="Direct link to heading">​</a></h3><p>Unpacking tuple adalah kebalikan dari packing tuple. Data tuple didistribusikan ke banyak variabel dalam 1 baris deklarasi.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> tuple_d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"stephanie"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">28</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"software engineering"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">name</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> hobbies</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> is_male</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> tuple_d</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"name : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"age : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> age</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hobbies : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> hobbies</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"is_male : {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> is_male</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="tuple" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc8AAACmCAIAAAAzlpNaAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NP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rThZ8VPAFxc97GtsUse09HZ0Yb342ev7PS2B1wbrnW2BQCAwMBKAgAABAGyLQAABAGyLQAABIF/DbAx31ASCIONDYk7ZUG7BAB4F5m4vq0TUwkgGP1nRvl70i4BAN5NfGXbd0469B1U/gYATCmy2ba/8rfHNHu7WFprasuKEmlph5XUphIxZu2MeHZf+xLTeWk1cUZNZiCX+ihqAwCAdLZlZ9OGzLZMTkkq0UP1cK20uan/u7GRIdpQ6TNVNRWvHu9kyoLkZohSmy982N+pDLl07Hos30iOhp63hEts20fuJwDgnWHoPQmSIt+mRpZVK0sonu1EXjxbp7+aeFmg/C3tEhG52+7XTwDANWKou2TDinwLxLNdxeQlsYdG0iW27UH6CQCYNYbdkzCwyPduebtYGod49jD40vN2tf04MD8BALPHqJ5ukBH5ZhixeLbBUGriUi7ZMNs+DvFsAMC7guTYlhd7Hkbkeyezx4lny0uMj+Puk7xLfNuD8hMAMHtAAwwAAIIAOgkAABAEo31y1y703AW3jgAA1x6sJAAAQBBgJQEAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAIIA2RYAAILgfwCoSF56a7OxngAAAABJRU5ErkJggg==" width="463" height="166" class="img_CujE"></p><blockquote><p>Pada bahasa lain teknik ini biasa disebut dengan destructuring assignment</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a154-tuple-">A.15.4. Tuple <code>()</code><a class="hash-link" href="#a154-tuple-" title="Direct link to heading">​</a></h2><p>Tuple bisa didefinisikan dengan tanpa isi dengan menggunakan <code>()</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> tuple_d </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> tuple_d</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a155-tuple-structs">A.15.5. Tuple Structs<a class="hash-link" href="#a155-tuple-structs" title="Direct link to heading">​</a></h2><p>Pembahasan mengenai tuple structs dibahas pada chapter <a href="/basic/struct#a247-tuple-struct">Struct</a>.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/tuple" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../tuple</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/std/primitive.tuple.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/primitive.tuple.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/primitives/tuples.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/primitives/tuples.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/slice"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.14. Slice (Basic)</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/vector"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.16. Vector</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a151-tipe-data-tuple" class="table-of-contents__link toc-highlight">A.15.1. Tipe data tuple</a></li><li><a href="#a152-mutable-tuple" class="table-of-contents__link toc-highlight">A.15.2. Mutable tuple</a></li><li><a href="#a153-notasi-deklarasi-tuple" class="table-of-contents__link toc-highlight">A.15.3. Notasi deklarasi tuple</a><ul><li><a href="#-type-inference" class="table-of-contents__link toc-highlight">◉ Type inference</a></li><li><a href="#-manifest-typing" class="table-of-contents__link toc-highlight">◉ Manifest typing</a></li><li><a href="#-packing-tuple" class="table-of-contents__link toc-highlight">◉ Packing tuple</a></li><li><a href="#-unpacking-tuple" class="table-of-contents__link toc-highlight">◉ Unpacking tuple</a></li></ul></li><li><a href="#a154-tuple-" class="table-of-contents__link toc-highlight">A.15.4. Tuple <code>()</code></a></li><li><a href="#a155-tuple-structs" class="table-of-contents__link toc-highlight">A.15.5. Tuple Structs</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/type-alias-casting.html b/basic/type-alias-casting.html index 305a46b5..d370d553 100644 --- a/basic/type-alias-casting.html +++ b/basic/type-alias-casting.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/type-alias-casting/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/type-alias-casting/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.27. Type Alias & Casting","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/type-alias-casting/#webpage"},"wordCount":466,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/type-alias-casting/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/type-alias-casting/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/type-alias-casting","name":"A.27. Type Alias & Casting","description":"Chapter ini membahas tentang type alias dan juga casting (explicit conversion) pada tipe data primitif scalar.","datePublished":"2024-08-01T10:17:31.889Z","dateModified":"2024-08-01T10:17:31.889Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/type-alias-casting/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/type-alias-casting"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/type-alias-casting/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.27. Type Alias & Casting","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/type-alias-casting/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/type-alias-casting/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.27. Type Alias & Casting","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/type-alias-casting/#webpage"},"wordCount":466,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/type-alias-casting/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/type-alias-casting/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/type-alias-casting","name":"A.27. Type Alias & Casting","description":"Chapter ini membahas tentang type alias dan juga casting (explicit conversion) pada tipe data primitif scalar.","datePublished":"2024-08-30T07:44:52.029Z","dateModified":"2024-08-30T07:44:52.029Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/type-alias-casting/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/type-alias-casting"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/type-alias-casting/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.27. Type Alias & Casting","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.27. Type Alias & Casting</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.27. Type Alias & Casting</h1></header><p>Chapter ini membahas tentang type alias dan juga casting (explicit conversion) pada tipe data primitif scalar.</p><blockquote><p>Pembahasan mengenai conversion pada tipe data non-primitif scalar (seperti struct dan enum) dibahas pada chapter <a href="#/wip/trait-conversion-from-into">Trait ➜ Conversion (From & Into)</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a271-type-alias">A.27.1. Type Alias<a class="hash-link" href="#a271-type-alias" title="Direct link to heading">​</a></h2><p>Type alias adalah pemberian nama baru ke suatu tipe data. Cara pembuatan alias sangat mudah yaitu menggunakan keyword <code>type</code>.</p><p>Berikut adalah 2 contoh penerapan type alias untuk membuat tipe data baru:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">type</span><span class="token plain"> </span><span class="token type-definition class-name">Inch</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Tipe data <code>Inch</code> di atas adalah tipe baru yang merupakan alias dari tipe <code>u64</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">type</span><span class="token plain"> </span><span class="token type-definition class-name">Coordinate</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Struct <code>Point</code> di atas dibuat memiliki 2 item (<code>x</code> dan <code>y</code>). Dari struct tersebut dibuat tipe data baru bernama <code>Coordinate</code> yang merupakan alias dari <code>Point</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a272-casting-tipe-data--alias">A.27.2. Casting tipe data & alias<a class="hash-link" href="#a272-casting-tipe-data--alias" title="Direct link to heading">​</a></h2><p>Casting adalah pengubahan tipe data tertentu ke tipe data lain yang keduanya masih compatible. Metode casting bisa diterapkan antara tipe data asli dan alias, dan juga antar tipe data scalar lainnya (yang memang compatible satu sama lain).</p><p>Pada contoh berikut, tipe data <code>Inch</code> di cast ke tipe data <code>u64</code> menggunakan keyword <code>as</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> height</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Inch</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"height: {height}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> height_in_u64 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> height </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"height_in_u64: {height_in_u64}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Type Alias Casting" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjQAAAB3CAIAAACbuk2/AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9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QDAYuJ0tazZoFCk6ER2cXIy+P71s3hF8bGjxAn/QwCAmcSpDswGAQBgc+KE2SAAAGxOnKrMBsUVCfY8Kg8HAICXK04AAACIEwAAIE4AAACIEwAAIE4AAACIEwAAIE4AAACIEwAAAOIEAACIEwAAAOIEAACIEwAAAOIEAACIEwAAwNL8DwiguM+7nF8FAAAAAElFTkSuQmCC" width="564" height="119" class="img_ev3q"></p><p>Contoh lainnya bisa dilihat pada kode berikut, variabel <code>p</code> dibuat menggunakan struct <code>Point</code>, kemudian di-cast ke tipe <code>Coordinate</code> sebagai data mutable lalu diubah nilai itemnya, dan terakhir di-cast sekali lagi ke tipe <code>Point</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> p </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"p: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> p</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> q</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Coordinate</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> p </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token class-name">Coordinate</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">q</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"q: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> q</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> q </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"r: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Type Alias Casting" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjgAAACICAIAAABlQgb9AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9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QYJ24F6gwALkSoLsc4USr86maKuCkCAEJlGSgvwThRsi5szbT6vy4+4OOmCAAXI1TaLkoYJzqniK0LE/VQKvFXuCkCAEJlGzD9IR/jREnvphIq3BQBAKEyR1MjXD4uxDgxJ1R1M3+4KQIAQrWQUJ2/cWJSqOozxU0RABCqZSMq5bszME7Uhcp/+VWpVLgpAgBCZVKayAIQ48SMUKkqhZsiAMB0QuXM3n37PHYxhZDpeRgnCtaF4W/IPGXCTREAYEKhKo5NtsYWS42bIgAAQuXFFhsabHFTBABAqCSp2tm+dbgpAgBCBQAAgFABAAAgVAAAgFABAAAgVEcwTtwK1BkAXIhQYZyIcSIAwOaFCuNEjBMBAGYUKs8aItpNFuPELg3GiQAAKwpVLwb+0IZxoqR3GCcCAKwgVN4jedG4hXFiVIdFuWGcCAAI1UTxSCYewzgR40QAgO0KFcaJGCcCAKwiVBgnZoQK40QAgJ0K1RXGiRgnAgBMJlT7B+PEcQVFqAAAoZoZjBPPS+QBAKE6U6nCOLGqzoinAAChAgAAQKgAAAChAgAAQKgAAAChAgAAQKgAAAAQKgAAQKgAAAAQKgAAQKgAAAAQKgAAAIQKAAAQKgAAAIQKAAAulP8By3oXe/rrx48AAAAASUVORK5CYII=" width="568" height="136" class="img_ev3q"></p><blockquote><p>Operasi assignment dan type casting pada custom type <code>struct</code> membuat owner-nya berpindah. Perpindahan owner ini disebut dengan <em>move semantics</em>.</p><p>Lebih jelasnya perihal topik ini dibahas pada chapter <a href="/basic/ownership">Ownership</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a273-casting-antar-tipe-scalar">A.27.3. Casting antar tipe scalar<a class="hash-link" href="#a273-casting-antar-tipe-scalar" title="Direct link to heading">​</a></h2><p>Casting antar tipe data numerik dilakukan dengan cara yang sama seperti casting antar tipe data dan alias. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">32</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number: {number}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_in_u8 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u8</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number_in_u8: {number_in_u8}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_in_f64 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number_in_f64: {number_in_f64}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> new_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">23.4</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"new_number: {new_number}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Type Alias Casting" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjcAAACZCAIAAABcw4xOAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZ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qlMp0dyieVvk3sK8PHkzDxaPpeZzVlQkynYlafjFIoIAABuolBxdtFMdXg4d+uHrZlab2iXvwVnR9F6q5FgYvqzKzDgnlgIAWFGlriQbQ69LL/Tue3BWtKiU4FioeBuiUgAA26gUAAAAKgUAAKjUuqfDhxAAAIilAAAAlQIAAEClAAAAlQIAAEClAAAAUCkAAEClAAAAUCkAAEClAAAAUCkAAABUCgAAUCkAAABUCgAAUCkAAABUCgAAoMD/LjfPkWSwhbAAAAAASUVORK5CYII=" width="567" height="153" class="img_ev3q"></p><p>Tipe data integer, unsigned integer, dan floating point bisa di-cast satu sama lain.</p><blockquote><p>Selain itu, tipe <code>char</code> juga bisa di-cast ke tipe lainnya (selain tipe float)</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a274-konsekuensi-casting-tipe-numerik">A.27.4. Konsekuensi casting tipe numerik<a class="hash-link" href="#a274-konsekuensi-casting-tipe-numerik" title="Direct link to heading">​</a></h2><p>Salah satu hal yang harus diperhatikan dalam casting adalah pemilihan tipe data beserta size yang tepat.</p><p>Setiap tipe data memiliki besaran alokasi memory yang berbeda. Sebagai contoh, tipe data <code>u64</code> bisa menampung angka yang jauh lebih besar dibanding <code>u16</code>.</p><p>Bagaimana jika misalnya ada data numerik yang angkanya cukup besar dan hanya bisa ditampung pada tipe data <code>u64</code> (atau tipe data lainnya yang size-nya lebih besar), kemudian tipe tersebut di-cast ke tipe data yang lebih kecil contohnya <code>u16</code>?</p><p>Sebagai contoh pada kode berikut, variabel <code>timestamp</code> bertipe <code>u64</code> menampung data unix timestamp waktu sekarang. Data tersebut di cast ke tipe yang lebih kecil yaitu <code>u16</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">time</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token punctuation" style="color:#393A34">{</span><span class="token class-name">SystemTime</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> timestamp</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">SystemTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">now</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">duration_since</span><span class="token punctuation" style="color:#393A34">(</span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_secs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"timestamp (u64): {timestamp}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"timestamp (as u16): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> timestamp </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u16</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Type Alias Casting" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjkAAAB3CAIAAABuRMYPAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxy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kAAAAASUVORK5CYII=" width="569" height="119" class="img_ev3q"></p><p>Bisa dilihat hasilnya angka menjadi lebih kecil, ini karena <code>u16</code> tidak bisa menampung nilai numerik sebesar <code>u64</code>. Lalu bagaimana jika angka tersebut di-cast lagi ke tipe <code>u64</code>?</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> timestamp</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">SystemTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">now</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">duration_since</span><span class="token punctuation" style="color:#393A34">(</span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_secs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"timestamp (u64): {timestamp}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"timestamp (as u16): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> timestamp </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u16</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"from u16 back to u64: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">timestamp </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u16</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Type Alias Casting" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjkAAACCCAIAAAArG06lAAA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YlLRAPU6wucUyNM6aJSXnPlBMAYHNadQFei1JGpjqIvnWsGsUjk/6No6wavWDJr3ihRvwE8eVlfCYBALamVZfgtShklCqnXkO9VWOJg6IavpRaNQaqqGcdhk1xJkmfSQCA7WnV9tmE1+JIsGoEAECrNq1WWDUCAKBVGw9k+OktAMD5axUAAKBVAAAAaBUAAABaBQAA561V/Y91drRYbeR2CyzNAwDYk1atu3GB1a5wXa2aZ1GhcpnetvKFl4QrIwCcp1atuB1coV3hWWmVepn1db28DNMqXBkB4Ey1KgqrmnG5e84WHs91X8RPBl0ZblconDM2YBRtFePiu9lG2/zpwYqTMKqQgmtXL7MtVqiNuDICwKVqlTYKt2Nwt2Vf68zr2x/5fojepoHm8VoKcOw2gLIBo2irqG3vetpyMB/DRNcmVUiRTouX6RZqGq3ClREAzjeuCiw0wjTdh/KGtiO0qsAGMG9q9cnZZ1acHGuGYctkm6QdRgso6dqVy/TCmZHvq3BlBICz1yphrUP4Smk+rRqiAYHdrz8Qi4tHnL3TP5kqKdSqqEIKtUrV/sFaFV4drowAcHFaFXj1zaRVBTaAggGjYqsonqXN1rh0IBNXpZZS6nOAwWW+/IgZrAy4MgLA5WmVpwGn8a9Qq6awK9TGWO/lU2yrKAlSn61laks0igwr5FBw7ZnLHPS+SgiWcGUEgEvSqoO37K1JXqBVE9kVymf0JvIkW8UwdbQO0PKDprhUUYUc7Neeu8whWoUrIwCcsVYBAACgVQAAAGgVAACgVQAAAGgVAACgVQAAAGgVAAAAWgUAAGgVAAAAWgUAAGgVAAAAWgUAAIBWAQDA+fI/fZXpdmg/zrMAAAAASUVORK5CYII=" width="569" height="130" class="img_ev3q"></p><p>Hasilnya adalah nilai tetap tidak akan kembali seperti semula. Jadi silakan berhati-hati dalam melakukan operasi casting antar tipe data numerik.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-module-stdtime">◉ Module <code>std::time</code><a class="hash-link" href="#-module-stdtime" title="Direct link to heading">​</a></h3><p><code>SystemTime</code> dan <code>UNIX_EPOCH</code> keduanya merupakan item milik module <code>std::time</code>.</p><p>Pengaksesan <code>SystemTime::now()</code> mengembalikan data waktu sekarang, dan jika di chain dengan method <code>duration_since(UNIX_EPOCH)</code> hasilnya adalah data duration bertipe <code>Result<Duration, SystemTimeError></code>.</p><p>Dari data tersebut bisa kita chain lagi dengan method <code>unwrap</code> dan <code>as_second</code> untuk mengambil datanya dalam bentuk <code>u64</code>.</p><blockquote><ul><li>Lebih jelasnya mengenai module <code>std::time</code> dibahas pada chapter <a href="/basic/datetime">DateTime</a></li><li>Lebih jelasnya mengenai tipe data <code>Result</code> dibahas pada chapter <a href="/basic/result-type">Tipe Data ➜ Result</a></li></ul></blockquote><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/type_alias_casting" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../type_alias_casting</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/rust-by-example/types/alias.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/types/alias.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/types/cast.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/types/cast.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/enum"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.26. Enum</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/visibility-privacy"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.28. Module System ➜ Visibility & Privacy</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a271-type-alias" class="table-of-contents__link toc-highlight">A.27.1. Type Alias</a></li><li><a href="#a272-casting-tipe-data--alias" class="table-of-contents__link toc-highlight">A.27.2. Casting tipe data & alias</a></li><li><a href="#a273-casting-antar-tipe-scalar" class="table-of-contents__link toc-highlight">A.27.3. Casting antar tipe scalar</a></li><li><a href="#a274-konsekuensi-casting-tipe-numerik" class="table-of-contents__link toc-highlight">A.27.4. Konsekuensi casting tipe numerik</a><ul><li><a href="#-module-stdtime" class="table-of-contents__link toc-highlight">◉ Module <code>std::time</code></a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.27. Type Alias & Casting</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.27. Type Alias & Casting</h1></header><p>Chapter ini membahas tentang type alias dan juga casting (explicit conversion) pada tipe data primitif scalar.</p><blockquote><p>Pembahasan mengenai conversion pada tipe data non-primitif scalar (seperti struct dan enum) dibahas pada chapter <a href="#/wip/trait-conversion-from-into">Trait ➜ Conversion (From & Into)</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a271-type-alias">A.27.1. Type Alias<a class="hash-link" href="#a271-type-alias" title="Direct link to heading">​</a></h2><p>Type alias adalah pemberian nama baru ke suatu tipe data. Cara pembuatan alias sangat mudah yaitu menggunakan keyword <code>type</code>.</p><p>Berikut adalah 2 contoh penerapan type alias untuk membuat tipe data baru:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">type</span><span class="token plain"> </span><span class="token type-definition class-name">Inch</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Tipe data <code>Inch</code> di atas adalah tipe baru yang merupakan alias dari tipe <code>u64</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token attribute attr-name" style="color:#00a4db">#[derive(Debug)]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">struct</span><span class="token plain"> </span><span class="token type-definition class-name">Point</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">type</span><span class="token plain"> </span><span class="token type-definition class-name">Coordinate</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Struct <code>Point</code> di atas dibuat memiliki 2 item (<code>x</code> dan <code>y</code>). Dari struct tersebut dibuat tipe data baru bernama <code>Coordinate</code> yang merupakan alias dari <code>Point</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a272-casting-tipe-data--alias">A.27.2. Casting tipe data & alias<a class="hash-link" href="#a272-casting-tipe-data--alias" title="Direct link to heading">​</a></h2><p>Casting adalah pengubahan tipe data tertentu ke tipe data lain yang keduanya masih compatible. Metode casting bisa diterapkan antara tipe data asli dan alias, dan juga antar tipe data scalar lainnya (yang memang compatible satu sama lain).</p><p>Pada contoh berikut, tipe data <code>Inch</code> di cast ke tipe data <code>u64</code> menggunakan keyword <code>as</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> height</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Inch</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"height: {height}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> height_in_u64 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> height </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"height_in_u64: {height_in_u64}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="Type Alias Casting" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjQAAAB3CAIAAACbuk2/AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL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TmL09+1HTOHCRfwPAQAWE6elzQanF6dhss71nUp4FY5dEIH/IQDAYuJ0tazZoFCk6ER2cXIy+P71s3hF8bGjxAn/QwCAmcSpDswGAQBgc+KE2SAAAGxOnKrMBsUVCfY8Kg8HAICXK04AAACIEwAAIE4AAACIEwAAIE4AAACIEwAAIE4AAACIEwAAAOIEAACIEwAAAOIEAACIEwAAAOIEAACIEwAAwNL8DwiguM+7nF8FAAAAAElFTkSuQmCC" width="564" height="119" class="img_CujE"></p><p>Contoh lainnya bisa dilihat pada kode berikut, variabel <code>p</code> dibuat menggunakan struct <code>Point</code>, kemudian di-cast ke tipe <code>Coordinate</code> sebagai data mutable lalu diubah nilai itemnya, dan terakhir di-cast sekali lagi ke tipe <code>Point</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> p </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> y</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"p: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> p</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> q</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Coordinate</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> p </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token class-name">Coordinate</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">q</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"q: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> q</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> r</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> q </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token class-name">Point</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"r: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> r</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Type Alias Casting" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjgAAACICAIAAABlQgb9AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90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rpsGXa90pylC4ikA2KVQAQAAIFQAAAAIFQAAIFQAAABnLlQYJ24F6gwALkSoLsc4USr86maKuCkCAEJlGSgvwThRsi5szbT6vy4+4OOmCAAXI1TaLkoYJzqniK0LE/VQKvFXuCkCAEJlGzD9IR/jREnvphIq3BQBAKEyR1MjXD4uxDgxJ1R1M3+4KQIAQrWQUJ2/cWJSqOozxU0RABCqZSMq5bszME7Uhcp/+VWpVLgpAgBCZVKayAIQ48SMUKkqhZsiAMB0QuXM3n37PHYxhZDpeRgnCtaF4W/IPGXCTREAYEKhKo5NtsYWS42bIgAAQuXFFhsabHFTBABAqCSp2tm+dbgpAgBCBQAAgFABAAAgVAAAgFABAAAgVEcwTtwK1BkAXIhQYZyIcSIAwOaFCuNEjBMBAGYUKs8aItpNFuPELg3GiQAAKwpVLwb+0IZxoqR3GCcCAKwgVN4jedG4hXFiVIdFuWGcCAAI1UTxSCYewzgR40QAgO0KFcaJGCcCAKwiVBgnZoQK40QAgJ0K1RXGiRgnAgBMJlT7B+PEcQVFqAAAoZoZjBPPS+QBAKE6U6nCOLGqzoinAAChAgAAQKgAAAChAgAAQKgAAAChAgAAQKgAAAAQKgAAQKgAAAAQKgAAQKgAAAAQKgAAAIQKAAAQKgAAAIQKAAAulP8By3oXe/rrx48AAAAASUVORK5CYII=" width="568" height="136" class="img_CujE"></p><blockquote><p>Operasi assignment dan type casting pada custom type <code>struct</code> membuat owner-nya berpindah. Perpindahan owner ini disebut dengan <em>move semantics</em>.</p><p>Lebih jelasnya perihal topik ini dibahas pada chapter <a href="/basic/ownership">Ownership</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a273-casting-antar-tipe-scalar">A.27.3. Casting antar tipe scalar<a class="hash-link" href="#a273-casting-antar-tipe-scalar" title="Direct link to heading">​</a></h2><p>Casting antar tipe data numerik dilakukan dengan cara yang sama seperti casting antar tipe data dan alias. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">32</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number: {number}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_in_u8 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u8</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number_in_u8: {number_in_u8}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> number_in_f64 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> number </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f64</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"number_in_f64: {number_in_f64}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> new_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">23.4</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">f32</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"new_number: {new_number}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Type Alias Casting" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjcAAACZCAIAAABcw4xOAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAA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VEqyMTy+xHl6aUiUbDmVmtVZUQ/9xGvJvpia00QRAACVqlMp0dyieVvk3sK8PHkzDxaPpeZzVlQkynYlafjFIoIAABuolBxdtFMdXg4d+uHrZlab2iXvwVnR9F6q5FgYvqzKzDgnlgIAWFGlriQbQ69LL/Tue3BWtKiU4FioeBuiUgAA26gUAAAAKgUAAKjUuqfDhxAAAIilAAAAlQIAAEClAAAAlQIAAEClAAAAUCkAAEClAAAAUCkAAEClAAAAUCkAAABUCgAAUCkAAABUCgAAUCkAAABUCgAAoMD/LjfPkWSwhbAAAAAASUVORK5CYII=" width="567" height="153" class="img_CujE"></p><p>Tipe data integer, unsigned integer, dan floating point bisa di-cast satu sama lain.</p><blockquote><p>Selain itu, tipe <code>char</code> juga bisa di-cast ke tipe lainnya (selain tipe float)</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a274-konsekuensi-casting-tipe-numerik">A.27.4. Konsekuensi casting tipe numerik<a class="hash-link" href="#a274-konsekuensi-casting-tipe-numerik" title="Direct link to heading">​</a></h2><p>Salah satu hal yang harus diperhatikan dalam casting adalah pemilihan tipe data beserta size yang tepat.</p><p>Setiap tipe data memiliki besaran alokasi memory yang berbeda. Sebagai contoh, tipe data <code>u64</code> bisa menampung angka yang jauh lebih besar dibanding <code>u16</code>.</p><p>Bagaimana jika misalnya ada data numerik yang angkanya cukup besar dan hanya bisa ditampung pada tipe data <code>u64</code> (atau tipe data lainnya yang size-nya lebih besar), kemudian tipe tersebut di-cast ke tipe data yang lebih kecil contohnya <code>u16</code>?</p><p>Sebagai contoh pada kode berikut, variabel <code>timestamp</code> bertipe <code>u64</code> menampung data unix timestamp waktu sekarang. Data tersebut di cast ke tipe yang lebih kecil yaitu <code>u16</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">time</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token punctuation" style="color:#393A34">{</span><span class="token class-name">SystemTime</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> timestamp</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">SystemTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">now</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">duration_since</span><span class="token punctuation" style="color:#393A34">(</span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_secs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"timestamp (u64): {timestamp}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"timestamp (as u16): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> timestamp </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u16</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Type Alias Casting" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjkAAAB3CAIAAABuRMYPAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcs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KsAAADQKgAAQKsAAADQKgAAALQKAABOkf8BE4gitJ7RQDkAAAAASUVORK5CYII=" width="569" height="119" class="img_CujE"></p><p>Bisa dilihat hasilnya angka menjadi lebih kecil, ini karena <code>u16</code> tidak bisa menampung nilai numerik sebesar <code>u64</code>. Lalu bagaimana jika angka tersebut di-cast lagi ke tipe <code>u64</code>?</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> timestamp</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">SystemTime</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">now</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">duration_since</span><span class="token punctuation" style="color:#393A34">(</span><span class="token constant" style="color:#36acaa">UNIX_EPOCH</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">as_secs</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"timestamp (u64): {timestamp}"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"timestamp (as u16): {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> timestamp </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u16</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"from u16 back to u64: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">timestamp </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u16</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">u64</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Type Alias Casting" src="data:image/png;base64,iV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aN/WV0hibdrOkP2ZpxcDkBAM5Mq3bhtShlpJdzuFYlLRAPU6wucUyNM6aJSXnPlBMAYHNadQFei1JGpjqIvnWsGsUjk/6No6wavWDJr3ihRvwE8eVlfCYBALamVZfgtShklCqnXkO9VWOJg6IavpRaNQaqqGcdhk1xJkmfSQCA7WnV9tmE1+JIsGoEAECrNq1WWDUCAKBVGw9k+OktAMD5axUAAKBVAAAAaBUAAABaBQAA561V/Y91drRYbeR2CyzNAwDYk1atu3GB1a5wXa2aZ1GhcpnetvKFl4QrIwCcp1atuB1coV3hWWmVepn1db28DNMqXBkB4Ey1KgqrmnG5e84WHs91X8RPBl0ZblconDM2YBRtFePiu9lG2/zpwYqTMKqQgmtXL7MtVqiNuDICwKVqlTYKt2Nwt2Vf68zr2x/5fojepoHm8VoKcOw2gLIBo2irqG3vetpyMB/DRNcmVUiRTouX6RZqGq3ClREAzjeuCiw0wjTdh/KGtiO0qsAGMG9q9cnZZ1acHGuGYctkm6QdRgso6dqVy/TCmZHvq3BlBICz1yphrUP4Smk+rRqiAYHdrz8Qi4tHnL3TP5kqKdSqqEIKtUrV/sFaFV4drowAcHFaFXj1zaRVBTaAggGjYqsonqXN1rh0IBNXpZZS6nOAwWW+/IgZrAy4MgLA5WmVpwGn8a9Qq6awK9TGWO/lU2yrKAlSn61laks0igwr5FBw7ZnLHPS+SgiWcGUEgEvSqoO37K1JXqBVE9kVymf0JvIkW8UwdbQO0PKDprhUUYUc7Neeu8whWoUrIwCcsVYBAACgVQAAAGgVAACgVQAAAGgVAACgVQAAAGgVAAAAWgUAAGgVAAAAWgUAAGgVAAAAWgUAAIBWAQDA+fI/fZXpdmg/zrMAAAAASUVORK5CYII=" width="569" height="130" class="img_CujE"></p><p>Hasilnya adalah nilai tetap tidak akan kembali seperti semula. Jadi silakan berhati-hati dalam melakukan operasi casting antar tipe data numerik.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-module-stdtime">◉ Module <code>std::time</code><a class="hash-link" href="#-module-stdtime" title="Direct link to heading">​</a></h3><p><code>SystemTime</code> dan <code>UNIX_EPOCH</code> keduanya merupakan item milik module <code>std::time</code>.</p><p>Pengaksesan <code>SystemTime::now()</code> mengembalikan data waktu sekarang, dan jika di chain dengan method <code>duration_since(UNIX_EPOCH)</code> hasilnya adalah data duration bertipe <code>Result<Duration, SystemTimeError></code>.</p><p>Dari data tersebut bisa kita chain lagi dengan method <code>unwrap</code> dan <code>as_second</code> untuk mengambil datanya dalam bentuk <code>u64</code>.</p><blockquote><ul><li>Lebih jelasnya mengenai module <code>std::time</code> dibahas pada chapter <a href="/basic/datetime">DateTime</a></li><li>Lebih jelasnya mengenai tipe data <code>Result</code> dibahas pada chapter <a href="/basic/result-type">Tipe Data ➜ Result</a></li></ul></blockquote><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/type_alias_casting" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../type_alias_casting</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/rust-by-example/types/alias.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/types/alias.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/types/cast.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/types/cast.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/enum"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.26. Enum</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/visibility-privacy"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.28. Module System ➜ Visibility & Privacy</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a271-type-alias" class="table-of-contents__link toc-highlight">A.27.1. Type Alias</a></li><li><a href="#a272-casting-tipe-data--alias" class="table-of-contents__link toc-highlight">A.27.2. Casting tipe data & alias</a></li><li><a href="#a273-casting-antar-tipe-scalar" class="table-of-contents__link toc-highlight">A.27.3. Casting antar tipe scalar</a></li><li><a href="#a274-konsekuensi-casting-tipe-numerik" class="table-of-contents__link toc-highlight">A.27.4. Konsekuensi casting tipe numerik</a><ul><li><a href="#-module-stdtime" class="table-of-contents__link toc-highlight">◉ Module <code>std::time</code></a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/unrecoverable-panic-error.html b/basic/unrecoverable-panic-error.html index 42dffb3d..4aa7b474 100644 --- a/basic/unrecoverable-panic-error.html +++ b/basic/unrecoverable-panic-error.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/unrecoverable-panic-error/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/unrecoverable-panic-error/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.54. Error ➜ Unrecoverable Error / Panic","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/unrecoverable-panic-error/#webpage"},"wordCount":352,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/unrecoverable-panic-error/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/unrecoverable-panic-error/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/unrecoverable-panic-error","name":"A.54. Error ➜ Unrecoverable Error / Panic","description":"Error handling atau penanganan error adalah salah satu aspek penting dalam pemrograman selalu umum. Rust mengenal 2 jenis error yaitu unrecoverable error (panic error) dan recoverable error. Pembahasan chapter ini fokus pada unrecoverable error atau panic error.","datePublished":"2024-08-01T10:17:31.244Z","dateModified":"2024-08-01T10:17:31.244Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/unrecoverable-panic-error/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/unrecoverable-panic-error"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/unrecoverable-panic-error/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.54. Error ➜ Unrecoverable Error / Panic","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/unrecoverable-panic-error/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/unrecoverable-panic-error/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.54. Error ➜ Unrecoverable Error / Panic","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/unrecoverable-panic-error/#webpage"},"wordCount":352,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/unrecoverable-panic-error/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/unrecoverable-panic-error/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/unrecoverable-panic-error","name":"A.54. Error ➜ Unrecoverable Error / Panic","description":"Error handling atau penanganan error adalah salah satu aspek penting dalam pemrograman selalu umum. Rust mengenal 2 jenis error yaitu unrecoverable error (panic error) dan recoverable error. Pembahasan chapter ini fokus pada unrecoverable error atau panic error.","datePublished":"2024-08-30T07:44:51.310Z","dateModified":"2024-08-30T07:44:51.310Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/unrecoverable-panic-error/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/unrecoverable-panic-error"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/unrecoverable-panic-error/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.54. Error ➜ Unrecoverable Error / Panic","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.54. Error ➜ Unrecoverable Error / Panic</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.54. Error ➜ Unrecoverable Error / Panic</h1></header><p>Error handling atau penanganan error adalah salah satu aspek penting dalam pemrograman selalu umum. Rust mengenal 2 jenis error yaitu <strong>unrecoverable error (panic error)</strong> dan <strong>recoverable error</strong>. Pembahasan chapter ini fokus pada unrecoverable error atau panic error.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a541-unrecoverable-error-runtime-error--compile-time-error">A.54.1. Unrecoverable error (RUNTIME error & COMPILE-TIME error)<a class="hash-link" href="#a541-unrecoverable-error-runtime-error--compile-time-error" title="Direct link to heading">​</a></h2><p><em>Unrecoverable error</em> adalah error yang tidak bisa ditangani, entah itu karena memang disengaja atau karena ada bug fatal yang menyebabkan program mendapati error jenis ini sehingga program <em>crash</em> dan berhenti secara paksa.</p><p>Salah satu operasi yang menyebabkan panic adalah pengaksesan elemen vector menggunakan index di luar kapasitas vector. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">23</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data index 1: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data index 6: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data index 2: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pengaksesan index ke-6 vector <code>data</code> menghasilkan panic karena vector tersebut hanya berisi 3 elemen.</p><p><img loading="lazy" alt="Error Handling, Panic, Operator ?" src="/assets/images/unrecoverable-panic-error-1-2a22152a19c4dfb91d4f55885880fc08.png" width="727" height="182" class="img_ev3q"></p><p>Apa yang bisa dilakukan ketika panic muncul?</p><ul><li>Jika panic muncul ketika program sudah di production, program akan crash karena bug pengaksesan error di atas.</li><li>Jika panic muncul saat pengembangan, maka bisa diperbaiki kodenya, bisa dengan menambahkan pengecekan kapasitas index vector atau lainnya.</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-perbedaan-panic-saat-pengaksesan-vector-dan-error-saat-pengaksesan-array">◉ Perbedaan panic saat pengaksesan vector dan error saat pengaksesan array<a class="hash-link" href="#-perbedaan-panic-saat-pengaksesan-vector-dan-error-saat-pengaksesan-array" title="Direct link to heading">​</a></h3><p>Coba ubah kode di atas, tipe data variabel <code>data</code> ubah dari vector ke array. Lalu jalankan ulang program.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">23</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data index 1: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data index 6: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data index 2: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Error masih muncul, tapi pesan error-nya berbeda.</p><p><img loading="lazy" alt="Error Handling, Panic, Operator ?" src="/assets/images/unrecoverable-panic-error-2-1ffea2a5a914b4b95bb2db06c1ac9b53.png" width="764" height="215" class="img_ev3q"></p><p>2 program yang dijalankan keduanya error tapi error-nya sangat berbeda.</p><table><tbody><tr><td>Pengaksesan elemen vector di luar kapastias memunculkan error saat <b>RUNTIME</b>. Penjelasannya:</td></tr><tr><td><ul><li><strong>RUNTIME error</strong> menandakan kode program sudah berhasil dikompilasi dan program juga berhasil di eksekusi.<ul><li>Silakan lihat gambar pertama, ada keterangan <em>Finished</em> dan <em>Running</em>.</li><li>Error ini masuk kategori <strong>panic-level error</strong> atau <strong>panic</strong>.</li></ul></li><li>Error muncul ketika baris kode <code>println!("data index 6: {}", data[6]);</code> dieksekusi.</li><li>Kode sebelum baris tersebut masih sempat dieksekusi.<ul><li>Silakan lihat gambar pertama, output <code>data index 1: 11</code> sempat muncul sebelum error.</li></ul></li><li>Tipe data vector tidak tidak mampu mengetahui kapasitas datanya saat kompilasi, inilah kenapa error bisa lolos kompilasi.</li></ul></td></tr></tbody></table><table><tbody><tr><td>Sedangkan pengaksesan elemen array di luar kapastias memunculkan error saat <b>COMPILE TIME</b>. Penjelasannya:</td></tr><tr><td><ul><li><strong>COMPILE TIME error</strong> menandakan kode program gagal dikompilasi dan tidak sampai dieksekusi.<ul><li>Silakan lihat gambar ke-dua, ada keterangan <em>Compiling</em> diikuti dengan error, dan keterangan <code>could not compile</code>.</li><li>Error ini masuk kategori <strong>compile-time-level error</strong> atau cukup <strong>error</strong>.</li></ul></li><li>Error muncul saat compiler memproses baris kode <code>println!("data index 6: {}", data[6]);</code>.</li><li>Tipe data array kapasitasnya sudah bisa diketahui oleh compiler saat kompilasi, menyebabkan proses kompilasi gagal.</li></ul></td></tr></tbody></table><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a542-macro-panic">A.54.2. Macro <code>panic!()</code><a class="hash-link" href="#a542-macro-panic" title="Direct link to heading">​</a></h2><p>Telah kita pelajari bahwa panic muncul karena <em>flaw</em> atau cacat program, disebabkan oleh bug di kode program. Selain itu, panic bisa dimunculkan dengan sengaja menggunakan macro <code>panic!()</code>.</p><p>Cara penggunaannya cukup dengan memanggil macro tersebut diikuti dengan argument berisi string keterangan panic errornya.</p><blockquote><p>Bisa dibilang macro <code>panic!()</code> adalah media untuk membuat <em>recoverable error</em> menjadi <em>unrecoverable error</em>.</p></blockquote><p>Pada contoh berikut, program sederhana dibuat untuk menangkap inputan nama user untuk kemudian di-print. Jika user tidak menginputkan apapun, maka panic sengaja dimunculkan via pemanggilan macro <code>panic!()</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">io</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Write</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"enter your name: "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdout</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">flush</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> name </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_empty</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">panic!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"unable to continue the program"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hi {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> reader_res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdin</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">read_line</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> reader_res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">trim</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Output program:</p><p><img loading="lazy" alt="Error Handling, Panic, Operator ?" src="/assets/images/unrecoverable-panic-error-3-4d90d454da4c451e1d9b6c9499ba72c6.png" width="719" height="284" class="img_ev3q"></p><p>Program dieksekusi 2 kali:</p><ol><li>Eksekusi pertama, inputan <code>noval agung</code> digunakan. Hasilnya program berjalan sesuai desain.</li><li>Pada eksekusi ke-2, tidak ada inputan yang ditulis, dan langsung tekan tombol enter, hasilnya panic sengaja dimunculkan via macro <code>panic!()</code> dengan pesan <code>unable to continue the program</code>.</li></ol><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-statement-iostdoutflush">◉ Statement <code>io::stdout().flush()</code><a class="hash-link" href="#-statement-iostdoutflush" title="Direct link to heading">​</a></h3><p>Dibanding dengan beberapa chapter sebelumnya yang juga ada praktek menangkap inputan user, kode program yang ditulis kali ini disisipi statement baru yaitu <code>io::stdout().flush()</code>. Kode tersebut berguna untuk mem-<em>flush</em> output STDOUT yang muncul, karena default output STDOUT adalah di-<em>buffer</em> oleh Rust.</p><p>Jika tidak di-flush, ada kemungkinan text <code>enter your name: </code> muncul setelah user mengisi inputan lalu menekan tombol <em>enter</em>.</p><blockquote><p>Untuk menggunakan stdout flush, path <code>std::io::Write</code> harus di-import terlebih dahulu.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a543-kapan-harus-menggunakan-panic-error">A.54.3. Kapan harus menggunakan panic error?<a class="hash-link" href="#a543-kapan-harus-menggunakan-panic-error" title="Direct link to heading">​</a></h2><p>Tidak semua jenis recoverable error harus berakhir dengan panic, ini penting untuk selalu diingat. Adakalanya error perlu di-recover secara gentle, ada kalanya error harus diumumkan via panic agar program terhenti. Contohnya:</p><ul><li>Error ketika ada inputan yang tidak valid, maka cukup direspon dengan pesan error saja.</li><li>Error karena ada operasi pembagian terhadap angka <code>0</code>, maka tidak perlu menggunakan panic.</li><li>Error karena file konfigurasi yang tidak ditemukan saat eksekusi program, ideal menggunakan panic.</li></ul><p>Tergantung tingkat <em>severity</em> atau keseriusan error, silakan tentukan prosedur penanganannya seperti apa sesuai kebutuhan, juga jangan lupa pertimbangkan implikasinya.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/unrecoverable_panic_error" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../unrecoverable_panic_error</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/recoverable-error-handling">Error ➜ Recoverable Error & Error Handling</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-with-panic.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-with-panic.html</a></li><li><a href="https://doc.rust-lang.org/book/ch09-03-to-panic-or-not-to-panic.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch09-03-to-panic-or-not-to-panic.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/file-path-directory"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.53. File, Path, Directory</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/recoverable-error-handling"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.55. Error ➜ Recoverable Error & Error Handling</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a541-unrecoverable-error-runtime-error--compile-time-error" class="table-of-contents__link toc-highlight">A.54.1. Unrecoverable error (RUNTIME error & COMPILE-TIME error)</a><ul><li><a href="#-perbedaan-panic-saat-pengaksesan-vector-dan-error-saat-pengaksesan-array" class="table-of-contents__link toc-highlight">◉ Perbedaan panic saat pengaksesan vector dan error saat pengaksesan array</a></li></ul></li><li><a href="#a542-macro-panic" class="table-of-contents__link toc-highlight">A.54.2. Macro <code>panic!()</code></a><ul><li><a href="#-statement-iostdoutflush" class="table-of-contents__link toc-highlight">◉ Statement <code>io::stdout().flush()</code></a></li></ul></li><li><a href="#a543-kapan-harus-menggunakan-panic-error" class="table-of-contents__link toc-highlight">A.54.3. Kapan harus menggunakan panic error?</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.54. Error ➜ Unrecoverable Error / Panic</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.54. Error ➜ Unrecoverable Error / Panic</h1></header><p>Error handling atau penanganan error adalah salah satu aspek penting dalam pemrograman selalu umum. Rust mengenal 2 jenis error yaitu <strong>unrecoverable error (panic error)</strong> dan <strong>recoverable error</strong>. Pembahasan chapter ini fokus pada unrecoverable error atau panic error.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a541-unrecoverable-error-runtime-error--compile-time-error">A.54.1. Unrecoverable error (RUNTIME error & COMPILE-TIME error)<a class="hash-link" href="#a541-unrecoverable-error-runtime-error--compile-time-error" title="Direct link to heading">​</a></h2><p><em>Unrecoverable error</em> adalah error yang tidak bisa ditangani, entah itu karena memang disengaja atau karena ada bug fatal yang menyebabkan program mendapati error jenis ini sehingga program <em>crash</em> dan berhenti secara paksa.</p><p>Salah satu operasi yang menyebabkan panic adalah pengaksesan elemen vector menggunakan index di luar kapasitas vector. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">23</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data index 1: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data index 6: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data index 2: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pengaksesan index ke-6 vector <code>data</code> menghasilkan panic karena vector tersebut hanya berisi 3 elemen.</p><p><img loading="eager" fetchpriority="high" alt="Error Handling, Panic, Operator ?" src="/assets/images/unrecoverable-panic-error-1-2a22152a19c4dfb91d4f55885880fc08.png" width="727" height="182" class="img_CujE"></p><p>Apa yang bisa dilakukan ketika panic muncul?</p><ul><li>Jika panic muncul ketika program sudah di production, program akan crash karena bug pengaksesan error di atas.</li><li>Jika panic muncul saat pengembangan, maka bisa diperbaiki kodenya, bisa dengan menambahkan pengecekan kapasitas index vector atau lainnya.</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-perbedaan-panic-saat-pengaksesan-vector-dan-error-saat-pengaksesan-array">◉ Perbedaan panic saat pengaksesan vector dan error saat pengaksesan array<a class="hash-link" href="#-perbedaan-panic-saat-pengaksesan-vector-dan-error-saat-pengaksesan-array" title="Direct link to heading">​</a></h3><p>Coba ubah kode di atas, tipe data variabel <code>data</code> ubah dari vector ke array. Lalu jalankan ulang program.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">23</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data index 1: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data index 6: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data index 2: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Error masih muncul, tapi pesan error-nya berbeda.</p><p><img loading="lazy" alt="Error Handling, Panic, Operator ?" src="/assets/images/unrecoverable-panic-error-2-1ffea2a5a914b4b95bb2db06c1ac9b53.png" width="764" height="215" class="img_CujE"></p><p>2 program yang dijalankan keduanya error tapi error-nya sangat berbeda.</p><table><tbody><tr><td>Pengaksesan elemen vector di luar kapastias memunculkan error saat <b>RUNTIME</b>. Penjelasannya:</td></tr><tr><td><ul><li><strong>RUNTIME error</strong> menandakan kode program sudah berhasil dikompilasi dan program juga berhasil di eksekusi.<ul><li>Silakan lihat gambar pertama, ada keterangan <em>Finished</em> dan <em>Running</em>.</li><li>Error ini masuk kategori <strong>panic-level error</strong> atau <strong>panic</strong>.</li></ul></li><li>Error muncul ketika baris kode <code>println!("data index 6: {}", data[6]);</code> dieksekusi.</li><li>Kode sebelum baris tersebut masih sempat dieksekusi.<ul><li>Silakan lihat gambar pertama, output <code>data index 1: 11</code> sempat muncul sebelum error.</li></ul></li><li>Tipe data vector tidak tidak mampu mengetahui kapasitas datanya saat kompilasi, inilah kenapa error bisa lolos kompilasi.</li></ul></td></tr></tbody></table><table><tbody><tr><td>Sedangkan pengaksesan elemen array di luar kapastias memunculkan error saat <b>COMPILE TIME</b>. Penjelasannya:</td></tr><tr><td><ul><li><strong>COMPILE TIME error</strong> menandakan kode program gagal dikompilasi dan tidak sampai dieksekusi.<ul><li>Silakan lihat gambar ke-dua, ada keterangan <em>Compiling</em> diikuti dengan error, dan keterangan <code>could not compile</code>.</li><li>Error ini masuk kategori <strong>compile-time-level error</strong> atau cukup <strong>error</strong>.</li></ul></li><li>Error muncul saat compiler memproses baris kode <code>println!("data index 6: {}", data[6]);</code>.</li><li>Tipe data array kapasitasnya sudah bisa diketahui oleh compiler saat kompilasi, menyebabkan proses kompilasi gagal.</li></ul></td></tr></tbody></table><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a542-macro-panic">A.54.2. Macro <code>panic!()</code><a class="hash-link" href="#a542-macro-panic" title="Direct link to heading">​</a></h2><p>Telah kita pelajari bahwa panic muncul karena <em>flaw</em> atau cacat program, disebabkan oleh bug di kode program. Selain itu, panic bisa dimunculkan dengan sengaja menggunakan macro <code>panic!()</code>.</p><p>Cara penggunaannya cukup dengan memanggil macro tersebut diikuti dengan argument berisi string keterangan panic errornya.</p><blockquote><p>Bisa dibilang macro <code>panic!()</code> adalah media untuk membuat <em>recoverable error</em> menjadi <em>unrecoverable error</em>.</p></blockquote><p>Pada contoh berikut, program sederhana dibuat untuk menangkap inputan nama user untuk kemudian di-print. Jika user tidak menginputkan apapun, maka panic sengaja dimunculkan via pemanggilan macro <code>panic!()</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">io</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">Write</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"enter your name: "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdout</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">flush</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> name </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_empty</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">panic!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"unable to continue the program"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hi {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> name</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">read_entry</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">-></span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> reader_res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">io</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">stdin</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">read_line</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> reader_res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_err</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> message</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">trim</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">to_string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Output program:</p><p><img loading="lazy" alt="Error Handling, Panic, Operator ?" src="/assets/images/unrecoverable-panic-error-3-4d90d454da4c451e1d9b6c9499ba72c6.png" width="719" height="284" class="img_CujE"></p><p>Program dieksekusi 2 kali:</p><ol><li>Eksekusi pertama, inputan <code>noval agung</code> digunakan. Hasilnya program berjalan sesuai desain.</li><li>Pada eksekusi ke-2, tidak ada inputan yang ditulis, dan langsung tekan tombol enter, hasilnya panic sengaja dimunculkan via macro <code>panic!()</code> dengan pesan <code>unable to continue the program</code>.</li></ol><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-statement-iostdoutflush">◉ Statement <code>io::stdout().flush()</code><a class="hash-link" href="#-statement-iostdoutflush" title="Direct link to heading">​</a></h3><p>Dibanding dengan beberapa chapter sebelumnya yang juga ada praktek menangkap inputan user, kode program yang ditulis kali ini disisipi statement baru yaitu <code>io::stdout().flush()</code>. Kode tersebut berguna untuk mem-<em>flush</em> output STDOUT yang muncul, karena default output STDOUT adalah di-<em>buffer</em> oleh Rust.</p><p>Jika tidak di-flush, ada kemungkinan text <code>enter your name: </code> muncul setelah user mengisi inputan lalu menekan tombol <em>enter</em>.</p><blockquote><p>Untuk menggunakan stdout flush, path <code>std::io::Write</code> harus di-import terlebih dahulu.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a543-kapan-harus-menggunakan-panic-error">A.54.3. Kapan harus menggunakan panic error?<a class="hash-link" href="#a543-kapan-harus-menggunakan-panic-error" title="Direct link to heading">​</a></h2><p>Tidak semua jenis recoverable error harus berakhir dengan panic, ini penting untuk selalu diingat. Adakalanya error perlu di-recover secara gentle, ada kalanya error harus diumumkan via panic agar program terhenti. Contohnya:</p><ul><li>Error ketika ada inputan yang tidak valid, maka cukup direspon dengan pesan error saja.</li><li>Error karena ada operasi pembagian terhadap angka <code>0</code>, maka tidak perlu menggunakan panic.</li><li>Error karena file konfigurasi yang tidak ditemukan saat eksekusi program, ideal menggunakan panic.</li></ul><p>Tergantung tingkat <em>severity</em> atau keseriusan error, silakan tentukan prosedur penanganannya seperti apa sesuai kebutuhan, juga jangan lupa pertimbangkan implikasinya.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/unrecoverable_panic_error" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../unrecoverable_panic_error</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/recoverable-error-handling">Error ➜ Recoverable Error & Error Handling</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-with-panic.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-with-panic.html</a></li><li><a href="https://doc.rust-lang.org/book/ch09-03-to-panic-or-not-to-panic.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch09-03-to-panic-or-not-to-panic.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/file-path-directory"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.53. File, Path, Directory</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/recoverable-error-handling"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.55. Error ➜ Recoverable Error & Error Handling</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a541-unrecoverable-error-runtime-error--compile-time-error" class="table-of-contents__link toc-highlight">A.54.1. Unrecoverable error (RUNTIME error & COMPILE-TIME error)</a><ul><li><a href="#-perbedaan-panic-saat-pengaksesan-vector-dan-error-saat-pengaksesan-array" class="table-of-contents__link toc-highlight">◉ Perbedaan panic saat pengaksesan vector dan error saat pengaksesan array</a></li></ul></li><li><a href="#a542-macro-panic" class="table-of-contents__link toc-highlight">A.54.2. Macro <code>panic!()</code></a><ul><li><a href="#-statement-iostdoutflush" class="table-of-contents__link toc-highlight">◉ Statement <code>io::stdout().flush()</code></a></li></ul></li><li><a href="#a543-kapan-harus-menggunakan-panic-error" class="table-of-contents__link toc-highlight">A.54.3. Kapan harus menggunakan panic error?</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/use.html b/basic/use.html index a291bd02..c61952c9 100644 --- a/basic/use.html +++ b/basic/use.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/use/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/use/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.29. Module System ➜ Use, Import, Re-export","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/use/#webpage"},"wordCount":522,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/use/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/use/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/use","name":"A.29. Module System ➜ Use, Import, Re-export","description":"Keyword use digunakan untuk dua hal, yaitu import path dan re-export path. Sebenarnya kita telah mempelajari kedua penerapan tersebut pada beberapa chapter sebelumnya. Pada chapter ini kita akan ulang lagi pembahasan agar lebih jelas.","datePublished":"2024-08-01T10:17:31.294Z","dateModified":"2024-08-01T10:17:31.294Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/use/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/use"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/use/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.29. Module System ➜ Use, Import, Re-export","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/use/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/use/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.29. Module System ➜ Use, Import, Re-export","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/use/#webpage"},"wordCount":522,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/use/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/use/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/use","name":"A.29. Module System ➜ Use, Import, Re-export","description":"Keyword use digunakan untuk dua hal, yaitu import path dan re-export path. Sebenarnya kita telah mempelajari kedua penerapan tersebut pada beberapa chapter sebelumnya. Pada chapter ini kita akan ulang lagi pembahasan agar lebih jelas.","datePublished":"2024-08-30T07:44:51.359Z","dateModified":"2024-08-30T07:44:51.359Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/use/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/use"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/use/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.29. Module System ➜ Use, Import, Re-export","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.29. Module System ➜ Use, Import, Re-export</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.29. Module System ➜ Use, Import, Re-export</h1></header><p>Keyword <code>use</code> digunakan untuk dua hal, yaitu <em>import</em> path dan <em>re-export</em> path. Sebenarnya kita telah mempelajari kedua penerapan tersebut pada beberapa chapter sebelumnya. Pada chapter ini kita akan ulang lagi pembahasan agar lebih jelas.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a291-keyword-use-untuk-import-path">A.29.1. Keyword <code>use</code> untuk import path<a class="hash-link" href="#a291-keyword-use-untuk-import-path" title="Direct link to heading">​</a></h2><p>Untuk bisa menggunakan sebuah item dari crate lain, entah itu dari rust standard library crate maupun 3rd-party, caranya cukup dengan menuliskan path item. Contohnya bisa dilihat di bawah ini, fungsi <code>current_dir</code> digunakan untuk mengambil path dari current directory. Fungsi tersebut merupakan item dari module <code>std::env</code>, maka untuk mengaksesnya kita harus menuliskan path secara lengkap.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> package_path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">env</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">current_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"package_path: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> package_path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Selain cara di atas, bisa juga gunakan keyword <code>use</code> untuk meng-import fungsi <code>current_dir</code> ke kode program, dengannya kita tidak perlu menulis path secara lengkap. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">env</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">current_dir</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> package_path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">current_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"package_path: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> package_path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Rust use" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAzIAAABoCAIAAAClqlJ2AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d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pluk58O/h5E1qEemmVpeb2/6c67pmlFO1RHnqYPXasjQNO80lQkBWM/2ZZswvv5uRuxA437O1IrblF8qyqA/Ihgu6Veq4zRep5Y0b3vnzDFJ/ysuFYuVAY2bHWyR3c+jOoGM6FgXYUyL+gVwaxHjOWpd7ep3jlqkP5FmvM2+u0nOf1ryg1jSGs2huJ9vGX6m7bDjTb1+d5Z75APSbrpb7YRk9GVmW/7gJtzp8Ndy02S6H6cEiL5f7MK0CrCxntlljJ1lmFbyQZs2fa70pK61mbQOXLkApd+mpCpb7NgmOOzRFkfyyTK3YMhoumvT7MpZeFCnz9eUGnWmQemv8yPaOpBnlgfqWWdJDys1hdAbr3jR2NuTVzMJnDOTaSvLJUJvMr/Q6yyC+gVz2usLNVdgaRmteUmtKe6a7tY0a2bKs8pz/8cPen75qRJhpuvJQflhG1jzxj1MTZ+5JzP0Qy3pmGenxXxKzGY/75uNTfO/yBTfH6RbpXJ4MdDBa8wm35v4Nd9Gv/L9wWbZoJdbTlGUAZ8C5PBmA1qThAFm2+IYtulNFrAF6J8BTHQ98TwagNWk48GqG07faTzQdAAAAALIMAAAAAJBlAAAAAMgyAAAAAECWAQAAACDLAAAAAABZBgAAAIAsAwAAAABkGQAAAMA58H8pfi2iZk6HKQAAAABJRU5ErkJggg==" width="818" height="104" class="img_ev3q"></p><blockquote><p>Di contoh, pengaksesan current directory di-chain dengan method <code>unwrap</code> karena nilai balik fungsi <code>current_dir</code> adalah bertipe <code>std::io::Result</code>.</p><p>Lebih jelasnya mengenai tipe tersebut dibahas pada chapter terpisah, <a href="/basic/result-type">Tipe Data ➜ Result</a></p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-import-items-dari-module-yang-sama">◉ Import items dari module yang sama<a class="hash-link" href="#-import-items-dari-module-yang-sama" title="Direct link to heading">​</a></h3><p>Pada contoh selanjutnya ini, kita akan coba praktikkan penerapan fungsi <code>std::env::args</code> untuk mengambil <em>argument</em> saat eksekusi program, kemudian menampilkannya ke layar.</p><p>Ok, berarti akan ada 2 path yang akan di-import:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">env</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">current_dir</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">env</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">args</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ada notasi penulisan import path lainnya yang bisa digunakan jika path-nya memiliki parent segment yang sama. Contohnya seperti di atas, kedua fungsi tersebut memiliki parent segment path yang sama yaitu <code>std::env</code>. Yang seperti ini bisa dituliskan juga dengan notasi penulisan import berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">env</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">current_dir</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> args</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ok, lanjut ke praktik. Silakan tulis kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">env</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">current_dir</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> args</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> package_path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">current_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"package_path: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> package_path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token function" style="color:#d73a49">args</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> each_arg </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">args</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">nth</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">i</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> each_arg </span><span class="token operator" style="color:#393A34">!=</span><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"arg{}: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> i</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> each_arg</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>std::env::args</code> digunakan untuk mengambil argument eksekusi program baik eksekusi via <code>cargo run</code> ataupun via pemanggilan binary. Fungsi tersebut nilai baliknya adalah iterator, jadi bisa digunakan dalam blok kode <code>for in</code> dengan mudah.</p><p>Statement <code>args().nth(i)</code> mengembalikan nilai argument pada index ke-<code>i</code> dalam tipe <code>Option</code>, dan nilai tersebut bisa saja tidak ada (direpresentasikan dengan keyword <code>None</code>). Oleh karena itu penting untuk dicek terlebih dahulu menggunakan keyword <code>if</code>. Jika memang nilainya adalah selain <code>None</code>, gunakan <code>unwrap</code> untuk mengambil nilainya dalam tipe data <code>String</code>.</p><blockquote><ul><li>Lebih jelasnya mengenai Iterator akan dibahas pada chapter terpisah, <a href="/basic/trait-iterator">Trait ➜ Iterator</a>.</li><li>Lebih jelasnya mengenai tipe <code>Option</code> akan dibahas pada chapter terpisah, <a href="/basic/option-type">Tipe Data ➜ Option</a>.</li></ul></blockquote><p>Silakan coba jalankan menggunakan dua command, yang pertama <code>cargo run</code>, kemudian <code>cargo run tulis argumen di sini dengan pembatas spasi</code>.</p><p>Bisa dilihat pada gambar berikut, jika ada argument disisipkan dalam eksekusi program, maka ditampilkan. Pada gambar berikut dicontohkan argument yang dipakai adalah <code>hello</code> dan <code>world</code>.</p><p><img loading="lazy" alt="Rust use" src="/assets/images/use-2-14040eb5ebbc4bd6148eec31b7d9f2e7.png" width="793" height="223" class="img_ev3q"></p><blockquote><p>Lebih jelasnya mengenai Iterator dibahas pada chapter terpisah, <a href="/basic/trait-iterator">Trait ➜ Iterator</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a292-keyword-use-untuk-re-export-path">A.29.2. Keyword <code>use</code> untuk re-export path<a class="hash-link" href="#a292-keyword-use-untuk-re-export-path" title="Direct link to heading">​</a></h2><p>Re-export item adalah sebuah cara untuk mem-<em>bypass</em> pengaksesan item yang secara hirarki memang tidak bisa diakses dari luar module (bisa jadi karena visibility item ataupun parent module nya adalah private). Dengan teknik ini, maka item pasti bisa diakses dari luar module.</p><p>Item yang di-re-export akan menjadi item milik <em>current module</em> di mana statement re-export tersebut ditulis.</p><p>Keyword <code>pub use</code> digunakan untuk operasi re-export. Notasi penulisannya bisa dilihat di bawah ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// pub use the_path</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">sub_module</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">say_hello_message</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// pub use the_path as exported_name;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">sub_module</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">say_hello_message </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> say_hello</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh penerapan bisa dilihat pada kode berikut. Submodule <code>sub_module</code> milik module <code>messaging</code> adalah private module, yang di dalamnya ada item dengan visibility publik.</p><p>Agar <code>say_hello_message</code> tidak bisa diakses dari <em>crate root</em> karena <code>sub_module</code> yang merupakan module scope item tersebut adalah private. Agar item tersebut bisa diakses dari publik, maka bisa dengan menggunakan teknik <em>re-export</em>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/messaging.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">sub_module</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">say_hello_message</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">sub_module</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">messaging</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">messaging</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Visibility &amp; Privacy" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdIAAABtCAIAAACa6Xd1AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG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2m1LnOHhpiP2OBVqQSF7639DKoQS73o2/g+XZUIcRRexPZu2PD8XfNxiossS2pVWwsNGHQ2ueuqcm6rTKuWMlZqMxWNiN0a7PVG2Ed7x02eT+nihC+ySTh9ofZHDe6gKNQz37aH/bbBKIvHuUElHEukwJWyOqbyuybFr9vSctMKmU+NIuPRUCB8OmySLREff8w0O3HNAFFw0Kq5gcPbYkNInTkG7xyKJ5zZRjnFbb3usq6u93eaGp563s7XiaUkNK21uZpF2T4roE5ad57sj7R6gq33T9Vy/rfXSrvvcGEHarQ9xkGFHzgWLwHqn0VnquUIbRZhe4lja9deTvEzaJQiCIO0SBEEQpF2CIAjSLkEQBEHaJQiCIO0SBEEQpF2CIAjSLkEQBGlX4PvvP3//++VO2iG4AV4kCIIg7a5Au8YNxbmsh1///f3z+zu7nCAI0i5plyAI0q7Koi/clUQKpuBBwqc+2h0z/GuTYkeaY2FtHlFmwY+gSu2l8DcDHQRBnIl2B2ps/t39q2HNgOxC5nTQbnhLm7/Ohj09j3T757dGu5pDTW+XIIgTBxmGHy9UFjBcTGx52g04OxuAaNKOmbcpLdpF+ZB2CYI4P+3K1Xsp7WbdY4s0tSDDFLkIbyHtEgRxG7SrEmWxt5v8XEC70EUm7RIEcQNBBisg64jthrSYhoadtNtf7PzbtLgoz0wBBEEQZ6DdS3JMoKU1EXqApwn624OTDObpAuyrjrn++f0rfBLgPNVDFwRBEBXSLkEQBEHaJQiCIO0SBEEQpF2CIAjSLkEQBGmXIAiCIO0SBEGQdgmCIAjSLkEQBGmXIAiCIO0SBEGQdgmCIEi7BEEQxCb4HzjE/yVJRbnzAAAAAElFTkSuQmCC" width="466" height="109" class="img_ev3q"></p><p>Bisa dilihat item <code>say_hello_message</code> sekarang bisa diakses dari fungsi <code>main</code> via path <code>messaging::say_hello_message</code> setelah di-re-export.</p><p>O iya, jika suatu item ingin di-re-export dengan nama berbeda, tambahkan keyword <code>as</code> diikuti alias atau nama item export. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/messaging.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">sub_module</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">say_hello_message </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> say_hello</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">sub_module</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">messaging</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">messaging</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/use" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../use</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/std/keyword.use.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.use.html</a></li><li><a href="https://doc.rust-lang.org/reference/items/use-declarations.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/items/use-declarations.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/visibility-privacy"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.28. Module System ➜ Visibility & Privacy</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/block-expression"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.30. Block Expression</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a291-keyword-use-untuk-import-path" class="table-of-contents__link toc-highlight">A.29.1. Keyword <code>use</code> untuk import path</a><ul><li><a href="#-import-items-dari-module-yang-sama" class="table-of-contents__link toc-highlight">◉ Import items dari module yang sama</a></li></ul></li><li><a href="#a292-keyword-use-untuk-re-export-path" class="table-of-contents__link toc-highlight">A.29.2. Keyword <code>use</code> untuk re-export path</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.29. Module System ➜ Use, Import, Re-export</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.29. Module System ➜ Use, Import, Re-export</h1></header><p>Keyword <code>use</code> digunakan untuk dua hal, yaitu <em>import</em> path dan <em>re-export</em> path. Sebenarnya kita telah mempelajari kedua penerapan tersebut pada beberapa chapter sebelumnya. Pada chapter ini kita akan ulang lagi pembahasan agar lebih jelas.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a291-keyword-use-untuk-import-path">A.29.1. Keyword <code>use</code> untuk import path<a class="hash-link" href="#a291-keyword-use-untuk-import-path" title="Direct link to heading">​</a></h2><p>Untuk bisa menggunakan sebuah item dari crate lain, entah itu dari rust standard library crate maupun 3rd-party, caranya cukup dengan menuliskan path item. Contohnya bisa dilihat di bawah ini, fungsi <code>current_dir</code> digunakan untuk mengambil path dari current directory. Fungsi tersebut merupakan item dari module <code>std::env</code>, maka untuk mengaksesnya kita harus menuliskan path secara lengkap.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> package_path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">env</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">current_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"package_path: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> package_path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Selain cara di atas, bisa juga gunakan keyword <code>use</code> untuk meng-import fungsi <code>current_dir</code> ke kode program, dengannya kita tidak perlu menulis path secara lengkap. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">env</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">current_dir</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> package_path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">current_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"package_path: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> package_path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="Rust use" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAzIAAABoCAIAAAClqlJ2AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG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Y07TCXH/ko8p9GoeMhWh/lqoK/nI8jy5zbOur+XP38qzVH7SpX7vIxrfNRRVomy7LFVjt6y7JfFtXmcI1w3WCWZaQD9S0zq418zaE7g3lvuqppTSr4B3LVHOLJoIvk7XWeW2bZQC5LUujotObFtmYW50uyqNRXd7e3rD6qzR8R/Kar5X5YRk9Pluk58O/h5E1qEemmVpeb2/6c67pmlFO1RHnqYPXasjQNO80lQkBWM/2ZZswvv5uRuxA437O1IrblF8qyqA/Ihgu6Veq4zRep5Y0b3vnzDFJ/ysuFYuVAY2bHWyR3c+jOoGM6FgXYUyL+gVwaxHjOWpd7ep3jlqkP5FmvM2+u0nOf1ryg1jSGs2huJ9vGX6m7bDjTb1+d5Z75APSbrpb7YRk9GVmW/7gJtzp8Ndy02S6H6cEiL5f7MK0CrCxntlljJ1lmFbyQZs2fa70pK61mbQOXLkApd+mpCpb7NgmOOzRFkfyyTK3YMhoumvT7MpZeFCnz9eUGnWmQemv8yPaOpBnlgfqWWdJDys1hdAbr3jR2NuTVzMJnDOTaSvLJUJvMr/Q6yyC+gVz2usLNVdgaRmteUmtKe6a7tY0a2bKs8pz/8cPen75qRJhpuvJQflhG1jzxj1MTZ+5JzP0Qy3pmGenxXxKzGY/75uNTfO/yBTfH6RbpXJ4MdDBa8wm35v4Nd9Gv/L9wWbZoJdbTlGUAZ8C5PBmA1qThAFm2+IYtulNFrAF6J8BTHQ98TwagNWk48GqG07faTzQdAAAAALIMAAAAAJBlAAAAAMgyAAAAAECWAQAAACDLAAAAAABZBgAAAIAsAwAAAABkGQAAAMA58H8pfi2iZk6HKQAAAABJRU5ErkJggg==" width="818" height="104" class="img_CujE"></p><blockquote><p>Di contoh, pengaksesan current directory di-chain dengan method <code>unwrap</code> karena nilai balik fungsi <code>current_dir</code> adalah bertipe <code>std::io::Result</code>.</p><p>Lebih jelasnya mengenai tipe tersebut dibahas pada chapter terpisah, <a href="/basic/result-type">Tipe Data ➜ Result</a></p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-import-items-dari-module-yang-sama">◉ Import items dari module yang sama<a class="hash-link" href="#-import-items-dari-module-yang-sama" title="Direct link to heading">​</a></h3><p>Pada contoh selanjutnya ini, kita akan coba praktikkan penerapan fungsi <code>std::env::args</code> untuk mengambil <em>argument</em> saat eksekusi program, kemudian menampilkannya ke layar.</p><p>Ok, berarti akan ada 2 path yang akan di-import:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">env</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">current_dir</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">env</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">args</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ada notasi penulisan import path lainnya yang bisa digunakan jika path-nya memiliki parent segment yang sama. Contohnya seperti di atas, kedua fungsi tersebut memiliki parent segment path yang sama yaitu <code>std::env</code>. Yang seperti ini bisa dituliskan juga dengan notasi penulisan import berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">env</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">current_dir</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> args</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ok, lanjut ke praktik. Silakan tulis kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">env</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">current_dir</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> args</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> package_path </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">current_dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"package_path: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> package_path</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">..=</span><span class="token function" style="color:#d73a49">args</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> each_arg </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">args</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">nth</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">i</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> each_arg </span><span class="token operator" style="color:#393A34">!=</span><span class="token plain"> </span><span class="token class-name">None</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"arg{}: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> i</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> each_arg</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">unwrap</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Fungsi <code>std::env::args</code> digunakan untuk mengambil argument eksekusi program baik eksekusi via <code>cargo run</code> ataupun via pemanggilan binary. Fungsi tersebut nilai baliknya adalah iterator, jadi bisa digunakan dalam blok kode <code>for in</code> dengan mudah.</p><p>Statement <code>args().nth(i)</code> mengembalikan nilai argument pada index ke-<code>i</code> dalam tipe <code>Option</code>, dan nilai tersebut bisa saja tidak ada (direpresentasikan dengan keyword <code>None</code>). Oleh karena itu penting untuk dicek terlebih dahulu menggunakan keyword <code>if</code>. Jika memang nilainya adalah selain <code>None</code>, gunakan <code>unwrap</code> untuk mengambil nilainya dalam tipe data <code>String</code>.</p><blockquote><ul><li>Lebih jelasnya mengenai Iterator akan dibahas pada chapter terpisah, <a href="/basic/trait-iterator">Trait ➜ Iterator</a>.</li><li>Lebih jelasnya mengenai tipe <code>Option</code> akan dibahas pada chapter terpisah, <a href="/basic/option-type">Tipe Data ➜ Option</a>.</li></ul></blockquote><p>Silakan coba jalankan menggunakan dua command, yang pertama <code>cargo run</code>, kemudian <code>cargo run tulis argumen di sini dengan pembatas spasi</code>.</p><p>Bisa dilihat pada gambar berikut, jika ada argument disisipkan dalam eksekusi program, maka ditampilkan. Pada gambar berikut dicontohkan argument yang dipakai adalah <code>hello</code> dan <code>world</code>.</p><p><img loading="lazy" alt="Rust use" src="/assets/images/use-2-14040eb5ebbc4bd6148eec31b7d9f2e7.png" width="793" height="223" class="img_CujE"></p><blockquote><p>Lebih jelasnya mengenai Iterator dibahas pada chapter terpisah, <a href="/basic/trait-iterator">Trait ➜ Iterator</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a292-keyword-use-untuk-re-export-path">A.29.2. Keyword <code>use</code> untuk re-export path<a class="hash-link" href="#a292-keyword-use-untuk-re-export-path" title="Direct link to heading">​</a></h2><p>Re-export item adalah sebuah cara untuk mem-<em>bypass</em> pengaksesan item yang secara hirarki memang tidak bisa diakses dari luar module (bisa jadi karena visibility item ataupun parent module nya adalah private). Dengan teknik ini, maka item pasti bisa diakses dari luar module.</p><p>Item yang di-re-export akan menjadi item milik <em>current module</em> di mana statement re-export tersebut ditulis.</p><p>Keyword <code>pub use</code> digunakan untuk operasi re-export. Notasi penulisannya bisa dilihat di bawah ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// pub use the_path</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">sub_module</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">say_hello_message</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// pub use the_path as exported_name;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">sub_module</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">say_hello_message </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> say_hello</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh penerapan bisa dilihat pada kode berikut. Submodule <code>sub_module</code> milik module <code>messaging</code> adalah private module, yang di dalamnya ada item dengan visibility publik.</p><p>Agar <code>say_hello_message</code> tidak bisa diakses dari <em>crate root</em> karena <code>sub_module</code> yang merupakan module scope item tersebut adalah private. Agar item tersebut bisa diakses dari publik, maka bisa dengan menggunakan teknik <em>re-export</em>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/messaging.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">sub_module</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">say_hello_message</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">sub_module</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">messaging</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">messaging</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Visibility &amp; Privacy" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdIAAABtCAIAAACa6Xd1AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF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_CujE"></p><p>Bisa dilihat item <code>say_hello_message</code> sekarang bisa diakses dari fungsi <code>main</code> via path <code>messaging::say_hello_message</code> setelah di-re-export.</p><p>O iya, jika suatu item ingin di-re-export dengan nama berbeda, tambahkan keyword <code>as</code> diikuti alias atau nama item export. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/messaging.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">sub_module</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">say_hello_message </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> say_hello</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">sub_module</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello_message</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">messaging</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">messaging</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/use" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../use</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/std/keyword.use.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/keyword.use.html</a></li><li><a href="https://doc.rust-lang.org/reference/items/use-declarations.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/items/use-declarations.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/visibility-privacy"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.28. Module System ➜ Visibility & Privacy</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/block-expression"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.30. Block Expression</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a291-keyword-use-untuk-import-path" class="table-of-contents__link toc-highlight">A.29.1. Keyword <code>use</code> untuk import path</a><ul><li><a href="#-import-items-dari-module-yang-sama" class="table-of-contents__link toc-highlight">◉ Import items dari module yang sama</a></li></ul></li><li><a href="#a292-keyword-use-untuk-re-export-path" class="table-of-contents__link toc-highlight">A.29.2. Keyword <code>use</code> untuk re-export path</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/variabel.html b/basic/variabel.html index 5091f25b..5bcc5da0 100644 --- a/basic/variabel.html +++ b/basic/variabel.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/variabel/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/variabel/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.4. Variabel","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/variabel/#webpage"},"wordCount":986,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/variabel/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/variabel/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/variabel","name":"A.4. Variabel","description":"Rust merupakan bahasa yang kalau dikategorikan berdasarkan type system-nya adalah statically typed, yang artinya semua tipe data harus diketahui saat kompilasi (compile time).","datePublished":"2024-08-01T10:17:31.364Z","dateModified":"2024-08-01T10:17:31.364Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/variabel/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/variabel"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/variabel/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.4. Variabel","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/variabel/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/variabel/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.4. Variabel","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/variabel/#webpage"},"wordCount":986,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/variabel/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/variabel/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/variabel","name":"A.4. Variabel","description":"Rust merupakan bahasa yang kalau dikategorikan berdasarkan type system-nya adalah statically typed, yang artinya semua tipe data harus diketahui saat kompilasi (compile time).","datePublished":"2024-08-30T07:44:51.428Z","dateModified":"2024-08-30T07:44:51.428Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/variabel/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/variabel"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/variabel/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.4. Variabel","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.4. Variabel</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.4. Variabel</h1></header><p>Rust merupakan bahasa yang kalau dikategorikan berdasarkan <em>type system</em>-nya adalah <em>statically typed</em>, yang artinya semua tipe data harus diketahui saat kompilasi (compile time).</p><p>Pada chapter ini kita akan belajar mengenai variabel pada Rust, cara deklarasinya, dan juga mengenai <em>immutability</em> variabel.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a41-deklarasi-variabel-menggunakan-let">A.4.1. Deklarasi variabel menggunakan <code>let</code><a class="hash-link" href="#a41-deklarasi-variabel-menggunakan-let" title="Direct link to heading">​</a></h2><p>Keyword <code>let</code> digunakan untuk deklarasi variabel. Notasinya kurang lebih seperti berikut. Di contoh ini sebuah variabel bernama <code>nama_variabel</code> didefinisikan dan diisi nilainya dengan sebuah string <code>"predefined value"</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> nama_variabel </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"predefined value"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">nama_variabel</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ok, sekarang coba jalankan, dan lanjut ke pembahasan di bawah.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-aturan-penamaan-variabel-naming-convention">◉ Aturan penamaan variabel (naming convention)<a class="hash-link" href="#-aturan-penamaan-variabel-naming-convention" title="Direct link to heading">​</a></h3><p><a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer"><em>Naming convention</em></a> variabel di Rust adalah <strong>snake case</strong>. Nama variabel dituliskan dalam huruf kecil dengan separator tanda garis bawah atau underscore (<code>_</code>). Contohnya seperti: <code>nama_variabel</code>, <code>hasil_operasi_pembagian</code>, <code>kota_kelahiran</code>, dll.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-macro-println-untuk-print-string">◉ Macro <code>println</code> untuk print string<a class="hash-link" href="#-macro-println-untuk-print-string" title="Direct link to heading">​</a></h3><p><img loading="lazy" alt="variabel rust" src="/assets/images/variabel-1-c9d8201d5914e2a0da75b23e92fa5bb9.png" width="455" height="228" class="img_ev3q"></p><p>Error? kok bisa?</p><p>Perlu diketahui bahwa pada penggunaan macro <code>println</code>, parameter pertama wajib diisi dengan sebuah <strong>string literal</strong>. Contohnya seperti <code>"Hello, world!"</code>. String literal yang ditampung terlebih dahulu dalam variabel, kemudian variabel-nya di print, akan menghasilkan error, contohnya seperti di atas.</p><p>Solusinya bagaimana? ya tetap menggunakan string literal, tapi dengan menerapkan teknik <strong>formatted print</strong>.</p><p>Sekarang ubah kode menjadi seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> nama_variabel </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"predefined value"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> nama_variabel</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat argument pertama statement macro <code>println</code> adalah string literal <code>"{}"</code>. String <code>{}</code> pada macro tersebut akan di-replace dengan isi argument setelahnya, yaitu <code>nama_variabel</code>.</p><p>Jika dijalankan, maka hasilnya tidak ada error dan menampilkan output sesuai harapan.</p><p><img loading="lazy" alt="string literal println" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdkAAACJCAIAAADv3NUWAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Im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tSbYwCQRAEaTyomYkgCKI/6IsRBEH0B30xgiCI/qAvRhAE0R/0xQiCIPqDvhhBEER/0BcjCILoD/piBEEQ/UFfjCAIoj/oixEEQfQHfTGCIIj+oC9GEATRH/TFCIIg+oO+GEEQRH/+H2UfGUkdQSlBAAAAAElFTkSuQmCC" width="473" height="137" class="img_ev3q"></p><p>Ok sekarang kembali ke topik, yaitu perihal variabel.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a42-immutability-pada-variabel">A.4.2. <em>Immutability</em> pada variabel<a class="hash-link" href="#a42-immutability-pada-variabel" title="Direct link to heading">​</a></h2><p>Tulis kode berikut. Ada 2 variabel yang dideklarasikan, <code>message_number</code> yang isinya numerik, dan <code>message1</code> yang isinya string.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan, hasilnya tidak ada error, aman.</p><p><img loading="lazy" alt="var immutability" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdMAAAB3CAIAAADXZj22AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NP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iDshjwvQRCE3ZDnJQiCsBvyvARBEHZDnpcgCMJuyPMSBEHYDXlegiAIuyHPSxAEYTfkeQmCIOzm/wF5FHFxmUMOjwAAAABJRU5ErkJggg==" width="467" height="119" class="img_ev3q"></p><blockquote><p>O iya, jika ingin menampilkan banyak variabel via macro <code>println</code>, manfaatkan string <code>{}</code>.</p><p>Tulis <code>{}</code> sejumlah variabel yang ingin ditampilkan, pada output string <code>{}</code> akan di-replace oleh variabel yang disisipkan pada argument saat pemanggilan macro <code>println</code> secara berurutan.</p><p>Pada contoh di atas, string <code>"message number {}: {}"</code><br> ... akan menjadi <code>"message number {message_number}: {message1}"</code><br> ... kemudian menghasilkan <code>"message number 1: hello"</code></p></blockquote><p>Sekarang ubah isi <code>message_number</code> menjadi <code>2</code> lalu siapkan juga variabel <code>message2</code>, kurang lebih kodenya menjadi seperti berikut, kemudian jalankan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"world"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="var immutability" src="/assets/images/variabel-4-11c9b8e77e4ddf88a314c0b480337a42.png" width="585" height="308" class="img_ev3q"></p><p>Error? kok bisa?</p><p>Perlu diketahui, bahwa <em>by default</em> semua variabel adalah <em>immutable</em>. Immutable itu artinya gak bisa diubah nilai/value-nya. Jadi mirip seperti konstanta.</p><blockquote><p>Variabel immutable mirip seperti konstanta, tapi sebenarnya berbeda. Akan kita bahas lebih detail di beberapa chapter berbeda perihal perbedaannya.</p></blockquote><p>Lalu bagaimana cara agar nilai variabel bisa diubah? Caranya dengan menambahkan keyword <code>mut</code> (yang merupakan kependekan dari <em>mutable</em>) saat pendefinisian variabel tersebut.</p><blockquote><p>Catatan tambahan:</p><ul><li><p>Operasi assignment pada variabel immutable hanya boleh dilakukan sekali. Dan pada kode di atas telah dicontohkan caranya bagaimana. Variabel dideklarasikan sekaligus diisi nilainya.</p></li><li><p>Perlu diketahui bahwa sebenarnya diperbolehkan untuk memecah statement deklarasi variable dan assignment nilai sebagai 2 statement terpisah. Lebih jelasnya dibahas setelah ini pada section <a href="/basic/variabel#a45-deklarasi-variabel-tanpa-predefined-value">section A.4.5</a>.</p></li></ul></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a43-keyword-mut">A.4.3. Keyword <code>mut</code><a class="hash-link" href="#a43-keyword-mut" title="Direct link to heading">​</a></h2><p>Ok, mari kita coba, ubah statement deklarasi variabel <code>message_number</code>, tambahkan keyword <code>mut</code>. Lalu jalankan ulang program.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"world"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="mut keyword" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdYAAACECAIAAACiSZ1FAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXa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uSlao1i6NxWFmAoprvEddA9DUXLdMRR5BECOgZDsF5km2x2dvphngF6iGyD1fS09EZnyBavaej52JVwO1KoAPNdcR5ECDku1tMU2yXfC/aslNWsn2sTEo3MsVqoEJ1udZe96t5nru+ZoQFYrP3pQ++kQQpDegZLsmZku2z7CMB3i19g7yF6q1KSaSn5+DHBSupplaPguQo9Zcj5Ml2+9M8FYu3pnPX7pK3RkEQUzBrkppKNmOIMgRwK6vZqBkO4IgRwC7roJRsh1BkCOAfV0wgiDIoceugQgEQZAjALpgBEEQy0AXjCAIYhnoghEEQSwDXTCCIIhloAtGEASxDHTBCIIgloEuGEEQxDLQBSMIgljG/wO7RSAwVCeE9AAAAABJRU5ErkJggg==" width="470" height="132" class="img_ev3q"></p><p>Ok, sekarang tidak muncul error.</p><p>Dengan menggunakan keyword <code>let mut</code> pada pendefinisian <code>message_number</code>, membuat variabel tersebut menjadi mutable atau bisa diubah nilainya.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-argument-parameter-macro-println">◉ Argument parameter macro <code>println</code><a class="hash-link" href="#-argument-parameter-macro-println" title="Direct link to heading">​</a></h3><p>Selanjutnya, coba tambahkan lagi 1 message baru pada program yang sudah dibuat, lalu run.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"world"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message3</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i8</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {1}: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="formatted print macro `println`" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdYAAACaCAIAAACblf6uAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE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D+AMCQAcl2zR6ps3dRsl0+xXjBWxNaJyIeyXYlSsX3pQgcMABDCSTbuemaZHvtz8Hl1eTqTDsPz1SK70vxBVc6HoMDBmD4gGQ7N92TbJdJ3c1cExRi65w0KL4vzXnJTjXxSyKKJZMRqGkAMAxAsr3fku0KliKCXQqziK3hkGxvVnyvb7EQT98speMG4hkAADOBZHufJdtVfTe+mO9Q8R0AMFgMtlIaJNsBACeawX41A5LtAIATzWCvgiHZDgA40Qy6CwYAgBPMYAciAADgRAMXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApvH/zux74reEzOEAAAAASUVORK5CYII=" width="470" height="154" class="img_ev3q"></p><p>Jika dilihat ada yg berbeda pada cara deklarasi variabel <code>message3</code> dan juga pada statement <code>println</code> untuk <code>message3</code> yang di situ digunakan <code>{1}</code> dan <code>{0}</code>, tidak seperti sebelumnya yg menggunakan <code>{}</code>. Kita akan bahas yg ke-2 terlebih dahulu.</p><ul><li>Jika menggunakan <code>{}</code>, maka string akan di-replace sesuai urutan argument pada pemanggilan <code>println</code>.</li><li>Jika menggunakan <code>{0}</code>, maka string akan di-replace dengan data pada argument ke <code>1</code> pemanggilan fungsi <code>println</code>, yang pada contoh di atas adalah <code>message3</code>.</li><li>Jika menggunakan <code>{1}</code>, maka string akan di-replace dengan data pada argument ke <code>2</code> pemanggilan fungsi <code>println</code>, yang pada contoh di atas adalah <code>message_number</code>.</li><li>Jika menggunakan <code>{n}</code>, maka string akan di-replace dengan data pada argument ke <code>n+1</code> pemanggilan fungsi <code>println</code>.</li></ul><p>Dengan ini maka 3 statement berbeda berikut akan menghasilkan output yang sama:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {0}: {1}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {1}: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sekarang perihal perbedaan cara deklarasi <code>message3</code> akan kita bahas di bawah ini.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a44-type-inference-vs-manifest-typing">A.4.4. <em>Type Inference</em> vs <em>Manifest Typing</em><a class="hash-link" href="#a44-type-inference-vs-manifest-typing" title="Direct link to heading">​</a></h2><p>Rust mendukung dua metode deklarasi variabel, yaitu <em>type inference</em> dan <em>manifest typing</em>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-metode-type-inference">◉ Metode <em>Type Inference</em><a class="hash-link" href="#-metode-type-inference" title="Direct link to heading">​</a></h3><p>Penulisan variabel dengan metode ini ditandai dengan tidak menuliskan tipe data secara jelas/eksplisit. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> var1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello"</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// compiler akan secara cerdas mendeteksi var1 tipe data nya string</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> var2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// compiler akan secara cerdas mendeteksi var2 tipe data nya numerik</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Metode deklarasi yang selama ini sudah kita terapkan adalah <em>type inference</em>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-metode-manifest-typing">◉ Metode <em>Manifest Typing</em><a class="hash-link" href="#-metode-manifest-typing" title="Direct link to heading">​</a></h3><p>Metode ini mewajibkan programmer untuk menuliskan secara jelas/eksplisit tipe data variabel. Contoh penerapannya bisa dilihat di praktik sebelumnya, pada definisi variabel <code>message3</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message3</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i8</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Notasi penulisan tipe data adalah <code>namavariabel: tipedata</code>. Contoh seperti di atas, yaitu <code>let message3: i8 = 24</code> artinya variabel <code>message3</code> didefinisikan memiliki tipe data <code>i8</code>.</p><p><code>i8</code> merupakan salah satu tipe data dari sekian banyak tipe data yang ada di Rust. Lebih jelasnya kita akan bahas pada chapter selanjutnya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a45-deklarasi-variabel-tanpa-predefined-value">A.4.5. Deklarasi variabel tanpa <em>predefined value</em><a class="hash-link" href="#a45-deklarasi-variabel-tanpa-predefined-value" title="Direct link to heading">​</a></h2><p>Sesuai dengan penjelasan di <a href="https://doc.rust-lang.org/error-index.html#E0381" target="_blank" rel="noopener noreferrer">dokumentasi spesifikasi Rust</a>, variable yang tidak ada value-nya akan memunculkan error saat program di-run.</p><p>Meski demikian, diperbolehkan untuk memisahkan variable statement untuk deklarasi variable dan pengisian value. Sebagai contoh, statement <code>message_number</code> pada kode berikut ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... boleh dituliskan dalam 2 statement terpisah seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Intinya, operasi assignment hanya diperbolehkan 1x saja pada variabel <em>immutable</em>, baik itu saat deklarasi variable atau setelahnya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a46-deklarasi-banyak-variabel-dalam-satu-statement">A.4.6. Deklarasi banyak variabel dalam satu statement<a class="hash-link" href="#a46-deklarasi-banyak-variabel-dalam-satu-statement" title="Direct link to heading">​</a></h2><p>Di Rust memungkinkan untuk mendefinisikan banyak variabel dalam 1 baris statement. Notasi penulisannya seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">var1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"var1: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => var1: 24</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"var2: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => var2: hello</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pendefinisian banyak variabel dalam 1 statement dilakukan dengan menuliskan semua variabelnya dengan separator tanda <code>,</code> dan diapit tanda kurung <code>()</code>.</p><p>Sebagai contoh di atas 2 variabel didefinisikan, yaitu <code>var1</code> dan <code>var2</code>, dan keduanya memiliki value yang berbeda tipe-datanya.</p><p>Bisa juga saat definisi variabel sekaligus ditentukan tipe data variabel, notasi penulisan bisa dilihat pada contoh kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">var3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i8</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"var3: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => var3: 32</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"var4: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => var4: 12</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dengan notasi ini bisa juga untuk definisi variabel <em>mutable</em>. Cukup tambahkan keyword <code>mut</code> pada variabel yang ingin bisa diubah nilainya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">var5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> var6</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var7</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i8</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"var5: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => var5: 64</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"var6: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var6</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => var6: 12</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">var6 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"var6: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var6</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => var6: 24</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"var7: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var7</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => var7: 4</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a47-deklarasi-variabel-dengan-tipe-data-ditentukan-dari-value">A.4.7. Deklarasi variabel dengan tipe data ditentukan dari value<a class="hash-link" href="#a47-deklarasi-variabel-dengan-tipe-data-ditentukan-dari-value" title="Direct link to heading">​</a></h2><p>Ini merupakan salah satu alternatif cara penulisan untuk men-specify tipe data variabel, caranya dengan menuliskan tipe data tepat setelah value, contohnya seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24i8</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data1: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => data1: 24</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Variabel <code>data</code> didefinisikan dengan predefined value adalah numerik <code>24</code> dengan tipe data <code>i8</code>, penulisan value nya menjadi <code>24i8</code>.</p><p>Boleh juga menggunakan separator <code>_</code> dalam penulisan value-nya sebagai pembatas antara nilai dan tipe data, contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24_i8</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data1: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => data1: 24</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a48-variable-shadowing">A.4.8. Variable <em>Shadowing</em><a class="hash-link" href="#a48-variable-shadowing" title="Direct link to heading">​</a></h2><p>Di Rust ada konsep bernama <strong>variable shadowing</strong>. Shadowing sendiri adalah pendefinisan ulang variabel yang sebelumnya sudah didefinisikan. Biasanya teknik ini dipakai untuk isolasi variabel dalam sebuah blok kode.</p><p>Contoh shadowing bisa dilihat pada kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"x: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => x: 5</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"x: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => x: 6</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Lebih jelasnya akan kita bahas pada chapter terpisah, yaitu <a href="/basic/shadowing">Shadowing</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a49-variabel-_">A.4.9. Variabel <code>_</code><a class="hash-link" href="#a49-variabel-_" title="Direct link to heading">​</a></h2><p>Di Rust, jika ada variabel yang dideklarasikan tapi tidak digunakan, maka muncul warning saat ekesekusi program.</p><p>Pada praktiknya, tidak semua variabel memang perlu untuk digunakan. Pada kasus tertentu suatu variabel harus tetap dideklarasikan untuk menampung suatu nilai meski tidak digunakan. Misalnya pada case dimana ada pemanggilan fungsi yang nilai baliknya tidak digunakan.</p><p>Untuk case seperti yang dijelaskan di atas, gunakan variabel <code>_</code>. Variabel ini berguna untuk menampung nilai yang tidak digunakan, untuk menghindari warning. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">run_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-work-in-progress">◉ Work in progress<a class="hash-link" href="#-work-in-progress" title="Direct link to heading">​</a></h3><ul><li>Variabel <code>_</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/variabel" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../variabel</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/shadowing">Shadowing</a></li><li><a href="#/wip/macro">Macro</a></li><li><a href="#/wip/formatted-print">Formatted Print</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/hello/print.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/hello/print.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/variable_bindings/scope.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/variable_bindings/scope.html</a></li><li><a href="https://doc.rust-lang.org/reference/variables.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/variables.html</a></li><li><a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">https://rust-lang.github.io/api-guidelines/naming.html</a></li><li><a href="https://stackoverflow.com/questions/38045700/how-do-i-declare-multiple-mutable-variables-at-the-same-time" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/38045700/how-do-i-declare-multiple-mutable-variables-at-the-same-time</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/komentar"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.3. Komentar</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/tipe-data-primitive-scalar"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.5. Tipe Data ➜ Primitive Scalar</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a41-deklarasi-variabel-menggunakan-let" class="table-of-contents__link toc-highlight">A.4.1. Deklarasi variabel menggunakan <code>let</code></a><ul><li><a href="#-aturan-penamaan-variabel-naming-convention" class="table-of-contents__link toc-highlight">◉ Aturan penamaan variabel (naming convention)</a></li><li><a href="#-macro-println-untuk-print-string" class="table-of-contents__link toc-highlight">◉ Macro <code>println</code> untuk print string</a></li></ul></li><li><a href="#a42-immutability-pada-variabel" class="table-of-contents__link toc-highlight">A.4.2. <em>Immutability</em> pada variabel</a></li><li><a href="#a43-keyword-mut" class="table-of-contents__link toc-highlight">A.4.3. Keyword <code>mut</code></a><ul><li><a href="#-argument-parameter-macro-println" class="table-of-contents__link toc-highlight">◉ Argument parameter macro <code>println</code></a></li></ul></li><li><a href="#a44-type-inference-vs-manifest-typing" class="table-of-contents__link toc-highlight">A.4.4. <em>Type Inference</em> vs <em>Manifest Typing</em></a><ul><li><a href="#-metode-type-inference" class="table-of-contents__link toc-highlight">◉ Metode <em>Type Inference</em></a></li><li><a href="#-metode-manifest-typing" class="table-of-contents__link toc-highlight">◉ Metode <em>Manifest Typing</em></a></li></ul></li><li><a href="#a45-deklarasi-variabel-tanpa-predefined-value" class="table-of-contents__link toc-highlight">A.4.5. Deklarasi variabel tanpa <em>predefined value</em></a></li><li><a href="#a46-deklarasi-banyak-variabel-dalam-satu-statement" class="table-of-contents__link toc-highlight">A.4.6. Deklarasi banyak variabel dalam satu statement</a></li><li><a href="#a47-deklarasi-variabel-dengan-tipe-data-ditentukan-dari-value" class="table-of-contents__link toc-highlight">A.4.7. Deklarasi variabel dengan tipe data ditentukan dari value</a></li><li><a href="#a48-variable-shadowing" class="table-of-contents__link toc-highlight">A.4.8. Variable <em>Shadowing</em></a></li><li><a href="#a49-variabel-_" class="table-of-contents__link toc-highlight">A.4.9. Variabel <code>_</code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-work-in-progress" class="table-of-contents__link toc-highlight">◉ Work in progress</a></li><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.4. Variabel</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.4. Variabel</h1></header><p>Rust merupakan bahasa yang kalau dikategorikan berdasarkan <em>type system</em>-nya adalah <em>statically typed</em>, yang artinya semua tipe data harus diketahui saat kompilasi (compile time).</p><p>Pada chapter ini kita akan belajar mengenai variabel pada Rust, cara deklarasinya, dan juga mengenai <em>immutability</em> variabel.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a41-deklarasi-variabel-menggunakan-let">A.4.1. Deklarasi variabel menggunakan <code>let</code><a class="hash-link" href="#a41-deklarasi-variabel-menggunakan-let" title="Direct link to heading">​</a></h2><p>Keyword <code>let</code> digunakan untuk deklarasi variabel. Notasinya kurang lebih seperti berikut. Di contoh ini sebuah variabel bernama <code>nama_variabel</code> didefinisikan dan diisi nilainya dengan sebuah string <code>"predefined value"</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> nama_variabel </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"predefined value"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">nama_variabel</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Ok, sekarang coba jalankan, dan lanjut ke pembahasan di bawah.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-aturan-penamaan-variabel-naming-convention">◉ Aturan penamaan variabel (naming convention)<a class="hash-link" href="#-aturan-penamaan-variabel-naming-convention" title="Direct link to heading">​</a></h3><p><a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer"><em>Naming convention</em></a> variabel di Rust adalah <strong>snake case</strong>. Nama variabel dituliskan dalam huruf kecil dengan separator tanda garis bawah atau underscore (<code>_</code>). Contohnya seperti: <code>nama_variabel</code>, <code>hasil_operasi_pembagian</code>, <code>kota_kelahiran</code>, dll.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-macro-println-untuk-print-string">◉ Macro <code>println</code> untuk print string<a class="hash-link" href="#-macro-println-untuk-print-string" title="Direct link to heading">​</a></h3><p><img loading="eager" fetchpriority="high" alt="variabel rust" src="/assets/images/variabel-1-c9d8201d5914e2a0da75b23e92fa5bb9.png" width="455" height="228" class="img_CujE"></p><p>Error? kok bisa?</p><p>Perlu diketahui bahwa pada penggunaan macro <code>println</code>, parameter pertama wajib diisi dengan sebuah <strong>string literal</strong>. Contohnya seperti <code>"Hello, world!"</code>. String literal yang ditampung terlebih dahulu dalam variabel, kemudian variabel-nya di print, akan menghasilkan error, contohnya seperti di atas.</p><p>Solusinya bagaimana? ya tetap menggunakan string literal, tapi dengan menerapkan teknik <strong>formatted print</strong>.</p><p>Sekarang ubah kode menjadi seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> nama_variabel </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"predefined value"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> nama_variabel</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Bisa dilihat argument pertama statement macro <code>println</code> adalah string literal <code>"{}"</code>. String <code>{}</code> pada macro tersebut akan di-replace dengan isi argument setelahnya, yaitu <code>nama_variabel</code>.</p><p>Jika dijalankan, maka hasilnya tidak ada error dan menampilkan output sesuai harapan.</p><p><img loading="lazy" alt="string literal println" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdkAAACJCAIAAADv3NUWAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMDctMjdU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O7GBDLvZRQl3BFu9/SuovD1sdf5N5VesiNcZznmZbPpB5Oi0PKNxbBrkJYYsgbLNxbFYaYfTOZlMyBIHdR9G2u18+nO0tEHglsR965OcAtbWh61iMDIAO2R9NTd5tyD6FXeGY+MeiD6CT83WYQDINbSISnQdsG73t0f//lHRSHRdRLjpO2P5TuLcVP5FFDX112KEuOm0byo9JIHXhzY2wEcpBOpe0WmU1EAD/lvZTHRkesqrTQjekrfOwnRGY8MFF3xxNQkC5Gp4A0xSGGve0jVQ7kL3gnsNHCbXD9dkS5DVrbBhAx0fYuuE0EE6lniE1Nj7nRkao7oi+ceRK9OFqPJYuGLtUmWv/UfuX57zA3piMqRdULfu2YTVwcmRj1rD66UAglrL+YAAEauX2Wt2vti58AIwBxMTE3yR9Y9zdcDr7f+YWvrH7dqq14VlK7T9IPpwPfKJUS82UcQRJtafHHxTlvrUQKYu3EFrt+eLN6UpyNTV27cmrw3NM1Xj92bioxeVT2S2Kw0RjA2PT0GsXvByWh9vasyd+NBcHqMjd27IRTcmo6MToq/JEYiadauNqRbNz4ZvT05OT09CenIvUh6zF7VNMkceHGg9196D//74cz7mcz5TOb9jEZswbxs7rnXU96C6f+UXhJdJ4K0AwaGYao5Xva0FqIvu6d3s77szt/uZH3KpxR6/qun75/69BoYgiDVgmG4DsbyncXyneXwvx0GgMx7mawvm/Fn+AfFCs7O+zkOQfYz6Iv3CN1fd3d/3X3kN0e4Lk47fIEgSBtSbYwCQRAEaTyomYkgCKI/6IsRBEH0B30xgiCI/qAvRhAE0R/0xQiCIPqDvhhBEER/0BcjCILoD/piBEEQ/UFfjCAIoj/oixEEQfQHfTGCIIj+oC9GEATRH/TFCIIg+oO+GEEQRH/+H2UfGUkdQSlBAAAAAElFTkSuQmCC" width="473" height="137" class="img_CujE"></p><p>Ok sekarang kembali ke topik, yaitu perihal variabel.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a42-immutability-pada-variabel">A.4.2. <em>Immutability</em> pada variabel<a class="hash-link" href="#a42-immutability-pada-variabel" title="Direct link to heading">​</a></h2><p>Tulis kode berikut. Ada 2 variabel yang dideklarasikan, <code>message_number</code> yang isinya numerik, dan <code>message1</code> yang isinya string.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jalankan, hasilnya tidak ada error, aman.</p><p><img loading="lazy" alt="var immutability" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdMAAAB3CAIAAADXZj22AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMDctMjdUMTY6MjE6NTMrMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyLTA5LTI3VDE3OjIx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150cfau6I0BAKFxxldZl7g4OyP7pMW72bLHFwamx0PI/XBdTsPQ6CRgXBEL0VkryuTtkTo7rv+QQ2jcrPZyZm7mOkdNRlyfafwMmaHrkTWDaJlOCJ7cXcn0i7OfZ8rM8SIIYt9oY2/D5OgQQpfS6Uv1lHIGwOLs5fBcWkyv38gyE1URCAA5ANlSGcL4NHAdkxfCnnL27iImLzAr2neypTJ8Rt0EUM7elX84Zi/bebtu3CReyqVsh9tEEIQF2txVxg4xXp9JXAeA6bn0zI2rEP2sLjE8NyMgM5eYXYQUfgWw+NPajCB7lXJmbnYRmDSsaH8J+zzlEsCu3foKt7O0ZxCPLwxIPxZhn8f8YoIgOk0bexsW72bLUiTUgGyJ8Txflbj2k7T4/Uxc+05evSBFeROJREJaGjevqDlDo5OAGB/l9DOTVy+Eytm7HandgOm5dDrdQsltNun6DznU49KTVy+ENPEWgiD2m9bXvFcnF2cv4+qNmfpdbzkzd3kWqghC7nZidlEbVpASF9OZCzPS6jaXyZQFH7A4ezeRVt5Hi6EJVkX8t/eLs59fuDEzk07PoJy5nSlf8pldXb+Nr9fSXu3Kvgsz6fRMB/YSNLX8pXT6EnK3EzNZVuL1mQTm0jPp9AxQHw6CIOyjy05917yxNXn1xkw4S5ueCIJ4teiyNynUMcfJC2GPHJAgCIJ4ZeiyNa/2PQrSGiAI4hWk6zwvQRDEK0+XRRsIgiBeA8jzEgRB2A15XoIgCLshz0sQBGE35HkJgiDshjwvQRCE3ZDnJQiCsBvyvARBEHZDnpcgCMJuyPMSBEHYDXlegiAIuyHPSxAEYTfkeQmCIOzm/wF5FHFxmUMOjwAAAABJRU5ErkJggg==" width="467" height="119" class="img_CujE"></p><blockquote><p>O iya, jika ingin menampilkan banyak variabel via macro <code>println</code>, manfaatkan string <code>{}</code>.</p><p>Tulis <code>{}</code> sejumlah variabel yang ingin ditampilkan, pada output string <code>{}</code> akan di-replace oleh variabel yang disisipkan pada argument saat pemanggilan macro <code>println</code> secara berurutan.</p><p>Pada contoh di atas, string <code>"message number {}: {}"</code><br> ... akan menjadi <code>"message number {message_number}: {message1}"</code><br> ... kemudian menghasilkan <code>"message number 1: hello"</code></p></blockquote><p>Sekarang ubah isi <code>message_number</code> menjadi <code>2</code> lalu siapkan juga variabel <code>message2</code>, kurang lebih kodenya menjadi seperti berikut, kemudian jalankan.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"world"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="var immutability" src="/assets/images/variabel-4-11c9b8e77e4ddf88a314c0b480337a42.png" width="585" height="308" class="img_CujE"></p><p>Error? kok bisa?</p><p>Perlu diketahui, bahwa <em>by default</em> semua variabel adalah <em>immutable</em>. Immutable itu artinya gak bisa diubah nilai/value-nya. Jadi mirip seperti konstanta.</p><blockquote><p>Variabel immutable mirip seperti konstanta, tapi sebenarnya berbeda. Akan kita bahas lebih detail di beberapa chapter berbeda perihal perbedaannya.</p></blockquote><p>Lalu bagaimana cara agar nilai variabel bisa diubah? Caranya dengan menambahkan keyword <code>mut</code> (yang merupakan kependekan dari <em>mutable</em>) saat pendefinisian variabel tersebut.</p><blockquote><p>Catatan tambahan:</p><ul><li><p>Operasi assignment pada variabel immutable hanya boleh dilakukan sekali. Dan pada kode di atas telah dicontohkan caranya bagaimana. Variabel dideklarasikan sekaligus diisi nilainya.</p></li><li><p>Perlu diketahui bahwa sebenarnya diperbolehkan untuk memecah statement deklarasi variable dan assignment nilai sebagai 2 statement terpisah. Lebih jelasnya dibahas setelah ini pada section <a href="/basic/variabel#a45-deklarasi-variabel-tanpa-predefined-value">section A.4.5</a>.</p></li></ul></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a43-keyword-mut">A.4.3. Keyword <code>mut</code><a class="hash-link" href="#a43-keyword-mut" title="Direct link to heading">​</a></h2><p>Ok, mari kita coba, ubah statement deklarasi variabel <code>message_number</code>, tambahkan keyword <code>mut</code>. Lalu jalankan ulang program.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"world"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="mut keyword" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdYAAACECAIAAACiSZ1FAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF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YhnoghEEQSwDXTCCIIhloAtGEASxDHTBCIIgloEuGEEQxDLQBSMIgljG/wO7RSAwVCeE9AAAAABJRU5ErkJggg==" width="470" height="132" class="img_CujE"></p><p>Ok, sekarang tidak muncul error.</p><p>Dengan menggunakan keyword <code>let mut</code> pada pendefinisian <code>message_number</code>, membuat variabel tersebut menjadi mutable atau bisa diubah nilainya.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-argument-parameter-macro-println">◉ Argument parameter macro <code>println</code><a class="hash-link" href="#-argument-parameter-macro-println" title="Direct link to heading">​</a></h3><p>Selanjutnya, coba tambahkan lagi 1 message baru pada program yang sudah dibuat, lalu run.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"world"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message3</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i8</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {1}: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="formatted print macro `println`" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdYAAACaCAIAAACblf6uAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4b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gEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApgEXDAAApvH/zux74reEzOEAAAAASUVORK5CYII=" width="470" height="154" class="img_CujE"></p><p>Jika dilihat ada yg berbeda pada cara deklarasi variabel <code>message3</code> dan juga pada statement <code>println</code> untuk <code>message3</code> yang di situ digunakan <code>{1}</code> dan <code>{0}</code>, tidak seperti sebelumnya yg menggunakan <code>{}</code>. Kita akan bahas yg ke-2 terlebih dahulu.</p><ul><li>Jika menggunakan <code>{}</code>, maka string akan di-replace sesuai urutan argument pada pemanggilan <code>println</code>.</li><li>Jika menggunakan <code>{0}</code>, maka string akan di-replace dengan data pada argument ke <code>1</code> pemanggilan fungsi <code>println</code>, yang pada contoh di atas adalah <code>message3</code>.</li><li>Jika menggunakan <code>{1}</code>, maka string akan di-replace dengan data pada argument ke <code>2</code> pemanggilan fungsi <code>println</code>, yang pada contoh di atas adalah <code>message_number</code>.</li><li>Jika menggunakan <code>{n}</code>, maka string akan di-replace dengan data pada argument ke <code>n+1</code> pemanggilan fungsi <code>println</code>.</li></ul><p>Dengan ini maka 3 statement berbeda berikut akan menghasilkan output yang sama:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {0}: {1}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {1}: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Sekarang perihal perbedaan cara deklarasi <code>message3</code> akan kita bahas di bawah ini.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a44-type-inference-vs-manifest-typing">A.4.4. <em>Type Inference</em> vs <em>Manifest Typing</em><a class="hash-link" href="#a44-type-inference-vs-manifest-typing" title="Direct link to heading">​</a></h2><p>Rust mendukung dua metode deklarasi variabel, yaitu <em>type inference</em> dan <em>manifest typing</em>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-metode-type-inference">◉ Metode <em>Type Inference</em><a class="hash-link" href="#-metode-type-inference" title="Direct link to heading">​</a></h3><p>Penulisan variabel dengan metode ini ditandai dengan tidak menuliskan tipe data secara jelas/eksplisit. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> var1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello"</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// compiler akan secara cerdas mendeteksi var1 tipe data nya string</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> var2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// compiler akan secara cerdas mendeteksi var2 tipe data nya numerik</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Metode deklarasi yang selama ini sudah kita terapkan adalah <em>type inference</em>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-metode-manifest-typing">◉ Metode <em>Manifest Typing</em><a class="hash-link" href="#-metode-manifest-typing" title="Direct link to heading">​</a></h3><p>Metode ini mewajibkan programmer untuk menuliskan secara jelas/eksplisit tipe data variabel. Contoh penerapannya bisa dilihat di praktik sebelumnya, pada definisi variabel <code>message3</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message3</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i8</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Notasi penulisan tipe data adalah <code>namavariabel: tipedata</code>. Contoh seperti di atas, yaitu <code>let message3: i8 = 24</code> artinya variabel <code>message3</code> didefinisikan memiliki tipe data <code>i8</code>.</p><p><code>i8</code> merupakan salah satu tipe data dari sekian banyak tipe data yang ada di Rust. Lebih jelasnya kita akan bahas pada chapter selanjutnya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a45-deklarasi-variabel-tanpa-predefined-value">A.4.5. Deklarasi variabel tanpa <em>predefined value</em><a class="hash-link" href="#a45-deklarasi-variabel-tanpa-predefined-value" title="Direct link to heading">​</a></h2><p>Sesuai dengan penjelasan di <a href="https://doc.rust-lang.org/error-index.html#E0381" target="_blank" rel="noopener noreferrer">dokumentasi spesifikasi Rust</a>, variable yang tidak ada value-nya akan memunculkan error saat program di-run.</p><p>Meski demikian, diperbolehkan untuk memisahkan variable statement untuk deklarasi variable dan pengisian value. Sebagai contoh, statement <code>message_number</code> pada kode berikut ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... boleh dituliskan dalam 2 statement terpisah seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i32</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">message_number </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"message number {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> message_number</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Intinya, operasi assignment hanya diperbolehkan 1x saja pada variabel <em>immutable</em>, baik itu saat deklarasi variable atau setelahnya.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a46-deklarasi-banyak-variabel-dalam-satu-statement">A.4.6. Deklarasi banyak variabel dalam satu statement<a class="hash-link" href="#a46-deklarasi-banyak-variabel-dalam-satu-statement" title="Direct link to heading">​</a></h2><p>Di Rust memungkinkan untuk mendefinisikan banyak variabel dalam 1 baris statement. Notasi penulisannya seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">var1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"var1: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => var1: 24</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"var2: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => var2: hello</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pendefinisian banyak variabel dalam 1 statement dilakukan dengan menuliskan semua variabelnya dengan separator tanda <code>,</code> dan diapit tanda kurung <code>()</code>.</p><p>Sebagai contoh di atas 2 variabel didefinisikan, yaitu <code>var1</code> dan <code>var2</code>, dan keduanya memiliki value yang berbeda tipe-datanya.</p><p>Bisa juga saat definisi variabel sekaligus ditentukan tipe data variabel, notasi penulisan bisa dilihat pada contoh kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">var3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i8</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"var3: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var3</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => var3: 32</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"var4: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => var4: 12</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Dengan notasi ini bisa juga untuk definisi variabel <em>mutable</em>. Cukup tambahkan keyword <code>mut</code> pada variabel yang ingin bisa diubah nilainya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">var5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> var6</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var7</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">i8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i8</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">i8</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">64</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">12</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"var5: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => var5: 64</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"var6: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var6</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => var6: 12</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">var6 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"var6: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var6</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => var6: 24</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"var7: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> var7</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => var7: 4</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a47-deklarasi-variabel-dengan-tipe-data-ditentukan-dari-value">A.4.7. Deklarasi variabel dengan tipe data ditentukan dari value<a class="hash-link" href="#a47-deklarasi-variabel-dengan-tipe-data-ditentukan-dari-value" title="Direct link to heading">​</a></h2><p>Ini merupakan salah satu alternatif cara penulisan untuk men-specify tipe data variabel, caranya dengan menuliskan tipe data tepat setelah value, contohnya seperti berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24i8</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data1: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => data1: 24</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Variabel <code>data</code> didefinisikan dengan predefined value adalah numerik <code>24</code> dengan tipe data <code>i8</code>, penulisan value nya menjadi <code>24i8</code>.</p><p>Boleh juga menggunakan separator <code>_</code> dalam penulisan value-nya sebagai pembatas antara nilai dan tipe data, contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> data1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">24_i8</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data1: {0}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => data1: 24</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a48-variable-shadowing">A.4.8. Variable <em>Shadowing</em><a class="hash-link" href="#a48-variable-shadowing" title="Direct link to heading">​</a></h2><p>Di Rust ada konsep bernama <strong>variable shadowing</strong>. Shadowing sendiri adalah pendefinisan ulang variabel yang sebelumnya sudah didefinisikan. Biasanya teknik ini dipakai untuk isolasi variabel dalam sebuah blok kode.</p><p>Contoh shadowing bisa dilihat pada kode berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"x: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => x: 5</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> x </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"x: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// hasilnya => x: 6</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Lebih jelasnya akan kita bahas pada chapter terpisah, yaitu <a href="/basic/shadowing">Shadowing</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a49-variabel-_">A.4.9. Variabel <code>_</code><a class="hash-link" href="#a49-variabel-_" title="Direct link to heading">​</a></h2><p>Di Rust, jika ada variabel yang dideklarasikan tapi tidak digunakan, maka muncul warning saat ekesekusi program.</p><p>Pada praktiknya, tidak semua variabel memang perlu untuk digunakan. Pada kasus tertentu suatu variabel harus tetap dideklarasikan untuk menampung suatu nilai meski tidak digunakan. Misalnya pada case dimana ada pemanggilan fungsi yang nilai baliknya tidak digunakan.</p><p>Untuk case seperti yang dijelaskan di atas, gunakan variabel <code>_</code>. Variabel ini berguna untuk menampung nilai yang tidak digunakan, untuk menghindari warning. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> _ </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">run_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-work-in-progress">◉ Work in progress<a class="hash-link" href="#-work-in-progress" title="Direct link to heading">​</a></h3><ul><li>Variabel <code>_</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/variabel" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../variabel</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-chapter-relevan-lainnya">◉ Chapter relevan lainnya<a class="hash-link" href="#-chapter-relevan-lainnya" title="Direct link to heading">​</a></h3><ul><li><a href="/basic/shadowing">Shadowing</a></li><li><a href="#/wip/macro">Macro</a></li><li><a href="#/wip/formatted-print">Formatted Print</a></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/hello/print.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/hello/print.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/variable_bindings/scope.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/variable_bindings/scope.html</a></li><li><a href="https://doc.rust-lang.org/reference/variables.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/variables.html</a></li><li><a href="https://rust-lang.github.io/api-guidelines/naming.html" target="_blank" rel="noopener noreferrer">https://rust-lang.github.io/api-guidelines/naming.html</a></li><li><a href="https://stackoverflow.com/questions/38045700/how-do-i-declare-multiple-mutable-variables-at-the-same-time" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/38045700/how-do-i-declare-multiple-mutable-variables-at-the-same-time</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/komentar"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.3. Komentar</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/tipe-data-primitive-scalar"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.5. Tipe Data ➜ Primitive Scalar</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a41-deklarasi-variabel-menggunakan-let" class="table-of-contents__link toc-highlight">A.4.1. Deklarasi variabel menggunakan <code>let</code></a><ul><li><a href="#-aturan-penamaan-variabel-naming-convention" class="table-of-contents__link toc-highlight">◉ Aturan penamaan variabel (naming convention)</a></li><li><a href="#-macro-println-untuk-print-string" class="table-of-contents__link toc-highlight">◉ Macro <code>println</code> untuk print string</a></li></ul></li><li><a href="#a42-immutability-pada-variabel" class="table-of-contents__link toc-highlight">A.4.2. <em>Immutability</em> pada variabel</a></li><li><a href="#a43-keyword-mut" class="table-of-contents__link toc-highlight">A.4.3. Keyword <code>mut</code></a><ul><li><a href="#-argument-parameter-macro-println" class="table-of-contents__link toc-highlight">◉ Argument parameter macro <code>println</code></a></li></ul></li><li><a href="#a44-type-inference-vs-manifest-typing" class="table-of-contents__link toc-highlight">A.4.4. <em>Type Inference</em> vs <em>Manifest Typing</em></a><ul><li><a href="#-metode-type-inference" class="table-of-contents__link toc-highlight">◉ Metode <em>Type Inference</em></a></li><li><a href="#-metode-manifest-typing" class="table-of-contents__link toc-highlight">◉ Metode <em>Manifest Typing</em></a></li></ul></li><li><a href="#a45-deklarasi-variabel-tanpa-predefined-value" class="table-of-contents__link toc-highlight">A.4.5. Deklarasi variabel tanpa <em>predefined value</em></a></li><li><a href="#a46-deklarasi-banyak-variabel-dalam-satu-statement" class="table-of-contents__link toc-highlight">A.4.6. Deklarasi banyak variabel dalam satu statement</a></li><li><a href="#a47-deklarasi-variabel-dengan-tipe-data-ditentukan-dari-value" class="table-of-contents__link toc-highlight">A.4.7. Deklarasi variabel dengan tipe data ditentukan dari value</a></li><li><a href="#a48-variable-shadowing" class="table-of-contents__link toc-highlight">A.4.8. Variable <em>Shadowing</em></a></li><li><a href="#a49-variabel-_" class="table-of-contents__link toc-highlight">A.4.9. Variabel <code>_</code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-work-in-progress" class="table-of-contents__link toc-highlight">◉ Work in progress</a></li><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-chapter-relevan-lainnya" class="table-of-contents__link toc-highlight">◉ Chapter relevan lainnya</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/vector.html b/basic/vector.html index 64708c9a..643a8317 100644 --- a/basic/vector.html +++ b/basic/vector.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/vector/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/vector/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.16. Tipe Data ➜ Vector","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/vector/#webpage"},"wordCount":1179,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/vector/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/vector/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/vector","name":"A.16. Tipe Data ➜ Vector","description":"Pada chapter ini kita akan belajar tetang tipe data Vector. Vector adalah tipe data seperti array tapi dinamis. Dinamis di sini artinya bisa bertambah dan berkurang kapanpun sesuai kebutuhan.","datePublished":"2024-08-01T10:17:31.740Z","dateModified":"2024-08-01T10:17:31.740Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/vector/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/vector"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/vector/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.16. Tipe Data ➜ Vector","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/vector/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/vector/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.16. Tipe Data ➜ Vector","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/vector/#webpage"},"wordCount":1179,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/vector/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/vector/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/vector","name":"A.16. Tipe Data ➜ Vector","description":"Pada chapter ini kita akan belajar tetang tipe data Vector. Vector adalah tipe data seperti array tapi dinamis. Dinamis di sini artinya bisa bertambah dan berkurang kapanpun sesuai kebutuhan.","datePublished":"2024-08-30T07:44:51.905Z","dateModified":"2024-08-30T07:44:51.905Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/vector/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/vector"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/vector/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.16. Tipe Data ➜ Vector","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.16. Vector</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.16. Tipe Data ➜ Vector</h1></header><p>Pada chapter ini kita akan belajar tetang tipe data <em>Vector</em>. Vector adalah tipe data seperti array tapi dinamis. Dinamis di sini artinya bisa bertambah dan berkurang kapanpun sesuai kebutuhan.</p><p>Vector sangat mirip seperti array, yang karakteristiknya adalah tipe data elemen wajib sama, punya informasi size, elemen-nya bisa diakses atau diubah. Salah satu perbedaan vector dibanding array adalah jumlah elemen pada vector bisa bertambah lebih dari kapasitas yang sudah ditentukan.</p><p>Vector memiliki 3 buah atribut yg penting untuk diketahui:</p><ul><li>pointer ke data asli</li><li>lebar atau size</li><li>kapasitas (representasi dari seberapa banyak memori di-booking untuk data vector tersebut)</li></ul><p>Vector bisa bertambah jumlah isinya selama size di bawah kapasitas yang sudah dialokasikan. Jika suatu ketika vector isinya bertambah lebih banyak dari jumlah alokasi maksimal kapasitas, maka vector akan dialokasikan ulang dengan kapasitas yang lebih besar.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a161-tipe-data-vect">A.16.1. Tipe data <code>Vec<T></code><a class="hash-link" href="#a161-tipe-data-vect" title="Direct link to heading">​</a></h2><p><code>Vec<T></code> adalah tipe data yang merepresentasikan vector, yang mana <code>T</code> adalah generics. Vector datanya dialokasikan di heap memory.</p><blockquote><ul><li>Lebih jelasnya mengenai generic dibahas pada chapter <a href="/basic/generics">Generics</a></li><li>Lebih jelasnya mengenai heap dibahas pada chapter <a href="/basic/basic-memory-management">Basic Memory Management</a></li></ul></blockquote><p>Langsung saja kita praktikkan.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-deklarasi-vektor-size-dan-capacity">◉ Deklarasi vektor, size, dan capacity<a class="hash-link" href="#-deklarasi-vektor-size-dan-capacity" title="Direct link to heading">​</a></h3><p>Ada beberapa cara yang bisa dipakai untuk membuat data vector. Salah satunya adalah menggunakan macro <code>vec</code>, penulisannya seperti pembuatan array hanya saja perlu ditambahi prefix <code>vec!</code>. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> data_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"batman"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"superman"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"lobo"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"length: {}, capacity: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">capacity</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcUAAABuCAIAAADZD59KAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGI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Un14emld4xOZd9qUR/th8Qur++23IUWekqdRkNS89IdkQae6k6cUebpqvuG6w1Sy4PD9i21I3T5PKYqiyFOKoijylKIoiiJPKYqiDspTt7PvRr2oRZVxDYTLaxT1MuPT3Wm3xuuyjKhrWagFPN39sbCrahCKIk+PxNM0p+uL/Ro+ZnudDUJRL4en0qtYMxuO46QhKlOcpzVj4Dv/m6lb0QQ8iP2eyopttshTzp+oFteqqUevBqEoqgNPkVcxNhvO/FQ09zXTq7gSH+vogV6NLHkql4yr9dctZTQOrbkUc6UuDUJRVBeeAq9ixSwj5oDt5L/dC27Lyll5SGyY433RU2p5Ongap1n/YSbOn1LUsXmKvIqtT3Es8ekChQY8rYAjjE7BAUueynGAKlJavpsenibfj9tERE6gUtSheSqvb5wknj1FjqMteLpid7hH2VPZNK62SuHi6ZxqK075hj9FHXi8D72KERD161iETAZPVyy/CKfTUniGqlT0VA4YxcbVxqfgZMPgGHKg7J8/wLJ0Q4NQFHUhnmrOvtLHtxyfqm7HBa9iDz6S8khSeT9xqa3Fp57KfuNqkafWnnfw887KktbGBqEo6qLx6T7jzAvN4+3qatx56My1eYoiT9WRd99QaX9X46485UCdosjTHGg3NO7sxNNzuzE2pSjylKIoijylKIqiyFOKoijylKIoijylKIoiTymKoijylKIoijylKIoiTymKoijylKIoijylKIo6rv4HCffy3PPDcloAAAAASUVORK5CYII=" width="453" height="110" class="img_ev3q"></p><p>Pada contoh di atas variabel <code>data_one</code> adalah sebuah vector yang isinya 3 elemen, yaitu literal string <code>batman</code>, <code>superman</code>, dan <code>lobo</code>. Vector <code>data_one</code> dideklarasikan menggunakan macro <code>vec</code> kemudiaan diikuti notasi penulisan yang mirip seperti array.</p><blockquote><p>Lebih jelasnya mengenai macro dibahas pada chapter <a href="#/wip/macro">Macro</a></p></blockquote><p>Pembuatan vector menggunakan teknik ini hasilnya adalah data vector yang <code>size</code> dan <code>capacity</code> nya adalah sesuai dengan <em>predefined value</em>, yang pada konteks ini adalah 3.</p><p>Umumnya vector dideklarasikan dengan keyword <code>mut</code> agar bisa diubah nilainya, karena tujuan disediakannya tipe data ini adalah untuk bisa mengakomodir tipe data array tetapi dinamis (bisa manipulasi datanya).</p><p>Perihal method <code>len</code> dan <code>capacity</code>:</p><ul><li>Method <code>len</code> digunakan untuk mencari tahu size atau jumlah elemen yang ada pada sebuah vector</li><li>Method <code>capacity</code> digunakan untuk mencari tahu kapasitas atau jumlah maksimum elemen yang ada pada sebuah vector</li></ul><blockquote><p>O iya, kode program di atas akan menghasilkan warning saat di-run. Hal ini dikarenakan variabel <code>data_one</code> yang didefinisikan mutable belum diubah nilainya. Hiraukan saja, karena selanjutnya kita akan manipulasi data variabel tersebut.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-pop--menghapus-elemen-terakhir">◉ Method <code>pop</code> ➜ menghapus elemen terakhir<a class="hash-link" href="#-method-pop--menghapus-elemen-terakhir" title="Direct link to heading">​</a></h3><p>Oke, selanjutnya mari kita oprek variabel <code>data_one</code> yang sudah ditulis.</p><p>Tipe data <code>Vec<T></code> memiliki method <code>pop</code> yang fungsinya menghapus data elemen terakhir. Mari gunakan method ini pada <code>data_one</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pop</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"length: {}, capacity: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">capacity</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAAB0CAIAAACZnqXOAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjO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xcrfKmw6n4xG0nXKLJab8iQBvOY2Brdp9Kkryu8ckdIrJkLC5X1cfl5jKpyHEdv+gfo26g1EERi9D1/gk5Z01r7GJLhlVYBSBUTC6lKB/ty89GEUIjPomFa47KH1xqOKdegRGEUIIgVGEEAKjCCEERhFC6CVjdHx+cNuVghe1pNstv7BihtCLikZXh1zxGNPiIwhbuGvC6OrPdY0r5ayVIwRGfQUc8tv+efeNyLpVobf180MIjM7EaBn7WZ6+cVR0jMEMg2fLd/nO/9ponH4OkaOSWu7ULo/k7G39dHM5SWI6SWdOd1mTTmsQMIrQhWFUWQJrT9/M2iQmQRmNGpbAu2BUxbAt6+KWP7QdF5extzTHSsA53Y4AiiJ0sRgVlsCGb0Xc/es++asZ0M0a07fHvRVXui92SitPB0bjNPM/8MTcKEIXiVFlCVz7vsUYjY4s2Aijc7+saQSwLeviOBwtUtaCYg9Gk0/FLV59Ix5F6NIwWnZrnSSeGVUOn2titEPZPFzIA7ati6v+0LVKuDA6pFpKUQxCELq8Qb2M+RQH7e5bBEgVjLqmAk2G+oyTVZWa1sWBntofuhIalw2jI8YjXP/8ERahu6y5IYTWwGgxgC8/m1z7vkWxTi9NhRuWwB5qZMeJj+Q1To6rZLtTT/OHLvK02vPOePBVzvR6GiQ5EAxF6PzR6DqDyTPN0a36IOnO42NW2RF64RhNR5Nz138WFmDdh/F3xSijcYRePEbzwfYNIGEnjJ7ajUgUITCKEEJgFCGEEBhFCCEwihBCYBQhhMAoQgghMIoQQmAUIYTAKEIIgVGEEAKjCCGE5uh/fx42cQ4+0S8AAAAASUVORK5CYII=" width="450" height="116" class="img_ev3q"></p><p>Bisa dilihat pada contoh di atas, setelah menggunakan method <code>pop</code>, isi <code>data_one</code> menjadi 2 elemen saja. Elemen terakhir (yaitu string <code>lobo</code>) dihapus. Efeknya, atribut size menjadi 2, tapi kapasitas tetap 3.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-remove--menghapus-elemen-index-ke-i">◉ Method <code>remove</code> ➜ menghapus elemen index ke <code>I</code><a class="hash-link" href="#-method-remove--menghapus-elemen-index-ke-i" title="Direct link to heading">​</a></h3><p>Method <code>remove</code> adalah salah satu method lainnya yang ada pada tipe data <code>Vec<T></code>. Kegunaan dari method <code>remove</code> adalah untuk menghapus elemen pada indeks tertentu.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">remove</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"length: {}, capacity: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">capacity</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAACGCAIAAADBxB3cAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb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AIYHZal69GomXL1aPTXj4Z8Kowau4NRhFATRoPhcTApGIyZ+60DJLLJQjPlOktMSS7c+bQxmu0ORhFCbRgNbiH/+b1fpY7Hyt0KdzycDkfQdso1lpjSOwK8+TQG9Wp3MIoQasXotXWVR6cWFRhFCIyCUTCKEDo0RtXd+4cQz9QjBEYRQgiBUYQQAqMIIQRGEULobWJ0undy3VWSN7Wc3S09Hfz+A4RQWzS6OOSy25gWOcNR8CTyufh9XdNdAtwngBAYdWOje9bomFHeirfHfj5spSB00xhNH/q0/YzDqOgUgxkGz5bv8p3vsdHvP0dLptnECHJquVPbxTTcqbNj5pMkppN0WOboo/c52g0QjRCaidHEtKPgZ5xYm4QkyKNRww65gRrzMRrZOY1HK9s21/yh1TGt2FuaY0XgbLcjgKII7Rajp3dufI+vUsOzI7z8yz75Myw/FsRofT9plCcJFaa0junAaJhmHgi3Wh1ECIw2YzQfhZoYTd7dObFgZxhVdvl3ddvmMBzNUhrHdGM0ek3eRSBkchShPWI0v6x1knBmVDl87igazU5Yt20u+kOXCuHC6JDqUopijoLQ/gb16mXskoP25ZvxroDRy+ZGo8nM8gA4OUfVtnmkp/aHltVkcU3/AJzg+utXun3GEhMURehqGM0G8Plrk4NXF5ej0ZhmyVr/hRjN8jmdKbXd9xzCdqdu84fOjmnV5526+eHOWKVqrhAYitD1o9FlBpNXmqOzF8z3Pz5mlR2hN47ReDRZGOSumYFln2vaFKOMxhF68xhNB/U3gISNMHquNyJRhMAoQgiBUYQQQmAUIYTAKEIIgVGEEAKjCCGEwChCCIFRhBACowghBEYRQgiMIoQQAqMIIQRGEUIIjCKE0JvT/wE0Wjx1dKk4VAAAAABJRU5ErkJggg==" width="450" height="134" class="img_ev3q"></p><p>Dicontohkan di atas elemen indeks ke-<code>1</code> dihapus dengan cara memanggil method <code>remove</code> lalu menyisipkan indeks elemen sebagai parameter pemanggilan method. Hasilnya elemen <code>superman</code> dihapus dari vector.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-push--menambahkan-elemen-baru">◉ Method <code>push</code> ➜ menambahkan elemen baru<a class="hash-link" href="#-method-push--menambahkan-elemen-baru" title="Direct link to heading">​</a></h3><p>Sekarang isi dari vector <code>data_one</code> tinggal 1 elemen, mari kita tambahkan 3 elemen baru dengan memanfaatkan method <code>push</code>.</p><p>Method <code>push</code> fungsinya adalah untuk menambahkan elemen baru pada vector.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"constantine"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"trigon"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"darkseid"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"length: {}, capacity: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">capacity</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcQAAACHCAIAAAAHhr4+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4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QZUOjXx2qlM89HtpcFI+gwp51N9Nz8YSZi58OqKp42Maia3i5mhdXvR/u8i18lqmvPfNCWa6To936ZG7mFok+lEfXoPkW2EvQRNIpkeGnseGFxr7fPUFXhrrkuG/Kq79G+7M5BMSaaLhg6Z9Gyui5dHV3snjZ2BZHqQYUVWInbocjf+NvkOHiWZEgRBECRTgiAIkilBEATJlCAIgmTaQxGMWR03vtMXY20BTYIgzhKZrk514sDTSiUse21mRzJtcwLsTeyiEgTJdHUy7TP5ecqDqW1El8mhBHF0MpUKsppQbvpunqLdq6k7X/wvnl7fVammJaDE7BeHVjSwRZ5y2UTVq9bEI30OicXUCII4JJkiBdmcHrD4wpaMTBWdXR+ZamppBUwqpels1eScCrX+8qCMw6GYU0SfZbIGfX4vnOUTxKHJFCjI6nrAWG/InuZXzPmjT3oVk2n+BWyoTaeqSowpnZpvFyyAP6Wp++pPpN/K/S6COB6ZIgXZvOpazC0rk2mYXQ2ZIiXmS141OQxNRUolTzeZRhKVpZElUOtgcEoQRyRTOTJxEqCz24BMk3XZ8pmt+jkcWzXZVKG2KuEi0zFV1eqn8cUJgiCOMs2H+8Rl4upiDmzLeP+u/46z77CUpsRsqiZPHIpleo3tdOkYvCjQ1eXXL/ixCccGVGQouZQgdiVTRRdWUZC1I1P5RRnft5WWkalbkVcqMWuqyX4VapGn5s+L8hlkuNrpdMgW31UmCKIsMq1ES53dskWA1YrdeMJ8dmlsgiCZrkZjDXR2ywxYdyN7UzLl9JwgSKYRm93QbHMjMr36jVEpQZBMCYIgSKYEQRAEyZQgCIJkShAEQTIlCIIgmRIEQRAkU4IgCJIpQRAEyZQgCIJkShAEQZBMCYIgSKYEQRAkU4IgCIJkShAEsRr+Bw1sp9tY0S8gAAAAAElFTkSuQmCC" width="452" height="135" class="img_ev3q"></p><p>Bisa dilihat sekarang <code>data_one</code> isinya adalah 4 elemen dan atribut size-nya cocok, yaitu <code>4</code>. Namun ada yang aneh, kenapa kapasitas jadi <code>6</code> padahal di awal kapasitas adalah 3.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-realokasi-vector">◉ Realokasi vector<a class="hash-link" href="#-realokasi-vector" title="Direct link to heading">​</a></h3><p>Perubahan kapasitas atau realokasi vector terjadi ketika sebuah vector isinya bertambah lebih banyak dari jumlah alokasi maksimal kapasitas.</p><p>Lalu apa efeknya? secara high level bisa dibilang tidak ada, namun kalau dibahas lebih rinci, efeknya adalah di sisi alokasi space untuk menampung elemen. Proses realokasi menghasilkan vector yang baru dengan kapasitas lebih besar.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-mengubah-value-sebuah-elemen-menggunakan-notasi-i">◉ Mengubah value sebuah elemen menggunakan notasi <code>[i]</code><a class="hash-link" href="#-mengubah-value-sebuah-elemen-menggunakan-notasi-i" title="Direct link to heading">​</a></h3><p>Sama seperti array, vector juga bisa dimodifikasi nilai elemennya dengan menggunakan notasi <code>[i]</code>.</p><p>Pada contoh berikut elemen indeks ke-<code>2</code> diubah nilainya dari <code>trigon</code> ke <code>red hood</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">data_one</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"red hood"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"length: {}, capacity: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">capacity</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcEAAACDCAIAAAB6PjdsAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxucz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lwlzOdTCcpa+wppbMKbz2VuTy6vTQOTR8d5TSq78sHwwITFl5C8fSR0czkdjGps24v2p+dbjrFZ1DpyL1LQivZHcpFb0Gz3cY9YG0OHRhP9yVpT+gMpW2/nPl86CbY5OWoWvsbBE3Htk9byCKHvkUO7R6/JFCajm0nh27uUSQjgngzD5Dzvi9PEARBkEMJgiDIoQRBEORQgiCIM3OoIsSyOI63EzcDM9Q2CYI4Yhy6OMOJE0sLlTDj5ZZtObTOEa6j7nISBDl0Ew5tM/lzyAOldbSNSZ0EsVMOlfKrmuxu8N5be8hTkfLVNG4v/rdCr++pTWYjoJzr12BWpKZFnnJtRJWF1iQYfQaJtckIgtgThyL51Zzsrvj0lIxDFW1jH4eG8g4TOBS9W5cTJ86JPevv68moG8opRaxZJjXQ5vfMqTxB7JFDkZytLmwDFX/sufyEiX30ratiDs3LqkNROFW2IdUzn8ChibDFhO/iRHqp3MIiiN1wKJSzzcqdxZSyMIeG2U3hUCR4fMmLE4eBqEip5Onm0EjosTSOTAp4U6ceCOIIHCoHJE4SroaaauqzODRZcy2fvqofjLHFiU2xZ6sRLg4NpH7nSleTQwliT3N5uONbJl0uJrq29PXf6R8+9p120gSPTXHigTqxxq2xMS4Ng2f+TVteXuB3GRx7SlFFSaEEsQWHKqKqivyqHYfKb674vlM0j0PdcrZS8FgTJ/aLPYs8NXtelC/3wpVMp0FW+hAxQRDV3vUEq3IbbG0suqOy8qz46ArUBEEOnctemSWA+vS57Jb0qhzKOThBvG0OTefyJ+CDlTj0ajfGoATxxjmUIAiCHEoQBEGQQwmCIMihBEEQ5FCCIAhyKEEQBDmUJiAIgiCHEgRBbID/AdPT3RucKBFQAAAAAElFTkSuQmCC" width="449" height="131" class="img_ev3q"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-is_empty--mengecek-apakah-vector-kosong">◉ Method <code>is_empty</code> ➜ mengecek apakah vector kosong<a class="hash-link" href="#-method-is_empty--mengecek-apakah-vector-kosong" title="Direct link to heading">​</a></h3><p>Method <code>is_empty</code> digunakan untuk mengidentifikasi apakah sebuah vector isinya kosong atau tidak.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> is_vector_empty </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_empty</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> is_vector_empty</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAABtCAIAAAC+8Pi1AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGG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CjWSDC8+BXBlalxVeLTZTCAy72VOVHldw+jxY25eTAez5mpGsdR6WDqaPv6+OZeV419vl8NSTPRYAe74uRF+F6+PQDdnzDHK8V11PAGDPLRHP3DekTjFz3y8lXUo9AYA9AQAA9gQAANgTAAAA7AkAALAnAADAngAAAHsCAADsCQAAAPYEAADYEwAAYE8AAIA9AQAA9gQAAAB7AgDABbHn119//vb4/XPhrH/+Pub898+vr5uXDgCAPTfi0Ji/XqjP5Dw3dzopMS8dAABeK3u2MCLsCQBYlz17RhtnuwPhTNPfgIOCi8erEUclhBX+DO/Msu1m4x6mE6FnkHFMzBl75pW3mgkAAD72HLnjwCUdBwU0NV6T0ZyXPYuxZ509LfL9+uv3kN9UT2dlbo1mAgCAmz3/hBT0u7sWMM3AeR2FidDvZPZ0o7jsWS5dVV43EwAAGmbulUhvSDHueA8Xzs2eSVVrpUeVt5sJAACz2bO8CjgGrOdlzzxu/uloxHAX+0oAgIXZU05zswQjex5v70O7In8Zi4uzd42Sdcu/PvaMKg9/AgAWZM90WjtxTWHX+s+vn0fCyqbEctd+iT33MLtfpdKNyotmAgCAjz0BAADAngAAAHsCAADsCQAAsCcAAMCeAAAAYE8AAIA9AQAA9gQAANgTAABgTwAAALAnAAAsjf8BjhZspMYdTGYAAAAASUVORK5CYII=" width="447" height="109" class="img_ev3q"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-clear--mengosongkan-isi-vector">◉ Method <code>clear</code> ➜ mengosongkan isi vector<a class="hash-link" href="#-method-clear--mengosongkan-isi-vector" title="Direct link to heading">​</a></h3><p>Method <code>clear</code> digunakan untuk mengosongkan sebuah vektor.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">clear</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"length: {}, capacity: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">capacity</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></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vwAGVvNm1G7EmwBV6EwAAbwIA4E0AAMCbAAB4EwAAbwIA4E0AALwJAAB4EwAAbwIA1OR/cAMaYB8BKLMAAAAASUVORK5CYII=" width="445" height="94" class="img_ev3q"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-append--concatenationpenggabungan-vector">◉ Method <code>append</code> ➜ concatenation/penggabungan vector<a class="hash-link" href="#-method-append--concatenationpenggabungan-vector" title="Direct link to heading">​</a></h3><p>Method <code>append</code> digunakan untuk menggabungkan dua buah vector. Penggunaannya cukup mudah, panggil saja method nya lalu sisipkan <em>mutable reference</em> dari vector satunya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> result_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> data_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">7</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">result_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">append</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> data_two</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"length: {}, capacity: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">capacity</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAAB9CAIAAAC+kfQGAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB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yplGow2kafAJblJDrrfFFKQRFLGGRn3RVQ51544Z3Bc9WapeKu+JHrvQYk2ANEoQXWg0OGj459d82Cc8Ovk7GnzpoUo9ZDWNRssEcpMkl6g4UxDvXeeih+cuK6IbywG+6OqxVV/0sPho/YU0ShAdaPTSKNqLaTzKecvRSaMEcfM0OvpZ1Txyy9FJowRx9TTKO/Wb2Zg0ShBXSKMEQRCkUYIgCNIoQRAEQRolCIK4AI2ucH39zpvPzexvNKidEgRxUG90dZKDh+qbczjKjjOg0T5fFuAWPEGQRsuKeGCyWJ9GD24Qgrh6GpVXEsebosHVUeEQjYc/FYHnMQcZ/c55bbRNzzgtqaZOrVdTUacWacpFEmyQRDck+rmVQQiC6EejieJIoH+/cMWixxZIm4RMgG7Kp9HdrNGqZwyvUiLN6UgCZK4dVqfWr2dK3xuKYykf/NjEIARB9KTR2NEZBmwSZPoRDn9bJx9GL5vANugZ52XzpiLlhazDkFqaDhoNw5TP+FcReCYIoheNos9bKjwYuKAxq3Sg0RY9Y0UAFGhOCxoVSlZTSEtU1EOjS6CK+XmzwDNBEL1pVI5JHEQTZluZRhv1jHEEqDkNvFFXyAoanUJVrXI2GoQgiL6TergHjHhQH71ixmvQqHdHpV7PGFcJak4nYv+WjrWxVS4Ng5cATmT492/6vM0gBEFsS6NiAi8/mxx8Ytn2RmM2S/b6W2m0Vc84rpKuTg0/N62qU4s0NXtq5Yermo0GIQjiEt5oJcAK3QV2OlbdYNl4etznVD5BEIehUfCppG39onX0jC9Go5yME8TN02g6qb8CStiIRtWPyRMEcWs0ShAEQRolCIIgSKMEQRCkUYIgCNIoQRAEaZQgCIIgjRIEQZBGCYIgSKMEQRAHx/8BRc/bn/H2QocAAAAASUVORK5CYII=" width="450" height="125" class="img_ev3q"></p><p>Pada contoh di atas <code>result_one</code> adalah vector mutable dengan isi 3 elemen. Kemudian dideklarasikan <code>data_two</code> yang isinya juga vector 3 elemen. Vector <code>data_two</code> dimasukkan kedalam vector <code>result_one</code> dengan menggunakan method <code>append</code>, dengan ini maka isi <code>result_one</code> adalah gabungan dari <code>result_one</code> yang lama dan <code>data_two</code>.</p><p>Proses append vector mengharuskan parameter method <code>append</code> diisi dengan <em>mutable reference</em> dari vector yang ingin dimasukkan. Cara untuk mengambil <em>mutable reference</em> adalah dengan menggunakan keyword <code>&mut</code>.</p><p>Ok, selanjutnya tambahkan lagi isi <code>result_one</code> dengan vector lain.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">result_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">append</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"length: {}, capacity: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">capacity</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAAB/CAIAAADw7lslAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS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CI+pk79F0Q/ekEIka1wZ6OZb5m3V9UJSjtnEjpW3LRhosnDYOn2GdO/SM+pVa/7knqJIjV2FPM0uV3hoNvEtu+Z0xiya59G3ueZtD9leK9SNoZfp9ZFYEWaWr2PClHMeH6pMcgQATalHYmCGIZ37Nh3ph8xWyD8TrrDsnKd6KWOURPEMTe2RN8dmjdzYp5hHs3Y0+eKiKIW2XPdK54BUywEns2fHSdIIirYE+CIAiyJ0EQBEH2JAiCIHsSBEGQPQmCIMieBEEQZE+CIAiC7EkQBEH2JAiC2Aj/A0eMR7gw7IWCAAAAAElFTkSuQmCC" width="447" height="127" class="img_ev3q"></p><p>Proses penggabungan vector pada contoh ke-dua di atas sedikit berbeda. Method <code>append</code> parameternya adalah langsung <em>mutable reference</em> dari literal vector. Ini merupakan salah satu cara yang bisa digunakan dalam penggabungan vector.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-sort--untuk-mengurutkan-vector">◉ Method <code>sort</code> ➜ untuk mengurutkan vector<a class="hash-link" href="#-method-sort--untuk-mengurutkan-vector" title="Direct link to heading">​</a></h3><p>Method <code>sort</code> digunakan untuk mengurutkan elemen vector.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">result_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">sort</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAAB/CAIAAADw7lslAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtb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="127" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a162-macam-deklarasi-vektor">A.16.2. Macam deklarasi vektor<a class="hash-link" href="#a162-macam-deklarasi-vektor" title="Direct link to heading">​</a></h2><p>Ada beberapa cara deklarasi vector. Pada contoh berikut dua buah vector dideklarasikan menggunakan macro <code>vec!</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> vector_4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> vector_5</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i64</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Vector <code>vector_4</code> didefinisikan dengan cara yang sudah kita terapkan sebelumnya, yaitu menggunakan macro <code>vec</code>. Vector <code>vector_5</code> juga didefinisikan dengan cara yang sama, hanya saja pada vector ini tipe datanya ditentukan secara eksplisit yaitu <code>Vec<i64></code>.</p><p><code>Vec<i64></code> Artinya adalah vector dengan tipe data elemen adalah <code>i64</code>. Dengan notasi penulisan <code>Vec<T></code> bisa ditentukan tipe data elemen yang diinginkan.</p><p>Cara deklarasi vector selanjutnya adalah pembuatan vector dengan isi kosong. Deklarasi vector ini mewajibkan tipe data vector dituliskan secara eksplisit, dikarenakan tipe data tidak bisa diidentifikasi dari isinya (karena isinya kosong). Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> vector_7</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> vector_8</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Vector <code>vector_7</code> dan <code>vector_8</code> keduanya bertipe vector dengan isi atau elemen bertipe data literal string <code>&str</code>.</p><p>Deklarasi vector kosong bisa dilakukan dengan macro <code>vec</code> yang ditulis tanpa isi, atau bisa menggunakan <code>Vec::new()</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a163-iterasi-data-vector">A.16.3. Iterasi data vector<a class="hash-link" href="#a163-iterasi-data-vector" title="Direct link to heading">​</a></h2><p>Keyword <code>for in</code> bisa digunakan untuk iterasi vector. Cara penerapannya seperti pada array atau slice.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> vec_eight </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> e </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> vec_eight </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// 1 2 3</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> vec_nine </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token plain">vec_nine</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} "</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> vec_nine</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">i</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// 1 2 3</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Keyword perulangan lainnya juga bisa digunakan.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a164-ownership-tipe-data-vector">A.16.4. Ownership tipe data vector<a class="hash-link" href="#a164-ownership-tipe-data-vector" title="Direct link to heading">​</a></h2><p>Salah satu atribut vector yang penting untuk diketahui adalah, pemilik data sebenarnya (atau owner). Agar lebih jelas, silakan coba terlebih dahulu kode berikut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> vec_ten </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> e </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> vec_ten </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token plain">vec_ten</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} "</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> vec_ten</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">i</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="/assets/images/vector-11-27b0884891ab00c87d90603997e1878c.png" width="634" height="626" class="img_ev3q"></p><p>Terlihat sekilas tidak ada kode yang bermasalah dari program di atas, tapi error, aneh.</p><p>Di Rust, ownership atau kepemilikan data adalah hal yang sangat penting. Saking pentingnya, beberapa orang menyebut Rust sebagai bahasa yang <em>value oriented</em>.</p><p>Dalam kasus kode program vector di atas, ketika keyword <code>for in</code> digunakan untuk mengiterasi vector <code>vec_ten</code>, membuat pemilik data vektor berpindah ke variabel <code>e</code>. Hal ini efeknya adalah ketika kita berusaha mengakses variabel yang sama setelah perulangan selesai, maka yang muncul adalah error, karena value-nya sudah berpindah.</p><blockquote><p>Perpindahan owner disebut dengan <em>move semantics</em>. Lebih jelasnya nanti dibahas pada chapter <a href="/basic/ownership">Ownership</a></p></blockquote><p>Solusi untuk antisipasi error ini adalah dengan cara meminjam value yang sebenarnya dari owner, untuk kemudian digunakan dalam perulangan. Caranya dengan menggunakan teknik <em>borrowing</em> menggunakan operator <code>reference</code> yaitu <code>&</code>. Data sebenarnya milik owner dipinjam untuk dipergunakan di perulangan.</p><blockquote><ul><li>Lebih jelasnya mengenai reference dibahas pada chapter <a href="/basic/pointer-references">Pointer & References</a></li><li>Lebih jelasnya mengenai borrowing dibahas pada chapter <a href="/basic/borrowing">Borrowing</a></li></ul></blockquote><p>Silakan ubah kode yang sebelumnya ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> e </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> vec_ten </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... menjadi seperti ini, kemudian run, maka error akan hilang.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> e </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">vec_ten </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Salah satu alternatif cara lainnya untuk antisipasi value berpindah tempat adalah dengan menggunakan method <code>iter</code> untuk mengkonversi vector menjadi iterator. Jadi yang di-iterasi bukan vector-nya, melainkan objek iterator yang dibuat dari vector tersebut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> e </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> vec_ten</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><ul><li>Lebih jelasnya mengenai <em>ownership</em> dibahas pada chapter <a href="/basic/ownership">Ownership</a></li><li>Lebih jelasnya mengenai <em>borrowing</em> dibahas pada chapter <a href="/basic/borrowing">Borrowing</a></li></ul></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a165-vector-slice">A.16.5. Vector slice<a class="hash-link" href="#a165-vector-slice" title="Direct link to heading">​</a></h2><p>Seperti array, slice juga bisa dibuat dari vector. Cara penerapannya juga sama persis. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> vec_population </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> vec_sample </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">vec_population</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> vec_sample</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// [2]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Semua operasi slice bisa diterapkan di vector.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a166-tipe-data-vecdequet">A.16.6. Tipe data <code>VecDeque<T></code><a class="hash-link" href="#a166-tipe-data-vecdequet" title="Direct link to heading">​</a></h2><p>Tipe data <code>VecDeque<T></code> adalah sama seperti <code>Vec<T></code> plus mendukung operasi menambah dan mengurangi elemen dari dua sisi secara efisien.</p><p>Pada tipe data <code>Vec<T></code>, ada method <code>pop</code> yang fungsinya menghapus data elemen terakhir dan method <code>push</code> untuk menambah elemen baru dari kanan. Tipe data <code>VecDeque</code> memiliki bebebrapa method tambahan, yaitu:</p><ul><li>method <code>pop_front</code> untuk hapus data elemen pertama atau paling kiri (indeks ke-0)</li><li>method <code>push_front</code> untuk menambah data dari kiri (indeks ke-0)</li><li>method <code>pop_back</code> untuk hapus data elemen pertama atau paling kanan (indeks terakhir)</li><li>method <code>push_back</code> untuk menambah data dari kanan (indeks terakhir)</li></ul><p>Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">collections</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">VecDeque</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> vec_10 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">VecDeque</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">vec_10</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pop_front</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">vec_10</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push_front</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> vec_10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">vec_10</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pop_back</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">vec_10</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push_back</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"h"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> vec_10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcUAAACBCAIAAAA+HTYdAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxu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aJSbQKOluzHFPy+RnNePQKPQXYtJ4GW8w//3m7X8/7UeMk/uePbAIcTu3tlH3392tXTtW9TeUa99xnr7GGmbG/D3D7enptOk2pmzfPN58RegqAnq6up0PEvYLGrZYRegqAnjatN1zBO+Bm4P19APQUAAA9BQAA9BQAAD0FANiHnuInvaL/aVNG7EcB7E5P8ZO+akY8LwWAnrZm+i78pGdkhJ4CbF1P8ZPONWsFP+kZGaGnANvWU/yklXCv4CcdZuT0QkVPAbasp/hJV1ukp5/0eGlf06GnALeop/hJd1cw9BTgXegpftKzFyPQU4B3q6f4SZey6eonjZ4C7E1P8ZMuZdTTTxo9Bdifnl4b/KRnrkUAAHraXU/xkwaAd6un+En7Gwk9BUBPAQDQUwAA9JQmAABATwEA0FMAAPQUAADQUwAA9BQAYPP8D9CBw9rPZAhHAAAAAElFTkSuQmCC" width="453" height="129" class="img_ev3q"></p><p>Tipe data <code>VecDeque<T></code> tidak otomatis di-import. Kita perlu mengimport path di mana tipe data tersebut berada menggunakan keyword <code>use</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">collections</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">VecDeque</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Cara membuat vector <code>VecDeque<T></code> bisa menggunakan <code>VecDeque::from</code> dengan parameter diisi data vectornya, seperti pada kode program yang sudah ditulis.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/vector" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../vector</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/std/macro.vec.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/macro.vec.html</a></li><li><a href="https://doc.rust-lang.org/std/vec/struct.Vec.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/vec/struct.Vec.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/std/vec.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/std/vec.html</a></li><li><a href="https://doc.rust-lang.org/std/collections/struct.VecDeque.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/collections/struct.VecDeque.html</a></li><li><a href="https://stackoverflow.com/questions/36672845/in-rust-is-a-vector-an-iterator" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/36672845/in-rust-is-a-vector-an-iterator</a></li><li><a href="https://stackoverflow.com/questions/28800121/what-do-i-have-to-do-to-solve-a-use-of-moved-value-error" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/28800121/what-do-i-have-to-do-to-solve-a-use-of-moved-value-error</a></li><li><a href="https://stackoverflow.com/questions/43036279/what-does-it-mean-to-pass-in-a-vector-into-a-for-loop-versus-a-reference-to-a" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/43036279/what-does-it-mean-to-pass-in-a-vector-into-a-for-loop-versus-a-reference-to-a</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/tuple"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.15. Tuple</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/function"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.17. Function</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a161-tipe-data-vect" class="table-of-contents__link toc-highlight">A.16.1. Tipe data <code>Vec<T></code></a><ul><li><a href="#-deklarasi-vektor-size-dan-capacity" class="table-of-contents__link toc-highlight">◉ Deklarasi vektor, size, dan capacity</a></li><li><a href="#-method-pop--menghapus-elemen-terakhir" class="table-of-contents__link toc-highlight">◉ Method <code>pop</code> ➜ menghapus elemen terakhir</a></li><li><a href="#-method-remove--menghapus-elemen-index-ke-i" class="table-of-contents__link toc-highlight">◉ Method <code>remove</code> ➜ menghapus elemen index ke <code>I</code></a></li><li><a href="#-method-push--menambahkan-elemen-baru" class="table-of-contents__link toc-highlight">◉ Method <code>push</code> ➜ menambahkan elemen baru</a></li><li><a href="#-realokasi-vector" class="table-of-contents__link toc-highlight">◉ Realokasi vector</a></li><li><a href="#-mengubah-value-sebuah-elemen-menggunakan-notasi-i" class="table-of-contents__link toc-highlight">◉ Mengubah value sebuah elemen menggunakan notasi <code>[i]</code></a></li><li><a href="#-method-is_empty--mengecek-apakah-vector-kosong" class="table-of-contents__link toc-highlight">◉ Method <code>is_empty</code> ➜ mengecek apakah vector kosong</a></li><li><a href="#-method-clear--mengosongkan-isi-vector" class="table-of-contents__link toc-highlight">◉ Method <code>clear</code> ➜ mengosongkan isi vector</a></li><li><a href="#-method-append--concatenationpenggabungan-vector" class="table-of-contents__link toc-highlight">◉ Method <code>append</code> ➜ concatenation/penggabungan vector</a></li><li><a href="#-method-sort--untuk-mengurutkan-vector" class="table-of-contents__link toc-highlight">◉ Method <code>sort</code> ➜ untuk mengurutkan vector</a></li></ul></li><li><a href="#a162-macam-deklarasi-vektor" class="table-of-contents__link toc-highlight">A.16.2. Macam deklarasi vektor</a></li><li><a href="#a163-iterasi-data-vector" class="table-of-contents__link toc-highlight">A.16.3. Iterasi data vector</a></li><li><a href="#a164-ownership-tipe-data-vector" class="table-of-contents__link toc-highlight">A.16.4. Ownership tipe data vector</a></li><li><a href="#a165-vector-slice" class="table-of-contents__link toc-highlight">A.16.5. Vector slice</a></li><li><a href="#a166-tipe-data-vecdequet" class="table-of-contents__link toc-highlight">A.16.6. Tipe data <code>VecDeque<T></code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.16. Vector</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.16. Tipe Data ➜ Vector</h1></header><p>Pada chapter ini kita akan belajar tetang tipe data <em>Vector</em>. Vector adalah tipe data seperti array tapi dinamis. Dinamis di sini artinya bisa bertambah dan berkurang kapanpun sesuai kebutuhan.</p><p>Vector sangat mirip seperti array, yang karakteristiknya adalah tipe data elemen wajib sama, punya informasi size, elemen-nya bisa diakses atau diubah. Salah satu perbedaan vector dibanding array adalah jumlah elemen pada vector bisa bertambah lebih dari kapasitas yang sudah ditentukan.</p><p>Vector memiliki 3 buah atribut yg penting untuk diketahui:</p><ul><li>pointer ke data asli</li><li>lebar atau size</li><li>kapasitas (representasi dari seberapa banyak memori di-booking untuk data vector tersebut)</li></ul><p>Vector bisa bertambah jumlah isinya selama size di bawah kapasitas yang sudah dialokasikan. Jika suatu ketika vector isinya bertambah lebih banyak dari jumlah alokasi maksimal kapasitas, maka vector akan dialokasikan ulang dengan kapasitas yang lebih besar.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a161-tipe-data-vect">A.16.1. Tipe data <code>Vec<T></code><a class="hash-link" href="#a161-tipe-data-vect" title="Direct link to heading">​</a></h2><p><code>Vec<T></code> adalah tipe data yang merepresentasikan vector, yang mana <code>T</code> adalah generics. Vector datanya dialokasikan di heap memory.</p><blockquote><ul><li>Lebih jelasnya mengenai generic dibahas pada chapter <a href="/basic/generics">Generics</a></li><li>Lebih jelasnya mengenai heap dibahas pada chapter <a href="/basic/basic-memory-management">Basic Memory Management</a></li></ul></blockquote><p>Langsung saja kita praktikkan.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-deklarasi-vektor-size-dan-capacity">◉ Deklarasi vektor, size, dan capacity<a class="hash-link" href="#-deklarasi-vektor-size-dan-capacity" title="Direct link to heading">​</a></h3><p>Ada beberapa cara yang bisa dipakai untuk membuat data vector. Salah satunya adalah menggunakan macro <code>vec</code>, penulisannya seperti pembuatan array hanya saja perlu ditambahi prefix <code>vec!</code>. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> data_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"batman"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"superman"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"lobo"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"length: {}, capacity: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">capacity</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcUAAABuCAIAAADZD59KAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczp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kVcxNhvO/FQ09zXTq7gSH+vogV6NLHkql4yr9dctZTQOrbkUc6UuDUJRVBeeAq9ixSwj5oDt5L/dC27Lyll5SGyY433RU2p5Ongap1n/YSbOn1LUsXmKvIqtT3Es8ekChQY8rYAjjE7BAUueynGAKlJavpsenibfj9tERE6gUtSheSqvb5wknj1FjqMteLpid7hH2VPZNK62SuHi6ZxqK075hj9FHXi8D72KERD161iETAZPVyy/CKfTUniGqlT0VA4YxcbVxqfgZMPgGHKg7J8/wLJ0Q4NQFHUhnmrOvtLHtxyfqm7HBa9iDz6S8khSeT9xqa3Fp57KfuNqkafWnnfw887KktbGBqEo6qLx6T7jzAvN4+3qatx56My1eYoiT9WRd99QaX9X46485UCdosjTHGg3NO7sxNNzuzE2pSjylKIoijylKIqiyFOKoijylKIoijylKIoiTymKoijylKIoijylKIoiTymKoijylKIoijylKIo6rv4HCffy3PPDcloAAAAASUVORK5CYII=" width="453" height="110" class="img_CujE"></p><p>Pada contoh di atas variabel <code>data_one</code> adalah sebuah vector yang isinya 3 elemen, yaitu literal string <code>batman</code>, <code>superman</code>, dan <code>lobo</code>. Vector <code>data_one</code> dideklarasikan menggunakan macro <code>vec</code> kemudiaan diikuti notasi penulisan yang mirip seperti array.</p><blockquote><p>Lebih jelasnya mengenai macro dibahas pada chapter <a href="#/wip/macro">Macro</a></p></blockquote><p>Pembuatan vector menggunakan teknik ini hasilnya adalah data vector yang <code>size</code> dan <code>capacity</code> nya adalah sesuai dengan <em>predefined value</em>, yang pada konteks ini adalah 3.</p><p>Umumnya vector dideklarasikan dengan keyword <code>mut</code> agar bisa diubah nilainya, karena tujuan disediakannya tipe data ini adalah untuk bisa mengakomodir tipe data array tetapi dinamis (bisa manipulasi datanya).</p><p>Perihal method <code>len</code> dan <code>capacity</code>:</p><ul><li>Method <code>len</code> digunakan untuk mencari tahu size atau jumlah elemen yang ada pada sebuah vector</li><li>Method <code>capacity</code> digunakan untuk mencari tahu kapasitas atau jumlah maksimum elemen yang ada pada sebuah vector</li></ul><blockquote><p>O iya, kode program di atas akan menghasilkan warning saat di-run. Hal ini dikarenakan variabel <code>data_one</code> yang didefinisikan mutable belum diubah nilainya. Hiraukan saja, karena selanjutnya kita akan manipulasi data variabel tersebut.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-pop--menghapus-elemen-terakhir">◉ Method <code>pop</code> ➜ menghapus elemen terakhir<a class="hash-link" href="#-method-pop--menghapus-elemen-terakhir" title="Direct link to heading">​</a></h3><p>Oke, selanjutnya mari kita oprek variabel <code>data_one</code> yang sudah ditulis.</p><p>Tipe data <code>Vec<T></code> memiliki method <code>pop</code> yang fungsinya menghapus data elemen terakhir. Mari gunakan method ini pada <code>data_one</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pop</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"length: {}, capacity: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">capacity</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAAB0CAIAAACZnqXOAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI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Bn7WZ6+cVR0jMEMg2fLd/nO/9ponH4OkaOSWu7ULo/k7G39dHM5SWI6SWdOd1mTTmsQMIrQhWFUWQJrT9/M2iQmQRmNGpbAu2BUxbAt6+KWP7QdF5extzTHSsA53Y4AiiJ0sRgVlsCGb0Xc/es++asZ0M0a07fHvRVXui92SitPB0bjNPM/8MTcKEIXiVFlCVz7vsUYjY4s2Aijc7+saQSwLeviOBwtUtaCYg9Gk0/FLV59Ix5F6NIwWnZrnSSeGVUOn2titEPZPFzIA7ati6v+0LVKuDA6pFpKUQxCELq8Qb2M+RQH7e5bBEgVjLqmAk2G+oyTVZWa1sWBntofuhIalw2jI8YjXP/8ERahu6y5IYTWwGgxgC8/m1z7vkWxTi9NhRuWwB5qZMeJj+Q1To6rZLtTT/OHLvK02vPOePBVzvR6GiQ5EAxF6PzR6DqDyTPN0a36IOnO42NW2RF64RhNR5Nz138WFmDdh/F3xSijcYRePEbzwfYNIGEnjJ7ajUgUITCKEEJgFCGEEBhFCCEwihBCYBQhhMAoQgghMIoQQmAUIYTAKEIIgVGEEAKjCCGE5uh/fx42cQ4+0S8AAAAASUVORK5CYII=" width="450" height="116" class="img_CujE"></p><p>Bisa dilihat pada contoh di atas, setelah menggunakan method <code>pop</code>, isi <code>data_one</code> menjadi 2 elemen saja. Elemen terakhir (yaitu string <code>lobo</code>) dihapus. Efeknya, atribut size menjadi 2, tapi kapasitas tetap 3.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-remove--menghapus-elemen-index-ke-i">◉ Method <code>remove</code> ➜ menghapus elemen index ke <code>I</code><a class="hash-link" href="#-method-remove--menghapus-elemen-index-ke-i" title="Direct link to heading">​</a></h3><p>Method <code>remove</code> adalah salah satu method lainnya yang ada pada tipe data <code>Vec<T></code>. Kegunaan dari method <code>remove</code> adalah untuk menghapus elemen pada indeks tertentu.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">remove</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"length: {}, capacity: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">capacity</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAACGCAIAAADBxB3cAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOk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yufh9XdNdAtwngBAYdWOje9bomFHeirfHfj5spSB00xhNH/q0/YzDqOgUgxkGz5bv8p3vsdHvP0dLptnECHJquVPbxTTcqbNj5pMkppN0WOboo/c52g0QjRCaidHEtKPgZ5xYm4QkyKNRww65gRrzMRrZOY1HK9s21/yh1TGt2FuaY0XgbLcjgKII7Rajp3dufI+vUsOzI7z8yz75Myw/FsRofT9plCcJFaa0junAaJhmHgi3Wh1ECIw2YzQfhZoYTd7dObFgZxhVdvl3ddvmMBzNUhrHdGM0ek3eRSBkchShPWI0v6x1knBmVDl87igazU5Yt20u+kOXCuHC6JDqUopijoLQ/gb16mXskoP25ZvxroDRy+ZGo8nM8gA4OUfVtnmkp/aHltVkcU3/AJzg+utXun3GEhMURehqGM0G8Plrk4NXF5ej0ZhmyVr/hRjN8jmdKbXd9xzCdqdu84fOjmnV5526+eHOWKVqrhAYitD1o9FlBpNXmqOzF8z3Pz5mlR2hN47ReDRZGOSumYFln2vaFKOMxhF68xhNB/U3gISNMHquNyJRhMAoQgiBUYQQQmAUIYTAKEIIgVGEEAKjCCGEwChCCIFRhBACowghBEYRQgiMIoQQAqMIIQRGEUIIjCKE0JvT/wE0Wjx1dKk4VAAAAABJRU5ErkJggg==" width="450" height="134" class="img_CujE"></p><p>Dicontohkan di atas elemen indeks ke-<code>1</code> dihapus dengan cara memanggil method <code>remove</code> lalu menyisipkan indeks elemen sebagai parameter pemanggilan method. Hasilnya elemen <code>superman</code> dihapus dari vector.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-push--menambahkan-elemen-baru">◉ Method <code>push</code> ➜ menambahkan elemen baru<a class="hash-link" href="#-method-push--menambahkan-elemen-baru" title="Direct link to heading">​</a></h3><p>Sekarang isi dari vector <code>data_one</code> tinggal 1 elemen, mari kita tambahkan 3 elemen baru dengan memanfaatkan method <code>push</code>.</p><p>Method <code>push</code> fungsinya adalah untuk menambahkan elemen baru pada vector.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"constantine"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"trigon"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"darkseid"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"length: {}, capacity: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">capacity</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcQAAACHCAIAAAAHhr4+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib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RzJtcwLsTeyiEgTJdHUy7TP5ecqDqW1El8mhBHF0MpUKsppQbvpunqLdq6k7X/wvnl7fVammJaDE7BeHVjSwRZ5y2UTVq9bEI30OicXUCII4JJkiBdmcHrD4wpaMTBWdXR+ZamppBUwqpels1eScCrX+8qCMw6GYU0SfZbIGfX4vnOUTxKHJFCjI6nrAWG/InuZXzPmjT3oVk2n+BWyoTaeqSowpnZpvFyyAP6Wp++pPpN/K/S6COB6ZIgXZvOpazC0rk2mYXQ2ZIiXmS141OQxNRUolTzeZRhKVpZElUOtgcEoQRyRTOTJxEqCz24BMk3XZ8pmt+jkcWzXZVKG2KuEi0zFV1eqn8cUJgiCOMs2H+8Rl4upiDmzLeP+u/46z77CUpsRsqiZPHIpleo3tdOkYvCjQ1eXXL/ixCccGVGQouZQgdiVTRRdWUZC1I1P5RRnft5WWkalbkVcqMWuqyX4VapGn5s+L8hlkuNrpdMgW31UmCKIsMq1ES53dskWA1YrdeMJ8dmlsgiCZrkZjDXR2ywxYdyN7UzLl9JwgSKYRm93QbHMjMr36jVEpQZBMCYIgSKYEQRAEyZQgCIJkShAEQTIlCIIgmRIEQRAkU4IgCJIpQRAEyZQgCIJkShAEQZBMCYIgSKYEQRAkU4IgCIJkShAEsRr+Bw1sp9tY0S8gAAAAAElFTkSuQmCC" width="452" height="135" class="img_CujE"></p><p>Bisa dilihat sekarang <code>data_one</code> isinya adalah 4 elemen dan atribut size-nya cocok, yaitu <code>4</code>. Namun ada yang aneh, kenapa kapasitas jadi <code>6</code> padahal di awal kapasitas adalah 3.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-realokasi-vector">◉ Realokasi vector<a class="hash-link" href="#-realokasi-vector" title="Direct link to heading">​</a></h3><p>Perubahan kapasitas atau realokasi vector terjadi ketika sebuah vector isinya bertambah lebih banyak dari jumlah alokasi maksimal kapasitas.</p><p>Lalu apa efeknya? secara high level bisa dibilang tidak ada, namun kalau dibahas lebih rinci, efeknya adalah di sisi alokasi space untuk menampung elemen. Proses realokasi menghasilkan vector yang baru dengan kapasitas lebih besar.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-mengubah-value-sebuah-elemen-menggunakan-notasi-i">◉ Mengubah value sebuah elemen menggunakan notasi <code>[i]</code><a class="hash-link" href="#-mengubah-value-sebuah-elemen-menggunakan-notasi-i" title="Direct link to heading">​</a></h3><p>Sama seperti array, vector juga bisa dimodifikasi nilai elemennya dengan menggunakan notasi <code>[i]</code>.</p><p>Pada contoh berikut elemen indeks ke-<code>2</code> diubah nilainya dari <code>trigon</code> ke <code>red hood</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">data_one</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"red hood"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"length: {}, capacity: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">capacity</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcEAAACDCAIAAAB6PjdsAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmF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TDj5ZZtObTOEa6j7nISBDl0Ew5tM/lzyAOldbSNSZ0EsVMOlfKrmuxu8N5be8hTkfLVNG4v/rdCr++pTWYjoJzr12BWpKZFnnJtRJWF1iQYfQaJtckIgtgThyL51Zzsrvj0lIxDFW1jH4eG8g4TOBS9W5cTJ86JPevv68moG8opRaxZJjXQ5vfMqTxB7JFDkZytLmwDFX/sufyEiX30ratiDs3LqkNROFW2IdUzn8ChibDFhO/iRHqp3MIiiN1wKJSzzcqdxZSyMIeG2U3hUCR4fMmLE4eBqEip5Onm0EjosTSOTAp4U6ceCOIIHCoHJE4SroaaauqzODRZcy2fvqofjLHFiU2xZ6sRLg4NpH7nSleTQwliT3N5uONbJl0uJrq29PXf6R8+9p120gSPTXHigTqxxq2xMS4Ng2f+TVteXuB3GRx7SlFFSaEEsQWHKqKqivyqHYfKb674vlM0j0PdcrZS8FgTJ/aLPYs8NXtelC/3wpVMp0FW+hAxQRDV3vUEq3IbbG0suqOy8qz46ArUBEEOnctemSWA+vS57Jb0qhzKOThBvG0OTefyJ+CDlTj0ajfGoATxxjmUIAiCHEoQBEGQQwmCIMihBEEQ5FCCIAhyKEEQBDmUJiAIgiCHEgRBbID/AdPT3RucKBFQAAAAAElFTkSuQmCC" width="449" height="131" class="img_CujE"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-is_empty--mengecek-apakah-vector-kosong">◉ Method <code>is_empty</code> ➜ mengecek apakah vector kosong<a class="hash-link" href="#-method-is_empty--mengecek-apakah-vector-kosong" title="Direct link to heading">​</a></h3><p>Method <code>is_empty</code> digunakan untuk mengidentifikasi apakah sebuah vector isinya kosong atau tidak.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> is_vector_empty </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">is_empty</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"result: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> is_vector_empty</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAABtCAIAAAC+8Pi1AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgIC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jP5Dw3dzopMS8dAABeK3u2MCLsCQBYlz17RhtnuwPhTNPfgIOCi8erEUclhBX+DO/Msu1m4x6mE6FnkHFMzBl75pW3mgkAAD72HLnjwCUdBwU0NV6T0ZyXPYuxZ509LfL9+uv3kN9UT2dlbo1mAgCAmz3/hBT0u7sWMM3AeR2FidDvZPZ0o7jsWS5dVV43EwAAGmbulUhvSDHueA8Xzs2eSVVrpUeVt5sJAACz2bO8CjgGrOdlzzxu/uloxHAX+0oAgIXZU05zswQjex5v70O7In8Zi4uzd42Sdcu/PvaMKg9/AgAWZM90WjtxTWHX+s+vn0fCyqbEctd+iT33MLtfpdKNyotmAgCAjz0BAADAngAAAHsCAADsCQAAsCcAAMCeAAAAYE8AAIA9AQAA9gQAANgTAABgTwAAALAnAAAsjf8BjhZspMYdTGYAAAAASUVORK5CYII=" width="447" height="109" class="img_CujE"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-clear--mengosongkan-isi-vector">◉ Method <code>clear</code> ➜ mengosongkan isi vector<a class="hash-link" href="#-method-clear--mengosongkan-isi-vector" title="Direct link to heading">​</a></h3><p>Method <code>clear</code> digunakan untuk mengosongkan sebuah vektor.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">clear</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"length: {}, capacity: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> data_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">capacity</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb0AAABeCAIAAAA4612LAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9i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IVJoukx+nzPIc3AeAivBkMyxPedEriTQC4Km8eh9hvcvjtetMtiTcB4EK9KaY328Bx8Ka66tPbK5jCTJRkfhMALtWb4h7z178HUfXXhYbB9+uLspf85G+yJN4EgEv15qnBmwCAN/EmAODNjb3J8+kAgDcBAPAmAADeBAAAvAkAsL03xxswt70Ec1UXx5vrWvVTQANAzXhzdatFdxct30J4y/15eXObXPrceACAN9OG6JZXD8WfUQi6cp2b8wi6BNiPN+Pgrn0IUzyVGYU87U2YTobjdgvx4jdZT2TqB+Ojx+RLgzM3PbO/m0565mid8byH3SAy76k+LWQ+onoohDQBduTNIF2HyPg+yqH9K8gLIr/6cbwZL56rCbm6TlWF0rCCVCvpsqznuHd2emY/8I2jazOVlDJl2aP9zfpeGKYD7MWbOpRpvqFBkf6F/L6nM8ObixeOcrvIrY3WigLO6Qi1r9J0JmdZ0ltnhjdlmfJBvM4+dZYzFwAX5c14YOl6UwSZWiPrezMc+hYvbyxgJF2OvBnlfepLOuvM9uZYaMaQO9gAj/ID7MCb8ZfQLiJnN4N5vzW9GY/sy8Irc4Nm0mUj3swqOcObfalZM5V6fXgT4NTjdPNKrSU+/+saDWIT3syZzmuqJH7EQ18kmh6lWrtkJl0O0tunEjknLmjHDWOP6o/2e3sL38+9LqQqijYBankzGpPHv+4rfgk4HW9qfQVX5Bd6U63QuuJUsnx87XtMumz+KrKbnjlap9eeN879p+bMZHGDIE2AE8SbMzFm2U5weWLVqyKVR7zb3A4PAPv1ph4fnuBG7DbcXdM8Vb3J+Brg+rwZjtMvwAGVvNm1G7EmwBV6EwAAbwIA4E0AAMCbAAB4EwAAbwIA4E0AALwJAAB4EwAAbwIA1OR/cAMaYB8BKLMAAAAASUVORK5CYII=" width="445" height="94" class="img_CujE"></p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-append--concatenationpenggabungan-vector">◉ Method <code>append</code> ➜ concatenation/penggabungan vector<a class="hash-link" href="#-method-append--concatenationpenggabungan-vector" title="Direct link to heading">​</a></h3><p>Method <code>append</code> digunakan untuk menggabungkan dua buah vector. Penggunaannya cukup mudah, panggil saja method nya lalu sisipkan <em>mutable reference</em> dari vector satunya.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> result_one </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> data_two </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">7</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">6</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">result_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">append</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> data_two</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"length: {}, capacity: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">capacity</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAAB9CAIAAAC+kfQGAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTAtMDdUMTc6Mzk6NTkrMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyLTEwLTA3VD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vNKidEgRxUG90dZKDh+qbczjKjjOg0T5fFuAWPEGQRsuKeGCyWJ9GD24Qgrh6GpVXEsebosHVUeEQjYc/FYHnMQcZ/c55bbRNzzgtqaZOrVdTUacWacpFEmyQRDck+rmVQQiC6EejieJIoH+/cMWixxZIm4RMgG7Kp9HdrNGqZwyvUiLN6UgCZK4dVqfWr2dK3xuKYykf/NjEIARB9KTR2NEZBmwSZPoRDn9bJx9GL5vANugZ52XzpiLlhazDkFqaDhoNw5TP+FcReCYIoheNos9bKjwYuKAxq3Sg0RY9Y0UAFGhOCxoVSlZTSEtU1EOjS6CK+XmzwDNBEL1pVI5JHEQTZluZRhv1jHEEqDkNvFFXyAoanUJVrXI2GoQgiL6TergHjHhQH71ixmvQqHdHpV7PGFcJak4nYv+WjrWxVS4Ng5cATmT492/6vM0gBEFsS6NiAi8/mxx8Ytn2RmM2S/b6W2m0Vc84rpKuTg0/N62qU4s0NXtq5Yermo0GIQjiEt5oJcAK3QV2OlbdYNl4etznVD5BEIehUfCppG39onX0jC9Go5yME8TN02g6qb8CStiIRtWPyRMEcWs0ShAEQRolCIIgSKMEQRCkUYIgCNIoQRAEaZQgCIIgjRIEQZBGCYIgSKMEQRAHx/8BRc/bn/H2QocAAAAASUVORK5CYII=" width="450" height="125" class="img_CujE"></p><p>Pada contoh di atas <code>result_one</code> adalah vector mutable dengan isi 3 elemen. Kemudian dideklarasikan <code>data_two</code> yang isinya juga vector 3 elemen. Vector <code>data_two</code> dimasukkan kedalam vector <code>result_one</code> dengan menggunakan method <code>append</code>, dengan ini maka isi <code>result_one</code> adalah gabungan dari <code>result_one</code> yang lama dan <code>data_two</code>.</p><p>Proses append vector mengharuskan parameter method <code>append</code> diisi dengan <em>mutable reference</em> dari vector yang ingin dimasukkan. Cara untuk mengambil <em>mutable reference</em> adalah dengan menggunakan keyword <code>&mut</code>.</p><p>Ok, selanjutnya tambahkan lagi isi <code>result_one</code> dengan vector lain.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">result_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">append</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">4</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"length: {}, capacity: {}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">capacity</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAAB/CAIAAADw7lslAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG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CIHsSBEGQPQmCIMieBEEQZE+CIAiC7EkQBEH2JAiC2Aj/A0eMR7gw7IWCAAAAAElFTkSuQmCC" width="447" height="127" class="img_CujE"></p><p>Proses penggabungan vector pada contoh ke-dua di atas sedikit berbeda. Method <code>append</code> parameternya adalah langsung <em>mutable reference</em> dari literal vector. Ini merupakan salah satu cara yang bisa digunakan dalam penggabungan vector.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-method-sort--untuk-mengurutkan-vector">◉ Method <code>sort</code> ➜ untuk mengurutkan vector<a class="hash-link" href="#-method-sort--untuk-mengurutkan-vector" title="Direct link to heading">​</a></h3><p>Method <code>sort</code> digunakan untuk mengurutkan elemen vector.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">result_one</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">sort</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> result_one</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAAB/CAIAAADw7lslAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4b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lx+bcE4apJ5yRcBu2zcKWmLrCndsP9gQ3wZ6R02P6nmrIuZy05jE3hT27oT+FPJqn/LExaisvrJ1URA936ydv2+dlhz3BwdgzGGHBMZVg2MVzyYyS1JDz7RoFadScpBHY0xddpU537jJx+6Iny9Bj5T3RY4cve7PVvBGSVqmNLrjusCc4GnsGLsf7z2HVPzzy+Bb1+vQwpB6ymT2N1bOUodWBK5+49ETPPLC66Mac3xddPW7qix4WPzKrM3etVWotb6+fA3AM9twaVStsE49gEn2r6LAngD23Y8/eq2oewETfKjrsCWDP5diTe+6HBvfcAewJAACwJwAAANgTAABgTwAAuDr2RB0ZLNrC7BqB22XPFfU9N5I3nkdeeCGB4YXZagZpZ8N4nFgCsOcK7LkTeeNpEiULCAx7GXAWkqq/q29rM8Oe4IDsuTd15OuWN75fUGDYVeKZGKpJl9rSZoY9weHYc7fqyNuzZxt5Ligw7Cvx2/s8Cw+N31TStJlhT3Aw9typOvI87Nk6cZ+kzbykwLAv8kRx5YkrNKo2M+wJboQ9d6COvK28cWMRlhUYrvQYW/mq2fKmNjPsCW6CPXehjrypvHHjiF9YYLjSlo18NeVbnIY2M+wJDsaeO1ZH3lDeWCaAbQWGVxBXNl5aE7WZYU9wRPbcuzry6vLGE7WZjYpNFBheRVx5orSzqs0Me4JDsufWQB35FqLDngD23I490SdGHRkA2FOe7XHP/ZjgnjuAPQEAAPYEAAAAewIAAOwJAACwJwAAwJ4AAAB7AgAAgD0BAGAJ/A9wxxZFJeVMpwAAAABJRU5ErkJggg==" width="447" height="127" class="img_CujE"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a162-macam-deklarasi-vektor">A.16.2. Macam deklarasi vektor<a class="hash-link" href="#a162-macam-deklarasi-vektor" title="Direct link to heading">​</a></h2><p>Ada beberapa cara deklarasi vector. Pada contoh berikut dua buah vector dideklarasikan menggunakan macro <code>vec!</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> vector_4 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> vector_5</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token keyword" style="color:#00009f">i64</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Vector <code>vector_4</code> didefinisikan dengan cara yang sudah kita terapkan sebelumnya, yaitu menggunakan macro <code>vec</code>. Vector <code>vector_5</code> juga didefinisikan dengan cara yang sama, hanya saja pada vector ini tipe datanya ditentukan secara eksplisit yaitu <code>Vec<i64></code>.</p><p><code>Vec<i64></code> Artinya adalah vector dengan tipe data elemen adalah <code>i64</code>. Dengan notasi penulisan <code>Vec<T></code> bisa ditentukan tipe data elemen yang diinginkan.</p><p>Cara deklarasi vector selanjutnya adalah pembuatan vector dengan isi kosong. Deklarasi vector ini mewajibkan tipe data vector dituliskan secara eksplisit, dikarenakan tipe data tidak bisa diidentifikasi dari isinya (karena isinya kosong). Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> vector_7</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> vector_8</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token operator" style="color:#393A34"><</span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Vec</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">new</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Vector <code>vector_7</code> dan <code>vector_8</code> keduanya bertipe vector dengan isi atau elemen bertipe data literal string <code>&str</code>.</p><p>Deklarasi vector kosong bisa dilakukan dengan macro <code>vec</code> yang ditulis tanpa isi, atau bisa menggunakan <code>Vec::new()</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a163-iterasi-data-vector">A.16.3. Iterasi data vector<a class="hash-link" href="#a163-iterasi-data-vector" title="Direct link to heading">​</a></h2><p>Keyword <code>for in</code> bisa digunakan untuk iterasi vector. Cara penerapannya seperti pada array atau slice.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> vec_eight </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> e </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> vec_eight </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// 1 2 3</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> vec_nine </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token plain">vec_nine</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} "</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> vec_nine</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">i</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// 1 2 3</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Keyword perulangan lainnya juga bisa digunakan.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a164-ownership-tipe-data-vector">A.16.4. Ownership tipe data vector<a class="hash-link" href="#a164-ownership-tipe-data-vector" title="Direct link to heading">​</a></h2><p>Salah satu atribut vector yang penting untuk diketahui adalah, pemilik data sebenarnya (atau owner). Agar lebih jelas, silakan coba terlebih dahulu kode berikut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> vec_ten </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> e </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> vec_ten </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> i </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token plain">vec_ten</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">len</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{} "</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> vec_ten</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">i</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="/assets/images/vector-11-27b0884891ab00c87d90603997e1878c.png" width="634" height="626" class="img_CujE"></p><p>Terlihat sekilas tidak ada kode yang bermasalah dari program di atas, tapi error, aneh.</p><p>Di Rust, ownership atau kepemilikan data adalah hal yang sangat penting. Saking pentingnya, beberapa orang menyebut Rust sebagai bahasa yang <em>value oriented</em>.</p><p>Dalam kasus kode program vector di atas, ketika keyword <code>for in</code> digunakan untuk mengiterasi vector <code>vec_ten</code>, membuat pemilik data vektor berpindah ke variabel <code>e</code>. Hal ini efeknya adalah ketika kita berusaha mengakses variabel yang sama setelah perulangan selesai, maka yang muncul adalah error, karena value-nya sudah berpindah.</p><blockquote><p>Perpindahan owner disebut dengan <em>move semantics</em>. Lebih jelasnya nanti dibahas pada chapter <a href="/basic/ownership">Ownership</a></p></blockquote><p>Solusi untuk antisipasi error ini adalah dengan cara meminjam value yang sebenarnya dari owner, untuk kemudian digunakan dalam perulangan. Caranya dengan menggunakan teknik <em>borrowing</em> menggunakan operator <code>reference</code> yaitu <code>&</code>. Data sebenarnya milik owner dipinjam untuk dipergunakan di perulangan.</p><blockquote><ul><li>Lebih jelasnya mengenai reference dibahas pada chapter <a href="/basic/pointer-references">Pointer & References</a></li><li>Lebih jelasnya mengenai borrowing dibahas pada chapter <a href="/basic/borrowing">Borrowing</a></li></ul></blockquote><p>Silakan ubah kode yang sebelumnya ...</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> e </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> vec_ten </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>... menjadi seperti ini, kemudian run, maka error akan hilang.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> e </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">vec_ten </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Salah satu alternatif cara lainnya untuk antisipasi value berpindah tempat adalah dengan menggunakan method <code>iter</code> untuk mengkonversi vector menjadi iterator. Jadi yang di-iterasi bukan vector-nya, melainkan objek iterator yang dibuat dari vector tersebut.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">for</span><span class="token plain"> e </span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> vec_ten</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">iter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">print!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{e} "</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><ul><li>Lebih jelasnya mengenai <em>ownership</em> dibahas pada chapter <a href="/basic/ownership">Ownership</a></li><li>Lebih jelasnya mengenai <em>borrowing</em> dibahas pada chapter <a href="/basic/borrowing">Borrowing</a></li></ul></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a165-vector-slice">A.16.5. Vector slice<a class="hash-link" href="#a165-vector-slice" title="Direct link to heading">​</a></h2><p>Seperti array, slice juga bisa dibuat dari vector. Cara penerapannya juga sama persis. Contoh:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> vec_population </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> vec_sample </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token plain">vec_population</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">..</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> vec_sample</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// [2]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Semua operasi slice bisa diterapkan di vector.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a166-tipe-data-vecdequet">A.16.6. Tipe data <code>VecDeque<T></code><a class="hash-link" href="#a166-tipe-data-vecdequet" title="Direct link to heading">​</a></h2><p>Tipe data <code>VecDeque<T></code> adalah sama seperti <code>Vec<T></code> plus mendukung operasi menambah dan mengurangi elemen dari dua sisi secara efisien.</p><p>Pada tipe data <code>Vec<T></code>, ada method <code>pop</code> yang fungsinya menghapus data elemen terakhir dan method <code>push</code> untuk menambah elemen baru dari kanan. Tipe data <code>VecDeque</code> memiliki bebebrapa method tambahan, yaitu:</p><ul><li>method <code>pop_front</code> untuk hapus data elemen pertama atau paling kiri (indeks ke-0)</li><li>method <code>push_front</code> untuk menambah data dari kiri (indeks ke-0)</li><li>method <code>pop_back</code> untuk hapus data elemen pertama atau paling kanan (indeks terakhir)</li><li>method <code>push_back</code> untuk menambah data dari kanan (indeks terakhir)</li></ul><p>Contoh penerapan:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">collections</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">VecDeque</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mut</span><span class="token plain"> vec_10 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">VecDeque</span><span class="token punctuation" style="color:#393A34">::</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token macro property" style="color:#36acaa">vec!</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"a"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"b"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"c"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">vec_10</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pop_front</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">vec_10</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push_front</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> vec_10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">vec_10</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pop_back</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">vec_10</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push_back</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"h"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"data: {:?}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> vec_10</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Vector" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcUAAACBCAIAAAA+HTYdAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi41IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjItMTAtMDdUMTg6MzM6NDMrMDc6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIyLTEwLTA3VDIwOjAzOjMw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QkVPAbasp/hJV1ukp5/0eGlf06GnALeop/hJd1cw9BTgXegpftKzFyPQU4B3q6f4SZey6eonjZ4C7E1P8ZMuZdTTTxo9Bdifnl4b/KRnrkUAAHraXU/xkwaAd6un+En7Gwk9BUBPAQDQUwAA9JQmAABATwEA0FMAAPQUAADQUwAA9BQAYPP8D9CBw9rPZAhHAAAAAElFTkSuQmCC" width="453" height="129" class="img_CujE"></p><p>Tipe data <code>VecDeque<T></code> tidak otomatis di-import. Kita perlu mengimport path di mana tipe data tersebut berada menggunakan keyword <code>use</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">std</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">collections</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token class-name">VecDeque</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Cara membuat vector <code>VecDeque<T></code> bisa menggunakan <code>VecDeque::from</code> dengan parameter diisi data vectornya, seperti pada kode program yang sudah ditulis.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/vector" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../vector</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/std/macro.vec.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/macro.vec.html</a></li><li><a href="https://doc.rust-lang.org/std/vec/struct.Vec.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/vec/struct.Vec.html</a></li><li><a href="https://doc.rust-lang.org/rust-by-example/std/vec.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/rust-by-example/std/vec.html</a></li><li><a href="https://doc.rust-lang.org/std/collections/struct.VecDeque.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/std/collections/struct.VecDeque.html</a></li><li><a href="https://stackoverflow.com/questions/36672845/in-rust-is-a-vector-an-iterator" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/36672845/in-rust-is-a-vector-an-iterator</a></li><li><a href="https://stackoverflow.com/questions/28800121/what-do-i-have-to-do-to-solve-a-use-of-moved-value-error" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/28800121/what-do-i-have-to-do-to-solve-a-use-of-moved-value-error</a></li><li><a href="https://stackoverflow.com/questions/43036279/what-does-it-mean-to-pass-in-a-vector-into-a-for-loop-versus-a-reference-to-a" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/43036279/what-does-it-mean-to-pass-in-a-vector-into-a-for-loop-versus-a-reference-to-a</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/tuple"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.15. Tuple</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/function"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.17. Function</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a161-tipe-data-vect" class="table-of-contents__link toc-highlight">A.16.1. Tipe data <code>Vec<T></code></a><ul><li><a href="#-deklarasi-vektor-size-dan-capacity" class="table-of-contents__link toc-highlight">◉ Deklarasi vektor, size, dan capacity</a></li><li><a href="#-method-pop--menghapus-elemen-terakhir" class="table-of-contents__link toc-highlight">◉ Method <code>pop</code> ➜ menghapus elemen terakhir</a></li><li><a href="#-method-remove--menghapus-elemen-index-ke-i" class="table-of-contents__link toc-highlight">◉ Method <code>remove</code> ➜ menghapus elemen index ke <code>I</code></a></li><li><a href="#-method-push--menambahkan-elemen-baru" class="table-of-contents__link toc-highlight">◉ Method <code>push</code> ➜ menambahkan elemen baru</a></li><li><a href="#-realokasi-vector" class="table-of-contents__link toc-highlight">◉ Realokasi vector</a></li><li><a href="#-mengubah-value-sebuah-elemen-menggunakan-notasi-i" class="table-of-contents__link toc-highlight">◉ Mengubah value sebuah elemen menggunakan notasi <code>[i]</code></a></li><li><a href="#-method-is_empty--mengecek-apakah-vector-kosong" class="table-of-contents__link toc-highlight">◉ Method <code>is_empty</code> ➜ mengecek apakah vector kosong</a></li><li><a href="#-method-clear--mengosongkan-isi-vector" class="table-of-contents__link toc-highlight">◉ Method <code>clear</code> ➜ mengosongkan isi vector</a></li><li><a href="#-method-append--concatenationpenggabungan-vector" class="table-of-contents__link toc-highlight">◉ Method <code>append</code> ➜ concatenation/penggabungan vector</a></li><li><a href="#-method-sort--untuk-mengurutkan-vector" class="table-of-contents__link toc-highlight">◉ Method <code>sort</code> ➜ untuk mengurutkan vector</a></li></ul></li><li><a href="#a162-macam-deklarasi-vektor" class="table-of-contents__link toc-highlight">A.16.2. Macam deklarasi vektor</a></li><li><a href="#a163-iterasi-data-vector" class="table-of-contents__link toc-highlight">A.16.3. Iterasi data vector</a></li><li><a href="#a164-ownership-tipe-data-vector" class="table-of-contents__link toc-highlight">A.16.4. Ownership tipe data vector</a></li><li><a href="#a165-vector-slice" class="table-of-contents__link toc-highlight">A.16.5. Vector slice</a></li><li><a href="#a166-tipe-data-vecdequet" class="table-of-contents__link toc-highlight">A.16.6. Tipe data <code>VecDeque<T></code></a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/basic/visibility-privacy.html b/basic/visibility-privacy.html index 79e10a20..04c3f05d 100644 --- a/basic/visibility-privacy.html +++ b/basic/visibility-privacy.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/visibility-privacy/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/visibility-privacy/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.28. Module System ➜ Visibility & Privacy","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/visibility-privacy/#webpage"},"wordCount":852,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/visibility-privacy/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/visibility-privacy/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/visibility-privacy","name":"A.28. Module System ➜ Visibility & Privacy","description":"Kita sebenarnya sudah mempelajari banyak hal yang berhubungan dengan visibility & privacy pada beberapa chapter sebelumnya. Jika pembaca mempelajari ebook ini secara urut, maka pastinya sudah familiar dengan keyword pub, self, crate, dan super.","datePublished":"2024-08-01T10:17:31.613Z","dateModified":"2024-08-01T10:17:31.613Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/visibility-privacy/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/visibility-privacy"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/visibility-privacy/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.28. Module System ➜ Visibility & Privacy","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/basic/visibility-privacy/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/basic/visibility-privacy/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"A.28. Module System ➜ Visibility & Privacy","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/visibility-privacy/#webpage"},"wordCount":852,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/visibility-privacy/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/visibility-privacy/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/basic/visibility-privacy","name":"A.28. Module System ➜ Visibility & Privacy","description":"Kita sebenarnya sudah mempelajari banyak hal yang berhubungan dengan visibility & privacy pada beberapa chapter sebelumnya. Jika pembaca mempelajari ebook ini secara urut, maka pastinya sudah familiar dengan keyword pub, self, crate, dan super.","datePublished":"2024-08-30T07:44:51.715Z","dateModified":"2024-08-30T07:44:51.715Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/basic/visibility-privacy/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/basic/visibility-privacy"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/basic/visibility-privacy/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"A.28. Module System ➜ Visibility & Privacy","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.28. Module System ➜ Visibility & Privacy</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.28. Module System ➜ Visibility & Privacy</h1></header><p>Kita sebenarnya sudah mempelajari banyak hal yang berhubungan dengan visibility & privacy pada beberapa chapter sebelumnya. Jika pembaca mempelajari ebook ini secara urut, maka pastinya sudah familiar dengan keyword <code>pub</code>, <code>self</code>, <code>crate</code>, dan <code>super</code>.</p><p>Chapter ini merupakan pembahasan tambahan untuk ke-4 keyword tersebut, dan fokusnya lebih ke visibility & privacy di Rust secara general.</p><p>O iya, perihal <em>visbility</em> dan <em>privacy</em> itu sendiri, kedua istilah tersebut di sini kita maknai sama, yang artinya kurang lebih adalah tentang manajemen akses item di Rust.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a281-pembahasan-module-system">A.28.1. Pembahasan module system<a class="hash-link" href="#a281-pembahasan-module-system" title="Direct link to heading">​</a></h2><p>Pastikan sudah mempelajari 5 buah chapter tentang module system yang sebelumnya sudah dibahas. Kesemua chapter tersebut sangat berhubungan dengan pembahasan chapter ini.</p><ul><li><a href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li><a href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li><a href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li><a href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li><a href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a282-default-visibility">A.28.2. Default visibility<a class="hash-link" href="#a282-default-visibility" title="Direct link to heading">​</a></h2><p>Di Rust, <em>by default</em>, hampir semua item adalah private. Apa efeknya ketika item adalah private atau publik? Silakan ingat 2 aturan penting berikut:</p><ol><li>Jika suatu item adalah private, maka item tersebut hanya bisa diakses dari <em>current module scope</em> dan dari <em>submodules</em> milik <em>current module</em>.</li><li>Jika suatu item adalah publik, maka dia bisa diakses dari module lain di luar <em>current module scope</em>, dengan catatan parent module scope item tersebut harus publik.</li></ol><blockquote><p>Kita sepakati di sini, pada istilah <strong>current module</strong> kata <em>module</em> di situ bisa saja tertuju untuk module atau juga submodule</p></blockquote><p>Dua point di atas sangat penting untuk dipahami, karena digunakan sebagai landasan pertimbangan dalam penyusunan hirarki module. Sebagai contoh, kita bisa membuat program yang hanya meng-expose API tertentu (yang memang diperlukan untuk diakses oleh publik), tanpa perlu ikut meng-expose detail implementasinya.</p><p>Ok, sekarang silakan perhatikan path sederhana di bawah ini. Diasumsikan ada sebuah fungsi yang path aksesnya adalah berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">messaging::service_layer::some_black_magic</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Segmen pertama yaitu <code>messaging</code> pasti adalah publik, karena di-import ke <em>crate root</em>. Lalu bagaimana dengan segmen <code>service_layer</code> dan juga <code>some_black_magic</code>?</p><p>Jika item <code>some_black_magic</code> di situ adalah publik, maka idealnya pengaksesan menggunakan path tersebut memungkinkan. Tapi kembali ke point ke-2 aturan yang sudah dibahas di atas, yaitu meskipun <code>some_black_magic</code> adalah publik, jika parent-nya (yang pada konteks ini adalah <code>service_layer</code>) adalah private, maka pengaksesan menggunakan path tersebut menghasilkan error.</p><p>Intinya, <strong>sebuah item bisa diakses jika item tersebut adalah publik, dan parent item tersebut juga publik. Sedangkan default visibility untuk hampir semua item adalah private.</strong></p><p>Ok, sekarang mari lanjut ke praktik menggunakan contoh dengan pembahasan yang lebih mendetail. Silakan perhatikan dan praktikkan kode berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── messaging.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── main.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/messaging.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">SOME_MESSAGE</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">service_layer</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">some_black_magic</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">messaging</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token constant" style="color:#36acaa">SOME_MESSAGE</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">service_layer</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">some_black_magic</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">messaging</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">messaging</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li><p>Konstanta <code>messaging::SOME_MESSAGE</code> adalah <strong>private</strong>. Penjelasan:</p><ul><li>Konstanta ini merupakan module item milik <code>messaging</code>.</li><li>Konstanta ini <strong>bisa diakses</strong> dari <em>current module scope</em> (<code>messaging</code>).</li><li>Konstanta ini <strong>bisa diakses</strong> dari submodule milik <em>current module</em>, yaitu submodule dari <code>messaging</code>. Contohnya bisa dilihat pada fungsi <code>messaging::service_layer::some_black_magic</code> yang di situ ada statement pemanggilan <code>SOME_MESSAGE</code>.</li><li>Konstanta ini <strong>tidak bisa diakses</strong> dari luar <em>current module scope</em> (<code>messaging</code>).</li></ul></li><li><p>Submodule <code>messaging::service_layer</code> adalah <strong>private</strong>. Penjelasan:</p><ul><li>Submodule ini merupakan module item milik <code>messaging</code>.</li><li>Submodule ini <strong>bisa diakses</strong> dari <em>current module scope</em> (<code>messaging</code>). Contohnya bisa dilihat pada fungsi <code>messaging::say_hello</code> yang di situ ada statement pemanggilan <code>service_layer</code>.</li><li>Submodule ini <strong>bisa diakses</strong> dari submodule milik <em>current module</em>, yaitu submodule dari <code>messaging</code>.</li><li>Submodule ini <strong>tidak bisa diakses</strong> dari luar <em>current module scope</em> (<code>messaging</code>).</li></ul></li><li><p>Fungsi <code>messaging::service_layer::some_black_magic</code> adalah <strong>publik</strong>. Penjelasan:</p><ul><li>Fungsi ini merupakan module item milik <code>messaging::service_layer</code>.</li><li>Fungsi ini <strong>bisa diakses</strong> dari <em>current module scope</em> (<code>messaging::service_layer</code>).</li><li>Fungsi ini <strong>bisa diakses</strong> dari submodule milik <em>current module</em>, yaitu submodule dari <code>messaging::service_layer</code>. Contohnya bisa dilihat pada fungsi <code>messaging::say_hello</code> yang di situ ada statement pemanggilan fungsi <code>some_black_magic</code>.</li><li>Fungsi ini <strong>bisa diakses</strong> dari luar <em>current module scope</em> (<code>messaging::service_layer</code>).</li><li>Namun meskipun demikian, bisa tidaknya fungsi ini diakses dari luar <em>current module scope</em> (<code>messaging::service_layer</code>) juga tergantung dengan visibility dari current module itu sendiri, yaitu <code>messaging::service_layer</code>.</li><li>Karena module <code>messaging::service_layer</code> adalah private, meskipun fungsi <code>some_black_magic</code> di dalamnya adalah publik, pengaksesan fungsi tersebut dari luar module scope <code>messaging::service_layer</code> tidak dimungkinkan.<ul><li>Pengaksesan <code>service_layer::some_black_magic</code> dari <code>messaging::say_hello</code> tidak error karena submodule <code>service_layer</code> meskipun private, posisinya adalah masih dalam satu module scope yang sama dengan fungsi <code>say_hello</code>.</li><li>Dimisalkan jika <code>service_layer::some_black_magic</code> dipaksa diakses dari <code>main</code>, maka muncul error karena <code>service_layer</code> adalah private dan posisinya tidak berada dalam module scope yang sama dengan crate root (<code>main</code>).</li></ul></li></ul></li><li><p>Fungsi <code>messaging::say_hello</code> adalah <strong>public</strong>. Penjelasan:</p><ul><li>Fungsi ini merupakan module item milik <code>messaging</code>.</li><li>Fungsi ini <strong>bisa diakses</strong> dari <em>current module scope</em> (<code>messaging</code>).</li><li>Fungsi ini <strong>bisa diakses</strong> dari submodule milik <em>current module</em>, yaitu submodule dari <code>messaging</code>.</li><li>Fungsi ini <strong>bisa diakses</strong> dari luar <em>current module scope</em> (<code>messaging</code>). Contohnya bisa dilihat pada crate root fungsi <code>main</code>, di situ ada pemanggilan statement <code>say_hello</code>.</li></ul></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a283-re-export-item">A.28.3. Re-export item<a class="hash-link" href="#a283-re-export-item" title="Direct link to heading">​</a></h2><p>Pada contoh, fungsi <code>messaging::say_hello</code> didesain sebagai media untuk mengakses fungsi <code>some_black_magic</code>. Di situasi <em>real world</em> pastinya sangat jarang terjadi sebuah fungsi isinya hanya satu baris pemanggilan fungsi lainnya. Jika memang ada situasi seperti itu, (kontekstual) lebih baik hapus saja fungsi yang jadi media pemanggilan dan langsung saja panggil fungsi di dalamnya sesuai kebutuhan.</p><p>Pada praktik selanjutnya ini kita misalkan bahwa fungsi <code>say_hello</code> isinya memang hanya 1 baris, dan yang paling penting adalah isi fungsi <code>some_black_magic</code> perlu untuk bisa diakses dari <code>main</code>. Untuk kasus seperti ini ada 3 alternatif solusi:</p><ol><li>Tidak perlu mengubah apapun, gunakan saja kode yang sudah ditulis di atas. Kode tersebut sudah bisa mengakomodir pemanggilan <code>some_black_magic</code> via <code>say_hello</code>.</li><li>Atau, hapus saja fungsi <code>say_hello</code>, lalu ubah visibility module <code>service_layer</code> menjadi publik, dengan demikian kita bisa mengakses <code>some_black_magic</code> dari <code>main</code> menggunakan path <code>messaging::service_layer::some_black_magic</code>.</li><li>Atau, gunakan teknik <strong>re-export item</strong>.</li></ol><p>Re-export item adalah sebuah cara untuk mem-<em>bypass</em> pengaksesan item yang secara hirarki memang tidak bisa diakses dari luar module (bisa jadi karena visibility item ataupun parent module nya adalah private). Dengan teknik ini, maka item pasti bisa diakses dari luar module.</p><p>Item yang di-re-export akan menjadi item milik <em>current module</em> di mana statement re-export tersebut ditulis.</p><p>Cara re-export item adalah menggunakan keyword <code>pub use</code> kemudian diikuti dengan path yang ingin di-export dan juga nama export item dengan notasi penulisan berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> the_path </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> exported_name</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">service_layer</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">some_black_magic </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> say_hello</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh jika diterapkan pada program yang sebelumnya sudah ditulis:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/messaging.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">service_layer</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">some_black_magic </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> say_hello</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">SOME_MESSAGE</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">service_layer</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">some_black_magic</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">messaging</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token constant" style="color:#36acaa">SOME_MESSAGE</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">messaging</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">messaging</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="lazy" alt="Visibility &amp; Privacy" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdIAAABtCAIAAACa6Xd1AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4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wn624OTDObpAuyrjrn++f0rfBLgPNVDFwRBEBXSLkEQBEHaJQiCIO0SBEEQpF2CIAjSLkEQBGmXIAiCIO0SBEGQdgmCIAjSLkEQBGmXIAiCIO0SBEGQdgmCIEi7BEEQxCb4HzjE/yVJRbnzAAAAAElFTkSuQmCC" width="466" height="109" class="img_ev3q"></p><p>Bisa dilihat di contoh di atas, fungsi <code>say_hello</code> dihapus, kemudian item <code>service_layer::some_black_magic</code> di-re-export dengan nama <code>say_hello</code>. Dengannya kita bisa mengakses <code>some_black_magic</code> dari luar module <code>messaging</code> menggunakan path <code>messaging::say_hello</code>.</p><p>Jika item ingin di-re-export tanpa perubahan nama item, bisa gunakan notasi berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> the_path</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">service_layer</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">some_black_magic</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jika diterapkan pada program sebelumnya, kurang lebih seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/messaging.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">service_layer</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">some_black_magic</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">SOME_MESSAGE</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">service_layer</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">some_black_magic</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">messaging</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token constant" style="color:#36acaa">SOME_MESSAGE</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">messaging</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">messaging</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">some_black_magic</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Lebih jelasnya mengenai keyword <code>use</code> dibahas pada chapter <a href="/basic/use">Module System ➜ Use</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a284-public-visibility-scope">A.28.4. Public visibility scope<a class="hash-link" href="#a284-public-visibility-scope" title="Direct link to heading">​</a></h2><p>Keyword <code>pub</code> digunakan untuk mengubah visibility item menjadi publik. Keyword ini bisa dikombinasikan dengan salah satu dari keyword <code>self</code>, <code>crate</code>, dan <code>super</code>; denganya kita bisa menentukan visibility sebuah publik item dengan scope yang lebih spesifik.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-keyword-pub">◉ Keyword <code>pub</code><a class="hash-link" href="#-keyword-pub" title="Direct link to heading">​</a></h3><p>Penulis rasa untuk penerapan keyword <code>pub</code> ini sudah sangat jelas, kita beberapa kali mempraktikkannya.</p><p>Dengan keyword <code>pub</code>, sebuah item visibility-nya menjadi publik.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-keyword-pubin-path">◉ Keyword <code>pub(in path)</code><a class="hash-link" href="#-keyword-pubin-path" title="Direct link to heading">​</a></h3><p>Keyword ini menjadikan visibility item hanya di dalam <code>path</code> yang ditulis di <code>pub(in path)</code>, dengan ketentuan <code>path</code> tersebut merupakan parent dari module item di mana keyword digunakan.</p><p>Contohnya bisa dilihat pada kode berikut. Fungsi <code>say_hello</code> didefinisikan publik dengan scope path ditentukan secara eksplisit adalah <code>crate::outer_mod</code>. Dengan demikian fungsi <code>say_hello</code> hanya bisa diakses dari dalam <code>outer_mod</code>.</p><p>Bisa dilihat di contoh, fungsi <code>say_hello</code> diakses dari <code>do_something</code>. Silakan coba saja paksa untuk mengaksesnya dari fungsi <code>main</code>, hasilnya pasti error.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">outer_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">inner_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// fungsi say_hello berikut hanya bisa diakses dari dalam `outer_mod`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// pengaksesannya dari luar `outer_mod` menghasilkan error.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">outer_mod</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">inner_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">outer_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-keyword-pubcrate">◉ Keyword <code>pub(crate)</code><a class="hash-link" href="#-keyword-pubcrate" title="Direct link to heading">​</a></h3><p>Keyword <code>pub(crate)</code> digunakan untuk membuat visibility item menjadi publik dengan scope akses <em>current crate</em>. Dengan ini item bisa diakses dari manapun asalakan masih dalam crate yang sama.</p><p>Contoh penerapannya bisa dilihat berikut ini. Fungsi <code>say_hello</code> visibility scope nya ditentukan adalah <em>current crate</em>. Fungsi tersebut bisa diakses dari <code>outer_mod_one::do_something</code>, dari <code>outer_mod_two::do_something</code>, dan juga dari fungsi <code>main</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">outer_mod_one</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">inner_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// fungsi ini visibility scope-nya di level crate</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">crate</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">inner_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">outer_mod_two</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">outer_mod_one</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">inner_mod</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">outer_mod_one</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">inner_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">outer_mod_one</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">outer_mod_two</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-keyword-pubsuper">◉ Keyword <code>pub(super)</code><a class="hash-link" href="#-keyword-pubsuper" title="Direct link to heading">​</a></h3><p>Keyword <code>pub(super)</code> digunakan untuk membuat visibility item menjadi publik dengan scope akses <em>parent module</em>.</p><p>Pada contoh berikut, fungsi <code>say_hello</code> visibility scope nya ditentukan adalah <em>parent module</em>, artinya fungsi tersebut hanya bisa diakses dari dalam <em>parent module</em> (yang pada konteks ini adalah <code>outer_mod</code>).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">outer_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">inner_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// fungsi ini visibility scope-nya di parent module scope,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// yaitu `outer_mod`</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">super</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">inner_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">outer_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-keyword-pubself">◉ Keyword <code>pub(self)</code><a class="hash-link" href="#-keyword-pubself" title="Direct link to heading">​</a></h3><p>Keyword ini digunakan untuk membuat visibility item menjadi publik dengan scope akses hanya pada current module. Contohnya bisa dilihat pada kode program berikut.</p><p>Fungsi <code>say_hello</code> visibility scope-nya adalah <em>current module</em>. Fungsi tersebut hanya bisa diakses dari tempat yang merupakan module item dari <em>current module</em> yaitu <code>inner_mod</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">outer_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">inner_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// fungsi ini visibility scope-nya di current module scope,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// yaitu `inner_mod`</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">outer_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">inner_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/visibility_privacy" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../visibility_privacy</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/reference/visibility-and-privacy.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/visibility-and-privacy.html</a></li><li><a href="https://aloso.github.io/2021/03/28/module-system.html" target="_blank" rel="noopener noreferrer">https://aloso.github.io/2021/03/28/module-system.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/type-alias-casting"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.27. Type Alias & Casting</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/use"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.29. Module System ➜ Use, Import, Re-export</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a281-pembahasan-module-system" class="table-of-contents__link toc-highlight">A.28.1. Pembahasan module system</a></li><li><a href="#a282-default-visibility" class="table-of-contents__link toc-highlight">A.28.2. Default visibility</a></li><li><a href="#a283-re-export-item" class="table-of-contents__link toc-highlight">A.28.3. Re-export item</a></li><li><a href="#a284-public-visibility-scope" class="table-of-contents__link toc-highlight">A.28.4. Public visibility scope</a><ul><li><a href="#-keyword-pub" class="table-of-contents__link toc-highlight">◉ Keyword <code>pub</code></a></li><li><a href="#-keyword-pubin-path" class="table-of-contents__link toc-highlight">◉ Keyword <code>pub(in path)</code></a></li><li><a href="#-keyword-pubcrate" class="table-of-contents__link toc-highlight">◉ Keyword <code>pub(crate)</code></a></li><li><a href="#-keyword-pubsuper" class="table-of-contents__link toc-highlight">◉ Keyword <code>pub(super)</code></a></li><li><a href="#-keyword-pubself" class="table-of-contents__link toc-highlight">◉ Keyword <code>pub(self)</code></a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Pemrograman Rust Dasar</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">A.28. Module System ➜ Visibility & Privacy</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>A.28. Module System ➜ Visibility & Privacy</h1></header><p>Kita sebenarnya sudah mempelajari banyak hal yang berhubungan dengan visibility & privacy pada beberapa chapter sebelumnya. Jika pembaca mempelajari ebook ini secara urut, maka pastinya sudah familiar dengan keyword <code>pub</code>, <code>self</code>, <code>crate</code>, dan <code>super</code>.</p><p>Chapter ini merupakan pembahasan tambahan untuk ke-4 keyword tersebut, dan fokusnya lebih ke visibility & privacy di Rust secara general.</p><p>O iya, perihal <em>visbility</em> dan <em>privacy</em> itu sendiri, kedua istilah tersebut di sini kita maknai sama, yang artinya kurang lebih adalah tentang manajemen akses item di Rust.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a281-pembahasan-module-system">A.28.1. Pembahasan module system<a class="hash-link" href="#a281-pembahasan-module-system" title="Direct link to heading">​</a></h2><p>Pastikan sudah mempelajari 5 buah chapter tentang module system yang sebelumnya sudah dibahas. Kesemua chapter tersebut sangat berhubungan dengan pembahasan chapter ini.</p><ul><li><a href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li><a href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li><a href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li><a href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li><a href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a282-default-visibility">A.28.2. Default visibility<a class="hash-link" href="#a282-default-visibility" title="Direct link to heading">​</a></h2><p>Di Rust, <em>by default</em>, hampir semua item adalah private. Apa efeknya ketika item adalah private atau publik? Silakan ingat 2 aturan penting berikut:</p><ol><li>Jika suatu item adalah private, maka item tersebut hanya bisa diakses dari <em>current module scope</em> dan dari <em>submodules</em> milik <em>current module</em>.</li><li>Jika suatu item adalah publik, maka dia bisa diakses dari module lain di luar <em>current module scope</em>, dengan catatan parent module scope item tersebut harus publik.</li></ol><blockquote><p>Kita sepakati di sini, pada istilah <strong>current module</strong> kata <em>module</em> di situ bisa saja tertuju untuk module atau juga submodule</p></blockquote><p>Dua point di atas sangat penting untuk dipahami, karena digunakan sebagai landasan pertimbangan dalam penyusunan hirarki module. Sebagai contoh, kita bisa membuat program yang hanya meng-expose API tertentu (yang memang diperlukan untuk diakses oleh publik), tanpa perlu ikut meng-expose detail implementasinya.</p><p>Ok, sekarang silakan perhatikan path sederhana di bawah ini. Diasumsikan ada sebuah fungsi yang path aksesnya adalah berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">messaging::service_layer::some_black_magic</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Segmen pertama yaitu <code>messaging</code> pasti adalah publik, karena di-import ke <em>crate root</em>. Lalu bagaimana dengan segmen <code>service_layer</code> dan juga <code>some_black_magic</code>?</p><p>Jika item <code>some_black_magic</code> di situ adalah publik, maka idealnya pengaksesan menggunakan path tersebut memungkinkan. Tapi kembali ke point ke-2 aturan yang sudah dibahas di atas, yaitu meskipun <code>some_black_magic</code> adalah publik, jika parent-nya (yang pada konteks ini adalah <code>service_layer</code>) adalah private, maka pengaksesan menggunakan path tersebut menghasilkan error.</p><p>Intinya, <strong>sebuah item bisa diakses jika item tersebut adalah publik, dan parent item tersebut juga publik. Sedangkan default visibility untuk hampir semua item adalah private.</strong></p><p>Ok, sekarang mari lanjut ke praktik menggunakan contoh dengan pembahasan yang lebih mendetail. Silakan perhatikan dan praktikkan kode berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">package source code structure</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_package</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">│─── Cargo.toml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└─── src</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> │─── messaging.rs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> └─── main.rs</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/messaging.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">SOME_MESSAGE</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">service_layer</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">some_black_magic</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">messaging</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token constant" style="color:#36acaa">SOME_MESSAGE</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">service_layer</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">some_black_magic</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">messaging</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">messaging</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><ul><li><p>Konstanta <code>messaging::SOME_MESSAGE</code> adalah <strong>private</strong>. Penjelasan:</p><ul><li>Konstanta ini merupakan module item milik <code>messaging</code>.</li><li>Konstanta ini <strong>bisa diakses</strong> dari <em>current module scope</em> (<code>messaging</code>).</li><li>Konstanta ini <strong>bisa diakses</strong> dari submodule milik <em>current module</em>, yaitu submodule dari <code>messaging</code>. Contohnya bisa dilihat pada fungsi <code>messaging::service_layer::some_black_magic</code> yang di situ ada statement pemanggilan <code>SOME_MESSAGE</code>.</li><li>Konstanta ini <strong>tidak bisa diakses</strong> dari luar <em>current module scope</em> (<code>messaging</code>).</li></ul></li><li><p>Submodule <code>messaging::service_layer</code> adalah <strong>private</strong>. Penjelasan:</p><ul><li>Submodule ini merupakan module item milik <code>messaging</code>.</li><li>Submodule ini <strong>bisa diakses</strong> dari <em>current module scope</em> (<code>messaging</code>). Contohnya bisa dilihat pada fungsi <code>messaging::say_hello</code> yang di situ ada statement pemanggilan <code>service_layer</code>.</li><li>Submodule ini <strong>bisa diakses</strong> dari submodule milik <em>current module</em>, yaitu submodule dari <code>messaging</code>.</li><li>Submodule ini <strong>tidak bisa diakses</strong> dari luar <em>current module scope</em> (<code>messaging</code>).</li></ul></li><li><p>Fungsi <code>messaging::service_layer::some_black_magic</code> adalah <strong>publik</strong>. Penjelasan:</p><ul><li>Fungsi ini merupakan module item milik <code>messaging::service_layer</code>.</li><li>Fungsi ini <strong>bisa diakses</strong> dari <em>current module scope</em> (<code>messaging::service_layer</code>).</li><li>Fungsi ini <strong>bisa diakses</strong> dari submodule milik <em>current module</em>, yaitu submodule dari <code>messaging::service_layer</code>. Contohnya bisa dilihat pada fungsi <code>messaging::say_hello</code> yang di situ ada statement pemanggilan fungsi <code>some_black_magic</code>.</li><li>Fungsi ini <strong>bisa diakses</strong> dari luar <em>current module scope</em> (<code>messaging::service_layer</code>).</li><li>Namun meskipun demikian, bisa tidaknya fungsi ini diakses dari luar <em>current module scope</em> (<code>messaging::service_layer</code>) juga tergantung dengan visibility dari current module itu sendiri, yaitu <code>messaging::service_layer</code>.</li><li>Karena module <code>messaging::service_layer</code> adalah private, meskipun fungsi <code>some_black_magic</code> di dalamnya adalah publik, pengaksesan fungsi tersebut dari luar module scope <code>messaging::service_layer</code> tidak dimungkinkan.<ul><li>Pengaksesan <code>service_layer::some_black_magic</code> dari <code>messaging::say_hello</code> tidak error karena submodule <code>service_layer</code> meskipun private, posisinya adalah masih dalam satu module scope yang sama dengan fungsi <code>say_hello</code>.</li><li>Dimisalkan jika <code>service_layer::some_black_magic</code> dipaksa diakses dari <code>main</code>, maka muncul error karena <code>service_layer</code> adalah private dan posisinya tidak berada dalam module scope yang sama dengan crate root (<code>main</code>).</li></ul></li></ul></li><li><p>Fungsi <code>messaging::say_hello</code> adalah <strong>public</strong>. Penjelasan:</p><ul><li>Fungsi ini merupakan module item milik <code>messaging</code>.</li><li>Fungsi ini <strong>bisa diakses</strong> dari <em>current module scope</em> (<code>messaging</code>).</li><li>Fungsi ini <strong>bisa diakses</strong> dari submodule milik <em>current module</em>, yaitu submodule dari <code>messaging</code>.</li><li>Fungsi ini <strong>bisa diakses</strong> dari luar <em>current module scope</em> (<code>messaging</code>). Contohnya bisa dilihat pada crate root fungsi <code>main</code>, di situ ada pemanggilan statement <code>say_hello</code>.</li></ul></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a283-re-export-item">A.28.3. Re-export item<a class="hash-link" href="#a283-re-export-item" title="Direct link to heading">​</a></h2><p>Pada contoh, fungsi <code>messaging::say_hello</code> didesain sebagai media untuk mengakses fungsi <code>some_black_magic</code>. Di situasi <em>real world</em> pastinya sangat jarang terjadi sebuah fungsi isinya hanya satu baris pemanggilan fungsi lainnya. Jika memang ada situasi seperti itu, (kontekstual) lebih baik hapus saja fungsi yang jadi media pemanggilan dan langsung saja panggil fungsi di dalamnya sesuai kebutuhan.</p><p>Pada praktik selanjutnya ini kita misalkan bahwa fungsi <code>say_hello</code> isinya memang hanya 1 baris, dan yang paling penting adalah isi fungsi <code>some_black_magic</code> perlu untuk bisa diakses dari <code>main</code>. Untuk kasus seperti ini ada 3 alternatif solusi:</p><ol><li>Tidak perlu mengubah apapun, gunakan saja kode yang sudah ditulis di atas. Kode tersebut sudah bisa mengakomodir pemanggilan <code>some_black_magic</code> via <code>say_hello</code>.</li><li>Atau, hapus saja fungsi <code>say_hello</code>, lalu ubah visibility module <code>service_layer</code> menjadi publik, dengan demikian kita bisa mengakses <code>some_black_magic</code> dari <code>main</code> menggunakan path <code>messaging::service_layer::some_black_magic</code>.</li><li>Atau, gunakan teknik <strong>re-export item</strong>.</li></ol><p>Re-export item adalah sebuah cara untuk mem-<em>bypass</em> pengaksesan item yang secara hirarki memang tidak bisa diakses dari luar module (bisa jadi karena visibility item ataupun parent module nya adalah private). Dengan teknik ini, maka item pasti bisa diakses dari luar module.</p><p>Item yang di-re-export akan menjadi item milik <em>current module</em> di mana statement re-export tersebut ditulis.</p><p>Cara re-export item adalah menggunakan keyword <code>pub use</code> kemudian diikuti dengan path yang ingin di-export dan juga nama export item dengan notasi penulisan berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> the_path </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> exported_name</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">service_layer</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">some_black_magic </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> say_hello</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Contoh jika diterapkan pada program yang sebelumnya sudah ditulis:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/messaging.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">service_layer</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">some_black_magic </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> say_hello</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">SOME_MESSAGE</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">service_layer</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">some_black_magic</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">messaging</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token constant" style="color:#36acaa">SOME_MESSAGE</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">messaging</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">messaging</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><img loading="eager" fetchpriority="high" alt="Visibility &amp; Privacy" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdIAAABtCAIAAACa6Xd1AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgMTE2LjM5YWJhZjcsIDIwMjIvMDIvMjUtMjE6NTc6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly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gt6ul3aBleCw0WzmrKeM0LoaJKz0MD1sqflxa7SLPN9AfXwD2m1LnOHhpiP2OBVqQSF7639DKoQS73o2/g+XZUIcRRexPZu2PD8XfNxiossS2pVWwsNGHQ2ueuqcm6rTKuWMlZqMxWNiN0a7PVG2Ed7x02eT+nihC+ySTh9ofZHDe6gKNQz37aH/bbBKIvHuUElHEukwJWyOqbyuybFr9vSctMKmU+NIuPRUCB8OmySLREff8w0O3HNAFFw0Kq5gcPbYkNInTkG7xyKJ5zZRjnFbb3usq6u93eaGp563s7XiaUkNK21uZpF2T4roE5ad57sj7R6gq33T9Vy/rfXSrvvcGEHarQ9xkGFHzgWLwHqn0VnquUIbRZhe4lja9deTvEzaJQiCIO0SBEEQpF2CIAjSLkEQBEHaJQiCIO0SBEEQpF2CIAjSLkEQBGlX4PvvP3//++VO2iG4AV4kCIIg7a5Au8YNxbmsh1///f3z+zu7nCAI0i5plyAI0q7Koi/clUQKpuBBwqc+2h0z/GuTYkeaY2FtHlFmwY+gSu2l8DcDHQRBnIl2B2ps/t39q2HNgOxC5nTQbnhLm7/Ohj09j3T757dGu5pDTW+XIIgTBxmGHy9UFjBcTGx52g04OxuAaNKOmbcpLdpF+ZB2CYI4P+3K1Xsp7WbdY4s0tSDDFLkIbyHtEgRxG7SrEmWxt5v8XEC70EUm7RIEcQNBBisg64jthrSYhoadtNtf7PzbtLgoz0wBBEEQZ6DdS3JMoKU1EXqApwn624OTDObpAuyrjrn++f0rfBLgPNVDFwRBEBXSLkEQBEHaJQiCIO0SBEEQpF2CIAjSLkEQBGmXIAiCIO0SBEGQdgmCIAjSLkEQBGmXIAiCIO0SBEGQdgmCIEi7BEEQxCb4HzjE/yVJRbnzAAAAAElFTkSuQmCC" width="466" height="109" class="img_CujE"></p><p>Bisa dilihat di contoh di atas, fungsi <code>say_hello</code> dihapus, kemudian item <code>service_layer::some_black_magic</code> di-re-export dengan nama <code>say_hello</code>. Dengannya kita bisa mengakses <code>some_black_magic</code> dari luar module <code>messaging</code> menggunakan path <code>messaging::say_hello</code>.</p><p>Jika item ingin di-re-export tanpa perubahan nama item, bisa gunakan notasi berikut:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> the_path</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">service_layer</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">some_black_magic</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Jika diterapkan pada program sebelumnya, kurang lebih seperti ini:</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/messaging.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">use</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">self</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">service_layer</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token plain">some_black_magic</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token constant" style="color:#36acaa">SOME_MESSAGE</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">&</span><span class="token keyword" style="color:#00009f">str</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">service_layer</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">some_black_magic</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"{}"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">messaging</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token constant" style="color:#36acaa">SOME_MESSAGE</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">src/main.rs</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">messaging</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">messaging</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">some_black_magic</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>Lebih jelasnya mengenai keyword <code>use</code> dibahas pada chapter <a href="/basic/use">Module System ➜ Use</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="a284-public-visibility-scope">A.28.4. Public visibility scope<a class="hash-link" href="#a284-public-visibility-scope" title="Direct link to heading">​</a></h2><p>Keyword <code>pub</code> digunakan untuk mengubah visibility item menjadi publik. Keyword ini bisa dikombinasikan dengan salah satu dari keyword <code>self</code>, <code>crate</code>, dan <code>super</code>; denganya kita bisa menentukan visibility sebuah publik item dengan scope yang lebih spesifik.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-keyword-pub">◉ Keyword <code>pub</code><a class="hash-link" href="#-keyword-pub" title="Direct link to heading">​</a></h3><p>Penulis rasa untuk penerapan keyword <code>pub</code> ini sudah sangat jelas, kita beberapa kali mempraktikkannya.</p><p>Dengan keyword <code>pub</code>, sebuah item visibility-nya menjadi publik.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-keyword-pubin-path">◉ Keyword <code>pub(in path)</code><a class="hash-link" href="#-keyword-pubin-path" title="Direct link to heading">​</a></h3><p>Keyword ini menjadikan visibility item hanya di dalam <code>path</code> yang ditulis di <code>pub(in path)</code>, dengan ketentuan <code>path</code> tersebut merupakan parent dari module item di mana keyword digunakan.</p><p>Contohnya bisa dilihat pada kode berikut. Fungsi <code>say_hello</code> didefinisikan publik dengan scope path ditentukan secara eksplisit adalah <code>crate::outer_mod</code>. Dengan demikian fungsi <code>say_hello</code> hanya bisa diakses dari dalam <code>outer_mod</code>.</p><p>Bisa dilihat di contoh, fungsi <code>say_hello</code> diakses dari <code>do_something</code>. Silakan coba saja paksa untuk mengaksesnya dari fungsi <code>main</code>, hasilnya pasti error.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">outer_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">inner_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// fungsi say_hello berikut hanya bisa diakses dari dalam `outer_mod`.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// pengaksesannya dari luar `outer_mod` menghasilkan error.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">in</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">outer_mod</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">inner_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">outer_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-keyword-pubcrate">◉ Keyword <code>pub(crate)</code><a class="hash-link" href="#-keyword-pubcrate" title="Direct link to heading">​</a></h3><p>Keyword <code>pub(crate)</code> digunakan untuk membuat visibility item menjadi publik dengan scope akses <em>current crate</em>. Dengan ini item bisa diakses dari manapun asalakan masih dalam crate yang sama.</p><p>Contoh penerapannya bisa dilihat berikut ini. Fungsi <code>say_hello</code> visibility scope nya ditentukan adalah <em>current crate</em>. Fungsi tersebut bisa diakses dari <code>outer_mod_one::do_something</code>, dari <code>outer_mod_two::do_something</code>, dan juga dari fungsi <code>main</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">outer_mod_one</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">inner_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// fungsi ini visibility scope-nya di level crate</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">crate</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">inner_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">outer_mod_two</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">crate</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">outer_mod_one</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token module-declaration namespace" style="opacity:0.7">inner_mod</span><span class="token module-declaration namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">outer_mod_one</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">inner_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">outer_mod_one</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">outer_mod_two</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-keyword-pubsuper">◉ Keyword <code>pub(super)</code><a class="hash-link" href="#-keyword-pubsuper" title="Direct link to heading">​</a></h3><p>Keyword <code>pub(super)</code> digunakan untuk membuat visibility item menjadi publik dengan scope akses <em>parent module</em>.</p><p>Pada contoh berikut, fungsi <code>say_hello</code> visibility scope nya ditentukan adalah <em>parent module</em>, artinya fungsi tersebut hanya bisa diakses dari dalam <em>parent module</em> (yang pada konteks ini adalah <code>outer_mod</code>).</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">outer_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">inner_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// fungsi ini visibility scope-nya di parent module scope,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// yaitu `outer_mod`</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">super</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">inner_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">outer_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-keyword-pubself">◉ Keyword <code>pub(self)</code><a class="hash-link" href="#-keyword-pubself" title="Direct link to heading">​</a></h3><p>Keyword ini digunakan untuk membuat visibility item menjadi publik dengan scope akses hanya pada current module. Contohnya bisa dilihat pada kode program berikut.</p><p>Fungsi <code>say_hello</code> visibility scope-nya adalah <em>current module</em>. Fungsi tersebut hanya bisa diakses dari tempat yang merupakan module item dari <em>current module</em> yaitu <code>inner_mod</code>.</p><div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">outer_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">mod</span><span class="token plain"> </span><span class="token module-declaration namespace" style="opacity:0.7">inner_mod</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// fungsi ini visibility scope-nya di current module scope,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// yaitu `inner_mod`</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">self</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token macro property" style="color:#36acaa">println!</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"hello rust"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">pub</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">say_hello</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">outer_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token namespace" style="opacity:0.7">inner_mod</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">::</span><span class="token function" style="color:#d73a49">do_something</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-source-code-praktik">◉ Source code praktik<a class="hash-link" href="#-source-code-praktik" title="Direct link to heading">​</a></h3><pre tabindex="0" class="codeBlockStandalone_MEMb thin-scrollbar codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><a href="https://github.com/novalagung/dasarpemrogramanrust-example/tree/master/visibility_privacy" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust-example/../visibility_privacy</a></code></pre><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://doc.rust-lang.org/reference/visibility-and-privacy.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/reference/visibility-and-privacy.html</a></li><li><a href="https://aloso.github.io/2021/03/28/module-system.html" target="_blank" rel="noopener noreferrer">https://aloso.github.io/2021/03/28/module-system.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/basic/type-alias-casting"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">A.27. Type Alias & Casting</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/use"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.29. Module System ➜ Use, Import, Re-export</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#a281-pembahasan-module-system" class="table-of-contents__link toc-highlight">A.28.1. Pembahasan module system</a></li><li><a href="#a282-default-visibility" class="table-of-contents__link toc-highlight">A.28.2. Default visibility</a></li><li><a href="#a283-re-export-item" class="table-of-contents__link toc-highlight">A.28.3. Re-export item</a></li><li><a href="#a284-public-visibility-scope" class="table-of-contents__link toc-highlight">A.28.4. Public visibility scope</a><ul><li><a href="#-keyword-pub" class="table-of-contents__link toc-highlight">◉ Keyword <code>pub</code></a></li><li><a href="#-keyword-pubin-path" class="table-of-contents__link toc-highlight">◉ Keyword <code>pub(in path)</code></a></li><li><a href="#-keyword-pubcrate" class="table-of-contents__link toc-highlight">◉ Keyword <code>pub(crate)</code></a></li><li><a href="#-keyword-pubsuper" class="table-of-contents__link toc-highlight">◉ Keyword <code>pub(super)</code></a></li><li><a href="#-keyword-pubself" class="table-of-contents__link toc-highlight">◉ Keyword <code>pub(self)</code></a></li></ul></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-source-code-praktik" class="table-of-contents__link toc-highlight">◉ Source code praktik</a></li><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/download-pdf.html b/download-pdf.html index 05ab7d32..b97b71e3 100644 --- a/download-pdf.html +++ b/download-pdf.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/download-pdf/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/download-pdf/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"Download versi PDF","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/download-pdf/#webpage"},"wordCount":17,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/download-pdf/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/download-pdf/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/download-pdf","name":"Download versi PDF","description":"Ebook Dasar Pemrograman Rust bisa di-download dalam bentuk file PDF, silakan gunakan link berikut:","datePublished":"2024-08-01T10:17:31.763Z","dateModified":"2024-08-01T10:17:31.763Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/download-pdf/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/download-pdf"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/download-pdf/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"Download versi PDF","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/download-pdf/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/download-pdf/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"Download versi PDF","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/download-pdf/#webpage"},"wordCount":17,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/download-pdf/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/download-pdf/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/download-pdf","name":"Download versi PDF","description":"Ebook Dasar Pemrograman Rust bisa di-download dalam bentuk file PDF, silakan gunakan link berikut:","datePublished":"2024-08-30T07:44:51.736Z","dateModified":"2024-08-30T07:44:51.737Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/download-pdf/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/download-pdf"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/download-pdf/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"Download versi PDF","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> <div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">Download versi PDF</span><meta itemprop="position" content="1"></li></ul></nav><div class="theme-doc-markdown markdown"><header><h1>Download versi PDF</h1></header><p>Ebook Dasar Pemrograman Rust bisa di-download dalam bentuk file PDF, silakan gunakan link berikut:</p><blockquote><p><a href="https://github.com/novalagung/dasarpemrogramanrust/raw/ebooks/dasarpemrogramanrust.pdf?v=v1.0.20240731" target="_blank" rel="noopener noreferrer">Dasar Pemrograman Rust.pdf</a></p></blockquote></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/CONTRIBUTING"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Contribution & Tech Stack</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/LICENSE"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Lisensi & Distribusi Konten</div></a></nav></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/index.html b/index.html index d34d586f..4561615a 100644 --- a/index.html +++ b/index.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com//#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com//#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"Tutorial Belajar Rust (Gratis!)","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com//#webpage"},"wordCount":277,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com//#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com//#webpage","url":"https://dasarpemrogramanrust.novalagung.com/","name":"Tutorial Belajar Rust (Gratis!)","description":"Rust adalah sebuah bahasa pemrograman general purpose yang fokus pada performance, type safety, dan concurrency. Bahasa ini diciptakan sebagai alternatif bahasa pemrograman yang berfokus pada hal-hal yang cukup low-level tapi tetap men-support fitur yang sifatnya high-level.","datePublished":"2024-08-01T10:17:27.482Z","dateModified":"2024-08-01T10:17:27.482Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com//#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com//#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"Tutorial Belajar Rust (Gratis!)","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com//#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com//#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"Tutorial Belajar Rust (Gratis!)","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com//#webpage"},"wordCount":277,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com//#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com//#webpage","url":"https://dasarpemrogramanrust.novalagung.com/","name":"Tutorial Belajar Rust (Gratis!)","description":"Rust adalah sebuah bahasa pemrograman general purpose yang fokus pada performance, type safety, dan concurrency. Bahasa ini diciptakan sebagai alternatif bahasa pemrograman yang berfokus pada hal-hal yang cukup low-level tapi tetap men-support fitur yang sifatnya high-level.","datePublished":"2024-08-30T07:44:47.597Z","dateModified":"2024-08-30T07:44:47.597Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com//#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com//#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"Tutorial Belajar Rust (Gratis!)","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> -<div id="docusaurus-base-url-issue-banner-container"></div><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">Dasar Pemrograman Rust</span><meta itemprop="position" content="1"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Tutorial Belajar Rust (Gratis!)</h1></header><p>Rust adalah sebuah bahasa pemrograman <em>general purpose</em> yang fokus pada <em>performance</em>, <em>type safety</em>, dan <em>concurrency</em>. Bahasa ini diciptakan sebagai alternatif bahasa pemrograman yang berfokus pada hal-hal yang cukup <em>low-level</em> tapi tetap men-support fitur yang sifatnya <em>high-level</em>.</p><p>Website/ebook tutorial Dasar Pemrograman Rust ini dibuat dengan harapan bisa menjadi alternatif referensi belajar Rust, disajikan dengan penyampaian yang cocok untuk pembaca di level <em>beginner</em>, dan gratis. Buku ini ada bukan untuk menggantikan <em>the book</em>, melainkan sebagai komplemen.</p><p><a href="https://www.rust-lang.org/learn" target="_blank" rel="noopener noreferrer">Dokumentasi <em>official</em> Rust</a> sangat lengkap, dan aktif di-update oleh komunitas. Jika pembaca sudah memiliki banyak pengalaman dalam programming, sudah paham mengenai system programming seperti C atau C++, maka penulis sangat anjurkan untuk langsung menggunakan <a href="https://www.rust-lang.org/learn" target="_blank" rel="noopener noreferrer"><em>the book</em></a> sebagai referensi belajar.</p><blockquote><p>Versi website/ebook: <strong>v1.0.20240731</strong>, dan versi <a href="https://blog.rust-lang.org/2024/06/13/Rust-1.79.0.html" target="_blank" rel="noopener noreferrer">Rust 1.79.0</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="update-konten--versi-terbaru">Update Konten & Versi Terbaru<a class="hash-link" href="#update-konten--versi-terbaru" title="Direct link to heading">​</a></h2><p>Setiap perubahan pada website/ebook bisa dilihat di halaman berikut:</p><blockquote><p><a href="/CHANGELOG">Version Changelogs & Updates</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="download-ebook-file-pdf">Download Ebook File (pdf)<a class="hash-link" href="#download-ebook-file-pdf" title="Direct link to heading">​</a></h2><p>Versi ebook bisa di-download dalam bentuk file di link berikut:</p><blockquote><p>PDF/Ebook file: <a href="https://github.com/novalagung/dasarpemrogramanrust/raw/ebooks/dasarpemrogramanrust.pdf?v=v1.0.20240731" target="_blank" rel="noopener noreferrer">Dasar Pemrograman Rust.pdf</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="source-code">Source Code<a class="hash-link" href="#source-code" title="Direct link to heading">​</a></h2><p>Source code website/ebook & praktik program bisa diunduh di link berikut:</p><blockquote><ul><li>Source code website/ebook ➡️ <a href="https://github.com/novalagung/dasarpemrogramanrust" target="_blank" rel="noopener noreferrer">https://github.com/novalagung/dasarpemrogramanrust</a></li><li>Source code praktik ➡️ <a href="https://github.com/novalagung/dasarpemrogramanrust-example" target="_blank" rel="noopener noreferrer">https://github.com/novalagung/dasarpemrogramanrust-example</a></li></ul></blockquote><p>Dianjurkan untuk sekedar tidak copy-paste dari source code dalam proses belajar, usahakan tulis sendiri kode program agar cepat terbiasa dengan bahasa Rust.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="kontribusi">Kontribusi<a class="hash-link" href="#kontribusi" title="Direct link to heading">​</a></h2><p>Website/ebook ini merupakan project open source, teruntuk siapapun yang ingin berkontribusi silakan langsung saja cek <a href="https://github.com/novalagung/dasarpemrogramanrust" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust</a>. Cek juga halaman kontributor berikut untuk melihat list kontributor.</p><blockquote><p><a href="/CONTRIBUTING">Contribution & Tech Stack</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="lisensi-dan-status-fossa">Lisensi dan Status FOSSA<a class="hash-link" href="#lisensi-dan-status-fossa" title="Direct link to heading">​</a></h2><p>Website/ebook tutorial Dasar Pemrograman Rust gratis untuk disebarluaskan secara bebas, baik untuk komersil maupun tidak, dengan catatan harus disertakan credit sumber aslinya (yaitu Dasar Pemrograman Rust atau novalagung) dan tidak mengubah lisensi aslinya (yaitu CC BY-SA 4.0). Lebih jelasnya silakan cek halaman berikut:</p><blockquote><p><a href="/LICENSE">lisensi dan distribusi konten</a></p></blockquote><p>FOSSA Status:</p><p><a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fnovalagung%2Fdasarpemrogramanrust?ref=badge_large" target="_blank" rel="noopener noreferrer"><img loading="lazy" src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fnovalagung%2Fdasarpemrogramanrust.svg?type=large" alt="FOSSA Status" class="img_ev3q"></a></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="author--maintainer">Author & Maintainer<a class="hash-link" href="#author--maintainer" title="Direct link to heading">​</a></h2><p>Ebook ini dibuat oleh Noval Agung Prayogo. Untuk pertanyaan, kritik, dan saran, silakan drop email ke <a href="mailto:hello@novalagung.com" target="_blank" rel="noopener noreferrer">hello@novalagung.com</a>.</p></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--next" href="/pengelanan-rust-programming"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Pengenalan Rust Programming</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#update-konten--versi-terbaru" class="table-of-contents__link toc-highlight">Update Konten & Versi Terbaru</a></li><li><a href="#download-ebook-file-pdf" class="table-of-contents__link toc-highlight">Download Ebook File (pdf)</a></li><li><a href="#source-code" class="table-of-contents__link toc-highlight">Source Code</a></li><li><a href="#kontribusi" class="table-of-contents__link toc-highlight">Kontribusi</a></li><li><a href="#lisensi-dan-status-fossa" class="table-of-contents__link toc-highlight">Lisensi dan Status FOSSA</a></li><li><a href="#author--maintainer" class="table-of-contents__link toc-highlight">Author & Maintainer</a></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<div id="docusaurus-base-url-issue-banner-container"></div><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">Dasar Pemrograman Rust</span><meta itemprop="position" content="1"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Tutorial Belajar Rust (Gratis!)</h1></header><p>Rust adalah sebuah bahasa pemrograman <em>general purpose</em> yang fokus pada <em>performance</em>, <em>type safety</em>, dan <em>concurrency</em>. Bahasa ini diciptakan sebagai alternatif bahasa pemrograman yang berfokus pada hal-hal yang cukup <em>low-level</em> tapi tetap men-support fitur yang sifatnya <em>high-level</em>.</p><p>Website/ebook tutorial Dasar Pemrograman Rust ini dibuat dengan harapan bisa menjadi alternatif referensi belajar Rust, disajikan dengan penyampaian yang cocok untuk pembaca di level <em>beginner</em>, dan gratis. Buku ini ada bukan untuk menggantikan <em>the book</em>, melainkan sebagai komplemen.</p><p><a href="https://www.rust-lang.org/learn" target="_blank" rel="noopener noreferrer">Dokumentasi <em>official</em> Rust</a> sangat lengkap, dan aktif di-update oleh komunitas. Jika pembaca sudah memiliki banyak pengalaman dalam programming, sudah paham mengenai system programming seperti C atau C++, maka penulis sangat anjurkan untuk langsung menggunakan <a href="https://www.rust-lang.org/learn" target="_blank" rel="noopener noreferrer"><em>the book</em></a> sebagai referensi belajar.</p><blockquote><p>Versi website/ebook: <strong>v1.0.20240731</strong>, dan versi <a href="https://blog.rust-lang.org/2024/06/13/Rust-1.79.0.html" target="_blank" rel="noopener noreferrer">Rust 1.79.0</a>.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="update-konten--versi-terbaru">Update Konten & Versi Terbaru<a class="hash-link" href="#update-konten--versi-terbaru" title="Direct link to heading">​</a></h2><p>Setiap perubahan pada website/ebook bisa dilihat di halaman berikut:</p><blockquote><p><a href="/CHANGELOG">Version Changelogs & Updates</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="download-ebook-file-pdf">Download Ebook File (pdf)<a class="hash-link" href="#download-ebook-file-pdf" title="Direct link to heading">​</a></h2><p>Versi ebook bisa di-download dalam bentuk file di link berikut:</p><blockquote><p>PDF/Ebook file: <a href="https://github.com/novalagung/dasarpemrogramanrust/raw/ebooks/dasarpemrogramanrust.pdf?v=v1.0.20240731" target="_blank" rel="noopener noreferrer">Dasar Pemrograman Rust.pdf</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="source-code">Source Code<a class="hash-link" href="#source-code" title="Direct link to heading">​</a></h2><p>Source code website/ebook & praktik program bisa diunduh di link berikut:</p><blockquote><ul><li>Source code website/ebook ➡️ <a href="https://github.com/novalagung/dasarpemrogramanrust" target="_blank" rel="noopener noreferrer">https://github.com/novalagung/dasarpemrogramanrust</a></li><li>Source code praktik ➡️ <a href="https://github.com/novalagung/dasarpemrogramanrust-example" target="_blank" rel="noopener noreferrer">https://github.com/novalagung/dasarpemrogramanrust-example</a></li></ul></blockquote><p>Dianjurkan untuk sekedar tidak copy-paste dari source code dalam proses belajar, usahakan tulis sendiri kode program agar cepat terbiasa dengan bahasa Rust.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="kontribusi">Kontribusi<a class="hash-link" href="#kontribusi" title="Direct link to heading">​</a></h2><p>Website/ebook ini merupakan project open source, teruntuk siapapun yang ingin berkontribusi silakan langsung saja cek <a href="https://github.com/novalagung/dasarpemrogramanrust" target="_blank" rel="noopener noreferrer">github.com/novalagung/dasarpemrogramanrust</a>. Cek juga halaman kontributor berikut untuk melihat list kontributor.</p><blockquote><p><a href="/CONTRIBUTING">Contribution & Tech Stack</a></p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="lisensi-dan-status-fossa">Lisensi dan Status FOSSA<a class="hash-link" href="#lisensi-dan-status-fossa" title="Direct link to heading">​</a></h2><p>Website/ebook tutorial Dasar Pemrograman Rust gratis untuk disebarluaskan secara bebas, baik untuk komersil maupun tidak, dengan catatan harus disertakan credit sumber aslinya (yaitu Dasar Pemrograman Rust atau novalagung) dan tidak mengubah lisensi aslinya (yaitu CC BY-SA 4.0). Lebih jelasnya silakan cek halaman berikut:</p><blockquote><p><a href="/LICENSE">lisensi dan distribusi konten</a></p></blockquote><p>FOSSA Status:</p><p><a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fnovalagung%2Fdasarpemrogramanrust?ref=badge_large" target="_blank" rel="noopener noreferrer"><img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fnovalagung%2Fdasarpemrogramanrust.svg?type=large" alt="FOSSA Status" fetchpriority="high" loading="eager" class="img_CujE"></a></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="author--maintainer">Author & Maintainer<a class="hash-link" href="#author--maintainer" title="Direct link to heading">​</a></h2><p>Ebook ini dibuat oleh Noval Agung Prayogo. Untuk pertanyaan, kritik, dan saran, silakan drop email ke <a href="mailto:hello@novalagung.com" target="_blank" rel="noopener noreferrer">hello@novalagung.com</a>.</p></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--next" href="/pengelanan-rust-programming"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Pengenalan Rust Programming</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#update-konten--versi-terbaru" class="table-of-contents__link toc-highlight">Update Konten & Versi Terbaru</a></li><li><a href="#download-ebook-file-pdf" class="table-of-contents__link toc-highlight">Download Ebook File (pdf)</a></li><li><a href="#source-code" class="table-of-contents__link toc-highlight">Source Code</a></li><li><a href="#kontribusi" class="table-of-contents__link toc-highlight">Kontribusi</a></li><li><a href="#lisensi-dan-status-fossa" class="table-of-contents__link toc-highlight">Lisensi dan Status FOSSA</a></li><li><a href="#author--maintainer" class="table-of-contents__link toc-highlight">Author & Maintainer</a></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/installation/instalasi-rust.html b/installation/instalasi-rust.html index aa88cd96..41ac0f5e 100644 --- a/installation/instalasi-rust.html +++ b/installation/instalasi-rust.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/installation/instalasi-rust/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/installation/instalasi-rust/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"Instalasi Rust","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/installation/instalasi-rust/#webpage"},"wordCount":170,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/installation/instalasi-rust/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/installation/instalasi-rust/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/installation/instalasi-rust","name":"Instalasi Rust","description":"Pada chapter ini kita akan belajar cara instalasi Rust. Pembaca bisa mengikuti panduan instalasi ini, atau langsung saja navigasi ke https://www.rust-lang.org/tools/install.","datePublished":"2024-08-01T10:17:31.784Z","dateModified":"2024-08-01T10:17:31.784Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/installation/instalasi-rust/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/installation/instalasi-rust"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/installation/instalasi-rust/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"Instalasi Rust","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/installation/instalasi-rust/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/installation/instalasi-rust/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"Instalasi Rust","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/installation/instalasi-rust/#webpage"},"wordCount":170,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/installation/instalasi-rust/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/installation/instalasi-rust/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/installation/instalasi-rust","name":"Instalasi Rust","description":"Pada chapter ini kita akan belajar cara instalasi Rust. Pembaca bisa mengikuti panduan instalasi ini, atau langsung saja navigasi ke https://www.rust-lang.org/tools/install.","datePublished":"2024-08-30T07:44:51.762Z","dateModified":"2024-08-30T07:44:51.762Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/installation/instalasi-rust/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/installation/instalasi-rust"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/installation/instalasi-rust/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"Instalasi Rust","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> <div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Persiapan dan Instalasi</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">Instalasi Rust</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Instalasi Rust</h1></header><p>Pada chapter ini kita akan belajar cara instalasi Rust. Pembaca bisa mengikuti panduan instalasi ini, atau langsung saja navigasi ke <a href="https://www.rust-lang.org/tools/install" target="_blank" rel="noopener noreferrer">https://www.rust-lang.org/tools/install</a>.</p><p>Ada dua metode instalasi yang penulis anjurkan, yaitu menggunakan <code>rustup</code> atau menggunakan installer.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="install-rust-menggunakan-rustup">Install Rust menggunakan <code>rustup</code><a class="hash-link" href="#install-rust-menggunakan-rustup" title="Direct link to heading">​</a></h2><p><code>rustup</code> adalah tool resmi untuk manajemen <em>Rust tooling</em>. <code>rustup</code> mempermudah proses instalasi, update versi, ataupun penggantian versi Rust.</p><blockquote><p>Instalasi Rust tooling menggunakan metode ini lebih direkomendasikan</p></blockquote><p>Cara instalasi <code>rustup</code> untuk tiap sistem operasi bisa dilihat di bawah ini:</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-macos-linux-unix">◉ MacOS, Linux, Unix<a class="hash-link" href="#-macos-linux-unix" title="Direct link to heading">​</a></h3><p>Jalankan command berikut untuk instal <code>rustup</code> dan mengecek hasil instalasi.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">curl</span><span class="token plain"> https://sh.rustup.rs </span><span class="token parameter variable" style="color:#36acaa">-sSf</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">sh</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">rustup </span><span class="token parameter variable" style="color:#36acaa">--version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">rustc </span><span class="token parameter variable" style="color:#36acaa">--version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">cargo</span><span class="token plain"> </span><span class="token parameter variable" style="color:#36acaa">--version</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-windows">◉ Windows<a class="hash-link" href="#-windows" title="Direct link to heading">​</a></h3><p>Silakan download file <code>rustup-init.exe</code> di <a href="https://www.rust-lang.org/tools/install" target="_blank" rel="noopener noreferrer">https://www.rust-lang.org/tools/install</a>. Jalankan installar, lalu run command berikut untuk mengecek hasil instalasi.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">rustup </span><span class="token parameter variable" style="color:#36acaa">--version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">rustc </span><span class="token parameter variable" style="color:#36acaa">--version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">cargo</span><span class="token plain"> </span><span class="token parameter variable" style="color:#36acaa">--version</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Untuk pengguna WSL (Windows Subsystem for Linux), bisa menggunakan command berikut.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">curl</span><span class="token plain"> </span><span class="token parameter variable" style="color:#36acaa">--proto</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'=https'</span><span class="token plain"> </span><span class="token parameter variable" style="color:#36acaa">--tlsv1.2</span><span class="token plain"> </span><span class="token parameter variable" style="color:#36acaa">-sSf</span><span class="token plain"> https://sh.rustup.rs </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">sh</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">rustup </span><span class="token parameter variable" style="color:#36acaa">--version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">rustc </span><span class="token parameter variable" style="color:#36acaa">--version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">cargo</span><span class="token plain"> </span><span class="token parameter variable" style="color:#36acaa">--version</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="install-rust-menggunakan-installer">Install Rust menggunakan installer<a class="hash-link" href="#install-rust-menggunakan-installer" title="Direct link to heading">​</a></h2><p>Silakan download installer sesuai dengan sistem operasi dan platform yang digunakan menggunakan link berikut:</p><blockquote><p><a href="https://forge.rust-lang.org/infra/other-installation-methods.html#standalone-installers" target="_blank" rel="noopener noreferrer">https://forge.rust-lang.org/infra/other-installation-methods.html#standalone-installers</a></p></blockquote><p>Lalu run command di bawah ini untuk mengecek hasil instalasi.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">rustup </span><span class="token parameter variable" style="color:#36acaa">--version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">rustc </span><span class="token parameter variable" style="color:#36acaa">--version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">cargo</span><span class="token plain"> </span><span class="token parameter variable" style="color:#36acaa">--version</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="update-versi-rust-tooling">Update versi Rust tooling<a class="hash-link" href="#update-versi-rust-tooling" title="Direct link to heading">​</a></h2><p>Jika pembaca menggunakan <code>rustup</code>, update Rust tooling dilakukan cukup dengan menjalankan command berikut:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">rustup update</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">rustup </span><span class="token parameter variable" style="color:#36acaa">--version</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Teruntuk Rust yang di-install menggunakan installer, cara update dilakukan dengan download dan run installer versi terbaru yang bisa didownload dari link berikut:</p><blockquote><p><a href="https://forge.rust-lang.org/infra/other-installation-methods.html#standalone-installers" target="_blank" rel="noopener noreferrer">https://forge.rust-lang.org/infra/other-installation-methods.html#standalone-installers</a></p></blockquote><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://www.rust-lang.org/tools/install" target="_blank" rel="noopener noreferrer">https://www.rust-lang.org/tools/install</a></li><li><a href="https://forge.rust-lang.org/infra/other-installation-methods.html" target="_blank" rel="noopener noreferrer">https://forge.rust-lang.org/infra/other-installation-methods.html</a></li><li><a href="https://doc.rust-lang.org/book/ch01-01-installation.html" target="_blank" rel="noopener noreferrer">https://doc.rust-lang.org/book/ch01-01-installation.html</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/LICENSE"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Lisensi & Distribusi Konten</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/installation/rust-editor-plugin"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Rust Editor & Plugin</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#install-rust-menggunakan-rustup" class="table-of-contents__link toc-highlight">Install Rust menggunakan <code>rustup</code></a><ul><li><a href="#-macos-linux-unix" class="table-of-contents__link toc-highlight">◉ MacOS, Linux, Unix</a></li><li><a href="#-windows" class="table-of-contents__link toc-highlight">◉ Windows</a></li></ul></li><li><a href="#install-rust-menggunakan-installer" class="table-of-contents__link toc-highlight">Install Rust menggunakan installer</a></li><li><a href="#update-versi-rust-tooling" class="table-of-contents__link toc-highlight">Update versi Rust tooling</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/installation/rust-editor-plugin.html b/installation/rust-editor-plugin.html index 87b30262..2c716db0 100644 --- a/installation/rust-editor-plugin.html +++ b/installation/rust-editor-plugin.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/installation/rust-editor-plugin/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/installation/rust-editor-plugin/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"Rust Editor & Plugin","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/installation/rust-editor-plugin/#webpage"},"wordCount":64,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/installation/rust-editor-plugin/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/installation/rust-editor-plugin/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/installation/rust-editor-plugin","name":"Rust Editor & Plugin","description":"Pemilihan editor dan plugin","datePublished":"2024-08-01T10:17:31.805Z","dateModified":"2024-08-01T10:17:31.805Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/installation/rust-editor-plugin/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/installation/rust-editor-plugin"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/installation/rust-editor-plugin/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"Rust Editor & Plugin","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/installation/rust-editor-plugin/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/installation/rust-editor-plugin/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"Rust Editor & Plugin","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/installation/rust-editor-plugin/#webpage"},"wordCount":64,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/installation/rust-editor-plugin/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/installation/rust-editor-plugin/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/installation/rust-editor-plugin","name":"Rust Editor & Plugin","description":"Pemilihan editor dan plugin","datePublished":"2024-08-30T07:44:51.779Z","dateModified":"2024-08-30T07:44:51.779Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/installation/rust-editor-plugin/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/installation/rust-editor-plugin"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/installation/rust-editor-plugin/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"Rust Editor & Plugin","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> <div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--active">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Persiapan dan Instalasi</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">Rust Editor & Plugin</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Rust Editor & Plugin</h1></header><h2 class="anchor anchorWithStickyNavbar_LWe7" id="pemilihan-editor-dan-plugin">Pemilihan editor dan plugin<a class="hash-link" href="#pemilihan-editor-dan-plugin" title="Direct link to heading">​</a></h2><p>Normalnya semua editor atau IDE bisa digunakan dalam penulisan kode program Rust. Namun development akan menjadi lebih mudah dan menyenangkan dengan bantuan Rust plugin.</p><p>Ada beberapa editor yang di-support secara official oleh Rust via plugin.</p><table><thead><tr><th align="left">Editor</th><th align="left">Plugin</th><th align="center">Link</th></tr></thead><tbody><tr><td align="left">VS Code</td><td align="left"><code>rust-analyzer</code></td><td align="center"><a href="https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer" target="_blank" rel="noopener noreferrer">plugin link</a></td></tr><tr><td align="left">Sublime Text</td><td align="left"><code>rust-enhanced</code></td><td align="center"><a href="https://github.com/rust-lang/rust-enhanced" target="_blank" rel="noopener noreferrer">plugin link</a></td></tr><tr><td align="left">Atom</td><td align="left"><code>atom-ide-rust</code></td><td align="center"><a href="https://github.com/rust-lang/atom-ide-rust" target="_blank" rel="noopener noreferrer">plugin link</a></td></tr><tr><td align="left">Intellij IDEA</td><td align="left"><code>Rust plugin</code></td><td align="center"><a href="https://plugins.jetbrains.com/plugin/8182-rust" target="_blank" rel="noopener noreferrer">plugin link</a></td></tr><tr><td align="left">Eclipse</td><td align="left"><code>Eclipse IDE for Rust Developers</code></td><td align="center"><a href="https://www.eclipse.org/downloads/packages/release/2019-09/r/eclipse-ide-rust-developers-includes-incubating-components" target="_blank" rel="noopener noreferrer">plugin link</a></td></tr><tr><td align="left">Vim</td><td align="left"><code>rust.vim</code></td><td align="center"><a href="https://github.com/rust-lang/rust.vim" target="_blank" rel="noopener noreferrer">plugin link</a></td></tr><tr><td align="left">Emacs</td><td align="left"><code>rust-mode</code></td><td align="center"><a href="https://github.com/rust-lang/rust-mode" target="_blank" rel="noopener noreferrer">plugin link</a></td></tr><tr><td align="left">Geany</td><td align="left">-</td><td align="center"><a href="https://geany.org/about/filetypes/" target="_blank" rel="noopener noreferrer">plugin link</a></td></tr></tbody></table><p>Silakan pilih editor sesuai preferensi, lalu install pluginnya. Untuk referensi lebih lanjut silakan navigasi ke <a href="https://www.rust-lang.org/tools" target="_blank" rel="noopener noreferrer">https://www.rust-lang.org/tools</a>.</p><p>Pada pembuatan ebook ini penulis menggunakan editor VS Code dengan plugin <a href="https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer" target="_blank" rel="noopener noreferrer">rust-analyzer</a> ter-install.</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="catatan-chapter-">Catatan chapter 📑<a class="hash-link" href="#catatan-chapter-" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="-referensi">◉ Referensi<a class="hash-link" href="#-referensi" title="Direct link to heading">​</a></h3><ul><li><a href="https://www.rust-lang.org/tools" target="_blank" rel="noopener noreferrer">https://www.rust-lang.org/tools</a></li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/installation/instalasi-rust"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Instalasi Rust</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/basic/hello-rust"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">A.1. Program Pertama ➜ Hello Rust</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#pemilihan-editor-dan-plugin" class="table-of-contents__link toc-highlight">Pemilihan editor dan plugin</a></li><li><a href="#catatan-chapter-" class="table-of-contents__link toc-highlight">Catatan chapter 📑</a><ul><li><a href="#-referensi" class="table-of-contents__link toc-highlight">◉ Referensi</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/intro.html b/intro.html index 79d162a9..39618cd2 100644 --- a/intro.html +++ b/intro.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/intro/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/intro/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"Dasar Pemrograman Rust","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/intro/#webpage"},"wordCount":0,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/intro/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/intro/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/intro","name":"Dasar Pemrograman Rust","description":"","datePublished":"2024-08-01T10:17:27.397Z","dateModified":"2024-08-01T10:17:27.397Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/intro/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/intro"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/intro/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"Dasar Pemrograman Rust","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/intro/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/intro/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"Dasar Pemrograman Rust","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/intro/#webpage"},"wordCount":0,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/intro/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/intro/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/intro","name":"Dasar Pemrograman Rust","description":"","datePublished":"2024-08-30T07:44:47.509Z","dateModified":"2024-08-30T07:44:47.509Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/intro/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/intro"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/intro/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"Dasar Pemrograman Rust","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> </div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/pengelanan-rust-programming.html b/pengelanan-rust-programming.html index ad57ada6..727a6825 100644 --- a/pengelanan-rust-programming.html +++ b/pengelanan-rust-programming.html @@ -7,14 +7,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> -<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/pengelanan-rust-programming/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/pengelanan-rust-programming/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"Pengenalan Rust Programming","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/pengelanan-rust-programming/#webpage"},"wordCount":89,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/pengelanan-rust-programming/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/pengelanan-rust-programming/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/pengelanan-rust-programming","name":"Pengenalan Rust Programming","description":"Rust adalah sebuah bahasa pemrograman general purpose yang fokus pada performance, type safety, dan concurrency. Bahasa ini diciptakan sebagai alternatif bahasa pemrograman yang berfokus pada hal-hal yang cukup low-level tapi tetap men-support fitur yang sifatnya high-level.","datePublished":"2024-08-01T10:17:31.839Z","dateModified":"2024-08-01T10:17:31.839Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/pengelanan-rust-programming/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/pengelanan-rust-programming"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/pengelanan-rust-programming/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"Pengenalan Rust Programming","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> +<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://dasarpemrogramanrust.novalagung.com/pengelanan-rust-programming/#article","isPartOf":{"@type":"WebPage","@id":"https://dasarpemrogramanrust.novalagung.com/pengelanan-rust-programming/#webpage"},"author":{"name":"Noval Agung Prayogo","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1"},"headline":"Pengenalan Rust Programming","mainEntityOfPage":{"@id":"https://dasarpemrogramanrust.novalagung.com/pengelanan-rust-programming/#webpage"},"wordCount":89,"publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"image":{"@id":"https://dasarpemrogramanrust.novalagung.com/pengelanan-rust-programming/#primaryimage"},"thumbnailUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","keywords":["rust"," belajar rust"," tutorial rust"," belajar tutorial rust gratis"," pemrograman rust"," cargo"," concurrent programming"," noval agung"],"articleSection":["Blog"],"inLanguage":"id"},{"@type":"WebPage","isPartOf":{"@id":"https://dasarpemrogramanrust.novalagung.com/#website"},"inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/pengelanan-rust-programming/#webpage","url":"https://dasarpemrogramanrust.novalagung.com/pengelanan-rust-programming","name":"Pengenalan Rust Programming","description":"Rust adalah sebuah bahasa pemrograman general purpose yang fokus pada performance, type safety, dan concurrency. Bahasa ini diciptakan sebagai alternatif bahasa pemrograman yang berfokus pada hal-hal yang cukup low-level tapi tetap men-support fitur yang sifatnya high-level.","datePublished":"2024-08-30T07:44:51.813Z","dateModified":"2024-08-30T07:44:51.813Z","breadcrumb":{"@id":"https://dasarpemrogramanrust.novalagung.com/pengelanan-rust-programming/#breadcrumb"},"potentialAction":[{"@type":"ReadAction","target":["https://dasarpemrogramanrust.novalagung.com/pengelanan-rust-programming"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/pengelanan-rust-programming/#primaryimage","url":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","contentUrl":"https://dasarpemrogramanrust.novalagung.com/img/cover_media_share.png","caption":"Pengenalan Rust Programming","width":1200,"height":627},{"@type":"WebSite","@id":"https://dasarpemrogramanrust.novalagung.com/#website","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","description":"Belajar Rust Mulai Dari 0, Gratis!","publisher":{"@id":"https://dasarpemrogramanrust.novalagung.com/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dasarpemrogramanrust.novalagung.com/search?q={searchTerms}"},"query-input":"required name=searchTerms"}],"inLanguage":"id"},{"@type":"Organization","@id":"https://dasarpemrogramanrust.novalagung.com/#organization","name":"Dasar Pemrograman Rust","url":"https://dasarpemrogramanrust.novalagung.com","sameAs":["https://web.facebook.com/adamstudio.page","https://www.instagram.com/adamstudio.ig","https://github.com/adamstudiogh","https://github.com/novalagung"],"contactPoint":{"@type":"ContactPoint","email":"hello@novalagung.com"},"logo":{"@type":"ImageObject","inLanguage":"id","@id":"adamstudio","url":"https://avatars.githubusercontent.com/u/65223287","contentUrl":"https://avatars.githubusercontent.com/u/65223287","width":1440,"height":900,"caption":"Adam Studio"}},{"@type":"Person","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/1","name":"Noval Agung Prayogo","image":{"@type":"ImageObject","inLanguage":"id","@id":"https://dasarpemrogramanrust.novalagung.com/#/schema/person/image/1","url":"https://i.stack.imgur.com/99yxf.jpg","contentUrl":"https://i.stack.imgur.com/99yxf.jpg","caption":"Noval Agung Prayogo"},"sameAs":["https://stackoverflow.com/users/1467988/novalagung","https://www.udemy.com/user/noval-agung-prayogo","https://apps.apple.com/id/developer/noval-agung-prayogo/id1163677873?l=id","https://novalagung.medium.com","https://adplist.org/mentors/noval-agung-prayogo","https://novalagung.com","https://linktr.ee/novalagung","https://www.instagram.com/novalagung","https://www.facebook.com/novalagungprayogo","https://www.codementor.io/@novalagung"],"url":"https://www.linkedin.com/in/novalagung"}]}</script></head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> <div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Dasar Pemrograman Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" href="/pengelanan-rust-programming">Pengenalan Rust Programming</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CHANGELOG">Version Changelogs & Updates</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/CONTRIBUTING">Contribution & Tech Stack</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/download-pdf">Download versi PDF</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/LICENSE">Lisensi & Distribusi Konten</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Persiapan dan Instalasi</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/instalasi-rust">Instalasi Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/installation/rust-editor-plugin">Rust Editor & Plugin</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link">Pemrograman Rust Dasar</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/hello-rust">A.1. Program Pertama ➜ Hello Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/build-dan-run-program-rust">A.2. Build dan Run Program Rust</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/komentar">A.3. Komentar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/variabel">A.4. Variabel</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-primitive-scalar">A.5. Tipe Data ➜ Primitive Scalar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-string-literal">A.6. Tipe Data ➜ String Literal (&str)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/konstanta">A.7. Konstanta</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator">A.8. Operator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/seleksi-kondisi-if">A.9. Seleksi Kondisi ➜ if, else if, else</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-while">A.10. Perulangan ➜ while</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-loop-break-continue-label">A.11. Perulangan ➜ loop, break, continue, label</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/perulangan-for-in">A.12. Perulangan ➜ for in</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/array">A.13. Array</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice">A.14. Slice (Basic)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tuple">A.15. Tuple</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/vector">A.16. Vector</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/function">A.17. Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/path-item">A.18. Module System ➜ Path & Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/package-crate">A.19. Module System ➜ Package & Crate</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-basic">A.20. Module System ➜ Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-inline">A.21. Module System ➜ Inline Module</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/module-scope-item-access">A.22. Module System ➜ Scope & Akses Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/struct">A.23. Struct</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/associated-function">A.24. Associated Function</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/method">A.25. Method</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/enum">A.26. Enum</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/type-alias-casting">A.27. Type Alias & Casting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/visibility-privacy">A.28. Module System ➜ Visibility & Privacy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/use">A.29. Module System ➜ Use, Import, Re-export</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/block-expression">A.30. Block Expression</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/shadowing">A.31. Shadowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/basic-memory-management">A.32. Basic Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pointer-references">A.33. Pointer & References</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/ownership">A.34. Ownership</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/borrowing">A.35. Borrowing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/traits">A.36. Traits</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/advanced-traits">A.37. Traits ➜ Advanced</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/generics">A.38. Generics</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/option-type">A.39. Tipe Data ➜ Option</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/result-type">A.40. Tipe Data ➜ Result</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/operator-tanda-tanya">A.41. Operator ?</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/pattern-matching">A.42. Pattern Matching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/static">A.43. Static Item</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/lifetime">A.44. Lifetime</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/slice-memory-management">A.45. Slice Memory Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/string-slice-vs-string-literal">A.46. String Literal (&str) vs. String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/tipe-data-custom-type-string-slice">A.47. Tipe Data ➜ String Custom Type</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/closures">A.48. Closures</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-function">A.49. Trait ➜ Function (Fn, FnMut, FnOnce)</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/trait-iterator">A.50. Trait ➜ Iterator</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/attributes">A.51. Attributes</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/datetime">A.52. Date Time</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/file-path-directory">A.53. File, Path, Directory</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/unrecoverable-panic-error">A.54. Error ➜ Unrecoverable Error / Panic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/basic/recoverable-error-handling">A.55. Error ➜ Recoverable Error & Error Handling</a></li></ul></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">Pengenalan Rust Programming</span><meta itemprop="position" content="1"></li></ul></nav><div class="theme-doc-markdown markdown"><header><h1>Pengenalan Rust Programming</h1></header><p>Rust adalah sebuah bahasa pemrograman general purpose yang fokus pada performance, type safety, dan concurrency. Bahasa ini diciptakan sebagai alternatif bahasa pemrograman yang berfokus pada hal-hal yang cukup low-level tapi tetap men-support fitur yang sifatnya high-level.</p><p>Rust dikembangkan oleh <a href="https://twitter.com/graydon_pub" target="_blank" rel="noopener noreferrer">Graydon Hoare</a> sewaktu ia masih bekerja di Mozilla pada tahun 2009, kemudian di-maintain di bawah naungan Rust Foundation hingga sekarang.</p><p>Rust memiliki beberapa kelebihan dibanding bahasa system-programming lainnya, yang di antaranya adalah:</p><ul><li>Keamanan memory yang sangat bagus, dengan pengecekan ada di waktu kompilasi</li><li>Ownership memory management</li><li>Type system (traits, generic, struct, dan lainnya)</li><li>Macros untuk metaprogramming</li><li>Tooling dan <code>std</code> library yang lengkap</li><li>Built-in package management tool (cargo & crates.io)</li><li>Efisien dan memiliki performa tinggi</li><li>Dukungan komunitas yang bagus. Banyak library open source yang tersedia</li></ul><p>Pada buku ini (terutama semua serial chapter A) kita akan belajar tentang dasar pemrograman Rust, mulai dari 0.</p></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dasar Pemrograman Rust</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/CHANGELOG"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Version Changelogs & Updates</div></a></nav></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body></html> \ No newline at end of file diff --git a/search.html b/search.html index 2a01aa36..4e7db5c0 100644 --- a/search.html +++ b/search.html @@ -9,14 +9,14 @@ <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-HKPC8ZGM74",{})</script> -<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.b9571daa.css"> -<link rel="preload" href="/assets/js/runtime~main.74e5229a.js" as="script"> -<link rel="preload" href="/assets/js/main.8355e625.js" as="script"> +<link rel="search" type="application/opensearchdescription+xml" title="Dasar Pemrograman Rust" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.c01241b2.css"> +<link rel="preload" href="/assets/js/runtime~main.d29c3922.js" as="script"> +<link rel="preload" href="/assets/js/main.945e59e1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> <div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_dark.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://dasarpemrogramanrust.novalagung.com/img/logo_small_light.png" alt="Dasar Pemrograman Rust - Belajar Rust Mulai Dari 0, Gratis!" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Dasar Pemrograman Rust</b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">📖 Webbook/Ebook</a><ul class="dropdown__menu"><li><a href="https://dasarpemrogramangolang.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Golang <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://dasarpemrogramanpython.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">Dasar Pemrograman Python <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://howto.novalagung.com" target="_blank" rel="noopener noreferrer" class="dropdown__link">How To <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">▶️ Udemy courses</a><ul class="dropdown__menu"><li><a href="https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/?couponCode=" target="_blank" rel="noopener noreferrer" class="dropdown__link">Udemy Course: Praktis Belajar Docker dan Kubernetes <svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div style="margin-top:8px;margin-right:15px"><a class="github-button" href="https://github.com/sponsors/novalagung" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @novalagung on GitHub">Sponsor</a> <a class="github-button" href="https://github.com/novalagung/dasarpemrogramanrust" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star novalagung/dasarpemrogramanrust on GitHub">Star</a> <a class="github-button" href="https://github.com/novalagung" data-size="large" aria-label="Follow @novalagung on GitHub">Follow @novalagung</a></div><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0"><div class="container margin-vert--lg"><h1>Search the documentation</h1><form class="row"><div class="col searchQueryColumn_RTkw col--12"><input type="search" name="q" class="searchQueryInput_u2C7" placeholder="Type your search here" aria-label="Search" autocomplete="off" autofocus=""></div></form><div class="row"><div class="col col--8 searchResultsColumn_JPFH"></div><div class="col col--4 text--right searchLogoColumn_rJIA"><a target="_blank" rel="noopener noreferrer" href="https://www.algolia.com/" aria-label="Search by Algolia"><svg viewBox="0 0 168 24" class="algoliaLogo_rT1R"><g fill="none"><path class="algoliaLogoPathFill_WdUC" d="M120.925 18.804c-4.386.02-4.386-3.54-4.386-4.106l-.007-13.336 2.675-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-10.846-2.18c.821 0 1.43-.047 1.855-.129v-2.719a6.334 6.334 0 0 0-1.574-.199 5.7 5.7 0 0 0-.897.069 2.699 2.699 0 0 0-.814.24c-.24.116-.439.28-.582.491-.15.212-.219.335-.219.656 0 .628.219.991.616 1.23s.938.362 1.615.362zm-.233-9.7c.883 0 1.629.109 2.231.328.602.218 1.088.525 1.444.915.363.396.609.922.76 1.483.157.56.232 1.175.232 1.85v6.874a32.5 32.5 0 0 1-1.868.314c-.834.123-1.772.185-2.813.185-.69 0-1.327-.069-1.895-.198a4.001 4.001 0 0 1-1.471-.636 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.803 0-.656.13-1.073.384-1.525a3.24 3.24 0 0 1 1.047-1.106c.445-.287.95-.492 1.532-.615a8.8 8.8 0 0 1 1.82-.185 8.404 8.404 0 0 1 1.972.24v-.438c0-.307-.035-.6-.11-.874a1.88 1.88 0 0 0-.384-.73 1.784 1.784 0 0 0-.724-.493 3.164 3.164 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.735 7.735 0 0 0-1.26.307l-.321-2.192c.335-.117.834-.233 1.478-.349a10.98 10.98 0 0 1 2.073-.178zm52.842 9.626c.822 0 1.43-.048 1.854-.13V13.7a6.347 6.347 0 0 0-1.574-.199c-.294 0-.595.021-.896.069a2.7 2.7 0 0 0-.814.24 1.46 1.46 0 0 0-.582.491c-.15.212-.218.335-.218.656 0 .628.218.991.615 1.23.404.245.938.362 1.615.362zm-.226-9.694c.883 0 1.629.108 2.231.327.602.219 1.088.526 1.444.915.355.39.609.923.759 1.483a6.8 6.8 0 0 1 .233 1.852v6.873c-.41.088-1.034.19-1.868.314-.834.123-1.772.184-2.813.184-.69 0-1.327-.068-1.895-.198a4.001 4.001 0 0 1-1.471-.635 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.804 0-.656.13-1.073.384-1.524.26-.45.608-.82 1.047-1.107.445-.286.95-.491 1.532-.614a8.803 8.803 0 0 1 2.751-.13c.329.034.671.096 1.04.185v-.437a3.3 3.3 0 0 0-.109-.875 1.873 1.873 0 0 0-.384-.731 1.784 1.784 0 0 0-.724-.492 3.165 3.165 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.75 7.75 0 0 0-1.26.307l-.321-2.193c.335-.116.834-.232 1.478-.348a11.633 11.633 0 0 1 2.073-.177zm-8.034-1.271a1.626 1.626 0 0 1-1.628-1.62c0-.895.725-1.62 1.628-1.62.904 0 1.63.725 1.63 1.62 0 .895-.733 1.62-1.63 1.62zm1.348 13.22h-2.689V7.27l2.69-.423v11.956zm-4.714 0c-4.386.02-4.386-3.54-4.386-4.107l-.008-13.336 2.676-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-8.698-5.903c0-1.156-.253-2.119-.746-2.788-.493-.677-1.183-1.01-2.067-1.01-.882 0-1.574.333-2.065 1.01-.493.676-.733 1.632-.733 2.788 0 1.168.246 1.953.74 2.63.492.683 1.183 1.018 2.066 1.018.882 0 1.574-.342 2.067-1.019.492-.683.738-1.46.738-2.63zm2.737-.007c0 .902-.13 1.584-.397 2.33a5.52 5.52 0 0 1-1.128 1.906 4.986 4.986 0 0 1-1.752 1.223c-.685.286-1.739.45-2.265.45-.528-.006-1.574-.157-2.252-.45a5.096 5.096 0 0 1-1.744-1.223c-.487-.527-.863-1.162-1.137-1.906a6.345 6.345 0 0 1-.41-2.33c0-.902.123-1.77.397-2.508a5.554 5.554 0 0 1 1.15-1.892 5.133 5.133 0 0 1 1.75-1.216c.679-.287 1.425-.423 2.232-.423.808 0 1.553.142 2.237.423a4.88 4.88 0 0 1 1.753 1.216 5.644 5.644 0 0 1 1.135 1.892c.287.738.431 1.606.431 2.508zm-20.138 0c0 1.12.246 2.363.738 2.882.493.52 1.13.78 1.91.78.424 0 .828-.062 1.204-.178.377-.116.677-.253.917-.417V9.33a10.476 10.476 0 0 0-1.766-.226c-.971-.028-1.71.37-2.23 1.004-.513.636-.773 1.75-.773 2.788zm7.438 5.274c0 1.824-.466 3.156-1.404 4.004-.936.846-2.367 1.27-4.296 1.27-.705 0-2.17-.137-3.34-.396l.431-2.118c.98.205 2.272.26 2.95.26 1.074 0 1.84-.219 2.299-.656.459-.437.684-1.086.684-1.948v-.437a8.07 8.07 0 0 1-1.047.397c-.43.13-.93.198-1.492.198-.739 0-1.41-.116-2.018-.349a4.206 4.206 0 0 1-1.567-1.025c-.431-.45-.774-1.017-1.013-1.694-.24-.677-.363-1.885-.363-2.773 0-.834.13-1.88.384-2.577.26-.696.629-1.298 1.129-1.796.493-.498 1.095-.881 1.8-1.162a6.605 6.605 0 0 1 2.428-.457c.87 0 1.67.109 2.45.24.78.129 1.444.265 1.985.415V18.17zM6.972 6.677v1.627c-.712-.446-1.52-.67-2.425-.67-.585 0-1.045.13-1.38.391a1.24 1.24 0 0 0-.502 1.03c0 .425.164.765.494 1.02.33.256.835.532 1.516.83.447.192.795.356 1.045.495.25.138.537.332.862.582.324.25.563.548.718.894.154.345.23.741.23 1.188 0 .947-.334 1.691-1.004 2.234-.67.542-1.537.814-2.601.814-1.18 0-2.16-.229-2.936-.686v-1.708c.84.628 1.814.942 2.92.942.585 0 1.048-.136 1.388-.407.34-.271.51-.646.51-1.125 0-.287-.1-.55-.302-.79-.203-.24-.42-.42-.655-.542-.234-.123-.585-.29-1.053-.503a61.27 61.27 0 0 1-.582-.271 13.67 13.67 0 0 1-.55-.287 4.275 4.275 0 0 1-.567-.351 6.92 6.92 0 0 1-.455-.4c-.18-.17-.31-.34-.39-.51-.08-.17-.155-.37-.224-.598a2.553 2.553 0 0 1-.104-.742c0-.915.333-1.638.998-2.17.664-.532 1.523-.798 2.576-.798.968 0 1.793.17 2.473.51zm7.468 5.696v-.287c-.022-.607-.187-1.088-.495-1.444-.309-.357-.75-.535-1.324-.535-.532 0-.99.194-1.373.583-.382.388-.622.949-.717 1.683h3.909zm1.005 2.792v1.404c-.596.34-1.383.51-2.362.51-1.255 0-2.255-.377-3-1.132-.744-.755-1.116-1.744-1.116-2.968 0-1.297.34-2.316 1.021-3.055.68-.74 1.548-1.11 2.6-1.11 1.033 0 1.852.323 2.458.966.606.644.91 1.572.91 2.784 0 .33-.033.676-.096 1.038h-5.314c.107.702.405 1.239.894 1.611.49.372 1.106.558 1.85.558.862 0 1.58-.202 2.155-.606zm6.605-1.77h-1.212c-.596 0-1.045.116-1.349.35-.303.234-.454.532-.454.894 0 .372.117.664.35.877.235.213.575.32 1.022.32.51 0 .912-.142 1.204-.424.293-.281.44-.651.44-1.108v-.91zm-4.068-2.554V9.325c.627-.361 1.457-.542 2.489-.542 2.116 0 3.175 1.026 3.175 3.08V17h-1.548v-.957c-.415.68-1.143 1.02-2.186 1.02-.766 0-1.38-.22-1.843-.661-.462-.442-.694-1.003-.694-1.684 0-.776.293-1.38.878-1.81.585-.431 1.404-.647 2.457-.647h1.34V11.8c0-.554-.133-.971-.399-1.253-.266-.282-.707-.423-1.324-.423a4.07 4.07 0 0 0-2.345.718zm9.333-1.93v1.42c.394-1 1.101-1.5 2.123-1.5.148 0 .313.016.494.048v1.531a1.885 1.885 0 0 0-.75-.143c-.542 0-.989.24-1.34.718-.351.479-.527 1.048-.527 1.707V17h-1.563V8.91h1.563zm5.01 4.084c.022.82.272 1.492.75 2.019.479.526 1.15.79 2.01.79.639 0 1.235-.176 1.788-.527v1.404c-.521.319-1.186.479-1.995.479-1.265 0-2.276-.4-3.031-1.197-.755-.798-1.133-1.792-1.133-2.984 0-1.16.38-2.151 1.14-2.975.761-.825 1.79-1.237 3.088-1.237.702 0 1.346.149 1.93.447v1.436a3.242 3.242 0 0 0-1.77-.495c-.84 0-1.513.266-2.019.798-.505.532-.758 1.213-.758 2.042zM40.24 5.72v4.579c.458-1 1.293-1.5 2.505-1.5.787 0 1.42.245 1.899.734.479.49.718 1.17.718 2.042V17h-1.564v-5.106c0-.553-.14-.98-.422-1.284-.282-.303-.652-.455-1.11-.455-.531 0-1.002.202-1.411.606-.41.405-.615 1.022-.615 1.851V17h-1.563V5.72h1.563zm14.966 10.02c.596 0 1.096-.253 1.5-.758.404-.506.606-1.157.606-1.955 0-.915-.202-1.62-.606-2.114-.404-.495-.92-.742-1.548-.742-.553 0-1.05.224-1.491.67-.442.447-.662 1.133-.662 2.058 0 .958.212 1.67.638 2.138.425.469.946.703 1.563.703zM53.004 5.72v4.42c.574-.894 1.388-1.341 2.44-1.341 1.022 0 1.857.383 2.506 1.149.649.766.973 1.781.973 3.047 0 1.138-.309 2.109-.925 2.912-.617.803-1.463 1.205-2.537 1.205-1.075 0-1.894-.447-2.457-1.34V17h-1.58V5.72h1.58zm9.908 11.104l-3.223-7.913h1.739l1.005 2.632 1.26 3.415c.096-.32.48-1.458 1.15-3.415l.909-2.632h1.66l-2.92 7.866c-.777 2.074-1.963 3.11-3.559 3.11a2.92 2.92 0 0 1-.734-.079v-1.34c.17.042.351.064.543.064 1.032 0 1.755-.57 2.17-1.708z"></path><path fill="#5468FF" d="M78.988.938h16.594a2.968 2.968 0 0 1 2.966 2.966V20.5a2.967 2.967 0 0 1-2.966 2.964H78.988a2.967 2.967 0 0 1-2.966-2.964V3.897A2.961 2.961 0 0 1 78.988.938z"></path><path fill="white" d="M89.632 5.967v-.772a.978.978 0 0 0-.978-.977h-2.28a.978.978 0 0 0-.978.977v.793c0 .088.082.15.171.13a7.127 7.127 0 0 1 1.984-.28c.65 0 1.295.088 1.917.259.082.02.164-.04.164-.13m-6.248 1.01l-.39-.389a.977.977 0 0 0-1.382 0l-.465.465a.973.973 0 0 0 0 1.38l.383.383c.062.061.15.047.205-.014.226-.307.472-.601.746-.874.281-.28.568-.526.883-.751.068-.042.075-.137.02-.2m4.16 2.453v3.341c0 .096.104.165.192.117l2.97-1.537c.068-.034.089-.117.055-.184a3.695 3.695 0 0 0-3.08-1.866c-.068 0-.136.054-.136.13m0 8.048a4.489 4.489 0 0 1-4.49-4.482 4.488 4.488 0 0 1 4.49-4.482 4.488 4.488 0 0 1 4.489 4.482 4.484 4.484 0 0 1-4.49 4.482m0-10.85a6.363 6.363 0 1 0 0 12.729 6.37 6.37 0 0 0 6.372-6.368 6.358 6.358 0 0 0-6.371-6.36"></path></g></svg></a></div></div></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">2024 | Maintained by Noval Agung Prayogo</div></div></div></footer></div> -<script src="/assets/js/runtime~main.74e5229a.js"></script> -<script src="/assets/js/main.8355e625.js"></script> +<script src="/assets/js/runtime~main.d29c3922.js"></script> +<script src="/assets/js/main.945e59e1.js"></script> </body> </html> \ No newline at end of file